Re: Comment about telecon item 'We should automate boolean-from-string() on the boolean MIPs (relevant, readonly, constraint)'

Nick,

Good catch. Yes that is a positive aspect.

As a side note, and veering off-topic, an XForms implementation based  
on XPath 2.0 could also make great use of type annotations. Right now,  
if you write:

   <xf:bind nodeset="foo" type="xs:decimal"/>
   <xf:bind nodeset="bar" calculate="../foo div 2"/>

then the xs:decimal type is not used at all by the @calculate  
expression.

XPath 2.0 OTOH has a notion of "typed value", which is used in  
"Arithmetic expressions, Comparison expressions, Function calls and  
returns, Cast expressions". [1] So in the same way that a Schema-aware  
XSLT 2.0 implementation can use the type information, an XForms  
implementation could use it too. In the example above, ../foo will  
first be atomized to an xs:decimal value, as if you had written  
xs:decimal(../foo). This can be very powerful and avoid a lot of  
casting of numeric values and dates in particular.

-Erik

[1] http://www.w3.org/TR/xpath20/#id-atomization

On Sep 14, 2008, at 11:51 PM, Nick_Van_den_Bleeken@inventivegroup.com  
wrote:

>
> All,
>
> I think that the Resolution 2008-09-10.1'For future versions, we  
> change MIPs that accept boolean values to say that they use the  
> XPath boolean function to convert the value to boolean, except if  
> the value is the string "false" in which case we treat it as a  
> boolean false.' is a really good resolution if you look forward to  
> incorporating XPath 2.0 in XForms.
>
> If we incorporated XPath 2.0 we can say that the MIPs that are  
> candidates for accepting an xs:boolean  (readonly, required, valid)  
> expect an xs:boolean and then the casting from string to to a  
> boolean in XPath 2.0 will behave like 'Resolution 2008-09-10.1'  
> says. We should of corse change the wording from using the boolean  
> function for doing the conversion to using casting to do the  
> conversion. See [1] for the difference between fn:boolean and 'cast  
> as xs:boolean' in XPath 2.0
>
>
> Regards,
>
> Nick Van den Bleeken  -  Research & Development Manager
> Inventive Designers
> Phone: +32 - 3 - 8210170
> Fax: +32 - 3 - 8210171
> Email: Nick_Van_den_Bleeken@inventivegroup.com
>
> [1] http://www.w3.org/TR/xpath-functions/#func-boolean
> Inventive Designers' Email Disclaimer:
> http://www.inventivedesigners.com/email-disclaimer
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content, and is believed to be clean.
> -- 

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Tuesday, 16 September 2008 22:24:56 UTC