RE: [xsl] Problem with rendering of &#160

Subject: RE: [xsl] Problem with rendering of &#160
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 13 Apr 2004 16:53:02 -0400
From: Richard.McMillian@xxxxxxxx [mailto:Richard.McMillian@xxxxxxxx]
 
I have a problem with non-breaking space being rendered as a "?" question
mark by the IE webbrowser.
I looked at the output html and the hex character is A0 as is is supposed to
be; however the XSL automatically inputs
<META http-equiv="Content-Type" content="text/html; charset=UTF-16"> after
the header.   Changing the Content
value to iso-8859-1 results in the correct rendering of the A0.  Where does
the XSL derive this META tag
value from?  I've included an XML sample and the XSL code below.


-- Getting utf-16 by default has nothing to do with xslt - it is a characteristic of the Microsoft xml/xslt processor, depending on how it is used.  Getting the display you do is a tipoff that your browser does not support that character in its own default encoding.  IE (in the US, anyway) is generally expecting iso-8859-1,  so you get the nonbreaking space rendering as intended when you use that encoding.

However, you have an error in the stylesheet.  You used a wrong encoding value in the xsl:output element.  You should write

<xsl:output method="html" encoding="iso-8859-1"/>

An encoding of "text" is not a recognized character encoding, and I am surprised you did not get an error from the processor.  Also, with the html output method, you don't need to omit the xml declaration - since the output is gong to be html and not xml, the xml declaration will not be inserted anyway.

Cheers,

Tom P

Current Thread