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

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: Graydon <graydon@xxxxxxxxx>
Date: Sat, 19 Nov 2011 16:36:17 -0500

On Sat, Nov 19, 2011 at 04:21:38PM -0500, Graydon Saunders scripsit:
> 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

div! div!

floor(CatNumber/@scott-number div 100) * 100

Sorry about that; you won't like what the slash does.

-- Graydon


Current Thread
Keywords