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 3.1 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:
-
validation=strict|lax|preserve|strip
: determines how the input document will be validated. The optionsstrict
andlax
require Saxon-EE. -
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 usingxsl:strip-space
declarations in the stylesheet.) The valueignorable
causes 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.Parser
causes John Cowan's TagSoup parser for HTML to be used.