[xsl] Add an element that contains multiple nested elements

Subject: [xsl] Add an element that contains multiple nested elements
From: "Gianluca Garbellotto" <gg@xxxxxxxxx>
Date: Tue, 16 May 2006 11:43:51 -0400
I use msxsl and XSL 1.0. I need to add a <container> element to a file like
this:

<rootElement>
  <element1>
    <elementA>A</elementA>
  </element1>
...
  <element2>
    <elementB>B</elementB>
  </element1>
</rootElement>
 
This is the result I need to achieve:
 
<rootElement>
 <container>
  <element1>
    <elementA>A</elementA>
  </element1>
...
  <element2>
    <elementB>B</elementB>
  </element1>
 </container>
</rootElement>

and this is what I get with all the various attempts I made:

<rootElement>
 <container>
  <element1>
    <elementA>A</elementA>
  </element1>
 </container>
...
 <container>
  <element2>
    <elementB>B</elementB>
  </element1>
 </container
</rootElement>

Any guidance on how to achieve the result I need would be greatly
appreciated. Thanks.

Current Thread