Merge 2 XML using XSL

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have a requirement where I need to merge 2 xml files, not sure how the XSL can be called from C# for this and how I can pass the 2 XML as parameters to XSL.
XML1:<br/>
<Employees><br/>
<Employee doc="1 <br/>
<EmpID>1</EmpID><br/>
<EmpName>Name1</EmpName><br/>
<EmpDesc>Desc1</EmpDesc><br/>
</Employee><br/>
<Employee doc="2 <br/>
<EmpID>2</EmpID><br/>
<EmpName>Name2</EmpName><br/>
<EmpDesc>Desc2</EmpDesc><br/>
</Employee><br/>
</Employees>
XML2:<br/>
<Employees><br/>
<Employee doc="1 <br/>
<EmpID>1</EmpID><br/>
<EmpName>Name1</EmpName><br/>
<EmpDesc>Desc11</EmpDesc><br/>
</Employee><br/>
<Employee doc="2 <br/>
<EmpID>2</EmpID><br/>
<EmpName>Name2</EmpName><br/>
<EmpDesc>Desc22</EmpDesc><br/>
</Employee><br/>
</Employees>
Now if you see the 2 XML, only the element <EmpDesc> is different, so I want this to be merged into one XML.
So in the final output the XML will be the same as XML1 but only the EmpDesc will changes to:

For <Employee doc="1
<EmpDesc>Desc1 Desc11</EmpDesc>
and for <Employee doc="2 , it will be:
<EmpDesc>Desc2 Desc22</EmpDesc>

Could you please advice on how to do this. Thanks. <hr class="sig Rpaul

View the full article
 
Back
Top