[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Finding Even and odd in xslt

Subject: [xsl] Finding Even and odd in xslt
From: "Kapur, Rajneesh" <Rajneesh.Kapur@xxxxxxxxxxx>
Date: Fri, 28 Jan 2005 16:31:43 -0500

	I want to test whether a number is even or odd. Therefore I have the
following code.

<xsl:variable name="namePadding">9</xsl:variable>
<xsl:variable name="modulas" expr="$namePadding mod 2"/>

		<xsl:when test="$modulas=number(1)">
			<xsl:variable name="toss">1</xsl:variable>
			<xsl:variable name="toss">0</xsl:variable>

	<xsl:value-of select="$toss"/>

But when I print out the value of $toss then processor complains that "toss"
is not defined.

Thanks in advance,

Current Thread