[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: finding position() in xpath 1.0

Subject: Re: finding position() in xpath 1.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 19 Mar 2007 12:54:02 GMT
Re:  finding position() in xpath 1.0
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.