This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: strange problem with string-replace


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]