You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Kent Fitch <k....@adfa.edu.au> on 2000/10/28 10:08:04 UTC

possible bug in Xalan 1.2 not passing parserLiaison class to StylesheetRoot

I've just started using Xalan, and everything worked well
until I tried using a DOM input *with* the pre-compiled
Stylesheet like this:

XSLTProcessor xsltProc = XSLTProcessorFactory.getProcessor
       (new org.apache.xalan.xpath.xdom.XercesLiaison());
StylesheetRoot styleSheet = xsltProc.processStylesheet("foo.xsl") ;

Document doc =

(Document)Class.forName("org.apache.xerces.dom.DocumentImpl").newInsta
nce();
doc.appendChild(...) ;
...
XSLTInputSource xmlID = new XSLTInputSource(doc);
ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
styleSheet.process(xmlID, new XSLTResultTarget(baos));

- it didnt like the DOM input, and I think the reason
is that when the StylesheetRoot is created in XSLTEngineImpl.java
(eg, in createStylesheetRoot() method), the m_parserLiaison
isnt checked and passed across to the StylesheetRoot.  I saw
StylesheetRoot had an init() method to pass this in, but
it didnt seem to be being called in the above sequence.
My "fix" was to change as follows:

public StylesheetRoot createStylesheetRoot(String baseIdentifier)
    throws MalformedURLException, FileNotFoundException,
           IOException, SAXException
  {
StylesheetRoot kf = new StylesheetRoot(this, baseIdentifier);
if (m_parserLiaison != null) {
 kf.m_liaisonClassUsedToCreate = m_parserLiaison.getClass().getName();
System.out.println(" KF SET
StylesheetRootm_liaisonClassUsedToCreate="+
kf.m_liaisonClassUsedToCreate) ;
}
return kf ;
//    return new StylesheetRoot(this, baseIdentifier);
  }

This fixed my problem, but maybe I've misunderstood the
process of the parserLiason stuff is meant to work.

Otherwise, I've found Xalan 1.2 to be fast and stable -
thanks for such a great tool!

Regards,

Kent Fitch