Skip to content
This repository has been archived by the owner on Jul 4, 2021. It is now read-only.

Commit

Permalink
xslt updated, fixed #46
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 23, 2021
1 parent 85a7933 commit 0d7ac05
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1560,13 +1560,30 @@
<!-- <xsl:text>term_</xsl:text> --><xsl:value-of select="$target"/>
</xsl:attribute>
<xsl:apply-templates />
<xsl:apply-templates select="following-sibling::*[1]" mode="em_xref"/><!-- get xref -->
</tbx:entailedTerm>
</xsl:template>


<!-- for xref, when previous is em -->
<xsl:template match="*[local-name() = 'xref'][preceding-sibling::*[1][local-name() = 'em']]" priority="2">
<xsl:template match="*[local-name() = 'xref']" mode="em_xref">
<xsl:text> </xsl:text>
<!-- preceding-sibling-text='<xsl:value-of select="normalize-space(preceding-sibling::node()[1])"/>' -->
<xsl:if test="normalize-space(preceding-sibling::node()[1]) ='('">(</xsl:if>
<xsl:value-of select="normalize-space()"/>
<xsl:if test="substring(normalize-space(following-sibling::node()[1]),1,1) =')'">)</xsl:if>
<!-- following-sibling-text='<xsl:value-of select="following-sibling::node()[1]"/>' -->
</xsl:template>

<xsl:template match="*[local-name() = 'xref'][preceding-sibling::*[1][local-name() = 'em']]" priority="2"/>
<!-- <xsl:template match="*[local-name() = 'xref'][preceding-sibling::*[1][local-name() = 'em']]" priority="2">
<xsl:value-of select="$elements//element[@source_id = current()/@target]/@section"/>
</xsl:template> -->

<!-- remove '(' between em and xref -->
<xsl:template match="text()[normalize-space() = '('][preceding-sibling::*[1][local-name() = 'em'] and following-sibling::*[1][local-name() = 'xref']]"/>
<!-- remove ')' after em and xref -->
<xsl:template match="text()[substring(normalize-space(),1,1) = ')'][preceding-sibling::*[1][local-name() = 'xref'] and preceding-sibling::*[2][local-name() = 'em']]">
<xsl:value-of select="substring-after(., ')')"/>
</xsl:template>

<xsl:template match="*[local-name() = 'em']">
Expand Down

0 comments on commit 0d7ac05

Please sign in to comment.