The XPath Boolean Functions

XPath also supports the following set of Boolean functions:

  • boolean(). Converts its argument to a Boolean value.

  • false(). Returns a value of false.

  • lang(). Tests whether the language set with the xml:lang attribute is the same as the language passed to this function.

  • not(). Reverses the true.false value of its argument.

  • true(). Returns a value of true.

boolean()

The boolean function converts its argument to a Boolean value. Here’s how you use this function:

boolean boolean(object) 

Here’s what happens when you pass this function arguments of various XPath types:

  • number. If the number is zero, the result is false; otherwise the result is true. NaN always returns false.

  • string. If the string is not empty, the result ...

Get Inside XSLT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.