xs:boolean

Converts a $string-var (a string) to a boolean value.

Signatures

xs:boolean(xs:string $string-var) —> xs:boolean

Arguments

Data Type
Argument
Description

xs:string

$string-var

Represents the string to convert to a boolean value

Returns

Returns the boolean value of the passed in string.

Examples

Simple

Invoking xs:boolean("false") returns the boolean value false, as shown in the following example query:

<result>{xs:boolean("false")}</result> 

The preceding query generates the following result:

<result>false</result> 

Numeric

Invoking xs:boolean("1") returns the boolean value true, as shown in the following example query:

<result>{xs:boolean("1")}</result> 

The preceding query generates the following result:

<result>true</result> 

Related Topics

W3C boolean function description