I have two xml files. I want to merge them and make some arithmetic with a few attributes. Please provide some ideas. I am using a standard xslt http://informatik.hu-berlin.de/merge to merge the files.
File 1:
<coverage branch-rate="0.5125" branch-total="50" line-rate="0.00593031875463">
</coverage>
File 2:
<coverage branch-rate="0.5" branch-total="40" line-rate="1.0">
</coverage>
Expected Result File
<coverage branch-rate="(0.5125*50 + 05*40)/(50+40)" branch-total="50" line-rate="0.00593031875463">
</coverage>
You can use XSLT and the document function. Document loads another xml file into the xslt processing. The example does only a simple arithmetic operation. You need to modify it.
This transformation:
when applied on any XML document (not used), and having the two provided XML documents reside in:
c:/temp/delete/file1.xml:
and c:/temp/delete/file2.xml:
produces the wanted, correct result: