I recently switched from a standalone FOP app to the servlet. The code compiles fine, but any lines that use SAX throw a transformer exception. For example. the following line
driver.render(input.getParser(), input.getInputSource()); throws a NPE (input is "XSLTInputHandler input = new XSLTInputHandler(new File(xmlParam), new File(xslParam));"). I changed the code using some examples from this list, but again, any time I use SAX, it does not work. I have tried the following with no luck: transformer.transform(fileSource, new SAXResult(driver.getContentHandler() )); throws a NPE transformer.transform( new DOMSource( inputDoc ), new SAXResult(driver.getContentHandler() )); throws a transform exception with "The markup in the document preceding the root element must be well-formed" transformer.transform( new SAXSource( new InputSource ( new StringReader ( xml ) ) ), new SAXResult(driver.getContentHandler() )); throws a transform exception with "The markup in the document preceding the root element must be well-formed.; Line#: 1; Column#: 1" transformer.transform(fileSource,streamResult); **this works** I tried changing the transformer factory from the following seemingly working line: Transformer transformer = transformerFactory.newTransformer(new javax.xml.transform.stream.StreamSource(xsl)); to Transformer transformer = transformerFactory.newTransformer(new javax.xml.transform.sax.SAXSource( new InputSource ( new StringReader ( xsl ) ) )); but this now throws a transform exception with "The markup in the document preceding the root element must be well-formed" The code is currently working with: XSLTransform.transform(xml, xsl, writer); but I really need the speed and efficiency increase of SAX. This led me to believe that me XSL was bad, but it looks OK to me: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nl "
"> <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output method="xml" indent="yes" encoding="utf-8"/> ... The XSL file also looks OK. I read some posts that their was a fix for nulls outside of the root causing a NPE, but I think it was fixed in 0.20.2. Is this not the case? Also, I don't explicitly include the sax jar file - do I need to? I'm using xalan 2.0.0 and xerces 1.2.3. Thanks for any help - this is driving me nuts. -Lou --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]