I would like to sum some values using XSLt V 1.0 but they are treated as strings. A sample of the xml is below as is my sample xslt. Should I change the data type in the underlying SQL view? I have tried various number data types but I need to retain the decimal or money format as this is supposed to be a total of dollars. Is there a way of using perhaps a variable in XSLT that will allow me to cast this string as a number? I have tried to convert using number() but I still get NaN. Don't know too much about xslt and would be very grateful for any help or if you can point me to relevant resource.
<?xml version="1.0" encoding="utf-8"?>
<xml>
<object>
<objectid>183382</objectid>
<objectnumber>Test00001237</objectnumber>
<lccs>
<lcc>
<groupname>Costs: Acquisition planning</groupname>
<userfieldgroupid>9</userfieldgroupid>
<userfieldname>Concept development hours</userfieldname>
<userfieldid>42</userfieldid>
<fieldvalue>1</fieldvalue>
<depreciationlife>25</depreciationlife>
<costs>46</costs>
</lcc>
<lcc>
<groupname>Costs: Acquisition planning</groupname>
<userfieldgroupid>9</userfieldgroupid>
<userfieldname>Concept assessment hours</userfieldname>
<userfieldid>43</userfieldid>
<fieldvalue>.25</fieldvalue>
<depreciationlife>25</depreciationlife>
<costs>11.5</costs>
</lcc>
</lccs>
</object>
</xml>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:js="urn:custom-javascriptscript" exclude-result-prefixes="msxsl js">
<xsl:output method="html" omit-xml-declaration="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>
<xsl:template match="/xml/object">
<html>
<head>
</head>
<body>
<table>
<tr style="font-weight:bold" >
<td>Item</td>
<td>$</td>
</tr>
<xsl:for-each select="lccs/lcc">
<xsl:choose>
<xsl:when test="normalize-space(userfieldid)='42'">
<tr>
<td>
<xsl:value-of select="normalize-space(fieldvalue)"/>
</td>
<td>
<xsl:value-of select="normalize-space(number(costs))"/>
</td>
</tr>
</xsl:when>
<xsl:when test="normalize-space(userfieldid)='43'">
<tr>
<td>
<xsl:value-of select="normalize-space(fieldvalue)"/>
</td>
<td>
<xsl:value-of select="normalize-space(number(costs))"/>
</td>
</tr>
<tr>
<td>Subtotal</td>
<td><xsl:value-of select="sum(//costs)"/></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>