title: How to append value to xml using xslt
body: <p>This is the xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Posttype1 xmlns="http://www.company.com/path" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;type1Set&gt;
      &lt;type1 action="Add"&gt;
        &lt;CLASS maxvalue="type1"&gt;type1&lt;/CLASS&gt;
        &lt;CREATEDBY&gt;user&lt;/CREATEDBY&gt;
        &lt;LANGCODE&gt;EN&lt;/LANGCODE&gt;
        &lt;STATUS&gt;NEW&lt;/STATUS&gt;
        &lt;ID&gt;1073&lt;/ID&gt;
      &lt;/type1&gt;
    &lt;/type1Set&gt;
  &lt;/Posttype1&gt;
  </code></pre>
  
  <p>In this xml Posttype1 has to be converted to Puttype1 and ID value have to be appended with 99.
  The output should be </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Puttype1 xmlns="http://www.company.com/path" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;type1Set&gt;
      &lt;type1 action="Add"&gt;
        &lt;CLASS maxvalue="type1"&gt;type1&lt;/CLASS&gt;
        &lt;CREATEDBY&gt;user&lt;/CREATEDBY&gt;
        &lt;LANGCODE&gt;EN&lt;/LANGCODE&gt;
        &lt;STATUS&gt;NEW&lt;/STATUS&gt;
        &lt;ID&gt;991073&lt;/ID&gt;
      &lt;/type1&gt;
    &lt;/type1Set&gt;
  &lt;/Posttype1&gt;
  </code></pre>
  
  <p>The Posttype1 is converted using xslt , but when trying to append 99 I am unable to reach the Id.</p>
  
  <p>The XSLT used is</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:comp="http://www.company.com/path" version="1.0" &gt;
  &lt;xsl:template match="comp:Postype1 "&gt;
      &lt;xsl:element name="Puttype1 "&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&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="Puttype1/type1Set/type1/ID"&gt;
  &lt;xsl:number&gt;99&lt;/xsl:number&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt; 
  </code></pre>
  
  <p>This give the following output</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;Puttype1 &gt;
    &lt;type1Set xmlns="http://www.company.com/path" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;type1 action="Add"&gt;
        &lt;CLASS maxvalue="type1"&gt;type1&lt;/CLASS&gt;
        &lt;CREATEDBY&gt;user&lt;/CREATEDBY&gt;
        &lt;LANGCODE&gt;EN&lt;/LANGCODE&gt;
  &lt;STATUS&gt;NEW&lt;/STATUS&gt;
     &lt;ID&gt;1073&lt;/ID&gt;
     &lt;/type1&gt;
     &lt;/type1Set&gt;
     &lt;/Posttype1&gt;
  </code></pre>
  
  <p>As you can see the xmlns and xmlns:xsi is moving to the child tag, Can someone tell me why this is happening and I don't know how to append the integer.</p>
  
  <p>P.S. I also tried </p>
  
  <pre><code>&lt;xsl:template match="comp:Postype1 "&gt;
  &lt;xsl:element name="Puttype1 "&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
  &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>It moved the xmlns tag to parent but xmlns:xsi is still in child.</p>