The quoted definition from the W3C is correct, however, we feel that a better definition would be: XPATH is a path addressing language that describes a way to locate and process items or information in an XML document’s hierarchy. The use of XPATH is not limited to only XSLT and XPointer; This is due to the versatility of the XPATH language which allows it to be used in more scenarios than just XSLT and XPointer – Elsewhere on this site you will see examples on how to use XPATH through programming languages and other methods to evaluate an XML document and process/calculate values at the same time.
Summarized: XPATH is a path language for XML documents. In simpler terms: XPATH is to XML as SQL is to a relational database.
The basis of XPATH is the expression. An XPATH expression is a combination of one or more of the following:
- Expression syntax appears much like a file system path to address the hierarchical nature of an XML document.
- A standard library of functions for text/string manipulation, math, date, time, Boolean, nodes, sequences and etc.
- Operators such as math (+, –, *, division), equality (=, !=, <, >,…) and sets (|).
- Predicates to assist in node selection.
- Axis to assist in node selection.
- Wildcards to assist in node selection.
The end-result is a query expression capable of node selections and value computation that is geared specifically for XML documents and the manipulation:
- XPATH and XSLT together provides a mechanism to interrogate and transform a source XML document into a desired target document (with structure and values).