Hello friends,
I tried to use XSLTC transformation instead of the "original" xalan
transformation. According to the notes I did:
1) put all of the jars in the classpath :
....., xsltc.jar, runtime.jar, BCEL.jar, Jlex.jar,
java_cup.jar, .....
2) set the properties:
String key = "javax.xml.transform.TransformerFactory";
String value =
"org.apache.xalan.xsltc.runtime.TransformerFactoryImpl";
Properties props = System.getProperties();
props.put(key, value);
System.setProperties(props);
3) ran our program and got an error : (listed bellow)
If I go back and set the properties to
org.apache.xalan.processor.TransformerFactoryImpl
we don't have problems.
Ok. What does our program do?
We have a (base) servlet that does :
TransformerFactory tFactory = TransformerFactory.newInstance();
Document pXMLSource = getXML();
String xslData = getXSL();
ByteArrayInputStream pXSLSource = new
ByteArrayInputStream(xslData.getBytes());
Transformer transformer = tFactory.newTransformer(new
StreamSource(pXSLSource));
if (pXMLSource != null)
transformer.transform(new DOMSource(pXMLSource), new
StreamResult(out));
So every servlet that extends this servlet feeds:
---> the appropriate XSL file as a (java.lang.String) ;
--->and the appropriate XML as (org.w3c.dom.Document);
Then we transform.
Please tell me why it doesn't work with the XSLTC processor. I looked in the
sources and my suspicion is that because we feed the XSL as a string we
don't have any URI attached - we feed just plain string (not File ).
Your help is very appreciated.
Thanks,
Ivan Georgiev
THE ERROR:
VTServlet::LoginServlet:
Exception received was: java.lang.NullPointerException
at
org.apache.xalan.xsltc.runtime.TransformerFactoryImpl.newTransformer(Transfo
rmerFactoryImpl.java:229)
at
com.vizional.portal.VTServlet.processTransformRequest(VTServlet.java:316)
at com.vizional.portal.VTServlet.doPost(VTServlet.java, Compiled Code)
at com.vizional.portal.VTServlet.doGet(VTServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:701)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:826)
at
com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.jav
a:462)
VTServlet::LoginServlet: com.vizional.VTError: Error in processing XSL :null
Exception received was: com.vizional.VTError: Error in processing XSL
:null
at
com.vizional.portal.VTServlet.processTransformRequest(VTServlet.java:345)
at com.vizional.portal.VTServlet.doPost(VTServlet.java, Compiled Code)
at com.vizional.portal.VTServlet.doGet(VTServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:701)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:826)
at
com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.jav
a:462)