How to select the first element with a specific attribute using XPath

The XPath bookstore/book[1] selects the first book node under bookstore.

How can I select the first node that matches a more complicated condition, e.g. the first node that matches /bookstore/book[@location='US']

9 Answers
9

Leave a Comment