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

Re: whitespace problem when formating to plain-text

Subject: Re: whitespace problem when formating to plain-text
From: Kevin_Gutch@xxxxxxxxxxx
Date: Wed, 31 Oct 2001 18:38:57 -0500
xsl write whitespaces

John,

The normalize function will remove leading and trailing whitespace. It is
hard to read your xml but you may have to force spaces where needed using
something like <xsl:text>&#x20</xsl:text>.

Hope that helps.



                                                                                                         
                    John Ericson                                                                         
                    <john@xxxxxxxxxx>                 To:     XSL-List@xxxxxxxxxxxxxxxxxxxxxx            
                    Sent by:                          cc:                                                
                    owner-xsl-list@xxxxxxxxxxxx       Subject:      whitespace problem when         
                    rytech.com                         formating to plain-text                           
                                                                                                         
                                                                                                         
                    10/31/2001 07:13 PM                                                                  
                    Please respond to xsl-list                                                           
                                                                                                         
                                                                                                         




Ive been writing a xsl for formating to plain-text. I have written one for
formating to html and it worked fine, but when Im writing this one I hit
into some problem with whitespaces. After some research I find out how to
use normalize-space.
But now it removes whitespaces which is needed for proper formating too.
I have recreated the problem in minimal files and here they are:

file.xml:
<info>
           <link url="231243342">SpazeIRC</link> blablablabla bla . bldse
dfseld s3242. 43 <link url="2342342">har</link>.
</info>

text.xsl:
<xsl:template match="text()">
           <xsl:value-of select="normalize-space(.)"/>
</xsl:template>

The output I get:
SpazeIRCblablablabla bla . bldse dfseld s3242. 43har.

I want it to look like this:
SpazeIRC blablablabla bla . bldse dfseld s3242. 43 har.
        ^                                         ^

I must write code to check for '> ' in the beginning and ' <' in the end of
the
string in the "text()" template so I can add an whitespace in the beginning
or
the end if they exist.

Can anyone help me write this code or come up with a similar solution?


--
* John Ericson john@xxxxxxxxxx
* ICQ: 7325429 JID: high@xxxxxxxxxx
* web: http://john.pp.se

 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.