Interface RelativeURIResolver
- All Superinterfaces:
URIResolver
This extended interface defines a URIResolver that separates the two functions of resolving a relative URI against a base URI, and fetching a resource with that absolute URI. If the URI resolver supplied to Saxon implements this interface, the absolute URI associated with a loaded document will be the URI returned by this resolver.
The particular motivation for providing this interface is to allow a URIResolver to wrap a .NET XmlResolver, which has additional capability not present in the JAXP interface.
-
Method Summary
Modifier and TypeMethodDescriptiondereference
(String uri) Called by the processor when it encounters an xsl:include, xsl:import, or document() function.default Source
dereference
(String uri, String flags) Extended method that accepts flagsmakeAbsolute
(String href, String base) Create an absolute URI from a relative URI and a base URI.Called by the processor when it encounters an xsl:include, xsl:import, or document() function.default Source
Extended method that accepts flags
-
Method Details
-
makeAbsolute
Create an absolute URI from a relative URI and a base URI. This method performs the process which is correctly called "URI resolution": this is purely a syntactic operation on the URI strings, and does not retrieve any resources.- Parameters:
href
- A relative or absolute URI, to be resolved against the specified base URIbase
- The base URI against which the first argument will be made absolute if the absolute URI is required.- Returns:
- A string containing the absolute URI that results from URI resolution. If the resource
needs to be fetched, this absolute URI will be supplied as the href parameter in a subsequent
call to the
resolve
method. - Throws:
TransformerException
- if any failure occurs
-
dereference
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.- Parameters:
uri
- The absolute URI to be dereferenced- Returns:
- A Source object, or null if the href cannot be dereferenced, and the processor should try to resolve the URI itself.
- Throws:
TransformerException
- if an error occurs when trying to resolve the URI.
-
dereference
Extended method that accepts flags- Parameters:
uri
- the URI to be dereferencedflags
- recognized flags are S=streamable, M=stylesheet module, D=document, K=schema- Returns:
- A Source object, or null if the href cannot be dereferenced, and the processor should try to resolve the URI itself.
- Throws:
TransformerException
- if the source cannot be dereferenced
-
resolve
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.Despite the name, the main purpose of this method is to dereference the URI, not merely to resolve it.
This method is provided because it is required by the interface. When using a RelativeURIResolver, the single-argument dereference() method is preferred. The result of calling this method should be the same as the result of calling
dereference(makeAbsolute(href, base))
- Specified by:
resolve
in interfaceURIResolver
- Parameters:
href
- An href attribute, which may be relative or absolute.base
- The base URI against which the first argument will be made absolute if the absolute URI is required.- Returns:
- A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
- Throws:
TransformerException
- if an error occurs when trying to resolve the URI.
-
resolve
Extended method that accepts flags- Parameters:
href
- the relative URI to be dereferencedbase
- the base URIflags
- recognized flags are S=streamable, M=stylesheet module, D=document, K=schema- Returns:
- the resolved source
- Throws:
TransformerException
- in the event of failure
-