[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How to get   in HTML


Subject: RE: [xsl] How to get   in HTML
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 07 Jan 2004 14:45:03 -0500

At 2004-01-07 13:37 -0500, Jiang, Peiyun wrote:
I wonder how XSLT treats these entites. Can you give me some general
information on this?

XSLT 1.0 section 16.2 reads: "The html output method may output a character using a character entity reference, if one is defined for it in the version of HTML that the output method is using."


The result encoding is not relevant, but the result output method is ... the entity names are only used if the output method is the HTML output method.

Since your inputs to XSLT 1.0 are only XML, you can't assume any HTML named entities on the way in unless you declare them in the declaration subset of the stylesheet. I often do the following in my stylesheets:



<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;"> <!--known for HTML output, not in XML-->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
<xsl:output method="html"/><!--use hardwired browser entities-->
...
...  &nbsp; ...
...


I hope this helps.


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

--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-02-09
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:     http://XMLGuild.info
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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




Current Thread
Keywords