I am attempting to sum up positive and negative values separately in XSL v1.0.I have XML like this:\[code\]<Billing_Statements> <Statement_Details> <Invoice_Details> <Meter_Details> <Consumption>XX</Consumption> </Meter_Details> <Meter_Details> <Consumption>XX</Consumption> </Meter_Details> </Invoice_Details> <Invoice_Details> <Meter_Details> <Consumption>XX</Consumption> </Meter_Details> <Meter_Details> <Consumption>XX</Consumption> </Meter_Details> </Invoice_Details> </Statement_Details></Billing_Statements>\[/code\]Where XX can be a positive or a negative value.I need to output first the sum of the positive values and then the sum of the negative values for all Invoice_Detail nodes for each Statement_Details.At the moment I have tried:\[code\]<xsl:value-of select="sum(Invoice_Details/Meter_Details[Consumption < 0])" />\[/code\]and many variations of this and they all return a sum of \[code\]0\[/code\] no matter what.When collecting all the other information from the Meter_Details nodes my for-each section works perfectly as this:\[code\]<xsl:for-each select="Invoice_Details/Meter_Details[Consumption < 0]">\[/code\]And selects only nodes with negative or positive values. Why does this not work for the sum()?I'm certainly struggling with XSL here and would love any help I can get.