[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xslt replace string stackoverflowerror
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.