Re: [xsl] limit count() to nodes with a position() < the postion of the current node

Subject: Re: [xsl] limit count() to nodes with a position() < the postion of the current node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 9 Sep 2003 09:57:57 +0100
> But I want to take this one step further and return the count of all nodes 
> that have a position()

Note that position() is not a property of the node, like name() it is a
function of the node and of the current node list that is being
processed. if you select  nodes with parent:: axis for example,
position() is always one.

<xsl:key name="linkCount" match="lid[position() &lt; 5]" use="."/>

That will index all lid elements that have less than four previous
sibling lid elements. Isn't that what you want?


> I expected it to return the count of the nodes that matched the current 
> context node as long as there postion was less than 5. 

It's hard to interpret this as a xsl:key itself doesn't return anything
and as I say above position() isn't a property of a node.

As xsl:key has to be top level the current context node is the root /
at that point.

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread