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

Re: XT, HTML, and &nsbp;

Subject: Re: XT, HTML, and &nsbp;
From: Ray Waldin <rwaldin@xxxxxxxxxxx>
Date: Fri, 21 May 1999 15:37:18 -0700
Thanks Mike,

Let me see if I understand this correctly:

XML only defines five built-in entity references: &amp;, &lt;, &gt;,
&apos;, and &quot;.

HTML40 defines many more (like &nbsp;).  In order to use HTML40 defined
entity references in XSL documents (not source trees, but in XSL
"scripts"), one must determine the underlying UCS character code, and
use that code in a character reference (&#160;).

The reason why XSL doesn't have something like:


is that the result tree needs to contain the actual character being
referenced, even though the resulting output will contain the string
"&nbsp;".  The XSL processor has no idea what character is being
referenced unless it parses the result namespace DTD looking for entity
declarations, which it doesn't. 

So why not add these missing entity declarations to the stylesheet?  I'm
using XT and Sun's Project X non-validating parser and I now prefix my
XML to HTML stylesheets with:

    <!DOCTYPE xsl:stylesheet SYSTEM 'Html40EntityDeclsForXml.dtd'>
    <xsl:stylesheet ...

The Html40EntityDeclsForXml.dtd is just an XML version of the entity
references section HTML40 DTD.  This seems to add no more than a couple
of milliseconds processing per stylesheet and let's me use any HTML40
entity reference right in my XSL without having to lookup the character
code myself.  (Yes, I'm that lazy!)


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

Current Thread


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.
First Name
Last Name
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.