W3C home > Mailing lists > Public > www-style@w3.org > August 2001

Relative links in XSLT

From: Jeffrey Yasskin <jyasskin@appcomp.com>
Date: Thu, 9 Aug 2001 06:18:18 -0400 (EDT)
Message-ID: <D47B6648C7A49C4183AAF655AC976FCE031E64@server1.appcomp.com>
To: "'www-style@w3.org'" <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:10 GMT