I am using an IE control in a database application to render a data view within the application. The underlying data source is SQL and the costs data type is decimal.
I expect to see a subtotal of 92, ie the sum of all costs in the userfieldgroupid = 9. Instead I get:Result -Item $1.5 690.5 23Subtotal 69 23I suspect the issues is with the xpath and that my result is the individual costs summed with themselves. If I use <xsl:value-of select="sum(../../*/*/costs)" />I get:Result -Item $1.5 690.5 23Subtotal NaN NaN
If I just use <xsl:value-of select='format-number(costs, "###,###.00")' /> directly on costs I get the numbers, but not summed! so back to where I started.
Result-
Item $
1.5 69
0.5 23
Subtotal 69.00 23.00
I have searched and tried so many examples but can't work this out so I would be very grateful for any help you can give me.
xslt sum and xpath
in XSLT/XSL-FO
Posted
I am trying to sum the costs values in this sample xml using the xslt below.
Sample xml:
Sample xslt:
I am using an IE control in a database application to render a data view within the application. The underlying data source is SQL and the costs data type is decimal.
I expect to see a subtotal of 92, ie the sum of all costs in the userfieldgroupid = 9. Instead I get:Result -Item $1.5 690.5 23Subtotal 69 23I suspect the issues is with the xpath and that my result is the individual costs summed with themselves. If I use <xsl:value-of select="sum(../../*/*/costs)" />I get:Result -Item $1.5 690.5 23Subtotal NaN NaN
If I just use <xsl:value-of select='format-number(costs, "###,###.00")' /> directly on costs I get the numbers, but not summed! so back to where I started.
Result-
Item $
1.5 69
0.5 23
Subtotal 69.00 23.00
I have searched and tried so many examples but can't work this out so I would be very grateful for any help you can give me.