[ACCEPTED]-Matching a node based on a sibling's value with XPath-xpath

Accepted answer
Score: 107

Found it:

/records/record/name[../record-type/text() = "A"]

0

Score: 66

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

Score: 38

You can also filter a parent element by 1 its children :

/records/record[record-type[text()='A']]/name

More Related questions