[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Grouping elements and summing their attribute value in

Subject: Grouping elements and summing their attribute value into one single element
From: <michella@xxxxxxx>
Date: Thu, 24 Mar 2005 11:53:50 +0100
grouping similar xml attribute value
Hello,

I'm currently having trouble choosing an efficient way to solve my problem :

Here the XML :

<EintrdgeListe>
	<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0811" BZ_DLA="B1" BZ_Format="NF"
BZ_Verarbeitung="Maschine" BZ_Bundart="999" BZF_Ankunftsdatum="20050211"
BZF_Zeit="1442" BZF_Zustelldatum="20050211" BZF_MengeGezdhlt="58"/>
	<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0835" BZ_DLA="B1" BZ_Format="NF"
BZ_Verarbeitung="Maschine" BZ_Bundart="999" BZF_Ankunftsdatum="20050211"
BZF_Zeit="1442" BZF_Zustelldatum="20050211" BZF_MengeGezdhlt="47"/>
	<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0847" BZ_DLA="B1" BZ_Format="NF"
BZ_Verarbeitung="Maschine" BZ_Bundart="999" BZF_Ankunftsdatum="20050211"
BZF_Zeit="1442" BZF_Zustelldatum="20050211" BZF_MengeGezdhlt="42"/>
...
</EintrdgeListe>

And my problem : Here we have three elements. Their attributes are all
similar, except BZF_MengeGezdhlt (the data) and BZF_Zeit , which is the time
where this data was created. (0835 means 08.35 am.)
Now, I have to compare these datas with other ones, but this comparison
process is only done in segments of round hours (e.g. 08.00 o'clock is all
summed element values between 0800 and 0859).
In the XML sample here, we have three elements that fit the selection criteria
(they have been all created between 0800 and 0859). I must create one single
element (with same caracteristics), but the end value of BZF_MengeGezdhlt
should be (58+47+42 = 147). Then the resulted element will be used for final
1-1 comparison.

==>  <Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0800" BZ_DLA="B1"
BZ_Format="NF" BZ_Verarbeitung="Maschine" BZ_Bundart="999"
BZF_Ankunftsdatum="20050211" BZF_Zeit="1442" BZF_Zustelldatum="20050211"
BZF_MengeGezdhlt="142"/>

Any hint would be greatful.

Best regards, and happy easter ;-)

Lawrence Michel

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.