<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="feed.xsl"?>
<rss xmlns:qpm="http://www.quickplaymedia.com" version="2.0">
<channel>
<item><title><![CDATA
[123456789012345678901234567890123456789012345678901234567890]]></
title></item>
<item><title><![CDATA[The national weather forecast]]
></title></item>
<item><title>
<![CDATA[Six bodies recovered at B.C. plane
crash]]>
</title></item>
<item><title>
<![CDATA[Suspect in police deaths hurt,
possibly dead: police]]>
</title></item>
</channel>
in my XSL, i've tried inserting
<xsl:strip-space elements="*"/>
but I presume that command is only for the XSL itself.
I also tried:
<xsl:template match="*">
<xsl:apply-templates select="normalize-space()">
</xsl:template>
That didnt seem to do the trick either.
I ended up having to insert normalize-space at every function to have
it work properly, ie
string-length(normalize-space(title)).
Am I missing something here?
Thanks in advance,
You can strip whitespace only text nodes that way, such as between the
'item' elements.
> I also tried:
>
> <xsl:template match="*">
> <xsl:apply-templates select="normalize-space()">
> </xsl:template>
That does not make any sense at all, the select expression needs to
select nodes while normalize-space() would yield a string.
> That didnt seem to do the trick either.
>
> I ended up having to insert normalize-space at every function to have
> it work properly, ie
>
> string-length(normalize-space(title)).
>
> Am I missing something here?
It is not clear what you want to achieve. If you want to trim leading
and trailing whitespace from the 'title' elements then
normalize-space(title) is the correct way (it also collapses any
whitespace within text however).
--
Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/
Thanks for the clarification, Martin.