home contribute faq download

FunctX XQuery Functions

fn:boolean

The effective boolean value of a sequence

Google
Webdatypic.com

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 Type

NameType
$arg item()*
return value xs:boolean

Examples

let $ordDoc :=
doc('https://www.datypic.com/functx./input/order.xml')
return
XQuery ExampleResults
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 Also

fn:trueThe boolean value true
fn:falseThe boolean value false
fn:notNegates a boolean value
fn:existsWhether an argument is the empty sequence
fn:emptyWhether a value is the empty sequence

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XQuery Services

Recommended Reading:

XQuery