Description
The fn:boolean function calculates the effective boolean value of a sequence. In most cases it is unnecessary to call this function because the effective boolean value is calculated automatically in many expressions, including conditional and logical expressions, where clauses, and predicates.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type |
$arg |
item()* |
return value |
xs:boolean |
Exampleslet $ordDoc := | doc('https://www.datypic.com/functx./input/order.xml') | return |
XQuery Example | Results |
---|
boolean( () ) |
false |
boolean('') |
false |
boolean(0) |
false |
boolean('0') |
true |
boolean('false') |
true |
boolean(xs:float('NaN')) |
false |
boolean((false(), false(), false())) |
Error FORG0006 |
boolean($ordDoc/order[1]) |
true |
boolean($ordDoc/noSuchChild) |
false |
boolean(<a>false</a>) |
true |
See AlsoHistory |
Recommended Reading:
|