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

Re: outputting &nbsp to HTML (not so final answer)

Subject: Re: outputting &nbsp to HTML (not so final answer)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 17 Dec 2001 16:12:04 +0000
declare nbsp xml
Hi Aniceto,

> using "<xsl:output method="html"/> + &#160; combination" I can have
> something like "<td> </td>" not "<td>&nbsp;</td>" as desired to
> solve the netscape cell problem

MSXML3 is serializing non-breaking space characters as native
characters (an actual non-breaking space character) rather than using
the HTML character entity reference (&nbsp;).

You can force MSXML3 not to use the native character by telling it to
serialize in an encoding which doesn't include the non-breaking space
character, for example ASCII:

<xsl:output encoding="US-ASCII" />

Unfortunately, MSXML3 does not use the HTML character entity reference
(&nbsp;) even if it can't use the native character, but instead gives
a character reference:

  <td>&#160;</td>

That's as close as you're going to get with MSXML3. Other processors
will use the character entity reference (&nbsp;) in these
circumstances.

But having tested in Netscape 4.74, whether you use a native
character, a character entity reference or a character reference makes
no difference - the table cell is rendered in exactly the same way.
It's only when you look at the source of the result file that you
might think that the native non-breaking space character was a normal
space rather than a non-breaking space.

> I can read in secction 2: "You can even declare nbsp in an internal
> subset of your stylesheet if you want a friendlier representation of
> the character" but I can't guess that it means

It means that you can use a DOCTYPE declaration in your stylesheet to
declare that the entity reference &nbsp; means the non-breaking space
character:

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp '&#160;'>
]>

And then in your stylesheet you can use &nbsp; as much as you want, to
mean a non-breaking space character. However, this does not affect the
way the non-breaking space character is serialized in the result
document. Whether you use:

  <td>&nbsp;</td>
  <td>&#160;</td>
  <td> </td>      (where that 'space' is a non-breaking space)

makes no difference to the XSLT processor.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.