.. _root: ==== root ==== The root of the tree that contains the argument Description ~~~~~~~~~~~ The fn:root function returns a document node if the $arg node is part of a document, but it may also return an element if the $arg node is not part of a document. Calling the fn:root function is similar to starting a path with / or /. It is more flexible in that it can appear anywhere in a path or other expression. Also, unlike starting with a path with /, the fn:root function does not require the root to be a document node; it could be an element in the case of a document fragment. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg:node() - the node to find the root of Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - root(doc('http://www.functx.com/input/order.xml')//item[1]) - The document node of order.xml * - root($in-xml/x) - 123