Skip to content

Commit

Permalink
xsl updated for definitions, #407
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Apr 18, 2024
1 parent 36f37f4 commit 7a7af65
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/resources/sts2mn.adoc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,7 @@
<!-- Terms and definitions -->
<!-- ======================== -->
<!-- first element in Terms and definitions section -->
<xsl:template match="sec[@sec-type = 'terms']/title | sec[@sec-type = 'terms']//sec/title | sec[.//std-def-list]/title" priority="2">
<xsl:template match="sec[@sec-type = 'terms' or @sec-type = 'definitions']/title | sec[@sec-type = 'terms']//sec/title | sec[.//std-def-list]/title" priority="2">

<xsl:choose>
<xsl:when test="$inputformat = 'IEEE' and ../../self::body and . != 'Definitions'">
Expand All @@ -2358,6 +2358,10 @@
<xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="../@sec-type = 'definitions'">
<xsl:text>[heading=terms and definitions,keeptitle=true]</xsl:text>
<xsl:text>&#xa;</xsl:text>
</xsl:if>
<xsl:call-template name="title"/>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -6242,11 +6246,19 @@
</xsl:template>

<xsl:template match="term-display/term">
<xsl:variable name="level">
<xsl:call-template name="getLevel">
<xsl:with-param name="addon">-1</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$level"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>:: </xsl:text>
<!-- <xsl:text>:: </xsl:text> -->
<xsl:text>&#xa;&#xa;</xsl:text>
</xsl:template>

<xsl:template match="term-display/def/p">
<xsl:template match="term-display/def/* ">
<xsl:apply-templates/>
<xsl:if test="following-sibling::*"> +&#xa;</xsl:if>
</xsl:template>
Expand Down
33 changes: 33 additions & 0 deletions src/main/resources/sts2mn.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,39 @@
</field-of-application>
</xsl:template>

<xsl:template match="term-display">
<term>
<xsl:copy-of select="@id"/>
<xsl:if test="not(@id)">
<xsl:attribute name="id">
<xsl:variable name="id_tmp" select="java:replaceAll(java:java.lang.String.new(term),'[^a-zA-Z0-9 ]', '_')"/><!-- replace all non word char to underscore -->
<xsl:text>term-</xsl:text><xsl:value-of select="translate($id_tmp, ' ', '-')"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</term>
</xsl:template>

<xsl:template match="term-display/term">
<preferred>
<xsl:choose>
<xsl:when test="$type_xml = 'presentation'">
<strong><xsl:apply-templates/></strong>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>

</preferred>
</xsl:template>

<xsl:template match="term-display/def">
<definition>
<xsl:apply-templates/>
</definition>
</xsl:template>

<!-- ======================== -->
<!-- END Terms, definitions -->
<!-- ======================== -->
Expand Down

0 comments on commit 7a7af65

Please sign in to comment.