cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v.@sevencs.com
Subject problem transforming elements
Date Fri, 19 Dec 2003 09:58:17 GMT
Hi all!

I have problems transforming a xml element
which was created inside a stylesheet. When
I look at the xml right after the first
transform, the element is present. In a
subsequent transform I need to process this
element, but the node cannot be accessed in
the second stylesheet.

What am I doing wrong?

All suggestions are appreciated!
Thanks in advance,
Nele.


+-----------------------------------------+
| directories within COCOON context       |
+-----------------------------------------+
/cocoon
+---/myRootDir
    +---/mySubDir
        +---/myContentDir
            +---file1.xml
            +---file2.xml
            +---file3.xml
        +---sitemap.xmap
    +---sitemap.xmap
+---/styles
    +---cincludeFiles.xsl
    +---content2page.xsl
+---sitemap.xmap (Cocoon)


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


+-----------------------------------------+
| sitemap snippet in folder "mySubDir"    |
+-----------------------------------------+
<map:match pattern="content">
  <map:generate src="context://myRootDir/mySubDir/myContentDir"
    type="directory">
    <map:parameter name="depth" value="1"/>
  </map:generate>
  <map:transform src="context://myRootDir/styles/cincludeFiles.xsl">
    <map:parameter name="part" value="{0}"/>
  </map:transform>
  <map:transform type="cinclude"/>
  <map:transform src="context://myRootDir/styles/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.

Please help!

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


Mime
View raw message