This section describes elements that serve as Boolean operators. These elements appear in the condition of an <if> step. Boolean operators can evaluate only to true or false.
This Boolean operator is used to determine whether a particular value is true. <istrue> contains a single attribute, value, and has no child elements. <istrue> evaluates to true if and only if value equals true. The comparison is case-insensitive.
The <istrue> operator has one required attribute, value, which is the value to compare against true. This attribute can reference simple substitution variables.
The following examples show how <istrue> is used and the results:
The following statement evaluates to true.
<istrue value="True"/> |
The following statement evaluates to false.
<istrue value="yes"/> |
The following statement evaluates to true if var is true.
<istrue value=":[var]"/> |
This Boolean operator is used to determine whether a particular value is equal to another value. This operator has the value1, value2, and exact attributes. This operator has no child elements, and evaluates to true if and only if value1 and value2 are equal. If exact is true, the values must be exactly the same, including case. If exact is false, the comparison is case-insensitive.
<istrue value="..."/> is a syntactic shorthand for the following statement:
<equals value1="..." value2="true"/> |
The <equals> operator has the following attributes:
value1 – A required attribute that is a value to be compared. This attribute can reference simple substitution variables.
value2 – A required attribute that is the value to be compared. This attribute can reference simple substitution variables.
exact – An optional attribute of type boolean, which is true if a case-sensitive match should be performed, false otherwise. Defaults to false.
The following examples show how <equals> is used and the results:
The following statement evaluates to true.
<equals value1="True" value2="true"/> |
The following statement evaluates to false.
<equals value1="True" value2="true" exact="true"/> |
The following statement evaluates to true.
<equals value1="apple" value2="apple" exact="true"/> |
The following statement evaluates to false.
<equals value1="apple" value2="orange"/> |
The following statement evaluates to true if var1 is equal to var2.
<equals value1=":[var1]" value2=":[var2]"/> |
This Boolean operator is used to determine whether a particular value matches a pattern. This operator has the value, pattern, and exact attributes. This operator has no child elements and evaluates to true if and only if the value of value matches the glob-style pattern contained in pattern. If exact is true, the values must be a case-sensitive match. Otherwise, the values can be a case-insensitive match.
The <matches> operator has the following attributes:
value – A required attribute that is the value to be matched against the pattern. This attribute can reference simple substitution variables.
pattern – A required attribute that is the pattern to be matched. This attribute can reference simple substitution variables.
exact – An optional attribute that is true if a case-sensitive match should be performed, false otherwise. Defaults to false.
The following examples show how <matches> is used and the results:
The following statement evaluates to true.
<matches value="True" pattern="true"/> |
The following statement evaluates to true.
<matches value="True" pattern="t*"/> |
The following statement evaluates to false.
<matches value="blue" pattern="*u"/> |
The following statement evaluates to true.
<matches value="True" pattern="t?ue"/> |
The following statement evaluates to false.
<matches value="Tue" pattern="t?ue"/> |
The following statement evaluates to false.
<matches value="True" pattern="t*" exact="true"/> |
The following statement evaluates to true if var1 matches the pattern of var2.
<matches value=":[var1]" pattern=":[var2]"/> |
This Boolean operator negates the result of another Boolean operator. This operator has no attributes and has a single child element, which is one of the other Boolean operators. This operator evaluates to true only if the value of its contained operator is not true.
The following examples show how <not> is used and the results:
The following statement evaluates to false.
<not><istrue value="True"/></not> |
The following statement evaluates to true.
<not><equals value1="apple" value2="orange"/></not> |
This Boolean operator logically ANDs the results of other Boolean operators. This operator has no attributes and can contain any number of child elements, which are the other Boolean operators. The <and> operator evaluates to true only if all of its child elements evaluate to true.
The following examples show how <and> is used and the results:
The following statement evaluates to true.
<and/> |
The following statement evaluates to true.
<and><istrue value="True"/></and> |
The following statement evaluates to false.
<and><equals value1="apple" value2="orange"/></and> |
The following statement evaluates to true.
<and> <matches value="apple" value2="ap*e"/> <istrue value="TRUE"/> <not><equals value1="apple" value2="orange"/></not> </and> |
The following statement evaluates to false.
<and> <matches value="apple" value2="ap*e"/> <istrue value="TRUE"/> <equals value1="apple" value2="orange"/> </and> |
This Boolean operator logically ORs the results of other Boolean operators. This operator has no attributes and can contain any number of child elements, which are the other Boolean operators. The <or> operator evaluates to true only if it contains at least one child element that evaluates to true.
The following examples show how <or> is used and the results:
The following statement evaluates to false.
<or/> |
The following statement evaluates to true.
<or><istrue value="True"/></or> |
The following statement evaluates to false.
<or><equals value1="apple" value2="orange"/></or> |
The following statement evaluates to false.
<or> <matches value="apple" value2="p*e"/> <istrue value="FALSE"/> <equals value1="apple" value2="orange"/> </or> |
The following statement evaluates to true.
<or> <matches value="apple" value2="p*e"/> <not><istrue value="FALSE"/></not> <equals value1="apple" value2="orange"/> </or> |