Relative links in XSLT

I'm trying to make a web site using XML and XSLT, but I've run into the 
problem that relative links in the XSLT transform don't work when the same 
transform is applied to several XML documents in different directories. For 
example, given the following directory structure: 
/ 
--index.xml 
--site.xslt 
--images/ 
----image.gif 
--projects/ 
----aproject.xml 
if site.xslt contains a tag: <img src="images/image.gif">, it doesn't work 
when applied to aproject.xml. The solution is to change the tag to: <img 
src="/images/image.gif"> 
However, if we add a "staging/" directory to this tree, with a copy of the 
rest of the tree inside of it, absolute links no longer work. 

The workflow I'm thinking of is to build a multi-directory web site inside 
of a staging directory and then be able to just copy it down a level into 
the production site. With the current XSLT spec, I think this is impossible.


I'm not sure of the best way to fix this, but one idea is to be able to 
switch URLs between "relative to the source XML document" and "relative to 
the current XSLT transform." 
The xml:base attribute would work, except for the copy. Maybe
xml:base="{current-document-location}"?

Jeffrey Yasskin 


P.S. This message bounced when sent from my Hotmail address "due to
unsolicited email." Is there anything I can do about that?

Received on Thursday, 9 August 2001 07:30:48 UTC