I want to ask how to get total amount if we use substring function,
for example I have this xml,
<document>
<line id="0">
<field id="0"><![CDATA[AAAddd17aaass]]></field>
</line>
<line id="1">
<field id="0"><![CDATA[DDDaaa33sssaa]]></field>
</line>
</document>
I should sum(substring(field[@id=’0′], 7,2)). Then I try to do that, I get this error message: Current Item is ‘NaN of type xs:string. (I try to use number function but it doesn’t help)
Please advice me how to solve it.
In XSLT 1.0 if you don’t want to write recursive templates yourself, you can use the
transform-and-sumtemplate from FXSL.See how to use it here.
Here is the full transformation:
when applied on the provided XML document:
the wanted, correct result is produced: