title: How to add prefix for all elements and attributes using XSLT?
body: <p>I am trying to add the schema location and prefix 'ns1' to all the elements in the XML. The XSLT is working well to insert the schema location but is unable to assign prefixes to each element.
  the sample input</p>
  <pre><code>**&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ns1:StandardBusinessDocument xmlns:ns1=&quot;http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&quot;&gt;
     &lt;ns1:StandardBusinessDocumentHeader&gt;
        &lt;HeaderVersion&gt;1.0&lt;/HeaderVersion&gt;
        &lt;Sender&gt;
           &lt;ns1:Identifier Authority=&quot;EAN.UCC&quot;&gt;1234567890&lt;/ns1:Identifier&gt;
        &lt;/Sender&gt;
        &lt;Receiver&gt;
           &lt;ns1:Identifier Authority=&quot;EAN.UCC&quot;&gt;BUILDLINK&lt;/ns1:Identifier&gt;
        &lt;/Receiver&gt;
        &lt;DocumentIdentification&gt;
           &lt;ns1:Standard&gt;EAN.UCC&lt;/ns1:Standard&gt;
           &lt;ns1:TypeVersion&gt;2.4&lt;/ns1:TypeVersion&gt;
           &lt;ns1:InstanceIdentifier&gt;0448431457&lt;/ns1:InstanceIdentifier&gt;
           &lt;ns1:Type&gt;Invoice&lt;/ns1:Type&gt;
           &lt;ns1:CreationDateAndTime&gt;2012-10-18&lt;/ns1:CreationDateAndTime&gt;
        &lt;/DocumentIdentification&gt;
     &lt;/ns1:StandardBusinessDocumentHeader&gt;**
  </code></pre>
  <p>To be</p>
  <pre><code>**&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ns1:StandardBusinessDocument xmlns:ns1=&quot;http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&quot; 
      xmlns:eanucc=&quot;urn:ean.ucc:2&quot; 
      xmlns:pay=&quot;urn:ean.ucc:pay:2&quot; 
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
      xsi:schemaLocation=&quot;http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader ../Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2 ../Schemas/InvoiceProxy.xsd&quot;&gt;
      &lt;ns1:StandardBusinessDocumentHeader&gt;
          &lt;ns1:HeaderVersion&gt;1.0&lt;/ns1:HeaderVersion&gt;
          &lt;ns1:Sender&gt;
              &lt;ns1:Identifier Authority=&quot;EAN.UCC&quot;&gt;1234567890&lt;/ns1:Identifier&gt;
          &lt;/ns1:Sender&gt;
          &lt;ns1:Receiver&gt;
              &lt;ns1:Identifier Authority=&quot;EAN.UCC&quot;&gt;BUILDLINK&lt;/ns1:Identifier&gt;
          &lt;/ns1:Receiver&gt;
          &lt;ns1:DocumentIdentification&gt;
              &lt;ns1:Standard&gt;EAN.UCC&lt;/ns1:Standard&gt;
              &lt;ns1:TypeVersion&gt;2.4&lt;/ns1:TypeVersion&gt;
              &lt;ns1:InstanceIdentifier&gt;0448431457&lt;/ns1:InstanceIdentifier&gt;
              &lt;ns1:Type&gt;Invoice&lt;/ns1:Type&gt;
              &lt;ns1:CreationDateAndTime&gt;2022-07-21T12:00:00.000+08:00&lt;/ns1:CreationDateAndTime&gt;
          &lt;/ns1:DocumentIdentification&gt;
      &lt;/ns1:StandardBusinessDocumentHeader&gt;**
  </code></pre>
  <p>XSLT -</p>
  <pre><code>**&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
  &lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; indent=&quot;yes&quot;/&gt;
  &lt;xsl:template match=&quot;/&quot;&gt;
  &lt;ns1:StandardBusinessDocument xmlns:ns1=&quot;http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&quot; 
      xmlns:eanucc=&quot;urn:ean.ucc:2&quot; 
      xmlns:pay=&quot;urn:ean.ucc:pay:2&quot; 
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
      xsi:schemaLocation=&quot;http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader ../Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2 ../Schemas/InvoiceProxy.xsd&quot;&gt;
  &lt;xsl:copy-of select=&quot;//ns1:StandardBusinessDocument&quot;/&gt;
  &lt;/ns1:StandardBusinessDocument&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;**
  </code></pre>
  <p>Could you please guide me. Thanks</p>