xsl-list
[Top] [All Lists]

RE: Xslt 2 stripping out non-numbers

2005-04-20 11:41:11

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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--