W3C home > Mailing lists > Public > public-forms@w3.org > November 2008

boolean-from-string() and XPath 2.0

From: John Boyer <boyerj@ca.ibm.com>
Date: Mon, 17 Nov 2008 15:02:42 -0800
To: public-forms@w3.org
Message-ID: <OFBEC4701A.DF0450D6-ON88257504.007D41BA-88257504.007E98D6@ca.ibm.com>
Can someone point out where in the XPath 2.0 spec does it say that a set 
of items (e.g. a nodeset) can evaluate to false if the set of items 
contains one node whose content is falsey?

In [1], the working group decided that future versions of XForms would 
allow boolean MIPs to "treat a false string as false".

[1] 
http://lists.w3.org/Archives/Public/public-forms/2008Sep/att-0025/2008-09-10.html#resolution1

I would like to better understand, though, how this actually fixes the 
intended problem.  I think that the working group is saying that the 
result of the MIP is first converted to string, and then the string is 
converted to boolean, except that the *string* value of "false" is treated 
as a boolean false.

If we do not assume that the MIP result is converted to string, then the 
resolution [1] does not fix the problem at hand, which is that I want to 
have a data node like this:

<isManager>false<isManager>

and I want to have a MIP like this:

relevant="isManager"

The node isManager exists, regardless of its value, and so direct 
application of the boolean function produces a result of true just based 
on the existence of the node.

But if the MIP is converted to string before being handled as described in 
[1], then the above MIP works the way I expect.

Yet, the problem we have is that if the above is accurate, then we've 
really just come up with another way of saying that we apply 
boolean-from-string() to the MIP.  And in that case, I think it is better 
to describe it that way because then we have consistency with how I might 
describe the negation case.

For example, suppose instead of using relevance to restrict access to some 
data, I use readonly.  I would be inclined to write this:

readonly="not(isManager)"

But we know that won't work, and we will have to explain why not.  When we 
do, the fix will be to write this:

readonly="not(boolean-from-string(isManager))"

Thanks,
John M. Boyer, Ph.D.
STSM, Interactive Documents and Web 2.0 Applications
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: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
Received on Monday, 17 November 2008 23:03:31 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 October 2013 22:06:49 UTC