title: How to transform a XML using XSLT only modifying a node that's required?
body: <p>I'm trying to transform an XML only to replace a node name with another, but the XSLT that I framed is messing up the transformed XML. This might be a small issue that I might have overlooked, but am stuck with this from a long time.</p>
  
  <p>Input XML that I have:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;dataCollection&gt;
      &lt;queryConst language="DBSQL"&gt;
          &lt;queryUsed&gt;
              SELECT EMP.FirstName, EMP.LastName FROM (SELECT FirstName, LastName FROM
              employees WHERE EmployeeID &amp;lt; 10) AS EMP
          &lt;/queryUsed&gt;
      &lt;/queryConst&gt;
      &lt;record&gt;
          &lt;old&gt;
              &lt;Employees&gt;
                  &lt;FirstName&gt;James&lt;/FirstName&gt;
                  &lt;LastName&gt;Gosling&lt;/LastName&gt;
              &lt;/Employees&gt;
          &lt;/old&gt;
      &lt;/record&gt;
      &lt;record&gt;
          &lt;old&gt;
              &lt;Employees&gt;
                  &lt;FirstName&gt;Rod&lt;/FirstName&gt;
                  &lt;LastName&gt;Johnson&lt;/LastName&gt;
              &lt;/Employees&gt;
          &lt;/old&gt;
      &lt;/record&gt;
  &lt;/dataCollection&gt;
  </code></pre>
  
  <p>The XSLT used is as follows:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /&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:template match="dataCollection/queryConst/@language"&gt;
          &lt;xsl:attribute name="language"&gt;DBVIEW&lt;/xsl:attribute&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="dataCollection/record/old/Employees"&gt;
          &lt;xsl:element name="TABLE"&gt;
              &lt;xsl:copy&gt;
                  &lt;xsl:apply-templates select="node()|@*" /&gt;
              &lt;/xsl:copy&gt;
          &lt;/xsl:element&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The Output XML that I want is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;dataCollection&gt;
      &lt;queryConst language="DBVIEW"&gt;
          &lt;queryUsed&gt;
              SELECT EMP.FirstName, EMP.LastName FROM (SELECT FirstName,
              LastName FROM employees WHERE EmployeeID &amp;lt; 10) AS EMP
          &lt;/queryUsed&gt;
      &lt;/queryConst&gt;
      &lt;record&gt;
          &lt;old&gt;
              &lt;TABLE&gt;
                  &lt;FirstName&gt;James&lt;/FirstName&gt;
                  &lt;LastName&gt;Gosling&lt;/LastName&gt;
              &lt;/TABLE&gt;
          &lt;/old&gt;
      &lt;/record&gt;
      &lt;record&gt;
          &lt;old&gt;
              &lt;TABLE&gt;
                  &lt;FirstName&gt;Rod&lt;/FirstName&gt;
                  &lt;LastName&gt;Johnson&lt;/LastName&gt;
              &lt;/TABLE&gt;
          &lt;/old&gt;
      &lt;/record&gt;
  &lt;/dataCollection&gt;
  </code></pre>
  
  <p>Any help / tips / suggestions on the above is much appreciated.</p>