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 Mon, 18 Nov 2002 09:37:37 GMT

Scott Stirling <> said:

> One idea is to set the depth of the XML page in an attribute of the
> <page/> element (like <page depth='1' title='special offers'>) and use
> its value in an <xsl:choose/> or other flow control construct to output
> the appropriate number of "../" (if any) in img src="".
> Similar, but better, would be to set the relative path to the root
> images dir (and possibly other stuff, like include files or css) like
> <page path2root='../../' title='special offers'> and use <xsl:variable/>
> in the XSL to get that and set an imageDir variable:

Thanks.  I'd actually come up with a similar thought myself (though not as
neatly expressed as yours).  My reason for posting this on the Ant list, though
was to see if anyone could think of a way of getting ant to populate such an 
attribute automatically based on the location of the file.

I'm not averse to a pre-filter step to fill in filter tokens such as
 <page title="Special Offers" path2root="@path2Root@"> ...
or any other form of pre-styling, but I'm not aware of any ant task which makes
such an attribute available while processing a tree of files.

What I want to avoid is having to hard-code the location of a file inside the
file as well as outside it.

Frank Carver

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

View raw message