boolean
The effective boolean value of a sequence
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.
Parameters |
Description |
|---|---|
arg:boolean() |
the sequence whose effective boolean value is returned |
Examples
The examples below use this input document:
<xsl:variable name="ordDoc" select="doc('http://www.functx.com/input/order.xml')"/>
<!-- content of order.xml -->
<order num="00299432" date="2006-09-15" cust="0221A">
<item dept="WMN" num="557" quantity="1" color="beige"/>
<item dept="ACC" num="563" quantity="1"/>
<item dept="ACC" num="443" quantity="2"/>
<item dept="MEN" num="784" quantity="1" color="blue/white"/>
<item dept="MEN" num="784" quantity="1" color="blue/red"/>
<item dept="WMN" num="557" quantity="1" color="sage"/>
</order>
XPath |
Results |
|---|---|
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 |