|
Re: accessing resources from jar hosted in a plugin [message #80163 is a reply to message #80147] |
Fri, 05 January 2007 13:37 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
So, to clarify the problem, your issue is that you have a couple of stylesheets (xslt1 and xslt2) and that xslt1 uses xsl:import xslt2? And that it defaults to trying to load that as a file?
You probaly need to look at the URIResolver ( http://xml.apache.org/xalan-j/apidocs/javax/xml/transform/UR IResolver.html) which is supposed to be used to translate a request into a source location. You could return e.g. a StreamSource. The code will look something like:
public class JARURIResolver implements URIResolver {
Source resolve(java.lang.String href, java.lang.String base) {
return new StreamSource(getClass().getResourceAsStream(href));
}
}
:
:
Transformer transformer = ...
transformer.setURIResolver(new JARURIResolver())
Or something similar to the above. Note this is all off-the-top-of-my-head and I've not tested the idea, but it should give you the right direction to start following. You'll almost certainly need to do extra processing of either the href or base (e.g. putting a / on the front of the href value) but the idea should be sound in principle.
I'm surprised that Xalan doesn't provide something for this already :-)
Alex.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03075 seconds