title: use xslt to change only a few XML elements while leaving everything else the same
body: <p>I have the following problem with XSLT. </p>
  
  <p>In an XML document I have several <code>&lt;h&gt;&lt;/h&gt;</code> tags embedded within different levels of <code>&lt;div&gt;&lt;/div&gt;</code> tags. </p>
  
  <p>In effort to change all the <code>&lt;h&gt;&lt;/h&gt;</code> to <code>&lt;h1&gt;&lt;/h1&gt;</code> <code>&lt;h2&gt;&lt;/h2&gt;</code> <code>&lt;h3&gt;&lt;/h3&gt;</code> respective to where the fall within the different div sections I have written the following XSLT script.</p>
  
  <pre><code>&lt;xsl:template match="//TU:div/TU:h"&gt;
      &lt;h1&gt;&lt;xsl:apply-templates/&gt;&lt;/h1&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="//TU:div/TU:div/TU:h"&gt;
      &lt;h2&gt;&lt;xsl:apply-templates/&gt;&lt;/h2&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>And so on. . . .
  The problem is that I want everything else to stay exactly the same. I only want the <code>&lt;h&gt;&lt;/h&gt;</code> tags to change.</p>
  
  <p>Unfortunately, when I process the document, the <code>&lt;h&gt;&lt;/h&gt;</code> tags change as desired, but all other elements go away. </p>
  
  <p>Is there another solution to this problem besides simply writing an <code>&lt;xsl:template&gt;</code> for each element, so that every given element will be replaced with itself? </p>
  
  <p>For example for the element <code>&lt;p&gt;&lt;/p&gt;</code>:</p>
  
  <pre><code>&lt;xsl:template match="//TU:p"&gt;
      &lt;p&gt;&lt;xsl:apply-template/&gt;&lt;/p&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Do I need to do something like that to preserve each element, or is there a better way?</p>
  
  <p>Thanks for your help.</p>