fn:boolean

Computes the effective boolean value of the sequence $arg.

Signature

fn:boolean($arg as item()*) as xs:boolean

Rules

The function computes the effective boolean value of a sequence, defined according to the following rules. See also Effective Boolean Value.

Error Conditions

In all cases other than those listed above, fn:boolean raises a type error [ERRFORG0006].

Notes

The result of this function is not necessarily the same as $arg cast as xs:boolean. For example, fn:boolean("false") returns the value true whereas "false" cast as xs:boolean (which can also be written xs:boolean("false")) returns false.

Examples

let $abc := ("a", "b", "")

fn:boolean($abc) raises a type error [ERRFORG0006].

The expression fn:boolean($abc[1]) returns true().

The expression fn:boolean($abc[0]) returns false().

The expression fn:boolean($abc[3]) returns false().

fn:boolean([]) raises a type error [ERRFORG0006].