[xsl] XSLT for mergig XML fragments into the base XML

Subject: [xsl] XSLT for mergig XML fragments into the base XML
From: Zeev Atlas <zatlas1@xxxxxxxxx>
Date: Sun, 04 Sep 2011 22:17:36 -0400
I have a main XML file like this:

<myxmlroot>
<myxmlproject>
<myxmlincludetype1 filename="SOMEFILE1"/>
<myxmlincludetype2 filename="SOMEFILE2" attributes.../>
<myxmlbranchhead branchname="STEP1" attributes...>
<myxmlleafnode leafnodename="LFNM1" attributes.../>
etc.
<myxmlbranchhead/>
<myxmlproject/>
<myxmlroot/>



The fragments look like (SOMEFILE1)



<myxmlroot>
<myxmlincludetype2 filename="SOMEFILE3" attributes.../>
<myxmlbranchhead branchname="STEP3" attributes...>
<myxmlleafnode leafnodename="LFNM3" attributes.../>
etc.
<myxmlbranchhead/>
<myxmlroot/>


Only myxmlincludetype2 is available in the fragment. Both myxmlincludetype1 and myxmlincludetype2 are optional. When present they mean that the filename, which contain the fragment should be read, stripped from the myxmlroot tags and embeded in the output XML. The process is recursive. So the output should look like this:




<myxmlroot>
<myxmlproject>
<myxmlincludetype1 filename="SOMEFILE1"/>
here would be the fragment from SOMEFILE1
<myxmlincludetype2 filename="SOMEFILE3" attributes.../>
here would be the fragment from SOMEFILE3
<myxmlbranchhead branchname="STEP3" attributes...>
<myxmlleafnode leafnodename="LFNM3" attributes.../>
etc.
<myxmlbranchhead/>

<myxmlincludetype2 filename="SOMEFILE2" attributes.../>
here would be the fragment from SOMEFIL2
<myxmlbranchhead branchname="STEP1" attributes...>
<myxmlleafnode leafnodename="LFNM1" attributes.../>
etc.
<myxmlbranchhead/>
<myxmlproject/>
<myxmlroot/>



Could anybody please guide me where to look or even give me a sample XSLT file that handle similar case, it is the first time I deal with XML and XSLT

Thanks

ZA

Ze'ev Atlas
201-801-0378
201-805-0286 (cell)

Current Thread