Switch Usage

Use a switch-var attribute instead of the value attribute when a tag expects a value with a compound string expression. The switch-var attribute contains a single variable name (which may be prefixed by %, but cannot be enclosed in curly brackets). Use <case>, <undef>, or <default> subtags to specify switch cases. These tags also expect the value attribute, so switches can be nested:

<name switch-var='%var'>
  <case eq='value1' value='...'/>
  <case eq='value2' switch-var='%var2'>
    <undef value='...'/>
  </case>
  <undef value='...'/>
  <default value='...'/>
</name>

When a switch is evaluated, the value of the variable specified using the switch-var attribute is matched against the literal specified in the <case> tags. The literal must be the same size as the variable. (The literals value1 and value2 in the example assume that var is defined as having six bytes.) If an appropriate case is found, the corresponding case value is evaluated.

Set the value and type of the variable to __fail__ (two underscores) if you do not want a relationship to be produced for the variable:

<progname switch-var="%fname">
  <case eq="LINKDATA" value="%pname" type="Calls" params="%3" /> 
  <case eq="LINK" value="%pname" type="Calls" params="%3" /> 
  <case eq="READQTS" value="__fail__" type="__fail__" /> 
  <default value="" /> 
  </progname>

If the variable is undefined, and the <undef> tag is specified, its value is used; if not, the switch fails. Otherwise, if the <default> case is specified, it is used; if not, the switch fails.