Cisco Systems OL-27172-01 Mobility Aid User Manual


 
5-19
Cisco Broadband Access Center 3.8 Administrator Guide
OL-27172-01
Chapter 5 Configuration Templates Management
Authoring Configuration Templates
</Configuration>
</tc:Template>
Using Conditionals
Cisco BAC supports powerful conditional expressions in template constructs to provide ultimate
configuration customization.
You can use conditional expression constructs to include or exclude blocks of text within a template.
These construct elements are tc:if, tc:choose, and tc:when. You use the tc:if construct for simple single
conditionals.
You can use a combination of tc:choose, tc:when, and tc:otherwise for a logical if...else if...else
construct. The tc:if and the tc:when constructs require a test attribute. A test attribute is an expression
that can be evaluated, and the resulting object can be converted to a Boolean operator (true or false).
The tc:choose element selects one from a number of possible alternatives. This element contains a
sequence of tc:when elements, followed by an optional tc:otherwise element. Each tc:when element
has a single attribute, test, which specifies an expression.
The content of the tc:when and the tc:otherwise elements is a valid template segment. When a tc:choose
element is processed, each of the tc:when elements is tested in turn, by evaluating the expression and
converting the resulting object to a Boolean operator.
The content of the first—and only the first—tc:when element whose test is true is instantiated. If no
tc:when is true, the content of the tc:otherwise element is instantiated. If no tc:when element is true
and no tc:otherwise element is present, nothing is created.
Note Within expressions, you can use single (‘) or double quotes (“) to delimit literal strings. The template
processor interprets a quotation mark (‘ or “) as terminating the attribute. To avoid this problem, you can
enter the marks as a character reference (&quot; or &apos;). (See Table 5-2.) Alternatively, the
expression can use single quotes (‘) if the attribute is delimited with double quotes (“) or vice-versa.
Table 5-2 lists the conditional template constructs that this Cisco BAC release supports.
Table 5-2 Conditional Template Constructs Supported in Cisco BAC
Conditional statement If
Conditional statement If...else if...else
Conditional statement or
Conditional expression and
Conditional expression lessThan
Conditional expression lessThanEquals
Conditional expression greaterThan
Conditional expression greaterThanEquals
Conditional expression contains, notContains
Conditional expression containsIgnoreCase, notContainsIgnoreCase
Conditional expression equals, notEquals
Conditional expression equalsIgnoreCase, notEqualsIgnoreCase