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

Re: [xsl] Entities in XSL (again)

Subject: Re: [xsl] Entities in XSL (again)
From: Terry Badger <terry_badger@xxxxxxxxx>
Date: Wed, 17 Feb 2010 09:18:02 -0800 (PST)

Thanks. I used the nbsp as a sample but was thinking also about non HTML
entities but this is great for those entities that are defined in HTML. I sort
of forgot about the html method which makes all if this very simple.
----- Original Message ----
From: G. Ken Holman
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Wed,
February 17, 2010 11:50:54 AM
Subject: Re: [xsl] Entities in XSL (again)

2010-02-17 07:36 -0800, Terry Badger wrote:
> Thank you. I thought I could get
the stylesheet to declare the 'missing' entity in the xml file but that is the
duty of the xml file and the parser would get this problem before the
stylesheet got it. I can just use disable-output-escaping to put that entity
in if needed on the output.


That is not the use case for

The entity "&nbsp;" is from an entity set used
by HTML.  The HTML serialization recognizes this and is supposed to use the
entity name when the result tree is serialized:
  Entity references and character references SHOULD be used only
the character is not present in the selected encoding, or
  where the visual
representation of the character is unclear (as
  with &nbsp;, for example).
However you declare or use the entity in the XML file, if the result tree text
node has &#x160; and you are using HTML serialization, then you should get
what you want.

Now if you want to serialize your result tree as XML then you
may be stuck:  using disable-output-escaping="yes" for &nbsp; will produce a
non-well-formed result because there is no entity declaration.  Unless,
perhaps, you are using standard XSLT to add the DOCTYPE declaration pointing
to an external declaration subset that includes a declaration for that entity.
I hope this helps.

. . . . . . . . . . Ken

XSLT/XQuery/XPath training
after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:  San
Carlos, California 2010-04-26/30
Vote for your XML training: 
Crane Softwrights Ltd.         
Training tools: Comprehensive interactive
XSLT/XPath 1.0/2.0 video
Video lesson:   
Video overview: 
G. Ken Holman               
Male Cancer Awareness Nov'07 
Legal business disclaimers: 

Current Thread