Just use the usua; grouping techniques (eg keys as below) to group, and
then use sum() to sum all elements of a group.
eg
<?xml version="1.0" encoding="iso-8859-1"?>
<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"/>
...
<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0947" 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>
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:om="http://www.openmath.org/OpenMath"
version="1.0">
<xsl:output indent="yes"/>
<xsl:key name="e" match="Eintrag" use="substring(@BZ_Zeit,1,2)"/>
<xsl:template match="EinträgeListe">
<xsl:for-each
select="Eintrag[generate-id()=generate-id(key('e',substring(@BZ_Zeit,1,2)))]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="BZ_Zeit"><xsl:value-of
select="substring(@BZ_Zeit,1,2)"/>00</xsl:attribute>
<xsl:attribute name="BZF_MengeGezählt"><xsl:value-of
select="sum(key('e',substring(@BZ_Zeit,1,2))/@BZF_MengeGezählt)"/></xsl:attribute>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
$ saxon sum.xml sum.xsl
<?xml version="1.0" encoding="utf-8"?>
<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0800" BZ_DLA="B1" BZ_Format="NF" B
_Verarbeitung="Maschine" BZ_Bundart="999" BZF_Ankunftsdatum="20050211" BZF_Zeit
"1442" BZF_Zustelldatum="20050211" BZF_MengeGezÀñhlt="147"/>
<Eintrag BZ_Abgangsdatum="20050211" BZ_Zeit="0900" BZ_DLA="B1" BZ_Format="NF" B
_Verarbeitung="Maschine" BZ_Bundart="999" BZF_Ankunftsdatum="20050211" BZF_Zeit
"1442" BZF_Zustelldatum="20050211" BZF_MengeGezÀñhlt="42"/>
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--