RE: [xsl] Is it possible to get " " in output rather than the encoded character?

Subject: RE: [xsl] Is it possible to get " " in output rather than the encoded character?
From: "Steven Reddie" <smr@xxxxxxxxxxxxxx>
Date: Wed, 19 May 2004 16:15:26 +1000
Hi Ken, thanks for this info.  Are you saying that by outputting a single
character rather than the text "&nbsp;" that the processor is non-conformant
(I think you're saying that section 16.2 makes this optional), or that
getting an 0xFF byte in the stream rather than an 0xA0 is the problem?

Thanks,

Steven

-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent: Wednesday, 19 May 2004 3:12 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Is it possible to get "&nbsp;" in output rather than the
encoded character?


At 2004-05-19 14:26 +1000, Steven Reddie wrote:
>I'm fairly new to XML and am trying to generate an HTML file from 
>XML/XSL. ... If I load the xml file (which references the xsl) from 
>within IE6 the "&#160;" is displayed as I'd expect (whitespace).  
>However, when using the Microsoft .NET XslTransform, outputting to 
>stdout and redirected to a file I get an ASCII character of value 0xff 
>in the file.

Sounds like the processor is not conformant.

>What I'd really like is
>to get the unencoded "&nbsp;" in the file so that it looks like typical 
>HTML.

Section 16.2 of XSLT says this is optional and one cannot request that it 
be that way or not:

   "The html output method may output a character using a character
    entity reference, if one is defined for it in the version of HTML
    that the output method is using."

>I've tried "&amp;nbsp" but it comes out unchanged.

Right ... as it should.

>If this is possible I'd really appreciate some pointers.

I would point to fixing the non-conformant behaviour and not trying to 
change something that is already working.

>On a similar note, is there some escape mechanism such as "\&nbsp" or 
>"&&nbsp" (I realise those aren't valid).

But you shouldn't be trying to escape it as it isn't text, it is 
markup.  No such method exists.

I hope this helps.

...................... Ken


--
Public courses: Spring 2004 world tour of hands-on XSL instruction
Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/m/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/m/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread