Skip to content
uencoder

XPath

XPath is the XML path query language, selecting nodes from XML documents with expressions like /root/child[@attr="val"].

Purpose

To select node sets from XML documents by path and predicate, used by XSLT, XQuery, XML databases, and testing.

Mechanism

A path expression consists of /-separated steps, each with an axis (child/attribute/descendant...), a node test, and a predicate [expr]. Evaluation returns a node set, string, number, or boolean.

Use cases

  • Node selection in XSLT
  • XML database queries
  • Selenium element location

Related tools

References