[xsl] Is there a neat way to get style-sheet relative paths?

Subject: [xsl] Is there a neat way to get style-sheet relative paths?
From: "Harald Brinkmann" <hbbst@xxxxxxx>
Date: Mon, 19 Jul 2004 13:33:17 +0200 (MEST)
Hello everyone,

for display on an IE 6.0 I want to use this directory structure:


for xml files containing the data and


for the style info to be used.

The explorer knows about the stylesheet to be used by finding a

  <?xml-stylesheet type="xsl/text" href="../style/StyleFiles.xsl"?>

line in the xml data files. So far, so good. Unfortunately some info is
contained in a css-file and there are image files to load as well, which are
located in the style directory. (I did not want to use css, but I could not
find another way to produce an output media dependent style, among other
things, and I am open to suggestions!) This is how I reference the css:

<xsl:template match="/">
   <link rel="stylesheet" type="text/css" href="ReportStyle.css" />

Obviously this is referenced after the html is generated and therefore
refers to the then current directory. I don't want to carry the relative
path info into the xml-file, other than in the stylesheet reference above,
unless I have to. So, is there a way to somehow use the stylesheet-path, so
that the href for the css and image includes look in the stylesheet
directory rather than the data directory? I have found a way to include
other xml files located in the style directory by doing

  <xsl:variable name="Lang" select="document( $fn, document(''))/Terms" />

but I couldn't figure out if there is way to use this for css and image
files as well.


Harald Brinkmann

Current Thread