This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Alternating Colors For Table Rows
Hmm, looks like my explanatory table got wrapped, at least in my email
client. Let me try it again:
> Simple, eh? Here's how it works. Say n=3. then
>
position() position() mod $n position() mod (2$n)
0 0 0
1 1 1
2 2 2
-----------------------------------------------------------
3 0 3
4 1 4
5 2 5
---------------------------------------------------------
6 0 0
7 1 1
8 2 2
---------------------------------------------------------
9 0 3
etc.
> See how it works?
>
> In practice, position() is 1-based, not zero-based, so you have to use
> (position()-1). In fact, I found that I actually had to use
> number(position()) -1.
>
Sorry about the earlier one.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list