[xsl] whitespace problem when formating to plain-text

Subject: [xsl] whitespace problem when formating to plain-text
From: John Ericson <john@xxxxxxxxxx>
Date: Thu, 1 Nov 2001 00:13:07 +0000
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


Current Thread