cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
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,

| directories within COCOON context       |
+---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"
    <map:parameter name="depth" value="1"/>
  <map:transform src="context://myRootDir/styles/cincludeFiles.xsl">
    <map:parameter name="part" value="{0}"/>
  <map:transform type="cinclude"/>
  <map:transform src="context://myRootDir/styles/content2page.xsl"/>
  <map:serialize type="xml"/>

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"/>
  <cinclude:include src="{$path}"/>

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"/>

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="."/>

Doesn't work either.

Please help!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message