|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Another Alternate table-row background color quest
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:variable name="r"> <xsl:copy-of select="Codes/Code[Name = 30 ... etc]"/> </xsl:variable> <xsl:for-each select="node-set($r)"> //.. do something with . </xsl:for-each> node-set comes into play because what's held in $r is a "result tree fragment", which needs to be converted to a "nodeset" before it may be iterated over, etc. I gather that XSLT 2.0 has features that obviate this step. Regards, --A
_________________________________________________________________ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








