Skip to content

Commit

Permalink
sts2mn xsl updated for preferred and alt terms, metanorma/metanorma-i…
Browse files Browse the repository at this point in the history
…so#765
  • Loading branch information
Intelligent2013 committed Aug 24, 2022
1 parent 2f73a24 commit 5ecf789
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
24 changes: 12 additions & 12 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You will need the `maven` build tool and `make`.

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file --check-type xsd-niso
java -jar mnconvert-1.21.0.jar xml_file --check-type xsd-niso
----

- `--check-type`, `-ct` - Check against XSD NISO (value xsd-niso), DTD ISO (dtd-iso), DTD NISO (dtd-niso)
Expand All @@ -26,7 +26,7 @@ or check any XML against XSD, DTD.

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file --validation-against <path DTD or XSD>
java -jar mnconvert-1.21.0.jar xml_file --validation-against <path DTD or XSD>
----

- `--validation-against`, `-va` - Check against specified DTD ot XSD
Expand All @@ -37,7 +37,7 @@ java -jar mnconvert-1.20.0.jar xml_file --validation-against <path DTD or XSD>

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file [options]
java -jar mnconvert-1.21.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -52,7 +52,7 @@ java -jar mnconvert-1.20.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file [options]
java -jar mnconvert-1.21.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -67,7 +67,7 @@ java -jar mnconvert-1.20.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file [options]
java -jar mnconvert-1.21.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -78,7 +78,7 @@ java -jar mnconvert-1.20.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.20.0.jar docx_file [options]
java -jar mnconvert-1.21.0.jar docx_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -88,7 +88,7 @@ java -jar mnconvert-1.20.0.jar docx_file [options]
=== 6. Convert from IEEE STL XML to Metanorma AsciiDoc.

----
java -jar mnconvert-1.20.0.jar xml_file [options]
java -jar mnconvert-1.21.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -100,7 +100,7 @@ java -jar mnconvert-1.20.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.20.0.jar xml_file --output-format ieee --validation-against <path to IEEE DTD>
java -jar mnconvert-1.21.0.jar xml_file --output-format ieee --validation-against <path to IEEE DTD>
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -118,7 +118,7 @@ e.g.

[source,sh]
----
java -jar target/mnconvert-1.20.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml
java -jar target/mnconvert-1.21.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml
----

NOTE: Input XML format (Metanorma, STS ISO/NISO, IEEE or XML2RFC) determines programmatically by root element of input file: +
Expand Down Expand Up @@ -151,7 +151,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma</groupId>
<artifactId>mnconvert</artifactId>
<version>1.20.0</version>
<version>1.21.0</version>
<name>Metanorma XML to NISO STS XML two-directional converter</name>
----

Expand All @@ -162,8 +162,8 @@ Tag the same version in Git:

[source,xml]
----
git tag v1.20.0
git push origin v1.20.0
git tag v1.21.0
git push origin v1.21.0
----

Then the corresponding GitHub release will be automatically created at:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metanorma</groupId>
<artifactId>mnconvert</artifactId>
<version>1.20.0</version>
<version>1.21.0</version>
<name>Metanorma XML to NISO STS XML two-directional, IEEE to Metanorma ADOC, Metanorma XML to IEEE XML, and XML2RFC to Metanorma Asciidoc IETF converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/sts2mn.adoc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,7 @@
<xsl:choose>
<xsl:when test="../tbx:normativeAuthorization/@value = 'admittedTerm'">alt</xsl:when>
<xsl:when test="../tbx:normativeAuthorization/@value = 'deprecatedTerm'">deprecated</xsl:when>
<xsl:when test="not(bold) and ancestor::sec[parent::body]//tbx:term[bold]">preferred</xsl:when> <!-- special case for https://github.com/metanorma/metanorma-iso/issues/765: when there is a term in bold -->
<xsl:otherwise>alt</xsl:otherwise>
</xsl:choose>
<xsl:text>:[</xsl:text>
Expand All @@ -2295,6 +2296,10 @@
<xsl:apply-templates select="../tbx:termType" mode="term"/>
</xsl:template>

<xsl:template match="tbx:term[count(node()) = 1]/bold" priority="2">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="tbx:termType" mode="term">
<xsl:text>&#xa;&#xa;</xsl:text>
<xsl:text>[%metadata]</xsl:text>
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/sts2mn.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,8 @@
<xsl:when test="../tbx:normativeAuthorization/@value = 'preferredTerm'">preferred</xsl:when>
<xsl:when test="../tbx:normativeAuthorization/@value = 'admittedTerm'">admitted</xsl:when>
<xsl:when test="../tbx:normativeAuthorization/@value = 'deprecatedTerm'">deprecates</xsl:when>
<xsl:when test="not(bold) and ancestor::sec[parent::body]//tbx:term[bold]">preferred</xsl:when>
<xsl:when test="bold and ancestor::sec[parent::body]//tbx:term[not(bold)]">admitted</xsl:when>
<xsl:otherwise>preferred</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Expand All @@ -1588,6 +1590,10 @@
</xsl:choose>
</xsl:template>

<xsl:template match="tbx:term[count(node()) = 1]/bold" priority="2">
<xsl:apply-templates />
</xsl:template>

<xsl:template name="createTermElement">
<xsl:param name="element_name"/>
<xsl:variable name="termType" select="normalize-space(../tbx:termType/@value)"/>
Expand Down

0 comments on commit 5ecf789

Please sign in to comment.