Re: [xsl] Empty object
Your output <OBJECT> </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
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 <OBJECT> </OBJECT> instead of <OBJECT> </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 Piez mailto:wapiez@xxxxxxxxxxxxxxxx
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