The XPath language is used to describe locations in a document tree. It is the expression language used by XSLT. See the XPath specification for complete details.
A well-formed XML document can be visualized as a tree
(in the computer science meaning of the term),
and this view is used throughout XPath and XSLT. For example,
if a certain document represents a book, it might have
a top-level tag
<book>, containing elements like
A few important definitions:
A node is the basic building block of the document tree, that is, the data structure used to represent an XML document during its processing by an XSLT script.
The node representing the outermost tag of the document is called the root node of the tree.
All nodes except the root node of the tree have a parent node, and many nodes can have child nodes under them.
To continue the example above, the
<book> node is the root,
and its children are the
XPath expressions use these data types:
Many XPath operations select a set of zero or
more nodes. For example, the expression
"address" selects all of the
that are children of the context node. This node-set
may contain no nodes, one node, or many.
A true or false value.
Numbers in XPath are represented using floating point.
A string of characters.