Use Muenchian grouping, see
http://www.jenitennison.com/xslt/gro...muenchian.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="k1" match="Line" use="concat(Attribute1, '|', Attribute2, '|', Attribute3)"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Line[generate-id() = generate-id(key('k1', concat(Attribute1, '|', Attribute2, '|', Attribute3))[1])]">
<xsl:copy>
<xsl:copy-of select="*[not(self::Value)]"/>
<Value><xsl:value-of select="sum(key('k1', concat(Attribute1, '|', Attribute2, '|', Attribute3))/Value)"/></Value>
</xsl:copy>
</xsl:template>
<xsl:template match="Line[not(generate-id() = generate-id(key('k1', concat(Attribute1, '|', Attribute2, '|', Attribute3))[1]))]"/>
</xsl:stylesheet>