Hello, I have some output from 3rd party software:
Sample XML from the software:
<testsuite name="XYZ">
<testcase name="ABC" status="0" time="12.001">Some stuff</testcase>
<testcase name="DEF" status="0" time="12,345.001">Some stuff</testcase>
<testcase name="GHI" status="0" time="4,321.001">Some stuff</testcase>
</testsuite>
I need to write an XSLT that transforms this into the following:
<testsuite name="XYZ" time="16678.003">
<testcase name="ABC" time="12.001">Some stuff</testcase>
<testcase name="DEF" time="12,345.001">Some stuff</testcase>
<testcase name="GHI" time="4,321.001">Some stuff</testcase>
</testsuite>
And I have almost got there, with the exception of the time attribute of the testsuite element. Instead of getting the total, I am getting NaN. The XPath expression I am using to get this is sum(//testsuite/@time)
Note that the error does not occur when there all the times are < 1000. This is probably because XSLT doesn't parse the number when it encounters commas. (I cannot get rid of these commas from the input because it comes from 3rd party software.)
So how do I sum these values for time? Is there away to modify sum(//testsuite/@time) such that it is able to strip commas on the fly?
Thanks!