[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Is it OK for xsl:output to affect the construction

Subject: RE: Is it OK for xsl:output to affect the construction of an unserialized result tree?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 20 Jul 2004 16:57:11 +0100
cafeconleche text of node
I find this interpretation of the specification rather surprising. Clearly
the result tree must contain all the element nodes, it is only the
serialization of the result tree that does not contain them. The trouble is
that the result tree is not a concrete object, you can only see a view of it
(e.g. as a serialized XML stream, a SAX stream, a DOM stream, etc) and since
the mapping of the abstract result tree to these various forms is
unspecified, they can always claim the right to do it as they like. But it
feels far-fetched to me.

Michael Kay

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo@xxxxxxxxxxxxxxx] 
> Sent: 20 July 2004 16:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Is it OK for xsl:output to affect the 
> construction of an unserialized result tree?
> 
> This is a practical issue relating to proposed Xalan-J bug:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=30197
> 
> Consider this stylesheet:
> 
> <?xml version="1.0"?> <xsl:stylesheet version="1.0"
>                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 				  <!-- test a stylesheet that use 
> method="text" -->
>    <xsl:output method="text"/>
>  
> <xsl:template match="/">
>      <element1>12345</element1>
>      <element2>67890</element2>
>      <element3/>
> 	<element4>0987654321</element4>
> 	<xsl:comment>test</xsl:comment>
> 	<xsl:processing-instruction name="test">PIs are not treated 
> as literals in
> XSLT?</xsl:processing-instruction>
>    </xsl:template>
> 
> </xsl:stylesheet>
> 
> Suppose we transform a DOM Document, XOM document, SAX InputSource or 
> some other such representation of an XML document. Furthermore 
> suppose that instead of serializing the output as a stream or a 
> string we create another DOM document, XOM document, etc. Should the 
> xsl:output element have any effect?
> 
> My claim is that it should not. Anything said in the xsl:output 
> element applies only when the document is serialized to a an actual 
> XML document represented as a sequence of characters or bytes, not 
> before. This is what earlier versions of Xalan did. Faced with this 
> case,  they would produce a result tree containing six child nodes of 
> different kinds,
> element, comment, and processing instructions.
> 
> However, in the last few versions, Xalan produces a single text node 
> containing all the element content. The elements, comments, and 
> processing instructions should be reduced to plain text only when the 
> document is serialized, not before. In my opinion, Xalan appears to 
> be jumping the gun when the output method is text and incorrectly 
> assuming that it can generate a single text node. However, at least 
> on of the Xalan developers disagrees with me, and thinks this is 
> acceptable and indeed desirable behavior.
> 
> What does everyone else think? I've always assumed xsl:output only 
> applied in serialization, not result tree construction but Joe 
> Kesselman thinks the spec language is at best ambiguous on this 
> point. Interpretations from working group members would be 
> particularly helpful.
> 
> One thing that worries me is that if this is made optional (because 
> xsl:output is support clearly optional according to the spec) then 
> this becomes yet another point where different implementations behave 
> differently with no clear way for client code to figure out what's 
> likely to happen.
> 
> -- 
> 
>    Elliotte Rusty Harold
>    elharo@xxxxxxxxxxxxxxx
>    Effective XML (Addison-Wesley, 2003)
>    http://www.cafeconleche.org/books/effectivexml            
>    
> http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosi
> m/cafeaulaitA 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.