<switch_> (Template Tag)


Description


The switch_ select instruction provides a convenient way to check a sequence of conditions and execute various instructions depending on the results of the comparison.


Example


 <?xml version="1.0" encoding="utf-8"?>

 <assembly id="nxm.tests.basic.pl">

. . .

   <switch_ input="this.address.zipcode">

     <case_ value="59-220">

       <text>Legnica</text>

     </case_>

     <case_ value="45-573">

       <text>Wrocław</text>

     </case_>

     <default_>

       <text>I don't know this code</text>

     </default_>

   </switch_>

. . .

 </assembly>




The code should be interpreted as follows: check the value of the expression this.address.zipcode, if the result is 59-220, then execute the instruction <text>Legnica</text> and abort execution of the switch block.

If 45-573 is the result, then execute the instruction <text>Wrocław</text> and abort the switch block.

If none of these cases apply, execute the <text>I don't know this code</text> instruction and end the switch block.

The default block is optional and can be omitted.


Attributes





Attribute

Description

input

The source of data

value

Fixed value inserted in the template



Child elements permitted





Child element

Description

case_

The tag tests values from the value tag / The tag inputs values from properties.

default_

The text contained in this tag is displayed when no match is found in the <case_> tag.



Parent elements permitted


Like in the <content> tag