xsl-list
[Top] [All Lists]

Re: [xsl] replace

2007-06-12 06:05:02
On 6/12/07, Charles Ohana <charles(_dot_)ohana(_at_)buongiorno(_dot_)com> wrote:
I want to replace "a" by "b" inside "/root/@description" . I'm using XSLT
1.0 as I copied this code example from the web. it's not working with 2.0
either anyways. I'm not restricted to any version. All I need is to be able
to replace string .
Thank you

To replace single characters use translate() eg

translate(/root/@description, 'a', 'b')

which is in both XSLT 1.0 and 2.0

To replace more than one character you can use replace()

replace(/root/@description, 'aa', 'bb')

which is only in 2.0

To to do multiple character replacements in 1.0 you need the
lond-winded recursive named template approach, which what you've
copied from the web.

cheers
andrew

--~------------------------------------------------------------------
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>
--~--