xsl-list
[Top] [All Lists]

Re: Loading XSL files from stylesheet stored into a JAR

2004-02-18 06:39:38
I've found how to do it :)

I've created a class which implements the javax.xml.transform.URIResolve
In this class, the function resolve(String href, String base) only use the href 
parameter in order to find required file as resource using getClass
().getResource(href);

Finally, I return a new StreamSource() with the new URL object created above ..

And it works

Thanks anyway :)

Selon cmalderez(_at_)free(_dot_)fr:

Hello,

I'm using JBoss v3.2.3 with Tomcat 4.1.29.
I've build a small Web application using JSP, EJB producing XML document
(using 
JDOM) and displaying data as HTML using XSL stylesheets.

I want to separate some XSL templates into other XSL files and load them from

my primary XSL stylesheet.
Easy using: <xsl:include href="foo.xsl"/>

But all my JSP and XSL files are packaged into a WAR(jar) file and deployed 
into JBoss with my EJB package.
The Web Package (WAR file) is mounted using the web-uri: mytool
The Web Package contains 2 folders 'jsp/' with all JSP pages & 'xsl/' with
all 
XSL stylesheets.

I access to my JSP using this URL http://localhost:8080/mytool/jsp/myjsp.jsp
In my JSP I can't load my XSL stylesheets as file because they are in a JAR.
So I load them using the getClass().getResource('myxsl.xsl');

But how can I specify the correct URI for the second XSL file 'foo.xsl' which

must be loaded from the 'myxsl.xsl' ?
I can't use <xsl:include href="foo.xsl"/> anymore ...
I've noticed that the following line works <xsl:include 
href="http://localhost:8080/mytool/xsl/foo.xsl"/> ... but I can't let hard 
configuration like that in XSL files.

How can I get a correct mount point in order to load the 'foo.xsl' 
from 'myxsl.xsl' ??

Thanks !





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



<Prev in Thread] Current Thread [Next in Thread>