lunky
asked on
xslt sum / group
<orderform id="1">
<Items quantity="1" productid="AAA" cy_lineitem_total="72" >
<saved_orderlevel_discount s_applied cy_discount_amount="30" discount_name="MVP Discount" discount_id="243"/>
<saved_orderlevel_discount s_applied cy_discount_amount="10" discount_name="VIP Discount" discount_id="2"/>
</Items>
<Items quantity="1" productid="AAB" cy_lineitem_total="100.2" >
<saved_orderlevel_discount s_applied cy_discount_amount="20" discount_name="MVP Discount" discount_id="243"/>
</Items>
</orderform>
how can i transform the above xml into the fragment below?
Notice that the saved_orderlevel_discounts _applied nodes have been grouped by discount_id and the cy_discount_amount has been summed.
I need to do it in xslt, I am open to using the msxml extensions (? node-set() ?) but I can't use inline functions.
<orderform id="1">
<Items quantity="1" productid="AAA" cy_lineitem_total="72" />
<Items quantity="1" productid="AAB" cy_lineitem_total="100.2" />
<saved_orderlevel_discount s_applied cy_discount_amount="50" discount_name="MVP Discount" discount_id="243" />
<saved_orderlevel_discount s_applied cy_discount_amount="10" discount_name="VIP Discount" discount_id="2"/>
</orderform>
<Items quantity="1" productid="AAA" cy_lineitem_total="72" >
<saved_orderlevel_discount
<saved_orderlevel_discount
</Items>
<Items quantity="1" productid="AAB" cy_lineitem_total="100.2" >
<saved_orderlevel_discount
</Items>
</orderform>
how can i transform the above xml into the fragment below?
Notice that the saved_orderlevel_discounts
I need to do it in xslt, I am open to using the msxml extensions (? node-set() ?) but I can't use inline functions.
<orderform id="1">
<Items quantity="1" productid="AAA" cy_lineitem_total="72" />
<Items quantity="1" productid="AAB" cy_lineitem_total="100.2" />
<saved_orderlevel_discount
<saved_orderlevel_discount
</orderform>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In your XMLs above, it appears that the saved_orderlevel_discounts _applied elements are grouped regardless of which Items element each originally belonged to. Is this intentional? (Or should they be grouped within each Items element?)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
*knock* *knock* anybody home?