Returns the URI of a resource where a document can be found, if available.
fn:document-uri
( xs:anyURI?
fn:document-uri
( $arg
as node()?
xs:anyURI?
If the argument is omitted, it defaults to the context item (.
). The
behavior of the function if the argument is omitted is exactly the same as if the
context item had been passed as the argument.
If $arg
is the empty sequence, the function returns the empty sequence.
If $arg
is not a document node, the function returns the empty
sequence.
Otherwise, the function returns the value of the document-uri
accessor
applied to $arg
, as defined in (See
).
The following errors may be raised when $arg
is omitted:
If the context item is absent, dynamic error
If the context item is not a node, type error .
In the case of a document node $D
returned by the fn:doc
function, or a document node at the root of a tree containing a node returned by the
fn:collection
function, it will always be true that either
fn:document-uri($D)
returns the empty sequence, or that the following
expression is true: fn:doc(fn:document-uri($D))
is $D
. It is
implementation-defined whether this guarantee also holds for
document nodes obtained by other means, for example a document node passed as the
initial context node of a query or transformation.