[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: limit count() to nodes with a position() < the

Subject: RE: limit count() to nodes with a position() < the postion of the current node
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 9 Sep 2003 09:30:57 +0100
position lt
> But I want to take this one step further and return the count 
> of all nodes 
> that have a position() that is less than the position of the 
> current node. 
> Taking the position() of the context node out of the equation 
> I thought it 
> would as simple as this (I used 5 as a test parameter)...

Nodes do not "have a position()". The result of the position() function
is context dependent: it returns the position of the current node in the
current node list, and the current node list depends on how you reached
the node in your processing.

I suspect that you are using "the position of a node" to mean something
like "the number of preceding siblings of the node", which is
count(preceding-sibling::node()).

Michael Kay


> 
> <xsl:key name="linkCount" match="lid[position() &lt; 5]" use="."/>
> 
> 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.  But 
> it didn't.  It 
> returned the total count for the entire xml tree.
> 
> So, my questions are...  1)What do I need to change to get 
> the above example 
> to work and 2)How could I then take it one step further and use the 
> position() of the current context node as the parameter to 
> test against the 
> position() of the test nodes?
> 
> Your help is much appreciated!
> 
> Best Regards,
> 
> M.David 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.