Extra XPointer features
XPointer provides a more fine-grained addressing than XPath.
- Instead of just nodes, XPointers address locations,
which can be nodes, points, or ranges.
- A point can represent the location preceding or following
any individual character in a chardata node.
The special node test
point()
selects the set of points of a node.
- A range consists of two points in the same document,
and is
specified using a range expression of the form
expr to expr.
- XPointer provides some extra functions:
here() | |
get location of element containing current XPointer
|
origin() | |
get location where user initiated link traversal
|
start-point(location-set) | |
get start point of location set
|
string-range(...) | |
find matching substrings
|
... | |
|
Example 1:
/descendant::text()/point()[position()=0]
|
selects the first character of all character data nodes in the document.
Example 2:
/section[1] to /section[3]
|
selects everything from the beginning of the first section to
the end of the third.