Re: [xsl] how to get position of node in node-set

Subject: Re: [xsl] how to get position of node in node-set
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 11 Sep 2003 17:32:48 +0100
Node sets are sets and so don't have an intrinsic order.
So nodes don't really have a position in a set (you can't for example
sort the nodes and save the sorted list in a set)
You can ask what is the position if the nodes in the set were sorted
into document order, although actually it's not so easy.
If the nodes are siblings and you are on <entry text="ccc"/>
then you want 
however you only want to count nodes that are in $legend
so that would be
if your text attribute uniquely determines the node, or something like

They are all pure xpath solutions, or you could use xsl, as in

<xsl:for-each select="$legend">
<xsl:if test="@text='ccc'"><xsl:value-of select="position()"/></xsl:if>


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread