This module belongs to the Literature Markup Language Version 2.0
There are two new attributes in LML 2.0 indicated in the index with (v2).
Conditional processing is for example established in SMIL or SVG to provide content dependent on the capabilities of the user-agent and the preferences of the user. A typical example concerning text content is the switch between different languages for the same information. Another typical application is to provide alternatives for multimedia formats not interpreted by the user-agent.
Conditional processing consists basically on conditional processing attributes and the element switch
.
Conditional processing attributes act as Boolean tests and evaluate to either true or false.
The attributes can be used in two ways, depending on the context of the element on which the attributes are specified.
The default evaluation is true.
Usage without switch
:
If the test on conditional processing evaluates to false, the related element and its children are not processed
(neither further interpreted nor displayed).
Usage with switch
:
Within a switch
element not more than one direct child (including its children) is processed at once. Which depends on the conditional processing attributes and on the specific attribute
how
of the switch element.
An exception of this rule is a possible meta
element as the first children of a switch.
If the test on this meta
evaluates to true
(for example because it has no conditional processing attributes specified),
not only this meta
element is processed,
the evaluation continues to find possible other elements to be processed.
This first meta
is presented independently to the conditional processing related to the switch.
This ensures, that the author can provide meta information about the switch
element
and the conditional processing itself.
If one child element has no attribute for conditional processing, it evaluates to true, therefore the following elements are not evaluated anymore. If an element without conditional processing attribute is noted as the last element within a switch, this is effectively the default, if no other condition before applies.
If more than one conditional processing attribute is noted at one element, each of them have to evaluate to 'true' to get 'true' for the element, else 'false'.
Type: Meta (inline or block)
A container for the alternatives inside. The direct children of switch represent the alternatives.
The user-agent should provide on demand an interface related to how
= "interface"
for a manual selection between the alternatives and including the possibility to select external programs or to save the related file,
if with a link
a document in another format is referenced.
This is intended to help users to decide on there own on demand, how and which alternative is the best.
Type: Attribute, how
= "conditional | interface | auto"
A specific attribute for the element switch
,
to indicate the method to determine, which direct child is processed. The default is 'auto'.
For the value 'conditional' the switch is done by conditional processing.
Only the first direct children of the switch
is processed,
which conditional processing attributes all evaluate to true. If there is no such element, none of them is processed.
For the value 'interface' an interface is provided to choose between all elements,
for which all conditional processing attributes evaluate to true as a first approach.
On demand from the user all alternatives have to be indicated, independent from the conditional processing evaluation as a second approach.
The information to be provided for the choice are the values of the conditional processing attributes
and if available the meta information about each of these elements.
A user-agent may provide additionally information about his own choice according to the result from 'auto'.
Therefore the initial presentation is only an indication for the interface.
After a selection, the selected alternative is processed.
On demand the user may choose another alternative.
For the value 'auto' the user-agent chooses between all elements,
for which all conditional processing attributes evaluate to true for the best expected presentation result.
If this cannot be selected unambiguously, the user-agent chooses the first of the best in source code rendering order.
The user-agent may use some rating number construction with reasonable weights for each conditional processing attribute
to compute the element rating number by multiplication of all single attribute rating numbers.
If a container with simple text and without conditional processing attribute is provided as last alternative
within the switch and previous alternatives are other formats, this text is typically only intended as fallback,
if nothing else works, therefore the rating number is assumed to be intended very low,
even if there is no technical problem with its presentation.
Type: Attribute, langc
= "list of language identifiers"
The value is a whitespace separated list of language tags or language tag groups
to indicate the applicable system language. For details about language tags see xml:lang.
An or-group is indicated with parenthesis, '(' at the beginning, ')' at the end.
An and-group is indicated with parenthesis, '{' at the beginning, '}' at the end.
A group can contain other groups.
A single tag evaluates to true for the purpose of conditional processing if one of the languages
indicated by user preferences equals one of the languages given in the value of this attribute,
or if one of the languages indicated by user preferences exactly equals a prefix of one of the languages given in the value
of this attribute such that the first tag character following the prefix is '-' (minus).
An or-group evaluates to true, if at least one of the specified tags, respectively groups directly inside evaluates to true.
An and-group evaluates to true, if all specified tags, respectively groups directly inside evaluate to true.
This attribute evaluates to true, if all specified tags, respectively groups directly inside evaluate to true.
systemLanguage
(Note that in SVG the value is processed simpler, excluding and- and or-groups.)Type: Attribute, typec
= "list of types"
The main idea of conditional processing dependent on a media type is to optimise accessibility for (other) formats and documents,
if they themselves do not provide (text) alternatives for non textual content.
If the referenced document provides this, it is sufficient to indicate the format of the document, not parts referenced inside.
If the referenced document or format does not provide (text) alternatives for non textual content,
the format itself or questionable formats used within the referenced documents are a matter of indication,
if some other formats are required to be interpreted within the referenced format.
For example PNG and JPEG are required in SVG,
SVG has the capabilities to provide text alternatives,
therefore if text alternatives are available in the SVG document,
only the type for SVG needs to be indicated.
If a SMIL document embeds video formats without text alternatives,
all formats including that for SMIL need to be indicated.
The value is a whitespace or comma separated list of internet media types (or codecs) or media type or codec groups.
For internet media types and codecs details see type.
An or-group is indicated with parenthesis, '(' at the beginning, ')' at the end.
An and-group is indicated with parenthesis, '{' at the beginning, '}' at the end.
A group can contain other groups.
A single type evaluates to true, if it is interpreted.
An or-group evaluates to true, if at least one of the specified types, respectively groups directly inside is interpreted.
An and-group evaluates to true, if all specified types, respectively groups directly inside are interpreted.
This attribute evaluates to true, if all specified types, respectively groups directly inside are interpreted.
requiredFormats
(Note that in SVG the value is processed simpler, excluding and- and or-groups.)Type: Attribute, elc
= "list of elements"
The value is a whitespace or comma separated list of LML element names or safe CURIEs,
respectively groups of them.
An or-group is indicated with parenthesis, '(' at the beginning, ')' at the end.
An and-group is indicated with parenthesis, '{' at the beginning, '}' at the end.
A group can contain other groups.
A single element or CURIE evaluates to true, if it is interpreted.
An or-group evaluates to true, if at least one of the specified elements, CURIEs,
respectively groups directly inside is interpreted.
An and-group evaluates to true, if all specified elements, CURIEs,
respectively groups directly inside are interpreted.
This attribute evaluates to true, if all specified elements, CURIEs,
respectively groups directly inside are interpreted.
requiredFeatures
(Note that in SVG the value consists of feature strings and is processed simpler, excluding and- and or-groups.)requiredExtensions
(Note that in SVG the value is processed simpler, excluding and- and or-groups.)Type: Attribute, namespacec
= "list of namespaces"
The attribute value is a whitespace separated list of namespaces.
All related formats have to be known/interpreted, to evaluate to 'true', else to 'false'.
This is an alternative to the attribute typec
.
If a format has a media type, but no namespace or vice versa, the other method can be used.
Type: Attribute, modulec
= "list of modules"
The attribute value is a whitespace separated list of module names. Some formats have modules or feature strings, identified with URIs as names. All modules/features have to be known/interpreted, to evaluate to 'true', else to 'false'.
The URI has to be non-ambiguous for namespace and module,
for example for XHTML modules this looks like this:
'http://www.w3.org/MarkUp/DTD/xhtml-target-1.mod'.
For SVG a feature string can be used, for example:
'http://www.w3.org/TR/SVG11/feature#SVG-animation'
Note that one can use feature strings in SVG for conditional processing,
but this approach with modulec
can be used to provide an alternative within another format
within LML instead of switching in SVG.
This is an alternative approach to the attribute elc
.
Modules and feature strings are more the traditional style, but elc
is more detailed.