|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Grouping & summing
Search the archives of this list (http://www.biglist.com/lists/xsl-list/archives/) or Google for "Muenchian method".
--
Charles Knell
cknell@xxxxxxxxxx - email
-----Original Message-----
From: Martin K. Borgars <martin.borgars@xxxxxxxxxxxxxxx>
Sent: Fri, 18 Jun 2004 12:27:52 +0100
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Grouping & summing
I have a piece of XML which looks like this: -
<application>
<personal_client id="pc1">
<full_name>Mr Test9</full_name>
</personal_client>
<personal_client id="pc2">
<full_name>Mrs Test9</full_name>
</personal_client>
<product>
<risk_benefit id="rb1" type="Permanent Health Insurance">
<risk_cover>
<life_assured personal_client_id="pc1"/>
</risk_cover>
<tpsdata>
<provider_component>
<calculated_sa>600</calculated_sa>
</provider_component>
</tpsdata>
</risk_benefit>
<risk_benefit id="rb2" type="Permanent Health Insurance">
<risk_cover>
<life_assured personal_client_id="pc1"/>
<life_assured personal_client_id="pc2"/>
</risk_cover>
<tpsdata>
<provider_component>
<calculated_sa>800</calculated_sa>
</provider_component>
</tpsdata>
</risk_benefit>
<risk_benefit id="rb3" type="Permanent Health Insurance">
<risk_cover>
<life_assured personal_client_id="pc1"/>
</risk_cover>
<tpsdata>
<provider_component>
<calculated_sa>1000</calculated_sa>
</provider_component>
</tpsdata>
</risk_benefit>
<risk_benefit id="rb4" type="Life And Health">
<risk_cover>
<life_assured personal_client_id="pc2"/>
</risk_cover>
<tpsdata>
<provider_component>
<calculated_sa>900</calculated_sa>
</provider_component>
</tpsdata>
</risk_benefit>
</product>
</application>
In my XSL, I want to sum the 'calculated_sa' for each
'life_assured[personal_client_id]' grouped by 'risk_benefit[type]'. If there
is more than 1 'life_assured[personal_client_id]' associated with a
'risk_benefit' then the 'calculated_sa' should be included for each
'life_assured[personal_client_id]'.
So, in this example I want to end up with something like this
life_assured[personal_client_id="pc1"] risk_benefit[type="Permanent Health
Insurance"] Total Sum Assured = 2400 (i.e. 600 + 800 + 1000)
life_assured[personal_client_id="pc2"] risk_benefit[type="Permanent Health
Insurance"] Total Sum Assured = 800
life_assured[personal_client_id="pc2"] risk_benefit[type=" Life And Health
"] Total Sum Assured = 900
Any suggestions with suitable XPATH or XSL would be greatly appreciated.
Many thanks
Martin K. Borgars
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








