RE: strange problem with string-replace

Subject: RE: strange problem with string-replace
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 10 Feb 2000 10:22:53 -0000
> But when I want to remove
> all &#13; (line feed) or &#32; (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


Current Thread