[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Is it OK for xsl:output to affect the construction of an unserialized result tree?


Subject: Re: [xsl] Is it OK for xsl:output to affect the construction of an unserialized result tree?
From: Barry Lay <blay@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Jul 2004 13:02:28 -0400

I would find this sort of behaviour non-intuitive. Using the JAXP API the attributes in the xsl:output element show up in the output properties of the transformer. In fact I have been able to reformat an XML document using a null transform and setting the property:

StreamResult result = new StreamResult( new FileWriter(projectBase + fileName) );
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty( "indent", "yes" );
transformer.transform( source, result );


I would guess that the serialization stage is interpreting the output properties. I am using Saxon so Michael Kay could confirm that this is true but I would be surprised (and a bit miffed) if it inserted text nodes into the result if "result" were a DOM. I don't know if there is a suitable place to put the output instructions in a DOM - they may just go away in that case.

Elliotte Rusty Harold wrote:

We should note that the general issue of whether the xsl:output can affect the construction of the result tree goes beyond the specific case cited here. For instance, if it is OK for xsl:output to do this, then one might imagine that <xsl:output indent="yes"/> could lead to the insertion of additional text nodes in the result tree, though to my knowledge no XSLT processor yet does that.


Current Thread
Keywords