Re: [xsl] finding position() in xpath 1.0

Subject: Re: [xsl] finding position() in xpath 1.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 19 Mar 2007 12:54:02 GMT
> but i know current() is not valid there because it's 2.0.
No, it's not in Xpath 2 either. It's an XSLT-supplied function only
available in XSLT implementations of XPath (both versions 1 and 2)
It wouldn't do what you want actually, as it returns the position of the
node at the start of the expression evaluation, which is probably / with
position 1 in this case.


Almost certainly any host language that allows you to call xpath will
allow you to bind variables, so the following isn't needed, but it is, I
think, what you asked for.

//CELL[@test='yes']/../preceding-sibling::ROW/CELL[position()=count(//CELL[@test='yes']/preceding-sibling::CELL)+1]

David

Current Thread