[xsl] Calculating Relative Paths in XSLT or Java

Subject: [xsl] Calculating Relative Paths in XSLT or Java
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Mon, 16 Jun 2003 18:48:36 -0500
This is slightly off topic, but this is the main development list I track and I figured someone here would probably know what I need and this is needed in the context of XSLT processing.

What I've got is my XSLT-based XInclude implementation (see the Dave Pawson XSL FAQ for a version of this code).

As part of the processing I'm doing I need to be able to rewrite URL pointers to graphics when the graphic as referenced in an included doc will not be in the same relative location WRT to the including doc.

For example, if I have a directory for the main document and, at the same level, a "common" directory that contains re-usable XML docs and graphics, then if the main document includes a common file that itself references a common graphic, if I don't rewrite the URL to that graphic (assuming the URL was originally relative, which of course it will be), then the resulting reference (in the final transcluded instance) will be pointing to the wrong place.

The solution of course is to rewrite the graphic reference URLs. This is a non-trivial thing to do (at least for me at this particular moment). I know I've puzzled it out in the past but just now I don't have time or energy for puzzles. So I was wondering if anyone could point me either to code that does this that I can crib from or has the algorithm at their fingertips and would be willing to share it?

Thanks,

Eliot
--
W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread