xsl-list
[Top] [All Lists]

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

2011-11-19 15:03:40
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--