Re: two-toned background....

Subject: Re: two-toned background....
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 29 Aug 2000 16:03:27 -0600 (MDT)
Dickson, Dan wrote:
> i am formatting a report so that it has a two-colored background,
> alternating grey & white using two CSS classnames class1 and class2 in HTML
> table <TD> tags.

so like each column is alternating grey and white?

> to get class1 or class2 in my XSL i do: select="position() mod 2" in the
> attribute of the TD tag and paste the 1 or 2 to the word 'class'

that sounds right. something like

<td class="class{position() mod 2}">
 ...
</td>

> the problem i am having is that my XML structure is about 4 levels deep, and
> I need to know the position() for members that are BELOW the first <TD> in
> each row (if that makes any sense...in other words i need to put the same
> position() mod value for each <TD> in a given <TR>, but how can i "carry"
> this value between different nodesets in the XML document hierarchy?).

position() is always the position of the current node, relative to the
nodes in the current node list, which were selected in the most recent
xsl:apply-templates or xsl:for-each.

if the current node list keeps changing from one row to the next, you
still have the node for the first column at position 1, the node for the
second column at position 2, etc., so without seeing your XML, XSLT and
what output you're really trying to produce, i can only guess at what the
problem might be. perhaps you aren't selecting ideal node-sets.

(x)html table construction with xslt is always a fun exercise in
inside-out logic...

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


Current Thread