title: replace namespace from source xml
body: <p>i have searched but i couldn't find appropriate solution for handling namespace in xslt 1.0. Each node has many attributes but for easy readability i haven't shown them.</p>
  
  <p>My input xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Vendor VendorId="v1" VendorName="vaseline health" xmlns:ns1="http://ABCSampleDemo.SampleDemo" &gt;
      &lt;Customer CustId="c1" CustomerName="John Dillon" CustomerAddress="3093 jerfe st" Code="APL111"&gt;
          &lt;POrders PId="P0110" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0111" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="09-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0112" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="09-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0113" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0114" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0115" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0116" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;    
          &lt;POrders PId="P0117" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
              &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P0118" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
                  &lt;ID AuthId= "1111"/&gt;        
      &lt;/Customer&gt;
      &lt;Customer CustId="C2" CustomerName="Mac Payne" CustomerAddress="3333 jerfe st" Code="APL113"&gt;
          &lt;POrders PId="P2221" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="01-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
              &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P2222" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="01-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" /&gt;
              &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P2223" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T000" PurchaseStart="01-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" /&gt;
              &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P2224" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="01-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
              &lt;ID AuthId= "1111"/&gt;
          &lt;POrders PId="P2225" PName="uuu aillw" Units="3" Amount="100" ServiceRef="T001" PurchaseStart="01-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" /&gt;
              &lt;ID AuthId= "1111"/&gt;
      &lt;/Customer&gt; 
  &lt;/Vendor&gt;
  </code></pre>
  
  <p>CURRENT SS, </p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt;
  &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt;
  &lt;xsl:strip-space elements="*"/&gt;
      &lt;xsl:key name=" KPOrderAttrb" use="concat(@ServiceRef,'+',@WarehouseId,'+',substring(@PurchaseStart,1,10))" match="POrders"/&gt;
          &lt;xsl:template match="node()|@*"&gt;
              &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*"/&gt;
          &lt;xsl:for-each select="Customer"&gt;
              &lt;xsl:copy&gt;
                  &lt;xsl:copy-of select="@*"/&gt;
                  &lt;xsl:attribute name="ClientSeqNo"&gt;&lt;xsl:number  count="Customer"/&gt;&lt;/xsl:attribute&gt;
                  &lt;xsl:for-each select="descendant::POrders[generate-id()  =  generate-id(key('KPOrderAttrb', concat(@ServiceRef,'+',@WarehouseId,'+',substring(@PurchaseStart,1,10))) [1] )]"&gt;
                      &lt;xsl:copy&gt;
                          &lt;xsl:copy-of select="@*"/&gt;
                          &lt;xsl:variable name="vGroup" select="key('KPOrderAttrb',concat(@ServiceRef,'+',@WarehouseId,'+',substring(@PurchaseStart,1,10)))"/&gt;
                          &lt;xsl:variable name="vPOrderIds"&gt;
                              &lt;xsl:for-each select="$vGroup"&gt;
                                  &lt;xsl:sort select="@PId" data-type="number"/&gt;
                                  &lt;xsl:if test="not(position()=1)"&gt;
                                      &lt;xsl:value-of select="','"/&gt;
                                  &lt;/xsl:if&gt;
                                  &lt;xsl:value-of select="@PId"/&gt;
                              &lt;/xsl:for-each&gt;
                          &lt;/xsl:variable&gt;
                          &lt;xsl:attribute name="index"&gt;&lt;xsl:value-of select="position()"/&gt;&lt;/xsl:attribute&gt;
                          &lt;xsl:attribute name="Code"&gt;&lt;xsl:value-of select="ancestor::Customer[1]/@Code"/&gt;&lt;/xsl:attribute&gt;
                          &lt;xsl:attribute name="AuthId"&gt;&lt;xsl:value-of select="descendant::ID[1]/@AuthId"/&gt;&lt;/xsl:attribute&gt;
                          &lt;xsl:attribute name="CombinePOID"&gt;&lt;xsl:value-of select="$vPOrderIds"/&gt;&lt;/xsl:attribute&gt;
                          &lt;xsl:attribute name="Amount"&gt;&lt;xsl:value-of select="sum($vGroup/@Amount)"/&gt;&lt;/xsl:attribute&gt;
                      &lt;/xsl:copy&gt;
                  &lt;/xsl:for-each&gt;
              &lt;/xsl:copy&gt;
          &lt;/xsl:for-each&gt;
      &lt;/xsl:copy&gt;
          &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>desired output xml</p>
  
  <pre><code>    &lt;Vendor xmlns:ns1="http://xyzDemo.xyzDemo" VendorId="v1" VendorName="vaseline health"&gt;
      &lt;Customer CustId="c1" CustomerName="John Dillon" CustomerAddress="3093 jerfe st" Code="APL111" ClientSeqNo="1"&gt;
          &lt;POrders PId="P0110" PName="uuu aillw" Units="3" ServiceRef="T000" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" index="1" Code="APL111" AuthId="" CombinePOID="P0110" Amount="100"/&gt;
          &lt;POrders PId="P0111" PName="uuu aillw" Units="3" ServiceRef="T000" PurchaseStart="09-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" index="2" Code="APL111" AuthId="" CombinePOID="P0111,P0112" Amount="200"/&gt;
          &lt;POrders PId="P0113" PName="uuu aillw" Units="3" ServiceRef="T001" PurchaseStart="09-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" index="3" Code="APL111" AuthId="" CombinePOID="P0113,P0114,P0115,P0116,P0117,P0118" Amount="600"/&gt;
      &lt;/Customer&gt;
      &lt;Customer CustId="C2" CustomerName="Mac Payne" CustomerAddress="3333 jerfe st" Code="APL113" ClientSeqNo="2"&gt;
          &lt;POrders PId="P2221" PName="uuu aillw" Units="3" ServiceRef="T000" PurchaseStart="01-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" index="1" Code="APL113" AuthId="" CombinePOID="P2221" Amount="100"/&gt;
          &lt;POrders PId="P2222" PName="uuu aillw" Units="3" ServiceRef="T000" PurchaseStart="01-09-2012" PurchaseEnd="10-10-2011" WarehouseId="W2013" index="2" Code="APL113" AuthId="" CombinePOID="P2222,P2223" Amount="200"/&gt;
          &lt;POrders PId="P2224" PName="uuu aillw" Units="3" ServiceRef="T001" PurchaseStart="01-09-2011" PurchaseEnd="10-10-2011" WarehouseId="W2023" index="3" Code="APL113" AuthId="" CombinePOID="P2224,P2225" Amount="200"/&gt;
      &lt;/Customer&gt;
  &lt;/Vendor&gt;
  </code></pre>