I have a DVWP that displays groups of data. For each group, I've got a sum of one of the columns. This sum exists in the group footer in a template called dvt_1.groupfooter0.

<xsl:variable name="mySum" select="sum($nodeset/@myQuantity)"/>

Is there any way to filter out groups depending on this sum (e.g. if the sum is negative). I don't think that the "XSLT Filter" for the DVWP will work, since it appears to filter prior to grouping...so this doesn't work:

[sum(@myQuantity) > 0]

The above discards individual rows for which myQuantity is negative.

Any suggestions?

1 Answer 1


You'd need to add the full XPath to the filter on the nodeset. Stuff like this is typically quite hard to do if you work directly with the XSL which SharePoint Designer generates.

Another way to do it is in the dvt_1.body template, doing the calculation to determine if you should call the rowview template.

Bottom line is that it's doable with XSL magic.


  • Thank you Marc. I will try this in the future. For this particular problem, I ended up just modifying my view in SQL Server. While I wish that things like this were easier to make happen in SPD + XSL, sometimes it just makes sense to do the heavy lifting on the back end.
    – Boden
    Commented Oct 25, 2010 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.