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

Subject: ISO-8859-1 encoding and XmlDecl omision (was Re: [xsl] Looking up keys in a separate xml file)
From: "John Meyer" <jmeyer@xxxxxxxxxxx>
Date: Tue, 6 Jan 2004 10:36:03 -0500
David,

I'm not sure I understand why 

<xsl:output method='xml' version='1.0' encoding='iso-8859-1'
	omit-xml-declaration="yes" indent="yes"/>

is invalid. ISO-8859-1 is a subset of UTF-8 and should cause no problems
since most parsers default to UTF-8 if the XML declaration is ommited.

Secondly, the xml-declaration can be invalid when not outputting a
well-formed XML document entity. This would occur when outputting only a
document fragment. If the declaration must be output when a non-UTF
encoding is used, this would cause serious problems outputting anything
other than document entities. I believe the only constraint when using
the XML output method is that the result must be a general parsed
entity.

I am interested in knowing if any xslt processors exhibit this behavior
though. It would seem to be a debilitating limitation unless I am
misunderstanding you.

As I side note, I think all document entities should contain an XML
declaration. The extra characters are nominal for memory requirements
and can be significant aid in identifying the document characteristics.


John Meyer
Senior Software Engineer
Clinician Support Technology
1 Wells Avenue, Suite 201
Newton, MA 02459
www.cstlink.com

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx] 
Sent: Tuesday, January 06, 2004 9:53 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Looking up keys in a separate xml file


> There may be a better way than saving the @lookup as $key_value,

In XSLT1 that is about the best you can do, this is made simpler in
XPath/XSLT2 drafts, where you can use the key() function after
a step in an Xpath so instead of

 <xsl:for-each select="$desc">
      <xsl:copy-of select="key('

you'll be able to do
 <xsl:copy-of select="document(...)/key(..."

Note however that:
> 
> <xsl:output method='xml' version='1.0' encoding='iso-8859-1'
> omit-xml-declaration="yes" indent="yes"/>

has incompatible options: you can't have latin1 output and omit the xml
declaration (otherwise the result would not be well formed XML.
The XSLt engine will be forced to ignore omit-xml-declaration="yes"
here.

David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



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


Current Thread