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";

Zorba version for this module:

The latest version of this module is 2.0. For more information about module versioning in Zorba please check out this resource.

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

External copy back to 'Function Summary'
declare function node:copy (
            $input as node()*
) as node()*

Return a deep copy of every given node according to the properties specified in the static context of the invoking module. Please note that a copy of a node is parentless.

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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

Parameters:
Returns:

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

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