SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# fn:doc

fn:doc(string? $uri) → document?

Function signature

$uri | string ?
Result | document-node() ?

XPath 2.0 Specification

Loads a document identified by its URI

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 recognized are:

- `validation=strict|lax|preserve|strip`: determines how the input document will be validated. The options "strict" and "lax" require Saxon-SA.

- `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-space declarations in the stylesheet.) The value "ignorable" 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.

Next