You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Kelly Campbell <ca...@channelpoint.com> on 2000/11/17 18:49:16 UTC

[bug?] DTM vs XercesLiaison in 1.2.1

We ran into a little bug in the FOP build when xalan upgraded to 1.2.1. I
had added some code into our Xslt task for Ant to cache stylesheets using
StylesheetRoot and to use a DOM document as the source for the xslt
operation to speed up some of the code generation that's done for fonts in
FOP.

People using Xalan 1.2.1 began getting this error:

XSL Error: Cannot use a DTMLiaison for a input DOM node...
           pass a org.apache.xalan.xpath.xdom.XercesLiaison instead!
  Task xslt - SAX ERROR:
        org.apache.xalan.xslt.XSLProcessorException:

Here's the code which was getting this exception:

org.w3c.dom.Document source = buildDocument(infile);
XSLTInputSource xmlSource = new XSLTInputSource (source);
XSLTResultTarget xmlResult = new XSLTResultTarget (outfile);
StylesheetRoot stylesheet = StylesheetCache.getStylesheet(xsltfile);
stylesheet.process(xmlSource, xmlResult); // <<<< this throws the exception

The StylesheetRoot object was created as follows:

XSLTProcessor processor = XSLTProcessorFactory.getProcessor(
                new org.apache.xalan.xpath.xdom.XercesLiaison());
StylesheetRoot compiledSheet = processor.processStylesheet(xslSheet);

Which worked fine in Xalan 1.2.0, but stopped working in 1.2.1. The easy fix
was to add a processor created with the XercesLiaison to the
stylesheet.process call, but my concern is that this still acts contrary to
the documentation listed at http://xml.apache.org/xalan/dtm.html which says
that the XercesLiaision will be used if the source document is a DOM instead
of an InputStream. I noticed there was a bugfix listed in the changes
between 1.2.0 -> 1.2.1 in this particular area, but it seems that it also
broke it in the case of using StylesheetRoot.

-Kelly
--
Kelly A. Campbell             Software Engineer
<ca...@channelpoint.com>       ChannelPoint, Inc.
<ca...@merlotxml.org>          Colorado Springs, Co.