[xsl] Establishing the floor of a range a number belongs to

Subject: [xsl] Establishing the floor of a range a number belongs to
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sat, 19 Nov 2011 14:03:25 -0700
I am parsing around 3500 numbers and want to be able to establish the floor of the range each number belongs to. For instance, 326 belongs to the range "300-399" and its floor is "300", the value I want. Another example would be 1627, whose range is 1600-1699 and whose floor is 1600. I failed to find the right combination of XPath math functions [mode(), floor()], etc., to do this.

The brute force method of:
<xsl:choose>
   <xsl:when test="number(CatNumbers/@scott-number) lt 1900 ">
       <xsl:value-of select="'1800'"/>
   </xsl:when>
   <xsl:when test="number(CatNumbers/@scott-number) lt 2000 ">
       <xsl:value-of select="'1900'"/>
   </xsl:when>

and so on, seems much too clumsy and repetitive.

What function or combination of functions do I need to accomplish my goal?

Thanks,
Mark


Current Thread