Reputation: 4004
If I have a XML file like this:
<abc:persons>
<abc:person id="1">
...
</abc:person>
<abc:person id="2">
...
</abc:person>
</abc:persons>
Given this, what's the xpath expression will be if I want to select person with id is 1.
Thanks.
Upvotes: 0
Views: 73
Reputation: 16927
In XPath 2 you could also use:
//*:person[@id = 1]
if you cannot declare a namespace
Upvotes: 1
Reputation: 1084
Try searching for the element and using a predicate to distinguish the attribute values:
//abc:person[@id = 1]
Upvotes: 3