you can use this:
/root/a/b[position()=$variable]
position() is 1 based
More Related Contents:
- How to execute XPath one-liners from shell?
- XPath query to get nth instance of an element
- Getting attribute using XPath
- xmllint failing to properly query with xpath
- Xml Namespace breaking my xpath!
- XPath to select multiple tags
- XPath to select Element by attribute value
- How can I use XPath to find the minimum value of an attribute in a set of elements?
- XSLT: How to convert XML Node to String
- XPath with multiple conditions
- How to ignore namespace when selecting XML nodes with XPath
- How to find the max attribute from an XML document using Xpath 1.0
- Get nodes where child node contains an attribute
- XSLT Replace function not found
- How do you identify duplicate values in a numerical sequence using XPath 2.0?
- What is the difference between ‘or’ and ‘|’ when programming in xslt?
- What is the correct XPath for choosing attributes that contain “foo”?
- Using XPath, How do I select a node based on its text content and value of an attribute?
- XPath to get all child nodes (elements, comments, and text) without parent
- How to apply the XPath function ‘substring-after’
- XPath to return only elements containing the text, and not its parents
- distinct in Xpath?
- How can I select an element with multiple classes with Xpath?
- WiX Installer: using xslt with heat.exe to update attributes
- What is the difference between name() and local-name()?
- XPath find all elements with specific child node
- How do I generate a comma-separated list with XSLT/XPath?
- How can I use xpath querying using R’s XML library?
- Matching a node based on a sibling’s value with XPath
- XSLT – Comparing preceding-sibling’s elements with current’s node element