title: Remove xmlns from XML using XSLT
body: <p>I have an XML as below and looking to remove the SOAP envelope and body from the request and generate as below. </p>
  
  <p>Current XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soap:Body&gt;
  &lt;AsnPODetailsRequest&gt;
  &lt;AsnPODetails&gt;
      &lt;RequestSourcedFrom&gt;EDI&lt;/RequestSourcedFrom&gt;
      &lt;ValidationLevelInd&gt;&lt;/ValidationLevelInd&gt;
      &lt;AdvanceShipmentNotificationId&gt;&lt;/AdvanceShipmentNotificationId&gt;
      &lt;PoAttributeList&gt;
          &lt;PoAttribute&gt;
              &lt;Department&gt;&lt;/Department&gt;
              &lt;FreightTerms&gt;&lt;/FreightTerms&gt;
              &lt;Location&gt;&lt;/Location&gt;
              &lt;LocationType&gt;&lt;/LocationType&gt;
              &lt;MFOrderNo&gt;MOMILQ&lt;/MFOrderNo&gt;
              &lt;NotBeforeDate&gt;2014-06-24 01:21:36&lt;/NotBeforeDate&gt;
              &lt;PurchaseOrderType&gt;&lt;/PurchaseOrderType&gt;
              &lt;RetekPurchaseOrderNo&gt;&lt;/RetekPurchaseOrderNo&gt;
              &lt;sku&gt;&lt;/sku&gt;
              &lt;Status&gt;&lt;/Status&gt;
              &lt;Supplier&gt;&lt;/Supplier&gt;
              &lt;SupplierDesc&gt;&lt;/SupplierDesc&gt;
              &lt;upc&gt;&lt;/upc&gt;
              &lt;VendorOrderNo&gt;&lt;/VendorOrderNo&gt;
          &lt;/PoAttribute&gt;
          &lt;PoAttribute&gt;
          &lt;Department&gt;&lt;/Department&gt;
          &lt;FreightTerms&gt;&lt;/FreightTerms&gt;
          &lt;Location&gt;&lt;/Location&gt;
          &lt;LocationType&gt;&lt;/LocationType&gt;
          &lt;MFOrderNo&gt;MOMILN&lt;/MFOrderNo&gt;
          &lt;NotBeforeDate&gt;2014-06-24 01:21:36&lt;/NotBeforeDate&gt;
          &lt;PurchaseOrderType&gt;&lt;/PurchaseOrderType&gt;
          &lt;RetekPurchaseOrderNo&gt;&lt;/RetekPurchaseOrderNo&gt;
          &lt;sku&gt;&lt;/sku&gt;
          &lt;Status&gt;&lt;/Status&gt;
          &lt;Supplier&gt;&lt;/Supplier&gt;
          &lt;SupplierDesc&gt;&lt;/SupplierDesc&gt;
          &lt;upc&gt;&lt;/upc&gt;
          &lt;VendorOrderNo&gt;&lt;/VendorOrderNo&gt;
          &lt;/PoAttribute&gt;
      &lt;/PoAttributeList&gt;
      &lt;/AsnPODetails&gt;
     &lt;/AsnPODetailsRequest&gt;
    &lt;/soap:Body&gt;
   &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Desired XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;AsnPODetailsRequest&gt;
  &lt;AsnPODetails&gt;
      &lt;RequestSourcedFrom&gt;EDI&lt;/RequestSourcedFrom&gt;
      &lt;ValidationLevelInd&gt;&lt;/ValidationLevelInd&gt;
      &lt;AdvanceShipmentNotificationId&gt;&lt;/AdvanceShipmentNotificationId&gt;
      &lt;PoAttributeList&gt;
          &lt;PoAttribute&gt;
              &lt;Department&gt;&lt;/Department&gt;
              &lt;FreightTerms&gt;&lt;/FreightTerms&gt;
              &lt;Location&gt;&lt;/Location&gt;
              &lt;LocationType&gt;&lt;/LocationType&gt;
              &lt;MFOrderNo&gt;MOMILQ&lt;/MFOrderNo&gt;
              &lt;NotBeforeDate&gt;2014-06-24 01:21:36&lt;/NotBeforeDate&gt;
              &lt;PurchaseOrderType&gt;&lt;/PurchaseOrderType&gt;
              &lt;RetekPurchaseOrderNo&gt;&lt;/RetekPurchaseOrderNo&gt;
              &lt;sku&gt;&lt;/sku&gt;
              &lt;Status&gt;&lt;/Status&gt;
              &lt;Supplier&gt;&lt;/Supplier&gt;
              &lt;SupplierDesc&gt;&lt;/SupplierDesc&gt;
              &lt;upc&gt;&lt;/upc&gt;
              &lt;VendorOrderNo&gt;&lt;/VendorOrderNo&gt;
          &lt;/PoAttribute&gt;
          &lt;PoAttribute&gt;
          &lt;Department&gt;&lt;/Department&gt;
          &lt;FreightTerms&gt;&lt;/FreightTerms&gt;
          &lt;Location&gt;&lt;/Location&gt;
          &lt;LocationType&gt;&lt;/LocationType&gt;
          &lt;MFOrderNo&gt;MOMILN&lt;/MFOrderNo&gt;
          &lt;NotBeforeDate&gt;2014-06-24 01:21:36&lt;/NotBeforeDate&gt;
          &lt;PurchaseOrderType&gt;&lt;/PurchaseOrderType&gt;
          &lt;RetekPurchaseOrderNo&gt;&lt;/RetekPurchaseOrderNo&gt;
          &lt;sku&gt;&lt;/sku&gt;
          &lt;Status&gt;&lt;/Status&gt;
          &lt;Supplier&gt;&lt;/Supplier&gt;
          &lt;SupplierDesc&gt;&lt;/SupplierDesc&gt;
          &lt;upc&gt;&lt;/upc&gt;
          &lt;VendorOrderNo&gt;&lt;/VendorOrderNo&gt;
          &lt;/PoAttribute&gt;
      &lt;/PoAttributeList&gt;
      &lt;/AsnPODetails&gt;
    &lt;/AsnPODetailsRequest&gt;
  </code></pre>
  
  <p>I am using the below XSLT</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
    &lt;xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/&gt;
    &lt;xsl:strip-space elements="*"/&gt;
  
   &lt;!-- identity 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="soap:Envelope | soap:Body"&gt;
    &lt;xsl:apply-templates select="@*|node()"/&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>but it is not removing the line xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/". it is removing only soap:Envelope and soap:Body. can any please help me to write an XSLT to remove tags as i requested?</p>