DAISY Consortium Logo - Link to Home Page

Specification for athe Digital Talking Book Modular Extension for Mathematics

STATUS: Approved DAISY Modular Extension – 23 February, 2007

STATUS: DAISY 3 Modular Extension for MathML, approved 23 February, 2007.
DAISY 3 is officially the DAISY/NISO Z39.86 Specifications for the Digital Talking Book.


This version:
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec.html
http://www.daisy.org/projects/mathml-in-daisy-spec-errata-markup.html(last modified 2008-09-24)
This document records known errors in the document:
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec.html
Previous version:
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec-old.html
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec-v1.0.html
First Public Draft :
http://www.daisy.org/projects/mathml/mathml-in-daisy-spec-draft1.html
Editors:
Neil Soiffer, Chair – Design Science, Inc.
Kathy Kahl – DAISY Consortium

Conventions

Added text marked Added text. Removed text marked Removed text.

Copyright Notice

All content of the DAISY Structure Guidelines is licensed for others to copy, distribute, and display only verbatim copies. No changes may be made and no derivative works based upon it.
Copyright © by the DAISY Consortium, Creative Commons License: No Derivative Works

Table of Contents


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:

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.

MathML Modular Extension Working Group Members

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

Acknowledgements

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.

Section 1: General Information

Section 1.1: Purpose and Scope of this Extension

(This section is informative.)

The Z39.86-2005 sStandard does not have a method for including mathematics in a document other than via images with alt tagstext. However section 4.2.2 of the sStandard does define how modular extensions can be added to the sStandard. 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.

Section 1.2: Definitions

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

Accessible
Fully usable by the target population.
Advanced MathML 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.
Basic MathML 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.
DTB
The Digital Talking Book content data set that complies with the specifications in the Z39.86-2005 sStandard.
DTBook
An XML element set (dtbook.dtd) that defines the markup for the textual content of a DTB.
DTD
The Document Type Definition file contains machine- and human-readable rules that define allowable XML markup for a particular application.
FIXED
When used in definitions of XML element attributes, means that the attribute has a single, fixed value specified in the DTD. See IMPLIED.
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.
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.
IDPF
International Digital Publishing Forum [IDPF] formerly 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 sStandard uses a subset (the Package File) of that specification.
IMPLIED
When used in definitions of XML element attributes, means that the attribute is optional and that no default value is supplied. See FIXED.
Informative
Supplying background or explanation. Contrast with Normative.
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.
Manifest
A component of the Package File, the Manifest lists all files included in the DTB.
Math island
An instance of MathML in the DTBook.
MathML
The Mathematical Markup Language [MathML] is a W3C recommendation (MathML 2.0) used in this modular extension to encode mathematical content.
MathML-extended DTB
A DTB that includes MathML that conforms to this modular extension.
MathML-unaware player
A DTB reading system that does not understand the math tag or support the fallback behavior specified in this document.
May
In normative sections, the word may means that a course of action is optional.
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.
Namespace
XML namespaces provide a simple method for qualifying element and attribute names used in XML documents by associating them with namespaces identified by URI references.
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.
Normative
Setting forth requirements that must be met to establish conformance with this modular extension; 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 modular extension. Contrast with Informative. Notes within a normative section may be informative.
OPF
Open eBook Forum Package File. See Package File.
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.
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.
Playback System
The hardware/software platform that renders the contents of a DTB to a reader. Synonymous with Player.
Player
See Playback System.
Reader
The person reading the digital talking book. Synonymous with User.
Shall
See Must.
Should
In normative sections, the word should means that a course of action is recommended but not required.
SMIL
The Synchronized Multimedia Integration Language [SMIL] is a W3C recommendation (SMIL 2.0) used in the Z39.86-2005 standard to control the synchronized presentation of content in multiple media.
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.
User
See Reader.
XML
The Extensible Markup Language [XML] is a standardized language for marking up files containing structured information.
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.
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:

This extension makes use of the Z39.86-2005 specifications and DTDs and does not modify that specification. Neither does this extension modify the MathML specification, although some constraints are placed upon the MathML. See Section 1.4.2: Relationship to MathML for details. Avoiding changes to the MathML specification means current MathML authoring and rendering tools will work without modification for Z39.86-2005 content that contains mathmath islands.

The third principle (providing a solution for players that are not currently aware of extensions) was the moremost difficult principle to satisfy. There will always be players that do not implement a mathMathML extension. The proposed extension provides a mechanism for Basic MathML players to present a simple prepared presentation with an image, alt-textalternative 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 convert the MathML into braille math codes such as LAMBDA, Nemeth, Marburg, and LaTeX.

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

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 the MathML specification, 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.

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 modular extension will be maintained at http://www.daisy.org/z3986/modular/.

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; if MathML is not present, then the metadata must not indicate that it is present. Metadata is also used to direct visual players that do not support MathML to apply XSLT included in a package file to the DTBook file. See Section 3: 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 Section 4: 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 Section 5: 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 Section 6: 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 Section 8: Resource 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.

Section 3: Publication Metadata

Section 3.1: Requirements for Metadata

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

Section 3.2: Uses of Metadata

(This section is informative.)

Section 3.2.1: Notification that DTB 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.2.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 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 generate synthesized speech from the alttext attributes given in the MathML. Typically, the XSLT transforms these two attributes and its content into an imggroupimagegroup for rendering as non-extended DTB content, although options are possible.

Section 3.2.3: Uses of Metadata in Other Extensions

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.

Section 3.2.4: Multimedia Content

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.

Section 3.3: Manifest

(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/xslt+xml".

If the DTB does not include MathML, these entries must not be present.

Section 4: Content Format for Text

Section 4.1: Requirements for Including MathML

(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 top level 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. The math element must also include a dtbook:smilref attribute that references the corresponding element in the SMIL file. Note that this attribute must be in the dtbook namespace.

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.

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//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'">
 ]
>

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 Each math island'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>&#x2211;</m:mo>
            <m:mrow>
              <m:mi>i</m:mi><m:mo>=</m:mo><m:mn>0</m:mn>
            </m:mrow>
            <m:mi>&#x221E;</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 requires 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 A math island 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 advanced MathML players in the marketplace.

Synchronization of math has the following form in the SMIL file:

<seq ...>
  <par ...>
    <text src="..." type="http://www.w3.org/1998/Math/MathML" .../>
    <audio src="..." />
  </par>
</seq>

The text element points to the MathML math island 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 the domain of 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 a math island.

Advanced and basic visual players that process math elements math islands 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 other options are possible.

An img element is not used in a SMIL container that references a math element math island. Similarly, an img element is not used to to reference an imggroup element in the DTBook file that was generated by an XSLT transform as a replacement for a math 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).

Section 5.2: Using the SMIL Element Set for Math Expressions

(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 Its src attribute must be used to point to the MathML element math island 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 elementmath island. It is strongly recommended that all math element math islands in the DTBook file be referenced in the SMIL file. This follows the recommendation in section 7.2 of the z39.86-2005 specification.

The audio element is optional. If it is included, the src attribute of the audio element refers to the corresponding audio file.

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 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 MathMLmath islands are escapable, a Resource File entry must be supplied for them. See Section 8: 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 Appendix 3.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 elementmath island in the DTBook. Its type mathelement attribute 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 math island. 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.

An example is found in Appendix 3.4: NCX File.

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 MathMLthe math island. 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 mathMathML is left to players, the ability of players to bookmark within mathmath islands 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" 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>

A full example is given in Appendix 3.5: Resource File.

Section 9: Content Rendering

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

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

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.

Four 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:
    <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>
    

Section 11: References to Other Specifications/Documents

Section 11.1: Normative References

(This section is normative.)

Section 11.2: Informative References

(This section is informative.)

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

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 link on the DAISY Web site, http://www.daisy.org/, specifying "MathML in DAISY".

Appendix 3: Full Example

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

  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-examples.zip.

Appendix 3.1: Package File

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.opf"
      id="opf"
      media-type="text/xml"/>
    <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="resource"
      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/xslt+xml" />
    <item href="nativemathml0001.mp3"
      id="MP3_1"
      media-type="audio/mpeg" />
    <item href="nativemathml0002.mp3"
      id="MP3_2"
      media-type="audio/mpeg" />
    <item href="main.mp3"
      id="MP3_4"
      media-type="audio/mpeg" />
    <item href="pagenum.mp3"
      id="MP3_5"
      media-type="audio/mpeg" />
  </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 contained in this file and math is not math contained in an external file as is the case for images.

The MathML math island 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. When math can occur the math island occurs in an inline context; , references to the end of the math math island 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>&#x2211;</m:mo>
                <m:mrow>
                  <m:mi>i</m:mi><m:mo>=</m:mo><m:mn>0</m:mn>
                </m:mrow>
                <m:mi>&#x221E;</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>

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, itThe audio element, if present, 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>

Appendix 3.4: NCX File

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" value="1">
      <navLabel>
        <text>1</text>
      </navLabel>
      <content src="nativemathml.smil#tcp0004" />
    </pageTarget>
    <pageTarget id="p2" playOrder="4" type="normal" value="2">
      <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>

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 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.daisy.org/z3986/2005/ncx/">
    <nodeSet id="ns000" select="//smilCustomTest[@bookStruct='Page_Number']">
      <resource xml:lang="en" id="n001">
        <text>page</text>
      </resource>
    </nodeSet>
  </scope>
  <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>

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/">

<!-- MathML-in-DAISY fallback transform 2007-09-28
  created by gh, LLC and ViewPlus Technologies for DAISY Consortium -->
  
  <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="*">
    <!-- Create a new element instead of copying source. 
    Prevents the processor from copying unnecessary namespace nodes from old to new. -->
    <xsl:copy>
    <xsl:element name="{name()}" namespace="{namespace-uri()}" >
 	<xsl:copy-of select="@*"/>
 	<xsl:apply-templates />
    </xsl:element>
    </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())"/>
	
	<!-- Create a new element instead of copying source.
		Prevents the processor from copying unnecessary namespace nodes from old to new. -->

    <imggroup>		
	<xsl:element name="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>
	  
	  <!-- Create a new element instead of copying source.
		  Prevents the processor from copying unnecessary namespace nodes from old to new. -->
	
      <img>	  
	  <xsl:element name="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>
	  </xsl:element>
      </img>
	  
	  <!-- Create a new element instead of copying source. 
		  Prevents the processor from copying unnecessary namespace nodes from old to new. -->
		 
	 <prodnote render="optional">
	  <xsl:element name="prodnote">
		<xsl:attribute name="render">required</xsl:attribute>
		<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
		<xsl:attribute name="imgref"><xsl:value-of select=" $img_id "/></xsl:attribute>
		<xsl:attribute name="smilref"><xsl:value-of xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/" select="@dtbook:smilref"/></xsl:attribute>
		<xsl:value-of select="@alttext"/>
	  </xsl:element>
    </xsl:element>
	 </prodnote>
    </imggroup>
  </xsl:template>
</xsl:stylesheet>