The root() function returns the root node of the tree containing a specified start node, or the root of the tree containing the context node.
Argument | Data Type | Meaning |
---|---|---|
start-node (optional) | node()? | A node in the tree whose root is required. If the argument is omitted, it defaults to the context node. It is then an error if the context item is not a node (for example, if it is an atomic value, or if it is undefined) |
Result | node()? | The root of the tree containing the start node |