This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Position() of parent node
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Position() of parent node
- From: Joe English <jenglish at flightlab dot com>
- Date: Tue, 06 Feb 2001 13:41:59 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
Simon Cansick wrote:
> Can anyone provide me with the syntax for getting the position() value of
> the current nodes' parent node (and the parent parent etc. position()
> value). I seem only able to return the current position().
The position() is not an intrinsic property of a node --
it only makes sense to ask for the position() of a node
_in the context of some node list_ [*].
Most likely you want the position of the parent node with
respect to its siblings, in document order; you can compute
this with:
1 + count(parent::*/preceding-sibling::*)
--Joe English
jenglish@flightlab.com
[*] I'm using the term "node list" to mean "a node set with
an associated order", e.g., proximity position order,
document order, an <xsl:sort...>-defined order, etc.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list