__________
New Member
I've got some XML as follows;\[code\]<risk> <driver driverId="2"> <vehicleUse>M</vehicleUse> </driver> <driver driverId="3"> <vehicleUse>F</vehicleUse> </driver> <driver driverId="4"> <vehicleUse>I</vehicleUse> </driver></risk>\[/code\]I am using XSLT (v1.0, .NET implementation) to translate each vehicleUse into a number, and then get the total of those numbers. The vehicleUses are translated as M=3, F=2 and I=1. An added complexity is that for the driver with an ID of 3, those values are multiplied by 10, and for driver 4 by 100. So in the example above the total would be 3 + 20 + 100 = 123.I've defined a template in my XSLT file like this;\[code\]<xsl:template name="getVehicleUseScore"> <xslaram name="driverId" /> <xslaram name="vehicleUse" /> <!-- Implementation left out for brevity --></xsl:template>\[/code\]The remainder of the XSLT file then calls the template;\[code\]<xsl:template match="risk"> <vehicleUseScore> <xsl:for-each select="driver"> <xsl:call-template name="getVehicleUseScore"> <xsl:with-param name="driverId" select="@driverId" /> <xsl:with-param name="vehicleUse" select="vehicleUse" /> </xsl:call-template> </xsl:for-each> </vehicleUseScore></xsl:template><xsl:template match="/"> <xsl:apply-templates /></xsl:template>\[/code\]The result is that I get the text "320100" which is just 3, 20 and 100 concatenated together, which does at least prove that the getVehicleUseScore template works.I'd like to pass the results of getVehicleUseScore into the sum() function but I don't know how. I tried the following;\[code\]<xsl:value-of select="sum(getVehicleUseScore(@driverId, vehicleUse)" />\[/code\]But the XSLT compiler states "getVehicleUseScore() is an unknown XSLT function".Is there any way to do this?