The inclusion of mathematics in DAISY publications was the objective of the MathML Modular Extension working group. It was clear from the onset that MathML was the best choice of a standard to build on. The working group looked at a variety of options in the course of developing the specification. As the working group explored the various options, several principles emerged that guided the design.
The specification must:
The working group explored a variety of techniques to create more interesting and innovative mechanisms to manipulate the SMIL and thereby present the mathematics in ways that could emulate what an intelligent reading system might do. The working group rejected this approach for several reasons. The working group believes that:
Finally, the working group settled on a simple and robust mechanism for the inclusion of MathML into the DAISY XML framework. This clean design provides a trustworthy specification so that content can be moved forward in the future through automated processes.
The following members of the working group took an active role in developing this modular extension:
The Working Group gratefully acknowledges the substantial contributions and comments made by the following individuals to the continuing development of the modular extension.
A significant number of the definitions and references used in the Z39.86-2005 specification were copied into this specification. This ensures consistent definitions and references between the two specifications. The Working Group members gratefully acknowledge the work of the Z39.86-2005 specification writers.
(This section is informative.)
The Z39.86-2005 standard does not have a method for including mathematics in a document other than via images with alt tags. However section 4.2.2 of the standard does define how modular extensions can be added to the standard. The DAISY MathML working group has developed a solution for including math based on this extension mechanism.
There are many problems associated with the use of images for authors and for readers (both those with and without visual disabilities) of documents containing math. These include:
MathML represents a solution to these problems. Because it is an XML application and has been designed to work with XHTML, using MathML in Z39.86-2005 was the direction that the MathML Modular Extension Working Group pursued.
This specification groups players into three categories:
This modular extension is meant to encourage advanced MathML players to provide a rich experience when reading mathematics. However, the modular extension also recognizes that mathematics may not be a focus for all vendors and provides fallbacks. For the common case of an audio only player, a predefined audio rendering is provided. There are no local navigation points within that rendering, which is something an advanced MathML player could provide. An advanced MathML player could allow a user to explore the structure of the expression tactilely using a refreshable braille display and/or with audio without having to listen to the expression in its entirety. A future version of this specification may add finer SMIL granularity within the math audio stream. For players that do not support MathML, an alternate image is provided as part of the MathML. Basic MathML players must either recognize MathML enough to locate the image reference provided on the MathML root element, or they must support XSLT and apply a supplied transform indicated in the metadata of the DTB Package file.
(This section is normative.)
The following abbreviations, acronyms, phrases, and terms are used in this modular extension as defined below. In the following definitions and throughout this specification, bracketed items correspond to entries in "Section 11: References to Other Specifications/Documents", where the full URL is provided for each reference.
(This section is informative.)
The Math Working Group's approach to a solution was governed by the following principles:
This extension makes use of the Z39.86-2005 specifications and DTD and does not modify that specification. Neither does this extension modify MathML, although some constraints are placed upon the MathML. See Section 1.4.2: Relationship to MathML for details. Avoiding changes to MathML means current MathML authoring and rendering tools will work without modification for Z39.86-2005 content that contains math.
The third principle (providing a solution for players that are not currently aware of extensions) was the more difficult principle to satisfy. There will always be players that do not implement a math extension. The proposed extension provides a mechanism for Basic MathML players to present a simple prepared presentation with an image, alt-text, and/or an audio file. Players that are able to display MathML visually (i.e., as traditional mathematical notation) and/or with audio can provide enhanced capabilities such as local navigation and synchronized highlighting. In addition, advanced MathML players or braille producers can create braille math codes such as LAMBDA, Nemeth, Marburg, and LaTeX from the MathML.
The working group looked at a number of alternatives for adding MathML that would work with players that are not aware of a MathML extension (as opposed to players that are aware but do not handle MathML). Perhaps the biggest problem is that the DTB specification does not define behavior for players that encounter unknown elements in the XML file. Thus, behavior such as skipping the entire element could not be relied on. Ultimately, the committee felt that the solutions it considered and that might work with all of these players were not good solutions in general. This extension should work for audio only players without a change and these players represent the vast majority of DAISY players in 2006. Players that look at the XML file instead of just the SMIL file will require some modification in order to render MathML-extended DTBs. These modifications are likely to be achievable for DAISY reading system developers to make. Furthermore, this enhancement is an area where reading system developers can clearly differentiate their advanced MathML players in the marketplace.
The MathML extension is the first extension of the DAISY specification. The working group felt it was important to avoid modifying any specification, including Z39.86-2005. The approach taken makes use of the existing extension mechanism specified by Z39.86-2005. However, the extension adds additional restraints. It is likely this approach could be used by other extensions (using application-specific tag names).
(This section is informative.)
MathML is based on Unicode. In Unicode 3.2, a large number of mathematical characters were added. Some additional characters were added in Unicode 4 and Unicode 5. It is recommended that MathML support be based on a version of Unicode no earlier than Unicode 3.2, and preferably should be based on the current version of the standard.
(This section is informative.)
This modular extension does not modify MathML, although it places some restrictions upon its use. This extension is based on MathML 2. It is expected that future versions of the MathML specification will be compatible with MathML 2 and support in players should be upgraded to new MathML versions in a timely manner.
The toplevel element in MathML is math. The math element
has optional attributes alttext and altimg.
Basic MathML players can use these two
attributes to render the math element.
See Section 4.1 for details.
Most of MathML's tags can be considered to be either presentation-based elements that describe how an expression is displayed or content-based elements that describe the meaning of the expression, but not necessarily how it is displayed. In MathML, these tags can be mixed together with some restrictions. This extension further restricts where content elements can appear. See Section 4.1 for details.
(This section is informative.)
It is believed that no companies claim rights to MathML or the use of MathML in Z39.86-2005. The implementation of Z39.86-2005 itself in players may involve the use of inventions covered by patent rights.
(This section is informative.)
The maintenance agency designated in Appendix 2 will be responsible for reviewing and acting upon suggestions for modifications to this extension. Questions concerning the implementation of this extension and requests for information should be sent to the maintenance agency.
A list of errata, proposed changes, and maintenance activities related to this modular extension will be maintained at http://www.daisy.org/z3986/modular/.
(This section is informative.)
To include MathML in a document, the following parts of the document require additions:
text
element. The value of the type
attribute is MathML´s
namespace URI and tells players that the reference is to
MathML, not normal text. See Section 5: Synchronization
of Media Files for more information. navList
along with figures, tables, etc. See Section 6: Navigation
Control File for more information.
The
XSLT file provides a means for visual players that know nothing
about MathML to transform the MathML into images by using the
altimg specified in the math tag.
It is required that a
MathML-extended DTB carries an XSLT with this role as part of the distributed
DTB fileset. The name of this file should be listed in the metadata in the
package file. The details of what should be in the XSLT File are not part of
this specification. However, Appendix 3.6: XSLT File, provides
an example implementation.
(This section is normative.)
The following two metadata entries shall be present in the MathML-extended DTB:
<meta name="z39-86-extension-version" scheme="http://www.w3.org/1998/Math/MathML" content="1.0" /> <meta name="DTBook-XSLTFallback" scheme="http://www.w3.org/1998/Math/MathML" content="xslt-file-name" />
"xslt-file-name" must be replaced by the name of the XSLT file being used. All other attribute values must be as listed above.
These entries must not be present if the DTB does not include MathML.
(This section is informative.)
The metadata attribute
name="z39-86-extension-version"
identifies that a conforming publication includes an extension.
The scheme attribute
scheme="http://www.w3.org/1998/Math/MathML"
identifies the type of extension. The value for the math extension is the namespace URI of MathML.
The content attribute identifies the version.
Reading systems and production tools that encounter this metadata can use the information to determine how to support the extension if they choose to support it. Reading systems and production tools that encounter metadata for mathematics will know that mathematics exists somewhere in the publication.
NOTE: the mathematics extension is the first extension defined for the DAISY/NISO Standard. It is recommended that all subsequent extensions use this metadata entry to expose the type of extension to the reading system and production tools.
The metadata entry attribute
name="DTBook-XSLTFallback"
identifies that an XSLT transformation is provided as a fallback. An example of an XSLT transformation is given in the Appendix 3.6: XSLT File.
The scheme attribute
scheme="http://www.w3.org/1998/Math/MathML"
identifies the type of transformation on which the transform should be used. The value for the math extension is the namespace URI of MathML.
The content attribute is the location of the file containing the transformation rules.
NOTE: intelligent reading systems that support MathML need
not use this XSLT. The intended use of this is for software reading
systems that do not support MathML, but can display the altimg and/or
synthesize speech from the alttext attributes given in
the MathML. Typically, the XSLT transforms these two attributes and its content into an
imagegroup for rendering as non-extended DTB content, although options
are possible.
Other extensions may want to use similar metadata entries to signal their
presence. If they use the same values for the name attribute,
they must use a different value for the scheme attribute. If multiple XSLT files are
used, care must be taken to ensure that they are compatible with each other.
dtb:multimediaContent
is a required metadata entry in a conforming DTB publication.
The content types are text, audio, and image. There is
no registered MIME type for MathML, so it is not required
to put any other entry in the multimedia type; text and image is
sufficient, and audio if audio is also included.
(This section is normative.)
In addition to the files that are part of a standard DTB, the XSLT file must be present and must be listed in the package file. If a MathML-extended DTD is present, it must be listed also. The MIME type of the XSLT must be "application/xml".
If the DTB does not include MathML, these entries must not be present.
(This section is normative.)
Section 4.2.2 of the Z39.86-2005 specification provides a means to extend DTBs to include math and other content. This extension utilizes the mechanisms in that section and subsequent errata. To be compliant with this specification, a DTBook text content file must be a valid XML file conforming to the dtbook-2005-2.dtd (or errata to that DTD) with the extension for MathML.
The toplevel element in MathML is math. The math element has optional
attributes alttext and
altimg.
To be valid with this specification, the alttext and altimg attributes must be
part of the math element.
These two attributes are required for this extension so that
players that do not support MathML can still render the math.
If any of the content elements listed in Chapter 4
of the MathML specification with the exception of those listed in Section
4.4.11 (Semantic Mapping Elements) are used, they must appear inside of
an annotation-xml
element inside of a semantics element.
(This section is informative.)
A DTBook document is an XML application. Therefore it should begin with the XML declaration identifying the version of the XML and the optional character set encoding.
<?xml version="1.0" encoding="UTF-8" ?>
This should be followed by the document type declaration
that has the DTBook DTD entity externalFlow
extended with the root element of the MathML declared in the MathML DTD and the
externalNamespaces extended
to allow the declaration of the MathML namespace in the root element of the
DTBook.
<!DOCTYPE dtbook PUBLIC "-//NISO//DTD dtbook 2005-2//EN"
"http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd"
[
<!ENTITY % MATHML.prefixed "INCLUDE" >
<!ENTITY % MATHML.prefix "m">
<!ENTITY % MATHML.Common.attrib
"xlink:href CDATA #IMPLIED
xlink:type CDATA #IMPLIED
class CDATA #IMPLIED
style CDATA #IMPLIED
id ID #IMPLIED
xref IDREF #IMPLIED
other CDATA #IMPLIED
xmlns:dtbook CDATA #FIXED 'http://www.daisy.org/z3986/2005/dtbook/'
dtbook:smilref CDATA #IMPLIED"
>
<!ENTITY % mathML2 PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"
>
%mathML2;
<!ENTITY % externalFlow "| m:math">
<!ENTITY % externalNamespaces "xmlns:m CDATA #FIXED
'http://www.w3.org/1998/Math/MathML'">
]
>
(This section is informative.)
MathML is added to a document by including the MathML
directly in the XML file. The MathML's root element is math. This
example has an id and a smilref attribute so that it can be referenced by and
point to the corresponding math reference in the SMIL file. Here is an
excerpt of an XML file:
<m:math xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
id="math0001" dtbook:smilref="nativemathml.smil#math0001"
altimg="nativemathml0001.png"
alttext="sigma-summation UnderScript i equals zero OverScript infinity EndScripts x Subscript i">
<m:mrow>
<m:mstyle displaystyle='true'>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi>i</m:mi><m:mo>=</m:mo><m:mn>0</m:mn>
</m:mrow>
<m:mi>∞</m:mi>
</m:munderover>
<m:mrow>
<m:msub>
<m:mi>x</m:mi>
<m:mi>i</m:mi>
</m:msub>
</m:mrow>
</m:mstyle>
</m:mrow>
</m:math>
The math
tag the altimg
and alttext
attributes. These attributes specify an image and text to
use for players that provide only basic MathML support.
The math root can be placed as a block element or an inline element.
(This section is informative.)
It is recommended that SMIL synchronization be made only at the beginning and end of math content.
Synchronization within math content continues to be an area of experimentation and is an area where reading system developers can differentiate their advanced MathML players in the marketplace.
Synchronization of math has the following form:
<seq ...>
<par ...>
<text src="..." type="http://www.w3.org/1998/Math/MathML" .../>
<audio src="..." />
</par>
</seq>
The text element points to the MathML in the DTBook file. A
type attribute is used as part of the text element to
inform players that the content being referenced is MathML.
The type attribute value is fixed to be the namespace URI
for MathML as defined in the MathML 2 specification. It is expected that other
extensions to DTBook that incorporate foreign namespaces will adopt the same approach
for identifying textual content nature in SMIL.
Audio only players ignore the text element and play the file indicated
in the audio element. Because of this, audio only players do not need to
be aware of the MathML. DTB player developers may choose to automatically invoke special
player local navigation modes when the reader enters MathML.
Advanced and
basic visual players that
process math elements will either render the MathML
or use the image file referenced in the math element
pointed to by the text element. Basic
visual players that are not capable of handling MathML should
have first applied the XSLT transform
indicated in the metadata. This transform typically changes
the MathML in the DTBook into an imggroup,
although options are possible.
An img element is
not used in a SMIL container that references a math element.
Similarly, an
img element is not used to to reference an imggroup element
that was generated by an XSLT transform as a replacement for a math element. If
an img element
were used in a SMIL container, then the image would be displayed twice,
once by the SMIL reference and once
by the DTBook (either from the math element or the XSLT-generated imggroup
element).
(This section is normative.)
To be compliant with this specification, the content of the SMIL must be a valid XML file that conforms to dtbsmil-2005-2.dtd or errata to that DTD.
The text element must be used to refer to the corresponding
math element
in the DTBook. The src attribute must be used to point to
the MathML element in the DTBook. The value of the type attribute
must be set as:
type="http://www.w3.org/1998/Math/MathML"
An img
element must not be used in a SMIL container that references a math element. It
is strongly recommended that all math elements in the DTBook file be referenced
in the SMIL file. This follows the recommendation in section
7.2 of
the z39.86-2005 specification.
(This section is normative.)
DTB players that understand the MathML extension should provide the functionality to allow readers to "escape" from the DTB rendition of the math equations.
To support this functionality, the SMIL entry for any escapable structure must consist of a seq
element containing at least one child time element (seq or par).
The parent seq
element containing just the escapable structure must have
an end attribute with
the value of <DTBuserEscape;childID-value.end>, where childID-value
is the id value of the last child time container of the parent
seq.
Because the SMIL constructs that reference the MathML are escapable, a Resource File entry must be supplied for them. See Section 8: Resource Files for more details.
(This section is informative.)
Below is an example of how math is represented in the SMIL file. A full example with the math in context is found in Appendix 3: SMIL Files.
<seq id="math0001" class="mathExt" end="DTBuserEscape;math-par.end">
<par id="math-par">
<text src="nativemathml.xml#math0001" type="http://www.w3.org/1998/Math/MathML"
id="mml0001"/>
<audio src="nativemathml0001.mp3" id="math-audio0001" clipBegin="00:00:01.539"
clipEnd="00:00:12.082"/>
</par>
<seq>
The seq with
end="DTBuserEscape;math-par.end"
provides a target for escaping from the math.
The text element points to the math element in the DTBook. Its type
element informs players that the target is MathML. The audio element points to an MP3 file
containing audio (either spoken or synthesized) that corresponds to the
contents of the math element. The legal audio file formats are specified in
Section 5 of Z39.86-2005.
(This section is informative)
Math books will often have a list of math equations,
theorems, and/or lemmas. It is recommended that the producer uses navLists to allow the user to efficiently navigate among these constructs.
(This section is informative)
The Z39.86-2005 defines an external format for portable bookmarks. This specification does not extend what can be stored.
Using the CharOffset
attribute is not
recommended for bookmarks that target the textual content
of MathML. There are two representations of the text, the
alttext
attribute and the content of the math element.
There is no way to determine to which representation the CharOffset applies.
This specification does not prevent advanced MathML players from creating bookmarks in their own internal format. Because synchronization behavior of math is left to players, the ability of players to bookmark within math is not restricted or specified by this specification.
(This section is normative)
This specification does not change the use and format of portable bookmarks and highlights.
(This section is normative)
In a MathML-extended DTB, resources must be provided for the SMIL constructs that contain references to MathML segments of the presentation.
(This section is informative)
The default approach for associating a resource with a SMIL
construct is to create a mapping based on a class attribute value of the SMIL
element that is referenced. In the example below, the producer has chosen to
use the class attribute value <mathExt> on SMIL time containers that contain
MathML references.
<scope nsuri="http://www.w3.org/2001/SMIL20/">
<nodeSet id="ns004" select="//seq[@class='mathExt']">
<resource xml:lang="en" id="r010">
<text>mathematical formula</text>
</resource>
</nodeSet>
</scope>
Additional resources can optionally be provided for MathML constructs within the DTBook file itself, as the example below demonstrates.
<scope nsuri="http://www.w3.org/1998/Math/MathML">
<nodeSet id="m1" select="//math">
<resource xml:lang="en" id="rm001">
<text>mathematical formula</text>
</resource>
</nodeSet>
</scope>
(This section is informative)
Advanced MathML players should read the MathML content and render it visually or aurally as appropriate. Research into the best way to speak mathematics, navigate mathematical structure, and synchronously highlight mathematics is still on going. Furthermore, cultural differences and user preference and experience level may influence some of these behaviors. For example, experienced readers may prefer terse or condensed speech, whereas novice or occasional readers may prefer verbose speech. This extension does not specify details in these areas and is an area in which vendors can differentiate their players.
Basic MathML players should make use of the image and audio equivalents.
Audio only players can ignore the text element in a SMIL file and play the
file indicated in the audio
element (see Section 5: Synchronization of Media
Files). Because of this, audio only players do not need to be aware of the
MathML, although those that generate speech from the MathML can customize the
speech to the listeners needs.
Basic MathML visual players need to either
extract the altimg attribute
of the math element and use
that or apply the XSLT transform referenced in the metadata. (see Section 3.1.2: Notification of XSLT File). Players that
generate the visual display from the MathML are able to make the math equation
match the size of the text when magnified along with being able to match the
text color and background color desired by the reader.
Advanced MathML players
are also able to synchronously highlight parts of the expression as they are
being spoken – none of these features are possible if the player uses the image
instead of the MathML.
(This section is informative)
This specification does not modify the MathML specification. Because of this, all of MathML is legal. However, certain MathML constructs make supporting MathML harder for DTBook players and are best avoided. These are listed below.
MathML contains two separate sets of
elements: notational "presentation" elements and semantic "content" elements.
The later elements do not specify the notation to use for the element. For
example, divide
might be displayed as a 2-dimensional fraction or a linear fraction
using "/" or "÷". For visual or audio rendering, a style sheet of some kind
(eg, a set of XSL transforms) converts the content MathML to presentation
MathML as desired.
In order to make use of content MathML, advanced MathML players must have a means to transform content MathML to presentation MathML. This can be via a set of built-in default rules or it could make use of an external style sheet provided by the producer. In either case, using content MathML places an additional burden on advanced MathML players.
This specification requires that if any of
the content elements listed in Chapter 4
of the MathML specification with the exception of those listed in Section
4.4.11 (Semantic Mapping Elements) are used, those elements should appear
inside of an annotation-xml
element inside of a semantics
element. Advanced MathML players that can make use of content MathML can
use those elements as needed and other advanced MathML players can safely (and
easily) ignore the content MathML. Content MathML can be used to improve what is
spoken for the math and its use is encouraged.
MathML defines a large number of character entity names. Although these names can make the raw text of the document easier to read, the DTBook specification requires that these be listed as part of an internal DTD subset. Hence, the default DTD must be modified if named character entities are used. Unicode values or numeric entities should be used instead of character entities to avoid the complication of modifying the DTD.
maction Element
The maction
element is used to allow interaction with the user. The values
for the actions have not been standardized, and the interactions could pose
accessibility problems for various classes of users.
MathML authoring tools are improving all of the time. However, almost all of the tools are geared towards visual rendering and some mistakes they make are not readily apparent because those mistakes might have little or no impact on visual rendering. However they might have a significant impact to audio rendering or braille translation. It is important to remember that visual proofing of the MathML generated by authoring tools is not sufficient to discover mistakes in the MathML.
Four common mistakes to watch out for are:
<mn>1</mn><mo>,</mo><mn>000</mn>Instead of
<mn>1,000</mn>
mi
element instead of the entire variable (<mi>distance</mi>)
<mrow> <mo>(</mo> <mi>a</mi> <msup> <mo>)</mo> <mn>2</mn> </msup> </mrow>Right:
<msup> <mrow> <mo>(</mo> <mi>a</mi> <mo>)</mo> </mrow> <mn>2</mn> </msup>
(This section is normative.)
(This section is informative.)
(This section is normative.)
This specification utilizes the DTDs defined in the Z39.86 2005 specification and the MathML specification.
The Z39.86 2005 DTDs must be used in conjunction with this modular extension and are maintained by the DAISY Consortium website: http://www.daisy.org/z3986/2005/.
The MathML DTD is maintained by the W3C Math Working Group. It is maintained at: http://www.w3.org/Math/DTD/.
(This section is informative.)
The functions assigned to the maintenance agency as specified in Section 1.6 will be administered by the DAISY Consortium. Questions concerning the implementation of this extension and requests for information should be sent to the staff of the DAISY Consortium using the Contact Us link on the DAISY Web site, http://www.daisy.org/, specifying "MathML in DAISY".
(This section is informative.)
This Appendix contains a small but complete example of a MathML-extended DTB. Image and sound files are not included in this appendix but are included in the zip file referenced below. With the exception of the XSLT file, all of the files are part of a normal DTB distribution. The files listed in this appendix are:
A zip file containing these files can be found at http://www.daisy.org/projects/mathml/MathMLExtension-examples.zip.
The package file contains administrative information about the DTB as described in the DTB specification. As described in Section 3: Publication Metadata, the MathML extension requires the addition of metadata to identify the presence of the extension and the location of an XSLT transform file for use by players that may need it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE package PUBLIC "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN"
"http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd">
<package unique-identifier="uid"
xmlns="http://openebook.org/namespaces/oeb-package/1.0/">
<metadata>
<dc-metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/">
<dc:Title>MathML Modular Extension Example 1</dc:Title>
<dc:Creator>DAISY MathML Working Group</dc:Creator>
<dc:Publisher>DAISY</dc:Publisher>
<dc:Date>2007-02-05</dc:Date>
<dc:Format>ANSI/NISO Z39.86-2005</dc:Format>
<dc:Identifier id="uid">DAISY-MathML-Example-1</dc:Identifier>
<dc:Language>en</dc:Language>
</dc-metadata>
<x-metadata>
<meta name="dtb:totalTime" content="00:00:32.740"/>
<meta name="prod:generator" content="notepad"/>
<meta name="dtb:multimediaType" content="audioFullText"/>
<meta name="dtb:multimediaContent" content="audio,text,image"/>
<meta name="z39-86-extension-version"
scheme="http://www.w3.org/1998/Math/MathML"
content="1.0" />
<meta name="DTBook-XSLTFallback"
scheme="http://www.w3.org/1998/Math/MathML"
content="mathml-fallback-transform.xslt" />
</x-metadata>
</metadata>
<manifest>
<item href="nativemathml.smil"
id="s0001"
media-type="application/smil"/>
<item href="nativemathml.xml"
id="xml0001"
media-type="application/x-dtbook+xml"/>
<item href="nativemathml.ncx"
id="ncx"
media-type="application/x-dtbncx+xml"/>
<item href="nativemathml.res"
id="res"
media-type="application/x-dtbresource+xml"/>
<item href="nativemathml0001.png"
id="img001"
media-type="image/png" />
<item href="nativemathml0002.png"
id="img002"
media-type="image/png" />
<item href="mathml-fallback-transform.xslt"
id="XSLT_0"
media-type="application/xml" />
<item href="nativemathml0001.mp3"
id="MP3_1"
media-type="audio/mpeg" />
<item href="nativemathml0002.mp3"
id="MP3_2"
media-type="audio/mpeg" />
</manifest>
<spine>
<itemref idref="s0001"/>
</spine>
</package>
The DTBook file is an XML file that contains the textual content of the book. The MathML is contained in this file and is not contained in an external file as is the case for images.
The MathML can be in either an inline or a block context. In this example, the single MathML instance is in an inline context.
The math element has both an id so it can be referenced
and a smilref so it can point to the corresponding location
in the SMIL file. math
can occur in an inline context; references to the end of the math can
be made by wrapping the following textual unit in a span with an id and smilref attribute.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dtbook PUBLIC "-//NISO//DTD dtbook 2005-2//EN"
"http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd" [
<!ENTITY % MATHML.prefixed "INCLUDE" >
<!ENTITY % MATHML.prefix "m">
<!ENTITY % MATHML.Common.attrib
"xlink:href CDATA #IMPLIED
xlink:type CDATA #IMPLIED
class CDATA #IMPLIED
style CDATA #IMPLIED
id ID #IMPLIED
xref IDREF #IMPLIED
other CDATA #IMPLIED
xmlns:dtbook CDATA #FIXED
'http://www.daisy.org/z3986/2005/dtbook/'
dtbook:smilref CDATA #IMPLIED"
>
<!ENTITY % mathML2 PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"
>
%mathML2;
<!ENTITY % externalFlow "| m:math">
<!ENTITY % externalNamespaces "xmlns:m CDATA #FIXED
'http://www.w3.org/1998/Math/MathML'">
]
>
<dtbook version="2005-2" xml:lang="en"
xmlns="http://www.daisy.org/z3986/2005/dtbook/"
xmlns:m="http://www.w3.org/1998/Math/MathML"
>
<head>
<meta name="dtb:uid" content="DAISY-MathML-Example-1"/>
<meta name="dc:Title" content="nativemathml math example 1"/>
<meta name="dc:Date" content="2007-02-05"/>
<meta name="dc:Language" content="en"/>
<meta name="dc:Creator" content="mgylling"/>
<meta name="dtb:generator" content="bruno 0.9.72"/>
</head>
<book>
<frontmatter>
<doctitle id="cn0001" smilref="nativemathml.smil#tcp0001">
MathML Modular Extension Example 1
</doctitle>
<docauthor id="cn0002" smilref="nativemathml.smil#tcp0002">
MathML-in-DAISY Working Group
</docauthor>
</frontmatter>
<bodymatter>
<level1>
<h1 id="cn0003" smilref="nativemathml.smil#tcp0003">
A Simple Math Example
</h1>
<pagenum id="p1" page="normal" smilref="nativemathml.smil#tcp0004">1</pagenum>
<p>
<sent id="cn0004" smilref="nativemathml.smil#tcp0005">
Following this paragraph is a mathml island.</sent>
<sent id="cn0005" smilref="nativemathml.smil#tcp0006">
Presentational markup is used.</sent>
</p>
<m:math xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
id="math0001" dtbook:smilref="nativemathml.smil#math0001"
altimg="nativemathml0001.png"
alttext="sigma-summation UnderScript i equals zero OverScript infinity EndScripts x Subscript i">
<m:mrow>
<m:mstyle displaystyle='true'>
<m:munderover>
<m:mo>∑</m:mo>
<m:mrow>
<m:mi>i</m:mi><m:mo>=</m:mo><m:mn>0</m:mn>
</m:mrow>
<m:mi>∞</m:mi>
</m:munderover>
<m:mrow>
<m:msub>
<m:mi>x</m:mi>
<m:mi>i</m:mi>
</m:msub>
</m:mrow>
</m:mstyle>
</m:mrow>
</m:math>
<pagenum id="p2" page="normal" smilref="nativemathml.smil#tcp0007">2</pagenum>
<p>
<span id="cn0008" smilref="nativemathml.smil#tcp0008">
This is a paragraph after the mathml island that
uses the in-line expression</span>
<m:math xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
id="math0002" dtbook:smilref="nativemathml.smil#math0002"
altimg="nativemathml0002.png" alttext="cube root of x ">
<m:mroot>
<m:mi>x</m:mi>
<m:mn>3</m:mn>
</m:mroot>
</m:math>
<span id="cn0009" smilref="nativemathml.smil#tcp0009">.</span>
</p>
</level1>
</bodymatter>
</book>
</dtbook>
Math is referenced in the SMIL file using a text and audio elements inside of a par element. As with any audio element, it points to the file containing the audio
for the math. The text
element uses a type
attribute to indicate that the referenced element is math.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE smil PUBLIC "-//NISO//DTD dtbsmil 2005-2//EN"
"http://www.daisy.org/z3986/2005/dtbsmil-2005-2.dtd">
<smil xmlns="http://www.w3.org/2001/SMIL20/">
<head>
<meta name="dtb:uid" content="DAISY-MathML-Example-1"/>
<meta name="dtb:generator" content="notepad"/>
<meta name="dtb:totalElapsedTime" content="00:00:00.000"/>
<customAttributes>
<customTest id="pagenum" defaultState="true" override="visible"/>
</customAttributes>
</head>
<body>
<seq dur="00:00:32.740" id="mseq">
<par id="tcp0001" class="doctitle">
<text src="nativemathml.xml#cn0001" id="tx0001"/>
<audio src="main.mp3" id="audio0001" clipBegin="00:00:00.000"
clipEnd="00:00:03.500"/>
</par>
<par id="tcp0002" class="docauthor">
<text src="nativemathml.xml#cn0002" id="tx0002"/>
<audio src="main.mp3" id="audio0002" clipBegin="00:00:03.500"
clipEnd="00:00:05.704"/>
</par>
<par id="tcp0003" class="h1">
<text src="nativemathml.xml#cn0003" id="tx0003"/>
<audio src="main.mp3" id="audio0003" clipBegin="00:00:05.704"
clipEnd="00:00:07.555"/>
</par>
<par id="tcp0004" class="pagenum" customTest="pagenum">
<text src="nativemathml.xml#p1" id="tx0004"/>
<audio src="pagenum.mp3" id="audio0004" clipBegin="00:00:00.085"
clipEnd="00:00:01.138"/>
</par>
<par id="tcp0005" class="sent">
<text src="nativemathml.xml#cn0004" id="tx0005"/>
<audio src="main.mp3" id="audio0005" clipBegin="00:00:07.55"
clipEnd="00:00:10.933"/>
</par>
<par id="tcp0006" class="sent">
<text src="nativemathml.xml#cn0005" id="tx0006"/>
<audio src="main.mp3" id="audio0006" clipBegin="00:00:10.933"
clipEnd="00:00:13.172"/>
</par>
<seq id="math0001" class="mathExt" end="DTBuserEscape;math-par.end">
<par id="math-par">
<text src="nativemathml.xml#math0001" type="http://www.w3.org/1998/Math/MathML"
id="mml0001"/>
<audio src="nativemathml0001.mp3" id="math-audio0001" clipBegin="00:00:01.539"
clipEnd="00:00:12.082"/>
</par>
</seq>
<par id="tcp0007" class="pagenum" customTest="pagenum">
<text src="nativemathml.xml#p2" id="tx0007"/>
<audio src="pagenum.mp3" id="audio0007" clipBegin="00:00:01.541" clipEnd="00:00:02.599"/>
</par>
<par id="tcp0008" class="p">
<text src="nativemathml.xml#cn0008" id="tx0008"/>
<audio src="main.mp3" id="audio0008" clipBegin="00:00:13.172" clipEnd="00:00:18.271"/>
</par>
<seq id="math0002" class="mathExt" end="DTBuserEscape;math-par2.end">
<par id="math-par2">
<text src="nativemathml.xml#math0002" type="http://www.w3.org/1998/Math/MathML"
id="mml0002"/>
<audio src="nativemathml0002.mp3" id="math-audio0002" clipBegin="00:00:00.070"
clipEnd="00:00:01.880"/>
</par>
</seq>
<par id="tcp0009" class="p">
<text src="nativemathml.xml#cn0009" id="tx0009"/>
</par>
</seq>
</body>
</smil>
In this example of a NCX file, a navList
has been created that contains a collection of pointers to mathematical
equations within the DTB. The navList
itself has been given the textual label "Equations" to summarize the
overall nature of the collection to the end user. Each navTarget within the navList has a more detailed label.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN"
"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx version="2005-1" xmlns="http://www.daisy.org/z3986/2005/ncx/">
<head>
<smilCustomTest id="pagenum" defaultState="true" override="visible"
bookStruct="PAGE_NUMBER"/>
<meta name="dtb:uid" content="DAISY-MathML-Example-1" />
<meta name="dtb:depth" content="1" />
<meta name="dtb:generator" content="gh DTB 3.0" />
<meta name="dtb:maxPageNumber" content="2" />
<meta name="dtb:totalPageCount" content="2" />
</head>
<docTitle><text>title</text></docTitle>
<docAuthor><text>author</text></docAuthor>
<navMap>
<navPoint id="cn0003" playOrder="1">
<navLabel>
<text>A math example part one</text>
</navLabel>
<content src="nativemathml.smil#tcp0003" />
</navPoint>
</navMap>
<pageList id="pagenums" >
<navLabel>
<text>pagenum</text>
</navLabel>
<pageTarget id="p1" playOrder="2" type="normal">
<navLabel>
<text>1</text>
</navLabel>
<content src="nativemathml.smil#tcp0004" />
</pageTarget>
<pageTarget id="p2" playOrder="4" type="normal">
<navLabel>
<text>2</text>
</navLabel>
<content src="nativemathml.smil#tcp0007" />
</pageTarget>
</pageList>
<navList id="Equations" >
<navLabel>
<text>Equations</text>
</navLabel>
<navTarget id="math0001" playOrder="3">
<navLabel>
<text>Block-level Expression</text>
</navLabel>
<content src="nativemathml.smil#math0001" />
</navTarget>
<navTarget id="math0002" playOrder="5">
<navLabel>
<text>In-line Expression</text>
</navLabel>
<content src="nativemathml.smil#math0002" />
</navTarget>
</navList>
</ncx>
Within the SMIL namespace, resources in two languages have
been provided for segments of the SMIL presentation that reference MathML
content. The mapping of the resources to SMIL is made using the value of the class attribute on the SMIL seq element.
To associate a resource directly with the MathML islands within the
DTBook document, the resource file author has also provided one resource
within the MathML namespace scope.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE resources PUBLIC "-//NISO//DTD resource 2005-1//EN"
"http://www.daisy.org/z3986/2005/resource-2005-1.dtd">
<resources xmlns="http://www.daisy.org/z3986/2005/resource/" version="2005-1">
<scope nsuri="http://www.w3.org/2001/SMIL20/">
<nodeSet id="ns004" select="//seq[@class='mathExt']">
<resource xml:lang="en" id="r010">
<text>mathematical formula</text>
</resource>
</nodeSet>
</scope>
<scope nsuri="http://www.w3.org/1998/Math/MathML">
<nodeSet id="m1" select="//math">
<resource xml:lang="en" id="rm001">
<text>mathematical formula</text>
</resource>
</nodeSet>
</scope>
</resources>
The XSLT file transforms the DTBook file for visual players
that are not enhanced to support MathML. The transform for the DTBook file
extracts the altimg attribute of the math element and produces an imggroup element with an img element inside of it.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns="http://www.daisy.org/z3986/2005/dtbook/">
<xsl:output method="xml" indent="no" encoding="UTF-8"
doctype-public="-//NISO//DTD dtbook 2005-2//EN"
doctype-system="http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction() | comment()">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="m:math">
<xsl:variable name="img_id" select="concat('img_',generate-id())"/>
<xsl:variable name="group_id" select="concat('imggroup_',generate-id())"/>
<imggroup>
<xsl:attribute name="id"><xsl:value-of select=" $group_id "/></xsl:attribute>
<xsl:attribute name="smilref">
<xsl:value-of xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
select="@dtbook:smilref"/></xsl:attribute>
<img>
<xsl:attribute name="id"><xsl:value-of select=" $img_id "/></xsl:attribute>
<xsl:attribute name="src"><xsl:value-of select="@altimg"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="@alttext"/></xsl:attribute>
</img>
<prodnote render="optional">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="imgref"><xsl:value-of select=" $img_id "/></xsl:attribute>
<xsl:value-of select="@alttext"/>
</prodnote>
</imggroup>
</xsl:template>
</xsl:stylesheet>
STATUS: Approved DAISY Modular Extension – 23 February, 2007
ERRATA version – Updated 15 April 2008
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec-errata-2008-v3.html