Writing a URI Resolver for Input Files
Saxon allows you to write your own URIResolver
to handle the URIs of input
documents, as defined in the JAXP specification. Such a URIResolver
is used
to process the URIs supplied to the doc()
and document()
functions. It is also used to process the URIs supplied for the source document and the
stylesheet on the command line. In XSLT it is used to process the URIs used in the
xsl:include,
xsl:import and
xsl:import-schema
declarations, and in XQuery it supports the location URIs in import
schema
.
The URIResolver
is called to process the supplied URI, and it returns a JAXP
Source
object, which Saxon uses as the source of the input. Note that the
Source
must be one of the implementations of Source
that Saxon
recognizes: you cannot write your own implementations of the JAXP Source
class.
The URIResolver
is used only for XML files. It is therefore not used to
support the unparsed-text()
function in XSLT, or to support import
module
in XQuery. There are other mechanisms for such cases:
- The
UnparsedTextURIResolver
is used by theunparsed-text()
,unparsed-text-lines()
,unparsed-text-available()
, andparse-json
functions. - The
ModuleURIResolver
is used to locate XQuery modules.