RE: [xsl] XSL Import using relative location from within a jar.

Subject: RE: [xsl] XSL Import using relative location from within a jar.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 30 May 2007 22:04:03 +0100
It doesn't depend on where the stylesheet actually is, it depends on what
it's base URI is, and that's essentially what you set it do, for example
when you did setSystemId() on the Source object.

If you're using the jar: URL scheme to address files inside the JAR, then
that might give you problems, because this URL scheme doesn't conform to the
RFC standards and isn't supported by the java.net.URI class.

Saxon has a few tweaks that allow you to use this schema and achieve
relative addressing within the JAR, but I doubt it would work to do relative
addressing that strays outside it.

You can always write your own URIResolver and try to do a better job
yourself.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Mah, Terry [mailto:terry.mah@xxxxxxxxxxx] 
> Sent: 30 May 2007 21:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] XSL Import using relative location from within a jar.
> 
> Hello All,
> I have a stylesheet that exists within a jar.  Is there a way 
> to write a relative href which points to a url outside of the jar?
>  
> Example: bar.xsl exists in: com.company.foo.bar.xsl location 
> of xsl I wish to import:
> ../../../user-defined-xsl/import_this_xsl.xsl  (the 
> user-defined-xsl directory is on the same level as the jar file).
>  
> ...
> <xsl:import href="../../../user-defined-xsl/import_this_xsl.xsl"/>
> ...
>  
> Gives an exception.  I am using Xalan.
>  
> Thanks.

Current Thread