Yep, that works. Thanks for your help.

Best Regards,
J


-----Original Message-----
From: Scott Warren [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 4:33 PM
To: [EMAIL PROTECTED]
Subject: Re: XSP All Nodes Even


No not a second stylesheet,  Change your stylesheet to be like this


<xsl:template match="table">
 <xsl:for-each select="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:for-each>
</xsl:template>

Where table is assumed to be the parent node of all the tr nodes. 

Does this help ?

Scott Warren

Jacob Arnold wrote:

If my query returns 56 records (1 per row) then I get 2, 4, 6, 8, 10...
through 114. Are you suggesting adding a second stylesheet?

Thanks,
J


-----Original Message-----
From: Scott Warren [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 4:22 PM
To: [EMAIL PROTECTED]
Subject: Re: XSP All Nodes Even


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]>

Reply via email to