<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML">

<!--
Use and distribution of this code are permitted under the terms of the <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">W3C Software Notice and License</a>.

Kyle Siegrist
Based on the stylesheet of David Carlisle
Contributions by Tom Leathrum
Version 2009.5.1
-->

<xsl:output method="xml" />

<xsl:template mode="c2p" match="*">
<xsl:copy>
	<xsl:copy-of select="@*"/>
	<xsl:apply-templates mode="c2p"/>
</xsl:copy>
</xsl:template>

<!-- 4.4.1.1 cn -->
<xsl:template mode="c2p" match="mml:cn">
	<mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='complex-cartesian']">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 1"><mml:mo>(</mml:mo></xsl:if>
		<mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn>
		<mml:mo>+</mml:mo>
		<mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>
		<mml:mo></mml:mo>
		<mml:mi>i</mml:mi>
		<xsl:if test="$p &gt; 1"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='rational']">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 4"><mml:mo>(</mml:mo></xsl:if>
		<mml:mfrac>
			<mml:mrow><mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn></mml:mrow>
			<mml:mrow><mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn></mml:mrow>
		</mml:mfrac>
		<xsl:if test="$p &gt; 4"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='integer']">
	<xsl:choose>
		<xsl:when test="not(@base) or @base=10">
			<mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>
		</xsl:when>
		<xsl:otherwise>
			<mml:msub>
				<mml:mrow><mml:mo>[</mml:mo>
					<mml:mn><xsl:apply-templates mode="c2p"/></mml:mn>
					<mml:mo>]</mml:mo>
				</mml:mrow>
				<mml:mn><xsl:value-of select="@base"/></mml:mn>
			</mml:msub>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='complex-polar']">
	<mml:mrow>
		<mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/></mml:mn>
		<mml:mo></mml:mo>
		<mml:msup>
			<mml:mi>e</mml:mi>
			<mml:mrow>
				 <mml:mi>i</mml:mi>
				 <mml:mo></mml:mo>
				 <mml:mn><xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>
			</mml:mrow>
		</mml:msup>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='e-notation']">
		<mml:mn><xsl:apply-templates mode="c2p" select="text()[1]"/>E<xsl:apply-templates mode="c2p" select="text()[2]"/></mml:mn>
</xsl:template>

<xsl:template mode="c2p" match="mml:cn[@type='vector']">
	<mml:mi mathvariant='bold'><xsl:value-of select="."/></mml:mi>
</xsl:template>

<!-- 4.4.1.1 ci  -->
<xsl:template mode="c2p" match="mml:ci/text()">
	<mml:mi><xsl:value-of select="."/></mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:ci">
	<mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:ci[@type='vector']">
	<mml:mi mathvariant='bold-italic'><xsl:value-of select="."/></mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:ci[@type='collection']">
	<mml:mi class='collection'><xsl:value-of select="."/></mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:ci[@type='bar']">
	<mml:mrow>
		<mml:mover acent='true'>
			<mml:mi><xsl:value-of select="."/></mml:mi>
			<mml:mo stretchy='true'>&#175;</mml:mo>
		</mml:mover>
	</mml:mrow>
</xsl:template>

<!-- 4.4.1.2 csymbol -->
<xsl:template mode="c2p" match="mml:csymbol/text()">
	<mml:mo><xsl:apply-templates mode="c2p"/></mml:mo>
</xsl:template>

<xsl:template mode="c2p" match="mml:csymbol">
	<mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>
</xsl:template>

<!-- 4.4.2.1 apply -->
<xsl:template mode="c2p" match="mml:apply">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="*[1]">
			<xsl:with-param name="p" select="10"/>
		</xsl:apply-templates>
		<mml:mo>(</mml:mo>
		<xsl:for-each select="*[position()>1 and not(self::mml:given)]">
			<xsl:apply-templates mode="c2p" select="."/>
			<xsl:if test="position() != last()"><mml:mo>,</mml:mo></xsl:if>
		</xsl:for-each>
		<xsl:for-each select="*[position() &gt; 1 and self::mml:given]">
			<xsl:apply-templates mode="c2p" select="."/>
		</xsl:for-each>
		<mml:mo>)</mml:mo>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[@type='relation']">
	<xsl:param name="mo" select="*[1]"/>
	<mml:mrow>
		<xsl:for-each select="*[position() &gt; 1]">
			<xsl:if test="position() &gt; 1">
				<xsl:apply-templates mode="c2p" select="$mo"/>
			</xsl:if>
			<xsl:apply-templates mode="c2p" select=".">
			</xsl:apply-templates>
		</xsl:for-each>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:given">
	<mml:mo>|</mml:mo>
	<xsl:for-each select="*[position()]">
		<xsl:apply-templates mode="c2p" select="."/>
		<xsl:if test="position() != last()"><mml:mo>,</mml:mo></xsl:if>
	</xsl:for-each>
</xsl:template>

<!-- String -->
<xsl:template mode="c2p" match="mml:string">
	<mml:mrow>
	<mml:mo>[</mml:mo>
	<xsl:for-each select="*[position()]">
		<xsl:apply-templates mode="c2p" select="."/>
	</xsl:for-each>
	<mml:mo>]</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.2.3 fn -->
<xsl:template mode="c2p" match="mml:fn">
	<mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>
</xsl:template>

<!-- 4.4.2.4 interval -->
<xsl:template mode="c2p" match="mml:interval[*[2]]">
	<mml:mfenced open="[" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced>
</xsl:template>
<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open']">
	<mml:mfenced open="(" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced>
</xsl:template>
<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='open-closed']">
	<mml:mfenced open="(" close="]"><xsl:apply-templates mode="c2p"/></mml:mfenced>
</xsl:template>
<xsl:template mode="c2p" match="mml:interval[*[2]][@closure='closed-open']">
	<mml:mfenced open="[" close=")"><xsl:apply-templates mode="c2p"/></mml:mfenced>
</xsl:template>

<xsl:template mode="c2p" match="mml:interval">
	<mml:mfenced open="{{" close="}}"><xsl:apply-templates mode="c2p"/></mml:mfenced>
</xsl:template>

<!-- 4.4.2.5 inverse -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:inverse]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow><mml:mo>&#8722;</mml:mo><mml:mn>1</mml:mn></mml:mrow>
	</mml:msup>
</xsl:template>

<!-- 4.4.2.7 condition -->
<xsl:template mode="c2p" match="mml:condition">
	<mml:mrow><xsl:apply-templates mode="c2p"/></mml:mrow>
</xsl:template>

<!-- 4.4.2.8 declare -->
<xsl:template mode="c2p" match="mml:declare"/>

<!-- 4.4.2.9 lambda -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lambda]]">
	<mml:mrow>
		<mml:mi>&#955;</mml:mi>
		<mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*"/></mml:mrow>
		<mml:mo>.</mml:mo>
		<mml:mfenced>
			<xsl:apply-templates mode="c2p" select="*[last()]"/>
		</mml:mfenced>
	</mml:mrow>
</xsl:template>

<!-- 4.4.2.10 compose -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:compose]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="2"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8728;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- compositionpower -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:compositionpower]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow>
			<mml:mo>&#8728;</mml:mo>
			<xsl:apply-templates mode="c2p" select="*[3]" />
		</mml:mrow>
	</mml:msup>
</xsl:template>

<!-- 4.4.2.11` ident -->
<xsl:template mode="c2p" match="mml:ident">
	<mml:mi>I</mml:mi>
</xsl:template>

<!-- 4.4.2.12` domain -->
<xsl:template mode="c2p" match="mml:domain">
	<mml:mo>domain</mml:mo>
</xsl:template>

<!-- 4.4.2.13` codomain -->
<xsl:template mode="c2p" match="mml:codomain">
	<mml:mo>codomain</mml:mo>
</xsl:template>

<!-- 4.4.2.14` image -->
<xsl:template mode="c2p" match="mml:image">
	<mml:mo>image</mml:mo>
</xsl:template>

<!-- 4.4.2.15` domainofapplication -->
<xsl:template mode="c2p" match="mml:domainofapplication">
	<mml:error/>
</xsl:template>

<!-- 4.4.2.16` piecewise -->
<xsl:template mode="c2p" match="mml:piecewise">
	<mml:mrow>
		<mml:mo>{</mml:mo>
		<mml:mtable columnalign="left">
		<xsl:for-each select="mml:piece">
			<mml:mtr>
				<mml:mtd><xsl:apply-templates mode="c2p" select="*[1]"/><mml:mo>,</mml:mo></mml:mtd>
				<mml:mtd><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mtd>
			</mml:mtr>
		</xsl:for-each>
		<xsl:for-each select="mml:otherwise">
			<mml:mtr>
				<mml:mtd><xsl:apply-templates mode="c2p" select="*[1]"/><mml:mo>,</mml:mo></mml:mtd>
				<mml:mtd><mml:mtext>otherwise</mml:mtext></mml:mtd>
			</mml:mtr>
		</xsl:for-each>
		</mml:mtable>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.1 quotient -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:quotient]]">
	<mml:mrow>
		<mml:mo>&#8970;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>/</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[3]"/>
		<mml:mo>&#8971;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- mapsto  -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:mapsto] and count(*)=3]">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#x021A6;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[3]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:mapsto] and count(*)=4]">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>:</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[3]"/>
		<mml:mo>&#8594;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[4]"/>
	</mml:mrow>
</xsl:template>

<!-- indicate -->
<xsl:template mode="c2p" match="mml:indicate">
	<mml:mn mathvariant='bold'>1</mml:mn>
</xsl:template>

<!-- 4.4.3.2 factorial -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorial] and count(*)=2]">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="7"/>
		</xsl:apply-templates>
		<mml:mo>!</mml:mo>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorial] and count(*)=3]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow>
			<mml:mo>(</mml:mo>
			<xsl:apply-templates mode="c2p" select="*[3]" />
			<mml:mo>)</mml:mo>
		</mml:mrow>
	</mml:msup>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorial] and count(*)=4]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow>
			<mml:mo>(</mml:mo>
			<xsl:apply-templates mode="c2p" select="*[3]" />
				<mml:mo>,</mml:mo>
			<xsl:apply-templates mode="c2p" select="*[4]" />
			<mml:mo>)</mml:mo>
		</mml:mrow>
</mml:msup>
</xsl:template>

<!-- divide -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:divide]]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 4"><mml:mo>(</mml:mo></xsl:if>
		<mml:mfrac>
			<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>
			<mml:mrow><xsl:apply-templates mode="c2p" select="*[3]"/></mml:mrow>
		</mml:mfrac>
		<xsl:if test="$p &gt; 4"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:divide[@type='inline']]]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 3"><mml:mo>(</mml:mo></xsl:if>
		<mml:mrow>
			<xsl:apply-templates mode="c2p" select="*[2]">
				<xsl:with-param name="p" select="7"/>
			</xsl:apply-templates>
		</mml:mrow>
		<mml:mo>/</mml:mo>
		<mml:mrow>
			<xsl:apply-templates mode="c2p" select="*[3]">
				<xsl:with-param name="p" select="7"/>
			</xsl:apply-templates>
		</mml:mrow>
		<xsl:if test="$p &gt; 3"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<!-- binomial -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:binomial]]">
		<mml:mrow>
		<mml:mo>(</mml:mo>
		<mml:mfrac linethickness='0'>
			<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>
			<mml:mrow>
				<xsl:for-each select="*">
					<xsl:if test="position() &gt; 2">
						<xsl:apply-templates mode="c2p" select="."/>
						<xsl:if test="position() != last()">
							<mml:mo>,</mml:mo>
						</xsl:if>
					</xsl:if>
				</xsl:for-each>
			</mml:mrow>
		</mml:mfrac>
		<mml:mo>)</mml:mo>
		</mml:mrow>
</xsl:template>

<!-- 4.4.3.4 max  min-->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:max]]">
	<mml:mrow>
		<mml:mo>max</mml:mo>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:min]]">
	<mml:mrow>
		<mml:mo>min</mml:mo>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<!--  inf  sup-->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:sup]]">
	<mml:mrow>
		<mml:mi>sup</mml:mi>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:inf]]">
	<mml:mrow>
		<mml:mi>inf</mml:mi>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.5  minus-->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)=2]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 3"><mml:mo>(</mml:mo></xsl:if>
		<mml:mo>&#8722;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="3"/>
		</xsl:apply-templates>
		<xsl:if test="$p &gt; 3"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:minus] and count(*)&gt;2]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#8722;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<!-- plusminus-->

<xsl:template mode="c2p" match="mml:plusminus">
	<mml:mo>&#177;</mml:mo>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:plusminus] and count(*)=2]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 3"><mml:mo>(</mml:mo></xsl:if>
		<mml:mo>&#177;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"></xsl:apply-templates>
		<xsl:if test="$p &gt; 3"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:plusminus] and count(*)&gt;2]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#177;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="2"/>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.6 plus -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:plus]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>+</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.7 power -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:power]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<xsl:apply-templates mode="c2p" select="*[3]" />
	</mml:msup>
</xsl:template>

<!-- ordinal -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ordinal]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mi>th</mml:mi>
	</mml:msup>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ordinal[@type='st']]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mi>st</mml:mi>
	</mml:msup>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ordinal[@type='nd']]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mi>nd</mml:mi>
	</mml:msup>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ordinal[@type='rd']]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mi>rd</mml:mi>
	</mml:msup>
</xsl:template>

<!-- convolutionpower -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:convolutionpower]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow>
			<mml:mo>*</mml:mo>
			<xsl:apply-templates mode="c2p" select="*[3]" />
		</mml:mrow>
	</mml:msup>
</xsl:template>

<!-- positivepart -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:positivepart]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow><mml:mo>+</mml:mo></mml:mrow>
	</mml:msup>
</xsl:template>

<!-- negativepart -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:negativepart]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mrow><mml:mo>&#8722;</mml:mo></mml:mrow>
	</mml:msup>
</xsl:template>

<!-- 4.4.3.8 remainder -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:rem]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#160;mod&#8194;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.9 times -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:times]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="4"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8290;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- convolve -->
<xsl:template mode="c2p" match="mml:convolve">
	<mml:mo>*</mml:mo>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:convolve]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="4"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>*</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- odds -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:odds]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>:</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.10 root -->
	<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:root]]" priority="4">
	<xsl:choose>
		<xsl:when test="mml:degree and not(mml:degree=2)">
			<mml:mroot>
				<xsl:apply-templates mode="c2p" select="*[position()&gt;1 and not(self::mml:degree)]"/>
				<mml:mrow>
					<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>
				</mml:mrow>
			</mml:mroot>
		</xsl:when>
		<xsl:otherwise>
			<mml:msqrt>
				<xsl:apply-templates mode="c2p" select="*[position()&gt;1]"/>
			</mml:msqrt>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- 4.4.3.11 gcd -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:gcd]]">
	<mml:mrow>
		<mml:mi>gcd</mml:mi>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.12 and -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:and]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="9"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8194;and&#8194;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.13 or -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:or]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="0"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8194;or&#8194;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.14 xor -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:xor]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8194;xor&#8194;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.15 not -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:not]]">
	<mml:mrow>
		<mml:mo>&#172;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="7"/>
		</xsl:apply-templates>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.16 implies -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:implies]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#8658;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<!-- modulo -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:modulo]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>/</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.3.17 forall -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:forall]]">
<mml:mrow>
	<xsl:apply-templates mode="c2p" select="*[last()]"/>
		<mml:mi>&#8194;for all&#8194;</mml:mi>
		<mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.18 exists -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exists]]">
<mml:mrow>
	<xsl:apply-templates mode="c2p" select="*[last()]"/>
		<mml:mi mathvariant="normal">&#8194;for some&#8194;</mml:mi>
		<mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar[not(current()/mml:condition)]/*|mml:condition/*"/></mml:mrow>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.19 abs -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:abs]]">
	<mml:mrow>
		<mml:mo>|</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>|</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- norm -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:norm]]">
	<mml:mrow>
		<mml:mo>&#x02016;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#x02016;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.20 conjugate -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:conjugate]]">
	<mml:mover>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#175;</mml:mo>
	</mml:mover>
</xsl:template>

<!-- 4.4.3.21 arg -->
<xsl:template mode="c2p" match="mml:arg">
	<mml:mo>arg</mml:mo>
</xsl:template>

<!-- 4.4.3.22 real -->
<xsl:template mode="c2p" match="mml:real">
	<mml:mo>&#8475;</mml:mo>
</xsl:template>

<!-- 4.4.3.23 imaginary -->
<xsl:template mode="c2p" match="mml:imaginary">
	<mml:mo>&#8465;</mml:mo>
</xsl:template>

<!-- 4.4.3.24 lcm -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lcm]]">
	<mml:mrow>
		<mml:mi>lcm</mml:mi>
		<xsl:call-template name="set"/>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.25 floor -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:floor]]">
	<mml:mrow>
		<mml:mo>&#8970;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#8971;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.3.25 ceiling -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:ceiling]]">
	<mml:mrow>
		<mml:mo>&#8968;</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#8969;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.4.1 eq -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:eq]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>=</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:eq">
	<mml:mo>=</mml:mo>
</xsl:template>

<!-- 4.4.4.2 neq -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:neq]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8800;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.4.3 gt -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:gt]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&gt;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:gt">
	<mml:mo>&gt;</mml:mo>
</xsl:template>

<!-- 4.4.4.4 lt -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:lt]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&lt;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:lt">
	<mml:mo>&lt;</mml:mo>
</xsl:template>

<!-- 4.4.4.5 geq -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:geq]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8805;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:geq">
	<mml:mo>&#8805;</mml:mo>
</xsl:template>

<!-- 4.4.4.6 leq -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:leq]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8804;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:leq">
	<mml:mo>&#8804;</mml:mo>
</xsl:template>

<!-- preceq (weak precedes) -->
<xsl:template mode="c2p" match="mml:preceq">
	<mml:mo>&#x0227C;</mml:mo>
</xsl:template>

<!-- prec (strong precedes) -->
<xsl:template mode="c2p" match="mml:prec">
	<mml:mo>&#x0227A;</mml:mo>
</xsl:template>

<!-- succeq (weak succeeds) -->
<xsl:template mode="c2p" match="mml:succeq">
	<mml:mo>&#x0227D;</mml:mo>
</xsl:template>

<!-- succ (strong succeeds) -->
<xsl:template mode="c2p" match="mml:succ">
	<mml:mo>&#x0227B;</mml:mo>
</xsl:template>

<!-- parallel -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:parallel]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#x02225;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:parallel">
	<mml:mo>&#x02225;</mml:mo>
</xsl:template>

<!-- perp (perpendicular) -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:perp]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#x022A5;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:perp">
	<mml:mo>&#x022A5;</mml:mo>
</xsl:template>

<!-- 4.4.4.7 equivalent -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:equivalent]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#x21D4;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:equivalent">
	<mml:mo>&#x21D4;</mml:mo>
</xsl:template>

<!-- 4.4.4.8 approx -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:approx]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8776;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:approx">
	<mml:mo>&#8776;</mml:mo>
</xsl:template>

<!-- approxeq -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:approxeq]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8773;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:approxeq">
	<mml:mo>&#8773;</mml:mo>
</xsl:template>

<!-- congruent -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:congruent]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#x02261;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:congruent">
	<mml:mo>&#x02261;</mml:mo>
</xsl:template>

<!-- 4.4.4.9 factorof -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:factorof]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>|</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:factorof">
	<mml:mo>|</mml:mo>
</xsl:template>

<!-- 4.4.5.1 int -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:int]]">
	<mml:mrow>
		<mml:msubsup>
			<mml:mo>&#8747;</mml:mo>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit/*|mml:interval/*[1]|mml:condition/*"/></mml:mrow>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*|mml:interval/*[2]"/></mml:mrow>
		</mml:msubsup>
		<xsl:apply-templates mode="c2p" select="*[last()]">
			<xsl:with-param name="p" select="3"/>
		</xsl:apply-templates>
	<mml:mo mathvariant="italic">d</mml:mo><xsl:apply-templates mode="c2p" select="mml:bvar"/>
	</mml:mrow>
</xsl:template>

<!-- 4.4.5.2 diff -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff] and count(*)=2]" priority="2">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>&#8242;</mml:mo>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff[@type='differential']] and count(*)=2]" priority="2">
	<mml:mrow>
		<mml:mi>d</mml:mi>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff] and mml:ci and mml:degree and count(*)=3]" priority="2">
	<xsl:choose>
		<xsl:when test="mml:degree=2">
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="*[3]"/>
				<mml:mo>&#8243;</mml:mo>
			</mml:mrow>
		</xsl:when>
		<xsl:when test="mml:degree=3">
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="*[3]"/>
				<mml:mo>&#8242;&#8242;&#8242;</mml:mo>
			</mml:mrow>
		</xsl:when>
		<xsl:otherwise>
			<mml:msup>
				<xsl:apply-templates mode="c2p" select="*[3]"/>
				<mml:mo>(<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>)</mml:mo>
			</mml:msup>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diff]]" priority="1">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<xsl:choose>
		<xsl:when test="mml:bvar/mml:degree">
			<mml:mrow>
				<mml:mo><mml:mfrac>
					<mml:mrow>
						<mml:msup>
							<mml:mi>d</mml:mi>
							<xsl:apply-templates mode="c2p" select="mml:bvar/mml:degree/node()"/>
						</mml:msup>
					 </mml:mrow>
					<mml:mrow>
						<mml:mi>d</mml:mi>
						<mml:msup>
							<xsl:apply-templates mode="c2p" select="mml:bvar/node()"/>
							<xsl:apply-templates mode="c2p" select="mml:bvar/mml:degree/node()"/>
						</mml:msup>
					</mml:mrow>
				</mml:mfrac></mml:mo>
				<xsl:apply-templates mode="c2p"  select="*[last()]"/>
			</mml:mrow>
		</xsl:when>
		<xsl:when test="mml:degree">
			<mml:mrow>
				<mml:mo><mml:mfrac>
					<mml:mrow>
						<mml:msup>
							<mml:mi>d</mml:mi>
							<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>
						</mml:msup>
					</mml:mrow>
					<mml:mrow>
						<mml:mi>d</mml:mi>
						<mml:msup>
							<xsl:apply-templates mode="c2p" select="mml:bvar/node()"/>
							<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>
						</mml:msup>
					</mml:mrow>
				</mml:mfrac></mml:mo>
				<xsl:apply-templates mode="c2p"  select="*[last()]"/>
			</mml:mrow>
		</xsl:when>
		<xsl:otherwise>
			<mml:mrow>
			<xsl:if test="$p &gt; 4"><mml:mo>(</mml:mo></xsl:if>
				<mml:mo>
					<mml:mfrac>
						<mml:mrow>
							<mml:mi>d</mml:mi>
							<xsl:apply-templates mode="c2p" select="*[last()]"/>
						</mml:mrow>
						<mml:mrow><mml:mi>d</mml:mi><xsl:apply-templates mode="c2p" select="mml:bvar/node()"/></mml:mrow>
					</mml:mfrac>
				</mml:mo>
				<xsl:if test="$p &gt; 4"><mml:mo>)</mml:mo></xsl:if>
			</mml:mrow>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- 4.4.5.3 partialdiff -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff] and mml:list and mml:ci and count(*)=3]" priority="2">
	<mml:mrow>
		<mml:msub>
			<mml:mo>D</mml:mo>
			<mml:mrow>
				<xsl:for-each select="mml:list[1]/*">
					<xsl:apply-templates mode="c2p" select="."/>
					<xsl:if test="position() &lt; last()"><mml:mo>,</mml:mo></xsl:if>
				</xsl:for-each>
			</mml:mrow>
		</mml:msub>
		<mml:mrow><xsl:apply-templates mode="c2p" select="*[3]"/></mml:mrow>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:partialdiff]]" priority="1">
	<mml:mfrac>
		<mml:mrow>
			<mml:msup>
				<mml:mo>&#8706;</mml:mo>
				<mml:mrow>
					<xsl:choose>
						<xsl:when test="mml:degree">
							<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>
						</xsl:when>
						<xsl:when test="mml:bvar/mml:degree[string(number(.))='NaN']">
							<xsl:for-each select="mml:bvar/mml:degree">
								<xsl:apply-templates mode="c2p" select="node()"/>
								<xsl:if test="position() &lt; last()"><mml:mo>+</mml:mo></xsl:if>
							</xsl:for-each>
							<xsl:if test="count(mml:bvar[not(mml:degree)])&gt;0">
								<mml:mo>+</mml:mo><mml:mn><xsl:value-of select="count(mml:bvar[not(mml:degree)])"/></mml:mn>
							</xsl:if>
						</xsl:when>
						<xsl:otherwise>
							<mml:mn><xsl:value-of select="sum(mml:bvar/mml:degree)+count(mml:bvar[not(mml:degree)])"/></mml:mn>
						</xsl:otherwise>
					</xsl:choose>
				</mml:mrow>
			</mml:msup>
			<xsl:apply-templates mode="c2p"  select="*[last()]"/></mml:mrow>
		<mml:mrow>
			<xsl:for-each select="mml:bvar">
				<mml:mrow>
					<mml:mo>&#8706;</mml:mo>
					<mml:msup>
						<xsl:apply-templates mode="c2p" select="node()"/>
			            <mml:mrow>
			            	<xsl:apply-templates mode="c2p" select="mml:degree/node()"/>
			            </mml:mrow>
					</mml:msup>
				</mml:mrow>
			</xsl:for-each>
		</mml:mrow>
	</mml:mfrac>
</xsl:template>

<!-- 4.4.5.4  lowlimit-->
<xsl:template mode="c2p" match="mml:lowlimit"/>

<!-- 4.4.5.5 uplimit-->
<xsl:template mode="c2p" match="mml:uplimit"/>

<!-- 4.4.5.6  bvar-->
<xsl:template mode="c2p" match="mml:bvar">
	<mml:mi><xsl:apply-templates mode="c2p"/></mml:mi>
	<xsl:if test="following-sibling::mml:bvar"><mml:mo>,</mml:mo></xsl:if>
</xsl:template>

<!-- 4.4.5.7 degree-->
<xsl:template mode="c2p" match="mml:degree"/>

<!-- 4.4.5.8 divergence-->
<xsl:template mode="c2p" match="mml:divergence">
	<mml:mo>div</mml:mo>
</xsl:template>

<!-- 4.4.5.9 grad-->
<xsl:template mode="c2p" match="mml:grad">
	<mml:mo>grad</mml:mo>
</xsl:template>

<!-- 4.4.5.10 curl -->
<xsl:template mode="c2p" match="mml:curl">
	<mml:mo>curl</mml:mo>
</xsl:template>

<!-- 4.4.5.11 laplacian-->
<xsl:template mode="c2p" match="mml:laplacian">
<mml:msup><mml:mo>&#8711;</mml:mo><mml:mn>2</mml:mn></mml:msup>
</xsl:template>

<!-- 4.4.6.1 set -->
<xsl:template mode="c2p" match="mml:set">
	<xsl:call-template name="set"/>
</xsl:template>

<!-- 4.4.6.2 list -->
<xsl:template mode="c2p" match="mml:list">
	<xsl:call-template name="set">
		<xsl:with-param name="o" select="'['"/>
		<xsl:with-param name="c" select="']'"/>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.3 union -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:union]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8746;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- Union -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:Union]]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 2"><mml:mo>(</mml:mo></xsl:if>
		<mml:msubsup>
			<mml:mo>&#x022C3;</mml:mo>
			<xsl:choose>
				<xsl:when test="mml:lowlimit">
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:bvar"/>
						<mml:mo>=</mml:mo>
		 				<xsl:apply-templates mode="c2p" select="mml:lowlimit/*"/>
		 			</mml:mrow>
		 		</xsl:when>
				 <xsl:otherwise>
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:condition"/>
					</mml:mrow>
				</xsl:otherwise>
			</xsl:choose>
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="mml:uplimit/*"/>
			</mml:mrow>
		</mml:msubsup>
		<xsl:apply-templates mode="c2p" select="*[last()]"/>
		<xsl:if test="$p &gt; 2"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<!-- 4.4.6.4 intersect -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:intersect]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8745;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- Intersect -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:Intersect]]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
		<xsl:if test="$p &gt; 2"><mml:mo>(</mml:mo></xsl:if>
		<mml:msubsup>
			<mml:mo>&#x022C2;</mml:mo>
			<xsl:choose>
				<xsl:when test="mml:lowlimit">
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:bvar"/>
						<mml:mo>=</mml:mo>
						<xsl:apply-templates mode="c2p" select="mml:lowlimit/*"/>
		   			</mml:mrow>
		 		</xsl:when>
		 		<xsl:otherwise>
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:condition"/>
					</mml:mrow>
				</xsl:otherwise>
			</xsl:choose>
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="mml:uplimit/*"/>
			</mml:mrow>
		</mml:msubsup>
		<xsl:apply-templates mode="c2p" select="*[last()]"/>
		<xsl:if test="$p &gt; 2"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<!-- symmetric difference -->
<xsl:template mode="c2p" match="mml:symmdiff">
	<mml:mo>&#916;</mml:mo>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:symmdiff]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#916;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.5 in -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:in]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#8712;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="2"/>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:in">
	<mml:mo>&#8712;</mml:mo>
</xsl:template>


<!-- 4.4.6.5 notin -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notin]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="mo"><mml:mo>&#8713;</mml:mo></xsl:with-param>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="this-p" select="3"/>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.7 subset -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:subset]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="2"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8838;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:subset">
	<mml:mo>&#8838;</mml:mo>
</xsl:template>

<!-- 4.4.6.8 prsubset -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:prsubset]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="2"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8834;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.9 notsubset -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notsubset]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="2"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8840;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.10 notprsubset -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:notprsubset]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="2"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8836;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.11 setdiff -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:setdiff]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#8726;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- 4.4.6.12 card -->
<xsl:template mode="c2p" match="mml:card">
	<mml:mi>#</mml:mi>
</xsl:template>

<!-- 4.4.6.13 cartesianproduct -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:cartesianproduct or self::mml:vectorproduct or self::mml:cross]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="3"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#215;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template match="mml:apply[*[1][self::mml:cartesianproduct][count(following-sibling::mml:reals)=count(following-sibling::*)]]" priority="2">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mn><xsl:value-of select="count(*)-1"/></mml:mn>
	</mml:msup>
</xsl:template>

<!-- 4.4.7.1 sum -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:sum]]">
	<mml:mrow>
		<mml:msubsup>
			<mml:mo>&#8721;</mml:mo>
			<xsl:choose>
				<xsl:when test="mml:lowlimit">
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:bvar"/>
						<mml:mo>=</mml:mo>
						<xsl:apply-templates mode="c2p" select="mml:lowlimit/*"/>
			  		</mml:mrow>
				</xsl:when>
				 <xsl:otherwise>
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:condition"/>
					</mml:mrow>
				</xsl:otherwise>
			</xsl:choose>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*"/></mml:mrow>
		</mml:msubsup>
		<mml:mrow>
			<xsl:apply-templates mode="c2p" select="*[last()]">
				<xsl:with-param name="p" select="3"/>
			</xsl:apply-templates>
	 	</mml:mrow>
	</mml:mrow>
</xsl:template>

<!-- 4.4.7.2 product -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:product]]">
	<mml:mrow>
		<mml:msubsup>
			<mml:mo>&#8719;</mml:mo>
			<xsl:choose>
				<xsl:when test="mml:lowlimit">
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:bvar"/>
						<mml:mo>=</mml:mo>
						<xsl:apply-templates mode="c2p" select="mml:lowlimit/*"/>
					</mml:mrow>
				</xsl:when>
		 		<xsl:otherwise>
					<mml:mrow>
						<xsl:apply-templates mode="c2p" select="mml:condition"/>
					</mml:mrow>
				</xsl:otherwise>
			</xsl:choose>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:uplimit/*"/></mml:mrow>
		</mml:msubsup>
		<mml:mrow>
			<xsl:apply-templates mode="c2p" select="*[last()]">
				<xsl:with-param name="p" select="3"/>
			</xsl:apply-templates>
		</mml:mrow>
	</mml:mrow>
</xsl:template>

<!-- 4.4.7.3 limit -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:limit]]">
	<mml:mrow>
		<mml:munder>
			<mml:mi>lim</mml:mi>
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="mml:lowlimit|mml:condition/*"/>
			</mml:mrow>
		</mml:munder>
		<xsl:apply-templates mode="c2p" select="*[last()]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[mml:limit]/mml:lowlimit" priority="3">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="../mml:bvar/node()"/>
		<mml:mo>&#8594;</mml:mo>
		<xsl:apply-templates mode="c2p"/>
	</mml:mrow>
</xsl:template>

<!-- limitinf -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:limitinf]]">
	<mml:mrow>
		<mml:munder>
			<mml:mi>lim&#160;inf&#160;</mml:mi>
			<mml:mrow>
				<xsl:apply-templates mode="c2p" select="mml:lowlimit|mml:condition/*"/>
			</mml:mrow>
		</mml:munder>
		<xsl:apply-templates mode="c2p" select="*[last()]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[mml:limitinf]/mml:lowlimit" priority="3">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="../mml:bvar/node()"/>
		<mml:mo>&#8594;</mml:mo>
		<xsl:apply-templates mode="c2p"/>
	</mml:mrow>
</xsl:template>

<!-- limitsup -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:limitsup]]">
	<xsl:param name="p" select="0"/>
	<xsl:param name="first" select="1"/>
	<mml:mrow>
	<xsl:if test="$p &gt; 4"><mml:mo>(</mml:mo></xsl:if>
		<mml:munder>
			<mml:mi>lim&#160;sup&#160;</mml:mi>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:lowlimit|mml:condition/*"/></mml:mrow>
		</mml:munder>
		<xsl:apply-templates mode="c2p" select="*[last()]"/>
	<xsl:if test="$p &gt; 4"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[mml:limitsup]/mml:lowlimit" priority="3">
	<mml:mrow>
		<xsl:apply-templates mode="c2p" select="../mml:bvar/node()"/>
		<mml:mo>&#8594;</mml:mo>
		<xsl:apply-templates mode="c2p"/>
	</mml:mrow>
</xsl:template>

<!-- 4.4.7.4 tendsto -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo">
			<mml:mo>&#8594;</mml:mo>
		</xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto[@type='above']]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo">
			<mml:mo>&#8595;</mml:mo>
		</xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto[@type='below']]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo">
			<mml:mo>&#8593;</mml:mo>
		</xsl:with-param>
	</xsl:call-template>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:tendsto[@type='two-sided']]]">
	<xsl:param name="p"/>
	<xsl:call-template name="binary">
		<xsl:with-param name="this-p" select="1"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo">
			<mml:mo>&#8594;</mml:mo>
		</xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- right -->
<xsl:template mode="c2p" match="mml:right">
	<mml:mo>&#8594;</mml:mo>
</xsl:template>

<!-- left -->
<xsl:template mode="c2p" match="mml:left">
	<mml:mo>&#8592;</mml:mo>
</xsl:template>

<!-- up -->
<xsl:template mode="c2p" match="mml:up">
	<mml:mo>&#8593;</mml:mo>
</xsl:template>

<!-- down -->
<xsl:template mode="c2p" match="mml:down">
	<mml:mo>&#8595;</mml:mo>
</xsl:template>

<!-- leftright -->
<xsl:template mode="c2p" match="mml:leftright">
	<mml:mo>&#8596;</mml:mo>
</xsl:template>

<!-- updown -->
<xsl:template mode="c2p" match="mml:updown">
	<mml:mo>&#x02195;</mml:mo>
</xsl:template>

<!-- equivalenceclass -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:equivalenceclass] and count(*)=2]">
	<mml:mrow><mml:mo>[</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]" />
		<mml:mo>]</mml:mo>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:equivalenceclass] and count(*)=3]">
	<mml:mrow>
		<mml:msub>
			<mml:mrow><mml:mo>[</mml:mo>
				<xsl:apply-templates mode="c2p" select="*[2]" />
				<mml:mo>]</mml:mo>
			</mml:mrow>
			<xsl:apply-templates mode="c2p" select="*[3]" />
		</mml:msub>
	</mml:mrow>
</xsl:template>

<!-- trig functions -->
<xsl:template mode="c2p" match="mml:sin">
	<mml:mi>sin</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:cos">
	<mml:mi>cos</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:tan">
	<mml:mi>tan</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:cot">
	<mml:mi>cot</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:sec">
	<mml:mi>sec</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:csc">
	<mml:mi>csc</mml:mi>
</xsl:template>

<!-- hyperbolic trig functions -->

<xsl:template mode="c2p" match="mml:sinh">
	<mml:mi>sinh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:cosh">
	<mml:mi>cosh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:tanh">
	<mml:mi>tanh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:coth">
	<mml:mi>coth</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:sech">
	<mml:mi>sech</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:csch">
	<mml:mi>csch</mml:mi>
</xsl:template>

<!-- inverse trig functions -->

<xsl:template mode="c2p" match="mml:arcsin">
	<mml:mi>arcsin</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccos">
	<mml:mi>arccos</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arctan">
	<mml:mi>arctan</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccot">
	<mml:mi>arccot</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arcsec">
	<mml:mi>arcsec</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccsc">
	<mml:mi>arccsc</mml:mi>
</xsl:template>

<!-- inverse hyperbolic trig functions -->

<xsl:template mode="c2p" match="mml:arcsinh">
	<mml:mi>arcsinh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccosh">
	<mml:mi>arccosh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arctanh">
	<mml:mi>arctanh</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccoth">
	<mml:mi>arccoth</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arcsech">
	<mml:mi>arcsech</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:arccsch">
	<mml:mi>arccsch</mml:mi>
</xsl:template>

<!-- logarithm functions -->

<xsl:template mode="c2p" match="mml:ln">
	<mml:mi>ln</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:log">
	<mml:mi>log</mml:mi>
</xsl:template>

<!-- 4.4.8.2 exp -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exp]]">
	<mml:msup>
		<mml:mi>e</mml:mi>
		<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>
	</mml:msup>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:exp[@type='inline']]]">
	<mml:mrow>
		<mml:mi>exp</mml:mi>
		<mml:mo>(</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
		<mml:mo>)</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- chisquare -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:chisquare] and count(*)=3]">
	<mml:mrow>
		<mml:msubsup>
			<mml:mi>&#967;</mml:mi>
			<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>
			<mml:mn>2</mml:mn>
		</mml:msubsup>
		<mml:mrow><mml:mo>(</mml:mo>
		<xsl:apply-templates mode="c2p" select="*[3]"/>
		<mml:mo>)</mml:mo></mml:mrow>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:chisquare] and count(*)=2]">
	<mml:mrow>
		<mml:msubsup>
			<mml:mi>&#967;</mml:mi>
			<mml:mrow><xsl:apply-templates mode="c2p" select="*[2]"/></mml:mrow>
			<mml:mn>2</mml:mn>
		</mml:msubsup>
	</mml:mrow>
</xsl:template>

<!-- 4.4.9.1 mean -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:mean]]">
	<mml:mrow>
		<mml:mo>&#9001;</mml:mo>
			<xsl:for-each select="*[position()&gt;1]">
				<xsl:apply-templates mode="c2p" select="."/>
				<xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>
			</xsl:for-each>
		<mml:mo>&#9002;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.9.2 sdev -->
<xsl:template mode="c2p" match="mml:sdev">
	<mml:mi>sd</mml:mi>
</xsl:template>

<!-- 4.4.9.3 variance -->
<xsl:template mode="c2p" match="mml:variance">
	<mml:mi>var</mml:mi>
</xsl:template>

<!-- covariance -->
<xsl:template mode="c2p" match="mml:covariance">
	<mml:mi>cov</mml:mi>
</xsl:template>

<!-- correlation -->
<xsl:template mode="c2p" match="mml:correlation">
	<mml:mi>cor</mml:mi>
</xsl:template>

<!-- skewness -->
<xsl:template mode="c2p" match="mml:skew">
	<mml:mi>skew</mml:mi>
</xsl:template>

<!-- kurtosis -->
<xsl:template mode="c2p" match="mml:kurt">
	<mml:mi>kurt</mml:mi>
</xsl:template>

<!-- probability -->
<xsl:template mode="c2p" match="mml:prob">
	<mml:mi>&#x02119;</mml:mi>
</xsl:template>

<!-- lebesgue -->
<xsl:template mode="c2p" match="mml:lebesgue">
	<mml:mi>&#955;</mml:mi>
</xsl:template>

<!-- hypothesis -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:hypothesis]]">
	<mml:mrow>
		<mml:mi>H</mml:mi>
		<mo>:&#160;&#160;</mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:hypothesis[@type='null']]]">
	<mml:mrow>
		<mml:msub>
			<mml:mi>H</mml:mi>
			<mml:mn>0</mml:mn>
		</mml:msub>
		<mo>:&#160;&#160;</mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:hypothesis[@type='alt']]]">
	<mml:mrow>
		<mml:msub>
			<mml:mi>H</mml:mi>
			<mml:mn>1</mml:mn>
		</mml:msub>
		<mo>:&#160;&#160;</mo>
		<xsl:apply-templates mode="c2p" select="*[2]"/>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:hypothesis[@type='null']">
	<mml:mrow>
		<mml:msub>
			<mml:mi>H</mml:mi>
			<mml:mn>0</mml:mn>
		</mml:msub>
	</mml:mrow>
</xsl:template>

<xsl:template mode="c2p" match="mml:hypothesis[@type='alt']">
	<mml:mrow>
		<mml:msub>
			<mml:mi>H</mml:mi>
			<mml:mn>1</mml:mn>
		</mml:msub>
	</mml:mrow>
</xsl:template>

<!-- Gamma -->
<xsl:template mode="c2p" match="mml:Gamma">
	<mml:mi>&#915;</mml:mi>
</xsl:template>

<!-- Beta -->
<xsl:template mode="c2p" match="mml:Beta">
	<mml:mi>&#914;</mml:mi>
</xsl:template>

<!-- zeta -->
<xsl:template mode="c2p" match="mml:zeta">
	<mml:mi>&#950;</mml:mi>
</xsl:template>

<!-- powerset -->
<xsl:template mode="c2p" match="mml:powerset">
	<mml:mi class='collection'>P</mml:mi>
</xsl:template>

<!-- expected value -->
<xsl:template mode="c2p" match="mml:expect">
	<mml:mo>&#x1D53C;</mml:mo>
</xsl:template>

<!-- area -->
<xsl:template mode="c2p" match="mml:area">
	<mml:mi>area</mml:mi>
</xsl:template>

<!-- 4.4.9.4 median -->
<xsl:template mode="c2p" match="mml:median">
	<mml:mi>median</mml:mi>
</xsl:template>

<!-- 4.4.9.5 mode -->
<xsl:template mode="c2p" match="mml:mode">
	<mml:mi>mode</mml:mi>
</xsl:template>

<!-- closure -->
<xsl:template mode="c2p" match="mml:closure">
	<mml:mi>cl</mml:mi>
</xsl:template>

<!-- 4.4.9.5 moment -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:moment]]">
	<mml:mrow>
		<mml:mo>&#9001;</mml:mo>
		<mml:msup>
			<xsl:apply-templates mode="c2p" select="*[last()]"/>
			<mml:mrow><xsl:apply-templates mode="c2p" select="mml:degree/node()"/></mml:mrow>
		</mml:msup>
		<mml:mo>&#9002;</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.9.5 momentabout -->
<xsl:template mode="c2p" match="mml:momentabout"/>

<!-- 4.4.10.1 vector  -->
<xsl:template mode="c2p" match="mml:vector">
	<mml:mrow>
		<mml:mo>(</mml:mo>
		<xsl:for-each select="*">
			<xsl:apply-templates mode="c2p" select="."/>
			<xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>
		</xsl:for-each>
		<mml:mo>)</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.10.2 matrix  -->
<xsl:template mode="c2p" match="mml:matrix">
	<mml:mrow>
		<mml:mo>(</mml:mo>
		<mml:mtable>
			<xsl:apply-templates mode="c2p"/>
		</mml:mtable>
		<mml:mo>)</mml:mo>
	</mml:mrow>
</xsl:template>

<!-- 4.4.10.3 matrixrow  -->
<xsl:template mode="c2p" match="mml:matrixrow">
	<mml:mtr>
		<xsl:for-each select="*">
			<mml:mtd><xsl:apply-templates mode="c2p" select="."/></mml:mtd>
		</xsl:for-each>
	</mml:mtr>
</xsl:template>

<!-- 4.4.10.4 determinant  -->
<xsl:template mode="c2p" match="mml:determinant">
	<mml:mi>det</mml:mi>
</xsl:template>

<!-- 4.4.10.5 transpose -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:transpose]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="7"/>
		</xsl:apply-templates>
		<mml:mi>T</mml:mi>
	</mml:msup>
</xsl:template>

<!-- complement -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:complement]]">
	<mml:msup>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="5"/>
		</xsl:apply-templates>
		<mml:mi>c</mml:mi>
	</mml:msup>
</xsl:template>

<!-- 4.4.10.5 selector -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:selector]]">
	<mml:msub>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="7"/>
		</xsl:apply-templates>
		<mml:mrow>
			<xsl:for-each select="*[position()>2 and not(self::mml:given)]">
				<xsl:apply-templates mode="c2p" select="."/>
				<xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>
			</xsl:for-each>
			<xsl:for-each select="*[position()>2 and self::mml:given]">
				<xsl:apply-templates mode="c2p" select="."/>
			</xsl:for-each>
		</mml:mrow>
	</mml:msub>
</xsl:template>

<!-- 4.4.10.6 vectorproduct see cartesianproduct -->

<!-- 4.4.10.7 scalarproduct -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:scalarproduct or self::mml:outerproduct]]">
	<xsl:param name="p" select="0"/>
	<xsl:call-template name="infix">
		<xsl:with-param name="this-p" select="5"/>
		<xsl:with-param name="p" select="$p"/>
		<xsl:with-param name="mo"><mml:mo>&#183;</mml:mo></xsl:with-param>
	</xsl:call-template>
</xsl:template>

<!-- innerproduct -->
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:innerproduct]]">
	<mml:mrow>
		<mml:mo>&#9001;</mml:mo>
		<xsl:for-each select="*[position()&gt;1]">
			<xsl:apply-templates mode="c2p" select="."/>
			<xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>
		</xsl:for-each>
		<mml:mo>&#9002;</mml:mo>
</mml:mrow>
</xsl:template>

<!-- 4.4.10.8 outerproduct-->

<!-- 4.4.11.2 semantics -->
<xsl:template mode="c2p" match="mml:semantics">
	<xsl:apply-templates mode="c2p" select="*[1]"/></xsl:template>
	<xsl:template mode="c2p" match="mml:semantics[mml:annotation-xml/@encoding='MathML-Presentation']">
	<xsl:apply-templates mode="c2p" select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/>
</xsl:template>

<!-- 4.4.12.1 integers -->
<xsl:template mode="c2p" match="mml:integers">
	<mml:mi>&#x2124;</mml:mi>
</xsl:template>

<!-- 4.4.12.2 reals -->
<xsl:template mode="c2p" match="mml:reals">
	<mml:mi>&#x211D;</mml:mi>
</xsl:template>

<!-- 4.4.12.3 rationals -->
<xsl:template mode="c2p" match="mml:rationals">
	<mml:mi>&#x211A;</mml:mi>
</xsl:template>

<!-- positiverationals -->
<xsl:template mode="c2p" match="mml:positiverationals">
	<mml:mrow>
		<mml:msub>
			<mml:mi>&#x211A;</mml:mi>
			<mml:mn>+</mml:mn>
		</mml:msub>
	</mml:mrow>
</xsl:template>

<!-- 4.4.12.4 naturalnumbers -->
<xsl:template mode="c2p" match="mml:naturalnumbers">
	<mml:mi>&#x2115;</mml:mi>
</xsl:template>

<!-- positiveintegers -->
<xsl:template mode="c2p" match="mml:positiveintegers">
	<mml:mrow>
		<mml:msub>
			<mml:mi>&#x2115;</mml:mi>
			<mml:mn>+</mml:mn>
		</mml:msub>
	</mml:mrow>
</xsl:template>

<!-- algebraicnumbers -->
<xsl:template mode="c2p" match="mml:algebraicnumbers">
	<mml:mi>&#x1D538;</mml:mi>
</xsl:template>

<!-- 4.4.12.5 complexes -->
<xsl:template mode="c2p" match="mml:complexes">
	<mml:mi>&#x2102;</mml:mi>
</xsl:template>

<!-- 4.4.12.6 primes -->
<xsl:template mode="c2p" match="mml:primes">
	<mml:mi mathvariant="double-struck">P</mml:mi>
</xsl:template>

<!-- 4.4.12.7 exponentiale -->
<xsl:template mode="c2p" match="mml:exponentiale">
	<mml:mi>e</mml:mi>
</xsl:template>

<!-- 4.4.12.8 imaginaryi -->
<xsl:template mode="c2p" match="mml:imaginaryi">
	<mml:mi>i</mml:mi>
</xsl:template>

<!-- 4.4.12.9 notanumber -->
<xsl:template mode="c2p" match="mml:notanumber">
	<mml:mi>undefined</mml:mi>
</xsl:template>

<!-- 4.4.12.10 true -->
<xsl:template mode="c2p" match="mml:true">
	<mml:mi>true</mml:mi>
</xsl:template>

<!-- 4.4.12.11 false -->
<xsl:template mode="c2p" match="mml:false">
	<mml:mi>false</mml:mi>
</xsl:template>

<!-- 4.4.12.12 emptyset -->
<xsl:template mode="c2p" match="mml:emptyset">
	<mml:mi mathvariant="normal">&#8709;<!-- emptyset --></mml:mi>
</xsl:template>

<!-- etc -->
<xsl:template mode="c2p" match="mml:etc">
	<mml:mi>...</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:etc[@type='middle']">
	<mml:mi>&#8201;&#183;&#183;&#183;&#8201;</mml:mi>
</xsl:template>

<!-- 4.4.12.13 pi -->
<xsl:template mode="c2p" match="mml:pi">
	<mml:mi mathvariant="normal">&#960;</mml:mi>
</xsl:template>

<!-- 4.4.12.14 eulergamma -->
<xsl:template mode="c2p" match="mml:eulergamma">
	<mml:mi>&#947;</mml:mi>
</xsl:template>

<!-- 4.4.12.15 infinity -->
<xsl:template mode="c2p" match="mml:infinity">
	<mml:mi mathvariant="normal">&#8734;</mml:mi>
</xsl:template>

<!-- ace -->
<xsl:template mode="c2p" match="mml:ace">
	<mml:mn>1</mml:mn>
</xsl:template>

<!-- jack -->
<xsl:template mode="c2p" match="mml:jack">
	<mml:mn>j</mml:mn>
</xsl:template>

<!-- queen -->
<xsl:template mode="c2p" match="mml:queen">
	<mml:mn>q</mml:mn>
</xsl:template>

<!-- king -->
<xsl:template mode="c2p" match="mml:king">
	<mml:mn>k</mml:mn>
</xsl:template>

<!-- spades -->
<xsl:template mode="c2p" match="mml:spades">
	<mml:mi>&#x02660;</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:spades]]">
	<xsl:apply-templates mode="c2p" select="*[2]" />
	<mml:mi>&#x02660;</mml:mi>
</xsl:template>

<!-- hearts -->
<xsl:template mode="c2p" match="mml:hearts">
	<mml:mi mathcolor="red">&#x02665;</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:hearts]]">
	<xsl:apply-templates mode="c2p" select="*[2]" />
	<mml:mi mathcolor="red">&#x02665;</mml:mi>
</xsl:template>

<!-- diamonds -->
<xsl:template mode="c2p" match="mml:diamonds">
	<mml:mi mathcolor="red">&#x02666;</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:diamonds]]">
	<xsl:apply-templates mode="c2p" select="*[2]" />
	<mml:mi mathcolor="red">&#x02666;</mml:mi>
</xsl:template>

<!-- clubs -->
<xsl:template mode="c2p" match="mml:clubs">
	<mml:mi>&#x02663;</mml:mi>
</xsl:template>

<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:clubs]]">
	<xsl:apply-templates mode="c2p" select="*[2]" />
	<mml:mi>&#x02663;</mml:mi>
</xsl:template>

<!-- General Templates -->

<!-- Infix -->
<xsl:template name="infix" >
	<xsl:param name="mo"/>
	<xsl:param name="p" select="0"/>
	<xsl:param name="this-p" select="0"/>
	<mml:mrow>
		<xsl:if test="$this-p &lt;= $p"><mml:mo>(</mml:mo></xsl:if>
		<xsl:for-each select="*[position() &gt; 1]">
			<xsl:if test="position() &gt; 1">
				<xsl:copy-of select="$mo"/>
			</xsl:if>
			<xsl:apply-templates mode="c2p" select=".">
				<xsl:with-param name="p" select="$this-p"/>
			</xsl:apply-templates>
		</xsl:for-each>
		<xsl:if test="$this-p &lt;= $p"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<!-- binary -->
<xsl:template name="binary" >
	<xsl:param name="mo"/>
	<xsl:param name="p" select="0"/>
	<xsl:param name="this-p" select="0"/>
	<mml:mrow>
		<xsl:if test="$this-p &lt;= $p"><mml:mo>(</mml:mo></xsl:if>
		<xsl:apply-templates mode="c2p" select="*[2]">
			<xsl:with-param name="p" select="$this-p"/>
		</xsl:apply-templates>
		<xsl:copy-of select="$mo"/>
		<xsl:apply-templates mode="c2p" select="*[3]">
			<xsl:with-param name="p" select="$this-p"/>
	 	</xsl:apply-templates>
		<xsl:if test="$this-p &lt;= $p"><mml:mo>)</mml:mo></xsl:if>
	</mml:mrow>
</xsl:template>

<!-- set -->
<xsl:template name="set" >
	<xsl:param name="o" select="'{'"/>
	<xsl:param name="c" select="'}'"/>
	<mml:mrow>
		<mml:mo><xsl:value-of select="$o"/></mml:mo>
		<xsl:choose>
			<xsl:when test="mml:condition">
				<mml:mrow><xsl:apply-templates mode="c2p" select="mml:bvar/*[not(self::bvar or self::condition)]"/></mml:mrow>
				<mml:mo>:</mml:mo>
				<mml:mrow><xsl:apply-templates mode="c2p" select="mml:condition/node()"/></mml:mrow>
			</xsl:when>
			<xsl:otherwise>
				<xsl:for-each select="*[not(position()=1 and parent::mml:apply)]">
					<xsl:apply-templates mode="c2p" select="."/>
					<xsl:if test="position() !=last()"><mml:mo>,</mml:mo></xsl:if>
				</xsl:for-each>
			</xsl:otherwise>
		</xsl:choose>
		<mml:mo><xsl:value-of select="$c"/></mml:mo>
	</mml:mrow>
</xsl:template>

</xsl:stylesheet>

