title: Duplication of XML namespaces in SQL
body: <p>I have the following problem, I need to remove the "cfdi_" for "cfdi:"</p>
  
  <p>I used the namespaces to solve that but they are duplicated by each node and I can not eliminate them, If you could help me I would appreciate it</p>
  
  <pre><code>declare @Mydoc xml;
  
  set @Mydoc = (SELECT 
                    '' as importe,
                    (SELECT Importe, TasaCuota, TipoFactor, Impuesto, Base
                     FROM CDFIDet
                     FOR XML RAW('cfdi_traslado'), TYPE, ROOT('cfdi_traslados'))
                FROM
                    CFDIENC
                FOR XML RAW('cfdi_gatito'),type)
  
  SELECT @Mydoc;
  </code></pre>
  
  <p>Result1:</p>
  
  <pre><code>&lt;cfdi:gatito importe=""&gt;
    &lt;cfdi:traslados&gt;
      &lt;cfdi:traslado Importe="1920" TasaCuota="0" TipoFactor="Tasa" Impuesto="16" Base="240" /&gt;
      &lt;cfdi:traslado Importe="2202" TasaCuota="0" TipoFactor="TASA" Impuesto="16" Base="450" /&gt;
    &lt;/cfdi:traslados&gt;
  &lt;/cfdi:gatito&gt;
  </code></pre>
  
  <p>Second attempt:</p>
  
  <pre><code>declare @Mydoc xml;
  
  WITH xmlnamespaces ('uri' as cfdi)
      SELECT @Mydoc = (SELECT 
                           '' AS importe,
                           (SELECT Importe, TasaCuota, TipoFactor, Impuesto, Base
                            FROM CDFIDet
                            FOR XML RAW('cfdi:traslado'), TYPE, ROOT('cfdi:traslados'))
                       FROM CFDIENC
                       FOR XML RAW('cfdi:gatito'), TYPE)
  
  SELECT @Mydoc;
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>&lt;cfdi:gatito xmlns:cfdi="uri" importe=""&gt;
    &lt;cfdi:traslados xmlns:cfdi="uri"&gt;
      &lt;cfdi:traslado Importe="1920" TasaCuota="0" TipoFactor="Tasa" Impuesto="16" Base="240" /&gt;
      &lt;cfdi:traslado Importe="2202" TasaCuota="0" TipoFactor="TASA" Impuesto="16" Base="450" /&gt;
    &lt;/cfdi:traslados&gt;
  &lt;/cfdi:gatito&gt;
  </code></pre>
  
  <p>My code is bigger and it is repeated too many times and I do not know how to eliminate them</p>