xsl-list
[Top] [All Lists]

Help with a Transform

2004-09-02 13:12:56
This is a piece of an XML file I'm working on:
<?xml version="1.0" encoding="utf-8"?>
<Orders>
   <OrderReport>
       <Item>
           <ItemPrice>
               <Component>
                   <Type>Principal</Type>
                   <Amount currency="USD">179.85</Amount>
               </Component>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">21.95</Amount>
               </Component>
               <Component>
                   <Type>Tax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
               <Component>
                   <Type>ShippingTax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
           </ItemPrice>
       </Item>
   </OrderReport>
   <OrderReport>
       <Item>
           <ItemPrice>
               <Component>
                   <Type>Principal</Type>
                   <Amount currency="USD">7.99</Amount>
               </Component>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">2.32</Amount>
               </Component>
               <Component>
                   <Type>Tax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
               <Component>
                   <Type>ShippingTax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
           </ItemPrice>
           <Promotion>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">-2.32</Amount>
               </Component>
           </Promotion>
       </Item>
       <Item>
           <ItemPrice>
               <Component>
                   <Type>Principal</Type>
                   <Amount currency="USD">67.95</Amount>
               </Component>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">2.31</Amount>
               </Component>
               <Component>
                   <Type>Tax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
               <Component>
                   <Type>ShippingTax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
           </ItemPrice>
           <Promotion>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">-2.31</Amount>
               </Component>
           </Promotion>
       </Item>
       <Item>
           <ItemPrice>
               <Component>
                   <Type>Principal</Type>
                   <Amount currency="USD">24.95</Amount>
               </Component>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">2.32</Amount>
               </Component>
               <Component>
                   <Type>Tax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
               <Component>
                   <Type>ShippingTax</Type>
                   <Amount currency="USD">0.00</Amount>
               </Component>
           </ItemPrice>
           <Promotion>
               <Component>
                   <Type>Shipping</Type>
                   <Amount currency="USD">-2.32</Amount>
               </Component>
           </Promotion>
       </Item>
   </OrderReport>
</Orders>

I want to get to:
<?xml version="1.0" encoding="utf-8"?>
<Orders>
   <OrderReport>
       <shippingTotal>21.95</shippingTotal>
   </OrderReport>
   <OrderReport>
       <shippingTotal>0.00</shippingTotal>
   </OrderReport>
</Orders>

I'm having problems with the totaling the <Amount>'s where the <Type> =
Shipping.

Right now I'm getting the total of all the Amounts in the document.  Any
suggestions on this would be appreciated.




<Prev in Thread] Current Thread [Next in Thread>