[xsl] SAXTransformerFactory/XMLFilter in pipe?

Subject: [xsl] SAXTransformerFactory/XMLFilter in pipe?
From: Niels Peter Strandberg <nielspeter@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Mar 2002 15:53:04 +0100
If I have a SAXTransformerFactory and generates sax XMLfilters from some stylesheets, like this:

SAXTransformerFactory stf = (SAXTransformerFactory) tfactory;

XMLFilter filter1 = stf.newXMLFilter(new StreamSource(xslID_1));
XMLFilter filter2 = stf.newXMLFilter(new StreamSource(xslID_2));
XMLFilter filter3 = stf.newXMLFilter(new StreamSource(xslID_3));

filter1.setParent(reader);
filter2.setParent(filter1);
filter3.setParent(filter2);
filter3.setContentHandler(new ExampleContentHandler());

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?

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.

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



Current Thread