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

Re: Formulas in XML values

  • From: COUTHURES Alain <alain.couthures@agencexml.com>
  • To: Michael Kay <mike@saxonica.com>, 'Kurt Cagle' <kurt.cagle@g...>, xml-dev@l...
  • Date: Fri, 26 Jun 2009 09:48:01 +0200

Re:  Formulas in XML values
Michael,
5CB9F5B20B44430ABA3C3433159847A5@Sealion" type="cite">
In fact, I'm more concerned with validation than evaluation. 
    
...
  
Wouldn't it be great if "1/3 + 2/3" was exactly like "1" ? As 
    

Then you seem to be very concerned with evaluation. There are languages that
perform rational arithmetic which would make this expression return the
integer 1, but XPath is certainly not one of them, and as far as I know
Javascript isn't either.

  
You're right saying that there can't be validation without evaluation.

For version 1, use of rational numbers would be "at-your-own-risks" and Javascript eval() function is enough for perfect results with +, - and * operators and decimal numbers. The result will always be a decimal number. Evaluation version 1 is already available with Javascript.

For version 2, rational numbers could be added. I have found Jasymca (http://webuser.hs-furtwangen.de/~dersch/jasymca2/index.html), written in Java for PDAs and it seems pretty fast and light :
                rat(3/5)+rat(1/3) gives 14/15 as answer !

I wouldn't say that XPath can't perform rational arithmetic but rather that rational arithmetic is not yet implemented for XPath. Benefits for scientists, financials,... Integrating this with XForms will permit users to set fields in web applications without a calculator always at hand.

For version 1 and version 2, validation has to start with evaluation which wasn't required before. So, validation has to be modified. The same for XPath which has to evaluate node content before using it.

Does it still sound like an impossible feature ?

Best regards,

Alain Couthures
<agenceXML>
http://www.agencexml.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.