Hi, David
Please post your xsl file here. The NullPointerException is likely from the
processing of the stylesheet. Without the xsl file, we cannot do any
further investigation. Thanks.
Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]
David Q
Levitt/Cambridge/ To: [EMAIL PROTECTED]
IBM@IBMUS cc:
Subject: TransformerException /
NullPointerException in portlet
10/25/2002 06:38
PM
Please respond to
xalan-dev
I'm trying to do an Xalan XSLT Transformation inside a portlet in order to
transform an XML DOM Element (which I've received from a web service) into
html to display. When the last line in the following code gets executed -
which doesn't do the transform but merely creates the transformer - I'm
getting this Exception:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.lang.NullPointerException at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:816)
at com.mycompany.portlets.dql.HelloWorld.service
here's the code:
InputStream xsltStream =
context.getResourceAsStream("/WEB-INF/hardcode.xsl");
xsltStreamSource = new StreamSource(xsltStream);
TransformerFactory tFactory = TransformerFactory.newInstance();
try {
Transformer transformer = tFactory.newTransformer(xsltStreamSource);
outputString = "transformer created";
}
catch (TransformerConfigurationException tce) {
PrintWriter writer = response.getWriter();
tce.printStackTrace(writer);
}
I verified that the XSL file is being read properly and converted into an
InputStream. I even went so far as to hardcode the XSL into my portlet and
read it in from a StringReader - same result.
Many thanks for any help offered.
- Dave Levitt