+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="id" select="@id"/>
+ <xsl:choose>
+ <xsl:when test="not(*[2])">
+ <xsl:for-each select="*[1]">
+ <xsl:copy>
+ <xsl:attribute name="m:xref">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+ <xsl:copy-of select="@*|*"/>
+ </xsl:copy>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <m:mrow m:xref="{$id}">
+ <xsl:copy-of select="*|text()"/>
+ </m:mrow>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>