This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: strange problem with string-replace
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: strange problem with string-replace
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Thu, 10 Feb 2000 10:22:53 -0000
- Reply-To: xsl-list at mulberrytech dot com
> But when I want to remove
> all (line feed) or   (space) I have a
> java.lang.StackOverFlowError, both with xt and saxon (win32
> executables)
The invisible whitespace demon strikes again.
In your statement
<xsl:variable name="from">&return;</xsl:variable>
the entity &return; expands to whitespace, so the XSLT processor strips it
from the tree. David Carlisle's code (shame on him!) recurses infinitely if
the value of "from" is an empty string. (Actually the spec doesn't define
the behaviour of things like contain() very clearly for null strings, but it
seems xt and Saxon have both implemented the same rules).
Rewrite it as:
<xsl:variable name="from" select="'&return;'"/>
and all will be well. This is better anyway: if you use the content of
xsl:variable to define a string value, the processor will have to go through
the motions of converting a result tree fragment to a string every time the
value is used.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list