Conditionals 1.0
This specification was marked final on 2015-03-28.
The Mallard Conditionals extension provides a standard mechanism for run-time conditional processing. Conditional processing is handled with simple but flexible expressions in the test attribute that control whether or not content is shown. Test expressions are logical expressions built from test tokens.
In addition to single conditional tests, the Conditionals extension provides the if:choose element to support branching and fallback content for different conditions.
Basic Conditionals
- The test and if:test Attributes — Use test expressions to specify conditions.
- The if:if Element — Wrap arbitrary content in a single conditional.
Branching and Fallback
- The if:choose Element — Provide a list of alternative content.
- The if:when Element — Provide content for one condition in a list of choices.
- The if:else Element — Provide fallback content in a list of choices.
Notes
- Fallback Behavior — Details on behavior of tools that don’t implement conditionals.
- Test Tokens — Standard tokens and prefixes for use in test expressions.
Schema
The formal definition of the Mallard Conditionals extension is maintained in RELAX NG Compact Syntax in code blocks within this specification. This is the namespace declaration for the schema.
# This schema cannot be used on its own. It is designed to be combined
# with the core Mallard schema using the version attribute.
namespace if = "http://projectmallard.org/if/1.0/"