xsl-list
[Top] [All Lists]

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

2007-03-19 05:54:23

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[(_at_)test='yes']/../preceding-sibling::ROW/CELL[position()=count(//CELL[(_at_)test='yes']/preceding-sibling::CELL)+1]

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--