Discussion:
  as HTML source output from XSLT - non breaking space to HTML
Dave McRae
2005-04-08 00:44:09 UTC
Permalink
Adam Knight proposed this question 2 months ago, (thread titled Using
  in XSL HTML Output)

Please excuse me, I did not understand the answers, and, if any are used
in code, they do not achieve the desired affect.

The desired effect - a Table of Contents or list of Anchors, space
delimited.

Eg HTML source to look like
<a href="#sect1">Section1</a>&nbsp;<a href="#sect2">Section2</a>

The XSLT I use for that is

<xsl:output method="html" encoding="iso-8859-1" indent="yes"/>
..
<xsl:for-each select="section">
<a href="#{@Anchor}"><xsl:value-of select="@SectionName"/></a>{I wish to
output to HTML &nbsp;}
</xsl:for-each>

Replace {I wish to output to HTML &nbsp;} with..

&nbsp;
XSL Error: Reference to undefined entity 'nbsp'.

&amp;nbsp;
<a href="#sect1">Section1</a>&amp;nbsp;<a href="#sect2">Section2</a>
This outputs in text as &nbsp; not as the space desired

<![CDATA[&nbsp;]]>
<a href="#sect1">Section1</a>&amp;nbsp;<a href="#sect2">Section2</a>
This outputs in text as &nbsp; not as the space desired

&#32;
<a href="#sect1">Section1</a> <a href="#sect2">Section2</a>
No &amp; but it is a space - but not a &nbsp; (I cant have 2 spaces -
well, I can, but the HTML browser will display only 1)

&#38;nbsp
<a href="#sect1">Section1</a>&amp;nbsp;<a href="#sect2">Section2</a>
DAMN - how did it know to to map &#38 to &amp;


At the moment I have the space with a span so it may be styled up (with
CSS) for the extra width.
I have read the FAQ - and it is good - thanks all - and with that
section on special characters I can output tabs and special characters -
I just cannot output &nbsp; to the HTML client.

Can it be done?

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
J***@nokia.com
2005-04-08 05:16:24 UTC
Permalink
Hi,
Post by Dave McRae
Adam Knight proposed this question 2 months ago, (thread titled Using
&nbsp; in XSL HTML Output)
Please excuse me, I did not understand the answers, and, if
any are used
in code, they do not achieve the desired affect.
The bottom line, methinks, is that you should want to output a nbsp entity, but rather the Unicode NO-BREAK SPACE character (as nbsp entity is just one way of expressing that). Thus write the NO-BREAK SPACE character into your stylesheet, or use a character reference &#160; or &#xA0;. The just let the serializer of you XSLT engine to handle the rest. If you're not happy with what the serializer generates (if it chooses not to generate a nbsp entity when using html output method), then try to configure the serializer to generate it, post-process the results, or write your own serializer.

Cheers,

Jarno - Informatik: The World Belongs to Us <http://www.metropolis-records.com/artists/audio/315-01.mp3>

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Pawson, David
2005-04-08 10:00:40 UTC
Permalink
-----Original Message-----
From: Dave McRae

Adam Knight proposed this question 2 months ago, (thread
titled Using &nbsp; in XSL HTML Output)

Please excuse me, I did not understand the answers, and, if
any are used in code, they do not achieve the desired affect.

http://www.dpawson.co.uk/xsl/sect2/nbsp.html

may help.

DaveP
--
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is
confidential and may be privileged. If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants. However, it
cannot accept any responsibility for any such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk




--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Loading...