This is akin to this question but I couldn't get the suggested sumAll
function to work. I also have several different columns to sum and it just seems silly to have a separate template for each column I want to sum. I have a column where not all rows have a value. I want to sum the rows that do have values. I have tried the following:
<xsl:value-of select="sum($nodeset/@MyField[string-length(@MyField) > 0])" />
This seems like it should work. However, I get 0 as the total. The very same data view shows individual rows below the total with values like 300, 160, etc., so 0 is obviously an incorrect total. I have tried wrapping @MyField
in number()
, but I end up getting NaN
as the total then. All the examples I've seen online talk about translate()
and dealing with British-style decimals, but I'm working with American-style decimals and I don't see any individual values with commas.
How can I sum this column?