fn:document-uri

Returns the URI of a document.

document-uri() ➔ xs:anyURI?

There are no arguments

Result

xs:anyURI?

document-uri($arg as node()?) ➔ xs:anyURI?

Arguments

 

$arg

node()?

The node whose document URI is required

Result

xs:anyURI?

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

Details

For documents supplied in the form of a JAXP Source object, this will normally be the absolutized value of the SystemId property of the Source object.

For documents read using the XPath doc() or document() functions, or the XSLT <xsl:source-document> instruction, it will normally be the absolutized URI that was used to read the document, even if a user-supplied URIResolver redirected the request to some other URI. By contrast, the base-uri() function returns the URI of the actual document returned by the URIResolver.

The value can be set programmatically on the TreeInfo for the relevant document tree using the call node.getTreeInfo().setUserData("saxon:document-uri", URI), where URI is a string. Setting the value to a zero-length string causes document-uri() to return the empty sequence, ().