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

Re: Empty object

Subject: Re: Empty object
From: scott gabelhart <swgabel@xxxxxxxxxxxx>
Date: Thu, 29 Jan 2004 10:21:13 -0500
ie empty td
Wendell Piez wrote:

Hi Scott,

At 03:57 PM 1/28/2004, you wrote:

in my final output I need to physically see <td>&nbsp:</td>. Currently my output contains <td>{a single space}</td>. The reason being my OBJECT element is transformed to <td> and the original space needs to be held within the outputed <td>&nbsp;</td>. If you open my current output in IE you will see the famous A where my output contains <td> </td>


By "the famous A" I take it you mean two characters, the A-with-circumflex (a little "hat" on top) followed by a space: "Â " (I paste it in hopes it'll come through).

In fact, this is what Internet Explorer shows when it's looking at a UTF-8 non-breaking space, but it doesn't know the file is in UTF-8, instead construing it in an older encoding (iso-8859-1 or some such).

In other words, you are in fact getting the correct character, only IE is not showing it to you.

Adding an encoding declaration to your output -- perhaps even assuring it's "safe" for IE by using <xsl:output encoding="iso-8859-1"/> (assuming your processor will do that: most will) and thereby writing in a character set that IE can handle, will fix this.

If you really want to post-process your file, or force your post-transformation serializer, to substitute the non-breaking space character with an entity reference (or rather, with a string that will function as such in the serialized output), that can be done. See for example http://www.xml.com/pub/a/2003/01/02/xmlchar.html. Doing this in XSLT, however, isn't recommended for those who haven't fully grasped the downside of the optional d-o-e feature.

It's far better, and usually much easier, to set up things so that your browser recognizes what character encoding your document is actually in, instead of just guessing wrong.

I might give more details on how to do this, only the whole thing makes my head hurt, and I know there are others on this list who could do a better job of it. But this is the oldest FAQ in the book.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Wendell,

thanks for all the input. Fixed the problem yesterday afternoon.

xml input file
<snippet..>

<!DOCTYPE WITAGLIB [
   <!ENTITY nbsp "&#160;">
]>

xsl file
<snippet..with OBJECT template>

<xsl:choose>
<xsl:when test="text() = '&#160;'">
<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</xsl:when>
<xsl:otherwise><xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</td>
XHTML output file:
<snippet..>


<td style="color:#000000;font-family:Arial;font-size:8pt;text-align:right;background-color:#FFFFFF;height:20px;width:98px;">$4.00</td>
<td style="color:#000000;font-family:Arial;font-size:8pt;text-align:right;background-color:#FFFFFF;height:20px;width:98px;">&nbsp;</td>


- Scott


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.