xsl-list
[Top] [All Lists]

RE: Empty object

2004-01-28 14:20:40
Um, doesn't that just mean that your encodings are screwed up?  If you're 
getting that "famous A" then the browser is interpreting the it as some other 
character encoding.  What encoding is your output?  What do you have a meta tag 
in there that specifies the encoding?  What about the HTTP headers (assuming 
you're accessing it via a webserver anyway)?  What encoding does IE say it's 
using (View->Encoding).

The solution isn't to force " " into your output, the solution is to get 
all your encodings on the same page.

Craig


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
scott
gabelhart
Sent: Wednesday, January 28, 2004 2:58 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Empty object


Wendell Piez wrote:

Scott,

Your output <OBJEC!> </OBJECT> does *not* contain a plain space 
(unless something is going on you aren't telling us about): it 
contains a non-breaking space. You shouldn't be too surprised if a 
non-breaking space looks like " " (heh).

Since a non-breaking space is the character represented by "& nbsp;" 
(once you have declared this entity to resolve to "& #160;", a numeric 
character reference for the same character), you are getting the 
character you want.

This may and should be enough for you: in particular, this character 
will be just as good as the entity reference "& nbsp;" in any (modern, 
conformant) browser. Unless you're having trouble with character 
encodings, which is a different issue and will affect many characters 
besides this one, it will display just fine (try it and see).

It does occasionally happen that a developer is not happy with the 
actual character, and wants instead the entity reference for it, 
particularly in HTML. Since you are generating XHTML, however, and 
using the method="xml" output method, the serializer that writes the 
output of your transformation to a file is not making this 
substitution for you. Actually, this substitution can't be done in 
pure XSLT, which doesn't concern itself with how characters are 
represented in the output, but must be done either by configuring a 
serializer, or using a post-process external to the transform, or by 
using techniques such as the disable-output-escaping trick -- which is 
a poor way to do it outside of carefully controlled circumstances 
(mainly for reasons having to do with long-term maintenance/portability).

But you haven't informed us as to why you need the entity reference, 
and aren't happy with the non-breaking space character itself. Without 
knowing more about your particular circumstances, it's impossible to 
guide you -- especially since the clearest answer at the moment seems 
to be that you're already getting the character you want.

At 12:56 PM 1/28/2004, you wrote:

I have attached my xml input file and my stylesheet I am still 
getting in my output <OBJEC!> </OBJECT> instead of 
<OBJEC!>&nbsp;</OBJECT>. Obvisouly my OBJECT template is not properly 
copying my element and character contents over properly.


Once you have understood and internalized that & nbsp; is a 
non-breaking space -- a character that looks like " " when expressed 
literally -- it's not so obvious that your template isn't doing just 
what it is supposed to.

I hope this helps,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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


Wendell,

in my final output  I need to physically see <td>&nbsp:</td>. Currently 
my output contains <td>{a single space}</td>. The reason being my OBJECT 
element is transformed to <td> and the original space needs to be held 
within the outputed <td>&nbsp;</td>. If you open my current output in IE 
you will see the famous A where my output contains <td> </td>

- Scott

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


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



<Prev in Thread] Current Thread [Next in Thread>