xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Help with a Transform


Subject: [xsl] Help with a Transform
From: Brandon Schenz <brandons@xxxxxxxxxxxxxxxxx>
Date: Thu, 02 Sep 2004 16:12:56 -0400

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.


Current Thread
Keywords
xml
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor