The if:else Element

Use the if:else element inside an if:choose element to provide fallback content when no if:when matches.

Notes

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

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

  • 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:else 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:else element are only displayed 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:else element. The namespace declarations for this definition are on the page Conditionals 1.0.

if_else = element if:else {
  if_else_attr,
  mal_block *
}
if_else_attr = (
  attribute style { xsd:NMTOKENS } ?,
  mal_attr_external *
)