Hello. I am trying to use the muenchian method to take an XML document shown below and consolidate it. The logic to use is:
If <LINE> and <ITEM> are the same in 2 or more <LINES> then SUM the <QTY> and delete all duplicate <LINES> nodes. My problem is how do I structure xslt so that the ROOT, HEADER, PO, VENDOR nodes are deep copied..while the LINES node and it's child nodes get consolidated and summed by QTY. See below XML samples:
Thank you very much for any insight into this problem
Thanks.
If <LINE> and <ITEM> are the same in 2 or more <LINES> then SUM the <QTY> and delete all duplicate <LINES> nodes. My problem is how do I structure xslt so that the ROOT, HEADER, PO, VENDOR nodes are deep copied..while the LINES node and it's child nodes get consolidated and summed by QTY. See below XML samples:
Thank you very much for any insight into this problem
Code:
<!--Take This Document..... -->
<ROOT>
<HEADER>
<PO>1</PO>
<VENDOR>ABC</VENDOR>
<LINES>
<LINE>1</LINE> <--Combine into 1 Node
<ITEM>A</ITEM>
<QTY>10</QTY>
</LINES>
<LINES>
<LINE>2</LINE>
<ITEM>B</ITEM>
<QTY>15</QTY>
</LINES>
<LINES>
<LINE>1</LINE> <--Duplicate Line #1
<ITEM>A</ITEM>
<QTY>15</QTY>
</LINES>
</HEADER>
</ROOT>
<!--.....And turn it into this -->
<ROOT>
<HEADER>
<PO>1</PO>
<VENDOR>ABC</VENDOR>
<LINES>
<LINE>1</LINE>
<ITEM>A</ITEM>
<QTY>25</QTY>
</LINES>
<LINES>
<LINE>2</LINE>
<ITEM>B</ITEM>
<QTY>15</QTY>
</LINES>
</HEADER>
</ROOT>