<mathmlref>

Use the <mathmlref> element to reference a non-DITA XML document that contains MathML markup. This element enables you to use the markup by reference.

The reference must be to a MathML <math> element. The reference can be one of the following:

  • A URI that addresses an XML document; the XML document has a MathML <math> element as the root element
  • A URI that addresses an XML document and contains a fragment identifier that is the XML ID of a <math> element within the document

Processors SHOULD process the MathML as though the <m:math> element had occurred directly in the content of the containing <mathml> element.

The reference can be direct, using the @href attribute, or indirect, using the @keyref attribute. For indirect referencing, specify only the key name. Specify the ID of the <mathml> element as part of the value for the @href attribute on the key definition.

For example, to refer to the <math> element with the @id of "equation-02" within a larger document using a key reference, you would define the key in the following way:

<keydef 
  keys="mathml-equation-02" 
  href="math/mathml-equations.xml#equation-02"
  format="mathml"
/>
You would refer to this key using just the key name:
<mathml>
  <mathmlref keyref="mathml-equation-02"/>
</mathml>

Content models

See appendix for information about this element in OASIS document type shells.

Inheritance

+ topic/xref mathml-d/mathmlref

Example

Here is a reference to a <mathml> element that is the root element of its containing document:

<equation-block>
   <mathml>
     <mathmlref href="../mathml-source/mathml-root-mathml.mml"/>
   </mathml>
</equation-block>

The mathml-root-mathml.mml file contains the following content. Note that the <math> element sets the MathML namespace as the default namespace, so there are no namespace prefixes on the MathML markup:

<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML" 
        xmlns:xlink="http://www.w3.org/1999/xlink">
    <mstyle displaystyle="false" scriptlevel="0">
        <mrow>
            <mfrac>
                <mrow>
                    <mi mathcolor="gray">sin</mi>
                    <mo rspace="verythinmathspace">⁡</mo>                    
                    <mi>θ</mi>
                </mrow>
                <mi>π</mi>
            </mfrac>
        </mrow>
    </mstyle>
</math>

Here is a reference to a specific <math> element in a containing XML file:

<equation-block>
  <mathml>
    <mathmlref
       href="../mathml-source/mathml-equation-library.xml#mathfrag-02"
    />
  </mathml>
</equation-block>

The mathml-equation-library.xml file contains the following content:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <part>
    <math
      id="timeinday"
      xmlns="http://www.w3.org/1998/Math/MathML">
      <mi>x</mi>
    </math>
    <math
      id="mathfrag-02"
      xmlns="http://www.w3.org/1998/Math/MathML">
      <math>
        <mrow>
          <mi>y</mi>
          <mo>=</mo>
          <mn>5</mn>
          <mi>x</mi>
          <mo>+</mo>
          <mn>2</mn>
        </mrow>
      </math>
    </math>
  </part>
  <part>
    <m:math
      id="mathfrag-03"
      display="inline"
      overflow="scroll"
      xmlns:m="http://www.w3.org/1998/Math/MathML">
      <m:mi>y</m:mi>
      <m:mo>=</m:mo>
      <m:mi>m</m:mi>
      <m:mi>x</m:mi>
      <m:mo>+</m:mo>
      <m:mi>b</m:mi>
    </math>
  </part>
</root>

Attributes

The following attributes are available on this element: Universal attribute group, @outputclass, and @keyref. This element also uses @href, @scope, and a narrowed definition of @format (given below) from Link relationship attribute group.

@format
Specifies the format (data type) of the referenced resource. For MathML the format should be "mml", which is the default value for @format on this element.

Was this helpful?