fn:root

Return root of tree with argument node.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:root(node $node) => node

Description

This function returns the root of the tree to which $node belongs. For persistent nodes this is always a document node, for transient nodes this is not necessarily the case.

Argument

$node

node

Example

  • Retrieve the modules stored in the current collection as non-XML data:

    declare namespace ino="http://namespaces.softwareag.com/tamino/response2"
    root(
     for $a in collection("ino:source")/ino:module
     where $a/@ino:targetNamespace="http://www.examples.com/tree"
     return $a
    )

    The query returns all those modules as document nodes that are in the namespace http://www.examples.com/tree.