http://www.zorba-xquery.com/modules/node-reference
Description
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.
See also
Author
Federico Cavalieri
XQuery version and encoding
xquery version "1.0" encoding "utf-8";
Namespaces
| ref | http://www.zorba-xquery.com/modules/node-reference |
| ver | http://www.zorba-xquery.com/options/versioning |
| zerr | http://www.zorba-xquery.com/errors |
Function Summary
node-by-reference($arg as xs:anyURI) as node()? externalReturns the node identified by the given node reference. | |
node-reference($arg as node()) as xs:anyURI externalReturns an immutable and opaque node reference (with type xs:anyURI) for a given node. |
Functions
node-by-reference#1
declare function ref:node-by-reference(
$arg as xs:anyURI
) as node()? externalReturns the node identified by the given node reference.
The function returns the empty sequence if the node that is referenced does not exist.
Parameters
$arg as xs:anyURIthe URI of the node to retrieve.
Returns
node()?the node identified by the URI passed as parameter or the empty-sequence if no node with that URI is found.
Errors
- zerr:ZAPI0028 if the given URI is not a valid node reference computed by the ref:node-reference function.
node-reference#1
declare function ref:node-reference(
$arg as node()
) as xs:anyURI externalReturns 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.Parameters
$arg as node()the node for which the URI should be computed
Returns
xs:anyURIthe opaque URI of the node.