xslt - xsl:call-template: return a number rather than text to be assigned to a variable -


i'm having (minor) problem here. i'm calling named template , assigning outcome variable. so good, need type of processed template's return value integer rather text.

i wonder if there's way achieve without having go temporary variable?

here's sample code:

<xsl:variable name="tmp">     <xsl:call-template name="mytemplate">         <xsl:with-param name="x" select="123"/>     </xsl:call-template> </xsl:variable>  <xsl:variable name="myvar" select="number($tmp)"/>  <xsl:template name="mytemplate">     <xsl:param name="x"/>     <xsl:value-of select="$x"/> </xsl:template> 

don't mind code oversimplification of template does. notice i've tried return <xsl:value-of select="number($x)"/> no avail.

any heavily appreciated. tia

first, $tmp data type result tree fragment. so, besides copying, in allowed operations $tmp, counts string value.

xpath have many rules implicit casting. in general, whenever operator or function takes number data type argument, expression cast number number() function.

bottom line: in every case don't need explicit casting.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -