You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by John Quinn <qu...@gmail.com> on 2006/04/11 18:33:44 UTC

Fwd: Missing or incorrect XSLT Namespace error (javax.xml.transform.TransformerConfigurationException)

 I am receiving an exception when I try to generate a PDF in a Servlet using
FOP under JBoss4.0.1SP1 (and JBoss4.0.3SP1) in a Redhat linux 2.1 OS.  Also
using xalan 2.6 and Java 1.4.2_10.

I am running the same code under  a Suse linux and Win XP OS without any
errors using JBoss.

Here's the Exception:
2006-03-02 15:17:21,969 INFO  [STDOUT] 15:17:21,958 ERROR [PDFServlet] Error
generating PDF file
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException : org.xml.sax.SAXException :
Missing or incorrect XSLT Namespace.
       at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates
(TransformerFactoryImpl.java:807)
       at com.kroger.accounting.ad.reports.PDFReport.generate(PDFReport.java:96)
       at com.kroger.accounting.ad.view.reports.PDFServlet.generateReport
(PDFServlet.java:80)
       at com.kroger.accounting.ad.view.reports.PDFServlet.doGet(
PDFServlet.java:70)


Code snippet (last line is where the exception is generated):

 public OutputStream generate() throws Exception {

 InputStream xslInputStream =3D null;

 log.info("PDFReport.generate(): url =3D<" + xslUrl + ">");

 if (xslUrl !=3D null) {
  xslInputStream =3D xslUrl.openStream ();
 } else {
  xslInputStream =3D new FileInputStream(xslFile);
 }


 // transform xml + xsl =3D> xslt
 TransformerFactory tf =3D TransformerFactory.newInstance();

 log.info("PDFReport source url for TransformerFactory: " +
tf.getClass().getProtectionDomain().getCodeSource());

 Templates xslTemplate =3D tf.newTemplates(new StreamSource(xslInputStream=

));

The xsl has the namespaces in it.  Of course it would have to in order to
work in the XP and SUSE linux environments.

They are xmlns:xsl=" http://www.w3.org/1999/XSL/Transform " and
xmlns:fo="http://www.w3.org/1999/XSL/Format
"

I also removed xml_apis.jar from the war file since JBoss had it in it's
endorsed library,

I have run out of ideas, someone suggested using saxon, however, I have
found a lot of problems with folks trying to use saxon with FOP.

I'd send the full xsl, but the mail server is not letting it go with the xsl
file.

Any idea appreciated,
Thanks,
John