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

Commit

Permalink
xslt updated for 'draft for comment` processing, metanorma/sts2mn#48
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed May 30, 2021
1 parent 7f76aec commit be8472d
Showing 1 changed file with 49 additions and 14 deletions.
63 changes: 49 additions & 14 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
<!-- ignoring all instances of .//relation[@type = 'adopted-from']/bibitem -->
<xsl:apply-templates select="*[local-name() = 'relation'][@type != 'adopted-from' and @type != 'related']" mode="front" /><!-- adopted-from -> to standalone xxx-meta , related -> comm-ref -->

<xsl:apply-templates select="*[local-name() = 'relation'][@type = 'related'][starts-with(*[local-name() = 'bibitem']/*[local-name() = 'docidentifier'], 'Draft for comment')]" mode="front" />


<permissions>
<!-- <copyright-statement>All rights reserved</copyright-statement> -->
Expand Down Expand Up @@ -772,22 +774,55 @@
</xsl:template>

<xsl:template match="*[local-name() = 'bibdata' or local-name() = 'bibitem']/*[local-name() = 'relation']" mode="front">
<!--
<relation xmlns="https://www.metanorma.org/ns/iso" type="informativelyReferences">
<bibitem>BS EN ISO 19011:2018</bibitem>
</relation>
-->
<!--
<std-xref type="informativelyReferences">
<std-ref type="dated">BS EN ISO 19011:2018</std-ref>
</std-xref>
-->
<std-xref>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="front"/>
</std-xref>
<xsl:variable name="value" select="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
<xsl:variable name="draft_comment_text">Draft for comment</xsl:variable>
<xsl:choose>
<xsl:when test="@type = 'related' and starts-with($value, $draft_comment_text)">
<!--
<relation type="related">
<bibitem>
<title> </title>
<docidentifier>Draft for comment 20/30387670 DC</docidentifier>
</bibitem>
</relation>
-->
<!--
<std-xref type="isPublishedFormatOf">
<std-ref type="undated">20/30387670 DC</std-ref>
</std-xref>
-->
<std-xref type="isPublishedFormatOf">
<std-ref>
<xsl:attribute name="type">
<xsl:call-template name="setDatedUndatedType">
<xsl:with-param name="value" select="$value"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="normalize-space(substring-after($value, $draft_comment_text))"/>
</std-ref>
</std-xref>
</xsl:when>
<xsl:otherwise>
<!--
<relation xmlns="https://www.metanorma.org/ns/iso" type="informativelyReferences">
<bibitem>BS EN ISO 19011:2018</bibitem>
</relation>
-->
<!--
<std-xref type="informativelyReferences">
<std-ref type="dated">BS EN ISO 19011:2018</std-ref>
</std-xref>
-->
<std-xref>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="front"/>
</std-xref>
</xsl:otherwise>
</xsl:choose>
</xsl:template>



<xsl:template match="*[local-name() = 'bibdata' or local-name() = 'bibitem']/*[local-name() = 'relation'][@type != 'adopted-from']/*[local-name() = 'bibitem']" mode="front">
<std-ref>
<xsl:copy-of select="@*"/>
Expand Down

0 comments on commit be8472d

Please sign in to comment.