7.1 Mstyle as Parent of an Element

Merge mstyle into its child. For instance

<mstyle mathvariant="bold">  
   <mi>F</mi>  
</mstyle>

into

<mi mathvariant="bold">F</mi>

<..mstyle script..>
 <script element="mstyle" >
    <set name="mstyle" >
       <.open xslt script.>
       <.mstyle templates.>
       <.close xslt script.>
    </set>
    <xslt name="." xml="." xsl="mstyle" />
 </script>
-_-_-

<..mstyle templates..>
 <xsl:template match=" m:mstyle [
                   @mathvariant
              and
                   child::m:*[ not(@mathvariant) ]
              and
                   (count(child::m:*) = 1)
 ] " >
   <xsl:element name="{name(child::m:*[1])}">
     <xsl:attribute name="mathvariant" >
          <xsl:value-of select="@mathvariant" />
     </xsl:attribute>
     <xsl:apply-templates select="child::m:*/@*" />
     <xsl:apply-templates select="
         child::m:*/*
         | child::m:*/text()
         | child::m:*/comment()
       "
     />
   </xsl:element>
 </xsl:template>
-_-_-