Glossary · 3 · Publishing SDKs and structured content
XPath
Also known as: XML Path Language
In XML processing, XPath (XML Path Language) is an expression language standardized by the W3C for selecting nodes in XML documents and computing values from them, by navigating the document tree along axes and filtering with predicates and functions; it is embedded in XSLT, XQuery and Schematron.
- Publishing SDKs
- Standards
In one sentence
XPath is the W3C expression language for selecting nodes and computing values in XML documents; XSLT, XQuery and Schematron build on it.
Example
The XPath expression `//step[not(cmd)]` selects every step in a DITA task that lacks a command element, so a check can report it.
How it applies
- Publishing SDKs: XPath is how publishing toolkits address content. XSLT templates match elements with XPath patterns, Schematron rules state their context and assertions in XPath, and many authoring tools, content management systems and test frameworks use it to locate or query elements.
- DITA processing: DITA Open Toolkit's XSLT modules use XPath to find topics, resolve attributes and select content for each output; customizations written as plug-ins use the same expressions.
- Developer and platform SDKs: XML APIs and configuration formats are queried with XPath in tests and integrations. Some platforms expose XPath-based selectors in their extension or automation APIs.
- Documentation: Rules and transformations are easier to maintain when their XPath expressions are documented together with the content model they assume; a change to the content model can silently make an expression match nothing.
Versions
XPath 1.0 (W3C Recommendation, November 16, 1999) works on node sets, strings, numbers and booleans and is still the version supported by many libraries and browsers. XPath 2.0 introduced sequences and the type system of XML Schema; XPath 3.0 and 3.1 added higher-order functions, maps and arrays, and JSON support. As of October 11, 2026, XPath 3.1 (March 21, 2017) is the latest W3C Recommendation; the W3C community group QT4 CG is developing drafts of XPath 4.0, which are not Recommendations. Documentation should name the version an expression requires.
XPath vs. CSS selectors
CSS selectors also select elements in a tree, but only downward and without computing values. XPath can move along any axis (parent, ancestor, preceding sibling), compare values and call functions, which is why rule and transformation languages for XML are built on it.