OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[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' />&#160;<xsl:value-of
    select='LastName' /></span>

which gives :

<span>Hello, John(U+0160)Smith</span>

In fact, with &#160; 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:text> </xsl:text>
    <xsl:value-of select='LastName' /></span>

<span xml:space="preserve">Hello, <xsl:value-of select='FirstName' />
    select='LastName' /></span>

<span>Hello, <xsl:value-of select="concat(FirstName,' ',LastName)" /></span>

Hope this helps.