xsl-list
[Top] [All Lists]

RE: ISO-8859-1 encoding and XmlDecl omision (was Re: Looking up keys in a separate xml file)

2004-01-07 07:40:38

I wrote

It has to either ignore the omit-xml-declaration, or ignore the 
requested encoding, and to output using an encoding that doesn't 
require a text declaration (utf8 or utf16)

Actually although this is my experience of XSLT1 
implementations, the XSLT1 spec is not so explicit on the 
behaviour in this case.

However the XSLT2 drafts (which I've read more recently) are explicit:

http://www.w3.org/TR/2003/WD-xslt-xquery-serialization-20030502/#N40031
8

  The omit-xml-declaration parameter should be ignored if the
  standalone parameter is present, or if the encoding parameter
  specifies a value other than UTF-8 or UTF-16. 

I currently have the situation where the result of my transform is
included as part of a html page using jsp.  

I use encoding="ascii" to ensure all of my character refs remain as
character refs through to the output, but for this reason (as Ive just
found out) the omit-xml-declaration="yes" is ignored - which means in
the middle of my output I have the xml declaration.

HTML being as forgiving as it is, this isnt a problem, but I would like
it gone - whats the solution here?

I would have thought that as ascii is a subset of utf-8, the processor
could happily leave the declartion out knowing that any future parsing
of the document would use utf-8 (by default) and could correctly read
the file.  

cheers
andrew

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