This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
what I meant by preserving whitespace
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] what I meant by preserving whitespace
- From: Eric Smith <Eric dot Smith at fruitcom dot com>
- Date: Sun, 23 Sep 2001 11:17:22 +0200
- References: <20010923055751.76454.qmail@web14510.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
According to Dimitre Novatchev on Sat, Sep 22, 2001 at 10:57:51PM -0700:
| > I have looked at the archives and failed to implement the
| > xml:space="preserve"
| > to preserve white space in selected nodes - failing that preserving
| > whitespace globally.
| >
| > I have tried most things I could think of, so would appreciate a
| > simple example of how to achieve this.
|
| The following stylesheet (applyed on any xml source) will try to pad the string
| "abc" with 3 spaces to the right.
|
| Two templates -- "pad" and "pad2" are called, the only difference being in how the
| "space buffer" variable is defined in them:
|
| In the "pad" template we have:
|
| <xsl:variable name="spaces">
| <xsl:text xml:space="preserve"> </xsl:text>
| </xsl:variable>
|
| In the "pad2" template we have:
|
| <xsl:variable name="spaces">
| <xsl:text> </xsl:text>
| </xsl:variable>
|
<snip>
Thank you, but I do not see why I need to define a $spaces variable for this.
<some_tag>
Imagine this is a poem
and we want lines idented
in this strange fasion
This is a nonsensical indentation
but serves to make the point
about what I mean by preserving whitespace
</some_tag>
In the output I do not wnt to see this:
<cut_and_paste>
Imagine this is a poem and we want lines idented in this strange fasion This is a
nonsensical indentation but serves to make the point about what I mean by
preserving whitespace
</cut_and_paste>
A simple solution for this?
--
Eric Smith
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list