The if:when Element

Use the if:when element inside an if:choose element to provide content for one condition.

Notes

  • The if:when element can contain any general block content.

  • The if:when element occurs in an if:choose element.

  • The required test attribute contains a test expression that determines whether the content of the if:when element will be displayed.

  • The style attribute takes a space-separated list of style hints. Processing tools should adjust their behavior according to those style hints they understand.

  • The if:when element can have attributes from external namespaces. See External Namespaces for more information on external-namespace attributes.

Examples

Processing Expectations

The contents of an if:when element are only displayed if its test attribute evaluates to true, and only if no previous if:when elements in the same if:choose were displayed. See Processing Expectations on the page The if:choose Element for more details.

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 formal definition for the if:when element. The namespace declarations for this definition are on the page Conditionals 1.0.

if_when = element if:when {
  if_when_attr,
  mal_block *
}
if_when_attr = (
  if_attr_test,
  attribute style { xsd:NMTOKENS } ?,
  mal_attr_external *
)
© 2011, 2012 Shaun McCance
cc-by-sa 3.0 (us)

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

As a special exception, the copyright holders give you permission to copy, modify, and distribute the example code contained in this document under the terms of your choosing, without restriction.

Powered by
Mallard
Hosted by Syllogist