title: XSLT rename element with attribute value
body: <p>I'm new with xslt. and im trying to rename the element name of my <em>.xml</em> with the attribute name, and also remove the atttribute.</p>
  
  <p>This is a sample of the XML i want to transform:</p>
  
  <pre><code>&lt;configdata&gt;  
   &lt;element xsi:type="AAA"&gt;
    &lt;attributes&gt;
       &lt;att1&gt;0&lt;/att1&gt;
       &lt;att2&gt;1&lt;/att2&gt;
       &lt;att3&gt;25&lt;/att3&gt;
    &lt;/attributes&gt;
   &lt;/element&gt;
   &lt;element xsi:type="BBB"&gt;
    &lt;attributes&gt;
       &lt;att4&gt;23&lt;/att4&gt;
       &lt;att5&gt;44&lt;/att5&gt;
       &lt;att6&gt;12&lt;/att6&gt;
    &lt;/attributes&gt;
   &lt;/element&gt;
  &lt;/configdata&gt;
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>&lt;configdata&gt; 
   &lt;AAA&gt;
    &lt;attributes&gt;
       &lt;att1&gt;0&lt;/att1&gt;
       &lt;att2&gt;1&lt;/att2&gt;
       &lt;att3&gt;25&lt;/att3&gt;
    &lt;/attributes&gt;
   &lt;/AAA&gt;
   &lt;BBB&gt;
    &lt;attributes&gt;
       &lt;att4&gt;23&lt;/att4&gt;
       &lt;att5&gt;44&lt;/att5&gt;
       &lt;att6&gt;12&lt;/att6&gt;
    &lt;/attributes&gt;
   &lt;/BBB&gt;
  &lt;/configdata&gt;
  </code></pre>
  
  <p>The xml has hundreds of elements(AAA,BBB,CCC,DDD...) so, any general solution would be great.</p>
  
  <p>I've tried with the following xslt code but in the output i keep the input xml with no change at all.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet 
  version="1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&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="element"&gt;
   &lt;xsl:element name="{@xsi:type}"&gt;
    &lt;xsl:value-of select="."/&gt;
   &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I would appreciate any help. Thanks</p>