• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

XSLTProcessor and usage of relative path

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is related to parsing XML using java parser API on server side in a typical web application..
Question : How to fix Limitation(may be) of xslt:
Path name to XSLT file is hard coded. It appears that XMLInputSource has trouble with file names.
I want to be able to give relative (not absolute) file names as properties (either via properties files or from the data dictionary) for the XSLT files. what support is there for resolving relative file names and what working directory or root URL they can be relative to. Using Apache XS
Can Any body suggest me how to fix this- relative path.... problem / by example ,source for docs...
The Java Code:
import org.apache.xalan.xslt.XSLTEngineImpl;
import org.apache.xalan.xpath.xml.XMLParserLiaisonDefault;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xslt.XSLTProcessor;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTResultTarget;
import org.apache.xalan.xpath.xdom.XercesLiaison; ........
......
try{
XSLTProcessor processor = XSLTProcessorFactory.getProcessor
(new org.apache.xalan.xpath.xdom.XercesLiaison());
XSLTResultTarget result=new XSLTResultTarget(res.getOutputStream());
/*
The xsl file location is hard coded .i.e absolute path. But what I want is relative path ....
*/
XSLTInputSource xslTrans = new XSLTInputSource(new
FileInputStream("c:\\project\\xslfiles\\trans1.xsl"));
XSLTInputSource xmlInput = new XSLTInputSource(DomGenerater.buildDom());
processor.process(xmlInput, xslTrans, result);
}
catch(Exception e)
{
System.out.println("Exception " +e);
}

Thanks,
___Ashish

 
A feeble attempt to tell you about our stuff that makes us money
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic