dynamic xsl files

J

Jon Smith

I have an app that has some dynamic xsl files generated from jsp files. We
are calling transform to do the tranformation using xalan and specifying the
full URL to the JSP files (on same server) e.g.
http://myserver/myapp/jsp/transformXSL.jsp is there a way of specifying
these paths relatively. or calling a translator. not specifying the server
etc causes it to be interpreted as a file e.g. /myapp/jsp/transformXSL.jsp
fails with file:/myapp/jsp/transformXSL.jsp not found

Thanks

Jon
 
G

gimme_this_gimme_that

Can you read the xsl file as a resource ? (A file in your
WEB-INF/classes directory?

Sort of like :

<%!
public static Transformer getTransformer( String sFileName ) throws
Exception {

Transformer transformer = null;
try {
InputStream stream =
getClassLoader().getResourceAsStream(sFileName);
BufferedReader reader = new BufferedReader (new
InputStreamReader (stream));
StreamSource source = new StreamSource (reader);
transformer = TransformerFactory.newInstance().newTransformer(
source ) ;
} catch ( TransformerConfigurationException ex ) {
// log error or do something
}
return transformer;
}
%>
 
J

Jon Smith

Thanks for this, but unfortunately getting a resource as stream just gets
the jsp file, it does not get interpreted by the app server.

mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top