RE: [xsl] JAXP/TrAX: how to set parser for transforms?

Subject: RE: [xsl] JAXP/TrAX: how to set parser for transforms?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 25 Apr 2001 08:51:56 +0100
> How does a Transformer know what XML parser to use?

If you want it to use a definite parser, you can supply one as part of the
SAXSource object.

If you don't care, you can supply a StreamSource, and the choice is then up
to the implementer. Saxon allows you to control the choice using
setAttribute() on the TransformerFactory. At the next release it will use
the JAXP javax.xml.parsers mechanism to define the fallback parser.
>
> If I want all the XML parsing to be done with a certain
> parser, what do I do?

In the case of Saxon, use setAttribute() on the TransformerFactory, once for
the source document parser and once for the stylesheet parser. Xalan I think
uses the javax.xml.parsers mechanism already.
>
> What if I want the parser for the main source document to be different
> than the one used by document() and xsl:include?

Then you need to supply each input in the form of a SAXSource that
encapsulates its own parser.

Note: JAXP is a little ambiguous as to whether the URIResolver should be
used for the principal input files as well as secondary inputs. Saxon does,
Xalan doesn't (I think).

Mike Kay


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


Current Thread