--- mathmlc2p.xsl	2005-07-08 17:06:49.000000000 -0500
+++ mathmlc2p-3.xsl	2005-07-08 17:06:17.000000000 -0500
@@ -63,23 +63,23 @@
       <mrow> <!-- mrow to be sure that the base is actually the element put as sub in case the number is a composed one-->
       <xsl:choose>  
       <xsl:when test="./@type='complex-cartesian' or ./@type='complex'">
-        <mn><xsl:value-of select="text()[position()=1]"/></mn>
+        <mn><xsl:value-of select="text()[1]"/></mn>
 	<xsl:choose>
-	<xsl:when test="contains(text()[position()=2],'-')">
-	  <mo>-</mo><mn><xsl:value-of select="substring-after(text()[position()=2],'-')"/></mn> 
+	<xsl:when test="contains(text()[2],'-')">
+	  <mo>-</mo><mn><xsl:value-of select="substring-after(text()[2],'-')"/></mn> 
 	  <!--substring-after does not seem to work well in XT : if imaginary part is expressed with at least one space char before the minus sign, then it does not work (we end up with two minus sign since the one in the text is kept)-->
 	</xsl:when>
 	<xsl:otherwise>
-	  <mo>+</mo><mn><xsl:value-of select="text()[position()=2]"/></mn>
+	  <mo>+</mo><mn><xsl:value-of select="text()[2]"/></mn>
 	</xsl:otherwise>
 	</xsl:choose>
 	<mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi>  <!-- perhaps ii-->
       </xsl:when>
       <xsl:when test="./@type='complex-polar'">
-        Polar<mfenced><mn><xsl:value-of select="text()[position()=1]"/></mn><mn><xsl:value-of select="text()[position()=2]"/></mn></mfenced>
+        Polar<mfenced><mn><xsl:value-of select="text()[1]"/></mn><mn><xsl:value-of select="text()[2]"/></mn></mfenced>
       </xsl:when>
       <xsl:when test="./@type='rational'">
-        <mn><xsl:value-of select="text()[position()=1]"/></mn><mo>/</mo><mn><xsl:value-of select="text()[position()=2]"/></mn>
+        <mn><xsl:value-of select="text()[1]"/></mn><mo>/</mo><mn><xsl:value-of select="text()[2]"/></mn>
       </xsl:when>
       <xsl:otherwise>
         <mn><xsl:value-of select="."/></mn>
@@ -93,22 +93,22 @@
     <xsl:choose>  
     <xsl:when test="./@type='complex-cartesian' or ./@type='complex'">
       <mrow>
-        <mn><xsl:value-of select="text()[position()=1]"/></mn>
+        <mn><xsl:value-of select="text()[1]"/></mn>
         <xsl:choose>
-        <xsl:when test="contains(text()[position()=2],'-')">
-  	  <mo>-</mo><mn><xsl:value-of select="substring(text()[position()=2],2)"/></mn><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
+        <xsl:when test="contains(text()[2],'-')">
+  	  <mo>-</mo><mn><xsl:value-of select="substring(text()[2],2)"/></mn><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
         </xsl:when>
         <xsl:otherwise>
-	  <mo>+</mo><mn><xsl:value-of select="text()[position()=2]"/></mn><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
+	  <mo>+</mo><mn><xsl:value-of select="text()[2]"/></mn><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
         </xsl:otherwise>
         </xsl:choose>
       </mrow>
     </xsl:when>
     <xsl:when test="./@type='complex-polar'">
-      <mrow><mi>Polar</mi><mfenced><mn><xsl:value-of select="text()[position()=1]"/></mn><mn><xsl:value-of select="text()[position()=2]"/></mn></mfenced></mrow>
+      <mrow><mi>Polar</mi><mfenced><mn><xsl:value-of select="text()[1]"/></mn><mn><xsl:value-of select="text()[2]"/></mn></mfenced></mrow>
     </xsl:when> 
     <xsl:when test="./@type='rational'">
-      <mrow><mn><xsl:value-of select="text()[position()=1]"/></mn><mo>/</mo><mn><xsl:value-of select="text()[position()=2]"/></mn></mrow>
+      <mrow><mn><xsl:value-of select="text()[1]"/></mn><mo>/</mo><mn><xsl:value-of select="text()[2]"/></mn></mrow>
     </xsl:when>
     <xsl:otherwise>
       <mn><xsl:value-of select="."/></mn>
@@ -126,16 +126,16 @@
     <xsl:choose>
     <xsl:when test="count(*)>0">  <!--if identifier is composed of real+imag parts-->
       <mrow>
-	<mi><xsl:value-of select="text()[position()=1]"/></mi>
+	<mi><xsl:value-of select="text()[1]"/></mi>
         <xsl:choose> <!-- im part is negative-->
-        <xsl:when test="contains(text()[preceding-sibling::*[position()=1 and self::m:sep]],'-')">
+        <xsl:when test="contains(text()[preceding-sibling::*[1][self::m:sep]],'-')">
           <mo>-</mo><mi>
-	  <xsl:value-of select="substring-after(text()[preceding-sibling::*[position()=1 and self::m:sep]],'-')"/>
+	  <xsl:value-of select="substring-after(text()[preceding-sibling::*[1][self::m:sep]],'-')"/>
           </mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
         </xsl:when>
         <xsl:otherwise> <!-- im part is not negative-->
           <mo>+</mo><mi>
-          <xsl:value-of select="text()[preceding-sibling::*[position()=1 and self::m:sep]]"/>
+          <xsl:value-of select="text()[preceding-sibling::*[1][self::m:sep]]"/>
           </mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo><mi><xsl:text disable-output-escaping="yes"><![CDATA[&ImaginaryI;]]></xsl:text></mi><!-- perhaps ii-->
         </xsl:otherwise>
         </xsl:choose>
@@ -201,9 +201,9 @@
 </xsl:template>
 
 <!-- externally defined symbols-->
-<xsl:template match="m:apply[*[position()=1 and self::m:csymbol]]">
+<xsl:template match="m:apply[*[1][self::m:csymbol]]">
   <mrow>
-  <xsl:apply-templates select="m:csymbol[position()=1]"/>
+  <xsl:apply-templates select="m:csymbol[1]"/>
   <mfenced>
   <xsl:for-each select="*[position()!=1]">
     <xsl:apply-templates select="."/>
@@ -232,11 +232,11 @@
 <!-- #################### 4.4.2 #################### -->
 
 <!-- apply/apply -->
-<xsl:template match="m:apply[*[position()=1 and self::m:apply]]">  <!-- when the function itself is defined by other functions: (F+G)(x) -->
+<xsl:template match="m:apply[*[1][self::m:apply]]">  <!-- when the function itself is defined by other functions: (F+G)(x) -->
   <xsl:choose>
   <xsl:when test="count(*)>=2">
     <mrow>
-      <mfenced separators=""><xsl:apply-templates select="*[position()=1]"/></mfenced>
+      <mfenced separators=""><xsl:apply-templates select="*[1]"/></mfenced>
       <mfenced><xsl:apply-templates select="*[position()!=1]"/></mfenced>
     </mrow>
   </xsl:when>
@@ -247,10 +247,10 @@
 </xsl:template>
 
 <!-- force function or operator MathML 1.0 deprecated-->
-<xsl:template match="m:apply[*[position()=1 and self::m:fn]]">
+<xsl:template match="m:apply[*[1][self::m:fn]]">
 <mrow>
   <xsl:choose>
-    <xsl:when test="m:fn/*[position()=1 and self::m:apply]"> <!-- fn definition is complex, surround with brackets, but only one child-->
+    <xsl:when test="m:fn/*[1][self::m:apply]"> <!-- fn definition is complex, surround with brackets, but only one child-->
       <mfenced separators=""><mrow><xsl:apply-templates select="m:fn/*"/></mrow></mfenced>
     </xsl:when>
     <xsl:otherwise>
@@ -267,9 +267,9 @@
 </xsl:template>
 
 <!--first ci is supposed to be a function-->
-<xsl:template match="m:apply[*[position()=1 and self::m:ci]]">
+<xsl:template match="m:apply[*[1][self::m:ci]]">
 <mrow>
-  <xsl:apply-templates select="m:ci[position()=1]"/>
+  <xsl:apply-templates select="m:ci[1]"/>
   <xsl:if test="count(*)>1">  <!-- if no operands, don't put empty parentheses-->
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
     <mfenced>
@@ -279,7 +279,7 @@
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:mo]]">
+<xsl:template match="m:apply[*[1][self::m:mo]]">
   <!--operator assumed to be infix-->
   <xsl:choose>
   <xsl:when test="count(*)>=3">
@@ -291,7 +291,7 @@
     </mrow>
   </xsl:when>
   <xsl:when test="count(*)=2">
-    <mrow><xsl:copy-of select="m:mo[position()=1]/*"/><xsl:apply-templates select="*[position()=2]"/></mrow>
+    <mrow><xsl:copy-of select="m:mo[1]/*"/><xsl:apply-templates select="*[2]"/></mrow>
   </xsl:when>
   </xsl:choose>
 </xsl:template>
@@ -304,32 +304,32 @@
       <xsl:choose>
         <xsl:when test="@closure and @closure='open-closed'">
 	  <mfenced open="(" close="]">
-	    <xsl:apply-templates select="*[position()=1]"/>
-	    <xsl:apply-templates select="*[position()=2]"/>
+	    <xsl:apply-templates select="*[1]"/>
+	    <xsl:apply-templates select="*[2]"/>
 	  </mfenced>
 	</xsl:when>
         <xsl:when test="@closure and @closure='closed-open'">
 	  <mfenced open="[" close=")">
-	    <xsl:apply-templates select="*[position()=1]"/>
-	    <xsl:apply-templates select="*[position()=2]"/>
+	    <xsl:apply-templates select="*[1]"/>
+	    <xsl:apply-templates select="*[2]"/>
 	  </mfenced>
 	</xsl:when>
         <xsl:when test="@closure and @closure='closed'">
 	  <mfenced open="[" close="]">
-	    <xsl:apply-templates select="*[position()=1]"/>
-	    <xsl:apply-templates select="*[position()=2]"/>
+	    <xsl:apply-templates select="*[1]"/>
+	    <xsl:apply-templates select="*[2]"/>
 	  </mfenced>
 	</xsl:when>
         <xsl:when test="@closure and @closure='open'">
 	  <mfenced open="(" close=")">
-	    <xsl:apply-templates select="*[position()=1]"/>
-	    <xsl:apply-templates select="*[position()=2]"/>
+	    <xsl:apply-templates select="*[1]"/>
+	    <xsl:apply-templates select="*[2]"/>
 	  </mfenced>
 	</xsl:when>
 	<xsl:otherwise>  <!--default is close-->
 	  <mfenced open="[" close="]">
-	    <xsl:apply-templates select="*[position()=1]"/>
-	    <xsl:apply-templates select="*[position()=2]"/>
+	    <xsl:apply-templates select="*[1]"/>
+	    <xsl:apply-templates select="*[2]"/>
 	  </mfenced>
 	</xsl:otherwise>
       </xsl:choose>
@@ -341,10 +341,10 @@
 </xsl:template>
 
 <!-- inverse -->
-<xsl:template match="m:apply[*[position()=1 and self::m:apply]/m:inverse]">
+<xsl:template match="m:apply[*[1][self::m:apply]/m:inverse]">
   <mrow>
   <msup> <!-- elementary classical functions have two templates: apply[func] for standard case, func[position()!=1] for inverse and compose case-->
-    <mrow><xsl:apply-templates select="m:apply[position()=1]/*[position()=2]"/></mrow> <!-- function to be inversed-->
+    <mrow><xsl:apply-templates select="m:apply[1]/*[2]"/></mrow> <!-- function to be inversed-->
     <mfenced><mn>-1</mn></mfenced>
   </msup>
   <xsl:if test="count(*)>=2"> <!-- deal with operands, if any-->
@@ -356,9 +356,9 @@
   </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:inverse]]">
+<xsl:template match="m:apply[*[1][self::m:inverse]]">
   <msup> <!-- elementary classical functions have two templates: apply[func] for standard case, func[position()!=1] for inverse and compose case-->
-    <mrow><xsl:apply-templates select="*[position()=2]"/></mrow> <!-- function to be inversed-->
+    <mrow><xsl:apply-templates select="*[2]"/></mrow> <!-- function to be inversed-->
     <mfenced><mn>-1</mn></mfenced>
   </msup>
 </xsl:template>
@@ -388,24 +388,24 @@
 </xsl:template>
 
 <!-- composition -->
-<xsl:template match="m:apply[*[position()=1 and self::m:apply]/m:compose]">
+<xsl:template match="m:apply[*[1][self::m:apply]/m:compose]">
   <mrow> <!-- elementary classical functions have two templates: apply[func] for standard case, func[position()!=1] for inverse and compose case-->
     <xsl:choose>
     <xsl:when test="count(*)>=2"> <!-- if there are operands, mfence functions-->
       <mfenced>
         <mrow>
-          <xsl:for-each select="m:apply[position()=1]/*[position()!=1 and position()!=last()]">
+          <xsl:for-each select="m:apply[1]/*[position()!=1 and position()!=last()]">
             <xsl:apply-templates select="."/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&SmallCircle;]]></xsl:text></mo> <!-- compose functions --><!-- does not work, perhaps compfn, UNICODE 02218-->
           </xsl:for-each>
-          <xsl:apply-templates select="m:apply[position()=1]/*[position()=last()]"/>
+          <xsl:apply-templates select="m:apply[1]/*[position()=last()]"/>
         </mrow>
       </mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:for-each select="m:apply[position()=1]/*[position()!=1 and position()!=last()]">
+      <xsl:for-each select="m:apply[1]/*[position()!=1 and position()!=last()]">
         <xsl:apply-templates select="."/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&SmallCircle;]]></xsl:text></mo> <!-- compose functions --><!-- does not work, perhaps compfn, UNICODE 02218-->
       </xsl:for-each>
-      <xsl:apply-templates select="m:apply[position()=1]/*[position()=last()]"/>
+      <xsl:apply-templates select="m:apply[1]/*[position()=last()]"/>
     </xsl:otherwise>
     </xsl:choose>
     <xsl:if test="count(*)>=2"> <!-- deal with operands, if any-->
@@ -420,7 +420,7 @@
   </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:compose]]">
+<xsl:template match="m:apply[*[1][self::m:compose]]">
    <!-- elementary classical functions have two templates: apply[func] for standard case, func[position()!=1] for inverse and compose case-->
   <xsl:for-each select="*[position()!=1 and position()!=last()]">
     <xsl:apply-templates select="."/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&SmallCircle;]]></xsl:text></mo> <!-- compose functions --><!-- does not work, perhaps compfn, UNICODE 02218-->
@@ -434,21 +434,21 @@
 </xsl:template>
 
 <!-- domain -->
-<xsl:template match="m:apply[*[position()=1 and self::m:domain]]">
+<xsl:template match="m:apply[*[1][self::m:domain]]">
   <mrow>
     <mi>domain</mi><mfenced open="(" close=")"><xsl:apply-templates select="*[position()!=1]"/></mfenced>
   </mrow>
 </xsl:template>
 
 <!-- codomain -->
-<xsl:template match="m:apply[*[position()=1 and self::m:codomain]]">
+<xsl:template match="m:apply[*[1][self::m:codomain]]">
   <mrow>
     <mi>codomain</mi><mfenced open="(" close=")"><xsl:apply-templates select="*[position()!=1]"/></mfenced>
   </mrow>
 </xsl:template>
 
 <!-- image -->
-<xsl:template match="m:apply[*[position()=1 and self::m:image]]">
+<xsl:template match="m:apply[*[1][self::m:image]]">
   <mrow>
     <mi>image</mi><mfenced open="(" close=")"><xsl:apply-templates select="*[position()!=1]"/></mfenced>
   </mrow>
@@ -463,7 +463,7 @@
       <mtable>
 	<xsl:for-each select="m:piece">
 	<mtr><mtd>
-	  <xsl:apply-templates select="*[position()=1]"/><mspace/>if<mspace/><xsl:apply-templates select="*[position()=2]"/>
+	  <xsl:apply-templates select="*[1]"/><mspace/>if<mspace/><xsl:apply-templates select="*[2]"/>
 	</mtd></mtr>
 	</xsl:for-each>
         <xsl:if test="m:otherwise">
@@ -477,25 +477,25 @@
 <!-- #################### 4.4.3 #################### -->
 
 <!-- quotient -->
-<xsl:template match="m:apply[*[position()=1 and self::m:quotient]]">
+<xsl:template match="m:apply[*[1][self::m:quotient]]">
   <mrow>  <!-- the third notation uses UNICODE chars x0230A and x0230B -->
     <mo>integer part of</mo>
     <mrow>
       <xsl:choose> <!-- surround with brackets if operands are composed-->
-      <xsl:when test="*[position()=2] and self::m:apply">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+      <xsl:when test="*[2] and self::m:apply">
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
       </xsl:otherwise>
       </xsl:choose>
       <mo>/</mo>
       <xsl:choose>
-      <xsl:when test="*[position()=3] and self::m:apply">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=3]"/></mfenced>
+      <xsl:when test="*[3] and self::m:apply">
+        <mfenced separators=""><xsl:apply-templates select="*[3]"/></mfenced>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[3]"/>
       </xsl:otherwise>
       </xsl:choose>
     </mrow>
@@ -503,14 +503,14 @@
 </xsl:template>
 
 <!-- factorial -->
-<xsl:template match="m:apply[*[position()=1 and self::m:factorial]]">
+<xsl:template match="m:apply[*[1][self::m:factorial]]">
   <mrow>
     <xsl:choose> <!-- surround with brackets if operand is composed-->
-    <xsl:when test="*[position()=2 and self::m:apply]">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <xsl:when test="*[2][self::m:apply]">
+      <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
     <mo>!</mo>
@@ -518,19 +518,19 @@
 </xsl:template>
 
 <!-- divide -->
-<xsl:template match="m:apply[*[position()=1 and self::m:divide]]">
+<xsl:template match="m:apply[*[1][self::m:divide]]">
   <mrow>
     <xsl:choose>
     <xsl:when test="contains(@other,'scriptstyle')">
       <mfrac bevelled="true">
-        <xsl:apply-templates select="*[position()=2]"/>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[2]"/>
+        <xsl:apply-templates select="*[3]"/>
       </mfrac>
     </xsl:when>
     <xsl:otherwise>
       <mfrac>
-        <xsl:apply-templates select="*[position()=2]"/>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[2]"/>
+        <xsl:apply-templates select="*[3]"/>
       </mfrac>
     </xsl:otherwise>
     </xsl:choose>
@@ -538,7 +538,7 @@
 </xsl:template>
 
 <!-- min -->
-<xsl:template match="m:apply[*[position()=1 and self::m:min]]">
+<xsl:template match="m:apply[*[1][self::m:min]]">
   <mrow>
     <xsl:choose>
     <xsl:when test="m:bvar"> <!-- if there are bvars-->
@@ -572,7 +572,7 @@
 </xsl:template>
 
 <!-- max -->
-<xsl:template match="m:apply[*[position()=1 and self::m:max]]">
+<xsl:template match="m:apply[*[1][self::m:max]]">
   <mrow>
     <xsl:choose>
     <xsl:when test="m:bvar"> <!-- if there are bvars-->
@@ -606,25 +606,25 @@
 </xsl:template>
 
 <!-- substraction(minus); unary or binary operator-->
-<xsl:template match="m:apply[*[position()=1 and self::m:minus]]">
+<xsl:template match="m:apply[*[1][self::m:minus]]">
   <mrow>
   <xsl:choose> <!-- binary -->
   <xsl:when test="count(*)=3">
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo>-</mo>
     <xsl:choose>
-      <xsl:when test="(*[position()=3 and (self::m:ci or self::m:cn)] and contains(*[position()=3]/text(),'-')) or *[position()=3 and self::m:apply]">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=3]"/></mfenced> <!-- surround negative or complex things with brackets -->
+      <xsl:when test="(*[3][self::m:ci or self::m:cn] and contains(*[3]/text(),'-')) or *[3][self::m:apply]">
+        <mfenced separators=""><xsl:apply-templates select="*[3]"/></mfenced> <!-- surround negative or complex things with brackets -->
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[3]"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:when>
   <xsl:otherwise> <!-- unary -->
     <mo>-</mo>
     <xsl:choose>
-    <xsl:when test="(*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-')) or *[position()=2 and self::m:apply]">
+    <xsl:when test="(*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-')) or *[2][self::m:apply]">
       <mfenced separators=""><!-- surround negative or complex things with brackets -->
       <xsl:apply-templates select="*[position()=last()]"/>
       </mfenced>
@@ -639,16 +639,16 @@
 </xsl:template>
 
 <!-- addition -->
-<xsl:template match="m:apply[*[position()=1 and self::m:plus]]">
+<xsl:template match="m:apply[*[1][self::m:plus]]">
   <xsl:choose>
   <xsl:when test="count(*)>=3">
     <mrow>
       <xsl:choose>
-        <xsl:when test="(*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-')) or (*[position()=2 and self::m:apply and child::m:minus])">
-          <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced> <!-- surround negative things with brackets -->
+        <xsl:when test="(*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-')) or (*[2][self::m:apply and child::m:minus])">
+          <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced> <!-- surround negative things with brackets -->
         </xsl:when>
         <xsl:otherwise>
-          <xsl:apply-templates select="*[position()=2]"/>
+          <xsl:apply-templates select="*[2]"/>
         </xsl:otherwise>
       </xsl:choose>
       <xsl:for-each select="*[position()!=1 and position()!=2]">
@@ -665,7 +665,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo>+</mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo>+</mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -675,45 +675,45 @@
 </xsl:template>
 
 <!-- power -->
-<xsl:template match="m:apply[*[position()=1 and self::m:power]]">
+<xsl:template match="m:apply[*[1][self::m:power]]">
   <msup>
     <xsl:choose>
-    <xsl:when test="*[position()=2 and self::m:apply]">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <xsl:when test="*[2][self::m:apply]">
+      <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </msup>
 </xsl:template>
 
 <!-- remainder -->
-<xsl:template match="m:apply[*[position()=1 and self::m:rem]]">
+<xsl:template match="m:apply[*[1][self::m:rem]]">
   <mrow>
     <xsl:choose> <!-- surround with brackets if operands are composed-->
-    <xsl:when test="*[position()=2 and self::m:apply]">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <xsl:when test="*[2][self::m:apply]">
+      <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
     <mo>mod</mo>
     <xsl:choose>
-    <xsl:when test="*[position()=3 and self::m:apply]">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=3]"/></mfenced>
+    <xsl:when test="*[3][self::m:apply]">
+      <mfenced separators=""><xsl:apply-templates select="*[3]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=3]"/>
+      <xsl:apply-templates select="*[3]"/>
     </xsl:otherwise>
     </xsl:choose>
   </mrow>
 </xsl:template>
 
 <!-- multiplication -->
-<xsl:template match="m:apply[*[position()=1 and self::m:times]]">
+<xsl:template match="m:apply[*[1][self::m:times]]">
 <xsl:choose>
 <xsl:when test="count(*)>=3">
   <mrow>
@@ -756,16 +756,16 @@
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleTimes;]]></xsl:text></mo>
     <xsl:choose>
       <xsl:when test="m:plus">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
       <xsl:when test="m:minus">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
-      <xsl:when test="*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-')">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+      <xsl:when test="*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-')">
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
       </xsl:otherwise>
     </xsl:choose>
   </mrow>
@@ -777,18 +777,18 @@
 </xsl:template>
 
 <!-- root -->
-<xsl:template match="m:apply[*[position()=1 and self::m:root]]">
+<xsl:template match="m:apply[*[1][self::m:root]]">
   <xsl:choose>
   <xsl:when test="m:degree">
     <xsl:choose>
     <xsl:when test="m:degree/m:cn/text()='2'"> <!--if degree=2 display a standard square root-->
       <msqrt>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[3]"/>
       </msqrt>
     </xsl:when>
     <xsl:otherwise>
       <mroot>
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[3]"/>
         <mrow><xsl:apply-templates select="m:degree/*"/></mrow>
       </mroot>
     </xsl:otherwise>
@@ -796,14 +796,14 @@
   </xsl:when>
   <xsl:otherwise> <!-- no degree specified-->
     <msqrt>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </msqrt>
   </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
 <!-- greatest common divisor -->
-<xsl:template match="m:apply[*[position()=1 and self::m:gcd]]">
+<xsl:template match="m:apply[*[1][self::m:gcd]]">
   <mrow>
     <mi>gcd</mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
     <mfenced>
@@ -813,7 +813,7 @@
 </xsl:template>
 
 <!-- AND -->
-<xsl:template match="m:apply[*[position()=1 and self::m:and]]">
+<xsl:template match="m:apply[*[1][self::m:and]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>=3"> <!-- at least two operands (common case)-->
@@ -855,7 +855,7 @@
 </xsl:template>
 
 <!-- OR -->
-<xsl:template match="m:apply[*[position()=1 and self::m:or]]">
+<xsl:template match="m:apply[*[1][self::m:or]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>=3">
@@ -875,7 +875,7 @@
 </xsl:template>
 
 <!-- XOR -->
-<xsl:template match="m:apply[*[position()=1 and self::m:xor]]">
+<xsl:template match="m:apply[*[1][self::m:xor]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>=3">
@@ -895,41 +895,41 @@
 </xsl:template>
 
 <!-- NOT -->
-<xsl:template match="m:apply[*[position()=1 and self::m:not]]">
+<xsl:template match="m:apply[*[1][self::m:not]]">
   <mrow>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&Not;]]></xsl:text></mo>
     <xsl:choose>
     <xsl:when test="m:apply"><!--add brackets around OR,AND,XOR children for priority purpose-->
       <mfenced separators="">
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
       </mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </mrow>
 </xsl:template>
 
 <!-- implies -->
-<xsl:template match="m:apply[*[position()=1 and self::m:implies]]">
+<xsl:template match="m:apply[*[1][self::m:implies]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&DoubleRightArrow;]]></xsl:text></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:implies]]">
+<xsl:template match="m:reln[*[1][self::m:implies]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&DoubleRightArrow;]]></xsl:text></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
 <!-- for all-->
-<xsl:template match="m:apply[*[position()=1 and self::m:forall]]">
+<xsl:template match="m:apply[*[1][self::m:forall]]">
   <mrow>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ForAll;]]></xsl:text></mo>
     <mrow>
@@ -953,7 +953,7 @@
 </xsl:template>
 
 <!-- exist-->
-<xsl:template match="m:apply[*[position()=1 and self::m:exists]]">
+<xsl:template match="m:apply[*[1][self::m:exists]]">
   <mrow>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&Exists;]]></xsl:text></mo>
     <mrow>
@@ -977,45 +977,45 @@
 </xsl:template>
 
 <!-- absolute value -->
-<xsl:template match="m:apply[*[position()=1 and self::m:abs]]">
+<xsl:template match="m:apply[*[1][self::m:abs]]">
   <mrow><mo>|</mo><xsl:apply-templates select="*[position()=last()]"/><mo>|</mo></mrow>
 </xsl:template>
 
 <!-- conjugate -->
-<xsl:template match="m:apply[*[position()=1 and self::m:conjugate]]">
+<xsl:template match="m:apply[*[1][self::m:conjugate]]">
   <mover>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ovbar;]]></xsl:text></mo>  <!-- does not work, UNICODE x0233D  or perhaps OverBar-->
   </mover>
 </xsl:template>
 
 <!-- argument of complex number -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arg]]">
+<xsl:template match="m:apply[*[1][self::m:arg]]">
   <mrow>
-    <mi>arg</mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo><mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <mi>arg</mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo><mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
   </mrow>
 </xsl:template>
 
 <!-- real part of complex number -->
-<xsl:template match="m:apply[*[position()=1 and self::m:real]]">
+<xsl:template match="m:apply[*[1][self::m:real]]">
   <mrow>
     <mi><xsl:text disable-output-escaping="yes">&amp;#x0211C;</xsl:text><!-- &Re; or &realpart; should work--></mi>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
-    <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
   </mrow>
 </xsl:template>
 
 <!-- imaginary part of complex number -->
-<xsl:template match="m:apply[*[position()=1 and self::m:imaginary]]">
+<xsl:template match="m:apply[*[1][self::m:imaginary]]">
   <mrow>
     <mi><xsl:text disable-output-escaping="yes">&amp;#x02111;</xsl:text><!-- &Im; or &impartl should work--></mi>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
-    <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+    <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
   </mrow>
 </xsl:template>
 
 <!-- lowest common multiple -->
-<xsl:template match="m:apply[*[position()=1 and self::m:lcm]]">
+<xsl:template match="m:apply[*[1][self::m:lcm]]">
   <mrow>
     <mi>lcm</mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
     <mfenced>
@@ -1025,12 +1025,12 @@
 </xsl:template>
 
 <!-- floor -->
-<xsl:template match="m:apply[*[position()=1 and self::m:floor]]">
+<xsl:template match="m:apply[*[1][self::m:floor]]">
   <mrow><mo><xsl:text disable-output-escaping="yes"><![CDATA[&LeftFloor;]]></xsl:text></mo><xsl:apply-templates select="*[position()=last()]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightFloor;]]></xsl:text></mo></mrow>
 </xsl:template>
 
 <!-- ceiling -->
-<xsl:template match="m:apply[*[position()=1 and self::m:ceiling]]">
+<xsl:template match="m:apply[*[1][self::m:ceiling]]">
   <mrow><mo><xsl:text disable-output-escaping="yes"><![CDATA[&LeftCeiling;]]></xsl:text></mo><xsl:apply-templates select="*[position()=last()]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightCeiling;]]></xsl:text></mo></mrow>
 </xsl:template>
 
@@ -1049,7 +1049,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo>=</mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo>=</mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1058,28 +1058,28 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:eq]]">
+<xsl:template match="m:apply[*[1][self::m:eq]]">
   <xsl:call-template name="eqRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:eq]]">
+<xsl:template match="m:reln[*[1][self::m:eq]]">
   <xsl:call-template name="eqRel"/>
 </xsl:template>
 
 <!-- not equal to -->
-<xsl:template match="m:apply[*[position()=1 and self::m:neq]]">
+<xsl:template match="m:apply[*[1][self::m:neq]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotEqual;]]></xsl:text></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:neq]]">
+<xsl:template match="m:reln[*[1][self::m:neq]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotEqual;]]></xsl:text></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
@@ -1096,7 +1096,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&gt;]]></xsl:text></mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&gt;]]></xsl:text></mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1105,11 +1105,11 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:gt]]">
+<xsl:template match="m:apply[*[1][self::m:gt]]">
   <xsl:call-template name="gtRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:gt]]">
+<xsl:template match="m:reln[*[1][self::m:gt]]">
   <xsl:call-template name="gtRel"/>
 </xsl:template>
 
@@ -1126,7 +1126,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&lt;]]></xsl:text></mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&lt;]]></xsl:text></mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1135,11 +1135,11 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:lt]]">
+<xsl:template match="m:apply[*[1][self::m:lt]]">
   <xsl:call-template name="ltRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:lt]]">
+<xsl:template match="m:reln[*[1][self::m:lt]]">
   <xsl:call-template name="ltRel"/>
 </xsl:template>
 
@@ -1156,7 +1156,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&GreaterEqual;]]></xsl:text></mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&GreaterEqual;]]></xsl:text></mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1165,11 +1165,11 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:geq]]">
+<xsl:template match="m:apply[*[1][self::m:geq]]">
   <xsl:call-template name="geqRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:geq]]">
+<xsl:template match="m:reln[*[1][self::m:geq]]">
   <xsl:call-template name="geqRel"/>
 </xsl:template>
 
@@ -1186,7 +1186,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&LessEqual;]]></xsl:text></mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&LessEqual;]]></xsl:text></mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1195,11 +1195,11 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:leq]]">
+<xsl:template match="m:apply[*[1][self::m:leq]]">
   <xsl:call-template name="leqRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:leq]]">
+<xsl:template match="m:reln[*[1][self::m:leq]]">
   <xsl:call-template name="leqRel"/>
 </xsl:template>
 
@@ -1216,7 +1216,7 @@
   </xsl:when>
   <xsl:when test="count(*)=2">
     <mrow>
-      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&equiv;]]></xsl:text></mo><xsl:apply-templates select="*[position()=2]"/>
+      <mo><xsl:text disable-output-escaping="yes"><![CDATA[&equiv;]]></xsl:text></mo><xsl:apply-templates select="*[2]"/>
     </mrow>
   </xsl:when>
   <xsl:otherwise>
@@ -1225,44 +1225,44 @@
   </xsl:choose>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:equivalent]]">
+<xsl:template match="m:apply[*[1][self::m:equivalent]]">
   <xsl:call-template name="equivRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:equivalent]]">
+<xsl:template match="m:reln[*[1][self::m:equivalent]]">
   <xsl:call-template name="equivRel"/>
 </xsl:template>
 
 <!-- approximately equal -->
-<xsl:template match="m:apply[*[position()=1 and self::m:approx]]">
+<xsl:template match="m:apply[*[1][self::m:approx]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping='yes'>&amp;#x02248;</xsl:text><!-- &TildeTilde; or &approx; should work--></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:approx]]">
+<xsl:template match="m:reln[*[1][self::m:approx]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo><xsl:text disable-output-escaping='yes'>&amp;#x02248;</xsl:text><!-- &TildeTilde; or &approx; should work--></mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
 <!-- factor of -->
-<xsl:template match="m:apply[*[position()=1 and self::m:factorof]]">
+<xsl:template match="m:apply[*[1][self::m:factorof]]">
   <mrow>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     <mo>|</mo>
-    <xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[3]"/>
   </mrow>
 </xsl:template>
 
 <!-- #################### 4.4.5 #################### -->
 
 <!-- integral -->
-<xsl:template match="m:apply[*[position()=1 and self::m:int]]">
+<xsl:template match="m:apply[*[1][self::m:int]]">
   <mrow>
     <xsl:choose>
     <xsl:when test="m:condition"> <!-- integration domain expressed by a condition-->
@@ -1285,8 +1285,8 @@
       <xsl:when test="m:interval"> <!-- integration domain expressed by an interval-->
         <msubsup>
           <mo><xsl:text disable-output-escaping="yes"><![CDATA[&Integral;]]></xsl:text></mo>
-          <xsl:apply-templates select="m:interval/*[position()=1]"/>
-          <xsl:apply-templates select="m:interval/*[position()=2]"/>
+          <xsl:apply-templates select="m:interval/*[1]"/>
+          <xsl:apply-templates select="m:interval/*[2]"/>
         </msubsup>
         <xsl:apply-templates select="*[position()=last()]"/>
         <mo>d<!--DifferentialD does not work--></mo><xsl:apply-templates select="m:bvar"/>
@@ -1312,7 +1312,7 @@
 </xsl:template>
 
 <!-- differentiation -->
-<xsl:template match="m:apply[*[position()=1 and self::m:diff]]">
+<xsl:template match="m:apply[*[1][self::m:diff]]">
   <mrow>
   <xsl:choose>
   <xsl:when test="m:bvar/m:degree"> <!-- if the order of the derivative is specified-->
@@ -1324,7 +1324,7 @@
       </mfrac>
       <mrow>
       <xsl:choose>
-      <xsl:when test="m:apply[position()=last()]/m:fn[position()=1]"> 
+      <xsl:when test="m:apply[position()=last()]/m:fn[1]"> 
         <xsl:apply-templates select="*[position()=last()]"/>
       </xsl:when> <!--add brackets around expression if not a function-->
       <xsl:otherwise>
@@ -1340,7 +1340,7 @@
       </mfrac>
       <mrow>
       <xsl:choose>
-      <xsl:when test="m:apply[position()=last()]/m:fn[position()=1]">
+      <xsl:when test="m:apply[position()=last()]/m:fn[1]">
         <xsl:apply-templates select="*[position()=last()]"/>
       </xsl:when>
       <xsl:otherwise>
@@ -1354,7 +1354,7 @@
   <xsl:otherwise> <!-- if no order is specified, default to 1-->
     <xsl:choose>
     <xsl:when test="count(*)&lt;=2"> <!--if just a function identifier, use f' instead of d(f)/dx-->
-      <xsl:apply-templates select="*[position()=2]"/>'
+      <xsl:apply-templates select="*[2]"/>'
     </xsl:when>
     <xsl:otherwise>
       <mfrac>
@@ -1363,7 +1363,7 @@
       </mfrac>
       <mrow>
       <xsl:choose>
-      <xsl:when test="m:apply[position()=last()]/m:fn[position()=1]">
+      <xsl:when test="m:apply[position()=last()]/m:fn[1]">
         <xsl:apply-templates select="*[position()=last()]"/>
       </xsl:when>
       <xsl:otherwise>
@@ -1382,7 +1382,7 @@
 <!-- the latest working draft sets the default rendering of the numerator
 to only one mfrac with one PartialD for the numerator, exponent being the sum
 of every partial diff's orders; not supported yet (I am not sure it is even possible with XSLT)-->
-<xsl:template match="m:apply[*[position()=1 and self::m:partialdiff]]">
+<xsl:template match="m:apply[*[1][self::m:partialdiff]]">
 <mrow>
   <xsl:choose>
     <xsl:when test="m:list">
@@ -1421,7 +1421,7 @@
     </xsl:for-each>
     <mrow>
     <xsl:choose>
-      <xsl:when test="m:apply[position()=last()]/m:fn[position()=1]"> 
+      <xsl:when test="m:apply[position()=last()]/m:fn[1]"> 
         <xsl:apply-templates select="*[position()=last()]"/>
       </xsl:when> <!--add brackets around expression if not a function-->
       <xsl:otherwise>
@@ -1435,71 +1435,71 @@
 </xsl:template>
 
 <!-- divergence -->
-<xsl:template match="m:apply[*[position()=1 and self::m:divergence]]">
+<xsl:template match="m:apply[*[1][self::m:divergence]]">
 <mrow>
   <mi>div</mi>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
 </xsl:template>
 
 <!-- gradient -->
-<xsl:template match="m:apply[*[position()=1 and self::m:grad]]">
+<xsl:template match="m:apply[*[1][self::m:grad]]">
 <mrow>
   <mi>grad</mi>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
 </xsl:template>
 
 <!-- vector calculus curl -->
-<xsl:template match="m:apply[*[position()=1 and self::m:curl]]">
+<xsl:template match="m:apply[*[1][self::m:curl]]">
 <mrow>
   <mi>curl</mi>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
 </xsl:template>
 
 <!-- laplacian -->
-<xsl:template match="m:apply[*[position()=1 and self::m:laplacian]]">
+<xsl:template match="m:apply[*[1][self::m:laplacian]]">
 <mrow>
   <msup>
     <mo><xsl:text disable-output-escaping='yes'>&amp;#x02207;</xsl:text></mo>  <!-- Del or nabla should work-->
     <mn>2</mn>
   </msup>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
@@ -1543,7 +1543,7 @@
 </xsl:template>
 
 <!-- union -->
-<xsl:template match="m:apply[*[position()=1 and self::m:union]]">
+<xsl:template match="m:apply[*[1][self::m:union]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>=3">
@@ -1563,7 +1563,7 @@
 </xsl:template>
 
 <!-- intersection -->
-<xsl:template match="m:apply[*[position()=1 and self::m:intersect]]">
+<xsl:template match="m:apply[*[1][self::m:intersect]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>=3">
@@ -1590,36 +1590,36 @@
 </xsl:template>
 
 <!-- inclusion -->
-<xsl:template match="m:apply[*[position()=1 and self::m:in]]">
+<xsl:template match="m:apply[*[1][self::m:in]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&isin;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:in]]">
+<xsl:template match="m:reln[*[1][self::m:in]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&isin;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- exclusion -->
-<xsl:template match="m:apply[*[position()=1 and self::m:notin]]">
+<xsl:template match="m:apply[*[1][self::m:notin]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&notin;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:notin]]">
+<xsl:template match="m:reln[*[1][self::m:notin]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&notin;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
@@ -1643,11 +1643,11 @@
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:subset]]">
+<xsl:template match="m:apply[*[1][self::m:subset]]">
   <xsl:call-template name="subsetRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:subset]]">
+<xsl:template match="m:reln[*[1][self::m:subset]]">
   <xsl:call-template name="subsetRel"/>
 </xsl:template>
 
@@ -1671,66 +1671,66 @@
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:prsubset]]">
+<xsl:template match="m:apply[*[1][self::m:prsubset]]">
   <xsl:call-template name="prsubsetRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:prsubset]]">
+<xsl:template match="m:reln[*[1][self::m:prsubset]]">
   <xsl:call-template name="prsubsetRel"/>
 </xsl:template>
 
 <!-- perhaps Subset and SubsetEqual signs are used in place of one another ; not according to the spec -->
 
 <!-- containment (not subset of)-->
-<xsl:template match="m:apply[*[position()=1 and self::m:notsubset]]">
+<xsl:template match="m:apply[*[1][self::m:notsubset]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotSubset;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:notsubset]]">
+<xsl:template match="m:reln[*[1][self::m:notsubset]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotSubset;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- containment (not proper subset of) -->
-<xsl:template match="m:apply[*[position()=1 and self::m:notprsubset]]">
+<xsl:template match="m:apply[*[1][self::m:notprsubset]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotSubsetEqual;]]></xsl:text></mo>  <!-- does not work, perhaps nsube, or nsubE, or nsubseteqq or nsubseteq, UNICODE x02288-->
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:notprsubset]]">
+<xsl:template match="m:reln[*[1][self::m:notprsubset]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&NotSubsetEqual;]]></xsl:text></mo>  <!-- does not work, perhaps nsube, or nsubE, or nsubseteqq or nsubseteq, UNICODE x02288-->
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- difference of two sets -->
-<xsl:template match="m:apply[*[position()=1 and self::m:setdiff]]">
+<xsl:template match="m:apply[*[1][self::m:setdiff]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&Backslash;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- cardinality -->
-<xsl:template match="m:apply[*[position()=1 and self::m:card]]">
+<xsl:template match="m:apply[*[1][self::m:card]]">
   <mrow><mo>|</mo><xsl:apply-templates select="*[position()=last()]"/><mo>|</mo></mrow>
 </xsl:template>
 
 <!-- cartesian product -->
-<xsl:template match="m:apply[*[position()=1 and self::m:cartesianproduct]]">
+<xsl:template match="m:apply[*[1][self::m:cartesianproduct]]">
 <xsl:choose>
 <xsl:when test="count(*)>=3">
   <mrow>
@@ -1773,16 +1773,16 @@
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&times;]]></xsl:text></mo>
     <xsl:choose>
       <xsl:when test="m:plus">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
       <xsl:when test="m:minus">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
-      <xsl:when test="*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-')">
-        <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+      <xsl:when test="*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-')">
+        <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
       </xsl:otherwise>
     </xsl:choose>
   </mrow>
@@ -1796,7 +1796,7 @@
 <!-- #################### 4.4.7 #################### -->
 
 <!-- sum -->
-<xsl:template match="m:apply[*[position()=1 and self::m:sum]]">
+<xsl:template match="m:apply[*[1][self::m:sum]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="m:condition">  <!-- domain specified by a condition -->
@@ -1825,7 +1825,7 @@
 </xsl:template>
 
 <!-- product -->
-<xsl:template match="m:apply[*[position()=1 and self::m:product]]">
+<xsl:template match="m:apply[*[1][self::m:product]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="m:condition">   <!-- domain specified by a condition -->
@@ -1854,7 +1854,7 @@
 </xsl:template>
 
 <!-- limit -->
-<xsl:template match="m:apply[*[position()=1 and self::m:limit]]">
+<xsl:template match="m:apply[*[1][self::m:limit]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="m:condition">
@@ -1881,28 +1881,28 @@
   <xsl:when test="m:tendsto/@type">
     <xsl:choose>
     <xsl:when test="m:tendsto/@type='above'"> <!-- from above -->
-      <xsl:apply-templates select="*[position()=2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&DownArrow;]]></xsl:text></mo><xsl:apply-templates select="*[position()=3]"/>
+      <xsl:apply-templates select="*[2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&DownArrow;]]></xsl:text></mo><xsl:apply-templates select="*[3]"/>
     </xsl:when>
     <xsl:when test="m:tendsto/@type='below'"> <!-- from below -->
-      <xsl:apply-templates select="*[position()=2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&UpArrow;]]></xsl:text></mo><xsl:apply-templates select="*[position()=3]"/>
+      <xsl:apply-templates select="*[2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&UpArrow;]]></xsl:text></mo><xsl:apply-templates select="*[3]"/>
     </xsl:when>
     <xsl:when test="m:tendsto/@type='two-sided'"> <!-- from above or below -->
-      <xsl:apply-templates select="*[position()=2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightArrow;]]></xsl:text></mo><xsl:apply-templates select="*[position()=3]"/>
+      <xsl:apply-templates select="*[2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightArrow;]]></xsl:text></mo><xsl:apply-templates select="*[3]"/>
     </xsl:when>
     </xsl:choose>
   </xsl:when>
   <xsl:otherwise>  <!-- no type attribute -->
-    <xsl:apply-templates select="*[position()=2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightArrow;]]></xsl:text></mo><xsl:apply-templates select="*[position()=3]"/>
+    <xsl:apply-templates select="*[2]"/><mo><xsl:text disable-output-escaping="yes"><![CDATA[&RightArrow;]]></xsl:text></mo><xsl:apply-templates select="*[3]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
 </xsl:template>
 
-<xsl:template match="m:apply[*[position()=1 and self::m:tendsto]]">
+<xsl:template match="m:apply[*[1][self::m:tendsto]]">
   <xsl:call-template name="tendstoRel"/>
 </xsl:template>
 
-<xsl:template match="m:reln[*[position()=1 and self::m:tendsto]]">
+<xsl:template match="m:reln[*[1][self::m:tendsto]]">
   <xsl:call-template name="tendstoRel"/>
 </xsl:template>
 
@@ -1914,20 +1914,20 @@
   <xsl:param name="func">sin</xsl:param> <!-- provide sin as default function in case none is provided (this should never occur)-->
   <mi><xsl:value-of select="$func"/></mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <mrow><xsl:apply-templates select="*[position()=2]"/></mrow>
+    <mrow><xsl:apply-templates select="*[2]"/></mrow>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
 </xsl:template>
 
 <!-- trigonometric function: sine -->
-<xsl:template match="m:apply[*[position()=1 and self::m:sin]]">
+<xsl:template match="m:apply[*[1][self::m:sin]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">sin</xsl:with-param>
   </xsl:call-template>
@@ -1938,7 +1938,7 @@
 </xsl:template>
 
 <!-- trigonometric function: cosine -->
-<xsl:template match="m:apply[*[position()=1 and self::m:cos]]">
+<xsl:template match="m:apply[*[1][self::m:cos]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">cos</xsl:with-param>
   </xsl:call-template>
@@ -1949,7 +1949,7 @@
 </xsl:template>
 
 <!-- trigonometric function: tan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:tan]]">
+<xsl:template match="m:apply[*[1][self::m:tan]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">tan</xsl:with-param>   
   </xsl:call-template>
@@ -1960,7 +1960,7 @@
 </xsl:template>
 
 <!-- trigonometric function: sec -->
-<xsl:template match="m:apply[*[position()=1 and self::m:sec]]">
+<xsl:template match="m:apply[*[1][self::m:sec]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">sec</xsl:with-param>  
   </xsl:call-template>
@@ -1971,7 +1971,7 @@
 </xsl:template>
 
 <!-- trigonometric function: csc -->
-<xsl:template match="m:apply[*[position()=1 and self::m:csc]]">
+<xsl:template match="m:apply[*[1][self::m:csc]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">csc</xsl:with-param>    
   </xsl:call-template>
@@ -1982,7 +1982,7 @@
 </xsl:template>
 
 <!-- trigonometric function: cotan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:cot]]">
+<xsl:template match="m:apply[*[1][self::m:cot]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">cot</xsl:with-param>    
   </xsl:call-template>
@@ -1993,7 +1993,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic sin -->
-<xsl:template match="m:apply[*[position()=1 and self::m:sinh]]">
+<xsl:template match="m:apply[*[1][self::m:sinh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">sinh</xsl:with-param>    
   </xsl:call-template>
@@ -2004,7 +2004,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic cos -->
-<xsl:template match="m:apply[*[position()=1 and self::m:cosh]]">
+<xsl:template match="m:apply[*[1][self::m:cosh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">cosh</xsl:with-param>    
   </xsl:call-template>
@@ -2015,7 +2015,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic tan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:tanh]]">
+<xsl:template match="m:apply[*[1][self::m:tanh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">tanh</xsl:with-param>    
   </xsl:call-template>
@@ -2026,7 +2026,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic sec -->
-<xsl:template match="m:apply[*[position()=1 and self::m:sech]]">
+<xsl:template match="m:apply[*[1][self::m:sech]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">sech</xsl:with-param>    
   </xsl:call-template>
@@ -2037,7 +2037,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic csc -->
-<xsl:template match="m:apply[*[position()=1 and self::m:csch]]">
+<xsl:template match="m:apply[*[1][self::m:csch]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">csch</xsl:with-param>   
   </xsl:call-template>
@@ -2048,7 +2048,7 @@
 </xsl:template>
 
 <!-- trigonometric function: hyperbolic cotan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:coth]]">
+<xsl:template match="m:apply[*[1][self::m:coth]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">coth</xsl:with-param>   
   </xsl:call-template>
@@ -2059,7 +2059,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc sine -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arcsin]]">
+<xsl:template match="m:apply[*[1][self::m:arcsin]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arcsin</xsl:with-param>    
   </xsl:call-template>
@@ -2070,7 +2070,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc cosine -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccos]]">
+<xsl:template match="m:apply[*[1][self::m:arccos]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccos</xsl:with-param>    
   </xsl:call-template>
@@ -2081,7 +2081,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc tan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arctan]]">
+<xsl:template match="m:apply[*[1][self::m:arctan]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arctan</xsl:with-param>    
   </xsl:call-template>
@@ -2092,7 +2092,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc sec -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arcsec]]">
+<xsl:template match="m:apply[*[1][self::m:arcsec]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arcsec</xsl:with-param>    
   </xsl:call-template>
@@ -2103,7 +2103,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc csc -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccsc]]">
+<xsl:template match="m:apply[*[1][self::m:arccsc]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccsc</xsl:with-param>    
   </xsl:call-template>
@@ -2114,7 +2114,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc cotan -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccot]]">
+<xsl:template match="m:apply[*[1][self::m:arccot]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccot</xsl:with-param>    
   </xsl:call-template>
@@ -2125,7 +2125,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc sinh -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arcsinh]]">
+<xsl:template match="m:apply[*[1][self::m:arcsinh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arcsinh</xsl:with-param>
   </xsl:call-template>
@@ -2136,7 +2136,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc cosh -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccosh]]">
+<xsl:template match="m:apply[*[1][self::m:arccosh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccosh</xsl:with-param>    
   </xsl:call-template>
@@ -2147,7 +2147,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc tanh -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arctanh]]">
+<xsl:template match="m:apply[*[1][self::m:arctanh]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arctanh</xsl:with-param>    
   </xsl:call-template>
@@ -2158,7 +2158,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc sech -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arcsech]]">
+<xsl:template match="m:apply[*[1][self::m:arcsech]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arcsech</xsl:with-param>    
   </xsl:call-template>
@@ -2169,7 +2169,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc csch -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccsch]]">
+<xsl:template match="m:apply[*[1][self::m:arccsch]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccsch</xsl:with-param>    
   </xsl:call-template>
@@ -2180,7 +2180,7 @@
 </xsl:template>
 
 <!-- trigonometric function: arc coth -->
-<xsl:template match="m:apply[*[position()=1 and self::m:arccoth]]">
+<xsl:template match="m:apply[*[1][self::m:arccoth]]">
   <xsl:call-template name="trigo">
     <xsl:with-param name="func">arccoth</xsl:with-param>   
   </xsl:call-template>
@@ -2191,10 +2191,10 @@
 </xsl:template>
 
 <!-- exponential -->
-<xsl:template match="m:apply[*[position()=1 and self::m:exp]]">
+<xsl:template match="m:apply[*[1][self::m:exp]]">
   <msup>
     <mi><xsl:text disable-output-escaping="yes"><![CDATA[&ee;]]></xsl:text></mi>   <!-- ExponentialE does not work yet -->
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </msup>
 </xsl:template>
 
@@ -2203,17 +2203,17 @@
 </xsl:template>
 
 <!-- natural logarithm -->
-<xsl:template match="m:apply[*[position()=1 and self::m:ln]]">
+<xsl:template match="m:apply[*[1][self::m:ln]]">
 <mrow>
   <mi>ln</mi><mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+  <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
     <mfenced separators="">
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </mfenced>
   </xsl:when>
   <xsl:otherwise>
-    <xsl:apply-templates select="*[position()=2]"/>
+    <xsl:apply-templates select="*[2]"/>
   </xsl:otherwise>
   </xsl:choose>
 </mrow>
@@ -2224,7 +2224,7 @@
 </xsl:template>
 
 <!-- logarithm to a given base (default 10)-->
-<xsl:template match="m:apply[*[position()=1 and self::m:log]]">
+<xsl:template match="m:apply[*[1][self::m:log]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="m:logbase">
@@ -2234,13 +2234,13 @@
     </msub>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
     <xsl:choose>
-    <xsl:when test="*[position()=3 and self::m:apply] or (*[position()=3 and (self::m:ci or self::m:cn)] and contains(*[position()=3]/text(),'-'))">
+    <xsl:when test="*[3][self::m:apply] or (*[3][self::m:ci or self::m:cn] and contains(*[3]/text(),'-'))">
       <mfenced separators="">
-        <xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[3]"/>
       </mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=3]"/>
+      <xsl:apply-templates select="*[3]"/>
     </xsl:otherwise>
     </xsl:choose>
   </xsl:when>
@@ -2251,13 +2251,13 @@
     </msub>
     <mo><xsl:text disable-output-escaping="yes"><![CDATA[&ApplyFunction;]]></xsl:text></mo>
     <xsl:choose>
-    <xsl:when test="*[position()=2 and self::m:apply] or (*[position()=2 and (self::m:ci or self::m:cn)] and contains(*[position()=2]/text(),'-'))">
+    <xsl:when test="*[2][self::m:apply] or (*[2][self::m:ci or self::m:cn] and contains(*[2]/text(),'-'))">
       <mfenced separators="">
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
       </mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </xsl:otherwise>
@@ -2288,7 +2288,7 @@
 
 <!-- mean -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:mean]]">
+<xsl:template match="m:apply[*[1][self::m:mean]]">
 <mrow>
   <xsl:choose>
   <xsl:when test="count(*)>2">  <!-- if more than one element use angle bracket notation-->
@@ -2311,7 +2311,7 @@
 
 <!-- standard deviation -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:sdev]]">
+<xsl:template match="m:apply[*[1][self::m:sdev]]">
 <mrow>
   <mi><xsl:text disable-output-escaping="yes"><![CDATA[&sigma;]]></xsl:text></mi>
   <mfenced>
@@ -2322,7 +2322,7 @@
 
 <!-- statistical variance -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:variance]]">
+<xsl:template match="m:apply[*[1][self::m:variance]]">
 <mrow>
   <mi><xsl:text disable-output-escaping="yes"><![CDATA[&sigma;]]></xsl:text></mi>
   <msup> 
@@ -2336,7 +2336,7 @@
 
 <!-- median -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:median]]">
+<xsl:template match="m:apply[*[1][self::m:median]]">
 <mrow>
   <mi>median</mi>
   <mfenced>
@@ -2347,7 +2347,7 @@
 
 <!-- statistical mode -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:mode]]">
+<xsl:template match="m:apply[*[1][self::m:mode]]">
 <mrow>
   <mi>mode</mi>
   <mfenced>
@@ -2358,7 +2358,7 @@
 
 <!-- statistical moment -->
 <!-- not sure we handle the n-ary thing correctly as far as display is concerned-->
-<xsl:template match="m:apply[*[position()=1 and self::m:moment]]">
+<xsl:template match="m:apply[*[1][self::m:moment]]">
 <mrow>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&lang;]]></xsl:text></mo>
   <xsl:for-each select="*[position()!=1 and position()!=2 and position()!=last() and not(self::m:momentabout)]">
@@ -2384,7 +2384,7 @@
 <!-- vector -->
 <xsl:template match="m:vector">  <!--default representation for vectors is horizontal, since they can be used for instance as the set of params of a function-->
   <xsl:choose> <!-- support for some cases where vectors should be displayed verticaly-->
-  <xsl:when test="(preceding-sibling::*[position()=1 and self::m:matrix] and preceding-sibling::*[position()=last() and self::m:times])">
+  <xsl:when test="(preceding-sibling::*[1][self::m:matrix] and preceding-sibling::*[position()=last() and self::m:times])">
     <mfenced>  <!-- vectors that are after a matrix, the operation being a multiplication -->
       <mtable>
 	<xsl:for-each select="*">
@@ -2421,29 +2421,29 @@
 </xsl:template>
 
 <!-- determinant -->
-<xsl:template match="m:apply[*[position()=1 and self::m:determinant]]">
+<xsl:template match="m:apply[*[1][self::m:determinant]]">
   <mrow>
     <mo>det</mo>
     <xsl:choose>
     <xsl:when test="m:apply">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+      <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </mrow>
 </xsl:template>
 
 <!-- transpose -->
-<xsl:template match="m:apply[*[position()=1 and self::m:transpose]]">
+<xsl:template match="m:apply[*[1][self::m:transpose]]">
   <msup>
     <xsl:choose>
     <xsl:when test="m:apply">
-      <mfenced separators=""><xsl:apply-templates select="*[position()=2]"/></mfenced>
+      <mfenced separators=""><xsl:apply-templates select="*[2]"/></mfenced>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
     <mo>T</mo>
@@ -2451,33 +2451,33 @@
 </xsl:template>
 
 <!-- selector-->
-<xsl:template match="m:apply[*[position()=1 and self::m:selector]]">
+<xsl:template match="m:apply[*[1][self::m:selector]]">
   <mrow>
   <xsl:choose>
-  <xsl:when test="*[position()=2 and self::m:matrix]"> <!-- select in a matrix defined inside the selector -->
+  <xsl:when test="*[2][self::m:matrix]"> <!-- select in a matrix defined inside the selector -->
     <xsl:choose>
     <xsl:when test="count(*)=4"> <!-- matrix element-->
-      <xsl:variable name="i"><xsl:value-of select="*[position()=3]"/></xsl:variable>  <!--extract row-->
-      <xsl:variable name="j"><xsl:value-of select="*[position()=4]"/></xsl:variable>  <!--extract column-->
-      <xsl:apply-templates select="*[position()=2]/*[position()=number($i)]/*[position()=number($j)]"/>
+      <xsl:variable name="i"><xsl:value-of select="*[3]"/></xsl:variable>  <!--extract row-->
+      <xsl:variable name="j"><xsl:value-of select="*[4]"/></xsl:variable>  <!--extract column-->
+      <xsl:apply-templates select="*[2]/*[position()=number($i)]/*[position()=number($j)]"/>
     </xsl:when>
     <xsl:when test="count(*)=3">  <!-- matrix row -->
-      <xsl:variable name="i"><xsl:value-of select="*[position()=3]"/></xsl:variable>  <!--extract row, put it in a matrix container of its own-->
-      <mtable><xsl:apply-templates select="*[position()=2]/*[position()=number($i)]"/></mtable>
+      <xsl:variable name="i"><xsl:value-of select="*[3]"/></xsl:variable>  <!--extract row, put it in a matrix container of its own-->
+      <mtable><xsl:apply-templates select="*[2]/*[position()=number($i)]"/></mtable>
     </xsl:when>
     <xsl:otherwise> <!-- no index select the entire thing-->
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </xsl:when>
-  <xsl:when test="*[position()=2 and (self::m:vector or self::m:list)]"> <!-- select in a vector or list defined inside the selector -->
+  <xsl:when test="*[2][(self::m:vector or self::m:list)]"> <!-- select in a vector or list defined inside the selector -->
     <xsl:choose>
     <xsl:when test="count(*)=3">  <!-- list/vector element -->
-      <xsl:variable name="i"><xsl:value-of select="*[position()=3]"/></xsl:variable>  <!--extract index-->
-      <xsl:apply-templates select="*[position()=2]/*[position()=number($i)]"/>
+      <xsl:variable name="i"><xsl:value-of select="*[3]"/></xsl:variable>  <!--extract index-->
+      <xsl:apply-templates select="*[2]/*[position()=number($i)]"/>
     </xsl:when>
     <xsl:otherwise> <!-- no index select the entire thing-->
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </xsl:when>
@@ -2485,22 +2485,22 @@
     <xsl:choose>
     <xsl:when test="count(*)=4"> <!-- two indices (matrix element)-->
       <msub>
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:apply-templates select="*[2]"/>
 	<mrow>
-	  <xsl:apply-templates select="*[position()=3]"/>
+	  <xsl:apply-templates select="*[3]"/>
 	  <mo><xsl:text disable-output-escaping="yes"><![CDATA[&InvisibleComma;]]></xsl:text></mo>  <!-- InvisibleComma does not work -->
-	  <xsl:apply-templates select="*[position()=4]"/>
+	  <xsl:apply-templates select="*[4]"/>
 	</mrow>
       </msub>
     </xsl:when>
     <xsl:when test="count(*)=3">  <!-- one index probably list or vector element, or matrix row -->
       <msub>
-        <xsl:apply-templates select="*[position()=2]"/>
-	<xsl:apply-templates select="*[position()=3]"/>
+        <xsl:apply-templates select="*[2]"/>
+	<xsl:apply-templates select="*[3]"/>
       </msub>
     </xsl:when>
     <xsl:otherwise> <!-- no index select the entire thing-->
-      <xsl:apply-templates select="*[position()=2]"/>
+      <xsl:apply-templates select="*[2]"/>
     </xsl:otherwise>
     </xsl:choose>
   </xsl:otherwise>
@@ -2509,29 +2509,29 @@
 </xsl:template>
 
 <!-- vector product = A x B x sin(teta) -->
-<xsl:template match="m:apply[*[position()=1 and self::m:vectorproduct]]">
+<xsl:template match="m:apply[*[1][self::m:vectorproduct]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo><xsl:text disable-output-escaping="yes"><![CDATA[&times;]]></xsl:text></mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- scalar product = A x B x cos(teta) -->
-<xsl:template match="m:apply[*[position()=1 and self::m:scalarproduct]]">
+<xsl:template match="m:apply[*[1][self::m:scalarproduct]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo>.</mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
 <!-- outer product = A x B x cos(teta) -->
-<xsl:template match="m:apply[*[position()=1 and self::m:outerproduct]]">
+<xsl:template match="m:apply[*[1][self::m:outerproduct]]">
 <mrow>
-  <xsl:apply-templates select="*[position()=2]"/>
+  <xsl:apply-templates select="*[2]"/>
   <mo>.</mo>
-  <xsl:apply-templates select="*[position()=3]"/>
+  <xsl:apply-templates select="*[3]"/>
 </mrow>
 </xsl:template>
 
@@ -2550,7 +2550,7 @@
       <xsl:apply-templates select="annotation-xml[contains(@encoding,'MathML-Presentation')]"/>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="*[position()=1]"/>  <!--if no specific representation is provided use the default one-->
+      <xsl:apply-templates select="*[1]"/>  <!--if no specific representation is provided use the default one-->
     </xsl:otherwise>
   </xsl:choose>
 </mrow>

