xsl-list
[Top] [All Lists]

Grouping elements and summing their attribute value into one single element

2005-03-24 03:53:50
Hello,

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

Here the XML :

<EinträgeListe>
        <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_MengeGezählt="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_MengeGezählt="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_MengeGezählt="42"/>
...
</EinträgeListe>

And my problem : Here we have three elements. Their attributes are all similar, 
except BZF_MengeGezählt (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_MengeGezählt 
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_MengeGezählt="142"/>

Any hint would be greatful.

Best regards, and happy easter ;-)

Lawrence Michel

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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