Re[2]: [xsl] HTML entities

Subject: Re[2]: [xsl] HTML entities
From: David Mitchell <dmitchell4@xxxxxxxxx>
Date: Thu, 23 Oct 2003 07:59:20 -0500
>>  Now my HTML entities need to be
>>declared somewhere.  Is there a standard template
>>for this?

WP> I don't know of any "standard" way to pull HTML entities into your
WP> stylesheet, beyond simply pulling the relevant piece of the XHTML DTD in 
WP> and declaring it for your stylesheet. (And it wouldn't be a template; it'd 
WP> be a DTD module referred to in a DOCTYPE declaration for your stylesheet.)
<snip/>
WP> ...this is just so I don't have to memorize the funky Unicode points, but
WP> can use the named entity. But I don't bother with the entire HTML set -- 
WP> only with the entities I am actually likely to need in my stylesheet.

I agree with Wendell that the common practice is to declare the
handful that you need. But, you could include all of them by copying
these lines from the XHTML strict DTD and including them in your DTD
(or you could just use the XHTML strict DTD itself).

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "xhtml-lat1.ent">
%HTMLlat1;

<!ENTITY % HTMLsymbol PUBLIC
   "-//W3C//ENTITIES Symbols for XHTML//EN"
   "xhtml-symbol.ent">
%HTMLsymbol;

<!ENTITY % HTMLspecial PUBLIC
   "-//W3C//ENTITIES Special for XHTML//EN"
   "xhtml-special.ent">
%HTMLspecial;

I've never actually done this. Wendall also makes a good point that
these declarations only let us use these "easy" names in our
stylesheet. The serializer will choose the output representation. For
XHTML output, a serializer would be correct to use a character
reference directly (either Hex or decimal). For HTML, I think it
would use the "easy" name of the entity reference.

--David Mitchell


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


Current Thread