|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: newline white space
Hi Lisa,
> This solved my problem for the hyphenated words, but where ever
> there were other tags in the string, I lost my spaces.
> How can I fix this?
Don't normalise the text nodes ;) Get rid of the normalising template
that I suggested (sorry):
<xsl:template match="text()">
<xsl:value-of select="normalize-space()" />
</xsl:template>
and instead have a template that only matches text nodes that
immediately follow a lb element:
<xsl:template match="text()[preceding-sibling::*[1][self::lb]">
...
</xsl:template>
I don't know whether all these text nodes start with a new line? If
so, then you could just remove that first new line character:
<xsl:template match="text()[preceding-sibling::*[1][self::lb]">
<xsl:value-of select="substring(., 2)" />
</xsl:template>
Otherwise, you need to test whether the first character is a
whitespace character, in which case you want to ignore it (otherwise
you just give the value of the text node):
<xsl:template match="text()[preceding-sibling::*[1][self::lb]">
<xsl:choose>
<xsl:when test="contains(' 
	
', substring(., 1, 1))">
<xsl:value-of select="substring(., 2)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








