Re: [xsl] xml to xml transformation

Subject: Re: [xsl] xml to xml transformation
From: "karan bhasin" <jusky@xxxxxxxxxxxxx>
Date: Fri, 16 May 2003 02:04:59 +0530
 <Log>
<Entity>
  <EntityName>Michigan</EntityName>
  <Batch>
   <TotalAmount>10</TotalAmount>
  </Batch>
  <Batch>
   <TotalAmount>20</TotalAmount>
  </Batch>
  <Entity>
   <EntityName>Detroit</EntityName>
   <Batch>
    <TotalAmount>30</TotalAmount>
   </Batch>
   <Batch>
    <TotalAmount>40</TotalAmount>
   </Batch>
  </Entity>
  <Entity>
   <EntityName>Kalamazoo</EntityName>
   <Batch>
    <TotalAmount>50</TotalAmount>
   </Batch>
   <Batch>
    <TotalAmount>60</TotalAmount>
   </Batch>
  </Entity>
 </Entity>
</Loop>

I have a XML which has the structure as follows:
Each Entity Element contains 'EntityName' Element, and one or more Batch Elements. Further it may contain several other Entity Elements.
My problem is that I want to Sum the total of all the Batches belonging to each Entity(including its Sub-Entities). For Example, Michigan should give me a result of (10+20+30+40+50+60), Detroit should give a sum of (3=+40). The XML is being generated dynamically, so i dont know how many Entity elements each Entity may contain, and i want to find the sum for all the Batches(Batches/TotalAmount), including those in the Entitiey elements any deep. Any ideas how chould I go about it. In a programming world, this would be achieved through recursive functions. How Would I do this in XSLt.
Thanks in advance.
Jaskaran


____________________________________________________________
Get 25MB of email storage with Lycos Mail Plus!
Sign up today -- http://www.mail.lycos.com/brandPage.shtml?pageId=plus 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread