I need to rename the contents of an attribute wherever it appears within an XML document. The XML document needs to remain unchanged apart from the rename operation and really this needs to be done as XSL.
So, given the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<var varname="fred"/> := (<var varname="john"/> + <var varname="bill"/>) *<var varname="steve"/>
<var varname="simon"/> := (<var varname="john"/> + <var varname="bill"/>) *<var varname="steve"/>
I need to be able to change all occurances of <var> nodes whose <varname> is "simon" to have a <varname> of "henry", all "bill" to "tony" etc etc
However, I'm getting stuck with the XSL I can use - there could be hundreds of replacements required per document and these will be run against XML docs that are several megabytes in size and I just can't figure out how to code it up.
Other solutions we've come up with are to use the DOM to do the replacements in code (selecting all <var> nodes and checking each one) or do a simple search/replace on the xml document that matches
and replaces it with
However, we have other XSL to run on the documents and so it seems best to try to get all the transformations done in one place.
Maximum points available as I need an answer quickly and I've not found anything to help either here or on google, so I'm assuming this isn't normally done, either because it can't be, or its too hard to get right.
Thanks for any help.