Skip to content

Commit

Permalink
Merge pull request #265 from metanorma/issue/264
Browse files Browse the repository at this point in the history
updated for IEEE, #264
  • Loading branch information
Intelligent2013 authored Sep 23, 2022
2 parents 794f095 + 86eb447 commit 18cd276
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 8 deletions.
52 changes: 51 additions & 1 deletion src/main/resources/mn2ieee.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<xsl:when test="$subdoctype = 'amendment' or $subdoctype = 'corrigendum'"><xsl:value-of select="$subdoctype"/></xsl:when>
<xsl:when test="$subdoctype = 'erratum'">errata</xsl:when>
<xsl:when test="$doctype = 'standard' or $doctype = 'guide' or $doctype = 'recommended-practice'"><xsl:value-of select="$doctype"/></xsl:when>
<xsl:when test="$doctype = 'international-standard'">standard</xsl:when>
<xsl:otherwise><xsl:value-of select="$doctype"/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
Expand Down Expand Up @@ -426,11 +427,17 @@

<xsl:template match="copyright/owner" mode="front_ieee_permissions">
<copyright-holder>
<xsl:attribute name="copyright-owner">
<xsl:variable name="copyright_owner">
<xsl:value-of select="organization/abbreviation"/>
<xsl:if test="not(organization/abbreviation)">
<xsl:value-of select="organization/name"/>
</xsl:if>
</xsl:variable>
<xsl:attribute name="copyright-owner">
<xsl:choose>
<xsl:when test="contains('Alcatel-Lucent, Australian-Crown, British-Crown, Canadian-Crown, Crown, CCBY, EU, IBM, IEEE, OAPA, NA, Other, Unknown, USGov', $copyright_owner)"><xsl:value-of select="$copyright_owner"/></xsl:when>
<xsl:otherwise>Other</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="ancestor::bibdata/contributor[role[@type = 'publisher']]/organization/abbreviation"/>
</copyright-holder>
Expand Down Expand Up @@ -812,6 +819,25 @@

</xsl:template>

<xsl:template match="admitted | deprecates | domain">
<def><term><xsl:apply-templates /></term></def>
</xsl:template>

<xsl:template match="termsource">
<term>
<related-object source-id="{origin/@bibitemid}">
<xsl:value-of select="origin"/>
</related-object>
</term>
</xsl:template>

<xsl:template match="example | termexample" priority="2">
<non-normative-note>
<label>EXAMPLE</label>
<p><xsl:apply-templates /></p>
</non-normative-note>
</xsl:template>

<!-- =============================== -->
<!-- Definitions list processing (redefine from mn2xml.xsl) -->
<!-- =============================== -->
Expand Down Expand Up @@ -1012,4 +1038,28 @@
</mixed-citation>
</xsl:template>

<xsl:template match="figure/note" priority="2">
<p>
<xsl:call-template name="note"/>
</p>
</xsl:template>

<xsl:template match="figure[figure]" priority="2">
<xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
<!-- IEEE doesn't support fig-group -->
<fig>
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
<label><xsl:value-of select="@section"/></label>
<xsl:apply-templates select="name"/>
</fig>
<xsl:apply-templates select="node()[not(self::name)]"/>
</xsl:template>

<xsl:template match="annotation" priority="2">
<named-content content-type="annotation">
<xsl:copy-of select="@id"/>
<xsl:apply-templates select="node()/node()"/>
</named-content>
</xsl:template>

</xsl:stylesheet>
23 changes: 16 additions & 7 deletions src/main/resources/mn2xml.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,7 @@
<xsl:variable name="bibitem_URN_" select="$bibitems_URN/bibitem[@id = current()/@id]"/>
<xsl:variable name="bibitem_URN" select="xalan:nodeset($bibitem_URN_)"/>
<list-item>
<xsl:copy-of select="@id"/>
<p>
<xsl:choose>
<xsl:when test="formattedref">
Expand Down Expand Up @@ -4459,9 +4460,20 @@
<!-- move notes outside table -->
<xsl:if test="note">
<table-wrap-foot>
<xsl:for-each select="note">
<xsl:call-template name="note"/>
</xsl:for-each>
<xsl:choose>
<xsl:when test="$outputformat = 'IEEE'">
<p>
<xsl:for-each select="note">
<xsl:call-template name="note"/>
</xsl:for-each>
</p>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="note">
<xsl:call-template name="note"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</table-wrap-foot>
</xsl:if>
<!-- </table-wrap> -->
Expand Down Expand Up @@ -4688,9 +4700,6 @@
<!-- =============================== -->

<xsl:template match="figure[figure]" priority="1">
<xsl:variable name="current_id">
<xsl:call-template name="getId"/>
</xsl:variable>

<xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>

Expand Down Expand Up @@ -5524,7 +5533,7 @@
</xsl:template> <!-- split -->

<xsl:template name="addSectionAttribute">
<xsl:if test="$metanorma_type = 'IEC' or $metanorma_type = 'ISO'">
<xsl:if test="($metanorma_type = 'IEC' or $metanorma_type = 'ISO') and $outputformat != 'IEEE'">
<xsl:copy-of select="@section"/>
</xsl:if>
</xsl:template>
Expand Down

0 comments on commit 18cd276

Please sign in to comment.