RE: XT, HTML, and &nsbp;

Subject: RE: XT, HTML, and &nsbp;
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Fri, 21 May 1999 11:14:05 -0600
> If you input 
>           &amp;nbsp;
> then you are putting four characters into the text node of 
> the result tree
> but you just want one.
>          &#160;

Perhaps a more helpful explanation:

&#160; will put the literal non-breaking space character in the
result tree, like if you had a key on your keyboard where you 
could type a non-breaking space. The HTML output document that
is *derived from* the result tree will (or should, rather) have
this single character replaced with the full "&nbsp;" (5 chars).

This was the source of much confusion for me at first. You are
transforming a source tree into a result tree, and then telling
the XSLT processor that you'd like for a certain kind of output
to be derived from the result tree. The stylesheet is defining
the tree transformation, not the literal, formatted contents of
the result tree as they're intended to be output.

Your declaration of the HTML 4.0 URI for the result namespace is
telling the XSLT processor that you would *like* the result tree
to be output as an HTML 4.0 document, which means, more or less,
that the result tree that you've defined in terms of well-formed
HTML (i.e., XML) should be output as serialized text after the
- emits a <!DOCTYPE> prolog
- entifies certain characters like your non-breaking space,
- removes extraneous slashes from empty elements (like <br/>)
- removes unnecessary closing tags (like </li>)

 XSL-List info and archive:

Current Thread