[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XPath / XSLT 2.1 - Rounding algorithms

Subject: RE: XPath / XSLT 2.1 - Rounding algorithms
From: "Rushforth, Peter" <prushfor@xxxxxxxxxxx>
Date: Fri, 14 Nov 2008 09:51:41 -0500
RE:  XPath / XSLT 2.1 - Rounding algorithms
Hi Michael,

> > round(3.065) returns 3. , whereas my need is for a function
> to return
> > 3.07 (say), something like this, say:
> >
> > round-half-up(3.065,2) -> 3.07
> > round-half-up(-3.065,2) -> -3.07
> You can always multiply by a hundred, round(), and then
> divide by a hundred.

Thanks for the algorithm, I'll try it out.

> I know it's tedious but there was a lot of feeling in the WG
> that we should have a library of a hundred functions rather
> than a thousand, if we were to have a reasonable prospect of
> making the spec implementable (not to mention the task of
> actually writing it and publishing it).

The round-half-to-even() function _is_ available, yet it's only part
of the standard, so it's an odd place to draw the line.

I understand the hesitation to increase the burden of implementation,
especially for open-source implementation providers.  Not being an
implementer, it's easy to talk, you might say.

But I also think that should be balanced against the barriers to entry
on the part of potential XSLT programmers.   Having to understand
functions and the limitations of what can be achieved
directly in XSLT / XPath takes time and raises the bar for potential
users. A certain 'core' set of math functions for XPath could be an
important addition - there are lots of mathematical uses for XSLT and

Having the ability to create one's own XPath functions was a fabulous
but it doesn't apply across languages dependant on XPath, the functions
must be
re-written in each language.  But here I'm just talking about one
and as far as I know it's not in either the EXSLT math library or
Dimitre's FXSL library.


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.