|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Alternating row background color - a twist
The typical way of alternating the background color of every other row in an HTML table is something like this: <xsl:for-each select="msxsl:node-set($sorted_legislators)"> <tr> <xsl:if test="position() mod 2 = 0"> <xsl:attribute name="bgcolor">#eeeeee</xsl:attribute> </xsl:if> ------------------------------------ My situation is this - the for-each is based on legislators sorted by district - here's a sample (not real) xml to illustrate: <legislators> <legislator> <name>Joe</name> <district_id>1</district_id> </legislator> <legislator> <name>Bob</name> <district_id>2</district_id> </legislator> <legislator> <name>Pete</name> <district_id>2</district_id> </legislator> </legislators> There will be one *or more* legislators for each district. Instead of alternating the background color for every *legislator*, I want to alternate the background color for every *district*. In other words, I want Joe in district_id 1 to have white background, but I want both Bob and Pete in district_id 2 to have a gray background. But since I can't change the value of a variable (can't increment a counter), I don't know what I can base the bgcolor alternation on. The xsl:for-each is based on a select of a variable containing all legislators sorted by district. I know there is probably an easy way to do this, but I don't know it. Help! Thanks. Hardy Merrill
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. 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
|







