docs.roxen.comView this page in a printer friendly mode
DocsRoxen2.1TutorialsIf tags
Copyright  2001, Roxen Internet Software
Suggestions, comments & compliments

The basics of if-else
If tags syntax
If plugins
A basic example
<if> and <define>
<if supports>


This lesson have been treating the Roxen Macro Language (RXML) If tags, used to create dynamic web pages based on conditions. They also make it possible to create web applications in RXML without using any programming language.

The If tags correspond to the if-else control flow statements common in regular programming languages.

If tags statements are built up by six basic tags, <if>, <else>, <elseif>, <then>, <true> and <false>. The general syntax is:

<if plugin1='expr' [and|or plugin2='expr' ...] [not]>
  if block
[<elseif plugin='expr' ...>
  elseif block
  else block

Mandatory attribute to <if> and <elseif> is an If plugin. Logical attributes - and, or and not - adds functionality. Inside the attribute expression, '=', '==', 'is', '!=', '<' and '>' operators are valid.

For proper XML, always close tags

<if match='&; is foo' />
<if match='&; is foo'></if>

and give all attributes a value

<if true=''>.

The If plugins are divided into five categories, Eval, Match, State, Utils and SiteBuilder, according to their function. Eval plugins evaluate expressions as in regular programming languages, Match plugins match contents with arguments given and State plugins check which of the conditions possible is met. Utils plugins perform specific tests such as present date or time. SiteBuilder plugins require a Roxen Platform SiteBuilder and add test capabilities to web pages contained in a SiteBuilder.

<set variable='' value = '1' />

<if variable=' = 1'>
  foo = 1
  foo is something else
foo = 1

Here is an example of a simple if-else with RXML <if> and the Eval plugin Variable.


Roxen Web Site Creator Manual

Roxen Macro Language (RXML)

Roxen Administrator Manual

HTML 4.01 Specification by W3C

XML 1.0 Specification by W3C

XSL Specification by W3C

XSLT Specification by W3C

Netscape JavaScript Reference

If you have any questions, suggestions, comments or complaints about this lesson, please send an e-mail to