I have an XML file where the number are comma-separated
<foo> <bar val='1,23'/> <bar val='4,56'/> <bar val='7,89'/> </foo>
I would like to make a sum over /foo/bar/@val values in XSLT, but I am a bit stuck the formatting. Does anyone knows what would be the proper syntax?
I am guessing, that the value specified in a
'val'attribute is a number that has comma instead of a decimal point.Several solutions are possible:
I. XSLT 1.0
This transformation:
when applied on the originally-provided XML document:
produces the wanted result:
II. XSLT 2.0
This transformation:
when applied on the same XML document, produces the same correct result:
13.68
III. FXSL 2.x
This transformation:
when applied on the same XML document produces the same correct result:
13.68
The last solution is more flexible and can be used successfully when a more complex transformation of the values is needed before summing.