Re: finding position() in xpath 1.0
Note that I tried to correct David with removing the '+1' with a self-test. But that's not needed. David's last solution is perfect and comes down to about the same I invented (it almost looked like David and I were in the same room: even the sample input and test template about matched!), but mine is a bit overly complicated.
(the reason that you can use +1 safely is that you are already walking from the path CELL[@test='yes'], which means that once the path matches, you are certain the +1 is correct)
About the 'magic', I usually do a mind-treewalk while dissecting a path. I imaging being some place on the XML tree and then walk the steps I wrote down in the XPath. Then suddenly the 'magic' goes and it all seems so logical.
Cheers, -- Abel
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format