Before using any of the functions below please remember to import the module namespace:
import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";The module provides functions to compute an immutable and opaque reference for any node and to retrieve nodes given their identifier. The identifiers are immutable, i.e. a node identifier does not change during the node lifetime and cannot be reused for another node after the original node gets deleted. Identifiers are unique, in that, two different nodes will never have the same identifier. A node, at any time during its lifetime, can be retrieved by its identifier.
Please see the data lifecycle documentation about details on storing nodes in collections or as documents.
XQuery version and encoding
xquery version "1.0" encoding "utf-8";
declare function ref:node-by-reference( $arg as xs:anyURI ) as node()? external
Returns the node identified by the given node reference.
The function returns the empty sequence if the node that is referenced does not exist.
$arg as xs:anyURIthe URI of the node to retrieve.
the node identified by the URI passed as parameter or the empty-sequence if no node with that URI is found.
- zerr:ZAPI0028 if the given URI is not a valid node reference computed by the ref:node-reference function.
declare function ref:node-reference( $arg as node() ) as xs:anyURI external
Returns an immutable and opaque node reference (with type xs:anyURI) for a given node.
The generated identifier is immutable, i.e. a node identifier does not change during the node lifetime and cannot be reused for another node after the original node gets deleted.
Identifiers are also unique, in that, two different nodes will never have the same identifier.A node, at any time during its lifetime, can be retrieved by its identifier, using the ref:node-by-reference function.
$arg as node()the node for which the URI should be computed
the opaque URI of the node.