jcr:deref Function

This function is used follow a REFERENCE property into the target reference. Support for this function is optional.

jcr:deref($source as attribute(),
$node-test as xs:string) as element()*

The first argument is an XML attribute that represents a REFERENCE property.

The second argument is a node test which is a string to match the target node name. The function returns a node sequence of all target nodes matching the node-test. An error is raised if the reference cannot be resolved.

For example, suppose there is a property of type REFERENCE called myapp:author which refers to a node representing the author of this document. A query expression to find the person’s last name property would be:

jcr:deref(@myapp:author, 'myapp:person')/address

The dereference expression above evaluates to one or more nodes which has the name myapp:person. Subsequently a child node of each, representing the person’s address, is selected.