Boolean Functions
The Boolean functions are few in number and quite
straightforward. They all return a Boolean that has the value true
or false. The true() function always returns true. The false( ) function always returns false. These substitute for
Boolean literals in XPath.
The not( ) function reverses the sense of its Boolean argument.
For example, not(@val>400) is
almost always equivalent to (@val<=400). (NaN is a special
case.)
The boolean() function converts its single argument to a Boolean
and returns the result. If the argument is omitted, then it converts
the context node. Numbers are converted to false if they’re zero or
NaN. All other numbers are true. Node-sets are false if they’re
empty and true if they contain at least one node. Strings are false
if they have zero length, otherwise they’re true. Note that
according to this rule, the string "false" is in fact true.