## [saxon] Using functions in a universal quantification

 [saxon] Using functions in a universal quantification From: Roger L. Costello - 2004-01-23 18:33:49 ```Hi Folks, Consider this instance document: 10 20 30 10 30 20 I would like to ensure that in every group-of-field, field2 equals field3. Sounds like a perfect use for universal quantification: every \$i in //set3/group-of-fields satisfies (string(\$i/field2) eq string(\$i/field3)) However, for some instance documents field2 and/or field3 may not exist, so I need a three-valued logic. Thus, I created an eq3 function: And now I change my universal quantification expression to invoke this function: every \$i in //set3/group-of-fields satisfies (ex:eq3(string(\$i/field2), string(\$i/field3))) For the above instance document I expect this universal quantification expression to evaluate to false. Unfortunately, no matter what the instance document is, it always evaluates to true. Am I doing something wrong? I am using Saxon-7_8. /Roger ```

 [saxon] Using functions in a universal quantification From: Roger L. Costello - 2004-01-23 18:33:49 ```Hi Folks, Consider this instance document: 10 20 30 10 30 20 I would like to ensure that in every group-of-field, field2 equals field3. Sounds like a perfect use for universal quantification: every \$i in //set3/group-of-fields satisfies (string(\$i/field2) eq string(\$i/field3)) However, for some instance documents field2 and/or field3 may not exist, so I need a three-valued logic. Thus, I created an eq3 function: And now I change my universal quantification expression to invoke this function: every \$i in //set3/group-of-fields satisfies (ex:eq3(string(\$i/field2), string(\$i/field3))) For the above instance document I expect this universal quantification expression to evaluate to false. Unfortunately, no matter what the instance document is, it always evaluates to true. Am I doing something wrong? I am using Saxon-7_8. /Roger ```
 RE: [saxon] Using functions in a universal quantification From: Michael Kay - 2004-01-29 21:00:57 ```You would probably find this easier to debug if you declared some types on your function signatures. Type checking is your friend! is a text node containing the string "false", not the boolean false, and the effective boolean value of a text node is true, regardless of the node's contents. Use or to return a typed result from a function. Michael Kay > -----Original Message----- > From: saxon-help-admin@... > [mailto:saxon-help-admin@...] On Behalf Of > Roger L. Costello > Sent: 23 January 2004 18:34 > To: saxon-help@... > Subject: [saxon] Using functions in a universal quantification > > > Hi Folks, > > Consider this instance document: > > > > > > 10 > 20 > 30 > > > 10 > 30 > 20 > > > > > I would like to ensure that in every group-of-field, field2 > equals field3. Sounds like a perfect use for universal > quantification: > > every \$i in //set3/group-of-fields satisfies > (string(\$i/field2) eq string(\$i/field3)) > > However, for some instance documents field2 and/or field3 may > not exist, so I need a three-valued logic. Thus, I created > an eq3 function: > > > > > > > > > > > > > > > > > > > And now I change my universal quantification expression to invoke this > function: > > every \$i in //set3/group-of-fields satisfies > (ex:eq3(string(\$i/field2), string(\$i/field3))) > > For the above instance document I expect this universal > quantification expression to evaluate to false. > Unfortunately, no matter what the instance document is, it > always evaluates to true. Am I doing something wrong? I am > using Saxon-7_8. /Roger > > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, > CA. http://www.eclipsecon.org/osdn > _______________________________________________ > saxon-help mailing list > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/s>; axon-help > ```