Cheatsheet: XPath

Basic operations

Root element

/

Element by tag name

//<cars><car></car></cars>
/cars
/cars/car

Element by attribute name

//<cars><car make="lexus"></car></cars>
/cars/car[@make="lexus"]