Show TOC

Background documentationFunctions: Boolean Locate this document in the navigation structure

 

boolean(object)

Description: Returns a boolean value for a number, string, or node-set. This function converts arguments to booleans according to the following rules:

  • If the argument is a negative or positive number, it is converted to the boolean value true. If the argument is zero or an NaN value, it is converted to false.

  • If the argument is a non empty node-set, it is converted to true. An empty node-set is converted to false.

  • If the argument is a non-empty string, it is converted to true. An empty string is converted to false.

  • If the argument is an object of a type other than the four basic types, it is converted to a boolean in a way that is dependent on that type.

Samples:

  • boolean(0) = false

  • boolean(1) = true

  • boolean(-100) = true

  • boolean(100) = true

  • boolean(NaN) = false

  • boolean('hello') = true

  • boolean('') = false

not(boolean)

Description: Returns true if the argument is false; otherwise false.

Sample:

not(true) returns false

true()

Description: Returns true

lang(string)

Description: Returns true if the language of the current node matches the language of the specified language

Sample:

lang("en") is true for <p xml:lang="en”>...</p>

lang("de") is false for <p xml:lang="en”>...</p>

false()

Description: Returns false

equal(object, object)

Description: Returns true if argument 1 equals argument 2; otherwise false

Sample:

equal(1, 2) = false

equal-or-greater(number, number)

Description: Returns true if arg1 is equal to or greater than arg2, otherwise false.

Sample:

equal-or-greater(2, 2) = true

equal-or-less(number, number)

Description: Returns true if arg1 is equal to or less than arg2; otherwise false

Sample:

equal-or-less(1, 2) = true

greater(number, number)

Description: Returns true if arg1 is greater than arg2; otherwise false

Sample:

greater(1, 2) = false

less(number, number)

Description: Returns true if arg1 is less than arg2; otherwise false

Sample:

less(1, 2) = true

logical-and(boolean, boolean)

Description: Returns true if arg1 and arg2 are both true; otherwise false

Sample:

logical-and(true, true) = true

logical-or(boolean, boolean)

Description: Returns true if arg1 or arg2 is true, otherwise false.

Sample:

logical-or(true, false) = true