- All Modules
- All Functions
-
www.w3.org
- 2005
- XDM
- store
- introspection
- reflection
- external
-
xqdoc
-
project_xqdoc
-
xqdoc
(E)
- xqdoc2xhtml
-
project_xqdoc
- data processing
- expath.org
- www.functx.com
- debugger
- error
http://www.zorba-xquery.com/modules/node
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.
Matthias Brantner
xquery version "1.0" encoding "utf-8";
The latest version of this module is 2.0. For more information about module versioning in Zorba please check out this resource.
- the XQuery module can be found here.
node | http://www.zorba-xquery.com/modules/node |
ver | http://www.zorba-xquery.com/options/versioning |
![]() |
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. |
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.
- $node1 the potential descendant
- $node2 the potential ancestor
- true if $node2 is an ancestor of $node1; false otherwise.
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.
- $node1 the potential parent
- $node2 the potential child
- true if $node2 is a child of $node1; false otherwise.
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.
- $node1 the potential ancestor
- $node2 the potential descendant
- true if $node2 is a descendant of $node1; false otherwise.
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.
- $node1 the potential preceding node
- $node2 the potential following node
- true if $node2 is following the node $node1; false otherwise.
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.
- $node1 the potential preceding-sibling
- $node2 the potential following-sibling
- true if $node2 is a following-sibling of $node1; false otherwise.
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.
- $node1 the first node
- $node2 the second node
- the least common ancestor of the two given nodes or the empty sequence if the two nodes are not part of the same tree.
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.
- $node the node for which the level should be computed
- The level as xs:integer of the given node in the tree.
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.
- $node1 the potential child
- $node2 the potential parent
- true if $node2 is a parent of $node1; false otherwise.
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.
- $node1 the potential following node
- $node2 the potential preceding node
- true if $node2 is preceding the node $node1; false otherwise.
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.
- $node1 the potential following-sibling
- $node2 the potential preceding-sibling
- true if $node2 is a preceding-sibling of $node1; false otherwise.