Retrieves an XML document located at the specified URI, parses it, and returns its document node.
doc($uri as xs:string?) ➔ document-node()?
The URI of the required document (relative to the static base URI)
Links to W3C specifications
Available in XPath 2.0, XSLT 2.0, XQuery 1.0, and later versions. Available in all Saxon editions.
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
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
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:
validation=strict|lax|preserve|strip: determines how the input document will be validated. The options
strip-space=yes|no|ignorable: determines whether whitespace-only text nodes will be stripped from the source document. (Such nodes are stripped if this is requested either using this option, or using
xsl:strip-spacedeclarations in the stylesheet.) The value
ignorablecauses whitespace text nodes to be stripped if they belong to an element defined in a DTD or schema as having element-only content.
parser=full.class.name: determines the name of the parser (XMLReader) to be used to parse this input file. For example,
parser=org.ccil.cowan.tagsoup.Parsercauses John Cowan's TagSoup parser for HTML to be used.
xinclude=yes|no: determines whether XInclude processing should be applied to the input document. This overrides any setting in the Configuration (or any command line option).