flybywire
flybywire

Reputation: 273972

xpath: find a node that has a given attribute whose value contains a string

Is there an xpath way to find a node that has a given attribute whose value contains a given string?

For example I have an xml document and want to find a node where the address attribute contains the string Downing, so that I could find the following node:

<person name="blair" address="10 Downing St. London"/>

Upvotes: 91

Views: 89343

Answers (1)

vartec
vartec

Reputation: 134691

select="//*[contains(@address,'Downing')]"

Upvotes: 163

Related Questions