The boolean() function you are using is indeed doing it's job. For using explicit true and false values you should use the following functions:
Just FYI, per the MSDN documentation, boolean() returns the following:
- 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.