Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XML/XSL Sequence Numbers >Thread Next - Re: XML/XSL Sequence Numbers Re: XML/XSL Sequence NumbersTo: NULL Date: 8/3/2006 8:16:00 PM HugeBob wrote: > I've got a successful XSL file working that generates a table. I want > to be able to perform alternate background colors for the table's rows. > How can I count the rows generated by the table and then determine if > that number is even/odd? Usually you have some elements in the XML input that correspond to the table rows, e.g. some item elements. When you process these with either <xsd:for-each select="item"> or <xsl:apply-templates select="item"/> to create the rows you can simply use the position function to check whether it is an even or odd position position() mod 2 = 0 Use that test to generate an attribute for the background color or for the corresponding style class. -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
