1<xsl:stylesheet 2 version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:mml="http://www.w3.org/1998/Math/MathML" 5> 6 7<!-- 8$Id: ctop.xsl 87 2005-02-09 16:45:09Z egonw $ 9 10Copyright David Carlisle 2001, 2002. 11 12Use and distribution of this code are permitted under the terms of the <a 13href="http://www.w3.org/Consortium/Legal/copyright-software-19980720" 14>W3C Software Notice and License</a>. 15--> 16 17<xsl:output method="xml" /> 18 19<xsl:template mode="c2p" match="*"> 20<xsl:copy> 21 <xsl:copy-of select="@*"/> 22 <xsl:apply-templates mode="c2p"/> 23</xsl:copy> 24</xsl:template> 25 26 27<!-- 4.4.1.1 cn --> 28 29<xsl:template mode="c2p" match="mml:cn"> 30 <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn> 31</xsl:template> 32 33<xsl:template mode="c2p" match="mml:cn[@type='complex-cartesian']"> 34 <mml:mrow> 35 <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn> 36 <mml:mo>+</mml:mo> 37 <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn> 38 <mml:mo><!--⁢--><!--invisible times--></mml:mo> 39 <mml:mi>i<!-- imaginary i --></mml:mi> 40 </mml:mrow> 41</xsl:template> 42 43<xsl:template mode="c2p" match="mml:cn[@type='rational']"> 44 <mml:mrow> 45 <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn> 46 <mml:mo>/</mml:mo> 47 <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn> 48 </mml:mrow> 49</xsl:template> 50 51<xsl:template mode="c2p" match="mml:cn[@type='integer']"> 52 <xsl:choose> 53 <xsl:when test="not(@base) or @base=10"> 54 <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn> 55 </xsl:when> 56 <xsl:otherwise> 57 <mml:msub> 58 <mml:mn><xsl:apply-templates mode="c2p"/></mml:mn> 59 <mml:mn><xsl:value-of select="@base"/></mml:mn> 60 </mml:msub> 61 </xsl:otherwise> 62 </xsl:choose> 63</xsl:template> 64 65<xsl:template mode="c2p" match="mml:cn[@type='complex-polar']"> 66 <mml:mrow> 67 <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn> 68 <mml:mo><!--⁢--><!--invisible times--></mml:mo> 69 <mml:msup> 70 <mml:mi>e<!-- exponential e--></mml:mi> 71 <mml:mrow> 72 <mml:mi>i<!-- imaginary i--></mml:mi> 73 <mml:mo><!--⁢--><!--invisible times--></mml:mo> 74 <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn> 75 </mml:mrow> 76 </mml:msup> 77 </mml:mrow> 78</xsl:template> 79 80<xsl:template mode="c2p" match="mml:cn[@type='e-notation']"> 81 <mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/>E<xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn> 82</xsl:template> 83 84<!-- 4.4.1.1 ci --> 85 86<xsl:template mode="c2p" match="mml:ci/text()"> 87 <mml:mi><xsl:value-of select="."/></mml:mi> 88</xsl:template> 89 90<xsl:template mode="c2p" match="mml:ci"> 91 <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow> 92</xsl:template> 93 94<!-- 4.4.1.2 csymbol --> 95 96<xsl:template mode="c2p" match="mml:csymbol/text()"> 97 <mml:mo><xsl:apply-templates mode="c2p"/></mml:mo> 98</xsl:template> 99 100<xsl:template mode="c2p" match="mml:csymbol"> 101 <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow> 102</xsl:template> 103 104<!-- 4.4.2.1 apply 4.4.2.2 reln --> 105 106<xsl:template mode="c2p" match="mml:apply|mml:reln"> 107 <mml:mrow> 108 <xsl:apply-templates mode="c2p" select="*[1]"> 109 <xsl:with-param name="p" select="10"/> 110 </xsl:apply-templates> 111 <mml:mo><!--⁢--><!--invisible times--></mml:mo> 112 <mml:mfenced open="(" close=")" separators=","> 113 <xsl:apply-templates mode="c2p" select="*[position()>1]"/> 114 </mml:mfenced> 115 </mml:mrow> 116</xsl:template> 117 118<!-- 4.4.2.3 fn --> 119<xsl:template mode="c2p" match="mml:fn"> 120 <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow> 121</xsl:template> 122 123<!-- 4.4.2.4 interval --> 124<xsl:template mode="c2p" match="mml:interval[*[2]]"> 125 <mml:mfenced open="[" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced> 126</xsl:template> 127<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open']"> 128 <mml:mfenced open="(" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced> 129</xsl:template> 130<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open-closed']"> 131 <mml:mfenced open="(" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced> 132</xsl:template> 133<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='closed-open']"> 134 <mml:mfenced open="[" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced> 135</xsl:template> 136 137<xsl:template mode="c2p" match="mml:interval"> 138 <mml:mfenced open="{{" close="}}"><xsl:apply-templates mode="c2p"/></mml:mfenced> 139</xsl:template> 140 141<!-- 4.4.2.5 inverse --> 142 143<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:inverse]]"> 144 <mml:msup> 145 <xsl:apply-templates mode="c2p" select="*[2]"/> 146 <mml:mrow><mml:mo>(</mml:mo><mml:mn>-1</mml:mn><mml:mo>)</mml:mo></mml:mrow> 147 </mml:msup> 148</xsl:template> 149 150<!-- 4.4.2.6 sep --> 151 152<!-- 4.4.2.7 condition --> 153<xsl:template mode="c2p" match="mml:condition"> 154 <mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow> 155</xsl:template> 156 157<!-- 4.4.2.8 declare --> 158<xsl:template mode="c2p" match="mml:declare"/> 159 160<!-- 4.4.2.9 lambda --> 161<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lambda]]"> 162 <mml:mrow> 163 <mml:mi>λ<!--lambda--></mml:mi> 164 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*"/></mml:mrow> 165 <mml:mo>.</mml:mo> 166 <mml:mfenced> 167 <xsl:apply-templates mode="c2p" select="*[last()]"/> 168 </mml:mfenced> 169</mml:mrow> 170</xsl:template> 171 172 173<!-- 4.4.2.10 compose --> 174<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:compose]]"> 175<xsl:param name="p" select="0"/> 176<xsl:call-template name="infix"> 177 <xsl:with-param name="this-p" select="1"/> 178 <xsl:with-param name="p" select="$p"/> 179 <xsl:with-param name="mo"><mml:mo>∘<!-- o --></mml:mo></xsl:with-param> 180</xsl:call-template> 181</xsl:template> 182 183 184<!-- 4.4.2.11` ident --> 185<xsl:template mode="c2p" match="mml:ident"> 186<mml:mo>id</mml:mo> 187</xsl:template> 188 189<!-- 4.4.2.12` domain --> 190<xsl:template mode="c2p" match="mml:domain"> 191<mml:mo>domain</mml:mo> 192</xsl:template> 193 194<!-- 4.4.2.13` codomain --> 195<xsl:template mode="c2p" match="mml:codomain"> 196<mml:mo>codomain</mml:mo> 197</xsl:template> 198 199<!-- 4.4.2.14` image --> 200<xsl:template mode="c2p" match="mml:image"> 201<mml:mo>image</mml:mo> 202</xsl:template> 203 204<!-- 4.4.2.15` domainofapplication --> 205<xsl:template mode="c2p" match="mml:domainofapplication"> 206 <mml:error/> 207</xsl:template> 208 209<!-- 4.4.2.16` piecewise --> 210<xsl:template mode="c2p" match="mml:piecewise"> 211<mml:mrow> 212<mml:mo>{</mml:mo> 213<mml:mtable> 214 <xsl:for-each select="mml:piece|mml:otherwise"> 215 <mml:mtr> 216 <mml:mtd><xsl:apply-templates mode="c2p" select="*[1]"/></mml:mtd> 217 <mml:mtd><mml:mtext>  if  </mml:mtext></mml:mtd> 218 <mml:mtd><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mtd> 219 </mml:mtr> 220 </xsl:for-each> 221</mml:mtable> 222</mml:mrow> 223</xsl:template> 224 225 226<!-- 4.4.3.1 quotient --> 227<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:quotient]]"> 228<mml:mrow> 229<mml:mo>⌊<!-- lfloor--></mml:mo> 230<xsl:apply-templates mode="c2p" select="*[2]"/> 231<mml:mo>/</mml:mo> 232<xsl:apply-templates mode="c2p" select="*[3]"/> 233<mml:mo>⌋<!-- rfloor--></mml:mo> 234</mml:mrow> 235</xsl:template> 236 237 238 239<!-- 4.4.3.2 factorial --> 240<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorial]]"> 241<mml:mrow> 242<xsl:apply-templates mode="c2p" select="*[2]"> 243 <xsl:with-param name="p" select="7"/> 244</xsl:apply-templates> 245<mml:mo>!</mml:mo> 246</mml:mrow> 247</xsl:template> 248 249 250<!-- 4.4.3.3 divide --> 251<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:divide]]"> 252 <xsl:param name="p" select="0"/> 253<xsl:call-template name="binary"> 254 <xsl:with-param name="mo"><mml:mo>/</mml:mo></xsl:with-param> 255 <xsl:with-param name="p" select="$p"/> 256 <xsl:with-param name="this-p" select="3"/> 257</xsl:call-template> 258</xsl:template> 259 260 261<!-- 4.4.3.4 max min--> 262<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:max]]"> 263<mml:mrow> 264 <mml:mo>max</mml:mo> 265 <xsl:call-template name="set"/> 266</mml:mrow> 267</xsl:template> 268 269<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:min]]"> 270<mml:mrow> 271 <mml:mo>max</mml:mo> 272 <xsl:call-template name="set"/> 273</mml:mrow> 274</xsl:template> 275 276<!-- 4.4.3.5 minus--> 277<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)=2]"> 278<mml:mrow> 279 <mml:mo>−<!--minus--></mml:mo> 280 <xsl:apply-templates mode="c2p" select="*[2]"> 281 <xsl:with-param name="p" select="5"/> 282 </xsl:apply-templates> 283</mml:mrow> 284</xsl:template> 285 286<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)>2]"> 287 <xsl:param name="p" select="0"/> 288<xsl:call-template name="binary"> 289 <xsl:with-param name="mo"><mml:mo>−<!--minus--></mml:mo></xsl:with-param> 290 <xsl:with-param name="p" select="$p"/> 291 <xsl:with-param name="this-p" select="2"/> 292</xsl:call-template> 293</xsl:template> 294 295<!-- 4.4.3.6 plus--> 296<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:plus]]"> 297 <xsl:param name="p" select="0"/> 298 <mml:mrow> 299 <xsl:if test="$p > 2"><mml:mo>(</mml:mo></xsl:if> 300 <xsl:for-each select="*[position()>1]"> 301 <xsl:if test="position() > 1"> 302 <mml:mo> 303 <xsl:choose> 304 <xsl:when test="self::mml:apply[*[1][self::mml:times] and 305 *[2][self::mml:apply/*[1][self::mml:minus] or self::mml:cn[not(mml:sep) and 306 (number(.) < 0)]]]">−<!--minus--></xsl:when> 307 <xsl:otherwise>+</xsl:otherwise> 308 </xsl:choose> 309 </mml:mo> 310 </xsl:if> 311 <xsl:choose> 312 <xsl:when test="self::mml:apply[*[1][self::mml:times] and 313 *[2][self::mml:cn[not(mml:sep) and (number(.) <0)]]]"> 314 <mml:mrow> 315 <mml:mn><xsl:value-of select="-(*[2])"/></mml:mn> 316 <mml:mo><!--⁢--><!--invisible times--></mml:mo> 317 <xsl:apply-templates mode="c2p" select="."> 318 <xsl:with-param name="first" select="2"/> 319 <xsl:with-param name="p" select="2"/> 320 </xsl:apply-templates> 321 </mml:mrow> 322 </xsl:when> 323 <xsl:when test="self::mml:apply[*[1][self::mml:times] and 324 *[2][self::mml:apply/*[1][self::mml:minus]]]"> 325 <mml:mrow> 326 <xsl:apply-templates mode="c2p" select="./*[2]/*[2]"/> 327 <xsl:apply-templates mode="c2p" select="."> 328 <xsl:with-param name="first" select="2"/> 329 <xsl:with-param name="p" select="2"/> 330 </xsl:apply-templates> 331 </mml:mrow> 332 </xsl:when> 333 <xsl:otherwise> 334 <xsl:apply-templates mode="c2p" select="."> 335 <xsl:with-param name="p" select="2"/> 336 </xsl:apply-templates> 337 </xsl:otherwise> 338 </xsl:choose> 339 </xsl:for-each> 340 <xsl:if test="$p > 2"><mml:mo>)</mml:mo></xsl:if> 341 </mml:mrow> 342</xsl:template> 343 344 345<!-- 4.4.3.7 power --> 346<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:power]]"> 347<mml:msup> 348<xsl:apply-templates mode="c2p" select="*[2]"> 349 <xsl:with-param name="p" select="5"/> 350</xsl:apply-templates> 351<xsl:apply-templates mode="c2p" select="*[3]"> 352 <xsl:with-param name="p" select="5"/> 353</xsl:apply-templates> 354</mml:msup> 355</xsl:template> 356 357<!-- 4.4.3.8 remainder --> 358<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:rem]]"> 359 <xsl:param name="p" select="0"/> 360<xsl:call-template name="binary"> 361 <xsl:with-param name="mo"><mml:mo>mod</mml:mo></xsl:with-param> 362 <xsl:with-param name="p" select="$p"/> 363 <xsl:with-param name="this-p" select="3"/> 364</xsl:call-template> 365</xsl:template> 366 367<!-- 4.4.3.9 times--> 368<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:times]]" name="times"> 369 <xsl:param name="p" select="0"/> 370 <xsl:param name="first" select="1"/> 371 <mml:mrow> 372 <xsl:if test="$p > 3"><mml:mo>(</mml:mo></xsl:if> 373 <xsl:for-each select="*[position()>1]"> 374 <xsl:if test="position() > 1"> 375 <mml:mo> 376 <xsl:choose> 377 <xsl:when test="self::mml:cn">×<!-- times --></xsl:when> 378 <xsl:otherwise><!--⁢--><!--invisible times--></xsl:otherwise> 379 </xsl:choose> 380 </mml:mo> 381 </xsl:if> 382 <xsl:if test="position()>= $first"> 383 <xsl:apply-templates mode="c2p" select="."> 384 <xsl:with-param name="p" select="3"/> 385 </xsl:apply-templates> 386 </xsl:if> 387 </xsl:for-each> 388 <xsl:if test="$p > 3"><mml:mo>)</mml:mo></xsl:if> 389 </mml:mrow> 390</xsl:template> 391 392 393<!-- 4.4.3.10 root --> 394<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:root] and not(mml:degree) or mml:degree=2]" priority="4"> 395<mml:msqrt> 396<xsl:apply-templates mode="c2p" select="*[position()>1]"/> 397</mml:msqrt> 398</xsl:template> 399 400<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:root]]"> 401<mml:mroot> 402<xsl:apply-templates mode="c2p" select="*[position()>1 and not(self::mml:degree)]"/> 403<mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/*"/></mml:mrow> 404</mml:mroot> 405</xsl:template> 406 407<!-- 4.4.3.11 gcd --> 408<xsl:template mode="c2p" match="mml:gcd"> 409<mml:mo>gcd</mml:mo> 410</xsl:template> 411 412<!-- 4.4.3.12 and --> 413<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:and]]"> 414<xsl:param name="p" select="0"/> 415<xsl:call-template name="infix"> 416 <xsl:with-param name="this-p" select="2"/> 417 <xsl:with-param name="p" select="$p"/> 418 <xsl:with-param name="mo"><mml:mo>∧<!-- and --></mml:mo></xsl:with-param> 419</xsl:call-template> 420</xsl:template> 421 422 423<!-- 4.4.3.13 or --> 424<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:or]]"> 425<xsl:param name="p" select="0"/> 426<xsl:call-template name="infix"> 427 <xsl:with-param name="this-p" select="3"/> 428 <xsl:with-param name="p" select="$p"/> 429 <xsl:with-param name="mo"><mml:mo>∨<!-- or --></mml:mo></xsl:with-param> 430</xsl:call-template> 431</xsl:template> 432 433<!-- 4.4.3.14 xor --> 434<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:xor]]"> 435<xsl:param name="p" select="0"/> 436<xsl:call-template name="infix"> 437 <xsl:with-param name="this-p" select="3"/> 438 <xsl:with-param name="p" select="$p"/> 439 <xsl:with-param name="mo"><mml:mo>xor</mml:mo></xsl:with-param> 440</xsl:call-template> 441</xsl:template> 442 443 444<!-- 4.4.3.15 not --> 445<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:not]]"> 446<mml:mrow> 447<mml:mo>¬<!-- not --></mml:mo> 448<xsl:apply-templates mode="c2p" select="*[2]"> 449 <xsl:with-param name="p" select="7"/> 450</xsl:apply-templates> 451</mml:mrow> 452</xsl:template> 453 454 455 456 457<!-- 4.4.3.16 implies --> 458<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:implies]]"> 459 <xsl:param name="p" select="0"/> 460<xsl:call-template name="binary"> 461 <xsl:with-param name="mo"><mml:mo>⇒<!-- Rightarrow --></mml:mo></xsl:with-param> 462 <xsl:with-param name="p" select="$p"/> 463 <xsl:with-param name="this-p" select="3"/> 464</xsl:call-template> 465</xsl:template> 466 467 468<!-- 4.4.3.17 forall --> 469<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:forall]]"> 470 <mml:mrow> 471 <mml:mi>∀<!--forall--></mml:mi> 472 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow> 473 <mml:mo>.</mml:mo> 474 <mml:mfenced> 475 <xsl:apply-templates mode="c2p" select="*[last()]"/> 476 </mml:mfenced> 477</mml:mrow> 478</xsl:template> 479 480 481 482<!-- 4.4.3.18 exists --> 483<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exists]]"> 484 <mml:mrow> 485 <mml:mi>∃<!--exists--></mml:mi> 486 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow> 487 <mml:mo>.</mml:mo> 488 <mml:mfenced> 489 <xsl:apply-templates mode="c2p" select="*[last()]"/> 490 </mml:mfenced> 491</mml:mrow> 492</xsl:template> 493 494 495<!-- 4.4.3.19 abs --> 496<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:abs]]"> 497<mml:mrow> 498<mml:mo>|</mml:mo> 499<xsl:apply-templates mode="c2p" select="*[2]"/> 500<mml:mo>|</mml:mo> 501</mml:mrow> 502</xsl:template> 503 504 505 506<!-- 4.4.3.20 conjugate --> 507<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:conjugate]]"> 508<mml:mover> 509<xsl:apply-templates mode="c2p" select="*[2]"/> 510<mml:mo>¯<!-- overline --></mml:mo> 511</mml:mover> 512</xsl:template> 513 514<!-- 4.4.3.21 arg --> 515<xsl:template mode="c2p" match="mml:arg"> 516 <mml:mo>arg</mml:mo> 517</xsl:template> 518 519 520<!-- 4.4.3.22 real --> 521<xsl:template mode="c2p" match="mml:real"> 522 <mml:mo>ℛ<!-- real --></mml:mo> 523</xsl:template> 524 525<!-- 4.4.3.23 imaginary --> 526<xsl:template mode="c2p" match="mml:imaginary"> 527 <mml:mo>ℑ<!-- imaginary --></mml:mo> 528</xsl:template> 529 530<!-- 4.4.3.24 lcm --> 531<xsl:template mode="c2p" match="mml:lcm"> 532 <mml:mo>lcm</mml:mo> 533</xsl:template> 534 535 536<!-- 4.4.3.25 floor --> 537<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:floor]]"> 538<mml:mrow> 539<mml:mo>⌊<!-- lfloor--></mml:mo> 540<xsl:apply-templates mode="c2p" select="*[2]"/> 541<mml:mo>⌋<!-- rfloor--></mml:mo> 542</mml:mrow> 543</xsl:template> 544 545 546<!-- 4.4.3.25 ceiling --> 547<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ceiling]]"> 548<mml:mrow> 549<mml:mo>⌈<!-- lceil--></mml:mo> 550<xsl:apply-templates mode="c2p" select="*[2]"/> 551<mml:mo>⌉<!-- rceil--></mml:mo> 552</mml:mrow> 553</xsl:template> 554 555<!-- 4.4.4.1 eq --> 556<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:eq]]"> 557<xsl:param name="p" select="0"/> 558<xsl:call-template name="infix"> 559 <xsl:with-param name="this-p" select="1"/> 560 <xsl:with-param name="p" select="$p"/> 561 <xsl:with-param name="mo"><mml:mo>=</mml:mo></xsl:with-param> 562</xsl:call-template> 563</xsl:template> 564 565<!-- 4.4.4.2 neq --> 566<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:neq]]"> 567<xsl:param name="p" select="0"/> 568<xsl:call-template name="infix"> 569 <xsl:with-param name="this-p" select="1"/> 570 <xsl:with-param name="p" select="$p"/> 571 <xsl:with-param name="mo"><mml:mo>≠<!-- neq --></mml:mo></xsl:with-param> 572</xsl:call-template> 573</xsl:template> 574 575<!-- 4.4.4.3 eq --> 576<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:gt]]"> 577<xsl:param name="p" select="0"/> 578<xsl:call-template name="infix"> 579 <xsl:with-param name="this-p" select="1"/> 580 <xsl:with-param name="p" select="$p"/> 581 <xsl:with-param name="mo"><mml:mo>></mml:mo></xsl:with-param> 582</xsl:call-template> 583</xsl:template> 584 585<!-- 4.4.4.4 lt --> 586<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lt]]"> 587<xsl:param name="p" select="0"/> 588<xsl:call-template name="infix"> 589 <xsl:with-param name="this-p" select="1"/> 590 <xsl:with-param name="p" select="$p"/> 591 <xsl:with-param name="mo"><mml:mo><</mml:mo></xsl:with-param> 592</xsl:call-template> 593</xsl:template> 594 595<!-- 4.4.4.5 geq --> 596<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:geq]]"> 597<xsl:param name="p" select="0"/> 598<xsl:call-template name="infix"> 599 <xsl:with-param name="this-p" select="1"/> 600 <xsl:with-param name="p" select="$p"/> 601 <xsl:with-param name="mo"><mml:mo>≥</mml:mo></xsl:with-param> 602</xsl:call-template> 603</xsl:template> 604 605<!-- 4.4.4.6 geq --> 606<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:leq]]"> 607<xsl:param name="p" select="0"/> 608<xsl:call-template name="infix"> 609 <xsl:with-param name="this-p" select="1"/> 610 <xsl:with-param name="p" select="$p"/> 611 <xsl:with-param name="mo"><mml:mo>≤</mml:mo></xsl:with-param> 612</xsl:call-template> 613</xsl:template> 614 615<!-- 4.4.4.7 equivalent --> 616<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:equivalent]]"> 617<xsl:param name="p" select="0"/> 618<xsl:call-template name="infix"> 619 <xsl:with-param name="this-p" select="1"/> 620 <xsl:with-param name="p" select="$p"/> 621 <xsl:with-param name="mo"><mml:mo>≡</mml:mo></xsl:with-param> 622</xsl:call-template> 623</xsl:template> 624 625<!-- 4.4.4.8 approx --> 626<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:approx]]"> 627<xsl:param name="p" select="0"/> 628<xsl:call-template name="infix"> 629 <xsl:with-param name="this-p" select="1"/> 630 <xsl:with-param name="p" select="$p"/> 631 <xsl:with-param name="mo"><mml:mo>≃</mml:mo></xsl:with-param> 632</xsl:call-template> 633</xsl:template> 634 635 636<!-- 4.4.4.9 factorof --> 637<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorof]]"> 638 <xsl:param name="p" select="0"/> 639<xsl:call-template name="binary"> 640 <xsl:with-param name="mo"><mml:mo>|</mml:mo></xsl:with-param> 641 <xsl:with-param name="p" select="$p"/> 642 <xsl:with-param name="this-p" select="3"/> 643</xsl:call-template> 644</xsl:template> 645 646<!-- 4.4.5.1 int --> 647<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:int]]"> 648 <mml:mrow> 649 <mml:msubsup> 650 <mml:mi>∫<!--int--></mml:mi> 651 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow> 652 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow> 653 </mml:msubsup> 654 <xsl:apply-templates mode="c2p" select="*[last()]"/> 655 <mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar"/> 656</mml:mrow> 657</xsl:template> 658 659<!-- 4.4.5.2 diff --> 660<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff] and mml:ci and count(*)=2]" priority="2"> 661 <mml:msup> 662 <mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow> 663 <mml:mo>′<!--prime--></mml:mo> 664 </mml:msup> 665</xsl:template> 666 667<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff]]" priority="1"> 668 <mml:mfrac> 669 <xsl:choose> 670 <xsl:when test="mml:bvar/mml:degree"> 671 <mml:mrow><mml:msup><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar/mml:degree/node()"/></mml:msup> 672 <xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow> 673 <mml:mrow><mml:mo>d</mml:mo><mml:msup><xsl:apply-templates mode="c2p" 674 select="mml:bvar/node()"/><xsl:apply-templates mode="c2p" 675 select="mml:bvar/mml:degree/node()"/></mml:msup> 676</mml:mrow> 677</xsl:when> 678<xsl:otherwise> 679 <mml:mrow><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow> 680 <mml:mrow><mml:mo>d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar"/></mml:mrow> 681</xsl:otherwise> 682 </xsl:choose> 683 </mml:mfrac> 684</xsl:template> 685 686 687<!-- 4.4.5.3 partialdiff --> 688<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff] and mml:list and mml:ci and count(*)=3]" priority="2"> 689<mml:mrow> 690 <mml:msub><mml:mo>D</mml:mo><mml:mrow> 691<xsl:for-each select="mml:list[1]/*"> 692<xsl:apply-templates mode="c2p" select="."/> 693<xsl:if test="position()<last()"><mml:mo>,</mml:mo></xsl:if> 694</xsl:for-each> 695</mml:mrow></mml:msub> 696 <mml:mrow><xsl:apply-templates mode="c2p" select="*[3]"/></mml:mrow> 697</mml:mrow> 698</xsl:template> 699 700<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff]]" priority="1"> 701 <mml:mfrac> 702 <mml:mrow><mml:msup><mml:mo>∂<!-- partial --></mml:mo> 703<mml:mrow> 704 <xsl:choose> 705 <xsl:when test="mml:degree"> 706<xsl:apply-templates mode="c2p" select="mml:degree/node()"/> 707</xsl:when> 708<xsl:when test="mml:bvar/mml:degree[string(number(.))='NaN']"> 709<xsl:for-each select="mml:bvar/mml:degree"> 710<xsl:apply-templates mode="c2p" select="node()"/> 711<xsl:if test="position()<last()"><mml:mo>+</mml:mo></xsl:if> 712</xsl:for-each> 713<xsl:if test="count(mml:bvar[not(mml:degree)])>0"> 714<mml:mo>+</mml:mo><mml:mn><xsl:value-of select="count(mml:bvar[not(mml:degree)])"/></mml:mn> 715</xsl:if> 716</xsl:when> 717<xsl:otherwise> 718<mml:mn><xsl:value-of select="sum(mml:bvar/mml:degree)+count(mml:bvar[not(mml:degree)])"/></mml:mn> 719</xsl:otherwise> 720 </xsl:choose> 721</mml:mrow> 722</mml:msup> 723 <xsl:apply-templates mode="c2p" select="*[last()]"/></mml:mrow> 724<mml:mrow> 725<xsl:for-each select="mml:bvar"> 726<mml:mrow> 727<mml:mo>∂<!-- partial --></mml:mo><mml:msup><xsl:apply-templates mode="c2p" select="node()"/> 728 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/node()"/></mml:mrow> 729</mml:msup> 730</mml:mrow> 731</xsl:for-each> 732</mml:mrow> 733 </mml:mfrac> 734</xsl:template> 735 736<!-- 4.4.5.4 lowlimit--> 737<xsl:template mode="c2p" match="mml:lowlimit"/> 738 739<!-- 4.4.5.5 uplimit--> 740<xsl:template mode="c2p" match="mml:uplimit"/> 741 742<!-- 4.4.5.6 bvar--> 743<xsl:template mode="c2p" match="mml:bvar"> 744 <mml:mi><xsl:apply-templates mode="c2p"/></mml:mi> 745 <xsl:if test="following-sibling::mml:bvar"><mml:mo>,</mml:mo></xsl:if> 746</xsl:template> 747 748<!-- 4.4.5.7 degree--> 749<xsl:template mode="c2p" match="mml:degree"/> 750 751<!-- 4.4.5.8 divergence--> 752<xsl:template mode="c2p" match="mml:divergence"> 753<mml:mo>div</mml:mo> 754</xsl:template> 755 756<!-- 4.4.5.9 grad--> 757<xsl:template mode="c2p" match="mml:grad"> 758<mml:mo>grad</mml:mo> 759</xsl:template> 760 761<!-- 4.4.5.10 curl --> 762<xsl:template mode="c2p" match="mml:curl"> 763<mml:mo>curl</mml:mo> 764</xsl:template> 765 766 767<!-- 4.4.5.11 laplacian--> 768<xsl:template mode="c2p" match="mml:laplacian"> 769<mml:msup><mml:mo>∇<!-- nabla --></mml:mo><mml:mn>2</mml:mn></mml:msup> 770</xsl:template> 771 772<!-- 4.4.6.1 set --> 773 774<xsl:template mode="c2p" match="mml:set"> 775 <xsl:call-template name="set"/> 776</xsl:template> 777 778<!-- 4.4.6.2 list --> 779 780<xsl:template mode="c2p" match="mml:list"> 781 <xsl:call-template name="set"> 782 <xsl:with-param name="o" select="'('"/> 783 <xsl:with-param name="c" select="')'"/> 784 </xsl:call-template> 785</xsl:template> 786 787<!-- 4.4.6.3 union --> 788<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:union]]"> 789<xsl:param name="p" select="0"/> 790<xsl:call-template name="infix"> 791 <xsl:with-param name="this-p" select="2"/> 792 <xsl:with-param name="p" select="$p"/> 793 <xsl:with-param name="mo"><mml:mo>∪<!-- union --></mml:mo></xsl:with-param> 794</xsl:call-template> 795</xsl:template> 796 797<!-- 4.4.6.4 intersect --> 798<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:intersect]]"> 799<xsl:param name="p" select="0"/> 800<xsl:call-template name="infix"> 801 <xsl:with-param name="this-p" select="3"/> 802 <xsl:with-param name="p" select="$p"/> 803 <xsl:with-param name="mo"><mml:mo>∩<!-- intersect --></mml:mo></xsl:with-param> 804</xsl:call-template> 805</xsl:template> 806 807<!-- 4.4.6.5 in --> 808<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:in]]"> 809 <xsl:param name="p" select="0"/> 810<xsl:call-template name="binary"> 811 <xsl:with-param name="mo"><mml:mo>∈<!-- in --></mml:mo></xsl:with-param> 812 <xsl:with-param name="p" select="$p"/> 813 <xsl:with-param name="this-p" select="3"/> 814</xsl:call-template> 815</xsl:template> 816 817<!-- 4.4.6.5 notin --> 818<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notin]]"> 819 <xsl:param name="p" select="0"/> 820<xsl:call-template name="binary"> 821 <xsl:with-param name="mo"><mml:mo>∉<!-- not in --></mml:mo></xsl:with-param> 822 <xsl:with-param name="p" select="$p"/> 823 <xsl:with-param name="this-p" select="3"/> 824</xsl:call-template> 825</xsl:template> 826 827<!-- 4.4.6.7 subset --> 828<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:subset]]"> 829<xsl:param name="p" select="0"/> 830<xsl:call-template name="infix"> 831 <xsl:with-param name="this-p" select="2"/> 832 <xsl:with-param name="p" select="$p"/> 833 <xsl:with-param name="mo"><mml:mo>⊆<!-- subseteq --></mml:mo></xsl:with-param> 834</xsl:call-template> 835</xsl:template> 836 837<!-- 4.4.6.8 prsubset --> 838<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:prsubset]]"> 839<xsl:param name="p" select="0"/> 840<xsl:call-template name="infix"> 841 <xsl:with-param name="this-p" select="2"/> 842 <xsl:with-param name="p" select="$p"/> 843 <xsl:with-param name="mo"><mml:mo>⊂<!-- prsubset --></mml:mo></xsl:with-param> 844</xsl:call-template> 845</xsl:template> 846 847<!-- 4.4.6.9 notsubset --> 848<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notsubset]]"> 849<xsl:param name="p" select="0"/> 850<xsl:call-template name="binary"> 851 <xsl:with-param name="this-p" select="2"/> 852 <xsl:with-param name="p" select="$p"/> 853 <xsl:with-param name="mo"><mml:mo>⊈<!-- notsubseteq --></mml:mo></xsl:with-param> 854</xsl:call-template> 855</xsl:template> 856 857<!-- 4.4.6.10 notprsubset --> 858<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notprsubset]]"> 859<xsl:param name="p" select="0"/> 860<xsl:call-template name="binary"> 861 <xsl:with-param name="this-p" select="2"/> 862 <xsl:with-param name="p" select="$p"/> 863 <xsl:with-param name="mo"><mml:mo>⊄<!-- prsubset --></mml:mo></xsl:with-param> 864</xsl:call-template> 865</xsl:template> 866 867<!-- 4.4.6.11 setdiff --> 868<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:setdiff]]"> 869<xsl:param name="p" select="0"/> 870<xsl:call-template name="binary"> 871 <xsl:with-param name="this-p" select="2"/> 872 <xsl:with-param name="p" select="$p"/> 873 <xsl:with-param name="mo"><mml:mo>∖<!-- setminus --></mml:mo></xsl:with-param> 874</xsl:call-template> 875</xsl:template> 876 877<!-- 4.4.6.12 card --> 878<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:card]]"> 879<mml:mrow> 880<mml:mo>|</mml:mo> 881<xsl:apply-templates mode="c2p" select="*[2]"/> 882<mml:mo>|</mml:mo> 883</mml:mrow> 884</xsl:template> 885 886<!-- 4.4.6.13 cartesianproduct --> 887<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:cartesianproduct or self::mml:vectorproduct]]"> 888<xsl:param name="p" select="0"/> 889<xsl:call-template name="infix"> 890 <xsl:with-param name="this-p" select="2"/> 891 <xsl:with-param name="p" select="$p"/> 892 <xsl:with-param name="mo"><mml:mo>×<!-- times --></mml:mo></xsl:with-param> 893</xsl:call-template> 894</xsl:template> 895 896<xsl:template 897match="mml:apply[*[1][self::mml:cartesianproduct][count(following-sibling::mml:reals)=count(following-sibling::*)]]" 898priority="2"> 899<mml:msup> 900<xsl:apply-templates mode="c2p" select="*[2]"> 901 <xsl:with-param name="p" select="5"/> 902</xsl:apply-templates> 903<mml:mn><xsl:value-of select="count(*)-1"/></mml:mn> 904</mml:msup> 905</xsl:template> 906 907 908<!-- 4.4.7.1 sum --> 909<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:sum]]"> 910 <mml:mrow> 911 <mml:msubsup> 912 <mml:mo>∑<!--sum--></mml:mo> 913 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow> 914 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow> 915 </mml:msubsup> 916 <xsl:apply-templates mode="c2p" select="*[last()]"/> 917</mml:mrow> 918</xsl:template> 919 920<!-- 4.4.7.2 product --> 921<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:product]]"> 922 <mml:mrow> 923 <mml:msubsup> 924 <mml:mo>∏<!--product--></mml:mo> 925 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow> 926 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow> 927 </mml:msubsup> 928 <xsl:apply-templates mode="c2p" select="*[last()]"/> 929</mml:mrow> 930</xsl:template> 931 932<!-- 4.4.7.3 limit --> 933<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:limit]]"> 934 <mml:mrow> 935 <mml:munder> 936 <mml:mi>limit</mml:mi> 937 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit|mml:condition/*"/></mml:mrow> 938 </mml:munder> 939 <xsl:apply-templates mode="c2p" select="*[last()]"/> 940</mml:mrow> 941</xsl:template> 942 943<xsl:template mode="c2p" match="mml:apply[mml:limit]/mml:lowlimit" priority="3"> 944<mml:mrow> 945<xsl:apply-templates mode="c2p" select="../mml:bvar/node()"/> 946<mml:mo>→<!--rightarrow--></mml:mo> 947<xsl:apply-templates mode="c2p"/> 948</mml:mrow> 949</xsl:template> 950 951 952<!-- 4.4.7.4 tendsto --> 953<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto]]"> 954 <xsl:param name="p"/> 955<xsl:call-template name="binary"> 956 <xsl:with-param name="this-p" select="2"/> 957 <xsl:with-param name="p" select="$p"/> 958 <xsl:with-param name="mo"><mml:mo> 959 <xsl:choose> 960 <xsl:when test="@type='above'">↘<!--searrow--></xsl:when> 961 <xsl:when test="@type='below'">↗<!--nearrow--></xsl:when> 962 <xsl:when test="@type='two-sided'">→<!--rightarrow--></xsl:when> 963 <xsl:otherwise>→<!--rightarrow--></xsl:otherwise> 964 </xsl:choose> 965 </mml:mo></xsl:with-param> 966</xsl:call-template> 967</xsl:template> 968 969<!-- 4.4.8.1 trig --> 970<xsl:template mode="c2p" match="mml:apply[*[1][ 971 self::mml:sin or self::mml:cos or self::mml:tan or self::mml:sec or 972 self::mml:csc or self::mml:cot or self::mml:sinh or self::mml:cosh or 973 self::mml:tanh or self::mml:sech or self::mml:csch or self::mml:coth or 974 self::mml:arcsin or self::mml:arccos or self::mml:arctan or self::mml:arccosh 975 or self::mml:arccot or self::mml:arccoth or self::mml:arccsc or 976 self::mml:arccsch or self::mml:arcsec or self::mml:arcsech or 977 self::mml:arcsinh or self::mml:arctanh or self::mml:ln]]"> 978<mml:mrow> 979<mml:mi><xsl:value-of select="local-name(*[1])"/></mml:mi> 980<xsl:apply-templates mode="c2p" select="*[2]"> 981 <xsl:with-param name="p" select="7"/> 982</xsl:apply-templates> 983</mml:mrow> 984</xsl:template> 985 986 987 988 989<!-- 4.4.8.2 exp --> 990<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exp]]"> 991<mml:msup> 992<mml:mi>e<!-- exponential e--></mml:mi> 993<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow> 994</mml:msup> 995</xsl:template> 996 997<!-- 4.4.8.3 ln --> 998<!-- with trig --> 999 1000<!-- 4.4.8.4 log --> 1001<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:log]]"> 1002<mml:mrow> 1003<xsl:choose> 1004<xsl:when test="not(mml:logbase) or mml:logbase=10"> 1005<mml:mi>log</mml:mi> 1006</xsl:when> 1007<xsl:otherwise> 1008<mml:msub> 1009<mml:mi>log</mml:mi> 1010<mml:mrow><xsl:apply-templates mode="c2p" select="mml:logbase/node()"/></mml:mrow> 1011</mml:msub> 1012</xsl:otherwise> 1013</xsl:choose> 1014<xsl:apply-templates mode="c2p" select="*[last()]"> 1015 <xsl:with-param name="p" select="7"/> 1016</xsl:apply-templates> 1017</mml:mrow> 1018</xsl:template> 1019 1020 1021<!-- 4.4.9.1 mean --> 1022<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:mean]]"> 1023<mml:mrow> 1024 <mml:mo>〈<!--langle--></mml:mo> 1025 <xsl:for-each select="*[position()>1]"> 1026 <xsl:apply-templates mode="c2p" select="."/> 1027 <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if> 1028 </xsl:for-each> 1029<mml:mo>〉<!--rangle--></mml:mo> 1030</mml:mrow> 1031</xsl:template> 1032 1033 1034<!-- 4.4.9.2 sdef --> 1035<xsl:template mode="c2p" match="mml:sdev"> 1036<mml:mo>σ<!--sigma--></mml:mo> 1037</xsl:template> 1038 1039<!-- 4.4.9.3 variance --> 1040<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:variance]]"> 1041<mml:msup> 1042<mml:mrow> 1043<mml:mo>σ<!--sigma--></mml:mo> 1044<mml:mo>(</mml:mo> 1045<xsl:apply-templates mode="c2p" select="*[2]"/> 1046<mml:mo>)</mml:mo> 1047</mml:mrow> 1048<mml:mn>2</mml:mn> 1049</mml:msup> 1050</xsl:template> 1051 1052 1053<!-- 4.4.9.4 median --> 1054<xsl:template mode="c2p" match="mml:median"> 1055<mml:mo>median</mml:mo> 1056</xsl:template> 1057 1058 1059<!-- 4.4.9.5 mode --> 1060<xsl:template mode="c2p" match="mml:mode"> 1061<mml:mo>mode</mml:mo> 1062</xsl:template> 1063 1064<!-- 4.4.9.5 moment --> 1065<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:moment]]"> 1066<mml:mrow> 1067 <mml:mo>〈<!--langle--></mml:mo> 1068 <mml:msup> 1069 <xsl:apply-templates mode="c2p" select="*[last()]"/> 1070 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/node()"/></mml:mrow> 1071 </mml:msup> 1072<mml:mo>〉<!--rangle--></mml:mo> 1073</mml:mrow> 1074</xsl:template> 1075 1076<!-- 4.4.9.5 momentabout --> 1077<xsl:template mode="c2p" match="mml:momentabout"/> 1078 1079<!-- 4.4.10.1 vector --> 1080<xsl:template mode="c2p" match="mml:vector"> 1081<mml:mrow> 1082<mml:mo>(</mml:mo> 1083<mml:mtable> 1084<xsl:for-each select="*"> 1085<mml:mtr><mml:mtd><xsl:apply-templates mode="c2p" select="."/></mml:mtd></mml:mtr> 1086</xsl:for-each> 1087</mml:mtable> 1088<mml:mo>)</mml:mo> 1089</mml:mrow> 1090</xsl:template> 1091 1092<!-- 4.4.10.2 matrix --> 1093<xsl:template mode="c2p" match="mml:matrix"> 1094<mml:mrow> 1095<mml:mo>(</mml:mo> 1096<mml:mtable> 1097<xsl:apply-templates mode="c2p"/> 1098</mml:mtable> 1099<mml:mo>)</mml:mo> 1100</mml:mrow> 1101</xsl:template> 1102 1103<!-- 4.4.10.3 matrixrow --> 1104<xsl:template mode="c2p" match="mml:matrixrow"> 1105<mml:mtr> 1106<xsl:for-each select="*"> 1107<mml:mtd><xsl:apply-templates mode="c2p" select="."/></mml:mtd> 1108</xsl:for-each> 1109</mml:mtr> 1110</xsl:template> 1111 1112<!-- 4.4.10.4 determinant --> 1113<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:determinant]]"> 1114<mml:mrow> 1115<mml:mi>det</mml:mi> 1116<xsl:apply-templates mode="c2p" select="*[2]"> 1117 <xsl:with-param name="p" select="7"/> 1118</xsl:apply-templates> 1119</mml:mrow> 1120</xsl:template> 1121 1122<xsl:template 1123match="mml:apply[*[1][self::mml:determinant]][*[2][self::mml:matrix]]" priority="2"> 1124<mml:mrow> 1125<mml:mo>|</mml:mo> 1126<mml:mtable> 1127<xsl:apply-templates mode="c2p" select="mml:matrix/*"/> 1128</mml:mtable> 1129<mml:mo>|</mml:mo> 1130</mml:mrow> 1131</xsl:template> 1132 1133<!-- 4.4.10.5 transpose --> 1134<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:transpose]]"> 1135<mml:msup> 1136<xsl:apply-templates mode="c2p" select="*[2]"> 1137 <xsl:with-param name="p" select="7"/> 1138</xsl:apply-templates> 1139<mml:mi>T</mml:mi> 1140</mml:msup> 1141</xsl:template> 1142 1143<!-- 4.4.10.5 selector --> 1144<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:selector]]"> 1145<mml:msub> 1146<xsl:apply-templates mode="c2p" select="*[2]"> 1147 <xsl:with-param name="p" select="7"/> 1148</xsl:apply-templates> 1149<mml:mrow> 1150 <xsl:for-each select="*[position()>2]"> 1151 <xsl:apply-templates mode="c2p" select="."/> 1152 <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if> 1153 </xsl:for-each> 1154</mml:mrow> 1155</mml:msub> 1156</xsl:template> 1157 1158<!-- *** --> 1159<!-- 4.4.10.6 vectorproduct see cartesianproduct --> 1160 1161 1162<!-- 4.4.10.7 scalarproduct--> 1163<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:scalarproduct or self::mml:outerproduct]]"> 1164<xsl:param name="p" select="0"/> 1165<xsl:call-template name="infix"> 1166 <xsl:with-param name="this-p" select="2"/> 1167 <xsl:with-param name="p" select="$p"/> 1168 <xsl:with-param name="mo"><mml:mo>.</mml:mo></xsl:with-param> 1169</xsl:call-template> 1170</xsl:template> 1171 1172<!-- 4.4.10.8 outerproduct--> 1173 1174<!-- 4.4.11.2 semantics --> 1175<xsl:template mode="c2p" match="mml:semantics"> 1176 <xsl:apply-templates mode="c2p" select="*[1]"/> 1177</xsl:template> 1178<xsl:template mode="c2p" match="mml:semantics[mml:annotation-xml/@encoding='MathML-Presentation']"> 1179 <xsl:apply-templates mode="c2p" select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/> 1180</xsl:template> 1181 1182<!-- 4.4.12.1 integers --> 1183<xsl:template mode="c2p" match="mml:integers"> 1184<mml:mi mathvariant="double-struck">Z</mml:mi> 1185</xsl:template> 1186 1187<!-- 4.4.12.2 reals --> 1188<xsl:template mode="c2p" match="mml:reals"> 1189<mml:mi mathvariant="double-struck">R</mml:mi> 1190</xsl:template> 1191 1192<!-- 4.4.12.3 rationals --> 1193<xsl:template mode="c2p" match="mml:rationals"> 1194<mml:mi mathvariant="double-struck">Q</mml:mi> 1195</xsl:template> 1196 1197<!-- 4.4.12.4 naturalnumbers --> 1198<xsl:template mode="c2p" match="mml:naturalnumbers"> 1199<mml:mi mathvariant="double-struck">N</mml:mi> 1200</xsl:template> 1201 1202<!-- 4.4.12.5 complexes --> 1203<xsl:template mode="c2p" match="mml:complexes"> 1204<mml:mi mathvariant="double-struck">C</mml:mi> 1205</xsl:template> 1206 1207<!-- 4.4.12.6 primes --> 1208<xsl:template mode="c2p" match="mml:primes"> 1209<mml:mi mathvariant="double-struck">P</mml:mi> 1210</xsl:template> 1211 1212<!-- 4.4.12.7 exponentiale --> 1213<xsl:template mode="c2p" match="mml:exponentiale"> 1214 <mml:mi>e<!-- exponential e--></mml:mi> 1215</xsl:template> 1216 1217<!-- 4.4.12.8 imaginaryi --> 1218<xsl:template mode="c2p" match="mml:imaginaryi"> 1219 <mml:mi>i<!-- imaginary i--></mml:mi> 1220</xsl:template> 1221 1222<!-- 4.4.12.9 notanumber --> 1223<xsl:template mode="c2p" match="mml:notanumber"> 1224 <mml:mi>NaN</mml:mi> 1225</xsl:template> 1226 1227<!-- 4.4.12.10 true --> 1228<xsl:template mode="c2p" match="mml:true"> 1229 <mml:mi>true</mml:mi> 1230</xsl:template> 1231 1232<!-- 4.4.12.11 false --> 1233<xsl:template mode="c2p" match="mml:false"> 1234 <mml:mi>false</mml:mi> 1235</xsl:template> 1236 1237<!-- 4.4.12.12 emptyset --> 1238<xsl:template mode="c2p" match="mml:emptyset"> 1239 <mml:mi>∅<!-- emptyset --></mml:mi> 1240</xsl:template> 1241 1242 1243<!-- 4.4.12.13 pi --> 1244<xsl:template mode="c2p" match="mml:pi"> 1245 <mml:mi>π<!-- pi --></mml:mi> 1246</xsl:template> 1247 1248<!-- 4.4.12.14 eulergamma --> 1249<xsl:template mode="c2p" match="mml:eulergamma"> 1250 <mml:mi>γ<!-- gamma --></mml:mi> 1251</xsl:template> 1252 1253<!-- 4.4.12.15 infinity --> 1254<xsl:template mode="c2p" match="mml:infinity"> 1255 <mml:mi>∞<!-- infinity --></mml:mi> 1256</xsl:template> 1257 1258 1259<!-- ****************************** --> 1260<xsl:template name="infix" > 1261 <xsl:param name="mo"/> 1262 <xsl:param name="p" select="0"/> 1263 <xsl:param name="this-p" select="0"/> 1264 <mml:mrow> 1265 <xsl:if test="$this-p < $p"><mml:mo>(</mml:mo></xsl:if> 1266 <xsl:for-each select="*[position()>1]"> 1267 <xsl:if test="position() > 1"> 1268 <xsl:copy-of select="$mo"/> 1269 </xsl:if> 1270 <xsl:apply-templates mode="c2p" select="."> 1271 <xsl:with-param name="p" select="$this-p"/> 1272 </xsl:apply-templates> 1273 </xsl:for-each> 1274 <xsl:if test="$this-p < $p"><mml:mo>)</mml:mo></xsl:if> 1275 </mml:mrow> 1276</xsl:template> 1277 1278<xsl:template name="binary" > 1279 <xsl:param name="mo"/> 1280 <xsl:param name="p" select="0"/> 1281 <xsl:param name="this-p" select="0"/> 1282 <mml:mrow> 1283 <xsl:if test="$this-p < $p"><mml:mo>(</mml:mo></xsl:if> 1284 <xsl:apply-templates mode="c2p" select="*[2]"> 1285 <xsl:with-param name="p" select="$this-p"/> 1286 </xsl:apply-templates> 1287 <xsl:copy-of select="$mo"/> 1288 <xsl:apply-templates mode="c2p" select="*[3]"> 1289 <xsl:with-param name="p" select="$this-p"/> 1290 </xsl:apply-templates> 1291 <xsl:if test="$this-p < $p"><mml:mo>)</mml:mo></xsl:if> 1292 </mml:mrow> 1293</xsl:template> 1294 1295<xsl:template name="set" > 1296 <xsl:param name="o" select="'{'"/> 1297 <xsl:param name="c" select="'}'"/> 1298 <mml:mrow> 1299 <mml:mo><xsl:value-of select="$o"/></mml:mo> 1300 <xsl:choose> 1301 <xsl:when test="mml:condition"> 1302 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*[not(self::bvar or self::condition)]"/></mml:mrow> 1303 <mml:mo>|</mml:mo> 1304 <mml:mrow><xsl:apply-templates mode="c2p" select="mml:condition/node()"/></mml:mrow> 1305 </xsl:when> 1306 <xsl:otherwise> 1307 <xsl:for-each select="*"> 1308 <xsl:apply-templates mode="c2p" select="."/> 1309 <xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if> 1310 </xsl:for-each> 1311 </xsl:otherwise> 1312 </xsl:choose> 1313 <mml:mo><xsl:value-of select="$c"/></mml:mo> 1314 </mml:mrow> 1315</xsl:template> 1316 1317</xsl:stylesheet> 1318 1319