xsl-list
[Top] [All Lists]

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

2011-11-19 16:05:23
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(_at_)lists(_dot_)mulberrytech(_dot_)com
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

--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--