RE: [Serial] Re: [xsl] Preserving character entities

We have had quite an extensive debate on this. It has been pointed out that
a document with no XML declaration, in an encoding other than UTF-8 or
UTF-16, is not necessarily malformed: the XML specification allows the
encoding to be inferred from external information.

Pragmatically, there are many reasons people want to omit the XML
declaration, for example they want to concatenate document fragments or wrap
extra tags around them by manipulating the output at the textual level. They
might want to wrap one document inside CDATA tags for insertion into another
document. They may also want to transcode the serialized output, for example
when putting it in a database. It's clear from implementation experience
that many users found the rule in earlier XSLT 2.0 drafts a nuisance, and
that's why it was removed.

Michael Kay


> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of 
> Elliotte Harold
> Sent: 25 November 2004 16:33
> To: public-qt-comments@w3.org
> Cc: xsl-list@lists.mulberrytech.com
> Subject: [Serial] Re: [xsl] Preserving character entities
> 
> 
> David Carlisle wrote:
> 
> 
> > except that currently saxon mplements the last draft which 
> said that if
> > you specify an encoding and then specify you don't want the
> > xml-declaration that you get the declaration anyway (as in XSLT 1)
> > 
> > the new draft (following at least in part from a public comment from
> > me) says that xslt should do what you ask and not give you an xml
> > declaration in this case.
> > 
> > Any XML parser would then be required to correctly default this to
> > utf-8.
> > 
> 
> I would like to make a formal comment that this is wrong. The 
> serializer 
> should not output a malformed document. Currently, the spec says:
> 
> A serialization error results if the omit-xml-declaration 
> parameter has 
> the value yes, and
> 
>      * the standalone attribute has a value other than none; or
>      * the version parameter has a value other than 1.0 and the 
> doctype-system parameter is specified.
> 
> The serializer MUST signal the error.
> 
> I suggest a third bullet point be added along these lines:
> 
>     * the encoding attribute has a value other than "utf-8" or utf-16"
> 
> I do not see why encoding should be singled out here from 
> standalone and 
>   version. It makes more sense to simply signal an error on any 
> impossible case.
> 
> -- 
> Elliotte Rusty Harold  elharo@metalab.unc.edu
> XML in a Nutshell 3rd Edition Just Published!
> http://www.cafeconleche.org/books/xian3/
> http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/
> ref=nosim
> 
> 

Received on Thursday, 25 November 2004 17:31:41 UTC