This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: whitespace problem when formating to plain-text
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] whitespace problem when formating to plain-text
- From: Kevin_Gutch at mapinfo dot com
- Date: Wed, 31 Oct 2001 18:38:57 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
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> </xsl:text>.
Hope that helps.
John Ericson
<john@john.pp.se> To: XSL-List@lists.mulberrytech.com
Sent by: cc:
owner-xsl-list@lists.mulber Subject: [xsl] 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@john.pp.se
* ICQ: 7325429 JID: high@jabber.org
* 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