This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL and White Space help PLEASE
- To: sgutti at ingr dot com
- Subject: Re: [xsl] XSL and White Space help PLEASE
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- Date: Fri, 1 Jun 2001 21:55:41 -0700 (PDT)
- Cc: xsl-list at lists dot mulberrytech dot com
- Reply-To: xsl-list at lists dot mulberrytech dot com
Gutti, Sridhara wrote:
> I'm trying to insert a white space using XSL, but I don't seem to get it
> working, I'm using msxml3.0 and
> I Tried the following..
>
> <xsl:text> </xsl:text> and also
> <xsl:text> </xsl:text>
>
> Niether of those is working, can you guys help me please.. I just want to
> insert a space in the following example...
The following is a demo how to successfully handle white-space only text nodes.
When run on any xml source, it will produce three spaces enclosed by the `
character.
xsl:text is used, but you may in the same way copy to the output any white-space
only child of any element (use xml:space="preserve" on this element).
Alternatively, set the "preserveWhiteSpace" of the DOMDocument to true.
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version="1.0">
<xsl:output method='text'/>
<xsl:template match="/">
<!-- Three spaces enclosed by xsl:text -->
`<xsl:text xml:space="preserve"> </xsl:text>`
</xsl:template>
</xsl:stylesheet>
If you'd be producing white-space in a html text, in many contexts it is
ignored by the browser.
If this is the case use 
 or enclose your white-space containing text in
the <pre>, <q> or <blockquote> tags.
Is it by coincidence that people, who are cross-posting to 4 newsgroups usually have
such nasty problems? :))
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list