[xsl] Missing or incorrect XSLT Namespace

Subject: [xsl] Missing or incorrect XSLT Namespace
From: "John Quinn" <Jquinn@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Apr 2006 15:59:34 -0400
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.

I am running the same code under  a Suse linux and Win XP OS WITH NO ERRORS
using the same versions of 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 = null;
  log.info("PDFReport.generate(): url =<" + xslUrl + ">");

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

  // transform xml + xsl => xslt
  log.info("PDFReport xslInputStream: " + xslInputStream);
  TransformerFactory tf = TransformerFactory.newInstance();
  log.info("PDFReport code source for TransformerFactory: " +
tf.getClass().getProtectionDomain().getCodeSource());
  log.info("PDFReport package for TransformerFactory: " +
tf.getClass().getPackage());
  Templates xslTemplate = tf.newTemplates(new StreamSource(xslInputStream));
  Transformer xslt = xslTemplate.newTransformer();


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


First portion of XSL with namespaces defined:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:attribute-set name="table">

<xsl:attribute name="font-size">8pt</xsl:attribute>

</xsl:attribute-set>

<xsl:template match="/">

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<!-- defines the layout master -->

<fo:layout-master-set>

I can send the full xsl, but it, of course, is large.

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, and I'm not
sure  which versions of saxon are best for using with FOP.


Any idea appreciated,
Thanks,
John

Current Thread