Replacing strings in various XML files

jonathanplum

New Member
Given the following xml file with the knowledge that the structure and contents can change: \[code\]<something> <parent> <child>Bird is the word 1.</child> <child>Curd is the word 2.</child> <child>Nerd is the word 3.</child> </parent> <parent> <child>Bird is the word 4.</child> <child>Word is the word 5.</child> <child>Bird is the word 6.</child> </parent></something>\[/code\]I would like a way to use xquery (and even xslt) to replace all instances of a supplied string with another. For example, replace the word "Bird" with "Dog". Therefore the results would be: \[code\]<something> <parent> <child>Dog is the word 1.</child> <child>Curd is the word 2.</child> <child>Nerd is the word 3.</child> </parent> <parent> <child>Dog is the word 4.</child> <child>Word is the word 5.</child> <child>Dog is the word 6.</child> </parent></something>\[/code\]I have no idea if this is even possible. Every attempt I have made has eliminated the tags. I have even tried this example (http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx), but it is for text not an entire document.Please help!
 
Back
Top