4 messages in com.googlegroups.google-gadgets-apiRe: NXSL and alternating row color
FromSent OnAttachments
paru...@gmail.com06 Mar 2006 13:54 
mesch06 Mar 2006 14:27 
paru...@gmail.com06 Mar 2006 19:54 
mesch07 Mar 2006 14:19 
Subject:Re: NXSL and alternating row color
From:mesch (stef@gmail.com)
Date:03/07/2006 02:19:20 PM
List:com.googlegroups.google-gadgets-api

There are two solutions to your problem:

1. Avoid the additional select attribute, so that the position() in the span "sees" the position of the div:

<div select="item" values="class:ext-if(position() mod 2 = 0,'white','green')"> <span values"id:position()" content="name"></span> </div>

2. Remember the position() of the div in a variable and use the variable in the span:

<div select="item" values="class:ext-if(position() mod 2 = 0,'white','green');$position:position()"> <span select="name" values"id:$position" content="."></span> </div>

The XPath function position() returns the position of the current node in the current node set. Every select attribute establishes a context with a new node set in which XPath expressions are evaluated.