1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Interactions with the Host Environment</title><style type="text/css">
.egmeta {
color:#5555AA;font-style:italic;font-family:serif;font-weight:bold;
}
table.syntax {
font-size: 75%;
background-color: #DDDDDD;
border: thin solid;
}
table.syntax td {
border: solid thin;
}
table.syntax th {
text-align: left;
}
table.attributes td { padding-left:0.5em; padding-right:0.5em; }
table.attributes td.attname { white-space:nowrap; vertical-align:top;}
table.attributes td.attdesc { background-color:#F0F0FF; padding-left:2em; padding-right:2em}
th.uname {font-size: 50%; text-align:left;}
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
li p { margin-top: 0.3em;
margin-bottom: 0.3em; }
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
a.mainindex {font-weight: bold;}
li.sitem {list-style-type: none;}
.error { color: red }
div.mathml-example {border:solid thin black;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
}
div.strict-mathml-example {border:solid thin black;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
}
div.strict-mathml-example h5 {
margin-top: -0.3em;
margin-bottom: -0.5em;}
var.meta {background-color:green}
var.transmeta {background-color:red}
pre.mathml {padding: 0.5em;
background-color: #FFFFDD;}
pre.mathml-fragment {padding: 0.5em;
background-color: #FFFFDD;}
pre.strict-mathml {padding: 0.5em;
background-color: #FFFFDD;}
.minitoc { border-style: solid;
border-color: #0050B2;
border-width: 1px ;
padding: 0.3em;}
.attention { border-style: solid;
border-width: 1px ;
color: #5D0091;
background: #F9F5DE;
border-color: red;
margin-left: 1em;
margin-right: 1em;
margin-top: 0.25em;
margin-bottom: 0.25em; }
.attribute-Name { background: #F9F5C0; }
.method-Name { background: #C0C0F9; }
.IDL-definition { border-style: solid;
border-width: 1px ;
color: #001000;
background: #E0FFE0;
border-color: #206020;
margin-left: 1em;
margin-right: 1em;
margin-top: 0.25em;
margin-bottom: 0.25em; }
.baseline {vertical-align: baseline}
#eqnoc1 {width: 10%}
#eqnoc2 {width: 80%; text-align: center; }
#eqnoc3 {width: 10%; text-align: right; }
div.div1 {margin-bottom: 1em;}
.h3style {
text-align: left;
font-family: sans-serif;
font-weight: normal;
color: #0050B2;
font-size: 125%;
}
h4 { text-align: left;
font-family: sans-serif;
font-weight: normal;
color: #0050B2; }
h5 { text-align: left;
font-family: sans-serif;
font-weight: bold;
color: #0050B2; }
th {background: #E0FFE0;}
p, blockquote, h4 { font-family: sans-serif; }
dt, dd, dl, ul, li { font-family: sans-serif; }
pre, code { font-family: monospace }
a.termref {
text-decoration: none;
color: black;
}
sub.diff-link {background-color: black; color: white; font-family:
sans-serif; font-weight: bold;}
.diff-add { background-color: #FFFF99}
.diff-del { background-color: #FF9999; text-decoration: line-through }
.diff-chg { background-color: #99FF99 }
.diff-off { }
.mathml-render {
font-family: serif;
font-size: 130%;
border: solid 4px green;
padding-left: 1em;
padding-right: 1em;
}
</style><link rel="stylesheet" type="text/css" href="../../../StyleSheets/TR/W3C-REC.css">
</head>
<body>
<h1><a name="world-interactions" id="world-interactions"></a>6 Interactions with the Host Environment
</h1>
<!-- TOP NAVIGATION BAR -->
<div class="minitoc">
Overview: <a href="Overview-d.html">Mathematical Markup Language (MathML) Version 3.0</a><br>
Previous: 5 <a href="chapter5-d.html">Mixing Markup Languages for Mathematical Expressions</a><br>
Next: 7 <a href="chapter7-d.html">Characters, Entities and Fonts</a><br><br>6 <a href="chapter6-d.html">Interactions with the Host Environment</a><br> 6.1 <a href="chapter6-d.html#world.introduction">Introduction</a><br> 6.2 <a href="chapter6-d.html#world.invoking.processors">Invoking MathML Processors</a><br> 6.2.1 <a href="chapter6-d.html#world.recognizing.mathml">Recognizing MathML in XML</a><br> 6.2.2 <a href="chapter6-d.html#world.resource.types">Resource Types for MathML Documents</a><br> 6.2.3 <a href="chapter6-d.html#encoding-names">Names of MathML Encodings</a><br> 6.3 <a href="chapter6-d.html#world-int-transfers">Transferring MathML</a><br> 6.3.1 <a href="chapter6-d.html#world-int-transf-flavors">Basic Transfer Flavor Names and Contents</a><br> 6.3.2 <a href="chapter6-d.html#world-int-transf-recommend">Recommended Behaviors when Transferring</a><br> 6.3.3 <a href="chapter6-d.html#world-int-transf-discuss">Discussion</a><br> 6.3.4 <a href="chapter6-d.html#world-int-transf-exa">Examples</a><br> 6.3.4.1 <a href="chapter6-d.html#id.6.3.4.1">Example 1</a><br> 6.3.4.2 <a href="chapter6-d.html#id.6.3.4.2">Example 2</a><br> 6.3.4.3 <a href="chapter6-d.html#id.6.3.4.3">Example 3</a><br> 6.3.4.4 <a href="chapter6-d.html#id.6.3.4.4">Example 4</a><br> 6.4 <a href="chapter6-d.html#world-int-combine-other">Combining MathML and Other Formats</a><br> 6.4.1 <a href="chapter6-d.html#interf.xhtml">Mixing MathML and XHTML</a><br> 6.4.2 <a href="chapter6-d.html#interf.html">Mixing MathML and HTML, and other non-XML contexts</a><br> 6.4.3 <a href="chapter6-d.html#interf.link">Linking</a><br> 6.4.4 <a href="chapter6-d.html#interf.graphics">MathML and Graphical Markup</a><br> 6.5 <a href="chapter6-d.html#world-int-style">Using CSS with MathML</a><br> 6.5.1 <a href="chapter6-d.html#id.6.5.1">Order of processing attributes versus style sheets</a><br> 6.5.2 <a href="chapter6-d.html#id.6.5.2">Layout engines that lack native MathML support</a><br></div>
<div class="div1">
<div class="div2">
<h2><a name="world.introduction" id="world.introduction"></a>6.1 Introduction
</h2>
<p>To be effective, MathML must work well with a wide variety of
renderers, processors, translators and editors. This chapter raises
some of the interface issues involved in generating and rendering
MathML. Since MathML exists primarily to encode mathematics in Web
documents, perhaps the most important interface issues relate to
embedding MathML in <a href="appendixh-d.html#HTML5">[HTML5]</a>, and
<a href="appendixg-d.html#XHTML">[XHTML]</a>, and in any newer HTML
when it appears.
</p>
<p>There are three kinds of interface issues that arise in embedding
MathML in other XML documents. First, MathML markup must be recognized
as valid embedded XML
content, and not as an error. This issue could be seen primarily as a
question of managing namespaces in XML <a href="appendixg-d.html#Namespaces">[Namespaces]</a>.
However, the implementation of XML namespaces and their management has
not been well supported by recent commercial software. As a result,
other mechanisms have appeared to deal with "foreign
content" in XML document types.
</p>
<p>Second, in the case of HTML/XHTML, MathML rendering must be
integrated with browser software. Some browsers already implement
MathML rendering natively, and one can expect more browsers will do so
in the future. At the same time, other browsers
have developed infrastructure to facilitate the rendering of MathML
and other embedded XML content by third-party software or other
built-in technology. Examples of this built-in technology are the
sophisticated CSS rendering engines now available, and the powerful
implementations of JavaScript/ECMAScript that are becoming
common. Using these browser-specific mechanisms generally requires
additional interface markup of some sort to activate them. In the
case of CSS, there is a special restricted form of MathML3
<a href="appendixh-d.html#MathMLforCSS">[MathMLforCSS]</a> that is tailored for use with
CSS rendering engines that support CSS 2.1 <a href="appendixh-d.html#CSS21">[CSS21]</a>.
This restricted profile of MathML3 does not offer the full
expressiveness of MathML3, but it provides a portable simpler form
that can be rendered acceptably on the screen by modern CSS engines.
</p>
<p>Third, other tools for generating and processing MathML must be
able to communicate. A number of MathML tools have been or are
being developed, including editors, translators, computer algebra
systems, and other scientific software. However, since MathML
expressions tend to be lengthy, and prone to error when entered by
hand, special emphasis must be made to ensure that MathML can easily
be generated by user-friendly conversion and authoring tools, and
that these tools work together in a dependable, platform-independent,
and vendor-independent way.
</p>
<p>
This chapter applies to both content and presentation markup, and describes
a particular processing model for the <code>semantics</code>, <code>annotation</code>
and <code>annotation-xml</code> elements described in
<a href="chapter5-d.html#mixing.semantic.annotations">Section 5.1 Annotation Framework</a>.
</p>
</div>
<div class="div2">
<h2><a name="world.invoking.processors" id="world.invoking.processors"></a>6.2 Invoking MathML Processors
</h2>
<div class="div3">
<h3><a name="world.recognizing.mathml" id="world.recognizing.mathml"></a>6.2.1 Recognizing MathML in XML
</h3>
<p>Within an XML document supporting namespaces <a href="appendixg-d.html#XML">[XML]</a>,
<a href="appendixg-d.html#Namespaces">[Namespaces]</a>, the preferred method to recognize
MathML markup is by the identification of the <code>math</code> element
in the MathML namespace by the use of the MathML namespace
URI <code>http://www.w3.org/1998/Math/MathML</code>.
</p>
<p>The MathML namespace URI is the recommended method to embed MathML
within <a href="appendixg-d.html#XHTML">[XHTML]</a> documents. However, some user-agents may
require supplementary information to be available to allow them to invoke
specific extensions to process the MathML markup.
</p>
<p>Markup-language specifications that wish to embed MathML may require
special conditions to recognize MathML markup that are independent of
this recommendation. The conditions should be similar to those expressed
in this recommendation, and the local names of the MathML elements should
remain the same as those defined in this recommendation.
</p>
</div>
<div class="div3">
<h3><a name="world.resource.types" id="world.resource.types"></a>6.2.2 Resource Types for MathML Documents
</h3>
<p>Although rendering MathML expressions often takes place in
a Web browser, other MathML processing functions take place more
naturally in other applications. Particularly common tasks include
opening a MathML expression in an equation editor or computer algebra
system. It is important therefore to specify the encoding names
by which MathML fragments should be identified.
</p>
<p>Outside of those environments where XML namespaces are recognized,
media types <a href="appendixg-d.html#RFC2045">[RFC2045]</a>, <a href="appendixg-d.html#RFC2046">[RFC2046]</a> should
be used if possible to ensure the invocation of a MathML processor.
For those environments where media types are not appropriate, such as
clipboard formats on some platforms, the encoding names described
in the next section should be used.
</p>
</div>
<div class="div3">
<h3><a name="encoding-names" id="encoding-names"></a>6.2.3 Names of MathML Encodings
</h3>
<p>MathML contains two distinct vocabularies: one for encoding visual
presentation, defined in <a href="chapter3-d.html">Chapter 3 Presentation Markup</a>, and one for encoding
computational structure, defined in <a href="chapter4-d.html">Chapter 4 Content Markup</a>. Some MathML
applications may import and export only one of these two vocabularies,
while others may produce and consume each in a different way, and still
others may process both without any distinction between the two. The
following encoding names may be used to distinguish between content
and presentation MathML markup when needed.
</p>
<ul>
<li>
<p><em>MathML-Presentation</em>:
The instance contains presentation MathML markup only.
</p>
<ul>
<li>
<p>Media Type: <code>application/mathml-presentation+xml</code></p>
</li>
<li>
<p>Windows Clipboard Flavor: <code>MathML Presentation</code></p>
</li>
<li>
<p>Universal Type Identifier: <code>public.mathml.presentation</code></p>
</li>
</ul>
</li>
<li>
<p><em>MathML-Content</em>:
The instance contains content MathML markup only.
</p>
<ul>
<li>
<p>Media Type: <code>application/mathml-content+xml</code></p>
</li>
<li>
<p>Windows Clipboard Flavor: <code>MathML Content</code></p>
</li>
<li>
<p>Universal Type Identifier: <code>public.mathml.content</code></p>
</li>
</ul>
</li>
<li>
<p><em>MathML</em> (generic):
The instance may contain presentation MathML markup, content MathML markup,
or a mixture of the two.
</p>
<ul>
<li>
<p>File name extension: <code>.mml</code></p>
</li>
<li>
<p>Media Type: <code>application/mathml+xml</code></p>
</li>
<li>
<p>Windows Clipboard Flavor: <code>MathML</code></p>
</li>
<li>
<p>Universal Type Identifier: <code>public.mathml</code></p>
</li>
</ul>
</li>
</ul>
<p>See <a href="appendixb-d.html">Appendix B Media Types Registrations</a> for more details about each of these
encoding names.
</p>
<p>MathML 2 specified the predefined encoding values <code>MathML</code>,
<code>MathML-Content</code>, and <code>MathML-Presentation</code> for the
<code>encoding</code> attribute on the <code>annotation-xml</code> element.
These values may be used as an alternative to the media type for backward
compatibility. See <a href="chapter5-d.html#mixing.alternate.representations">Section 5.1.3 Alternate representations</a> and
<a href="chapter5-d.html#mixing.content.equiv">Section 5.1.4 Content equivalents</a> for details.
Moreover, MathML 1.0 suggested the media-type <code>text/mathml</code>,
which has been superseded by <a href="appendixg-d.html#RFC3023">[RFC3023]</a>.
</p>
</div>
</div>
<div class="div2">
<h2><a name="world-int-transfers" id="world-int-transfers"></a>6.3 Transferring MathML
</h2>
<p>MathML expressions are often exchanged between applications using the
familiar copy-and-paste or drag-and-drop paradigms and are often stored
in files or exchanged over the HTTP protocol. This section provides
recommended ways to process MathML during these transfers.
</p>
<p>The transfers of MathML fragments described in this section occur between
the contexts of two applications by making the MathML data available in
several flavors, often called <em>media types</em>, <em>clipboard
formats</em>, or <em>data flavors</em>. These flavors are typically
ordered by preference by the producing application, and are typically
examined in preference order by the consuming application. The
copy-and-paste paradigm allows an application to <em>place</em>
content in a central <em>clipboard</em>, with one data stream per
<em>clipboard format</em>; a consuming application negotiates by
choosing to read the data of the format it prefers. The drag-and-drop
paradigm allows an application to <em>offer</em> content by declaring
the available formats; a potential recipient accepts or rejects a drop
based on the list of available formats, and the drop action allows the
receiving application to request the delivery of the data in one of the
indicated formats. An HTTP GET transfer, as in <a href="appendixh-d.html#HTTP11">[HTTP11]</a>,
allows a client to submit a list of acceptable media types; the server
then delivers the data using the one of the indicated media types.
An HTTP POST transfer, as in <a href="appendixh-d.html#HTTP11">[HTTP11]</a>, allows a client
to submit data labelled with a media type that is acceptable to the
server application.
</p>
<p>Current desktop platforms offer copy-and-paste and drag-and-drop
transfers using similar architectures, but with varying naming schemes
depending on the platform. HTTP transfers are all based on media types.
This section specifies what transfer types applications should provide,
how they should be named, and how they should handle the special
<code>semantics</code>, <code>annotation</code>, and <code>annotation-xml</code>
elements.
</p>
<p>To summarize the three negotiation mechanisms, the following paragraphs
will describe transfer <em>flavors</em>, each with a <em>name</em>
(a character string) and <em>content</em> (a stream of binary data),
which are <em>offered</em>, <em>accepted</em>, and/or
<em>exported</em>.
</p>
<div class="div3">
<h3><a name="world-int-transf-flavors" id="world-int-transf-flavors"></a>6.3.1 Basic Transfer Flavor Names and Contents
</h3>
<p>The names listed in <a href="chapter6-d.html#encoding-names">Section 6.2.3 Names of MathML Encodings</a> are the exact
strings that should be used to identify the transfer flavors that
correspond to the MathML encodings. On operating systems that allow
such, an application should register their support for these flavor
names (e.g. on Windows, a call to RegisterClipboardFormat, or, on the
Macintosh platform, declaration of support for the universal type
identifier in the application descriptor).
</p>
<p>When transferring MathML, an application MUST ensure the content
of the data transfer is a
<a href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-wellformed">well-formed</a>
XML instance of a MathML document type. Specifically:
</p>
<ol type="1">
<li>
<p>The instance MAY begin with an XML declaration,
e.g. <?xml version="1.0">
</p>
</li>
<li>
<p>The instance MUST contain exactly one root <code>math</code> element.
</p>
</li>
<li>
<p>The instance MUST declare the MathML namespace
on the root <code>math</code> element.
</p>
</li>
<li>
<p>The instance MAY use a <code>schemaLocation</code> attribute
on the <code>math</code> element to indicate the location of the MathML
schema that describes the MathML document type to which the instance
conforms. The presence of the <code>schemaLocation</code> attribute
does not require a consumer of the MathML instance to obtain or use
the referenced schema.
</p>
</li>
<li>
<p>The instance SHOULD use numeric character references
(e.g. &#x03b1;) rather than character entity names
(e.g. &alpha;) for greater interoperability.
</p>
</li>
<li>
<p>The instance MUST specify the character encoding, if it uses an
encoding other than UTF-8, either in the XML declaration, or by the use
of a byte-order mark (BOM) for UTF-16-encoded data.
</p>
</li>
</ol>
</div>
<div class="div3">
<h3><a name="world-int-transf-recommend" id="world-int-transf-recommend"></a>6.3.2 Recommended Behaviors when Transferring
</h3>
<p>An application that transfers MathML markup SHOULD adhere to the following
conventions:
</p>
<ol type="1">
<li>
<p>An application that supports pure presentation markup and/or pure
content markup SHOULD offer as many of these flavors as it has available.
</p>
</li>
<li>
<p>An application that only exports one MathML flavor SHOULD name it
<code>MathML</code> if it is unable to determine a more specific flavor.
</p>
</li>
<li>
<p>
If an application is able to determine a more specific flavor, it SHOULD
offer both the generic and specific transfer flavors, but it SHOULD only
deliver the specific flavor if it knows that the recipient supports it.
For an HTTP GET transfer, for example, the specific transfer types for
content and presentation markup should only be returned if they are
included in the the HTTP <code>Accept</code> header sent by the client.
</p>
</li>
<li>
<p>
An application that exports the two specific transfer flavors SHOULD
export both the content and presentation transfer flavors, as well as
the generic flavor, which SHOULD combine the other two flavors using
a top-level MathML <code>semantics</code> element
(see <a href="chapter5-d.html#mixing.top.level">Section 5.4.1 Top-level Parallel Markup</a>).
</p>
</li>
<li>
<p>
When an application exports a MathML fragment whose only child of the
root element is a <code>semantics</code> element, it SHOULD offer, after
the above flavors, a transfer flavor for each <code>annotation</code> or
<code>annotation-xml</code> element, provided the transfer flavor can be
recognized and named based on the <code>encoding</code> attribute value,
and provided the annotation key is (the default)
<a href="http://www.openmath.org/cd/mathmlkeys.xhtml#alternate-representation">alternate-representation</a>.
The transfer content for each annotation should contain the character data
in the specified encoding (for an <code>annotation</code> element), or a
well-formed XML fragment (for an <code>annotation-xml</code> element), or
the data that results by requesting the URL given by the <code>src</code>
attribute (for an annotation reference).
</p>
</li>
<li>
<p>As a final fallback, an application MAY export a version of
the data in a plain-text flavor (such as <code>text/plain</code>,
<code>CF_UNICODETEXT</code>, <code>UnicodeText</code>, or
<code>NSStringPboardType</code>). When an application has multiple
versions of an expression available, it may choose the version to
export as text at its discretion. Since some older MathML processors
expect MathML instances transferred as plain text to begin with a
<code>math</code> element, the text version SHOULD generally omit the XML
declaration, DOCTYPE declaration, and other XML prolog material that
would appear before the <code>math</code> element. The Unicode
text version of the data SHOULD always be the last flavor exported,
following the principle that exported flavors should be ordered with
the most specific flavor first and the least specific flavor last.
</p>
</li>
</ol>
</div>
<div class="div3">
<h3><a name="world-int-transf-discuss" id="world-int-transf-discuss"></a>6.3.3 Discussion
</h3>
<p>To determine whether a MathML instance is pure content markup or
pure presentation markup, the <code>math</code>, <code>semantics</code>,
<code>annotation</code> and <code>annotation-xml</code> elements should be
regarded as belonging to both the presentation and content markup
vocabularies. The <code>math</code> element is treated in this way
because it is required as the root element in any MathML transfer.
The <code>semantics</code> element and its child annotation elements
comprise an arbitrary annotation mechanism within MathML, and are
not tied to either presentation or content markup. Consequently,
an application that consumes MathML should always process these four
elements, even if it only implements one of the two vocabularies.
</p>
<p>It is worth noting that the above recommendations allow agents
that produce MathML to provide binary data for the clipboard, for
example in an image or other application-specific format. The sole
method to do so is to reference the binary data using the <code>src</code>
attribute of an annotation, since XML character data does not allow
for the transfer of arbitrary byte-stream data.
</p>
<p>While the above recommendations are intended to improve
interoperability between MathML-aware applications that use these
transfer paradigms, it should be noted that they do not guarantee
interoperability. For example, references to external resources
(e.g. stylesheets, etc.) in MathML data can cause interoperability
problems if the consumer of the data is unable to locate them,
as can happen when cutting and pasting HTML or other data types.
An application that makes use of references to external resources
is encouraged to make users aware of potential problems and provide
alternate ways to obtain the referenced resources. In general,
consumers of MathML data that contains references they cannot
resolve or do not understand should ignore the external references.
</p>
</div>
<div class="div3">
<h3><a name="world-int-transf-exa" id="world-int-transf-exa"></a>6.3.4 Examples
</h3>
<div class="div4">
<h4><a name="id.6.3.4.1" id="id.6.3.4.1"></a>6.3.4.1 Example 1
</h4>
<p>An e-Learning application has a database of quiz questions, some of
which contain MathML. The MathML comes from multiple sources, and the
e-Learning application merely passes the data on for display, but does
not have sophisticated MathML analysis capabilities. Consequently,
the application is not aware whether a given MathML instance is pure
presentation or pure content markup, nor does it know whether the
instance is valid with respect to a particular version of the MathML schema. It therefore
places the following data formats on the clipboard:
</p>
<table id="table-flavor-a" border="1">
<thead>
<tr>
<th>Flavor Name</th>
<th>Flavor Content</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>MathML</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">...</math></pre></td>
</tr>
<tr>
<td><code>Unicode Text</code></td>
<td><pre class="mathml-fragment"><math xmlns="http://www.w3.org/1998/Math/MathML">...</math></pre></td>
</tr>
</tbody>
</table>
</div>
<div class="div4">
<h4><a name="id.6.3.4.2" id="id.6.3.4.2"></a>6.3.4.2 Example 2
</h4>
<p>An equation editor on the Windows platform is able to generate pure presentation markup,
valid with respect to MathML 3. Consequently, it
exports the following flavors:
</p>
<table id="table-flavor-b" border="1">
<thead>
<tr>
<th>Flavor Name</th>
<th>Flavor Content</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>MathML Presentation</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">...</math></pre></td>
</tr>
<tr>
<td><code>Tiff</code></td>
<td>(a rendering sample)</td>
</tr>
<tr>
<td><code>Unicode Text</code></td>
<td><pre class="mathml-fragment"><math xmlns="http://www.w3.org/1998/Math/MathML">...</math></pre></td>
</tr>
</tbody>
</table>
</div>
<div class="div4">
<h4><a name="id.6.3.4.3" id="id.6.3.4.3"></a>6.3.4.3 Example 3
</h4>
<p>A schema-based content management system on the Mac OS X platform contains multiple MathML
representations of a collection of mathematical expressions, including mixed
markup from authors, pure content markup for interfacing to symbolic computation
engines, and pure presentation markup for print publication. Due to the system's
use of schemata, markup is stored with a namespace prefix.
The system therefore can transfer the following data:
</p>
<table id="table-flavor-c" border="1">
<thead>
<tr>
<th>Flavor Name</th>
<th>Flavor Content</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>public.mathml.presentation</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
...
<mml:mrow>
</mml:math></pre></td>
</tr>
<tr>
<td><code>public.mathml.content</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:apply>
...
<mml:apply>
</mml:math></pre></td>
</tr>
<tr>
<td><code>public.mathml</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
<mml:apply>
... content markup within presentation markup ...
</mml:apply>
...
</mml:mrow>
</mml:math> </pre></td>
</tr>
<tr>
<td><code>public.plain-text.tex</code></td>
<td><pre class="TeX">{x \over x-1}</pre></td>
</tr>
<tr>
<td><code>public.plain-text</code></td>
<td><pre class="mathml-fragment"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
...
<mml:mrow>
</mml:math></pre></td>
</tr>
</tbody>
</table>
</div>
<div class="div4">
<h4><a name="id.6.3.4.4" id="id.6.3.4.4"></a>6.3.4.4 Example 4
</h4>
<p>A similar content management system is web-based and delivers MathML
representations of mathematical expressions. The system is able to produce
MathML-Presentation, MathML-Content, TeX and pictures in TIFF format.
In web-pages being browsed, it could produce a MathML fragment such as the following:
</p><pre class="mathml-fragment"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
<mml:semantics>
<mml:mrow>...</mml:mrow>
<mml:annotation-xml encoding="MathML-Content">...</mml:annotation-xml>
<mml:annotation encoding="TeX">{1 \over x}</mml:annotation>
<mml:annotation encoding="image/tiff" src="formula3848.tiff"/>
</mml:semantics>
</mml:math>
</pre><p>A web-browser on the Windows platform that receives such a fragment and tries to export it as part of
a drag-and-drop action, can offer the following flavors:
</p>
<table id="table-flavor-d" border="1">
<thead>
<tr>
<th>Flavor Name</th>
<th>Flavor Content</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>MathML Presentation</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
...
<mml:mrow>
</mml:math></pre></td>
</tr>
<tr>
<td><code>MathML Content</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:apply>
...
<mml:apply>
</mml:math></pre></td>
</tr>
<tr>
<td><code>MathML</code></td>
<td><pre class="mathml-fragment"><?xml version="1.0"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
<mml:apply>
... content markup within presentation markup ...
</mml:apply>
...
</mml:mrow>
</mml:math> </pre></td>
</tr>
<tr>
<td><code>TeX</code></td>
<td><pre class="TeX">{x \over x-1}</pre></td>
</tr>
<tr>
<td><code>CF_TIFF</code></td>
<td>(the content of the picture file, requested from formula3848.tiff)</td>
</tr>
<tr>
<td><code>CF_UNICODETEXT</code></td>
<td><pre class="mathml-fragment"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<mml:mrow>
...
<mml:mrow>
</mml:math></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="div2">
<h2><a name="world-int-combine-other" id="world-int-combine-other"></a>6.4 Combining MathML and Other Formats
</h2>
<p>MathML is usually used in combination with other markup languages.
The most typical case is perhaps the use of MathML within a
document-level markup language, such as XHTML or DocBook. It is also
common that other object-level markup languages are also included in a
compound document format, such as the W3C XHTML+MathML+SVG
profile. Other common use cases include mixing other markup within
MathML. For example, an authoring tool might insert an element
representing a cursor position or other state information within
MathML markup, so that an author can pick up editing where he or
she left off.
</p>
<p>Most document markup languages have some concept of an inline
equation, (or graphic, object, etc.) so there is a typically a natural
way to incorporate MathML instances into the content
model. However, in the other direction, embedding of markup within
MathML is not so clear cut, since in many MathML elements, the role of
child elements is defined by position. For example, the first
child of an <code>apply</code> must be an operator, and the second child
of an <code>mfrac</code> is the denominator. The proper behavior when
foreign markup appears in such contexts is problematic. Even when such
behavior can be defined in a particular context, it presents an
implementation challenge for generic MathML processors.
</p>
<p>For this reason, the default MathML schema does not allow
foreign markup elements to be included within MathML
instances.
</p>
<p>In the standard schema, elements from other namespaces
are not allowed, but attributes from other namespaces are permitted.
MathML processors that encounter unknown XML markup should behave
as follows:
</p>
<ol type="1">
<li>
<p>An attribute from a non-MathML namespace should be silently ignored.</p>
</li>
<li>
<p>An element from a non-MathML namespace should be treated
as an error, except in an <code>annotation-xml</code> element.
If the element is a child of a presentation element, it should be
handled as described in <a href="chapter3-d.html#presm.merror">Section 3.3.5 Error Message <code><merror></code></a>.
If the element is a child of a content element, it should be
handled as described in <a href="chapter4-d.html#contm.cerror">Section 4.2.9 Error Markup <code><cerror></code></a>.
</p>
</li>
</ol>
<p>
For example, if the second child of an <code>mfrac</code> element is an
unknown element, the fraction should be rendered with a denominator
that indicates the error.
</p>
<p>When designing a compound document format in which MathML is included in a larger document type, the designer may extend the
content model of MathML to allow additional elements. For example, a common extension is to extend the MathML schema such
that elements from non-MathML namespaces are
allowed in token elements, but not in other elements. MathML processors that
encounter unknown markup should behave as follows:
</p>
<ol type="1">
<li>
<p>An unrecognized XML attribute should be silently ignored.</p>
</li>
<li>
<p>An unrecognized element in a MathML token element should be silently ignored.</p>
</li>
<li>
<p>An element from a non-MathML namespace should be treated
as an error, except in an <code>annotation-xml</code> element.
If the element is a child of a presentation element, it should be
handled as described in <a href="chapter3-d.html#presm.merror">Section 3.3.5 Error Message <code><merror></code></a>.
If the element is a child of a content element, it should be
handled as described in <a href="chapter4-d.html#contm.cerror">Section 4.2.9 Error Markup <code><cerror></code></a>.
</p>
</li>
</ol>
<p>Extending the schema in this way is easily achieved using the Relax NG schema described in <a href="appendixa-d.html">Appendix A Parsing MathML</a>, it may be as simple as including the MathML schema whilst overriding the content model of <code>mtext</code>:
</p><pre>
default namespace m = "http://www.w3.org/1998/Math/MathML"
include "mathml3.rnc" {
mtext = element mtext {mtext.attributes, (token.content|anyElement)*}
}
</pre><p>
The definition given here would allow any well formed XML that is not in the MathML namespace as a child of <code>mtext</code>. In practice this may be too lax. For example, an XHTML+MathML Schema may just want to allow inline XHTML elements as additional
children of <code>mtext</code>. This may be achieved by replacing <code>anyElement</code> by a suitable production from the <span class="diff-chg">schema</span> for the host document type.
</p>
<p>Considerations about mixing markup vocabularies in compound
documents arise when a compound document type is first designed.
But once the document type is fixed, it is not generally practical
for specific software tools to further modify the content model to
suit their needs.
However, it is still frequently the case that such tools may need to
persist additional information within a MathML instance. Since MathML
is most often generated by authoring tools, a particularly common and
important case is where an authoring tool needs to persist information
about its internal state along with a MathML expression, so an author
can resume editing from a previous state. For example, placeholders
may be used to indicate incomplete parts of an expression, or a
insertion point within an expression may need to be persisted.
</p>
<p>An application that needs to persist private data within a MathML
expression should generally attempt to do so without altering the
underlying content model, even in situations where it is feasible to
do so. To support this requirement, regardless of what may be allowed
by the content model of a particular compound document format, MathML
permits the persistence of private data via the following strategies:
</p>
<ol type="1">
<li>
<p>For small amounts of data, attributes from other namespaces
are allowed on all MathML elements.
</p>
</li>
<li>
<p>For larger amounts of data, applications may use the
<code>semantics</code> element, as described in
<a href="chapter5-d.html#mixing.semantic.annotations">Section 5.1 Annotation Framework</a>.
</p>
</li>
<li>
<p>For authoring tools and other applications that need to
associate particular actions with presentation MathML subtrees,
e.g. to mark an incomplete expression to be filled in by an author,
the <code>maction</code> element may be used, as described in
<a href="chapter3-d.html#presm.maction">Section 3.7.1 Bind Action to Sub-Expression
<code><maction></code></a>.
</p>
</li>
</ol>
<div class="div3">
<h3><a name="interf.xhtml" id="interf.xhtml"></a>6.4.1 Mixing MathML and XHTML
</h3>
<p>To fully integrate MathML into XHTML, it should be possible not
only to embed MathML in XHTML (as described in <a href="chapter6-d.html#world.recognizing.mathml">Section 6.2.1 Recognizing MathML in XML</a>, but also see <a href="chapter2-d.html#interf.toplevel">Section 2.2 The Top-Level
<code>math</code> Element</a>), but also to embed XHTML in MathML. However,
fragments using MathML extended in this way can not be reliably used
in other MathML systems that do not support the compound document
format. Therefore, at present, the MathML specification does not
allow XHTML elements within a MathML expression, although when
specifying a particular instance of a compound document format using
both XHTML and MathML, the designer may wish to extend the MathML
Schema to allow certain XHTML elements as children of MathML token
elements; <code>mtext</code> may be the most suitable element for such an
extension as described above.
</p>
<p>In most cases, XHTML elements (headings, paragraphs, lists, etc.)
either do not apply in mathematical contexts, or MathML already
provides equivalent or improved functionality specifically tailored
to mathematical content (tables, mathematics style changes,
etc.).
</p>
<p>While the use of namespaces to embed MathML in other XML
applications is completely described by <a href="appendixg-d.html#Namespaces">[Namespaces]</a>,
a certain degree of pragmatism is necessary.
Support for XML, namespaces, and rendering behaviors in
popular user agents is not currently in alignment with W3C
Recommendations. When using namespace prefixes with MathML
markup, some situations require the of use <code>m:</code>
as a conventional namespace prefix for MathML markup. Using
this conventional namespace prefix may provide better
compatibility in current user agents. For example:
</p><pre>
<body>
...
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:mrow>...<m:mrow>
</m:math>
...
</body>
</pre><p>Consult the <a href="http://www.w3.org/Math/">W3C Math Working
Group</a> home page for compatibility and implementation suggestions
for current browsers and other MathML-aware tools.
</p>
</div>
<div class="div3">
<h3><a name="interf.html" id="interf.html"></a>6.4.2 Mixing MathML and HTML, and other non-XML contexts
</h3>
<p>MathML is defined as an XML vocabulary and may be included into many
larger XML document types of which XHTML is an important example as
discussed in the previous section. There may be other non-XML
vocabularies which require markup for Mathematical expressions, where it
makes sense to reference this specification. If a non-XML syntax is used
for MathML then formally this specification
does not apply. However implementations of such a syntax should, if possible,
offer a facility to output any mathematical expressions as MathML in the XML syntax
defined here. Such an application would then be a
MathML-output-conformant processor as described in
<a href="chapter2-d.html#fund.mathmlconf">Section 2.3.1 MathML Conformance</a>.
</p>
<p>An important example of such a non-XML based system is defined in <a href="appendixh-d.html#HTML5">[HTML5]</a>. HTML5 incorporates MathML using a slightly
modified syntax
(for example, in HTML5, some attribute values need not be surrounded by quotes)
in documents served with media type text/html. <a href="appendixh-d.html#HTML5">[HTML5]</a> contains details for how
MathML is included in HTML5 (and XHTML5).
</p>
</div>
<div class="div3">
<h3><a name="interf.link" id="interf.link"></a>6.4.3 Linking
</h3>
<p>In MathML 3, an element is designated as a link by the presence of
the <code>href</code> attribute. MathML has no element that corresponds
to the HTML/XHTML anchor element <var>a</var>.
</p>
<p>MathML allows the <code>href</code> attribute on all
elements.
However, most user agents have no way
to implement nested links or links on elements with no visible rendering;
such links may have no effect.
</p>
<p>The list of presentation markup elements that do not ordinarily
have a visual rendering, and thus should not be used as linking
elements, is given in the table below.
</p>
<table id="table-nolink" width="75%">
<thead>
<tr>
<th colspan="2">MathML elements that should not be linking elements</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>mprescripts</code></td>
<td><code>none</code></td>
</tr>
<tr>
<td><code>malignmark</code></td>
<td><code>maligngroup</code></td>
</tr>
</tbody>
</table>
<p>For compound document formats that support linking mechanisms, the
<code>id</code> attribute should
be used to specify the location for a link into a MathML expression. The
<code>id</code> attribute is allowed on all MathML elements, and its value
must be unique within a document, making it ideal for this purpose.
</p>
<p>Note that MathML 2 has no direct support for linking; it refers to
the W3C Recommendation "XML Linking Language" <a href="appendixh-d.html#XLink">[XLink]</a> in
defining links in compound document contexts by using an <code>xlink:href</code> attribute.
As mentioned above, MathML 3 adds an <code>href</code>
attribute for linking so that <code>xlink:href</code> is no longer needed.
However, <code>xlink:href</code> is still allowed because MathML permits the use of attributes
from non-MathML namespaces. It is recommended that new compound document
formats use the MathML 3 <code>href</code> attribute for linking. When user agents
encounter MathML elements with both <code>href</code> and <code>xlink:href</code> attributes, the
<code>href</code> attribute should take precedence. To support backward
compatibility, user agents that implement XML Linking
in compound documents containing MathML 2 should continue to support
the use of the <code>xlink:href</code> attribute in addition to supporting the <code>href</code> attribute.
</p>
</div>
<div class="div3">
<h3><a name="interf.graphics" id="interf.graphics"></a>6.4.4 MathML and Graphical Markup
</h3>
<p>Apart from the introduction of new glyphs, many of the situations
where one might be inclined to use an image amount to displaying
labeled diagrams. For example, knot diagrams, Venn diagrams, Dynkin
diagrams, Feynman diagrams and commutative diagrams all fall into this
category. As such, their content would be better encoded via some
combination of structured graphics and MathML markup. However, at the
time of this writing, it is beyond the scope of the W3C Math Activity
to define a markup language to encode such a general concept as
"labeled diagrams." (See <a href="http://www.w3.org/Math/">http://www.w3.org/Math</a> for
current W3C activity in mathematics and <a href="http://www.w3.org/Graphics/">http://www.w3.org/Graphics</a>
for the W3C graphics activity.)
</p>
<p>One mechanism for embedding additional graphical content is via the
<code>semantics</code> element, as in the following example:
</p><pre><semantics>
<apply>
<intersect/>
<ci>A</ci>
<ci>B</ci>
</apply>
<annotation-xml encoding="image/svg+xml">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 290 180">
<clipPath id="a">
<circle cy="90" cx="100" r="60"/>
</clipPath>
<circle fill="#AAAAAA" cy="90" cx="190"
r="60" style="clip-path:url(#a)"/>
<circle stroke="black" fill="none" cy="90" cx="100" r="60"/>
<circle stroke="black" fill="none" cy="90" cx="190" r="60"/>
</svg>
</annotation-xml>
<annotation-xml encoding="application/xhtml+xml">
<img xmlns="http://www.w3.org/1999/xhtml"
src="intersect.gif" alt="A intersect B"/>
</annotation-xml>
</semantics></pre><p>
Here, the <code>annotation-xml</code> elements are used to indicate alternative
representations of the MathML-Content depiction of the
intersection of two sets.
The first one is in the "Scalable Vector
Graphics" format <a href="appendixh-d.html#SVG1.1">[SVG1.1]</a>
(see <a href="appendixh-d.html#XHTML-MathML-SVG">[XHTML-MathML-SVG]</a> for the definition of an XHTML profile integrating MathML and SVG), the second one uses the
XHTML <code>img</code> element embedded as an XHTML fragment.
In this situation, a MathML processor can use any of these
representations for display, perhaps producing a graphical format
such as the image below.
</p>
<blockquote>
<p><img src="image/intersect.gif" alt="\includegraphics{intersect}"></p>
</blockquote>
<p>Note that the semantics representation of this example is given
in MathML-Content markup, as the first child of the
<code>semantics</code> element. In this regard, it is the
representation most analogous to the <code>alt</code> attribute of the
<code>img</code> element in XHTML, and would likely be
the best choice for non-visual rendering.
</p>
</div>
</div>
<div class="div2">
<h2><a name="world-int-style" id="world-int-style"></a>6.5 Using CSS with MathML
</h2>
<p>When MathML is rendered in an environment that supports CSS <a href="appendixh-d.html#CSS21">[CSS21]</a>,
controlling mathematics style properties with a CSS style sheet is desirable,
but not as simple as it might first appear, because the formatting of MathML layout schemata
is quite different from the CSS visual formatting model and many of the style parameters that affect
mathematics layout have no direct textual analogs.
Even in cases where there are analogous properties, the sensible values for
these properties may not correspond.
Because of this difference, applications that support MathML natively may choose to
restrict the CSS properties applicable to MathML layout schemata to those
properties that do not affect layout.
</p>
<p>Generally speaking, the model for CSS interaction with the math
style attributes runs as follows. A CSS style sheet might provide a style
rule such as:
</p><pre>
math *.[mathsize="small"] {
font-size: 80%
}
</pre><p>This rule sets the CSS font-size properties for all children of the
<code>math</code> element that have the <code>mathsize</code> attribute set to small.
A MathML renderer
would then query the style engine for the CSS environment, and use the
values returned as input to its own layout algorithms. MathML does
not specify the mechanism by which style information is inherited from
the environment. However, some suggested rendering rules for the
interaction between properties of the ambient style environment and
MathML-specific rendering rules are discussed in <a href="chapter3-d.html#presm.commatt">Section 3.2.2 Mathematics style attributes common to token elements</a>, and more generally throughout <a href="chapter3-d.html">Chapter 3 Presentation Markup</a>.
</p>
<p>It should be stressed, however, that some caution is required in
writing CSS stylesheets for MathML. Because changing typographic
properties of mathematics symbols can change the meaning of an equation,
stylesheets should be written in a way such that changes to document-wide
typographic styles do not affect embedded MathML expressions.
</p>
<p>Another pitfall to be avoided is using CSS to provide
typographic style information necessary to the proper understanding of
an expression.
Expressions dependent on CSS for meaning will not be
portable to non-CSS environments such as computer algebra systems. By
using the logical values of the new MathML 3.0 mathematics style attributes
as selectors for CSS rules, it can be assured that style information
necessary to the sense of an expression is encoded directly in the
MathML.
</p>
<p>MathML 3.0 does not specify how a user agent should process style
information, because there are many non-CSS MathML environments, and
because different users agents and renderers have widely varying
degrees of access to CSS information.
</p>
<div class="div3">
<h3><a name="id.6.5.1" id="id.6.5.1"></a>6.5.1 Order of processing attributes versus style sheets
</h3>
<p>CSS or analogous style sheets can specify changes to rendering
properties of selected MathML elements. Since rendering properties
can also be changed by attributes on an element, or be changed
automatically by the renderer, it is necessary to specify the order in
which changes requested by various sources should occur.
The order is defined by <a href="appendixh-d.html#CSS21">[CSS21]</a> cascading order taking into account
precedence of non-CSS presentational hints.
</p>
</div>
<div class="div3">
<h3><a name="id.6.5.2" id="id.6.5.2"></a>6.5.2 Layout engines that lack native MathML support
</h3>
<p>
While controlling all aspects of MathML formatting through CSS is problematic
and many MathML layout schemata have no analogues in CSS visual formatting model,
CSS as a general purpose style language is still capable of formatting representative
subset of MathML. This capability can be used to provide reasonable rendering of MathML
in applications that lack native MathML support, but are able to format XML using
a CSS style sheet. More about this possibility and a sample CSS style sheet
may be found in <a href="appendixh-d.html#MathMLforCSS">[MathMLforCSS]</a>.
</p>
</div>
</div>
</div>
<div class="minitoc">
Overview: <a href="Overview-d.html">Mathematical Markup Language (MathML) Version 3.0</a><br>
Previous: 5 <a href="chapter5-d.html">Mixing Markup Languages for Mathematical Expressions</a><br>
Next: 7 <a href="chapter7-d.html">Characters, Entities and Fonts</a></div>
</body>
</html>
|