Matching a node based on a sibling's value with XPath

Solution 1:

Found it:

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

Solution 2:

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.

Solution 3:

You can also filter a parent element by its children :

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