XSLT - copy all XML, and inject one XML element

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
I need to be able to copy all the source XML (exactly as it is, attributes, namespaces etc) and to also inject one XML element in the target XML. The newly injected XML needs to go into a specific play in the XML structure hierarchy.
A snapshot of my source XML is....
<pre class="prettyprint ...
<rispostaBilanciSintetici versione="7
<bilancio codBilancio="710" idBilancio="3
...
</bilancio>
<bilancio codBilancio="710" idBilancio="2
...
</bilancio>
<elencoVariazioni idElencoVariazioni="2
...
</elencoVariazioni>
</rispostaBilanciSintetici>
...[/code]
and the desired target XML snapshot is...
...<br/>
<rispostaBilanciSintetici versione="7 <br/>
<confrontoBilanci><br/>
<bilancio codBilancio="710" idBilancio="3 <br/>
...<br/>
</bilancio><br/>
<bilancio codBilancio="710" idBilancio="2 <br/>
...<br/>
</bilancio><br/>
<elencoVariazioni idElencoVariazioni="2 <br/>
...<br/>
</elencoVariazioni><br/>
</confrontoBilanci><br/>
</rispostaBilanciSintetici><br/>
...
Notice the newly injected XML element confrontoBilanci it needs to be a parent element of child elements bilancio and elencoVariazioni.

I am used to omitting XML and not injecting so am finding this quite tricky.
Thanks
<

View the full article
 
Back
Top