From: Jan N. <Jan...@iv...> - 2017-07-19 13:31:41
|
Hi, I'm trying to use an XPath expression to find elements referring to the current element in VTD-XML. So say my XML contains books and ratings and looks like this: <root> <book id="1" name="Book1"/> <book id="2" name="Book1"/> <rating book-id="1" value="5"/> <rating book-id="2" value="3"/> </root> First I'm iterating over all book elements. Then, for each book, I want to execute an XPath expression that fetches the rating for that book. For example: /root/rating[@book-id=current()/@id]/@value This doesn't work as the current() function is exclusive to XSLT. So I tried declaring a variable expression named "current" to "." to mean "the current book", but that doesn't work either because (as the name implies), a variable expression doesn't store the results of the expression, but the expression itself. Is there a way to achieve this effect in VTD-XML using just an XPath expression? (I realize there's various ways of doing it in Java code, but I want to use pure XPath so users can easily create a configuration file describing their data format) Thanks for any suggestions! Best, Jan Niestadt. ________________________________ ---------------------------------------------------------- Aan dit bericht kunnen geen rechten worden ontleend. Het bericht is alleen bestemd voor de geadresseerde. Indien het bericht niet voor u is bestemd, verzoeken wij u dit aan ons te melden en het bericht te verwijderen. This message shall not constitute any obligations. This message is intended solely for the addressee. If you have received this message in error, please inform us and delete the message. ---------------------------------------------------------- |