input code:
<?xml-stylesheet type="text/xsl" href="result.xml"?>
<productCatalog>
<product>
<name>bread</name>
<quantity>5</quantity>
<price>20</price>
</product>
<product>
<name>milk</name>
<quantity>12</quantity>
<price>40</price>
</product>
<product>
<name>sugar</name>
<quantity>10</quantity>
<price>22</price>
</product>
<product>
<name>tea powder</name>
<quantity>3</quantity>
<price>10</price>
</product>
<product>
<name>flour</name>
<quantity>20</quantity>
<price>25</price>
</product>
<product>
<name>bread</name>
<quantity>6</quantity>
<price>20</price>
</product>
<product>
<name>flour</name>
<quantity>3</quantity>
<price>25</price>
</product>
</productCatalog>
output code should be:
<?xml version="1.0" encoding="utf-8"?>
<product name="bread" Price="20" TotalPrice="220">
</product>
<product name="milk" Price="40" TotalPrice="480">
</product>
<product name="sugar" Price="22" TotalPrice="220">
</product>
<product name="tea powder" Price="10" TotalPrice="30">
</product>
<product name="flour" Price="25" TotalPrice="575">
</product>
because Bread and flour node is repeated we should add that value and should produce the output. It should produce the consolidate code which is stored in the attribute.