Booleans

Previous Next

USoft Blend  >  Expressions  >  XPath  >  Booleans

 

Boolean is one of the (4) primitive data types that an XPath expression can evaluate to. There is no XPath syntax for representing boolean values directly, but Boolean values are returned by the XPath functions of true() and false().

"Flag-based" string-to-boolean conversion

USoft Blend applies implicit data type conversion rules between the 4 XPath data types (nodeset, string, number, boolean) in the same way as XPath 1.0 and XSLT 1.0. In the case of booleans, USoft Blend offers an alternative string-to-boolean conversion mechanism referred to as "flag-based". "Flag-based" interprets the following strings (case-insensitively) as true():

true

yes

 

and the following string (case-insensitively) as false():

false

no

 

This contrast with XPath's implicit conversion rule that non-empty strings always evaluate to true().

"Flag-based" string-to-boolean conversion is not the default: you must switch it on explicitly. For details, see the pc:assign-boolean help topic.

You can execute "flag-based" string-to-boolean conversion explicitly by calling the booleanflags:ToBoolean function.

You can extend the list of string that "flag-based" conversion interprets as false(). For details, see the following topics:

booleanflags:Show

pc:define-boolean-flags

 

See also

Guide to expressions and data types

          Literal expressions

                 Dates

                 string literals

          Path expressions

          XML expressions

          XPath expressions

                 Node set expressions

                 Booleans

                 Strings

                 Numbers

                 Function calls

                 Variable references

                 Implicit XPath data type conversion

                 Evaluated expressions vs. literals

          SQL expressions