Re: [xsl] xml:base, resolve-uri and imported xslt files: how to get the importing base url from imported xslt

Subject: Re: [xsl] xml:base, resolve-uri and imported xslt files: how to get the importing base url from imported xslt
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 9 Oct 2006 17:31:56 +0100
> Hmm, for some reason, using the path in this overloaded variable, is 
> still interpreted as relative to the imported stylesheet, instead of the 
> importing stylesheet.

the variable pathToConfig holds a string not a uri so it is not subject
to any uri resolution while being passed around -as a string- If you
then use it in a place where a URI is expected (eg the argument to
doc()) then (in any particular instance) URI resolution will be just as
if a string constant had been used at that point, the string valued
variable doesn't hold any information about _where_ it was defined.

> The only resolution appears to be (I think), using 
> resolve-uri in the importing stylesheet to make sure it is an absolute 
> path to begin with.

which is effectively similar to my suggestion of calling doc() in the
importing stylesheet rather than the imported one, both have the effect
of doing the resolution at that point.


> houldn't that mean that  the base uri, on any given moment, is defined
> as the base uri of the  main document (the importing document)?

No the base URI of each stylesheet module is (unless overrideen with
xml:base) the URI used to retrieve that module. When working out the
base uri of a node in the stylesheet you work up the ancestor axis
until you come to an xml:base or the top of the tree, in which case the
base uri is determined. You don't have to navigate the xsl:import tree.

David

Current Thread