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

Re: How to deal with special characters in XSL?

Subject: Re: How to deal with special characters in XSL?
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Wed, 17 Oct 2001 17:19:09 -0400
c2 a0
I decided to try it out myself.  See the xslt file at the end of this post.
It produces a
table cell with some text and two non-breaking spaces.  Output encoding is
utf-8 (iso-8859-1 seems to produce the expected results).  This is on
Windows2000, in a command line session.  I did a copy-and-paste from the
command line results.

Three  processors, xt, 4xslt and saxon, actually output the characters
"&nbsp;".  Two others, sablotron v 0.7 and msxsl (using msxml3) output
strange looking characters that, in examining the hex, turned out to be hex
C2 A0.  Now A0 is hex for 160.  I assume that C2 A0 is correct for UTF-8?
Anyone know for sure?

The C2 A0 do not display as a nonbreaking space in IE5.5 on my system.  I
assume that's because it doesn't know that the file is in utf-8.

If I use iso-8859-1 encoding, the output from those two processors is A0, as
expected.  The upshot is that if you output in utf-8, the browser may not
know that, and so display the character incorrectly.  I'm not sure how to
inform the browser about the encoding.

Cheers,

Tom P


                           4xslt output
<html>
  <body>
    <table>
      <tr>
        <td>Here are two non-breaking spaces ==&nbsp;&nbsp;==
                </td>
      </tr>
    </table>
  </body>
</html>


                               saxon output
<html>
   <body>
      <table>
         <tr>
            <td>Here are two non-breaking spaces ==&nbsp;&nbsp;==

            </td>
         </tr>
      </table>
   </body>
</html>

                           msxsl output
<html><body>
<table><tr>
<td>Here are two non-breaking spaces ==-á-á==
                </td>
</tr></table>
</body></html>


Sablotron 0.7 output:
<html>
  <body>
    <table>
      <tr>
        <td>Here are two non-breaking spaces ==-á-á==
                </td>
      </tr>
    </table>
  </body>
</html>



==============================================
Stylesheet:

<?xml version="1.0" encoding='utf-8'?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' encoding='utf-8'/>

<xsl:template match="/">
<html><body>
 <table><tr>
  <td>Here are two non-breaking spaces ==&#160;&#160;==
  </td>
 </tr></table>
</body></html>

</xsl:template>
</xsl:stylesheet>


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


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.