saxon:doc

Fetches and parses an XML document, with supplied parsing options.

doc($href as xs:string, $options as map(*)) ➔ document-node()

Arguments

 

$href

xs:string

The URI of the document to be fetched

 

$options

map(*)

Parsing options

Result

document-node()

Namespace

http://saxon.sf.net/

Notes on the Saxon implementation

Introduced in Saxon 9.8.

Details

This function has a similar effect to fn:doc($href), but allows an extra argument to be supplied (in the form of a map) to control the way in which the document is parsed.

The available options are:

Name Type Values

validation

xs:string

strict | lax | preserve | strip | skip: controls whether XSD validation is performed.

type

xs:QName

Requests validation against a named type

dtd-validation

xs:boolean

Determines whether DTD validation takes place

strip-space

xs:string

all | none | package-defined: controls stripping of whitespace text nodes. The values all and none cause stripping of respectively all whitespace text nodes or none; the value package-defined applies only in XSLT, and causes whitespace stripping to follow the rules of the xsl:strip-space and xsl:preserve-space options in the stylesheet. In all cases, whitespace stripping also respects the value of any xml:space attributes encountered, and when validation is enabled, whitespace in element-only content is always stripped.

accumulators

xs:QName*

Names the accumulators that are applicable to this document.

Note: the saxon:doc function was introduced as a target for compiling the XSLT 3.0 xsl:source-document instruction when streaming is not in force. It is however useful in its own right.

In the current implementation, the function returns a new document on each call. This is not guaranteed, however; future versions may decide to cache the results so that two calls with the same arguments return the same node.