W3C home > Mailing lists > Public > public-forms@w3.org > December 2007

A decimal-string() function proposed for XForms 1.2

From: John Boyer <boyerj@ca.ibm.com>
Date: Wed, 12 Dec 2007 11:31:12 -0800
To: Forms WG (new) <public-forms@w3.org>
Message-ID: <OF46A5E9A6.A8D8557B-ON882573AF.0069C80C-882573AF.006B399A@ca.ibm.com>
Hello all,

One of the small features I proposed for 1.2 is a decimal-string() 
function that can convert an XPath 1.0 number to a lexical string 
representation that is desired by financial industry application 
developers.  Nick comments that we'll get this in XForms 2.0 when we have 
XPath 2.0.  For my own part, I wouldn't want to wait that long for XForms 
to 'officially' support financial applications.

I think it is not hard to have a function that receives a number and an 
indication of how many places past the decimal point it should be rounded 
to obtain a string output.  The only extra bell/whistle would be to 
indicate whether or not zero padding is desired, which is often done with 
a negative sign or some such.

The lion's share of usage will be of the form 
decimal-string('12.300000002', -2) to get a guarantee of two decimal 
places, with zero padding if needed. The output in this example would be 
the string '12.30'.

Right now, the numeric results of calculations come out to irritating 
values when converted to lexical representation for storage in XML, and it 
becomes necessary to write code on the server side to fix this stuff up 
before it goes into a database.  I do have actual customers now for whom I 
am currently having to add an extension function because the XML data we 
send chokes their database, and they don't want to add code, esp. since it 
is contrary to our "killer app" messaging.

Now that there is some discussion on it, it seems worth breaking out into 
a thread of its own to see if

A) there are any other objections
B) to see if I've managed to convince Nick yet :-)

John M. Boyer, Ph.D.
Senior Technical Staff Member
Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
Received on Wednesday, 12 December 2007 19:31:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:48:27 UTC