http://www.zorba-xquery.com/modules/node ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace node = "http://www.zorba-xquery.com/modules/node";

This module defines a set of function which can be used to determine (1) the relationship between two nodes (e.g. if one is the ancestor if another) and (2) properties of given nodes (e.g. their level in the tree). The same functionality can be achieved with simple XPath expressions. However, please note that using the functions in this modules instead of path expressions guarantees better performance.

Author:

Matthias Brantner

XQuery version and encoding for this module:

xquery version "1.0" encoding "utf-8";

Module Resources
Namespaces
node http://www.zorba-xquery.com/modules/node
ver http://www.zorba-xquery.com/options/versioning
Function Summary
ancestor-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is an ancestor of the node given as first argument.
child-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is a child of the node given as first argument.
descendant-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is a descendant of the node given as first argument.
following-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is following the node given as first argument.
following-sibling-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is a following-sibling of the node given as first argument.
least-common-ancestor ( $node1 as node(), $node2 as node() ) as node()? external
Computes the least common ancestor of two given nodes in the tree.
level ( $node as node() ) as xs:integer external
Computes the level of a given node in the tree.
parent-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is a parent of the node given as first argument.
preceding-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is preceding the node given as first argument.
preceding-sibling-of ( $node1 as node(), $node2 as node() ) as xs:boolean external
Determines whether the node given as second argument is a preceding-sibling of the node given as first argument.
Functions
ancestor-of back to 'Function Summary'
declare function node:ancestor-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is an ancestor of the node given as first argument.

Parameters:
Returns:

child-of back to 'Function Summary'
declare function node:child-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is a child of the node given as first argument.

Parameters:
Returns:

descendant-of back to 'Function Summary'
declare function node:descendant-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is a descendant of the node given as first argument.

Parameters:
Returns:

following-of back to 'Function Summary'
declare function node:following-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is following the node given as first argument.

Parameters:
Returns:

following-sibling-of back to 'Function Summary'
declare function node:following-sibling-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is a following-sibling of the node given as first argument.

Parameters:
Returns:

least-common-ancestor back to 'Function Summary'
declare function node:least-common-ancestor (
            $node1 as node(), 
            $node2 as node() 
 ) as node()? external

Computes the least common ancestor of two given nodes in the tree.

Parameters:
Returns:

level back to 'Function Summary'
declare function node:level (
            $node as node() 
 ) as xs:integer external

Computes the level of a given node in the tree. Note: The first level has the number one.

Parameters:
Returns:

parent-of back to 'Function Summary'
declare function node:parent-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is a parent of the node given as first argument.

Parameters:
Returns:

preceding-of back to 'Function Summary'
declare function node:preceding-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is preceding the node given as first argument.

Parameters:
Returns:

preceding-sibling-of back to 'Function Summary'
declare function node:preceding-sibling-of (
            $node1 as node(), 
            $node2 as node() 
 ) as xs:boolean external

Determines whether the node given as second argument is a preceding-sibling of the node given as first argument.

Parameters:
Returns:

blog comments powered by Disqus