title: replace a string with a string with xslt
body: <p>i want to replace a string with another string. i found an example that does that but  didnt seem to work. this is a sample data</p>
  
  <pre><code>&lt;Addy&gt;
    &lt;Row&gt;
    &lt;LD&gt;Dwelling, 1&lt;/D&gt;
    &lt;LN&gt; East&lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
  
    &lt;Row&gt;
    &lt;LD&gt;Logde&lt;/LD&gt;
    &lt;LN&gt;North &lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
  &lt;/Addy&gt;
  </code></pre>
  
  <p>i want to replace the following string in this manner. </p>
  
  <pre><code> Dwelling = FLAT
   Lodge    =  SHOP
  </code></pre>
  
  <p>Below are the codes i used.  it only deleted all the values in LD element.</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:lookup="lookup"&gt;
  
  &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt;
  &lt;xsl:strip-space elements="*"/&gt;
  
  &lt;lookup:data&gt;
      &lt;LD code="Dwelling"&gt;FLAT&lt;/LD&gt;
       &lt;LD code="Lodge"&gt;SHOP&lt;/LD&gt;
  
  &lt;/lookup:data&gt;
  
  &lt;xsl:variable name="lookup" select="document('')/*/lookup:data"/&gt;
  
  &lt;xsl:template match="LD/text()"&gt;
      &lt;xsl:value-of select="$lookup/LD[@code = current()]" /&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>If applied to the input data above, it produces this:</p>
  
  <pre><code>   &lt;Addy&gt;
    &lt;Row&gt;
    &lt;LD&gt;&lt;/LD&gt;
    &lt;LN&gt; East&lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
  
    &lt;Row&gt;
    &lt;LD&gt;&lt;/LD&gt;
    &lt;LN&gt;North &lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
    &lt;/Addy&gt;
  </code></pre>
  
  <p>expected result with appropriate codes should produce</p>
  
  <pre><code>   &lt;Addy&gt;
    &lt;Row&gt;
    &lt;LD&gt;FLAT,1&lt;/D&gt;
    &lt;LN&gt; East&lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
  
    &lt;Row&gt;
    &lt;LD&gt;SHOP&lt;/LD&gt;
    &lt;LN&gt;North &lt;/LN&gt;
    &lt;L&gt;1&lt;/L&gt;
    &lt;Tf&gt;Abesinia Passage&lt;/Tf&gt;
    &lt;/Row&gt;
    &lt;/Addy&gt;  
  </code></pre>