What is the value that position() is returning? Can you move the template into a another template that has a <xsl:for-each select="tr"> I think you may get different results then.

Hope this helps

Scott Warren

Jacob Arnold wrote:

Whenever I test for even nodes using XSLT on my serialized XSP, all the
nodes are even. For example, I'm trying to make every even table row a
different color:

<xsl:template match="tr">
<xsl:if test="position() mod 2 = 0">
<tr class="evenrow"><xsl:apply-templates/></tr>
</xsl:if>
<xsl:if test="position() mod 2 = 1">
<tr class="oddrow"><xsl:apply-templates/></tr>
</xsl:if>
</xsl:template>

But every table row is getting the evenrow class applied. When I display the
position, every row (and every <td> for that matter) is even-numbered. Does
anyone know what might be causing this?

Here's a sitemap fragment:

<map:match pattern="**.xsp">
<map:act type="resource-exists">
<map:parameter name="url" value="docs/{1}.xsp"/>
<map:generate src="docs/{../1}.xsp" type="serverpages"/>
<map:serialize/>
</map:act>
<map:generate src="docs/404.xsp"/>
<map:transform src="stylesheets/encode-html.xsl"/>
<map:serialize/>
</map:match>

<map:match pattern="**.html">
<map:aggregate element="document">
<map:part src="cocoon:/menu.xsp" strip-root="true"/>
<map:part src="cocoon:/{1}.xsp" strip-root="true"/>
</map:aggregate>
<map:transform src="stylesheets/encode-html.xsl"/>
<map:serialize/>
</map:match>

I'm using Cocoon 2.0.4 on Tomcat 4.1.12.

Thanks,
J

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>





---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to