RE: [xsl] Xslt 2 stripping out non-numbers

Subject: RE: [xsl] Xslt 2 stripping out non-numbers
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Apr 2005 19:41:11 +0100
> This is the "double-translate" technique first proposed on this list
> (to the best of my knowledge) by Mike Kay.
> 
> The FXSL template/function 
> 
>     str-filter
> 
> has been shown to perform better than the double-translate technique
> on large strings:
> 
>   http://www.biglist.com/lists/xsl-list/archives/200203/msg01524.html
> 
> 

I suspect most implementations of translate() are likely to be optimized for
a fairly short second argument (the set of characters to be replaced) and
are likely to have performance proportional to length(arg1)*length(arg2).
Where that's the case, the double-translate trick applied to a large input
string is quite likely to generate a call on translate with long values for
both arg1 and arg2 which could obviously be rather inefficient. Using
replace() in XPath 2.0 is likely to perform much better in these
circumstances.

Michael Kay
http://www.saxonica.com/

Current Thread