You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Gary L Peskin <ga...@firstech.com> on 2000/12/08 16:54:47 UTC

Re: How to replace chars by another string

MAHE Vincent FTRD/DIH/REN wrote:
> 
> Is there a Xalan extension which enables to subsitute all occurences of a
> given character by another string ?
> For instance, I want to replace all the white spaces by the "aaa" string.
> 
> I've tried the translate() XPath function but I can only replace one char by
> another char.

Yes, translate will only substitute a single character.  There is no
extension function that I know of written yet.  Please feel free to
write one and contribute the code.

Also, a "grep" extension function is planned for XalanJ2 that may
support such substitution.

For doing this in pure XSLT, see
http://www.dpawson.co.uk/xsl/stringreplace.html#N34004

Gary