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

Re: semi-newbie question about escaping

Subject: Re: semi-newbie question about escaping
From: Joseph Kesselman <keshlam@xxxxxxxxxx>
Date: Tue, 15 Oct 2002 13:14:49 -0400
some non breaking space
>The goal here was to output some non-breaking space entities in HTML 
>(&nbsp;) to denote indentation.

The &nbsp; entity isn't defined by default in XML. Your stylesheet needs 
to reference a DTD, or set up an internal subset, which provides that 
definition.

Alternatively, as others have said, use the numeric character reference 
rather than the mnemonic entity name. That should work everywhere &nbsp; 
does, and doesn't have to be explicitly defined.

Either way, if you can get the character into the data in the first place, 
HTML output mode will convert it to &nbsp; on output. XML output mode may 
or may not do so, depending on whether you specified a DTD reference for 
the output and on the exact behavior of your XSLT processor's serializer; 
most won't, but I think it's allowed to do so if it wants to make the 
additional effort.

And either is better than trying to construct the entity reference as 
text. Among other things, if you ever want to pipe the XSLT processor's 
output directly into another XML application you'll find that the text 
approach will come through as text (equivalent to &amp;nbsp;) whereas the 
character reference or the properly-defined entity reference will come 
through as the intended character.

______________________________________
Joe Kesselman  / IBM Research

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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