[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Establishing the floor of a range a number belongs
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|