Chapter 11 - XPath Data Types and Functions | |
XSLT For Dummies | |
by Richard Wagner | |
Hungry Minds 2002 |
The final major data type XSLT deals with is boolean, which is a simple binary state (true or false). The four built-in functions for boolean values are: not() , true() , false() , and boolean() . Returning the opposite valueTo return a value thats opposite from the one you have, you can use the not() function: boolean not(boolean) The following xsl:if instruction evaluates to true if the myvar variable is not true: <xsl:if test="not($myvar)"> This was not true. </xsl:if> Returning true and false valuesTo return a true value (no, not the hardware store), use the true() function: boolean true() To return a false value, use the false() function: boolean false() Converting to a booleanYou can convert a value to a boolean with the boolean() function. A string and node returns true when it is not empty, whereas a number is true if it is not equal to . The syntax is: boolean boolean(object)
|