Summary
Returns the base URI of a node.
Signatures
fn:base-uri
(
) as xs:anyURI?
fn:base-uri
(
$arg
as node()?
) as xs:anyURI?
Properties
The zero-argument form of this function is deterministic, context-dependent, and focus-dependent.
The one-argument form of this function is deterministic, context-independent, and focus-independent.
Rules
The zero-argument version of the function returns the base URI of the context node: it
is equivalent to calling fn:base-uri(.)
.
The single-argument version of the function behaves as follows:
- If
$arg
is the empty sequence, the function returns the empty
sequence.
- Otherwise, the function returns the value of the
dm:base-uri
accessor
applied to the node $arg
. This accessor is defined, for each kind of
node, in the XDM specification (See ).
As explained in XDM, document, element and processing-instruction nodes have a
base-uri property which may be empty. The base-uri property for all other node kinds is
the empty sequence. The dm:base-uri accessor returns the base-uri property of a node if
it exists and is non-empty; otherwise it returns the result of applying the dm:base-uri
accessor to its parent, recursively. If the node does not have a parent, or if the
recursive ascent up the ancestor chain encounters a parentless node whose base-uri
property is empty, the empty sequence is returned. In the case of namespace nodes,
however, the result is always an empty sequence — it does not depend on the base URI of
the parent element.
See also fn:static-base-uri
.