ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Carver <>
Subject Generating relative paths with XSLT
Date Sat, 16 Nov 2002 20:57:29 GMT
This is sort of an Ant question, and sort of an XSLT question. I've
asked it here first, to see what I get. All suggestions or ideas
where else to look welcome!

I make a lot of use of Ant's XSLT task to build all the web pages in a
site from simple XML definitions to fully marked up pages with fancy
graphics and menus etc. This is a great technique because it allows a
site-wide style change to be a simple (!) matter of modifying one XSLT
stylesheet and reprocessing the page definitions. I prefer to do this
before the pages are deployed, so I don't incur the hit of restyling
and the chance of errors on the deployment server.

Now, mostly, this works, but I have one problem. If I were making the
pages by hand, I would use relative (eg. ../../images/logo.gif) URLs
whenever I refer to another page or image in the stylesheet (for a
common navigation menu or site-wide logo, for example). With the XSLT
approach, I can't seem to work out how to do this.

I have found two partial solutions: 

1. Put all my pages at one "level", so that I can hard-code the
relative references in the stylesheet. This rapidly leads to a very
cluttered site with overcomplicated page names.

2. Use absolute (eg.
or rooted (eg. /application/images/logo.gif) URLs. This is a little
better, but fails if the application name is changed after deployment,
or the application is deployed more than once with different names, or
if I try and view the pages direct from disk rather than deploying
them to a server.

Does anyone have any suggestions for how I can use an arbitrary page
hierarchy and still have the XSLT page styling generate the correct
relative references?

Many thanks.

Frank Carver

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

View raw message