-<xsl:template match="*[@xlink:href]">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="xlink:href">
- <xsl:call-template name="makeURL">
- <xsl:with-param name="uri" select="@xlink:href"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="xlink:show">other</xsl:attribute>
+<xsl:key name="id" use="@id" match="m:*"/>
+
+<xsl:template match = "m:semantics">
+ <xsl:apply-templates select="*[1]" mode="semantics"/>
+</xsl:template>
+
+<!-- Discharging content markup mantaining the linking info (helm:xref and
+xlink:href) -->
+<xsl:template match = "*" mode="semantics">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:if test="@xref">
+ <xsl:variable name="cnode" select="key('id',@xref)"/>
+ <xsl:if test="$cnode/@definitionURL">
+ <xsl:attribute name="xlink:href">
+ <xsl:call-template name="makeURL"><xsl:with-param name="uri" select="$cnode/@definitionURL"/></xsl:call-template>
+ </xsl:attribute>