home *** CD-ROM | disk | FTP | other *** search
/ XML Bible (2nd Edition) / XML_Bible_Second_Edition_Hungry_Minds_2001.iso / mac / specs / XML-MathML-20010221 / xml / interface.xml < prev    next >
Text File  |  2001-02-19  |  46KB  |  1,026 lines

  1. <div1 id="interf" role="chapter7"><head>The MathML Interface</head>
  2. <!-- $Id: interface.xml,v 1.46 2001/02/19 10:18:59 davidc Exp $ -->
  3.  
  4. <p>To be effective, MathML must work well with a wide variety of
  5. renderers, processors, translators and editors. This chapter addresses
  6. some of the interface issues involved in generating and rendering
  7. MathML. Since MathML exists primarily to encode mathematics in Web
  8. documents, perhaps the most important interface issues are related to
  9. embedding MathML in <bibref ref="HTML4" /> and
  10. <bibref ref="XHTML"/>.</p>
  11.  
  12. <p>There are three kinds of interface issues that arise in embedding
  13. MathML in other XML documents. First, MathML must be semantically
  14. integrated. MathML markup must be recognized as valid embedded XML
  15. content, and not as an error.  This is primarily a question of
  16. managing namespaces in XML <bibref ref="Namespaces"/>.</p>
  17.  
  18. <p>Second, in the case of HTML/XHTML, MathML rendering must be
  19. integrated into browser software.  Some browsers already implement
  20. MathML rendering natively, and one can expect more browsers will do so
  21. in the future.  At the same time, other browsers have developed
  22. infrastructure to facilitate the rendering of MathML and other
  23. embedded XML content by third-party software.  Using these browser
  24. specific mechanisms generally requires some additional interface
  25. markup of some sort to activate them.</p>
  26.  
  27. <p>Third, other tools for generating and processing MathML must be
  28. able to intercommunicate.  A number of MathML tools have been or are
  29. being developed, including editors, translators, computer algebra
  30. systems, and other scientific software.  However, since MathML
  31. expressions tend to be lengthy, and prone to error when entered by
  32. hand, special emphasis must be given to insuring that MathML can be
  33. easily generated by user-friendly conversion and authoring tools, and
  34. that these tools work together in a dependable, platform and vendor
  35. independent way.</p>
  36.  
  37. <p>The W3C Math Working Group is committed to providing support to software
  38. vendors developing any kind of MathML tool. The Working Group monitors
  39. the public mailing list 
  40. <loc href="mailto:www-math@w3.org">www-math@w3.org</loc>,
  41. and will attempt to answer questions about the MathML specification. The
  42. Working Group works with MathML developer
  43. and user groups. For current information about MathML tools, applications
  44. and user support activities, consult the
  45. <loc href="http://www.w3.org/Math/">home page of the W3C Math Working
  46. Group</loc>.</p>
  47.  
  48. <div2 id="interf_embed"><head>Embedding MathML in other Documents</head>
  49.  
  50. <p>While MathML can be used in isolation as a language for exchanging
  51. mathematical expressions between MathML-aware applications, the
  52. primary anticipated use of MathML is to encode mathematical expression
  53. within larger documents.  MathML is ideal for embedding math
  54. expressions in other applications of XML.</p>
  55.  
  56. <p>In particular, the focus here is on the mechanics of embedding
  57. MathML in <bibref ref="XHTML"/>. XHTML is a W3C Recommendation
  58. formulating a family of current and future XML-based document types
  59. and modules that reproduce, subset, and extend HTML.  While <bibref
  60. ref="HTML4"/> is the dominant language of the Web at the time of
  61. this writing, one may anticipate a shift from HTML to XHTML.
  62. Indeed, XHTML can already be made to render properly in most HTML user
  63. agents.</p> 
  64.  
  65. <p>Since MathML and XHTML share a common XML framework, namespaces
  66. provide a standard mechanism for embedding MathML in XHTML.  While
  67. some popular user agents also support inclusion of MathML directly in
  68. HTML as "XML data islands," this is a transitional strategy.
  69. Consult user agent documentation for specific information on
  70. its support for embedding XML in HTML.</p>
  71.  
  72. <div3 id="interf_namespace"><head>MathML and Namespaces</head>
  73.  
  74. <p>Embedding MathML in XML-based documents in general, and XHTML in
  75. particular, is a matter of managing namespaces.  See the W3C
  76. Recommendation "Namespaces in XML" <bibref
  77. ref="Namespaces"/> for full details.</p>
  78.  
  79. <p>An XML namespace is a collection of names identified by a URI.  The
  80. URI for the MathML namespace is:</p> 
  81.  
  82. <eg>
  83. http://www.w3.org/1998/Math/MathML
  84. </eg>
  85.  
  86. <p>Using namespaces, embedding a MathML expression in a larger XML
  87. document is merely a matter of identifying the MathML markup as
  88. residing in the MathML namespace.  This can be accomplished by either
  89. explicitly identifying each MathML element name by attaching a
  90. namespace prefix, or by declaring a default namespace on an enclosing
  91. element.</p>
  92.  
  93. <p>To declare a namespace, one uses an <kw role="attrib">xmlns</kw>
  94. attribute, or an attribute 
  95. with an <kw role="attrib">xmlns</kw> prefix.  When the <kw
  96. role="attrib">xmlns</kw> attribute is used alone, it sets 
  97. the default namespace for the element on which it
  98. appears, and for any children elements.</p> 
  99.  
  100. <p>Example:</p>
  101.  
  102. <eg><![CDATA[
  103. <math xmlns="http://www.w3.org/1998/Math/MathML">
  104. <mrow>...</mrow>
  105. </math>
  106. ]]></eg>
  107.  
  108. <p>When the <kw role="attrib">xmlns</kw> attribute is used as a
  109. prefix, it declares a 
  110. prefix which can then be used to explicitly associate other elements
  111. and attributes with a particular namespace.</p>
  112.  
  113. <p>Example:</p>
  114.  
  115. <eg><![CDATA[
  116. <body xmlns:m="http://www.w3.org/1998/Math/MathML">
  117. ...
  118. <m:math><m:mrow>...</m:mrow></m:math>
  119. ...
  120. </body>
  121. ]]></eg>
  122.  
  123. <p>These two methods of namespace declaration can be used together.
  124. For example, by using both an explicit document-wide namespace prefix,
  125. and default namespace declarations on individual mathematical
  126. elements, it is possible to localize namespace related markup to the
  127. top-level <kw role="element">math</kw> element.  This is also
  128. important for implementation with some user agents, since attaching
  129. rendering behaviors to an element currently requires an explicit
  130. namespace prefix in these browsers.  At the same time, a number of
  131. MathML authoring tools are not yet namespace-aware, and thus the
  132. ability to use markup without prefixes is also desirable in the short
  133. term.</p>
  134.  
  135. <p>Example:</p>
  136.  
  137. <eg><![CDATA[
  138. <body xmlns:m="http://www.w3.org/1998/Math/MathML">
  139. ...
  140. <m:math xmlns="http://www.w3.org/1998/Math/MathML">
  141. <mrow>...<mrow>
  142. </m:math>
  143. ...
  144. </body>
  145. ]]></eg>
  146.  
  147. <div4 id="interf_validation"><head>Document Validation Issues</head>
  148.  
  149. <p>The use of namespace prefixes creates an issue for DTD validation
  150. of documents embedding MathML.  DTD validation requires knowing the
  151. literal (possibly prefixed) element names used in the document.
  152. However, the Namespaces in XML Recommendation <bibref
  153. ref="Namespaces"/> allows the prefix to be changed at arbitrary points
  154. in the document, since namespace prefixes may be declared on any
  155. element.</p>
  156.  
  157. <p>The `historical' method of bridging this gap was to write a DTD
  158. with a fixed prefix, or in the case of XHTML and MathML, with no
  159. prefix, and mandate that the specified form must be used throughout
  160. the document.  However, this is somewhat restricting for a modular DTD
  161. that is intended for use in conjunction with another DTD, which is
  162. exactly the situation with MathML in XHTML.  In essence, the MathML
  163. DTD would have to allocate a prefix for itself and hope no 
  164. other module uses the same prefix to avoid name clashes, thus losing
  165. one of the main benefits of XML namespaces.</p>
  166.  
  167. <p>One strategy for addressing this problem is to make every element
  168. name in the DTD be accessed by an entity reference. This means that by
  169. declaring a couple of entities to specify the prefix before the DTD is
  170. loaded, the prefix can be chosen by a document author, and compound
  171. DTDs that include several modules can, without changing the module
  172. DTDs, specify unique prefixes for each module to avoid clashes.  The
  173. MathML DTD has been designed in this fashion. See <specref
  174. ref="parsing_dtd" /> and <bibref ref="Modularization"/> for
  175. details.</p>  
  176.  
  177. <p>An extra issue arises in the case where explicit prefixes are used
  178. on the top-level <kw role="element">math</kw> element, but a default
  179. namespace is used for other MathML elements.  In this case, one wants
  180. the MathML module to be included into XHTML with the prefix set to
  181. empty.  However, the `driver' DTD file that sets up the inclusion of
  182. the MathML module would then need to define a new element called
  183. m:math.  This would allow the top-level <kw role="element">math</kw>
  184. element to use an explicit prefix, for attaching rendering behaviors
  185. in current browsers, while the contents would not need an explicit
  186. prefix, for ease of interoperability between authoring tools, etc.</p>
  187.  
  188. </div4>
  189. <div4 id="interf_compatibility"><head>Compatibility Suggestions</head>
  190.  
  191. <p>While the use of namespaces to embed MathML in other XML
  192. applications is completely described by the relevant W3C
  193. Recommendations, a certain degree of pragmatism is still called for at
  194. present.  Support for XML, namespaces and rendering behaviors in
  195. popular user agents is not always fully in alignment with W3C
  196. Recommendations.  In some cases, the software predates the relevant
  197. standards, and in other cases, the relevant standards are not yet
  198. complete.</p>
  199.  
  200. <p>During the transitional period, in which some software may not be
  201. fully namespace-aware, a few conventional practices will ease
  202. compatibility problems:  
  203.  
  204. <olist>
  205. <item><p>When using namespace prefixes with MathML markup, use m: as a
  206. conventional prefix for the MathML namespace.  Using an explicit
  207. prefix is probably safer for compatibility in current user agents.  
  208. </p></item>
  209.  
  210. <item><p>When using namespace prefixes, pick one and use it
  211. consistently within a document.
  212. </p></item>
  213.  
  214. <item><p>Explicitly declare the MathML namespace on all
  215. <kw role="element">math</kw> elements.
  216. </p></item> </olist></p>
  217.  
  218. <p>Examples.</p>
  219.  
  220. <eg><![CDATA[
  221. <body>
  222. ...
  223. <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
  224. <m:mrow>...<m:mrow>
  225. </m:math>
  226. ...
  227. </body>
  228. ]]></eg>
  229.  
  230. <p>Or</p>
  231. <eg><![CDATA[
  232. <body>
  233. ...
  234. <math xmlns="http://www.w3.org/1998/Math/MathML">
  235. <mrow>...<mrow>
  236. </math>
  237. ...
  238. </body>
  239. ]]></eg>
  240.  
  241. <p>Note that these suggestions alone may not be sufficient for
  242. creating functional Web pages containing MathML markup.  It will
  243. generally be the case that some additional document-wide markup will
  244. be required.  Additional work may also be required to make all MathML
  245. instances in a document compatible with document-wide declarations.
  246. This is particularly true when documents are created by cutting and
  247. pasting MathML expressions, since current tools will probably not 
  248. be able to query global namespace information.</p>
  249.  
  250. <p>Consult the <loc href="http://www.w3.org/Math/">W3C Math Working
  251. Group</loc> home page for compatibility and implementation suggestions
  252. for current browsers and other MathML-aware tools.</p>
  253.  
  254. </div4>
  255. </div3>
  256. <div3 id="interf_toplevel"><head>The Top-Level 
  257. <kw role="element">math</kw> Element</head>
  258.  
  259. <p>MathML specifies a single top-level or root <kw
  260. role="element">math</kw> element, which encapsulates each instance of
  261. MathML markup within a document.  All other MathML content must be
  262. contained in a <kw role="element">math</kw> element; equivalently,
  263. every valid, complete MathML expression must be contained in <kw
  264. role="starttag">math</kw> tags. The <kw role="element">math</kw>
  265. element must always be the outermost element in a MathML expression;
  266. it is an error for one <kw role="element">math</kw> element to contain
  267. another.</p>
  268.  
  269. <p>Applications that return sub-expressions of other MathML
  270. expressions, for example, as the result of a cut-and-paste operation,
  271. should always wrap them in <kw role="starttag">math</kw>
  272. tags. Ideally, the presence of enclosing <kw role="starttag">math</kw>
  273. tags should be a very good heuristic test for MathML
  274. material. Similarly, applications which insert MathML expressions in
  275. other MathML expressions must take care to remove the <kw
  276. role="starttag">math</kw> tags from the inner expressions.</p>
  277.  
  278. <p>The <kw role="element">math</kw> element can contain an arbitrary number
  279. of children schemata. The children schemata render by default as if they
  280. were contained in an <kw role="element">mrow</kw> element.</p>
  281.  
  282. <p>The attributes of the <kw role="element">math</kw> element are:
  283. <glist>
  284. <gitem><label>class, id, style</label>
  285. <def><p>Provided for use with stylesheets.</p></def>
  286. </gitem>
  287.  
  288. <gitem><label>xref</label>
  289. <def><p>Provided along with <kw role="attrib">id</kw> for use 
  290. with XSL processing (See <specref ref="mixing_tools" />)</p></def>
  291. </gitem>
  292.  
  293. <gitem><label>macros</label>
  294. <def><p>This attribute provides a way of pointing to
  295. external macro definition files. Macros are not part of the MathML
  296. specification, and much of the functionality provided by macros in MathML can be
  297. accommodated by XSL transformations <bibref ref="XSLT"/>.  However, the <kw
  298. role="attrib">macros</kw> attribute is provided to make possible future
  299. development of more streamlined, MathML-specific macro mechanisms. The
  300. value of this attribute is a sequence of URLs or URIs, separated by
  301. whitespace</p></def>
  302. </gitem>
  303.  
  304. <gitem>
  305. <label>mode</label>
  306. <def><p>The <kw role="attrib">mode</kw> attribute specifies whether
  307. the enclosed MathML expression should be rendered in a display style
  308. or an in-line style. Allowed values are 
  309. <kw role="attval">display</kw> and
  310. <kw role="attval">inline</kw> (default).
  311. This attribute is <intref ref="interf_deprec">deprecated</intref> in
  312. favor of the new <kw role="attrib">display</kw> attribute, or the
  313. <loc href="http://www.w3.org/TR/CSS2/visuren.html#propdef-display">CSS2 
  314. `display' property</loc> with the analogous <kw>block</kw> and 
  315. <kw>inline</kw> values.</p></def>
  316. </gitem>
  317.  
  318. <gitem>
  319. <label>display</label>
  320. <def><p>The <kw role="attrib">display</kw> attribute replaces the
  321. deprecated <kw role="attrib">mode</kw> element.  It specifies whether
  322. the enclosed MathML expression should be rendered in a display style
  323. or an in-line style. Allowed values are 
  324. <kw role="attval">block</kw> and
  325. <kw role="attval">inline</kw> (default).
  326. </p></def>
  327. </gitem>
  328.  
  329. </glist>
  330. </p>
  331.  
  332. <p>The attributes of the <kw role="element">math</kw> element affect
  333. the entire enclosed expression. They are, in a sense, <quote>inward
  334. looking</quote>. However, to render MathML properly in a browser, and
  335. to integrate it properly into an XHTML document, a second collection
  336. of <quote>outward looking</quote> attributes are also useful.</p>
  337.  
  338. <p>While general mechanisms for attaching rendering behaviors to
  339. elements in XML documents are under development, wide variations in
  340. strategy and level of implementation remain between various existing
  341. user agents.  Consequently, the remainder of this section describes
  342. attributes and functionality that are desirable for integrating
  343. third-party rendering modules with user agents:
  344.  
  345. <glist>
  346. <gitem><label>overflow</label> <def><p>In cases where size negotiation
  347. is not possible or fails (for example in the case of an extremely long
  348. equation), this attribute is provided to suggest an alternative
  349. processing method to the renderer.  Allowed values are <glist>
  350. <gitem><label>scroll</label> <def><p>The window provides a viewport
  351. into the larger complete display of the mathematical
  352. expression. Horizontal or vertical scrollbars are added to the window
  353. as necessary to allow the viewport to be moved to a different
  354. position.</p></def> </gitem>
  355.  
  356. <gitem><label>elide</label>
  357. <def><p>The display is abbreviated by removing enough of it so that
  358. the remainder fits into the window. For example, a large polynomial
  359. might have the first and last terms displayed with <quote>+ ... +</quote> between
  360. them. Advanced renderers may provide a facility to zoom in on elided
  361. areas.</p></def>
  362. </gitem>
  363.  
  364. <gitem><label>truncate</label>
  365. <def><p>The display is abbreviated by simply truncating it at the right and
  366. bottom borders. It is recommended that some indication of truncation is
  367. made to the viewer.</p></def>
  368. </gitem>
  369.  
  370. <gitem><label>scale</label>
  371. <def><p>The fonts used to display the mathematical expression are
  372. chosen so that the full expression fits in the window. Note that this
  373. only happens if the expression is too large. In the case of a window
  374. larger than necessary, the expression is shown at its normal size
  375. within the larger window.</p></def>
  376. </gitem>
  377. </glist>
  378. </p>
  379. </def>
  380. </gitem>
  381.  
  382. <gitem><label>altimg</label>
  383. <def><p>This attribute provides a graceful fall-back for browsers that do
  384. not support embedded elements. The value of the
  385. attribute is an URL.</p></def>
  386. </gitem>
  387.  
  388. <gitem><label>alttext</label>
  389. <def><p>This attribute provides a graceful fall-back for browsers that do
  390. not support embedded elements or images. 
  391. The value of the attribute is a text string.</p></def>
  392. </gitem>
  393.  
  394. </glist>
  395. </p>
  396. </div3>
  397.  
  398. <div3><head>Invoking MathML Processors</head>
  399.  
  400. <p>In browsers where MathML is not natively supported, it is anticipated
  401. that MathML rendering will be carried out via embedded objects such as
  402. plug-ins, applets, or helper applications.  The direction which has
  403. begun emerging for invoking third-party rendering and processing
  404. software is elucidated in the W3C Working Draft "Behavioral
  405. Extensions to CSS" <bibref ref="Behaviors" />.</p> 
  406.  
  407. <p>Behavioral extensions use the linking mechanism of CSS to attach
  408. executable components to elements.  Typically, the executable
  409. components involve script code which manipulate the DOM to instantiate
  410. other MathML processing components.  Using experimental
  411. implementations of behavior extensions in current user agents, it is
  412. possible to attach processing components to <kw
  413. role="element">math</kw> elements which then carry out the rendering
  414. of MathML markup in an XHTML page.</p> 
  415.  
  416. <p>Work on on Behavior Extensions to CSS is ongoing at W3C, and
  417. existing implementations must be regarded as non-standard at this time.
  418. However, it offers a very promising direction for powerful and
  419. flexible invocation of third-party MathML processors.</p>
  420.  
  421. <p>MIME types <bibref ref="RFC2045" />, <bibref ref="RFC2046" /> offer
  422. an alternative strategy that can also be used in current user agents
  423. to invoke a MathML renderer.  This is primarily useful when
  424. referencing separate files containing MathML markup from an <kw
  425. role="element">EMBED</kw> or <kw role="element">OBJECT</kw> element.
  426. <bibref ref="RFC3023" /> assigns MathML the MIME type
  427. <code>application/mathml+xml</code>.  The W3C Math Working Group
  428. recommends the standard file extension <code>.mml</code> used for
  429. browser registry.</p>
  430.  
  431. <p>In MathML 1.0, <code>text/mathml</code> was given as the suggested
  432. MIME type.  This has been superceded by RFC3023.</p>
  433.  
  434. <p>Although rendering MathML expressions typically occurs in place in
  435. a Web browser, other MathML processing functions take place more
  436. naturally in other applications. Particularly common tasks include
  437. opening a MathML expression in an equation editor or computer algebra
  438. system.</p>
  439.  
  440. <p>At present, there is no standard way of selecting between various
  441. applications which might be used to render or process embedded MathML.
  442. As work progresses on coordination between browsers and embedded
  443. elements and the Document Object Model <bibref ref="DOM" />, providing
  444. this kind of functionality should be a priority. Both authors and
  445. readers should be able to indicate a preference about what MathML
  446. application to use in a given context. For example, one might imagine
  447. that some mouse gesture over a MathML expression causes a browser to
  448. present the reader with a pop-up menu, showing the various kinds of
  449. MathML processing available on the system, and the MathML processors
  450. recommended by the author.</p>
  451.  
  452. <p>Since MathML is most often generated by authoring tools, it is
  453. particularly important that opening a MathML expression in an editor should
  454. be easy to do and to implement. In many cases, it will be desirable for an
  455. authoring tool to record some information about its internal state along
  456. with a MathML expression, so that an author can pick up editing where he or
  457. she left off.  The MathML specification does not explicitly contain
  458. provisions for recording information about the authoring tool. In some
  459. circumstances, it may be possible to include authoring tool information
  460. that applies to an entire document in the form of meta-data; interested
  461. readers are encouraged to consult the <loc
  462. href="http://www.w3.org/Metadata/">W3C Metadata Activity</loc> for current
  463. information about metadata and resource definition. For encoding authoring
  464. tool state information that applies to a particular MathML instance,
  465. readers are referred to the possible use of the <kw
  466. role="element">semantics</kw> element for this purpose <specref
  467. ref="contm_semantics"/>.</p> 
  468.  
  469. <p>In the short term, regardless of the methodology, implementors of
  470. embedded MathML processing applications are encouraged to try to allow for
  471. the following kinds of functionality:
  472.  
  473. <ulist>
  474. <item><p>An author wishing to reach an audience as wide as possible
  475. might want MathML to be rendered by any available processor.</p>
  476. </item>
  477.  
  478. <item><p>An author targeting a specific audience might want to indicate that
  479. a particular MathML processor be used.</p>
  480. </item>
  481.  
  482. <item><p>A reader might wish to specify which of several available
  483. processors installed locally should be used.</p>
  484. </item>
  485. </ulist>
  486. </p>
  487.  
  488. </div3>
  489.  
  490. <div3 id="interf_link"><head>Mixing and Linking MathML and HTML</head>
  491.  
  492. <p>In order to fully integrate MathML into XHTML, it should be possible
  493. not only to embed MathML in XHTML, but also to embed XHTML in MathML.
  494. However, the problem of supporting XHTML in MathML presents many
  495. difficulties.  Therefore, at present, the MathML specification does not
  496. permit any XHTML elements within a MathML expression, although this
  497. may be subject to change in a future revision of MathML.</p>
  498.  
  499. <p>In most cases, XHTML elements (headings, paragraphs, lists, etc.)
  500. either do not apply in mathematical contexts, or MathML already
  501. provides equivalent or better functionality specifically tailored to
  502. mathematical content (tables, mathematics style changes,
  503. etc.). However, there are two notable exceptions, the XHTML anchor and
  504. image elements.  For this functionality, MathML relies on the general
  505. XML linking and graphics mechanisms being developed by other W3C
  506. Activities. </p>
  507.  
  508. <div4><head>Linking</head>
  509.  
  510. <p>MathML has no element that corresponds to the XHTML anchor element
  511. <mi>a</mi>. In XHTML, anchors are used both to make links, and to
  512. provide locations to which a link can be made. MathML, as an XML
  513. application, defines links by the use of the mechanism described in
  514. the W3C Candidate Recommendation "XML Linking Language" <bibref
  515. ref="XLink"/>. The reader is cautioned that at the time of this writing,
  516. XLink is not yet a Recommendation, and is therefore subject to future
  517. revision. Since the MathML linking mechanism is defined in terms of
  518. the XML linking specification, the same proviso holds for it as
  519. well.</p>
  520.  
  521. <p>A MathML element is designated as a link by the presence of the
  522. attribute <kw role="attrib">xlink:href</kw>.  To use the attribute <kw
  523. role="attrib">xlink:href</kw>, it is also necessary to declare the 
  524. appropriate namespace. Thus, a typical MathML link might look like:
  525. <eg><![CDATA[
  526. <mrow xmlns:xlink="http://www.w3.org/1999/xlink"
  527.       xlink:href="sample.xml">
  528.   ...
  529. </mrow>
  530. ]]></eg>
  531. </p>
  532. <p>MathML designates that almost all elements can be used as XML linking
  533. elements. The only elements that cannot serve as linking elements are those
  534. such as the <kw role="element">sep</kw> element, which exist primarily to
  535. disambiguate other MathML constructs and in general do not correspond to
  536. any part of a typical visual rendering. The full list of exceptional
  537. elements that cannot be used as linking elements is given in the table
  538. below.
  539. <table width="75%">
  540. <thead>
  541. <tr><td colspan="3">MathML elements that cannot be linking elements.</td></tr>
  542. </thead>
  543. <tbody>
  544. <tr>
  545. <td><kw role="element">mprescripts</kw></td>
  546. <td><kw role="element">none</kw></td>
  547. <td><kw role="element">sep</kw></td>
  548. </tr>
  549. <tr>
  550. <td><kw role="element">malignmark</kw></td>
  551. <td><kw role="element">maligngroup</kw></td>
  552. <td></td>
  553. </tr>
  554. </tbody>
  555. </table>
  556. </p>
  557.  
  558. <p>Note that the XML Linking <bibref
  559. ref="XLink"/> and XML Pointer Language <bibref
  560. ref="XPointer"/> specifications also define how to link
  561. <emph>into</emph> a MathML expressions.  Be aware, however, that such
  562. links may or may not be properly interpreted in current software.</p>
  563. </div4>
  564.  
  565. <div4><head>Images</head>
  566.  
  567. <p>The <kw role="element">IMG</kw> element has no MathML
  568. equivalent. The decision to omit a general mechanism for image
  569. inclusion from MathML was based on several factors.  However, the main
  570. reason for not providing an image facility is that MathML takes great
  571. pains to make the notational structure and mathematical content it
  572. encodes easily available to processors, whereas information contained
  573. in images is only available to a human reader looking at a visual
  574. representation. Thus, for example, in the MathML paradigm, it would be
  575. preferable to introduce new glyphs via the <kw
  576. role="element">mglyph</kw> element which at a minimum identifies them
  577. as glyphs, rather than simply including them as images.</p> 
  578.  
  579. <p>Finally, apart from the introduction of new glyphs, many of the
  580. situations where one might be inclined to use an image amount to some
  581. sort of labeled diagram. For example, knot diagrams, Venn diagrams,
  582. Dynkin diagrams, Feynman diagrams and complicated commutative diagrams
  583. all fall into this category. As such, their content would be better
  584. encoded via some combination of structured graphics and MathML markup.
  585. Because of the generality of the <quote>labeled diagram</quote> construction, the
  586. definition of a markup language to encode such constructions extends
  587. beyond the scope of the current W3C Math activity. 
  588. (See <loc
  589. href="http://www.w3.org/Graphics/">http://www.w3.org/Graphics</loc> for
  590. further W3C activity in this area.)
  591.  
  592. </p>
  593. </div4>
  594. </div3>
  595.  
  596. <div3 id="interf_style"><head>Using CSS with MathML</head>
  597.  
  598. <p>When MathML is rendered in an environment
  599. that supports CSS, controlling mathematics style properties with a CSS
  600. stylesheet is obviously desirable.
  601. MathML 2.0 has significantly redesigned the way presentation element
  602. style properties are organized to facilitate better interaction
  603. between MathML renderers and CSS style mechanisms.  It introduces four
  604. new <emph>mathematics style</emph> attributes with logical values.  Roughly
  605. speaking, these attributes can be viewed as the proper selectors for
  606. CSS rules that affect MathML.</p>
  607.  
  608. <p>Controlling mathematics styling is not as simple as it might first appear
  609. because mathematics styling and text styling are quite different in
  610. character.  In text, meaning is primarily carried by the relative
  611. positioning of characters next to one another to form words.  Thus,
  612. although the font used to render text may impart nuances to the
  613. meaning, transforming the typographic properties of the individual
  614. characters leaves the meaning of text basically intact.  By contrast,
  615. in mathematical expressions, individual characters in specific
  616. typefaces tend to function as atomic symbols.  Thus, in the same
  617. equation, a bold italic 'x' and a normal italic 'x' are almost always
  618. intended to be two distinct symbols that mean different things.  In
  619. traditional usage, there are eight basic typographical categories
  620. of symbols.  These categories are described by mathematics style
  621. attributes, primarily the <kw role="attrib">mathvariant</kw>
  622. attribute.</p> 
  623.  
  624. <p>Text and mathematics layout also obviously differ in that
  625. mathematics uses 2-dimensional layout.  As a result, many of the style
  626. parameters that affect mathematics layout have no textual analogs.
  627. Even in cases where there are analogous properties, the sensible
  628. values for these properties may not correspond.  For example,
  629. traditional mathematical typography usually uses italic fonts for
  630. single character identifiers, and upright fonts for multicharacter
  631. identifier.  In text, italicization does not usually depend on the
  632. number of letters in a word.  Thus although a font-slant property
  633. makes sense for both mathematics and text, the natural default values
  634. are quite different.</p>
  635.  
  636. <p>Because of the difference between text and mathematics styling, only some
  637. aspects of MathML layout are good candidates for CSS control.  MathML
  638. 2.0 captures the most important properties with the new mathematics style
  639. attributes, and users should try to use them whenever possible over
  640. more direct, but less robust, approaches.  A sample CSS stylesheet
  641. illustrating the use of the mathematical 
  642. style attributes is available in <specref ref="stylesheet"/></p>
  643.  
  644. <p>Generally speaking, the model for CSS interaction with the math
  645. style attributes runs as follows.  A CSS style sheet might provide a style
  646. rule such as:</p>
  647.  
  648. <eg><![CDATA[
  649. math *.[mathsize="small"] {
  650.   font-size: 80%
  651. }
  652. ]]></eg>
  653.  
  654. <p>This rule sets the CSS font-size properties for all children of the
  655. <kw role="element">math</kw> element that have the <kw
  656. role="attrib">mathsize</kw> attribute set to small.  A MathML renderer
  657. would then query the style engine for the CSS environment, and use the
  658. values returned as input to its own layout algorithms.  MathML does
  659. not specify the mechanism by which style information is inherited from
  660. the environment.  However, some suggested rendering rules for the
  661. interaction between properties of the ambient style environment and
  662. MathML-specific rendering rules are discussed in <specref
  663. ref="presm_commatt"/>, and more generally throughout <specref
  664. ref="presm"/>.</p>
  665.  
  666. <p>It should be stressed, however, that some caution is required in
  667. writing CSS stylesheets for MathML.  Because changing typographic
  668. properties of mathematics symbols can change the meaning of an equation,
  669. stylesheet should be written in a way such that changes to document-wide
  670. typographic styles do not affect embedded MathML expressions.  By
  671. using the MathML 2.0 mathematics style attributes as selectors for CSS rules,
  672. this danger is minimized.</p>
  673.  
  674. <p>Another pitfall to be avoided is using CSS to provide
  675. typographic style information necessary to the proper understanding of
  676. an expression.  Expressions dependent on CSS for meaning will not be
  677. portable to non-CSS environments such as computer algebra systems.  By
  678. using the logical values of the new MathML 2.0 mathematics style attributes
  679. as selectors for CSS rules, it can be assured that style information
  680. necessary to the sense of an expression is encoded directly in the
  681. MathML.</p>
  682.  
  683. <p>MathML 2.0 does not specify how a user agent should process style
  684. information, because there are many non-CSS MathML environments, and
  685. because different users agents and renderers have widely varying
  686. degrees of access to CSS information.  In general, however, developers
  687. are urged to provide as much CSS support for MathML as possible.</p>
  688. </div3>
  689. </div2>
  690.  
  691. <div2 id="interf_genproc"><head>Conformance</head> 
  692.  
  693. <p>Information is increasingly generated, processed and rendered by
  694. software tools. The exponential growth of the Web is fueling the
  695. development of advanced systems for automatically searching,
  696. categorizing, and interconnecting information. Thus, although MathML
  697. can be written by hand and read by humans, the future of MathML is
  698. largely tied to the ability to process it with software tools.</p>
  699.  
  700. <p>There are many different kinds of MathML editors, translators,
  701. processors and renderers.  What it means to support MathML varies
  702. widely between applications.  For example, the issues that arise with
  703. a MathML-compliant validating parser are very different from those for
  704. a MathML-compliant equation editor.</p>
  705.  
  706. <p>In this section, guidelines are given for describing different types
  707. of MathML support, and for quantifying the extent of MathML support in
  708. a given application.  Developers, users and reviewers are encouraged
  709. to use these guidelines in characterizing products.  The intention
  710. behind these guidelines is to facilitate reuse and interoperability
  711. between MathML applications by accurately characterizing their
  712. capabilities in quantifiable terms.</p>
  713.  
  714. <p>The W3C Math Working Group maintains <loc 
  715. href="http://www.w3.org/Math/iandi/compliance">MathML 2.0 Compliance
  716. Guidelines</loc>.  Consult this document for future updates on conformance
  717. activities and resources.
  718. </p>
  719.  
  720. <div3><head>MathML Compliance</head>
  721.  
  722. <p>A valid MathML expression is an XML construct determined by the MathML
  723. DTD together with the additional requirements given in this specification.</p>
  724.  
  725. <p>Define a <quote>MathML processor</quote> to mean any application that
  726. can accept, produce, or <quote>roundtrip</quote> a valid MathML
  727. expression. An example of an application that might round-trip a MathML
  728. expression might be an editor that writes a new file even though no
  729. modifications are made.</p>
  730.  
  731. <p>Three forms of MathML compliance are specified:
  732. <olist>
  733. <item><p>A MathML-input-compliant processor must accept all valid MathML
  734. expressions, and faithfully translate all MathML expressions into
  735. application-specific form allowing native application operations to be
  736. performed.</p>
  737. </item>
  738.  
  739. <item><p>A MathML-output-compliant processor must generate valid MathML,
  740. faithfully representing all application-specific data.</p>
  741. </item>
  742.  
  743. <item><p>A MathML-roundtrip-compliant processor must preserve MathML
  744. equivalence. Two MathML expressions are <quote>equivalent</quote> if and
  745. only if both expressions have the same interpretation (as stated by the
  746. MathML DTD and  specification) under any circumstances, by any MathML
  747. processor. Equivalence on an element-by-element basis is discussed
  748. elsewhere in this document.</p>
  749. </item>
  750. </olist>
  751. </p>
  752.  
  753. <p>Beyond the above definitions, the MathML specification makes no demands
  754. of individual processors.  In order to guide developers, the MathML
  755. specification includes advisory material; for example, there are many suggested
  756. rendering rules throughout <specref ref="presm"/>.  However, in general,
  757. developers are given wide latitude in interpreting what kind of MathML
  758. implementation is meaningful for their own particular application.</p>
  759.  
  760. <p>To clarify the difference between compliance and interpretation of
  761. what is meaningful, consider some examples:
  762. <olist>
  763. <item><p>In order to be MathML-input-compliant, a validating parser needs
  764. only to accept expressions, and return <quote>true</quote> for
  765. expressions that are valid MathML. In particular, it need not render or
  766. interpret the MathML expressions at all.</p>
  767. </item>
  768.  
  769. <item><p>A MathML computer-algebra interface based on content markup might
  770. choose to ignore all presentation markup. Provided the interface accepts
  771. all valid MathML expressions including those containing presentation markup,
  772. it would be technically correct to characterize the application as
  773. MathML-input-compliant.</p>
  774. </item>
  775.  
  776. <item><p>An equation editor might have an internal data representation
  777. that makes it easy to export some equations as MathML but not
  778. others. If the editor exports the simple equations as valid MathML,
  779. and merely displays an error message to the effect that conversion
  780. failed for the others, it is still technically
  781. MathML-output-compliant.</p> </item> </olist> </p>
  782.  
  783. <div4 id="interf_testsuite"><head>MathML Test Suite and Validator</head>
  784.  
  785. <p>As the previous examples show, to be useful, the concept of MathML
  786. compliance frequently involves a judgment about what parts of the
  787. language are meaningfully implemented, as opposed to parts that are
  788. merely processed in a technically correct way with respect to the
  789. definitions of compliance.  This requires some mechanism for giving a
  790. quantitative statement about which parts of MathML are meaningfully
  791. implemented by a given application.  To this end, the W3C Math Working
  792. Group has provided a <loc href="http://www.w3.org/Math/testsuite/">test
  793. suite</loc>.</p>
  794.  
  795. <p>The test suite consists of a large number of MathML expressions
  796. categorized by markup category and dominant MathML element being
  797. tested.  The existence of this test suite makes it possible, for example,
  798. to characterize quantitatively the hypothetical computer algebra interface
  799. mentioned above by saying that it is a MathML-input compliant processor
  800. which meaningfully implements MathML content markup, including all of
  801. the expressions in the content markup section of the test suite.</p> 
  802.  
  803. <p>Developers who choose not to implement parts of the MathML
  804. specification in a meaningful way are encouraged to itemize the parts
  805. they leave out by referring to specific categories in the test suite.</p>
  806.  
  807. <p>For MathML-output-compliant processors, there is also a <loc
  808. href="http://www.w3.org/Math/validator/">MathML validator</loc>
  809. accessible over the Web.  Developers of MathML-output-compliant
  810. processors are encouraged to verify their output using this
  811. validator.</p>
  812.  
  813. <p>Customers of MathML applications who wish to verify claims as to which
  814. parts of the MathML specification are implemented by an application are
  815. encouraged to use the test suites as a part of their decision
  816. processes.</p>
  817. </div4>
  818.  
  819. <div4 id="interf_deprec"><head>Deprecated MathML 1.x Features</head>
  820.  
  821. <p>MathML 2.0 contains a number of MathML 1.x features which are now
  822. deprecated.  The following points define what it means for a
  823. feature to be deprecated, and clarify the relation between
  824. deprecated features and MathML 2.0 compliance.</p>
  825.  
  826. <olist>
  827. <item><p>In order to be MathML-output-compliant, authoring tools may not
  828. generate MathML markup containing deprecated features.</p></item>
  829.  
  830. <item><p>In order to be MathML-input-compliant, rendering/reading
  831. tools must support deprecated features if they are to be 
  832. MathML 1.x compliant.   They do not have to support deprecated
  833. features to be considered MathML 2.0 compliant.  However, all tools
  834. are encouraged to support the old forms as much as
  835. possible.</p></item>
  836.  
  837. <item><p>In order to be MathML-roundtrip-compliant, a processor need
  838. only preserve MathML equivalence on expressions containing no
  839. deprecated features.</p></item>
  840. </olist>
  841.  
  842. </div4>
  843. </div3>
  844.  
  845. <div3 id="interf_error"><head>Handling of Errors</head>
  846.  
  847. <p>If a MathML-input-compliant application receives input containing one or
  848. more elements with an illegal number or type of attributes or child
  849. schemata, it should nonetheless attempt to render all the input in an
  850. intelligible way, i.e. to render normally those parts of the input that
  851. were valid, and to render error messages (rendered as if enclosed in
  852. an <intref ref="presm_merror"><kw role="element">merror</kw></intref>
  853. element) in place of invalid expressions.</p>
  854.  
  855. <p>MathML-output-compliant applications such as editors and translators may
  856. choose to generate <kw role="element">merror</kw> expressions to signal
  857. errors in their input. This is usually preferable to generating valid, but
  858. possibly erroneous, MathML.</p>
  859. </div3>
  860.  
  861. <div3 id="interf_unspecified"><head>Attributes for unspecified data</head>
  862.  
  863. <p>The MathML attributes described in the MathML specification are
  864. necessary for presentation and content markup. Ideally, the MathML
  865. attributes should be an open-ended list so that users can add specific
  866. attributes for specific renderers. However, this cannot be done within
  867. the confines of a single XML DTD. Although it can be done using
  868. extensions of the standard DTD, some authors will wish to use
  869. non-standard attributes to take advantage of renderer-specific
  870. capabilities while remaining strictly in compliance with the standard
  871. DTD.</p>
  872.  
  873. <p>To allow this, the MathML 1.0 specification allowed the attribute
  874. <kw role="attrib">other</kw> on all elements, for use as a hook to
  875. pass on renderer-specific information. In particular, it was intended
  876. as a hook for passing information to audio renderers, computer algebra
  877. systems, and for pattern matching in future macro/extension
  878. mechanisms. The motivation for this approach to the problem was
  879. historical, looking to PostScript, for example, where comments are
  880. widely used to pass information that is not part of PostScript.</p>
  881.  
  882. <p>In the meantime, however, the development of a general XML namespace
  883. mechanism has made the use of the <kw role="attrib">other</kw>
  884. attribute obsolete.  In MathML 2.0, the <kw role="attrib">other</kw>
  885. attribute is <intref ref="interf_deprec">deprecated</intref>
  886. in favor of the use of namespace
  887. prefixes to identify non-MathML attributes.</p>
  888.  
  889. <p>For example, in MathML 1.0, it was recommended that if additional information
  890. was used in a renderer-specific implementation for the <kw
  891. role="element">maction</kw> element (<specref ref="presm_maction"/>),
  892. that information should be passed in using the <kw
  893. role="attrib">other</kw> attribute:</p>
  894.  
  895. <eg><![CDATA[
  896. <maction actiontype="highlight" other="color='#ff0000'"> expression </maction>
  897. ]]></eg>
  898.  
  899. <p>In MathML 2.0, a <kw role="attrib">color</kw> attribute from another
  900. namespace would be used:</p>
  901.  
  902. <eg><![CDATA[
  903. <body xmlns:my="http://www.example.com/MathML/extensions">
  904. ...
  905. <maction actiontype="highlight" my:color="#ff0000"> expression </maction>
  906. ...
  907. </body>
  908. ]]></eg>
  909.  
  910. <p>Note that the intent of allowing non-standard attributes is
  911. <emph>not</emph> to encourage software developers to use this as a
  912. loophole for circumventing the core conventions for MathML markup. 
  913. Authors and applications should use non-standard attributes
  914. judiciously.</p>
  915.  
  916. </div3>
  917. </div2>
  918.  
  919. <div2 id="interf_future"><head>Future Extensions</head>
  920.  
  921. <p>If MathML is to remain useful in the future, it is to be expected
  922. that MathML will need to be extended and revised in various ways. Some
  923. of these extensions can be easily foreseen; for example, as work on
  924. behavioral extensions to CSS proceeds, MathML will likely need to be
  925. extended as well.</p>
  926.  
  927. <p>Similarly, there are several kinds of functionality that are fairly
  928. obvious candidates for future MathML extensions. These include macros,
  929. style sheets, and perhaps a general facility for <quote>labeled
  930. diagrams</quote>. However, there will no doubt be other desirable
  931. extensions to MathML that will only emerge as MathML is widely used. For
  932. these extensions, the W3C Math Working Group relies on the extensible
  933. architecture of XML, and the common sense of the larger Web community.</p>
  934.  
  935. <div3><head>Macros and Style Sheets</head>
  936.  
  937. <p>The development of style-sheet mechanisms for XML is part of the ongoing
  938. XML activity of the World Wide Web Consortium. Both XSL and CSS are working
  939. to incorporate greater support for mathematics.</p> 
  940.  
  941. <p>In particular, XSL Transformations <bibref ref="XSLT"/> are likely
  942. to have a large impact on the future development of MathML.  Macros
  943. have traditionally contributed greatly the usability and effectiveness
  944. of mathematics encodings.  Further work developing applications of
  945. XSLT tailored specifically to MathML is clearly called for.</p>
  946.  
  947. <p>Some of the possible uses of macro capabilities for MathML include:
  948. <glist>
  949. <gitem><label>Abbreviation</label>
  950. <def><p>One common use of macros is for
  951. abbreviation. Authors needing to repeat some complicated but constant
  952. notation can define a macro. This greatly facilitates hand authoring.
  953. Macros that allow for substitution of parameters facilitate such usage
  954. even further.</p></def>
  955. </gitem>
  956.  
  957. <gitem><label>Extension of Content Markup</label>
  958. <def><p>By defining macros for semantic objects, for example a binomial
  959. coefficient, or a Bessel function, one can in effect extend the content
  960. markup for MathML.  Such a macro could include an explicit semantic
  961. binding, or such a binding could be easily added by an external
  962. application. Narrowly defined disciplines should be able to easily
  963. introduce standardized content markup by using standard macro packages. For
  964. example, the OpenMath project could release macro packages for attaching
  965. OpenMath content markup.</p></def>
  966. </gitem>
  967.  
  968. <gitem><label>Rendering and Style Control</label>
  969. <def><p>Another basic way in which macros are often used is to provide a
  970. way of controlling style and rendering behavior by replacing high-level
  971. macro definitions. This is especially important for controlling the
  972. rendering behavior of MathML content tags in a context sensitive way. Such
  973. a macro capability is also necessary to provide a way of attaching
  974. renderings to user-defined XML extensions to the MathML core.</p></def>
  975. </gitem>
  976.  
  977. <gitem><label>Accessibility</label>
  978. <def><p>Reader-controlled style sheets are important in providing
  979. accessibility to MathML. For example, a reader listening to a voice
  980. renderer might, by default, hear a bit of MathML presentation markup read as
  981. <quote>D sub x sup 2 of f</quote>. Knowing the context to be multi-variable
  982. calculus, the reader may wish to use a style sheet or macro package that
  983. instructs the renderer to render this <kw role="starttag">msubsup</kw>
  984. element as <quote>second derivative with respect to x of f</quote>.</p></def>
  985. </gitem>
  986. </glist>
  987. </p>
  988. </div3>
  989.  
  990. <div3><head>XML Extensions to MathML</head>
  991.  
  992. <p>The set of elements and attributes specified in the MathML
  993. specification are necessary for rendering common mathematical expressions.
  994. It is recognized that not all mathematical notation is covered by this
  995. set of elements, that new notations are continually invented, and that
  996. sub-communities within mathematics often have specialized notations;
  997. and furthermore that the explicit extension of a standard is a
  998. necessarily slow and conservative process. This implies that the
  999. MathML standard could never explicitly cover all the presentational
  1000. forms used by every sub-community of authors and readers of
  1001. mathematics, much less encode all mathematical content.</p>
  1002.  
  1003. <p>In order to facilitate the use of MathML by the widest possible
  1004. audience, and to enable its smooth evolution to encompass more
  1005. notational forms and more mathematical content (perhaps eventually
  1006. covered by explicit extensions to the standard), the set of tags and
  1007. attributes is open-ended, in the sense described in this section.</p>
  1008.  
  1009. <p>MathML is described by an XML DTD, which necessarily limits the elements
  1010. and attributes to those occurring in the DTD. Renderers desiring to accept
  1011. non-standard elements or attributes, and authors desiring to include these
  1012. in documents, should accept or produce documents that conform to an
  1013. appropriately extended XML DTD that has the standard MathML DTD
  1014. as a subset.</p>
  1015.  
  1016. <p>MathML-compliant renderers are allowed, but not required, to accept
  1017. non-standard elements and attributes, and to render them in any way. If a
  1018. renderer does not accept some or all non-standard tags, it is encouraged
  1019. either to handle them as errors as described above for elements with the
  1020. wrong number of arguments, or to render their arguments as if they were
  1021. arguments to an <kw role="element">mrow</kw>, in either case rendering all
  1022. standard parts of the input in the normal way.</p>
  1023. </div3>
  1024. </div2>
  1025. </div1>
  1026.