I have a simple web application under websphere5. Under appDir\WEB-INF\classes\
I have these files:
main.xslt
templates.xslt
main.xslt
contains the instruction
<xsl:import href="templates.xsl" />
but the application fails when main.xslt
is used in Java code. How should I specify the path to imported XSL files if they all are in the same folder (WEB-INF\classes\
)?
Text of exception:
java.io.FileNotFoundException: d:\Program Files\WebSphere\AppServer1\templates.xsl (The system cannot find the file specif开发者_Python百科ied. )
You need to provide a custom uri-resolver to process the includes. In a web application, there's no guarantee that a filesystem is accessible, as you could be running out of a WAR file. Take a look at the javax.xml.transform.URIResolver interface and Transformer.setURIResolver()
Depending on how you loaded the main.xsl, you may need to set the SystemID
property, so that it can resolve the relative path.
精彩评论