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

Re: position() from the attribute axis for getting the

Subject: Re: position() from the attribute axis for getting the position of the parent in respect to its siblings
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 18 Jan 2007 11:35:38 GMT
Re:  position() from the attribute axis for getting the
> Somehow, I understood that position() retrieves the position of the 
> context node relative to its siblings,

I'm not sure why, but this seems to be a common misunderstanding about
position(). position() has _no_ relationship to the position of a node
in a source document, it just relates to the position of a node in the
current node list (in xslt 1) or the current item in the current
sequence (in xslt2).

If you select a node with parent::* then it will have position()= 1
always as there is only one node in the node list and the selected node
is therefoe always the first in the list, even if it has 1001 earlier
siblings.

I'm not sure what number you want, probably 
<xsl:number/> or count(preceding-sibling::*)+1


see also

http://www.dpawson.co.uk/xsl/sect2/N6099.html#d8191e311


David

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.