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

Re: Using Entity References in XSL Templates

Subject: Re: Using Entity References in XSL Templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 21 Jan 2000 18:12:54 GMT
using nbsp in xslt
> but not with MSXML 
MSXML does not support XSLT but rather different language.
I see that MS are promising a `preview' release next wednesday
of a parser supporting xpath and xslt.

> coming through not as a non-breaking space, but as a Â

No you are only looking at _half_ the character, on a terminal using the
wrong encoding. The default XML encoding is UTF-8 (and xt currently does
not support changing that) in UTF-8 position 160 is encoded as two
bytes. If you look at the file on a terminal using latin1 then you see
the two bytes as two random characters, but a utf-8 terminal or a
browser which understands utf-8 (which is most of the current versions
of the main browsers) should do the right thing.

This must be the most F of FAQ's on this list though:-)

> Following your advice, I defined nbsp as follows:
>     <!DOCTYPE xsl:stylesheet [
>         <!ENTITY nbsp "<xsl:text
> disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
>     ]>
> This worked fine.

but it will stop working as soon as you use XSL in an embedded system
where the XML tree output from XSL is passed straight into another
application without being re-parsed.

If you output &#160; you are outputting the single unicode character 160
(even if it is two bytes in utf-8)

If you output &amp;nbsp;
then you are outputting the six characters
`ampersand' n b s p ;

_if_ your XSL engine decides to honour the disable-output-escaping (it
does not have to) you will get the characters &nbsp; in your output
but that will only be the no break space character if you re-parse your
entire document. If you pass it straight into the dom of a browser,
you'll see what you asked for, the 6 characters &nbsp;.

this seems a high price to pay, just to get the character appearing
as something you can read in a non-unicode aware terminal or editor.


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

Current Thread


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