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

Re: xslt newbie- inserting spaces

Subject: Re: xslt newbie- inserting spaces
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 15 Aug 2003 18:04:28 -0400
inserting spaces in html
Bruce,

At 05:26 PM 8/15/2003, you wrote:
  I'm back like a bad rash. Here's a question I'm sure has been asked but
can't seem to traverse in the archives.

Probably because it's in there so frequently -- this is the FAQest of FAQs, and used to get asked several -- many -- times a week.


  I'm wanting to insert spaces via my xslt stylesheet, so the html output
has some blank spaces where I want them.

All I've read suggests that i can just include this :
<xsl:text>   </xsl:text>

This will insert spaces. The problem is that web browsers collapse white space for you. In particular, inside table cells if you have nothing but spaces the whole cell will fail to appear. But if you look at the source code of your serialized output, you'll see the spaces are there.


Hence the problem isn't getting spaces, it's getting spaces the HTML browser will respect.

The HTML entity &_nbsp; (remove underscore) is a representation of Unicode character #160, a non-breaking space, and is the usual choice for this purpose.

Only XML has no hard-wired entities other than the basic markup delimiters &_lt; &_amp; etc., so you can't use this entity unless you declare it.

Some people like to do this. Others simply use the numeric character reference for the same character: &_#160; or (the hex version) &_#xA0; (again, remove underscore character). If your XSLT engine is writing out HTML, you may find this gets serialized as your friend the &_nbsp;.

So try <xsl:text>& #160;& #160;& #160;& #160;</xsl:text>

or rather the same thing without the spaces in it.

I hope this helps.
--Wendell

- doesn't work for me,

nor do these variants help:

<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>

<xsl:text disable-output-escaping="yes">


======================================================================
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



Current Thread

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
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.