(Referencing) Every non-namespace node will be represented by:
This allows to dereference the pointers by key('nodes-by-genid',...).
Namespace nodes cannot be matched by <xsl:key>.
Therefore we represent its parent and its name.
Both parts are seperated by colon character:
The string value of this representation allows for duplicate node
elimination by key('no-duplicates',...) and Muenchian grouping.
An id-node-set is just a node-set of id-nodes.
Dereferencing an id-node-set is done this way, even without exslt:node-set() function.
As a side-effect applying the key function sorts the nodes into document order (*)!
(*) not for Webkit based browsers Chrome and Safari.
id-node-sets can just be copied. Because of the contained id-value the
copies still reference the same nodes as before.
While handling of a constant number of "pointers" could be achieved by
<xsl:variable name="..." select="..."> there is no concept of
set of references in XSLT, only a node-set. But passing node-set while
calling a template would need to generate copies and cannot be used for
representing pointers by itself.
All what is needed for XSLT pointers is XSLT 1.0 plus the exslt:node-set()
function. This has the advantage that XSLT pointers work on the following
browsers: Chrome, Firefox(**), Internet Explorer(***), Opera, Safari.
(**) Firefox does not support the namespace:: axis.
(***) Support for Internet Explorer is provided by:
id-node-sets can preferably be used to implement eg. a location step as part
of dyn:evaluate() function within XSLT itself along the "words":
A location step identifies a new node-set relative to the context node-set.
The location step is evaluated against each node in the context node-set, and
the union of the resulting node-sets becomes the context node-set for the
Find below a sequence of above operations with generated output.
determine id-node-set from node-set (reference)
intentionally generate id-node-set with duplicates
eliminate duplicates in id-node-set
copy of id-node-set (different order)
determine node-set from id-node-set (dereference, document order(****))
(****) not for Webkit based browsers Chrome and Safari
output of $result-nodes