title: XSLT Convert attribute to element and copy value from an other elemen
body: <p>I have XML data like this</p>
  
  <pre><code>&lt;ABC version="1.0"&gt;
    &lt;XYZ&gt;
      &lt;ROWSET ROWS="00001"&gt;
        &lt;ROWDEF&gt;
          &lt;COLUMN ID="ACCT_ID" LEN="016" NULL="Y"/&gt;
          &lt;COLUMN ID="AGNT_ID" LEN="004" NULL="Y"/&gt;
          &lt;COLUMN ID="CUST_EXTR_ID" LEN="024" NULL="Y"/&gt;
          &lt;COLUMN ID="PI_ID" LEN="019" NULL="Y"/&gt;
          &lt;COLUMN ID="PRIN_ID" LEN="004" NULL="Y"/&gt;
          &lt;COLUMN ID="SYS_ID" LEN="004" NULL="Y"/&gt;
        &lt;/ROWDEF&gt;
        &lt;ROW&gt;
          &lt;C&gt;6369921501000060&lt;/C&gt;
          &lt;C&gt;0000&lt;/C&gt;
          &lt;C&gt;C13093102141063422034238&lt;/C&gt;
          &lt;C&gt;6369921501000060   &lt;/C&gt;
          &lt;C&gt;1500&lt;/C&gt;
          &lt;C&gt;9008&lt;/C&gt;
        &lt;/ROW&gt;
        &lt;ROW&gt;
          &lt;C&gt;6369921501000061&lt;/C&gt;
          &lt;C&gt;0001&lt;/C&gt;
          &lt;C&gt;C13093102141063422034231&lt;/C&gt;
          &lt;C&gt;6369921501000060   &lt;/C&gt;
          &lt;C&gt;1501&lt;/C&gt;
          &lt;C&gt;9001&lt;/C&gt;
        &lt;/ROW&gt;
      &lt;/ROWSET&gt;
    &lt;/XYZ&gt;
  &lt;/ABC&gt;
  </code></pre>
  
  <p>And I'm trying to convert this into</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ABC version="1.0"&gt;
    &lt;XYZ RC="0067"&gt;
      &lt;ROWSET ROWS="00001"&gt;
        &lt;ROWDEF&gt;
          &lt;ACCT_ID&gt;6369921501000060&lt;/ACCT_ID&gt;
          &lt;AGNT_ID&gt;0000&lt;/AGNT_ID&gt;
          &lt;CUST_EXTR_ID&gt;C13093102141063422034238&lt;/CUST_EXTR_ID&gt;
          &lt;PI_ID&gt;6369921501000060&lt;/PI_ID&gt;
          &lt;PRIN_ID&gt;1500&lt;/PRIN_ID&gt;
          &lt;SYS_ID&gt;9008&lt;/SYS_ID&gt;
        &lt;/ROWDEF&gt;
        &lt;ROWDEF&gt;
          &lt;ACCT_ID&gt;6369921501000061&lt;/ACCT_ID&gt;
          &lt;AGNT_ID&gt;0001&lt;/AGNT_ID&gt;
          &lt;CUST_EXTR_ID&gt;C13093102141063422034231&lt;/CUST_EXTR_ID&gt;
          &lt;PI_ID&gt;6369921501000060&lt;/PI_ID&gt;
          &lt;PRIN_ID&gt;1501&lt;/PRIN_ID&gt;
          &lt;SYS_ID&gt;9001&lt;/SYS_ID&gt;
        &lt;/ROWDEF&gt;
      &lt;/ROWSET&gt;
    &lt;/XYZ&gt;
  &lt;/ABC&gt;
  </code></pre>
  
  <p>I have looked around and tried few things but it is not working.
  Can someone help me with this.
  Below is my XSLT. Thanks in advance.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
    &lt;xsl:output method="xml" version="1.0" encoding="utf-8" 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="COLUMN"&gt;
      &lt;xsl:element name="{@ID}"&gt;
        &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="node()"&gt;&lt;/xsl:apply-templates&gt;
        &lt;/xsl:copy&gt;
        &lt;xsl:apply-templates /&gt;
        &lt;!--&lt;xsl:call-template name="value"&gt;&lt;/xsl:call-template&gt;--&gt;
      &lt;/xsl:element&gt;
    &lt;/xsl:template&gt;
  
    &lt;!--
    &lt;xsl:template match="ROW" name="value"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="node()"&gt;&lt;/xsl:apply-templates&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
    --&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>