Re: [xsl] Entities in XSL (again)

Subject: Re: [xsl] Entities in XSL (again)
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Feb 2010 11:50:54 -0500
At 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 disable-output-escaping="yes".

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
   where 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 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 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 Legal business disclaimers:

Current Thread