xsl-list
[Top] [All Lists]

[xsl] Missing or incorrect XSLT Namespace

2006-04-06 13:03:55
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Missing or incorrect XSLT Namespace, John Quinn <=