fn:doc

Retrieves an XML document located at the specified URI, parses it, and returns its document node.

doc($uri as xs:string?) ➔ document-node()?

Arguments

 

$uri

xs:string?

The URI of the required document (relative to the static base URI)

Result

document-node()?

Namespace

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

Links to W3C specifications

XPath 2.0 Functions and Operators

XPath 3.0 Functions and Operators

Notes on the Saxon implementation

By default the URI is dereferenced using the conventional URL behaviour, as implemented by the Java run-time library; this behaviour can be modified by means of a user-supplied URIResolver.

If the same URI is requested repeatedly, Saxon retains the document node in memory and returns the same instance each time.

The way the URI is handled depends on the URIResolver in use. The standard URI resolver has an option (set using -p on the command line, or via options on the Configuration or TransformerFactory classes) to recognize query parameters in the URI. These are keyword=value pairs, separated by semicolons or ampersand characters, giving options for parsing the file located via the URI. The options that are then recognized are: