Subject: RE: [xsl] Another Alternate table-row background color question - Using filters From: "Aron Bock" <aronbock@xxxxxxxxxxx> Date: Mon, 30 May 2005 21:26:52 +0000 |
stylesheet will extract only some information (filter) from the XML and create a table. I want the rows in this table to have alternate background color. Because of the filter condition in the XSL, I cannot use the position() to check for odd/even rows. I need to (essentially) check the row number inserted into the HTML <TABLE>.
Here're 2 XSLT 1.0 options: split the transform into 2 stylesheets--the first picks out only the rows you want, and the second formats them into HTML, this time using position() to determine even/odd rows. Alternatively you could do this in 1 stylesheet if you're willingto use an extension function such as node-set(). The idea here is to create a variable containing the rows you want, then to iterate rows inthis variable, this time using position(). Something like so:
<xsl:template match="Code"> <xsl:copy> <xsl:attribute name="color"> <xsl:value-of select="(position() - 1) mod 2"/> </xsl:attribute> <xsl:copy-of select="*"/> </xsl:copy> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Another Alternate table-r, Aron Bock | Thread | Re: [xsl] Another Alternate table-r, Dimitre Novatchev |
[xsl] EXSLT for MSXML4 (Was: Re: [x, Dimitre Novatchev | Date | [xsl] template name in attributes, Luke Ambrogio |
Month |