Conditionally processes one of several possible template sections.
The select tag, just like an arbitrary number of nested case tags, has an attribute named "value" whose value is compared, one at a time, to the value attributes of the nested case tags. The first case tag whose value attribute matches the value attribute of the select tag has its contents processed. If no case tags match and there is a nested default tag, then the default tag contents will be processed.
Tag Summary | |
---|---|
required |
<select value="value" /> |
full tag |
<select value="value" /> |
Required Attributes |
|
---|---|
value | A value to be compared with all nested case tags' value attribute values. |
There are no optional attributes |
---|
Example | |
---|---|
<select value="%class(comments)%" > <case value="verbose"> // Lots of comments </case> <case value="terse"> // Minimal comment </case> <default> <statusMessage>The comment level for class <attr node="class" name="className"/> is invalid: <attr node="class" name="comments"/></statusMessage severity="error"> </default> </select> This select tag demonstrates two uses for the select tag. First, the value of attribute "comment" for the node associated with variable name "class" is compared with "verbose" and "terse". If the value is either "verbose" or "terse" then the contents of the appropriate case tag will be processed. If the value is "verbose" then a section of template generating lots of comments is processed and if the value is "terse" then a section of template generating relatively compact comments is processed. Second, if neither value matches we can assume that the comments attribute contains an invalid value and the default tag content, processed because neither case tag comment was processed, uses the statusMessage tag to return an informative message to the pattern user. |
© Copyright IBM Corporation 2000,
2006. All Rights Reserved.