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

Re: position() problem

Subject: Re: position() problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 11 Jul 2006 14:40:30 +0100
xpath position 1
> I have a problem with position(). I know that its value is the position
> of the context node.

not really, the number returned by position() is not a property of the
node, the same node will have different position() depending on how it
was selected. For example if it is selected with select="." it will have

> Having selected a token/@pos='N' I'd like to select its
> following sibling token/@pos='N' if and only if it is in a specified
> distance (e.g., 5 tokens away).

selects the following six elements, so
selects the first of those (if there is one) with @pos='N' (note how
position() changes value for a given node even within the same path

> If both tokens are in the specified distance all tokens should be
> displayed (starting from N1 up to N2 with all other tokens between them).

a bit easier to say that in xpath 2 than xpath 1, but in xpath 1
probably you's do something like
<xsl:variable name="next" 
<xsl:if test="$next">
<xsl:for-each select="following-sibling::*[generate-id(following-sibling::*[@pos='N'])=generate-id($next)"/>


Current Thread


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.
First Name
Last Name
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.