This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: in XSL other than d-o-e ?
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Jochen Metzger" <j dot metzger at steptown dot com>
- Cc: XSL-List at lists dot mulberrytech dot com
- Date: Fri, 19 Jul 2002 10:32:47 +0100
- Subject: Re: [xsl] in XSL other than d-o-e ?
- Organization: Jeni Tennison Consulting Ltd
- References: <005d01c22f01$f7dfb060$d576fea9@tonline.de>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Jochen,
> So know I'm wondering if there's an other way using
> in an XSL-Stylesheet without using d-o-e
>
> This is the way I do it right now:
> <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
>
> Is there another, much easier way?
The easiest way of getting a non-breaking space into your output is to
use the character reference for a non-breaking space in your
stylesheet. Simply use:
 
or:
 
When the XSLT processor serialises the result tree as HTML, it will
see the non-breaking space character and serialise it as a
non-breaking space character or as the character reference   or
  or as the entity reference . Whichever of those it does,
you'll get a non-breaking space displayed when you view the HTML
document in a browser (so you shouldn't really worry about which it
uses).
If you want to force the processor to use an character or entity
reference (so that you can see the non-breaking space when you view
the source of the output) then tell it to use ASCII encoding:
<xsl:output encoding="ASCII" />
The non-breaking space character isn't in the ASCII character set, so
it has to be output using an entity or character reference.
If you don't want to have   or   in your stylesheet, then you
can declare a 'nbsp' entity in its place:
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp ' '>
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
</xsl:stylesheet>
That will enable you to use in the stylesheet whenever you want
a non-breaking space in the output. (But it won't guarantee that
you'll get " " in the output.)
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list