[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Sharing Techniques: White Spaces in HTML pages by XSLT


adding spaces in html
> > 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
have
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' />
<xsl:value-of
    select='LastName' /></span>

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

Hope this helps.
Jonathan



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.