This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes relative path for XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "relative path for XSL" Watch "relative path for XSL" New topic
Author

relative path for XSL

Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
I am having trouble referencing my stylesheets in a relative way. Currently, we have the paths to the style sheets hardcoded. (The JSP pages that contain the following lines are in the tm directory)
processor.process(new XSLTInputSource(doc.getDocumentElement()), new XSLTInputSource("file:c:\\progra~1\\allaire\\jrun\\servers\\default\\tm\\xslfiles\\loadstatus.xsl"), htmlstream);}catch(Exception e){System.out.println(e.getMessage()); e.printStackTrace();}
When I try different things for the parameter to the 2nd XLSTInputSource class instantiation, nothing seems to work:
new XLSTInputSource("\\xslfiles\\loadstatus.xsl"); x
new XLSTInputSource("xslfiles\\loadstatus.xsl"); x
What do I need to do to make the relative path work? We will be deploying this on different servers so we don't want to have to set up some absolute path.
Thanks for the help!
Brian Nice
bcnice@mindspring.com
Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
I got it now. I needed to include the application root directory in the path name. So something like the following works:
processor.process(new XSLTInputSource(doc.getDocumentElement()), new XSLTInputSource("tm/xslfiles/result.xsl"), htmlstream);
Brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: relative path for XSL
 
Similar Threads
JSP with XSL
Servlet Write a file to server
xml-xml transformation exception
XSLTProcessor and usage of relative path
Migrating Older Code to JAXP 1.2