Specification for a Digital Talking Book Modular Extension for Mathematics

STATUS: DRAFT – 8 September 2006

Editor's Note: unfinished portions are highlighted and marked with [XXX] for easy reference.

Foreword

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:

o        Encourage developers of intelligent reading systems to incorporate support for mathematics as a separate reading mode. A reading system would encounter mathematics and enter into a separate reading mode that enabled the user to explore the mathematics in rich and innovative ways. The working group believes that this intelligent presentation of the mathematics has the greatest potential to deliver a rich experience for the end user.

o        Enable simple playback hardware to present a predefined audio rendering of the mathematics. This means that a player that does not understand mathematics would still be able to play one rendering of the mathematics. These players would not be considered to be mathematics aware, but could present whatever prepared presentation the producer provided.

o        Enable software players that are not mathematics aware to transform the MathML without much difficulty so that an image of the mathematics and a text rendering would be easily presented. These software reading systems would need to be aware that mathematics is present and perform the transformation, but the reading system would still only provide the prepared rendering.

o        Allow producers to create MathML content within the DAISY XML framework and then allow software to generate the needed image, text, and audio renderings.

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:

o        The best presentation is ultimately provided by intelligent reading systems that incorporate an interactive reading experience to the end user.

o        The techniques that might be used would put a much larger burden on the producer, which we thought was poor design.

o        The techniques would confuse the marketplace and slow down the development of intelligent reading systems.

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.

MathML Modular Extension Working Group Members

The following members of the working group took an active role in developing this standard:

o        John Gardner (Oregon State University; ViewPlus Technologies, Inc.)

o        Markus Gylling (DAISY; Swedish Library of Talking Books and Braille)

o        George Kerscher (DAISY; RFB&D)

o        Dennis Leas (gh LLC)

o        Emilia Persoon (Dedicon Netherlands)

o        Neil Soiffer (Design Science, Inc.)

o        Jonathan Williford (gh LLC)

Acknowledgements

The Working Group gratefully acknowledges the substantial contributions made by the following individuals to the continuing development of the standard.

[XXX]???

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.

Section 1: General Information

Section 1.1: Purpose and Scope of Standard

(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 been working on 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:

o        inability to magnify the image or change its colors

o        fixed speech (based on alt text) that can not be tailored to an individual's needs

o        no local navigation and exploration of the mathematical structure

o        no synchronized highlighting of speech

o        inability to be translated to a braille math code

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 modular extension is meant to encourage players to implement a MathML solution natively to provide a rich experience when reading mathematics. However, the standard 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 a MathML-aware player could provide. Such a player could allow a user to explore the structure of the expression without having to listen to the expression in its entirety. For players that do not support MathML, an alternate image is provided as part of the MathML. MathML-unaware 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.

Section 1.2: Definitions

(This section is normative.)

The following abbreviations, acronyms, phrases, and terms are used in this standard as defined below. In the following definitions and throughout the standard, bracketed items correspond to entries in "References to Other Specifications/Documents," where the full URL is provided for each reference.

o        Accessible –Fully usable by the target population.

o        DTB –The Digital Talking Book content data set that complies with the specifications in this standard.

o        DTBook – An XML element set (dtbook.dtd) that defines the markup for the textual content of a DTB.

o        DTD – The Document Type Definition file contains machine- and human-readable rules that define allowable XML markup for a particular application.

o        FIXED– When used in definitions of XML element attributes, means that the attribute has a single, fixed value specified in the DTD. See IMPLIED.

o        Fragment Identifier – A means to address a named place in a document. For reference within the current document, the reference part is to a named target and begins with "#". See URI for addressing into another document.

o        Global navigation – Movement to user-selected portions of a document, with that movement enabled by the NCX. Navigation targets may be headings representing the hierarchical structure of the document or specific points such as pages, notes, sidebars, etc.

o        IMPLIED – When used in definitions of XML element attributes, means that the attribute is optional and that no default value is supplied. See FIXED.

o        Informative – Supplying background or explanation. Contrast with Normative.

o        Local navigation – Movement within a document at a granularity finer than that provided by the NCX. For example, navigation by paragraph or sentence, or within a table or nested list. Precise local navigation can be controlled by the textual content file or the SMIL file(s); the granularity is limited by the degree to which the textual content file has been marked up or the level to which synchronization has been applied in the SMIL file(s). Time-based movement through a document (e.g., fast-forward and rewind as on an analog cassette, or time jumps by specified intervals) may also be implemented.

o        Manifest – A component of the Package File, the Manifest lists all files included in the DTB.

o        MathML – The Mathematical Markup Language [MathML] is a W3C recommendation (MathML 2.0) used in this standard to encode mathematical content.

o        MathML-aware player – A DTB reading system that has incorporated native understanding of MathML structures and semantics, and is able to render and navigate within the MathML content intelligently.

o        MathML-unaware player – A DTB reading system that has not incorporated native understanding of MathML structure and semantics. This reading system relies on fallbacks to provide an alternate rendering to the user.

o        May – In normative sections, the word may means that a course of action is optional.

o        Must – In normative sections, the word must is to be interpreted as a mandatory requirement on the content or implementation. The term shall has the same definition as must.

o        NCX – The Navigation Control file for XML (NCX) applications provides the reader efficient and flexible access to the hierarchical structure of a DTB as well as direct access to selected elements such as page numbers, notes, figures, etc.

o        Normative – Setting forth requirements that must be met to establish conformance with this standard; or providing recommendations or optional courses of action. For recommended or optional features, conformance is not dependent on the fact of implementation, but, if implemented, that implementation is as prescribed in this standard. Contrast with Informative. Notes within a normative section may be informative.

o        OEBF – The Open eBook Forum [OEBF] is an organization formed to create and maintain standards and promote the successful adoption of electronic books. The Open eBook Publication Structure Version 1.2 provides a specification for representing the content of a book when it is converted from print to electronic form. This DTB standard uses a subset (the Package File) of that specification.

o        OPF – Open eBook Forum Package File. See Package File.

o        Package File – The Open eBook Forum Package File (OPF) is an XML file conforming to the oebpkg12.dtd that contains administrative information about the DTB, the files that comprise it, and how these files interrelate.

o        Playback – With regard to implementations, playback refers to the methods used to render the DTB content. Playback may include audio, Braille, large print, and synthetic speech as appropriate for the content and as supported by the playback system.

o        Playback System – The hardware/software platform that renders the contents of a DTB to a reader. Synonymous with Player.

o        Player – See Playback System.

o        Reader – The person reading the digital talking book. Synonymous with User.

o        Shall – See Must

o        Should – In normative sections, the word should means that a course of action is recommended but not required.

o        SMIL – The Synchronized Multimedia Integration Language [SMIL] is a W3C recommendation (SMIL 2.0) used in this standard to control the synchronized presentation of content in multiple media.

o        URI – A Uniform Resource Identifier is a compact string of characters for identifying resources: documents, images, audio files, etc. Within a DTB, URIs are most likely to appear as attribute values for various XML elements, used as a way of identifying other documents or files either in whole or part. For the purposes of this specification, URIs must adhere to the syntax defined in RFC 2396 [RFC 2396]. A URI may include a fragment identifier suffix beginning with "#" that matches some named anchor in the target document. See Fragment Identifier.

o        User – See Reader.

o        XML – The Extensible Markup Language [XML] is a standardized language for marking up files containing structured information.

o        XSL – The Extensible Stylesheet Language is a series of recommendations by the Worldwide Web Consortium that describes how XML documents can be transformed and rearranged [XSLT], then formatted [XSL] for screen, handheld device, paper, or audio presentation.

o        XSLT – A language for transforming XML documents into other XML documents. [XSLT] is designed for use as part of XSL. See XSL.

Section 1.3: Strategy

(This section is informative.)

The Math Working Group's approach to a solution was governed by the following principles:

o        Any solution must follow the Z39.86-2005 specifications

o        Any solution should not require modification of another standard (MathML in this instance)

o        Any solution should have an easy transition path/fallback for players that currently are not aware of extensions

o        Any solution should be able to be generalized to other extensions

o        Any solution should extend to working with schemas when they replace DTDs in a future version of Z39.86

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 additional constraints are recommended.  See 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 don't implement a math extension. The proposed extension provides a mechanism for non-MathML-aware players to present a simple prepared presentation. Players that are able to display MathML visually and/or with audio can provide enhanced capabilities such as local navigation and synchronized highlighting. In addition, MathML-aware players or braille producers can create braille math codes 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 DTBook 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 DTBooks with MathML in them.  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 MathML-aware reading system in the marketplace.

Section 1.4: Relationship to Other Specifications

Section 1.4.1: Relationship to Unicode

(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.

Section 1.4.2: Relationship to MathML

(This section is informative.)

This modular extension does not modify MathML. This standard is based on MathML 2. It is expected that future versions of MathML 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. These two attributes are required for this extension so that players that do not support MathML can still render the math.

Section 1.5: Patent Rights

(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.

Section 1.6: Maintenance Agency

(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 standard will be maintained at http://www.daisy.org/z3986/2005/extensions/MathML/errata.html.

Section 2: Overview

(This section is informative.)

To include MathML in a document, the following parts of the document require additions:

1.      The package file – metadata must be added to indicate the presence of MathML in the DTBook file. Metadata is also used to direct visual players that don´t support MathML to apply XSLT included in a package file to the DTBook file. See Publication Metadata for more information.

2.      The DTBook file – the DTBook file contains two additions. The first is that the DTBook DTD is extended to allow MathML to be included in the document. The second addition is the actual math content. The math is encoded in MathML. See Content Format for Text for more information.

3.      The SMIL file – the SMIL file contains information for synchronization. The MathML is referenced using a 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 Synchronization of Media Files for more information.

4.      The NCX file – math books often have numbered math equations, theorems, and/or lemmas. These should be part of the navList along with figures, tables, etc. See Navigation Control File for more information.

5.      The Resource file – the resource file assists the player by providing an appropriate message for skippable structures. See Resource File for more information.

6.      The XSLT file – this 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, this appendix provides an example implementation.

Section 3: Publication Metadata

(This section is normative.)

The following two metadata entries shall be present in the DTB package file in any conforming DTBook that includes mathematics:

<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="file.xslt" />

Only the filename ("file.xslt") may differ from the name used above.

Section 3.1: Uses of Metadata

(This section is informative.)

Section 3.1.1: Notification that DTBook Contains an Extension

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.

Section 3.1.2: Notification of XSLT File

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.

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 present the altimg and the alttext attributes given in the MathML. The XSLT transforms these two attributes and its content into an imagegroup for rendering as non-extended DTBook content.

Section 3.1.3: Multimedia Content

dtb:multimediaContent is a required metadata entry in a conforming DTBook 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.

Section 3.2: Manifest

(This section is informative.)

In addition to the files that are part of a standard DTBook, the XSLT file must be listed in the package file along with the DTD that has been extended to include MathML.

Section 4: Content Format for Text

Section 4.1: Requirements for Including MathML

(This section is normative.)

Section 4.2.2 of the DTBook 2005 specification provides a means to extend DTBook to include math and other content. This extension utilizes the mechanisms in that section and subsequent errata. To be compliant with this specification, a text content file of a DTBook must be a valid XML file conforming to the dtbook-2005-2.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 should appear inside of an annotation-xml element inside of a semantics element.

Section 4.2: MathML Extension of the DTD

(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+mathml//EN" "dtbook-2005-2.dtd" [
   <!ENTITY % MATHML.prefixed "INCLUDE" >
   <!ENTITY % MATHML.prefix "m">
   <!ENTITY % MATHML.Common.attrib
          "xlink:href    CDATA       #IMPLIED
          class          CDATA       #IMPLIED
          style          CDATA       #IMPLIED
          id             ID          #IMPLIED
          xref           IDREF       #IMPLIED
          other          CDATA       #IMPLIED
          xmlns:dtbook   CDATA       #IMPLIED
          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'">
  <!ENTITY ApplyFunction "&#02061;">
 ]
>

Section 4.3: Using MathML in the DTBook Element Set

 

(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. It 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. Eg, here is an excerpt of an XML file:

<m:math id="math001" dtbook:smilref="example1.smil#math001"
        altimg="example1-001.png" alttext="f of x">
  <m:mrow>
    <m:mi> f </m:mi>
    <m:mo> &ApplyFunction; </m:mo>
    <m:mrow>
      <m:mo> ( </m:mo>
      <m:mi> x </m:mi>
      <m:mo> ) </m:mo>
    </m:mrow>
  </m:mrow>
</m:math>

The math tag is required to include the altimg and alttext attributes.  These attributes specify an image to use for visual players that don't support MathML and text to use for audio players that do not make use of the audio file referenced by the SMIL file.

The math root can be placed as a block element or an inline element.

Section 5: Synchronization of Media Files

Section 5.1: Introduction

(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 MathML-aware reading system 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.

Visual players that are MathML-aware will either render the MathML or use the image file referenced in the math element pointed to by the text element. Visual players that are not capable of handling MathML should have first applied the XSLT transform indicated in the metadata. This transform changes the MathML in the DTBook into an imggroup.

Section 5.2: Using the SMIL Element Set for Math Expressions

(This section is normative.)

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 image element can not be used because the image is not part of the XML file and would inappropriately be shown in addition to the image generated from the MathML.

Section 5.3: Escapable Structures

(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 such 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 the reference MathML are escapable, a Resource File entry must be supplied for them. See the section on Resource Files for more details.

Section 5.4: Math Expression SMIL Example

(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 an Appendix.

<seq id="math0001" class="mathExt" end="DTBuserEscape;math-par001.end">
  <par id="math-par001">
    <text src="example1.xml#math0001"
      type="http://www.w3.org/1998/Math/MathML" id="mml0001"/>
    <audio src="example1.mp3" id="math-audio0001"
      clipBegin="00:00:00.000" clipEnd="00:00:01.000"/>
  </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.

 

Section 6: Navigation Control File

(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

Section 7: Portable Bookmarks and Highlights

Section 7.1: Player Behavior

(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 MathML-aware 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.

Section 7.2: Portable Bookmarks in MathML

(This section is normative)

This specification does not change the use and format of portable bookmarks and highlights.

Section 8: Resource File

Section 8.1: Resource File Requirements

(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.

Section 8.2: Resource File Example

(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" xml:lang="en" id="r010">
      <text>mathematical formula</text>
      <audio src="formula.wav"/>
    </resource>
    <resource xml:lang="sv" id="r011">
      <text>matematisk formel</text>
      <audio src="matte.wav"/>
    </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" xml:lang="en" id="rm001">
      <text>mathematical formula</text>
      <audio src="formula.wav"/>
    </resource>
 </nodeSet>
</scope>

Section 9: Content Rendering

(This section is informative)

MathML-aware 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 users 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.

Players that are not MathML-aware 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 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.

Visual players that are not MathML-aware need to either extract the altimg attribute of the math element and use that or apply the XSLT transform referenced in the metadata. (see 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. MathML-aware 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.

Section 10: Best Practices

(This section is informative)

Section 10.1: General Principles

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.

Section 10.1.1: Use Content MathML Only inside of a Semantics Element

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, MathML-aware 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 MathML-aware players.

This specification recommends 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. MathML-aware players that can make use of content MathML can use those elements as needed and other MathML-aware players can safely (and easily) ignore the content MathML.

Section 10.1.2: Avoid Character Entity Names

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.

Section 10.1.3: Avoid using the 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.

Section 10.2: Common Mistakes to Avoid

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.

Three common mistakes to watch out for are:

  1. Numbers are marked up incorrectly. For example, "1,000" is marked up as
    <mn>1</mn><mo>,</mo><mn>000</mn>
    instead of
    <mn>1,000</mn>
  2. Equations often describe physical phenomena and contain physical units related to time, distance, etc. The MathML working group issued a set of guidelines for units (http://www.w3.org/TR/mathml-units/). Use of these guidelines will help ensure that the units are displayed and spoken correctly.
  3. Multiple letter variables, such as "distance", are incorrectly marked up such that each letter is an independent variable (ie, each letter is inside of an mi element instead of the entire variable (<mi>distance</mi>)
  4. The superscript is attached to the right parenthesis instead of to the entire base.
    Wrong:
    <mo>(</mo> <mi>a</mi>
    <msup> <mo>)</mo> <mn>2</mn> </sup>

    Right:
    <msup>
    <mrow> <mo>(</mo> <mi>a</mi> <mo>)</mo> </mrow>
    <mn>2</mn>
    </sup>

A more complete list of common mistakes can be found at [XXX].

Section 11: References to Other Specifications/Documents

Section 11.1: Normative References

(This section is normative.)

o        Dublin Core – Dublin Core Metadata Initiative: http://dublincore.org/

o        DC-Type – Dublin Core Type Vocabulary: http://dublincore.org/documents/dcmi-type-vocabulary/

o        MathML – MathML 2.0 W3C Recommendation [Second Edition) 21 October 2003: http://www.w3.org/TR/2003/REC-MathML2-20031021/

o        NS – XML NameSpaces: http://www.w3.org/TR/REC-xml-names/

o        OEBF – The Open eBook Forum Publication Structure, version 1.2: http://www.openebook.org

o        RFC 2396 – Uniform Resource Identifiers (URI): Generic Syntax: http://www.ietf.org/rfc/rfc2396.txt

o        SMIL – SMIL 2.0 W3C Recommendation [Second Edition] 07 January 2005: http://www.w3.org/TR/2005/REC-SMIL2-20050107/

o        XML – XML Version 1.0: http://www.w3.org/TR/REC-xml/

o        XML-Namespaces – Namespaces in XML: http://www.w3.org/TR/REC-xml-names/

o        XSL – Extensible Stylesheet Language (XSL) Version 1.0: http://www.w3.org/TR/xsl/

o        XSLT – XSL Transformations (XSLT) Version 1.0: http://www.w3.org/TR/xslt

o        Z39.86-2005 – Specifications for the Digital Talking Book: http://www.daisy.org/z3986/2005/z3986-2005.html

Section 11.2: Informative References

(This section is informative.)

[XXX] Probably more references need to be added

DAISY – The DAISY Consortium: http://www.daisy.org

Appendix 1: Document Type Definitions (DTDs)

(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 standard 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/

Appendix 2: Designation of Maintenance Agency

(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 form found in the footer of the Web site, specifying Category "Project MathML in DAISY".

Appendix 3: Full Example

(This section is informative.)

This Appendix contains a small but complete example of a MathML-extended DTBook. With the exception of the XSLT file, all of the files are part of a normal DTBook distribution. The files listed in this appendix are:

1.      The package file

2.      The DTBook file

3.      The SMIL file

4.      The NCX file

5.      The Resource file

6.      The XSLT file

A zip file containing these files can be found at http://www.daisy.org/projects/MathML/MathMLExtension-draft1-examples.zip.

Appendix 3.1: Package File

The package contains administrative information about the DTBook as describe in the DTBook specification. As described in 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 Specification Example</dc:Title>
      <dc:Creator>DAISY MathML Working Group</dc:Creator>
      <dc:Publisher>DAISY</dc:Publisher>
      <dc:Date>2006-02-25</dc:Date>
      <dc:Format>ANSI/NISO Z39.86-2005</dc:Format>
      <dc:Identifier id="uid">uid</dc:Identifier>
      <dc:Language>en</dc:Language>
    </dc-metadata>
    <x-metadata>
      <meta name="dtb:totalTime" content="00:00:00"/>
      <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="dtbook.css"
      id="css001"
      media-type="text/css"/>
    <item href="nativemathml.png"
      id="img001"
      media-type="image/png" />
    <item href="mathml-fallback-transform.xslt"
      id="XSLT_0"
      media-type="text/xml" />
  </manifest>
  <spine>
    <itemref idref="s0001"/>
  </spine>
</package>

Appendix 3.2: DTBook File

The DTBook file is an XML file that contains the textual content of the book. The MathML is typically 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+mathml//EN" "dtbook-2005-2.dtd" [
   <!ENTITY % MATHML.prefixed "INCLUDE" >
   <!ENTITY % MATHML.prefix "m">
   <!ENTITY % MATHML.Common.attrib
          "xlink:href    CDATA       #IMPLIED
          class          CDATA       #IMPLIED
          style          CDATA       #IMPLIED
          id             ID          #IMPLIED
          xref           IDREF       #IMPLIED
          other          CDATA       #IMPLIED
          xmlns:dtbook   CDATA       #IMPLIED
          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'">
  <!ENTITY ApplyFunction "&#02061;">
 ]
>

<dtbook version="2005-2" xml:lang="en" xml:lang="en"
  xmlns="http://www.daisy.org/z3986/2005/dtbook/"
  xmlns:m="http://www.w3.org/1998/Math/MathML"
  >
 <head>
  <meta name="uid" content="uid"/>
  <meta name="dc:Title" content="nativemathml math example"/>
  <meta name="dc:Date" content="2006-06-29"/>
  <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="cn0002" smilref="nativemathml.smil#tcp0002">
     nativemathml math example
  </doctitle>
   <docauthor id="cn0001" smilref="nativemathml.smil#tcp0001">
     math-daisy-wg
   </docauthor>
  </frontmatter>
  <bodymatter>
   <level1>
    <h1 id="cn0003" smilref="nativemathml.smil#tcp0003">
      A math example part one
    </h1>
    <pagenum id="p1" page="normal" smilref="nativemathml.smil#tcp0004">
      1
    </pagenum>
    <p>
     <sent id="cn0004" smilref="nativemathml.smil#tcp0005">
       Following this dtbook para 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="nativemathml.png" alttext="f of x">
      <m:mrow>
        <m:mi> f </m:mi>
        <m:mo> &ApplyFunction; </m:mo>
        <m:mrow>
          <m:mo> ( </m:mo>
          <m:mi> x </m:mi>
          <m:mo> ) </m:mo>
        </m:mrow>
       </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 dtbook para following after the mathml island that
  uses the variable</span>
      <m:math xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
          id="math0002" dtbook:smilref="nativemathml.smil#math0002"
          altimg="nativemathml.png" alttext="f of x">
        <m:mi> x </m:mi>
      </m:math>
      <span id="cn0009" smilref="nativemathml.smil#tcp0009">.</span>
    </p>
   </level1>
  </bodymatter>
 </book>
</dtbook>

Appendix 3.3: SMIL File

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" "dtbsmil-2005-2.dtd">
<smil xmlns="http://www.w3.org/2001/SMIL20/">
  <head>
    <meta name="dtb:uid" content="uid"/>
    <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:01.000" id="mseq">
      <par id="tcp0001" class="docauthor">
        <text src="nativemathml.xml#cn0001" id="tx0001"/>
      </par>
      <par id="tcp0002" class="doctitle">
        <text src="nativemathml.xml#cn0002" id="tx0002"/>
      </par>
      <par id="tcp0003" class="h1">
        <text src="nativemathml.xml#cn0003" id="tx0003"/>
      </par>
      <par id="tcp0004" class="pagenum" customTest="pagenum">
        <text src="nativemathml.xml#p1" id="tx0004"/>
      </par>
      <par id="tcp0005" class="sent">
        <text src="nativemathml.xml#cn0004" id="tx0005"/>
      </par>
      <par id="tcp0006" class="sent">
        <text src="nativemathml.xml#cn0005" id="tx0006"/>
      </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:00.000" clipEnd="00:00:01.000"/>
        </par>
      </seq>
      <par id="tcp0007" class="pagenum" customTest="pagenum">
        <text src="dtbookmath.xml#p2" id="tx0007"/>
      </par>
      <par id="tcp0008" class="p">
        <text src="dtbookmath.xml#cn0008" id="tx0008"/>
      </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.000" clipEnd="00:00:01.000"/>
        </par>
      </seq>
      <par id="tcp0009" class="p">
        <text src="dtbookmath.xml#cn0009" id="tx0009"/>
      </par>
    </seq>
  </body>
</smil>

Appendix 3.4: NCX File

In this example, 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">
  <head>
    <meta name="dtb:uid" content="ghBOOK1149627926" />
    <meta name="dtb:depth" content="0" />
    <meta name="dtb:generator" content="gh DTB 3.0" />
    <meta name="dtb:maxPageNormal" content="2" />
    <meta name="dtb:pageFront" content="0" />
    <meta name="dtb:pageNormal" content="2" />
    <meta name="dtb:pageSpecial" content="0" />
  </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#cn0003" />
    </navPoint>
  </navMap>

  <navList id="Equations">
    <navLabel>
      <text>Equations</text>
    </navLabel>
    <navTarget id="math0001" playOrder="2">
      <navLabel>
        <text>Simple Function</text>
      </navLabel>
      <content src="nativemathml.smil#math0001" />
    </navTarget>
    <navTarget id="math0002" playOrder="3">
      <navLabel>
        <text>In-line Variable</text>
      </navLabel>
      <content src="nativemathml.smil#math0002" />
    </navTarget>
  </navList>

  <navList id="pagenum">
    <navLabel>
      <text>pagenum</text>
    </navLabel>
    <navTarget id="p1" playOrder="4">
      <navLabel>
        <text>1</text>
      </navLabel>
      <content src="nativemathml.smil#p1" />
    </navTarget>

    <navTarget id="p2" playOrder="5">
      <navLabel>
        <text>2</text>
      </navLabel>
      <content src="nativemathml.smil#p2" />
    </navTarget>
  </navList>
</ncx>

Appendix 3.5: Resource File

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" xml:lang="en" id="r010">
    <text>mathematical formula</text>
          <audio src="formula.wav" clipBegin="0s" clipEnd="1s"/>
  </resource>
        <resource xml:lang="sv" id="r011">
    <text>matematisk formel</text>
          <audio src="matte.wav" clipBegin="0s" clipEnd="1s"/>
      </resource>
    </nodeSet>
  </scope>

  <!-- Additional resources for native constructs are omitted from this example -->
  <scope nsuri="http://www.w3.org/1998/Math/MathML">
    <nodeSet id="m1" select="//math">
      <resource xml:lang="en" xml:lang="en" id="rm001">
        <text>mathematical formula</text>
        <audio src="formula.wav" clipBegin="0s" clipEnd="1s"/>
      </resource>
   </nodeSet>
  </scope>

</resources>

Appendix 3.6: XSLT File

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/" xmlns:smil="http://www.w3.org/2001/SMIL20/" exclude-result-prefixes="smil">

  <xsl:output method="xml" indent="no" encoding="UTF-8" />

  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="local-name(*)='dtbook'">
        <xsl:text disable-output-escaping="yes">
          <![CDATA[<!DOCTYPE dtbook PUBLIC "-//NISO//DTD dtbook 2005-2+mathml//EN_" "dtbook-2005-2.dtd">]]>
        </xsl:text>
      </xsl:when>
    </xsl:choose>
    <xsl:apply-templates />
  </xsl:template>

  <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 select="@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" showin="blp">
         <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>