[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Sharing Techniques: White Spaces in HTML pages by XSLT
> > http://www.mycgiserver.com/~~lisali/papers/paper.htm
> > Any comment is welcome.
Perhaps you should specify more precisely what is intended by
"adding whitespace to HTML pages" : does it mean (1)adding whitespace in the
HTML markup (which may be normalized or stripped by the user agent),
e.g. for indentation, or adding visible space to the rendered page
(e.g. between words).
(2) seems to be what is desired here, and it sort of can be done
with  , but this method goes beyond the intent, which may
be simply to prevent contiguous values from coalescing, as in :
<span>Hello, <xsl:value-of select='FirstName' /> <xsl:value-of
which gives :
In fact, with   you're not really inserting whitespace, just a special
character that happens to render as whitespace.
In fact, what you want is HTML output that looks like this, as you would
entered it manually :
<span>Hello, John Smith</span>
There are at least 3 ways of obtaining this :
<span>Hello, <xsl:value-of select='FirstName' />
<xsl:value-of select='LastName' /></span>
<span xml:space="preserve">Hello, <xsl:value-of select='FirstName' />
<span>Hello, <xsl:value-of select="concat(FirstName,' ',LastName)" /></span>
Hope this helps.