My sample input XML is:
<root> <a> <b>item</b> <b>item1</b> <b>item2</b> <b>item3</b> <b>item4</b> </a> </root>
I am suppose to select a node b
whose position is the value of a variable.
How can I use the value of a variable to test the position of a node?
The key part of this XPath is *[1] , which will select the node value of the first child of Department .
you can use this:
/root/a/b[position()=$variable]
position() is 1 based
http://saxon.sourceforge.net/saxon6.5.3/expressions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With