ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Carver <>
Subject RE: Generating relative paths with XSLT
Date Sun, 17 Nov 2002 19:54:20 GMT

Scott Stirling <> said:
> Please explain what you mean.  Do you get errors during transformation?
> Not sure what the real problem is.  How exactly do the relative hrefs in
> the input XML differ from the output HTML?

Ah.  Sorry for the confusion.  My input documents have no references, relative
or otherwise.  The references are part of the style, and described in the
stylesheet.  Here's a simplified example:

file ./index.xml:

  <page title='home page'>
  <p>Welcome to my statically-styled web site!</p>
  <p>See our <a href='products/special.html">Special Offer</a></p>

file products/special.xml:

  <page title='special offers'>
  <p><b>Today Only!</b> Widgets at $39/kg</p>

I wish to apply the same stylesheet to both these pages (and lots of others, of
course).  Something like:

file default.xsl: (trimmed a lot from the real one, and not syntax checked!)

  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="" version="1.0">
  <xsl:output method="html" encoding="8859-1"/>
  <xsl:template match="page">
  <html><head><title><xsl:value-of select="@title"/></title></head><body>
  <h2><img src='images/logo.gif'/> <xsl:value-of select="@title"/></h2>
  <xsl:apply-templates select="node()"/>

  <xsl:template match="@*|node()|processing-instruction()|comment()">
    <xsl:apply-templates select="@*|node()|processing-instruction()|comment()"/>

The problem occurs with the reference to images/logo.gif.  It works fine for
pages at the "top level" (such as index.html, above).  But pages in
subdirectories (such as products/special.xml, above) would really need
to generate something like "../images/logo.gif".

Is that clearer ?

Thanks for your interest.

Frank Carver

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message