Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm having a little trouble with some syntax for my xslt statement on a custom sharepoint page, any help would be much appricated.

I've summed a column from a list and it displays correctly (code below):

<xsl:value-of select="format-number(sum(dsQueryResponse/Rows/Row/@Capex), '$#,##0.00;-$#,##0.00')" />

However what won't work is when I try to apply a condition to the summed column. For example I am trying to Sum only where projects are still active. I have the code below, and would appricate any thoughts to get it working.

<xsl:value-of select="sum(/dsQueryResponse/Rows/Row[(@Capex) and (@ProjectStatus)='Active'])" />

The result of the above is NaN, so assume I need to do some formatting of the non-numeric section, I just haven't been able to get that working. Help!

share|improve this question
add comment

1 Answer 1

I think you need to define the filter after the sum element. Something like:

<xsl:value-of select="sum(/dsQueryResponse/Rows/Row/@Capex[@ProjectStatus='Active'])" />

There are some more examples here - http://stackoverflow.com/questions/1846850/sum-contents-of-column-based-on-a-variable-with-xpath - which may help you to refine the formula.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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