This topic describes how Boolean functions work in XPath functions in the Expression editor.
Using Boolean elements in XPath functions
XPaths that select element values always return strings, even if the XSD data type is Boolean. If you use elements with an XSD boolean type in an XPath expression, you must be aware of how the Boolean type is treated in XPath.
When an element is evaluated for use as a Boolean argument, it is first converted to a Boolean according to the following rules:
Number 0 converts to Boolean false, all other numbers convert to Boolean true.
String 0 length converts to Boolean false, all other strings convert to Boolean true.
Boolean value is unchanged.
Node-set empty node set converts to Boolean false, all others convert to Boolean true.
Examples:
Given the boolean element, <BooleanIn>true</BooleanIn>, using the not(BooleanIn) XPath results in true being returned. This is because the node value is treated as the string true with length is > 0 and is, therefore, true.
Given <BooleanIn>false</BooleanIn>, not(BooleanIn) also returns true.
These conditions apply to the XPath and, or, and not functions.
Using Boolean expressions in XPath functions
When an extension function requires a Boolean argument, use the XPath functions true() or false().
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com