cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject Fix for xalan-based xsl:include
Date Wed, 19 Jan 2000 17:23:52 GMT


Stefano, many many apologies for not getting this to you sooner (and before
your 1.6 release).  I've been stretched pretty thin over the last couple of
weeks for one reason or the other.

Stefano, I hope at some point you are planning to make a
stylesheet/transform object pool?  Depending on the transform, a lot of
time can be spent on the processing of the stylesheet.  Both Xalan and XT
allow you to create stylesheet objects that are independent of the content
being transformed.

Here is the patch I think you need to make to the XalanTransformer parser
liaison:

  class XMLParser extends XMLParserLiaisonDefault
  {
    Parser parser;
    Document document;

    public XMLParser(Parser parser)
    {
      this.parser = parser;
    }

    public Document createDocument()
    {
      return this.parser.createEmptyDocument();
    }

    public void parse(InputSource in) throws IOException, SAXException
    {
      this.document = this.parser.parse(in);

      // The Xalan stylesheet is normally built from SAX events,
      // so if a DocumentHandler is specified, we need to produce
      // SAX events from the DOM tree.
      if(null != m_docHandler)
      {
        org.apache.xalan.xpath.xml.TreeWalker tw
          = new org.apache.xalan.xpath.xml.TreeWalker(stylesheetProcessor);
        tw.traverse(this.document);

        // Note that when cocoon transitions to being more SAX based,
        // this function will be called recursivly while the parser is
        // still in the middle of a parse, and thus the parser will have
        // created on the fly (or perhaps cloned) since the Xerces parser
        // is not (to my knowledge) reentrant.
      }
    }

    public Document getDocument()
    {
      return this.document;
    }

    public boolean getShouldExpandEntityRefs()
    {
      return true;
    }

    public boolean supportsSAX()
    {
      return true;
    }
  }

-scott




Mime
View raw message