Find required files by pattern in xml files and the change the pattern on Linux

Hello,

I need to find all *.xml files that matched by pattern on Linux. I need to have written the file name on the screen and then change the pattern in the file just was found.

For instance.

I can start the script with arguments for keyword and for value, i.e

script.sh keyword "another word"

Script should find all files with keyword and do the following changes in the files containing keyword.

<keyword></keyword> should be the same <keyword></keyword>
<keyword>some word</keyword> should be like this <keyword>some word, another word</keyword>

In other words if initially value in keyword node was empty, then I don't need to change it and if it contains some value then I need to extend it with the value I will specify.

What is best way to do this on Linux?

Thank you.

Listing is easy enough, I guess:

 
grep -l '<keyword>[^<]*some word[^<]*<\/keyword>' *.xml