RE: [xsl] Merging 2 XML's in to 1 output XML (Performance Issue)

Subject: RE: [xsl] Merging 2 XML's in to 1 output XML (Performance Issue)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 15:10:48 +0100
> > The problem is, I don't know whether the ContentHandler 
> does expect to
> > receive data from an XSL transformation.
> 
> If someone's giving the ContentHandler to TrAX, then I think it's a 
> pretty good bet they expect it to receive output from an XSL 
> transformation.

But they don't necessarily know that the XMLFilter they've invoked is
actually an XSLT transformation. The whole point about pipelines is that you
don't have to have special knowledge about who's before you and after you in
the pipeline. When you call transformerFactory.newXMLFilter() you get an
XMLFilter back, and you can pass that to someone who is expecting an
XMLReader, and who then calls parse() on it thinking that it's a real
parser. That user is entitled to expect that it obeys the contract for
XMLReader, which is is that an XMLReader notifies events representing a
well-formed document, and when it encounters an event that would make the
document ill-formed, it throws an exception.

There are no black-and-white right-and-wrong answers here: it's a matter of
judgment, and there are different use cases where different designs are
optimal. For that reason, Saxon allows you to override the above behavior.
Perhaps the default should be different for the XMLFilter scenario from the
SAXResult scenario. But it's not a bug if it isn't, it's a design that we
can talk about improving.

Michael Kay
http://www.saxonica.com/ 

Current Thread