You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sobeck, David" <da...@thinklinkinc.com> on 2000/11/15 21:49:37 UTC

RE: Importing Stylesheets when the importing stylesheet has been loaded from a JAR

You could map a full URL to a resource loaded off the classpath by defining
a new protocol (not as hard as it sounds). The content handler would just
call getResourceAsStream. You must advertise your handler on the
java.protocol.handler.pkgs property. I am always amazed at how hard it is to
find the documentation for this useful technique. Its with the URL
constructor which takes three Strings:

http://www.javasoft.com/j2se/1.3/docs/api/java/net/URL.html#URL(java.lang.St
ring,%20java.lang.String,%20java.lang.String)

-----Original Message-----
From: Fergus Gallagher [mailto:Fergus.Gallagher@OrbisUK.com]
Sent: Wednesday, November 15, 2000 10:38 AM
To: xalan-dev@xml.apache.org
Subject: Re: Importing Stylesheets when the importing stylesheet has
been loaded from a JAR


If you open using an InputStream, the location information is lost so any 
xsl:import or xsl:include can't know where to look.

Is I understand it, you should be able to specify

         XSLTInputSource("jar:<url>!/{entry}")

and then any imported stylesheets would be relative to that.   However, 
this appears to be broken (in Xalan 1 at least) and you have to specify a 
full URL :-(

Fergus


At 13:04 15/11/00 +0000, John Francis wrote:

>  I wish to release the stylesheet files I use in a jar with the server
that
>uses them.
>  I can load the primary stylesheet using the standard class loader
>"InputStream inStr = getClass().getResourceAsStream(primaryXSLFilename)".
>However this imports some stylesheets which I wish to maintain separately,
>but should be loaded from the same "directory" in the jar file.
>  Is there some way of telling xalan to use the class loader rather than
the
>file system to load files ?
>
>  Thanks, and thanks for xalan,xerces,ant etc... in the first place.

-- 
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717