RE: [xsl] SAXTransformerFactory/XMLFilter in pipe?

Subject: RE: [xsl] SAXTransformerFactory/XMLFilter in pipe?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 26 Mar 2002 15:14:19 -0000
> If I have a SAXTransformerFactory and generates sax
> XMLfilters from some
> stylesheets, ...
>
> Since the filter has SAX as input and output. Does this mean that for
> each filter a new DOM tree has to be build from the SAX
> events, then the
> stylesheet is applied / transforming the DOM tree, then the
> DOM tree is
> walked to produce new SAX events, witch is then used for input to
> another filter...? Is that correct?

An XPath tree, yes. Not necessarily a DOM tree.
>
> If that is the case, then why use SAXTransformerFactory att all? The
> events will never reach the next filter, before the transformation is
> finish and the DOM is walked to generate SAX events.

Firstly, some processors (e.g. Xalan) can do the tree building and the
transformation in parallel. Secondly, even if each stage of the pipeline
builds a full tree before transformation starts (as it will with Saxon),
it's a convenient processing model. And it's better to let the processor
build the tree rather than building it from the user application, because
the processor is then able to make decisions about how to build it. For
example, with Saxon, whitespace stripping is much more efficient when Saxon
builds the tree itself.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx
>
> What about Xalan stree? From the xalan javadoc: "The primary
> feature of
> the Stree is that nodes can be parsed on one thread, while they are
> being read on another thread. If a requested child node has not yet
> arrived, the reading thread will wait until the parse thread has
> produced the node...." Does this mean that xalan will start reporting
> sax events to the next filter in line before the
> transformation on the
> previous filter  is finished?
>
>
> Niels Peter
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread