XPath logo

XML Path

CategoryData Transformation Standards

XML Path Language (XPath) 3.0 is a language defined by the World Wide Web Consortium (W3C) for selecting nodes and computing values from the content of an XML document. It provides the ability to navigate around the document tree and select a node-set based on the pattern.


Specification


XML Document Navigation


Pattern-based Node Selection

XPath 3.0 specification defines an expression language that allows hierarchic addressing of the nodes in an XML tree described in the XPath Data Model (XDM).

The basic building blocks of XPath are its expressions — strings of Unicode characters representing a path in the hierarchical structure, evaluated with respect to a context node. The most important kind of expression is a location path, consisting of three components: axis — navigation direction, node test — specific node name or a wildcard pattern, and predicates — expressions in square brackets to filter a node-set.

XPath defines four data types: node-set — an array of nodes with no intrinsic order, string, number and boolean. The function library includes operations to manipulate strings and numbers, get properties of nodes, and get details of the processing context.

Subsets of the XPath query language are used in other W3C specifications, such as XML Schema and XSLT, where XML document node matching is required.

XPath standard