[ACCEPTED]-Matching a node based on a sibling's value with XPath-xpath
Accepted answer
Found it:
/records/record/name[../record-type/text() = "A"]
0
Surprisingly, none of the answers to date on this old question provide the simplest XPath solution.
This simple XPath
/records/record[record-type = "A"]/name
selects
<name>svn</name>
<name>blog</name>
as requested.
0
You can also filter a parent element by 1 its children :
/records/record[record-type[text()='A']]/name
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.