0

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!

0

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 - https://stackoverflow.com/questions/1846850/sum-contents-of-column-based-on-a-variable-with-xpath - which may help you to refine the formula.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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