Google Search diml.org
[ french ]

Table des matières
 Latest News
 An application of the  WCT_NEWS  component
>> Top of page

Data Injection Markup Language Reference

Compact if Statement


Module : Core Group : Control Structures

Syntax 1 :

<%if (condition) 
   "alternative1"
   %endif 
   %>

Syntax 2 :

<%if (condition) 
   %variable-name%
   %endif 
   %>

Syntax 3 :

<%if (condition) 
   "alternative1"
   %else
   "alternative2"
   %endif 
   %>

Syntax 4 :

<%if (condition) 
   %variable-name%
   %else
   %variable-name%
   %endif 
   %>

The DIML has provision for conditional structures. The above syntaxes are a compact implementation of such structures and will provide IF and IF...ELSE conditional schemes. The DIML has also a multiline syntax for conditional statements, that is nearer the usual "block" implementation in programming languages.

Condition syntax: The condition is langage dependant and conforms to the processor implementation syntax (it will accept Perl expression syntax for the Perl version), except two major modifications:

  • DIML variables can be used in the expression, as %variable-name% calls, rather than the internal storage implementation dependant variable names.
  • The modulo operator (%) is shifted to the '@' non standard operator, because being too confusing for parsing.

Alternatives: Syntaxes 1 and 3, 2 and 4 by other hand accept a litteral syntax (quoted parsed string) or a DIML variable reference. the litteral form can contain some DIML statements where "dangerous" chars (for DIML parsing) have been correctly SGML escaped (e.g., the syntax

"a string with an embedded &lt;%set %INSTRUCTION% = "e;0"e; %&gt;"

is valid.

In syntaxes 3 and 4, both alternative forms can be mixed.


previous summary next


All material is copyleft V.G. FREMAUX (EISTI France) 1999 to 2003 except explicitly mentioned