RE: [xsl] counter in xsl

Subject: RE: [xsl] counter in xsl
From: "David B. Bitton" <david@xxxxxxxxxxxxxx>
Date: Fri, 08 Feb 2002 09:40:16 -0500
You can't, but this is how you can implement alternating row color (as
this is how I do it).  In your for-each, do this...

<xsl:for-each ... >
	<tr class="row{position() mod 2}">
		...
	</tr>
</xsl:for-each>

Now, each odd row is class="row1" and each even row is class=row0".  The
only this left to do is define these classes in a CSS style block or
sheet, like so:

<style>
	.row1 { background-color:green; color:white }
	.row0 { background-color:white; color:black }
</style>

The { and } work almost like an eval statement would (almost). :)

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> thenewmatrix@xxxxxxxx
> Sent: Friday, February 08, 2002 4:35 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] counter in xsl
> 
> 
> How can i create a counter into xsl due to insert alternate 
> color in table-row???
> 
> Thanks.
> 
> Connettiti con Genie.it e vinci una fantastica Mini! E' 
> facile clicca qui http://www.genie.it/geniemini
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread