Mathematical and Scientific Notations

1. Introduction
Described are some ideas about extending MathML to include XSLT functionality for transforming input semantic content into output presentational content.  An element, <notation>, is described and illustrations and examples are provided.  The functionality described herein can accompany the current version of the mathematical markup language or can supplement a next version.  Additionally, a sketch of an XSLT-enhanced XInclude is provided (see Appendix A).
1.1 XSL Transforms
XSLT describes transformations, rules for transforming a source tree into a resultant tree [XSLT10, XSLT20, XSLT21].  XSLT utilizes the syntax of its target language, XML, and can be viewed as a Turing-complete template processor.  For processing semantic content into presentational content, including from  mathematical semantic content to MathML presentational content, XSLT is often utilized.  XSLT-based approaches can facilitate modularity, configurability, notational conventions and the specialized notational practices of mathematical and scientific subfields.
1.2 XInclude
The XInclude specification describes a mechanism for merging XML documents to facilitate modularity [XINCLUDE10].
2. Syntax
2.1 The <notation> Element
2.1.1 Attributes
The class Attribute
The syntax of this attribute's value is a set of space-separated tokens.
The style Attribute
The syntax of this attribute's value is as defined by the CSS Styling Attribute Syntax specification [CSSATTR].
The present Attribute
The syntax of this attribute's value is as per that of the HTTP request header Accept [HTTP11, RFC4229].
The type Attribute
The syntax of this attribute's value is as per a MIME type [RFC2046].
The src Attribute
The syntax of this attribute's value is as per a URI [RFC3986].
The transform Attribute
The syntax of this attribute's value is as per a URI [RFC3986].
2.2 The <presentation> Element
2.3 The <data> Element
The <data> element combines aspects of MathML's <annotation> and <annotation-xml> elements [MATHML3] with HTML's <link> element [HTML5].  The <data> element has two contexts, semantic and presentational; a <data> element in in a <notation> element is in a semantic context unless within a <presentation> element.
2.3.1 Attributes
The type Attribute
The syntax of this attribute's value is as per a MIME type [RFC2046].
The q Attribute
The syntax of this attribute's value is a floating-point number ranging from 0 to 1.  The default value is q=1.  The attribute is valid on <data> elements in a presentational context [HTTP11, RFC4229].
The media Attribute
The syntax of this attribute's value is as per a valid media query [MQ].
The src Attribute
The syntax of this attribute's value is as per a URI [RFC3986].
The transform Attribute
The syntax of this attribute's value is as per a URI [RFC3986].
The input Attribute
The input attribute can reference semantic context <data> elements by id.
2.4 The <with-param> Element
Resembles XSLT's <with-param> element [XSLT10, XSLT20, XSLT21].
2.4.1 Attributes
The name Attribute
The syntax of this attribute's value is an XML qualified name [XMLNS].
The as Attribute
The syntax of this attribute's value is an XPath sequence type [XPATH10, XPATH20, XPATH30].
The tunnel Attribute
The syntax of this attribute's value is "yes" or "no" with a default value of "no".
The src Attribute
The syntax of this attribute's value is a URI [RFC3986].
2.5 The <extension> Element
2.5.1 Attributes
The name Attribute
The syntax of this attribute's value is an XML qualified name [XMLNS].
The as Attribute
The syntax of this attribute's value is an XPath sequence type [XPATH10, XPATH20, XPATH30].
The oncall Attribute
The syntax of this attribute's value is that of an event handler.
2.6 The <param> Element
Resembles XSLT's <param> element [XSLT10, XSLT20, XSLT21].
2.6.1 Attributes
The name Attribute
The syntax of this attribute's value is an XML qualified name [XMLNS].
The as Attribute
The syntax of this attribute's value is an XPath sequence type [XPATH10, XPATH20, XPATH30].
The required Attribute
The syntax of this attribute's value is "yes" or "no" with a default value of "no".
The tunnel Attribute
The syntax of this attribute's value is "yes" or "no" with a default value of "no".
The src Attribute
The syntax of this attribute's value is a URI [RFC3986].
3. Discussion
3.1 Client-Side XSL Transformations
In a presentational context, <data> elements can reference XSLT resources by means of their transform attributes.  The described <notation> system utilizes XSLT to transform mathematical and scientific semantic content into presentational content to be rendered by UA's.
While processing models resembling an XSLT-enhanced XInclude [XINCLUDE10] are possible (see Appendix A), the processing model described herein is one where <data> elements in both presentational and semantic contexts, their attribute values, contained text, XML content or referenced resources are utilized to arrive at resultant content which, in the output <notation> element, is rendered by a UA.
3.2 The Document Object Model and Cascading Stylesheets
The utilized, obtained, processed or otherwise resultant content, in the output <notation> element, is a part of the DOM structure of the resultant document and can be styled accordingly.  Attributes such as id, class and style are preserved between input and output <notation> elements.  An extension to the DOM is possible for traversing from the resultant or output <notation> node to the input <notation> node's XML DOM contents.
3.3 Multimedia Content
When resources are referenced with MIME types which describe neither text nor XML content, with regard to the content in resultant <notation> elements, for HTML5 scenarios [HTML5], "image/..." content can map to an an <img> element, "audio/..." can map to an <audio> element, and "video/..." can map to a <video> element.
3.4 UA Tables
Two UA Tables are described herein.  The following two tables provide for convenient and succinct syntax for document authors by providing situational default attribute values.
3.4.1. UA Table 1: Default Output Content Type for Input Content Types
UA Table 1 describes for content-related MIME types, default output or presentational MIME types.  For example, for mathematics-related content types (e.g. application/mathml-content+xml, application/openmath+xml) the default output MIME type could be application/mathml-presentation+xml, which facilitates layout scenarios including mathematics in sentences while interoperable with cascading stylesheets.  Table 1 describes default output content types for various input content types.
3.4.2. UA Table 2: UA Default XSLT Resources for Input and Output Content Type Pairs
UA Table 2 maps pairs of content types map to UA default XSLT resources.  While the transform attribute on the <data> element allows authors to specify XSLT resources, UA's can include default XSLT resources for pairs of input and output content types.
3.5 Client-Side XSL Transformations, Tunneling Parameters and HTTP Semantics
When processing XSLT for <notation> elements, and possibly for other XSLT from HTML scenarios, tunneling parameters can be passed to XSLT processing utilizing HTTP semantics [HTTP11] with HTTP vocabulary in RDF 1.0 [HTTP-RDF].
A <notation> element's present attribute value or otherwise a string assembled from presentational context <data> elements' type and q attributes (see Illustration B.4) can be passed to XSLT as a tunneling parameter named http://www.w3.org/2011/http-headers#accept .
Similarly, the values from lang attributes [BCP47] on, or from the document context of, presentational context <data> elements can be combined into a string value for a tunneling parameter named http://www.w3.org/2011/http-headers#accept-language .  The language value of the document context of the <notation> element can also be utilized to provide the http://www.w3.org/2011/http-headers#accept-language parameter value to XSLT.
The values from the media attributes, media queries [MQ], on <data> elements in a presentational context, or from the UA context, can be assembled together and passed as a tunneling parameter named http://www.w3.org/2011/http-headers#accept-features [RFC4229].
The text encoding of the document containing the <notation> element can be passed as a tunneling parameter named http://www.w3.org/2011/http-headers#accept-charset .
3.6 Client-Side XSL Transformations and Content Negotiation
Content negotiation topics include content negotiation between the UA and XSLT processors, between the UA and indicated input resources to XSLT processors, between XSLT processors, and HTTP content negotiation that may occur when XSLT processors request external resources.
3.7 Client-Side XSL Transformations, Scripting and Extension Functions
The <extension> and <param> elements describe a means of providing JavaScript functions to XSLT.   With regard to to XSLT processors, the availability of and interoperability with UA API's such as DOM, CSSOM, and XMLHttpRequest is topical.
3.8 JavaScript API
A JavaScript API can exist to provide functionality resembling XSLTHttpRequest, resembling and encapsulating the XMLHttpRequest API.  The XSLTProcessor API could version to include indicating JavaScript-interoperable extension objects.
3.9 The HTML <link> Element
With a link relation type, e.g. "notation", XSLT can be referenced by <link> elements [HTML5] into the processing context of document <notation> elements (see Example C.10).
Furthermore, alternate notations can be indicated with <link> elements having a rel attribute value such as "alternate notation" (see Example C.11).
3.10 Parallel Markup
MathML3 includes an annotational parallel markup system [MATHML3].  In the system described herein, parallel markup can be achieved and a means of navigating from resultant presentational DOM nodes to input content nodes is described in Section 3.2 .
While notational elements, in general, in documents are expressive, it often occurs that sets of such elements can be interrelated in semantic structures.  To indicate such semantic structures in documents, some existing techniques include RDFa [RDFA-CORE], the use of xref attributes between resources, and solutions where external XML resources can relate XML elements from multiple resources, for example SMIL [SMIL30].
3.11 Clipboarding, Drag and Drop and Interprocess Communication
As the input <notation> element contents are available to JavaScript (see Section 3.2), by means of that content, the rows of Table 2 (see Section 3.4), and custom notations (see Section 3.9), a UA can determine which formats it can place onto a DataTransfer for a <notation> item.  By adding a function, setDataProvider, to DataTransfer, computation can be deferred until paste or drop recipients request the data in particular data formats.  With such techniques, UA's can place all possible formats onto a DataTransfer for clipboarding, drag and drop and interprocess communication.
3.12 Advanced Mathematical and Scientific Presentational Markup Scenarios
With the XSLT processing of semantic content into presentational content as a supported scenario, it is possible that presentational markup can come to include even more advanced features and CSS interoperability that might have been otherwise cumbersome for manual markup authoring scenarios.
3.13 Multimodal Mathematical and Scientific Input
Means can be devised to obtain InkML [INKML] and SRGS/SISR [SRGS10, SISR10] content from notational contexts (see Sections 3.4 and 3.9) and/or semantic content; document authors should be able to include and users to make use of such content.
3.14 Natural Language Generation and Synthesis
Synthesis processors can utilize the MIME type "application/ssml+xml" and/or the media query of "speech" to obtain SSML [SSML] from <notation> elements (see Sections 3.4 and 3.9 and Examples C.7 and C.8).
4. Conclusion
The current version of the MathML syntax [MATHML3] utilizes an annotational system for parallel markup for both presentational and semantic content (see Section 3.10).  Adding XSLT interoperability to such a syntax exacerbates the dichotomy between input and output content, semantics and presentation.  While a <notation> syntax as described herein can accompany the current version of MathML's <math>, <semantics>, <annotation> and <annotation-xml> elements, if the MathML syntax were to version to include an element such as the <data> element, and did so in a manner so as to replace the <annotation> and <annotation-xml> elements, and, as the <math> element has thus far had a default presentational context, if the MathML <semantics> element were reinterpreted so as to create a semantic context inside of a <math> element, syntactic possibilities could resemble:

<notation>
  <presentation>
    <data type="application/mathml-presentation+xml">...</data>
  </presentation>
  <data type="application/mathml-content+xml">...</data>
</notation>


<math>
  <data type="application/mathml-presentation+xml">...</data>
  <semantics>
    <data type="application/mathml-content+xml">...</data>
  </semantics>
</math>

Furthermore, with the default content type for such a <math> element as "application/mathml-presentation+xml", such a syntax would be backwards compatible with traditional mathematical presentational markup scenarios.
5. References
5.1 Normative References

[BCP47] Tags for Identifying Languages; Matching of Language Tags. A. Phillips, M. Davis. IETF.
[CSSATTR] CSS Styling Attribute Syntax. T. Çelik, E. Etemad. W3C.
[HTML5] HTML5. Ian Hickson, David Hyatt. W3C.
[HTTP11] Hypertext Transfer Protocol — HTTP/1.1. R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, T. Berners-Lee. IETF.
[HTTP-RDF] HTTP Vocabulary in RDF 1.0. J. Koch, C. Velasco, P. Ackermann. W3C.
[MATHML3] Mathematical Markup Language (MathML). D. Carlisle, P. Ion, R. Miner, N. Poppelier. W3C.
[MIMESNIFF] MIME Sniffing. A. Barth, I. Hickson. WHATWG.
[MQ] Media Queries. H. Lie, T. Çelik, D. Glazman, A. van Kesteren. W3C.
[RFC2046] Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. N. Freed, N. Borenstein. IETF.
[RFC3986] Uniform Resource Identifier (URI): Generic Syntax. T. Berners-Lee, R. Fielding, L. Masinter. IETF.
[RFC4229] HTTP Header Field Registrations. M. Nottingham, J. Mogul. IETF.
[XML10] Extensible Markup Language (XML) 1.0 (Fifth Edition). T. Bray, J. Paoli, C. Sperberg-McQueen. W3C.
[XML11] Extensible Markup Language (XML) 1.1 (Second Edition). T. Bray, J. Paoli, C. Sperberg-McQueen. W3C.
[XMLNS] Namespaces in XML. T. Bray, D. Hollander, A. Layman, R. Tobin. W3C.
[XPATH10] XML Path Language (XPath) 1.0. J. Clark, S. DeRose. W3C.
[XPATH20] XML Path Language (XPath) 2.0. D. Chamberlin, A. Berglund, S. Boag. W3C.
[XPATH30] XML Path Language (XPath) 3.0. J. Robie, D. Chamberlin, M. Dyck, J. Snelson. W3C.
[XSLT10] XSL Transformations (XSLT) Version 1.0. J. Clark. W3C.
[XSLT20] XSL Transformations (XSLT) Version 2.0. M. Kay. W3C.
[XSLT21] XSL Transformations (XSLT) Version 2.1. M. Kay. W3C.

5.2 Informative References

[INKML] Ink Markup Language (InkML). Y. Chee, M. Froumentin, S. Watt. W3C.
[OPENMATH20] The OpenMath Standard Version 2.0. S. Buswell, O. Caprotti, D. Carlisle, M. Dewar, M. Gaëtano and M. Kohlhase. The OpenMath Society.
[OMDOC12] OMDoc - An Open Markup Format for Mathematical Documents Version 1.2. Michael Kohlhase.
[RDFA-CORE] RDFa Core 1.1: Syntax and Processing Rules for Embedding RDF through Attributes. B. Adida, M. Birbeck, S. McCarron, I. Herman. W3C. 
[SISR10] Semantic Interpretation for Speech Recognition. L. Van Tichelen, D. Burke. W3C.
[SMIL30] Synchronized Multimedia Integration Language (SMIL 3.0). D. Bulterman, J. Jansen, P. Cesar, et al. W3C.
[SRGS10] Speech Recognition Grammar Specification 1.0. A. Hunt, S. McGlashan. W3C.
[SSML11] Speech Synthesis Markup Language (SSML) 1.1. D.  Burnett, Z. Shuang. W3C.
[XINCLUDE10] XML Inclusions (XInclude) Version 1.0 (Second Edition). J. Marsh, D. Orchard, D. Veillard. W3C.

Appendix A. An XSLT-Enhanced XInclude
As described in Section 3.1, one of several approaches for an XSLT-Enhanced XInclude [XINCLUDE10] is sketched.
A.1 The <include> element
A.1.1 Attributes
The src Attribute
The href attribute is refactored to src to resemble the syntactic conventions above.  The syntax of this attribute's value is as per a URI [RFC3986].
The type Attribute
The syntax of this attribute's value is as per a MIME type [RFC2046].
The transform Attribute
The syntax of this attribute's value is as per a URI [RFC3986].
The xpath Attribute
The syntax of this attribute's value is an XPath expression [XPATH10, XPATH20, XPATH30].
A.2 The <fallback> Element
A.3 The <with-param> Element
See Section 2.4
A.4 The <extension> Element
See Section 2.5
A.5 The <param> Element
See Section 2.6
Appendix B. Illustrations
Utilizing UA Tables 1 and 2 (see Section 3.4) for the default values of some attributes, and UA default XSLT resources, the expressiveness of the <notation> system is illustrated.
In the following illustrations, the syntax "ua/default" intends to indicate the value in UA Table 1 for the corresponding input content type.  The syntax "uadefault.xslt", "uadefault1.xslt" and "uadefault2.xslt" intends to indicate the UA default XSLT resources, contextually, from UA Table 2.
In the following illustrations, an example HTTP server returns, in its HTTP response content type headers, "application/mathml-content+xml" for files of type ".mmlc" and "application/openmath+xml" for files of type ".om".
Illustration B.1


<notation>
  <presentation>
    <data type="ua/default" transform="uadefault.xslt" input="#content1" />
  </presentation>
  <data id="content1" type="application/mathml-content+xml">...</data>
</notation>


<notation>
  <presentation>
    <data type="ua/default" transform="uadefault.xslt" />
  </presentation>
  <data type="application/mathml-content+xml">...</data>
</notation>


<notation>
  <data type="application/mathml-content+xml">...</data>
</notation>


<notation type="application/mathml-content+xml">...</notation>


<notation>...</notation>


Illustration B.2


<notation>
  <presentation>
    <data type="ua/default" transform="uadefault.xslt" input="#content1" />
  </presentation>
  <data id="content1" type="application/mathml-content+xml" src="file.mmlc"/>
</notation>


<notation>
  <presentation>
    <data type="ua/default" transform="uadefault.xslt" />
  </presentation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation type="application/mathml-content+xml" src="file.mmlc" />


<notation src="file.mmlc" />


Illustration B.3


<notation>
  <presentation>
    <data type="ua/default" transform="custom.xslt" input="#content1" />
  </presentation>
  <data id="content1" type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <presentation>
    <data type="ua/default" transform="custom.xslt" />
  </presentation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation present="ua/default" transform="custom.xslt">
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation present="ua/default" transform="custom.xslt" type="application/mathml-content+xml" src="file.mmlc" />


<notation present="ua/default" transform="custom.xslt" src="file.mmlc" />


<notation transform="custom.xslt" src="file.mmlc" />


Illustration B.4


<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" q="0.9" transform="uadefault1.xslt" input="#content1"/>
    <data type="image/svg+xml" q="0.2" transform="uadefault2.xslt" input="#content1" />
  </presentation>
  <data id="content1" type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" q="0.9" transform="uadefault1.xslt" />
    <data type="image/svg+xml" q="0.2" transform="uadefault2.xslt" />
  </presentation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" q="0.9" />
    <data type="image/svg+xml" q="0.2" />
  </presentation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation present="application/mathml-presentation+xml;q=0.9, image/svg+xml;q=0.2">
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation present="application/mathml-presentation+xml;q=0.9, image/svg+xml;q=0.2" type="application/mathml-content+xml" src="file.mmlc" />


<notation present="application/mathml-presentation+xml;q=0.9, image/svg+xml;q=0.2" src="file.mmlc" />


Illustration B.5


<notation>
  <presentation>
    <data type="ua/default" transform="custom.xslt" input="#content1">
      <with-param name="namespace:param1" as="xs:string">text</with-param>
      <with-param name="namespace:param2" as="schema:type">
        <xml>
          <xml />
        </xml>
      </with-param>
    </data>
  </presentation>
  <data id="content1" type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <presentation>
    <data type="ua/default" transform="custom.xslt">
      <with-param name="namespace:param1" as="xs:string">text</with-param>
      <with-param name="namespace:param2" as="schema:type">
        <xml>
          <xml />
        </xml>
      </with-param>
    </data>
  </presentation>
  <data type="application/mathml-content+xml" src="file.mmlc" />
</notation>


<notation>
  <presentation>
    <data transform="custom.xslt">
      <with-param name="namespace:param1" as="xs:string">text</with-param>
      <with-param name="namespace:param2" as="schema:type">
        <xml>
          <xml />
        </xml>
      </with-param>
    </data>
  </presentation>
  <data src="file.mmlc" />
</notation>


<notation transform="custom.xslt" src="file.mmlc">
  <with-param name="namespace:param1" as="xs:string">text</with-param>
  <with-param name="namespace:param2" as="schema:type">
    <xml>
      <xml />
    </xml>
  </with-param>
</notation>


Appendix C. Examples
Example C.1
<notation src="file.om" />
Example C.2
<notation transform="custom.xslt" src="file.om" />
Example C.3

<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" src="file.mmlp" />
  </presentation>
</notation>

Example C.4

<notation>
  <presentation>
    <data type="model/x3d+xml" src="file.x3d" media="screen" />
    <data type="image/png" src="file.png" media="print" />
  </presentation>
</notation>

Example C.5

<notation>
  <presentation>
    <data type="model/x3d+xml" transform="3d.xslt" media="screen" />
    <data type="image/svg+xml" transform="svg.xslt" media="print" />
  </presentation>
  <data type="application/...+xml" src="..." />
</notation>

Example C.6

<notation>
  <presentation>
    <data type="image/svg+xml" q="0.9" transform="feynman-diagram.xslt" />
    <data type="image/png" q="0.2" src="file.png" />
  </presentation>
  <data type="application/...+xml">...</data>
</notation>

Example C.7

<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" media="screen, print" />
    <data type="application/ssml+xml" transform="synthesize.xslt" xml:lang="en" media="speech">
      <with-param name="namespace:param1" as="xs:string">text</with-param>
    </data>
  </presentation>
  <data type="application/openmath+xml">...</data>
</notation>

Example C.8

<notation>
  <presentation>
    <data type="application/mathml-presentation+xml" media="screen, print" />
    <data type="application/ssml+xml" transform="synthesize.xslt" xml:lang="en" media="speech">
      <with-param name="namespace:param1" as="xs:string">text</with-param>
      <extension name="namespace:function" as="xs:string" oncall="jsfun(event)">
        <param name="namespace:functionparam1" as="xs:string" required="yes" />
      </extension>
    </data>
  </presentation>
  <data type="application/openmath+xml">...</data>
</notation>

Example C.9

<html>
  <head>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="x1"> 
      ...
    </xsl:stylesheet>
  </head>
  <body>
    <notation transform="#x1" src="file.om" />
  </body>
</html>

Example C.10

<html>
  <head>
    <link rel="notation" type="application/xslt+xml" href="custom.xslt" />
  </head>
  <body>
    <notation src="file.om" />
  </body>
</html>

Example C.11

<html>
  <head>
    <link rel="notation" type="application/xslt+xml" href="custom1.xslt" title="title1" />
    <link rel="alternate notation" type="application/xslt+xml" href="custom2.xslt" title="title2" />
  </head>
  <body>
    <notation src="file.om" />
  </body>
</html>
 		 	   		  

Received on Wednesday, 9 May 2012 03:43:24 UTC