88

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"/>
Pooven
  • 1,744
  • 1
  • 25
  • 44
flybywire
  • 261,858
  • 191
  • 397
  • 503
  • 1
    Possible duplicate of [What is the correct XPath for choosing attributes that contain "foo"?](http://stackoverflow.com/questions/103325/what-is-the-correct-xpath-for-choosing-attributes-that-contain-foo) – Michael Freidgeim Jan 20 '17 at 00:17

1 Answers1

160
select="//*[contains(@address,'Downing')]"
vartec
  • 131,205
  • 36
  • 218
  • 244