alternatives Element

This topic describes the <alternatives> XML element.

General syntax
<alternatives> 

   child instructions 

</alternatives>
DescriptionThe alternatives statement is like an if-else operation. When the first child instruction in the alternatives statement returns true, then the next child instruction is not executed and the alternatives statement is exited. If the first child instruction returns false, then the next child instruction will be executed.

Only alternatives and test statements can return false. Other instructions or operations always return true.

Examples
<!-- the execution here is as follows: 
   1. if attribute SYMBOL exist, add attribute SUB_SYMBOL with value 1 and return true
      and exit alternatives 
   2. if attribute SYMBOL does not exist, it returns false and proceed to the next 
      child instruction where an attribute SYMBOL with value 1 is added and exit 
      alternatives -->

<alternatives> 
   <test type="attribute" name="SYMBOL"> 
      <add target="attribute" name="SUB_SYMBOL value="1"/> 
   </test> 
   <add target="attribute" name="SYMBOL" value="1"/> 
</alternatives>