xsl-list
[Top] [All Lists]

RE: Is there a neat way to get style-sheet relative paths?

2004-07-19 05:09:01
XSLT 2.0 would allow you to write

href="{resolve-uri('ReportStyle.css')}"

But of course that doesn't help very much because you need a solution that
works in IE. Unfortunately I don't think it's possible: although the base
URI of a stylesheet instruction is part of the context in 1.0, it's
accessible only through the document() function.

Michael Kay
 

-----Original Message-----
From: Harald Brinkmann [mailto:hbbst(_at_)gmx(_dot_)net] 
Sent: 19 July 2004 12:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Is there a neat way to get style-sheet relative paths?

Hello everyone,

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

  somepath/data/DataFiles.xml

for xml files containing the data and

  somepath/style/StyleFiles.xsl

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="/">
 <html>
  <head>
   ...
   <link rel="stylesheet" type="text/css" href="ReportStyle.css" />
  </head>

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.

Cheers

Harald Brinkmann





--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>