Looping and Conditional processing

LOOP Statement

The simplest possible looping construct is the LOOP statement. The syntax for this statement is as follows:

[label:] LOOP
statements
END LOOP
[label];

The statements between the LOOP and END LOOP statements will be repeated indefinitely, until the LOOP is terminated. You can terminate the LOOP using the LEAVE statement, which we will describe shortly.

Conditional Processing

The !IF construct specifies conditions for processing. The syntax is as follows:

!IF (expression) !THEN statements
[!ELSE statements] !IFEND
• !IF, !THEN, and !IFEND are all required. !ELSE is optional.

• If the result of the expression is true, the statements following !THEN are executed. If the result of the expression is false and !ELSE is specified, the statements following !ELSE are executed. Otherwise, the program continues.

• Valid operators for the expressions include !EQ, !NE, !GT, !LT, !GE, !LE, !OR, !NOT, and !AND, or =, ~= (¬=), >, <, >=, <=, |, ~ (¬), and &.

• When a macro is expanded, conditional processing constructs are interpreted after arguments are substituted and functions are executed.

• !IF statements can be nested whenever necessary. Parentheses can be used to specify the order of evaluation. The default order is the same as for transformations: !NOT has precedence over !AND, which has precedence over !OR.

XSLT Style Sheet and root template
Patterns and Expressions

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?