I have a problem using sum() function in xslt 1.0. In short: I want to sum values in L_AMOUNT nodes.
This is my xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="XX_EXEC_PRINT_DOCUMENT.xsl"?>
<ROWSET>
<ROW>
<LINES>
<LINES_ROW>
<L_AMOUNT>330,00</L_AMOUNT>
</LINES_ROW>
<LINES_ROW>
<L_AMOUNT>995 650,00</L_AMOUNT>
</LINES_ROW>
</LINES>
</ROW>
</ROWSET>
And significant part of xsl file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="html"/>
<xsl:template match="*">
<html>
<body class="OraBody">
<xsl:value-of select="sum(translate(translate(ROW/LINES/*/L_AMOUNT,' ',''),',','.'))"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
As You can see i tried to trunctate all white spaces in between and replaced comma with dot. But then, firefox parser says that XPath expression should return NodeSet. Numbers returned by translate functions are values not nodes, so the error is obvious. But how can I do it then? I'm out of ideas...