[xsl] Cannot get numeric value - what am I doing wrong?

Subject: [xsl] Cannot get numeric value - what am I doing wrong?
From: "Kyle Partridge" <kpartridge@xxxxxxxxxxxx>
Date: Thu, 18 Mar 2004 16:44:56 -0500
Hi all,

This is probably an easy question for you to answer, but I'm stumped.

I've got this variable I'm trying to assign a NUMERIC value to:

<xsl:variable name="top-remove">
	<xsl:choose>
		<xsl:when test="string($prior-break-regions)">
			<xsl:call-template name="add-up">
				<xsl:with-param name="set-one"
select="$prior-break-regions/@top"/>
				<xsl:with-param name="set-two"
select="$prior-break-regions/@height"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise><xsl:value-of
select="number('0')"/></xsl:otherwise>
	</xsl:choose>
</xsl:variable>

It calls a template, "add-up" which takes two sets of number node-sets
and adds them all together.  This, too, is supposed to return a NUMERIC
value:

<xsl:template name="add-up">
	<xsl:param name="set-one"/>
	<xsl:param name="set-two"/>
	<xsl:param name="index" select="1"/>
	<xsl:param name="total" select="0"/>
	<xsl:choose>
		<xsl:when test="$index &gt; count($set-one) or $index
&gt; count($set-two)">
			<xsl:value-of select="number($total)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:call-template name="add-up">
				<xsl:with-param name="set-one"
select="$set-one"/>
				<xsl:with-param name="set-two"
select="$set-two"/>
				<xsl:with-param name="total"
select="$total + $set-one[$index] + $set-two[$index]"/>
				<xsl:with-param name="index"
select="$index + 1"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

So...HOW COME I wind up with a Node-Fragment type assigned to my
variable, when all is said and done???  I need the value to be a numeric
value, so that when I test to see if it is boolean true or false, it
will react properly.

Thanks,
KP


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread