Search code examples
xmlxpathxmlspy

access Nth node from xpath result set


Possible Duplicate:
Get Nth child of a node using xpath

How can I access Nth node from the following set.
XPath = /ProcessData/*[starts-with(name(), 'INV')]

enter image description here


Solution

  • Below expression will help

    (/ProcessData/*[starts-with(name(), 'INV')])[5]
    

    Here 5 can be replaced with the desired value to get the nth node from the selected(filtered) nodes.