3. Presentation Elements
3.6 Enlivening Expressions
3.6.1
<maction> -- bind actions to a subexpression
Authors can make links from MathML subexpressions by using the
standard XML href="...">
simple link construction,
as described in Section 7.1.4. However,
links are only one of many ways which specific renderers might
provide authors for making math notation active. For example, in
lengthy mathematical expressions, the ability to "fold" expressions
might be provided, i.e. a renderer might allow a reader to toggle
between an ellipsis and a much longer expression which it
represents.
To provide a mechanism for binding actions to expressions,
MathML provides the <maction> element. This element
accepts any number of subexpressions as arguments, and the
following attributes:
|
Name |
values |
default |
|
actiontype |
(described below) |
(required attribute, no default value) |
|
selection |
positive-integer |
1 |
By default, renderers which do not recognize the specified
actiontype should render the selected
subexpression as defined below. If no selected subexpression
exists, it is a MathML error; the appropriate rendering in that
case is as described in Section 7.2.2 on
the treatment of MathML errors.
Since a MathML-compliant renderer is not required to recognize
any particular actiontypes, a renderer can be fully MathML
compliant just by implementing the above-described default
behavior.
The selection attribute is provided for those actiontypes
which permit someone viewing a document to select one of several
subexpressions for viewing. Its value should be a positive integer
which indicates one of the subexpressions of the
<maction> element, numbered from 1 to the number of
children of the element. When this is the case, the subexpression
so indicated is defined to be the "selected subexpression" of the
<maction> element; otherwise the "selected
subexpression" does not exist, which is an error. When the
selection attribute is not specified (including for actiontypes
for which it makes no sense), its default value is 1, so the
selected subexpression will be the first subexpression.
Note that the selection attribute of an
<maction> element affects not only the rendering of the
element itself, but potentially the rendering of elements
containing it, due to the reference to an <maction>'s
selected subexpression in the definition of embellished operator
in Section 3.2.4.
Furthermore, as described in Chapter
7, if a MathML renderer responds to a user command to copy the
currently selected MathML subexpression to the environment's
"clipboard", any <maction> elements present in what is
copied should be given selection attributes which correspond to
their selection state in the MathML rendering at the time of the
copy command.
Here is a suggested list of actiontypes and their
associated actions. (Note that hyperlinks are not included here,
but are described separately in Chapter
7.)
- <maction actiontype="toggle" selection="number"
>
(first expression) (second
expression)...
</maction>
- For this action type, a renderer would alternately display the
given expressions, cycling through them when a reader clicked on
the active expression, starting with the selected expression and
maintaining this attribute value as described above. Typical uses
would be for exercises in education, ellipses in long computer
algebra output, or to illustrate alternate notations. Note that the
expressions may be of significantly different size, so that size
negotiation with the browser may be desirable. If size negotiation
is not available, scrolling, elision, panning, or some other method
may be necessary to allow full viewing.
- <maction actiontype="statusline"> (expression)
(message) </maction>
- In this case, the renderer would display the expression in
context on the screen. When a reader clicked on the expression or
moved the mouse over it, the renderer would send a rendering of the
message to the browser statusline. Since most browsers in the
forseeable future are likely to be limited to displaying text on
their statusline, authors would presumably use plain text in an
<mtext> element for the message in most circumstances.
For non-<mtext> messages, renderers might provide a
natural language translation of the markup, but this is not
required.
- <maction actiontype="tooltip"> (expression)
(message) </maction>
- Here the renderer would also display the expression in context
on the screen. When the mouse pauses over the expression for a long
enough delay time, the renderer displays a rendering of the message
in a pop-up "tooltip" box near the expression. These message boxes
are also sometimes called "ballon help" boxes. Presumably authors
would use plain text in an <mtext> element for the
message in most circumstances. For non-<mtext>
messages, renderers may provide a natural language translation of
the markup if full MathML rendering is not practical, but this is
not required.
- <maction actiontype="foregroundhighlight"
other="color='#ff0000'"> expression </maction>
<maction actiontype="backgroundhighlight"
other="color='#ff0000'"> expression </maction>
- In this case, a renderer might highlight the enclosed
expression on a "mouse-over" event. In the example given above, use
is being made of the "other" attribute to pass a color to a
specific renderer (see 7.2.3).
The "foregroundhighlight" version changes the color of the
characters in the presentation, while the "backgroundhighlight"
changes the color of the background behind the characters.
- <maction actiontype="menu" selection="number" >
(menu item 1) (menu item 2) ... </maction>
- This action type instructs a renderer to provide a pop up menu.
This allows a one to many linking capability. Note that the menu
items may be other <maction
actiontype="menu">...</maction> expressions, thereby
allowing nested menus.
Next: Content Markup
Up: Table of Contents