XPointers refer to particular parts of or locations in XML documents.
The syntax of an XPointer is the keyword xpointer, followed
by parentheses containing an XPath expression that returns a
node set.
The id() function points to an element with a
specified value for an ID type attribute.
Location steps can be chained to make more sophisticated location paths.
Each location step contains an axis, a node test, and zero or more predicates.
Relative location steps select nodes in a document based on their relationship to a context node.
The self axis points to the context node. It
can be abbreviated as a period (.).
The parent axis points to the node that
contains the context node. It can be abbreviated as a double
period (..).
The child axis points to immediate children of
the context node. It can be abbreviated simply by a node test.
The descendant axis points to all elements
contained in the context node. It can be abbreviated as a double
slash (//).
The descendant-or-self axis points to all
elements contained in the context node as well as the context
node itself.
The ancestor axis points to an element that
contains the context node.
The ancestor-or-self axis points to all
elements that contain the context node as well as the context
node itself.
The preceding axis points to any element that
comes before the context node.
The following axis points to any element
following the context node.
The preceding-sibling axis selects from sibling
elements that precede the context node.
The following-sibling axis selects from sibling
elements that follow the context node.
The attribute axis points to an attribute of the context
node. It can be abbreviated as a @ sign.
The node test of a relative location step is normally an
element name, but may also be the * wild card to
select all elements or one of the keywords
comment(), text(),
processing-instruction(), node(),
point() or range().
The optional predicate of a relative location step is an XPath boolean expression enclosed in square brackets that further narrows down the node set the XPointer refers to.
A point indicates a position preceding or following a node or a character.
A range identifies the parsed character data between two points.
The string-range() function points to a
specified block of text.
A child sequence points to an element by counting children from the root.