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

RE: what I meant by preserving whitespace

Subject: RE: what I meant by preserving whitespace
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Sun, 23 Sep 2001 10:54:42 +0100
fasion lines
Eric,
<some_tag xml:space="preserve">

    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>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="some_tag">	
		<cut_and_paste>
				<xsl:value-of select="." />
		</cut_and_paste>
	</xsl:template>
</xsl:stylesheet>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Eric Smith
> Sent: 23 September 2001 10:17
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  what I meant by preserving whitespace
> 
> 
> 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
> 
> 


 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.