Re: More entity confusion and my opinion on the right way

Subject: Re: More entity confusion and my opinion on the right way
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Jan 1999 21:13:54 -0800
At 99/01/05 14:36 -0800, Andrew Bunner wrote:
>  Wrong.
>
>  &#32; (space) gets translated to the space character, not to &nbsp;

That is because &#32; is the space.

The value &#160; is the non-breaking space.

An example is attached below (with manually modified HTML to prevent mail
readers from rendering; just change all occurrences of "< " to "<").

........... Ken


T:\FTEMP>type greeting.xml
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="greeting.xsl"?>
<greeting><emphasis>Hello</emphasis>&#160;World!</greeting>

T:\FTEMP>type greeting.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                xmlns="http://www.w3.org/TR/REC-html40";
                result-ns="">

<xsl:template match="/">   <!--the framework of a complete HTML file-->
  < html>
    < head>
      < title>Test< /title>
    < /head>
    < body>
      < xsl:apply-templates/>
    < /body>
  < /html>
</xsl:template>

<xsl:template match="greeting">
  < p><xsl:apply-templates/>< /p>
</xsl:template>

<xsl:template match="emphasis">
  < b><xsl:apply-templates/>< /b>
</xsl:template>

</xsl:stylesheet>

<!--end of file-->
T:\FTEMP>call xsl greeting.xml greeting.xsl greeting.htm
T:\FTEMP>type greeting.htm
< !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
< html>
< head>
< title>Test< /title>
< /head>
< body>
< p>
< b>Hello< /b>&nbsp;World!< /p>
< /body>
< /html>

T:\FTEMP>

--
G. Ken Holman         mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com/s/
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Training:   http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training (see training link):   WWW8 - 1999-05-11


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


Current Thread