Subject: Re: [xsl] 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 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] position() from the attri, Michael Kay | Thread | Re: [xsl] position() from the attri, Andrew Welch |
RE: [xsl] position() from the attri, Michael Kay | Date | Re: [xsl] position() from the attri, Andrew Welch |
Month |