Re: [xsl] Unanticipated Results from text()

Subject: Re: [xsl] Unanticipated Results from text()
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 26 Feb 2007 18:14:27 +0100
Signature House wrote:

No matter how many line-breaks are in the XML, or where they're placed, in IE the "normalize-space(text())" picks up the "B2" text
as I expected. But FileMaker/Xalan/Xerces won't pick up the "B2" text if a line-break appears between the <BBB><CCC>. I just tried
the other white-space characters (blank and tab) and the same thing happened. No white-space between the <BBB><CCC>,
FM//Xalan/Xerces get the "B2", any white-space between <BBB><CCC>, FM//Xalan/Xerces doesn't get the "B2" text.

The problem is that you call e.g.
normalize-space(text())
so you call normalize-space on a node set of all child text nodes. That way you normalize white space in the first text node in the node set as converting the node set to a string takes the string of the first node only. I think what you want instead is e.g.
<xsl:for-each select="text()">
<xsl:value-of select="normalize-space()"/>
</xsl:for-each>


--

	Martin Honnen
	http://JavaScript.FAQTs.com/

Current Thread