XPointer Location Set Functions

Two XPointer functions return location sets:

  • here()— Returns a location set with one location, the current location

  • origin()— The same as here(), except that this function is used with out-of-link links

The here() function refers to the current element. This is useful because XPointers are usually stored in text nodes or attribute values, and you might want to refer to the current element (not just the current node). For example, you might want to refer to the second previous <NAME> sibling element of the element that contains an Xpointer; you can use an expression like this to do so: here()/preceding-sibling::NAME[position() = 2].

The origin() function is much like the here() function, but you use it with out-of-line ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.