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

Re: replace

Subject: Re: replace
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 12 Jun 2007 14:04:01 +0100
Re:  replace
On 6/12/07, Charles Ohana <charles.ohana@xxxxxxxxxxxxxx> 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

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.