fn:boolean

Compute effective Boolean value of a sequence of items.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:boolean(item* $srcval) => boolean

Description

This function returns the effective Boolean value of a sequence of items. If the sequence is empty, the function returns "false". If $srcval is an atomic value, this function returns the same value as the constructor function xs:boolean. In the following cases the function returns "false":

  • The singleton Boolean value "false";

  • A singleton numeric value that is numerically equal to zero;

  • The empty string value "".

Argument

$srcval

any item

Example

boolean(24-24)
boolean("24-24")

The first query returns "false", since the argument is a numerical expression that evaluates to zero. In the second query the argument is a non-empty string value, and therefore the function returns "true".