title: XSLT to change namespace prefix along with attribute conversion
body: <p>I am trying to convert elements into attributes along with addition of  namespace prefix. But I am not able to do both the things in same XSLT.    </p>
  
  <p>Source XML:</p>
  
  <pre><code>    &lt;createDocument&gt; 
      &lt;ecm_cmd_doc&gt; 
          &lt;ecm_application_name&gt;preview&lt;/ecm_application_name&gt;  
          &lt;ecm_operation&gt; 
              &lt;mode&gt;asynchronous&lt;/mode&gt;  
              &lt;name&gt;create&lt;/name&gt; 
          &lt;/ecm_operation&gt;  
          &lt;doc_in_create&gt; 
              &lt;doc_object_attribute_create&gt; 
                  &lt;doc_format&gt;pdf&lt;/doc_format&gt;  
                  &lt;dctm_folder/&gt;  
                  &lt;dctm_object_type&gt;ecm_gbd_check_image_doc&lt;/dctm_object_type&gt;  
                  &lt;doc_attr&gt; 
                      &lt;attr_name&gt;document_code&lt;/attr_name&gt;  
                      &lt;attr_value&gt;9002&lt;/attr_value&gt; 
                  &lt;/doc_attr&gt;                     
                  &lt;doc_attr&gt; 
                      &lt;attr_name&gt;bill_customer_identifier&lt;/attr_name&gt;  
                      &lt;attr_value&gt;234567898&lt;/attr_value&gt; 
                  &lt;/doc_attr&gt; 
                  &lt;file_info&gt; 
                      &lt;URL&gt;1234567890.pdf&lt;/URL&gt;  
                      &lt;URI&gt;1234567890.pdf&lt;/URI&gt;  
                      &lt;file_in_target&gt;false&lt;/file_in_target&gt; 
                  &lt;/file_info&gt; 
              &lt;/doc_object_attribute_create&gt; 
          &lt;/doc_in_create&gt; 
      &lt;/ecm_cmd_doc&gt; 
  &lt;/createDocument&gt;    
  </code></pre>
  
  <p>XSLT Used:</p>
  
  <pre><code>      &lt;xsl:stylesheet env:encodingStyle="" xmlns:p="http://tempuri.org/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" version="1.0"&gt;
        &lt;xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /&gt; 
        &lt;xsl:strip-space elements="*"/&gt; 
  
        &lt;xsl:template match="/"&gt;
        &lt;xsl:apply-templates select="/*"/&gt;  
        &lt;/xsl:template&gt;
  
        &lt;xsl:template match="*"&gt;
        &lt;xsl:copy&gt; 
        &lt;xsl:for-each select="mode|doc_format|URL|URI|file_in_target|xmlns|dctm_folder|name|dctm_object_type|attr_value|attr_name"&gt;
         &lt;xsl:attribute name="{name()}"&gt;
         &lt;xsl:value-of select="."/&gt; 
         &lt;/xsl:attribute&gt;
         &lt;/xsl:for-each&gt;
         &lt;xsl:apply-templates select="node()[not(self::mode or self::dctm_folder or self::doc_format or self::xmlns or self::URL or self::URI or self::file_in_target or self::name or self::dctm_object_type or self::attr_value or self::attr_name)]" /&gt; 
         &lt;/xsl:copy&gt;
         &lt;/xsl:template&gt;
  
         &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>    &lt;p:createDocument xmlns:p="http://ecm.com/ecm_c_dc"&gt;
      &lt;p:ecm_cmd_doc&gt;
      &lt;p:ecm_application_name&gt;preview&lt;/p:ecm_application_name&gt;
      &lt;p:ecm_operation mode="asynchronous" name="create"/&gt;
      &lt;p:doc_in_create&gt;
       &lt;p:doc_object_attribute_create doc_format="pdf"
                                    dctm_folder=""
                                    dctm_object_type="ecm_gbd_check_image_doc"&gt;
          &lt;p:doc_attr attr_name="document_code" attr_value="9002"/&gt;
          &lt;p:doc_attr attr_name="bill_customer_identifier" attr_value="234567898"/&gt;
          &lt;p:file_info URL="1234567890.pdf" URI="1234567890.pdf" file_in_target="false"/&gt;
       &lt;/p:doc_object_attribute_create&gt;
       &lt;/p:doc_in_create&gt;
       &lt;/p:ecm_cmd_doc&gt;
       &lt;/p:createDocument&gt;
  </code></pre>
  
  <p>Would appreciate any help on this!</p>