Use of XQuery boolean function in XML
In this article, i will go to explain about boolean function in XQuery.
Boolean Function
The fn:boolean function calculates the effective boolean value of sequence. It has a argument-
Syntax of boolean function
fn:boolean($arg as item()*) as xs:boolean
|
-
If $args has no value then, it returns false.
-
If $args is a sequence whose first item is node then, it returns true.
-
If $args is a single value of type xs:boolean is false then, it returns false otherwise it returns true.
-
If $args is a single value of type xs:string or xdt:untypedAtomic ; length value is zero then, it returns false and if value is greater then zero then, it returns true.
-
If $args is a single value of any numeric type value is zero or NaN then, it returns false otherwise returns true.
-
If $args have any other cases then, it raises a error.
Example of boolean function
let $xyz := ("x","y","z")
fn:boolean($xyz) raises a error
fn:boolean($xyz[1]) returns true.
fn:boolean($xyz[0]) returns false.
fn:boolean($xyz[4]) returns false.
|
Further Readings
You may also want to read these related articles:
Ask Your Question
Got a programming related question? You may want to post your question here