View Single Post
  #7 (permalink)  
Old December 25th, 2003, 03:33 PM
shbyland shbyland is offline
Authorized User
 
Join Date: Oct 2003
Location: , PA, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had a similar problem that I chose to solve by maintaining a database of strings to be searched for and the corresponding strings to replace with. However, in my situation, I had a *string*, i.e. not an entire XML document, that could contain any number of occurrences of certain strings that had to be replaced with other strings. So I chose to create a database, for example:

<SubstitutionTable>
    <CharacterSubstitutions>
        <SearchString>BadString1</SearchString>
        <ReplaceString>GoodString1</ReplaceString>
    </CharacterSubstitutions>
    <CharacterSubstitutions>
        <SearchString>BadString2</SearchString>
        <ReplaceString>GoodString2</ReplaceString>
    </CharacterSubstitutions>
etc
</SubstitutionTable>

I then applied templates selecting the database above (changing the context node to the first occurrence of CharacterSubstitutions) and passing the string to be searched as a parameter, and walked along the search database calling a named template similar to what Armen wrote to perform systematic substitutions of SearchString with ReplaceString through the whole database.

Perhaps some combination of the stylesheets Armen provided and the use of a database similar to above will solve your problem.

Happy Holidays,

…sam


Reply With Quote