Helpful Information
Category: Programming Languages More

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 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; ........
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:projectxslfilestrans1.xsl"));

XSLTInputSource xmlInput = new XSLTInputSource(DomGenerater.buildDom());

processor.process(xmlInput, xslTrans, result);

catch(Exception e)
System.out.println("Exception " +e);