change the order of the tags with xsl

Hi ,
i have the below xml,

<Doc>
    <Ins00>Insert00</Ins00>
    <Ins5>Insert5</Ins5>
    <Ins6>Insert6</Ins6>
    <Ins20>Insert20</Ins20>
    <Ins21>Insert21</Ins21>
    <Ins22>Insert22</Ins22>
    <Ins91>Insert91</Ins91>
    <Ins92>Insert92</Ins92>
    <Programs>
      <Program>
        <Type>MA</Type>
      </Program>
      <Program>
        <Type>HP</Type>
      </Program>
    </Programs>
  </Doc>

Open in new window


i want to update the xml as below

<Doc>
   <Ins20>Insert20</Ins20>
    <Ins21>Insert21</Ins21>
    <Ins22>Insert22</Ins22>
     <Ins5>Insert5</Ins5>
    <Ins6>Insert6</Ins6>
    <Ins00>Insert00</Ins00>
     <Ins91>Insert91</Ins91>
    <Ins92>Insert92</Ins92>
    <Programs>
      <Program>
        <Type>MA</Type>
      </Program>
      <Program>
        <Type>HP</Type>
      </Program>
    </Programs>
  </Doc>

Open in new window


I am using the below xsl  (with the help of Member Geert)

<xsl:template match="Doc">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="Ins20"/>
            <xsl:apply-templates select="Ins21"/>
            <xsl:apply-templates select="Ins22"/>
            <xsl:apply-templates select="Ins5"/>
            <xsl:apply-templates select="Ins6"/>
            <xsl:apply-templates select="Ins00"/>
            <xsl:apply-templates select="Ins91"/>
            <xsl:apply-templates select="Ins92"/>
        </xsl:copy>
</xsl:template>

the xsl i s getting me the correct  order but it removing the  <Programs> part, i dont want to disturb the below part
============
 <Programs>
      <Program>
        <Type>MA</Type>
      </Program>
      <Program>
        <Type>HP</Type>
      </Program>
    </Programs>


Thank you in advance.
sri1209Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
Simply add a apply-templates for adding the programs

<xsl:apply-templates select="Ins92"/>

to become

<xsl:apply-templates select="Ins92"/>
<xsl:apply-templates select="Programs"/>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sri1209Author Commented:
Thanks Geert, you always have a solution.
0
Gertone (Geert Bormans)Information ArchitectCommented:
welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.