[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

alternating bg colour in nested data

Subject: alternating bg colour in nested data
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jan 2002 17:51:21 -0000
bg colour
Hi all,

Im trying to get alternating table row background colours from nested xml.

The xml is essentially nested groups.  1 contains 2,3 and 4. 2 contains 3
and 4 and so on.

(This indicates that a group belongs to its parent and will be rendered
expandable-collapsable-windows-explorer stylee)

For example:


I currently get alternating row colours using this kind of template for each

<xsl:template match="group1">
<xsl:variable name="position" select="position()" />
  <xsl:when test="$position mod 2 = 1">
    <xsl:call-template name="row_even"/>
    <xsl:call-template name="row_odd"/>
<xsl:apply-templates select="group2"/>

Each template is virtually identical apart from the 'groupX' number. Also,
occasionally two adjacent rows share the same colour (where group changes
and last elem pos was even)

Is there any way I can reduce the duplication in each template, and sort out
the ocassional lapse in alternating  colours?




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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.