[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] position of the parents node -> XSLT1.1


Subject: Re: [xsl] position of the parents node -> XSLT1.1
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 9 May 2006 13:29:33 +0100

Note that there will never be an XSL 1.1 the working draft was withdrawn
and the working group decided to work on XSLT2 (which is almost, but not
quite, now finalised) So it's best not to rely on features in the 1.1
draft (although saxon 6 does implement them if you specify version=1.1
in the stylesheet)

> Xpath's like this "parent::position()" dont'nt work. 

 You can't, in XSLT1, use a function returning an integer as a step of an
 XPath, and (in XSLT 1 and 2) you can only use a node name and not a
 function after an axis such as parent::


However you do not want the position() function at all, which is
unrelated to the position of a node in the input, it just relates to the
position in the current node list. So for example if you select a node
with parent::* it will always have position()=1 as there is only one
node selected.

I think you want the number of preceding sibling elements of the parent, which
is
select="count(../preceding-sibling::*)+1"

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords