:: Using Xalan
I have created a URI Resolver to take notice of a specific URI scheme
defined for internal use in a specific application context.
The resolver is associated with the Transformer like this :-
transformer.setURIResolver(objResolver);
For Xalan, this causes the resolver to be called when the document()
function is encountered (AFAIK include and import use a resolver associated
with the TransformerFactory).
All of this works satisfactorily. However in some cases I want to use my
custom URI Resolver and in others the default. For example if I had this in
my XSLT :-
<xsl:variable name="inboundXML" select="document('wbimb:NBA')"/>
<xsl:variable name="docFile" select="document('OddsAndEvens_NoNS.xml')"/>
.. the custom URI resolver should take care of the first, and the default
resolver the second.
At the moment in my custom URI resolver, if the scheme does not match what
this resolver is interested in I just return null :-
if (href.startsWith("wbimb:")) {
... do stuff related to the custom URI resolver
} else {
return null;
}
I had expected this NOT to work for the second case above, that is, when I
expect the default resolver to be used. But it does ... ??
Whereas its nice when things work, it leaves me with the question of why ?
Is this the expected behaviour of an XSLT processor, to fall back to the
default URI resolver if the associated custom resolver returns null ??
I thought that I would need to do something like :-
// a reference to the default URI resolver is available in the variable
(defaultURIResolver)
if (href.startsWith("myScheme")) {
... do stuff related to the custom URI resolver
} else {
return defaultURIResolver.resolve(href, base);
}
Can anyone shed any light on this behaviour.
Thanks
Fraser.