Skip to content

Commit

Permalink
mn2xsl.xsl updated for nbsp between digit and percent, #209
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Feb 1, 2023
1 parent cd5d42e commit f5d0d5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/resources/mn2sts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,14 @@
<!-- remove @id from 'list' and 'p' if starts with '_' -->
<xsl:template match="*[self::list or self::p or self::non-normative-note]/@id[starts-with(., '_')]" mode="id_replace"/>

<!-- additional action in 'id_replace' task (for time saving): add non-break space -->
<xsl:template match="text()[normalize-space() != '']" mode="id_replace">
<!-- ([0-9])[space](%) -->
<xsl:variable name="regex_digit_percent">([0-9]) (%)</xsl:variable>
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new(.), $regex_digit_percent, concat('$1', $CHAR_NBSP, '$2'))"/>

<xsl:value-of select="$text1"/>
</xsl:template>
<!-- ================================== -->
<!-- END: id replacement for IEC/ISO ID scheme -->
<!-- ================================== -->
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/mn2xml.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<xsl:variable name="metanorma_type" select="java:toUpperCase(java:java.lang.String.new(substring-before(local-name(//*[contains(local-name(), '-standard')]), '-')))"/> <!-- ISO, IEC, ... -->

<xsl:variable name="CHAR_NBSP">&#xa0;</xsl:variable> <!-- &#xA0; -->
<xsl:variable name="CHAR_EM_DASH">—</xsl:variable> <!-- &#x2014; -->
<xsl:variable name="CHAR_BULLET">•</xsl:variable> <!-- &#x2022; -->
<xsl:variable name="CHAR_WHITE_CIRCLE">○</xsl:variable> <!-- &#x25CB; -->
Expand Down Expand Up @@ -61,7 +62,7 @@
</xsl:choose>
</xsl:template>

<xsl:template match="@*[name() = 'id' or name() = 'target' or name() = 'bibitemid'][starts-with(normalize-space(), 'semantic__')]" mode="remove_namespace" priority="3"> <!-- -->
<xsl:template match="@*[name() = 'id' or name() = 'target' or name() = 'bibitemid'][starts-with(normalize-space(), 'semantic__')]" mode="remove_namespace" priority="3">
<xsl:attribute name="{name()}">
<xsl:value-of select="substring-after(., 'semantic__')"/>
</xsl:attribute>
Expand Down

0 comments on commit f5d0d5d

Please sign in to comment.