Combining two variables in xslt (not numeric and / or numeric)

I have two variables in xslt, I can not add them and assign them to another variable, Any help would be appreciated.

<xsl:variable name="Book" select="hummpty" /> <xsl:variable name="Book1" select="andro" /> <xsl:variable name="Total"> <xsl:value-of select="$Book + $Book1/> </xsl:variable> 

When I try to print "Total", I get the value as NaN. How do I achieve this? Having achieved this, I would like to assign it as an attribute value. eg:

 <Book totakBook="$Total" /> 

Something like the above. Any help was appreciated.

+4
source share
2 answers

If you really want to concatenate string values, try the following:

 <xsl:value-of select="concat($Book, $Book1)" /> 
+18
source

try it

  <xsl:value-of select="sum($Book + $Book1)"/> 

if both variables contain valid numeric values.

0
source

All Articles