title: How to I use XSLT to edit elements in my XML file?
body: <p>I have an XML file here:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
  &lt;class&gt;
      &lt;student&gt;
          &lt;name&gt;Ben&lt;/name&gt;
          &lt;age&gt;1&lt;/age&gt;
          &lt;ages&gt;4&lt;/ages&gt;
          &lt;entryprofile&gt;&lt;/entryprofile&gt;
          &lt;node&gt;1&lt;/node&gt;
      &lt;/student&gt;
      &lt;student&gt;
          &lt;name&gt;Steve&lt;/name&gt;
          &lt;age&gt;2&lt;/age&gt;
          &lt;ages&gt;3&lt;/ages&gt;
          &lt;entryprofile&gt;&lt;/entryprofile&gt;
          &lt;node&gt;1&lt;/node&gt;
      &lt;/student&gt;
  &lt;/class&gt;
  </code></pre>
  <p>I am trying to promote the <code>entryprofile</code> element so that it becomes a child element of <code>student</code>, rather than an attribute of <code>student</code>--and I want it to contain <code>node</code>. I have tried to apply the following XSL in order to do this:</p>
  <pre><code>&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
  &lt;xsl:template match=&quot;student&quot;&gt;
    &lt;xsl:copy-of select=&quot;name&quot;/&gt;
    &lt;new-level&gt;
       &lt;xsl:copy-of select=&quot;entryprofile&quot;/&gt;
    &lt;/new-level&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  <p>This doesn't seem to be doing much apart from this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
      &lt;name&gt;Ben&lt;/name&gt;&lt;new-level&gt;&lt;entryprofile&gt;g&lt;/entryprofile&gt;&lt;/new-level&gt;
      &lt;name&gt;Steve&lt;/name&gt;&lt;new-level&gt;&lt;entryprofile&gt;g&lt;/entryprofile&gt;&lt;/new-level&gt;
  </code></pre>
  <p>But what I am looking for is this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
  &lt;class&gt;
      &lt;student&gt;
          &lt;name&gt;Ben&lt;/name&gt;
          &lt;age&gt;1&lt;/age&gt;
          &lt;ages&gt;4&lt;/ages&gt;
          &lt;entryprofile&gt;
            &lt;node&gt;1&lt;/node&gt;
          &lt;/entryprofile&gt;
      &lt;/student&gt;
      &lt;student&gt;
          &lt;name&gt;Steve&lt;/name&gt;
          &lt;age&gt;2&lt;/age&gt;
          &lt;ages&gt;3&lt;/ages&gt;
          &lt;entryprofile&gt;
            &lt;node&gt;1&lt;/node&gt;
          &lt;/entryprofile&gt;
      &lt;/student&gt;
  &lt;/class&gt;
  </code></pre>
  <p>You can see there that <code>entryprofile</code> for <em><strong>both</strong></em> stdudents has become a child on account of <code>node</code> becoming a child of <code>entryprofile</code>.</p>
  <p>Would anyone know where I am going wrong, and what I can do to achieve my desired result? Many thanks.</p>