In XPath 1.0 there's a function current() that comes in handy when I refer to a node somewhere else in the XML based on the node I'm in at the moment. My XML has a structure like this:
<root> <book> <chapter> <section> <para> <image id="1">1.png</image> </para> </section> </chapter> </book> <objects> <Object> <ID>1</ID> </Object> </objects> </root> When I process the para nodes in book, I sometimes use XPath expressions like this one to look up information in the objects nodes:
Object[ID=current()/descendant::image[1]/@id] When I switch my parser to XPath 2.0, this expression gives an error (function current is not available).
I've done some searching, but haven't been able to find a straight replacement for this function. Is there one?