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

Subject: Re: [xsl] Establishing the floor of a range a number belongs to
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sat, 19 Nov 2011 15:05:06 -0700
The replace function worked beautifully. I never thought to use it because of my "in the box" thinking -- I was seeing numbers, not characters, and was looking for math functions. Thanks!
Mark


-----Original Message----- From: Graydon
Sent: Saturday, November 19, 2011 2:21 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Establishing the floor of a range a number belongs to


On Sat, Nov 19, 2011 at 02:03:25PM -0700, Mark scripsit:
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.
[snip, yeah, that is indeed painful]
What function or combination of functions do I need to accomplish my goal?

What's wrong with


replace(CatNumbers/@scott-number,'\d\d$','00')

Which will replace the last two digits with zeros?

Alternatively,

floor(CatNumbers/@scott-number / 100) * 100

ought to do it.

-- Graydon

Current Thread