cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v.@sevencs.com
Subject content aggregation + links to used files
Date Mon, 05 Jan 2004 10:11:05 GMT
Hi all!

I want to create an xml document by extracting
defined elements from files conforming to a
known format. When assembling the document I need
to keep in mind which element originates from
which file to be able to link the element with
the corresponding file after transformation into
HTML. The resulting HTML document consists - among
other things - of links to all processed files.

How do I achieve this with Cocoon?

All suggestions will be appreciated!
Thanks in advance,
Nele.


I tried the following using a directory generator
and aggregation, but it doesn't work.

+-----------------------------------------+
| directories within COCOON context       |
+-----------------------------------------+
+---myContentDir/
    +---file1.xml
    +---file2.xml
    +---file3.xml


I aggregate the files in "myContentDir" using the
following sitemap snippet:

+-----------------------------------------+
| sitemap snippet                         |
+-----------------------------------------+
<map:match pattern="content">
  <map:generate src="/myContentDir" type="directory">
    <map:parameter name="depth" value="1"/>
  </map:generate>
  <map:transform src="cincludeFiles.xsl">
    <map:parameter name="part" value="content"/>
  </map:transform>
  <map:transform type="cinclude"/>
  <map:transform src="content2page.xsl"/>
  <map:serialize type="xml"/>
</map:match>


Within the stylesheet "cincludeFiles.xsl", I transform the
xml stream coming from the directory generator. Iteratively
all files are inserted by <cinclude:include src="{$path}"/>.
An element named "file" with an attribute "path" is created.

+-----------------------------------------+
| stylesheet snippet "cincludeFiles.xsl"  |
+-----------------------------------------+
<xsl:template match="dir:file">
  <xsl:param name="path"/>
  <xsl:element name="file">
    <xsl:attribute name="path">
      <xsl:value-of select="$path"/>
    </xsl:attribute>
  <cinclude:include src="{$path}"/>
  </xsl:element>
</xsl:template>


The transform outputs the following
([...] stands for more xml elements):

[...]
  <file path="myContentDir/file1.xml">[...]</file>
  <file path="myContentDir/file2.xml">[...]</file>
  <file path="myContentDir/file3.xml">[...]</file>
[...]


+-----------------------------------------+
| stylesheet snippet "content2page.xsl"   |
+-----------------------------------------+
<xsl:template match="file">
  <xsl:text>following file was added:</xsl:text>
  <xsl:value-of select="./@path"/>
</xsl:template>

When I try to read the attribute value "path", my
stylesheet outputs nothing.

<xsl:template match="@path">
  <xsl:text>following file was added:</xsl:text>
  <xsl:value-of select="."/>
</xsl:template>

Doesn't work either.

This is really urgent. Thanks for your help!



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message