metanorma-iho 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92c16323617a6b16e621bab2d77ea28dff47d7780fcaa39abb8dbe00cd6e2024
4
- data.tar.gz: fefa770337465aa7b2038880f289f6c890b24b636e13ef052f45b495b7e00fba
3
+ metadata.gz: 48f4dfd3bb336cc6d6438a84febaf7383912e793bcacd70b88a261e183928263
4
+ data.tar.gz: af832e04cc7fde3ff2ff492c873bed6256e81414850c4ddc1ae1e5ed206f044f
5
5
  SHA512:
6
- metadata.gz: 46219534717178e1c5285ccc34a1f848142e675a97d7b441bd809af78775f5195862c086259bcd5388580ae165f787065383000650876623e10f67bd766eea14
7
- data.tar.gz: 7e7e93b23714967cd5064de4fb6029b6ff275c236564723ed828aaa2ea0bfc2ec79f8b90da2f03eef86fef2f6a6701f1f532e01bbe1178ffe8946b2329d56a2e
6
+ metadata.gz: b04b76d74f713fc591ff8c19b816666763675dc1c974861b4c6ff952b4c0c23b7390fe8c334702cb9d4842275e7e803236bfd14ee61dd819e285ff57dffea740
7
+ data.tar.gz: aca9d9fae397f42da6687b36a182f0a13714da6a8285ae9d4c8ee318389ca354dd3019f8d1fef8ed055a62a9f00c68b58469d6079607d43e7b0452c1af286096
@@ -1373,6 +1373,7 @@
1373
1373
 
1374
1374
  0.5pt solid black
1375
1375
 
1376
+
1376
1377
  </xsl:variable>
1377
1378
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1378
1379
 
@@ -1659,6 +1660,7 @@
1659
1660
  <xsl:attribute-set name="term-name-style">
1660
1661
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1661
1662
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1663
+
1662
1664
  </xsl:attribute-set>
1663
1665
 
1664
1666
  <xsl:attribute-set name="figure-block-style">
@@ -2609,7 +2611,7 @@
2609
2611
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2610
2612
  </xsl:when>
2611
2613
  <xsl:otherwise>
2612
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
2614
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2613
2615
  </xsl:otherwise>
2614
2616
  </xsl:choose>
2615
2617
 
@@ -3112,7 +3114,7 @@
3112
3114
  <xsl:param name="colwidths"/>
3113
3115
  <xsl:param name="colgroup"/>
3114
3116
 
3115
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3117
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3116
3118
 
3117
3119
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3118
3120
 
@@ -3180,6 +3182,7 @@
3180
3182
 
3181
3183
  <!-- except gb and bsi -->
3182
3184
 
3185
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3183
3186
  <xsl:apply-templates select="../*[local-name()='note']"/>
3184
3187
 
3185
3188
  <xsl:variable name="isDisplayRowSeparator">
@@ -3305,7 +3308,7 @@
3305
3308
  <!-- ===================== -->
3306
3309
  <!-- Table's row processing -->
3307
3310
  <!-- ===================== -->
3308
- <!-- row in table header (thead) -->
3311
+ <!-- row in table header (thead) thead/tr -->
3309
3312
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3310
3313
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3311
3314
 
@@ -3339,7 +3342,7 @@
3339
3342
  </xsl:choose>
3340
3343
  </xsl:template>
3341
3344
 
3342
- <!-- row in table footer (tfoot) -->
3345
+ <!-- row in table footer (tfoot), tfoot/tr -->
3343
3346
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3344
3347
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3345
3348
 
@@ -3815,6 +3818,8 @@
3815
3818
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3816
3819
  <fo:block-container>
3817
3820
 
3821
+ <xsl:call-template name="setBlockSpanAll"/>
3822
+
3818
3823
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3819
3824
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3820
3825
  </xsl:if>
@@ -5955,13 +5960,17 @@
5955
5960
  </xsl:template>
5956
5961
 
5957
5962
  <xsl:template match="*[local-name() = 'callout']">
5958
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5963
+ <xsl:choose>
5964
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5965
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5966
+ </xsl:choose>
5959
5967
  </xsl:template>
5960
5968
 
5961
5969
  <xsl:template match="*[local-name() = 'annotation']">
5962
5970
  <xsl:variable name="annotation-id" select="@id"/>
5963
5971
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5964
5972
  <fo:block id="{$annotation-id}" white-space="nowrap">
5973
+
5965
5974
  <fo:inline>
5966
5975
  <xsl:apply-templates>
5967
5976
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -6066,6 +6075,10 @@
6066
6075
  <!-- ====== -->
6067
6076
  <!-- ====== -->
6068
6077
 
6078
+ <xsl:template name="setBlockSpanAll">
6079
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
6080
+ </xsl:template>
6081
+
6069
6082
  <!-- ====== -->
6070
6083
  <!-- note -->
6071
6084
  <!-- termnote -->
@@ -6075,6 +6088,8 @@
6075
6088
 
6076
6089
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6077
6090
 
6091
+ <xsl:call-template name="setBlockSpanAll"/>
6092
+
6078
6093
  <fo:block-container margin-left="0mm" margin-right="0mm">
6079
6094
 
6080
6095
  <fo:block>
@@ -6125,6 +6140,8 @@
6125
6140
  <xsl:template match="*[local-name() = 'termnote']">
6126
6141
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6127
6142
 
6143
+ <xsl:call-template name="setBlockSpanAll"/>
6144
+
6128
6145
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6129
6146
 
6130
6147
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -8035,6 +8052,9 @@
8035
8052
  <!-- ====== -->
8036
8053
  <xsl:template match="*[local-name() = 'termexample']">
8037
8054
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8055
+
8056
+ <xsl:call-template name="setBlockSpanAll"/>
8057
+
8038
8058
  <xsl:apply-templates select="*[local-name()='name']"/>
8039
8059
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8040
8060
  </fo:block>
@@ -8086,6 +8106,8 @@
8086
8106
 
8087
8107
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
8088
8108
 
8109
+ <xsl:call-template name="setBlockSpanAll"/>
8110
+
8089
8111
  <xsl:variable name="fo_element">
8090
8112
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8091
8113
  inline
@@ -8113,6 +8135,35 @@
8113
8135
  </fo:block-container>
8114
8136
  </xsl:when> <!-- end block -->
8115
8137
 
8138
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8139
+
8140
+ <xsl:variable name="provisional_distance_between_starts">
8141
+ 7
8142
+ </xsl:variable>
8143
+ <xsl:variable name="indent">
8144
+ 0
8145
+ </xsl:variable>
8146
+
8147
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8148
+ <fo:list-item>
8149
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8150
+ <fo:block>
8151
+ <xsl:apply-templates select="*[local-name()='name']">
8152
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8153
+ </xsl:apply-templates>
8154
+ </fo:block>
8155
+ </fo:list-item-label>
8156
+ <fo:list-item-body start-indent="body-start()">
8157
+ <fo:block>
8158
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8159
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8160
+ </xsl:apply-templates>
8161
+ </fo:block>
8162
+ </fo:list-item-body>
8163
+ </fo:list-item>
8164
+ </fo:list-block>
8165
+ </xsl:when> <!-- end list -->
8166
+
8116
8167
  <xsl:otherwise> <!-- inline -->
8117
8168
 
8118
8169
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8188,6 +8239,11 @@
8188
8239
  </fo:block>
8189
8240
  </fo:block-container>
8190
8241
  </xsl:when>
8242
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8243
+ <fo:block xsl:use-attribute-sets="example-p-style">
8244
+ <xsl:apply-templates/>
8245
+ </fo:block>
8246
+ </xsl:when>
8191
8247
  <xsl:otherwise>
8192
8248
  <fo:inline xsl:use-attribute-sets="example-p-style">
8193
8249
  <xsl:apply-templates/>
@@ -8305,6 +8361,9 @@
8305
8361
  <!-- ====== -->
8306
8362
  <xsl:template match="*[local-name() = 'quote']">
8307
8363
  <fo:block-container margin-left="0mm">
8364
+
8365
+ <xsl:call-template name="setBlockSpanAll"/>
8366
+
8308
8367
  <xsl:if test="parent::*[local-name() = 'note']">
8309
8368
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8310
8369
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8591,6 +8650,8 @@
8591
8650
  <fo:block>
8592
8651
  <xsl:call-template name="setId"/>
8593
8652
 
8653
+ <xsl:call-template name="setBlockSpanAll"/>
8654
+
8594
8655
  <xsl:apply-templates/>
8595
8656
  </fo:block>
8596
8657
  </xsl:template>
@@ -8605,6 +8666,8 @@
8605
8666
  <fo:block break-after="page"/>
8606
8667
  <fo:block id="{@id}">
8607
8668
 
8669
+ <xsl:call-template name="setBlockSpanAll"/>
8670
+
8608
8671
  </fo:block>
8609
8672
  <xsl:apply-templates/>
8610
8673
  </xsl:template>
@@ -9564,6 +9627,8 @@
9564
9627
  <!-- text in the box -->
9565
9628
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9566
9629
 
9630
+ <xsl:call-template name="setBlockSpanAll"/>
9631
+
9567
9632
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9568
9633
 
9569
9634
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -9739,6 +9804,16 @@
9739
9804
  <xsl:apply-templates mode="update_xml_step1"/>
9740
9805
  </xsl:copy>
9741
9806
  </xsl:template>
9807
+
9808
+ <!-- remove semantic xml -->
9809
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9810
+
9811
+ <!-- remove image/emf -->
9812
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9813
+
9814
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9815
+ <xsl:copy-of select="."/>
9816
+ </xsl:template>
9742
9817
  <!-- =========================================================================== -->
9743
9818
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9744
9819
  <!-- =========================================================================== -->
@@ -9760,7 +9835,7 @@
9760
9835
 
9761
9836
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9762
9837
 
9763
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9838
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9764
9839
 
9765
9840
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9766
9841
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9834,6 +9909,10 @@
9834
9909
 
9835
9910
  </xsl:template>
9836
9911
 
9912
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9913
+ <xsl:copy-of select="."/>
9914
+ </xsl:template>
9915
+
9837
9916
  <xsl:template name="replace_text_tags">
9838
9917
  <xsl:param name="tag_open"/>
9839
9918
  <xsl:param name="tag_close"/>
@@ -9860,6 +9939,194 @@
9860
9939
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9861
9940
  <!-- ===================================== -->
9862
9941
 
9942
+ <!-- ===================================== -->
9943
+ <!-- ===================================== -->
9944
+ <!-- Make linear XML (need for landscape orientation) -->
9945
+ <!-- ===================================== -->
9946
+ <!-- ===================================== -->
9947
+ <xsl:template match="@*|node()" mode="linear_xml">
9948
+ <xsl:copy>
9949
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9950
+ </xsl:copy>
9951
+ </xsl:template>
9952
+
9953
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9954
+ <xsl:copy-of select="."/>
9955
+ </xsl:template>
9956
+
9957
+ <!-- From:
9958
+ <clause>
9959
+ <title>...</title>
9960
+ <p>...</p>
9961
+ </clause>
9962
+ To:
9963
+ <clause/>
9964
+ <title>...</title>
9965
+ <p>...</p>
9966
+ -->
9967
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
9968
+
9969
+ <xsl:copy>
9970
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9971
+
9972
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9973
+
9974
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
9975
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9976
+ </xsl:if>
9977
+ </xsl:copy>
9978
+
9979
+ <xsl:apply-templates mode="linear_xml"/>
9980
+ </xsl:template>
9981
+
9982
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9983
+ <xsl:copy>
9984
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9985
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9986
+ <xsl:variable name="level">
9987
+ <xsl:call-template name="getLevel"/>
9988
+ </xsl:variable>
9989
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9990
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9991
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9992
+ </xsl:copy>
9993
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9994
+ </xsl:template>
9995
+
9996
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
9997
+ <xsl:copy>
9998
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9999
+
10000
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10001
+
10002
+ <xsl:variable name="level">
10003
+ <xsl:call-template name="getLevel"/>
10004
+ </xsl:variable>
10005
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10006
+
10007
+ <xsl:if test="parent::*[local-name() = 'annex']">
10008
+ <xsl:attribute name="depth">1</xsl:attribute>
10009
+ </xsl:if>
10010
+
10011
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
10012
+ <xsl:copy-of select="../@inline-header"/>
10013
+ </xsl:if>
10014
+
10015
+ <xsl:attribute name="ancestor">
10016
+ <xsl:choose>
10017
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
10018
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
10019
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
10020
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
10021
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
10022
+ </xsl:choose>
10023
+ </xsl:attribute>
10024
+
10025
+ <xsl:apply-templates mode="linear_xml"/>
10026
+ </xsl:copy>
10027
+ </xsl:template>
10028
+
10029
+ <!-- add @to = figure, table, clause -->
10030
+ <!-- add @depth = from -->
10031
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
10032
+ <xsl:copy>
10033
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10034
+ <xsl:variable name="target" select="@target"/>
10035
+ <xsl:attribute name="to">
10036
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
10037
+ </xsl:attribute>
10038
+ <xsl:attribute name="depth">
10039
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
10040
+ </xsl:attribute>
10041
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10042
+ </xsl:copy>
10043
+ </xsl:template>
10044
+
10045
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
10046
+ <xsl:choose>
10047
+ <xsl:when test="contains(., $non_breaking_hyphen)">
10048
+ <xsl:call-template name="replaceChar">
10049
+ <xsl:with-param name="text" select="."/>
10050
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
10051
+ <xsl:with-param name="by" select="'-'"/>
10052
+ </xsl:call-template>
10053
+ </xsl:when>
10054
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10055
+ </xsl:choose>
10056
+ </xsl:template>
10057
+
10058
+ <xsl:template name="replaceChar">
10059
+ <xsl:param name="text"/>
10060
+ <xsl:param name="replace"/>
10061
+ <xsl:param name="by"/>
10062
+ <xsl:choose>
10063
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
10064
+ <xsl:value-of select="$text"/>
10065
+ </xsl:when>
10066
+ <xsl:when test="contains($text, $replace)">
10067
+ <xsl:value-of select="substring-before($text,$replace)"/>
10068
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10069
+ <xsl:call-template name="replaceChar">
10070
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10071
+ <xsl:with-param name="replace" select="$replace"/>
10072
+ <xsl:with-param name="by" select="$by"/>
10073
+ </xsl:call-template>
10074
+ </xsl:when>
10075
+ <xsl:otherwise>
10076
+ <xsl:value-of select="$text"/>
10077
+ </xsl:otherwise>
10078
+ </xsl:choose>
10079
+ </xsl:template>
10080
+
10081
+ <xsl:template match="*[local-name() = 'inlineChar']">
10082
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10083
+ </xsl:template>
10084
+
10085
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10086
+ <!--
10087
+ <fn reference="1">
10088
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10089
+ </fn>
10090
+ -->
10091
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
10092
+ <xsl:variable name="p_fn_">
10093
+ <xsl:call-template name="get_fn_list"/>
10094
+ </xsl:variable>
10095
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10096
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10097
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10098
+ <xsl:variable name="reference" select="@reference"/>
10099
+ <!-- fn sequence number in document -->
10100
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10101
+
10102
+ <xsl:copy>
10103
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10104
+ <!-- put actual reference number -->
10105
+ <xsl:attribute name="current_fn_number">
10106
+ <xsl:value-of select="$current_fn_number"/>
10107
+ </xsl:attribute>
10108
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10109
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10110
+ </xsl:attribute>
10111
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10112
+ </xsl:copy>
10113
+ </xsl:template>
10114
+
10115
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10116
+ <xsl:copy>
10117
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10118
+ <xsl:if test="@depth = '1'">
10119
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10120
+ </xsl:if>
10121
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10122
+ </xsl:copy>
10123
+ </xsl:template>
10124
+ <!-- ===================================== -->
10125
+ <!-- ===================================== -->
10126
+ <!-- END: Make linear XML (need for landscape orientation) -->
10127
+ <!-- ===================================== -->
10128
+ <!-- ===================================== -->
10129
+
9863
10130
  <!-- for correct rendering combining chars -->
9864
10131
  <xsl:template match="*[local-name() = 'lang_none']">
9865
10132
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
@@ -1373,6 +1373,7 @@
1373
1373
 
1374
1374
  0.5pt solid black
1375
1375
 
1376
+
1376
1377
  </xsl:variable>
1377
1378
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
1378
1379
 
@@ -1659,6 +1660,7 @@
1659
1660
  <xsl:attribute-set name="term-name-style">
1660
1661
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1661
1662
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1663
+
1662
1664
  </xsl:attribute-set>
1663
1665
 
1664
1666
  <xsl:attribute-set name="figure-block-style">
@@ -2609,7 +2611,7 @@
2609
2611
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2610
2612
  </xsl:when>
2611
2613
  <xsl:otherwise>
2612
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
2614
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2613
2615
  </xsl:otherwise>
2614
2616
  </xsl:choose>
2615
2617
 
@@ -3112,7 +3114,7 @@
3112
3114
  <xsl:param name="colwidths"/>
3113
3115
  <xsl:param name="colgroup"/>
3114
3116
 
3115
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3117
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3116
3118
 
3117
3119
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3118
3120
 
@@ -3180,6 +3182,7 @@
3180
3182
 
3181
3183
  <!-- except gb and bsi -->
3182
3184
 
3185
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3183
3186
  <xsl:apply-templates select="../*[local-name()='note']"/>
3184
3187
 
3185
3188
  <xsl:variable name="isDisplayRowSeparator">
@@ -3305,7 +3308,7 @@
3305
3308
  <!-- ===================== -->
3306
3309
  <!-- Table's row processing -->
3307
3310
  <!-- ===================== -->
3308
- <!-- row in table header (thead) -->
3311
+ <!-- row in table header (thead) thead/tr -->
3309
3312
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3310
3313
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3311
3314
 
@@ -3339,7 +3342,7 @@
3339
3342
  </xsl:choose>
3340
3343
  </xsl:template>
3341
3344
 
3342
- <!-- row in table footer (tfoot) -->
3345
+ <!-- row in table footer (tfoot), tfoot/tr -->
3343
3346
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3344
3347
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3345
3348
 
@@ -3815,6 +3818,8 @@
3815
3818
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3816
3819
  <fo:block-container>
3817
3820
 
3821
+ <xsl:call-template name="setBlockSpanAll"/>
3822
+
3818
3823
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3819
3824
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3820
3825
  </xsl:if>
@@ -5955,13 +5960,17 @@
5955
5960
  </xsl:template>
5956
5961
 
5957
5962
  <xsl:template match="*[local-name() = 'callout']">
5958
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5963
+ <xsl:choose>
5964
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5965
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5966
+ </xsl:choose>
5959
5967
  </xsl:template>
5960
5968
 
5961
5969
  <xsl:template match="*[local-name() = 'annotation']">
5962
5970
  <xsl:variable name="annotation-id" select="@id"/>
5963
5971
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5964
5972
  <fo:block id="{$annotation-id}" white-space="nowrap">
5973
+
5965
5974
  <fo:inline>
5966
5975
  <xsl:apply-templates>
5967
5976
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -6066,6 +6075,10 @@
6066
6075
  <!-- ====== -->
6067
6076
  <!-- ====== -->
6068
6077
 
6078
+ <xsl:template name="setBlockSpanAll">
6079
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
6080
+ </xsl:template>
6081
+
6069
6082
  <!-- ====== -->
6070
6083
  <!-- note -->
6071
6084
  <!-- termnote -->
@@ -6075,6 +6088,8 @@
6075
6088
 
6076
6089
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6077
6090
 
6091
+ <xsl:call-template name="setBlockSpanAll"/>
6092
+
6078
6093
  <fo:block-container margin-left="0mm" margin-right="0mm">
6079
6094
 
6080
6095
  <fo:block>
@@ -6125,6 +6140,8 @@
6125
6140
  <xsl:template match="*[local-name() = 'termnote']">
6126
6141
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6127
6142
 
6143
+ <xsl:call-template name="setBlockSpanAll"/>
6144
+
6128
6145
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6129
6146
 
6130
6147
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -8035,6 +8052,9 @@
8035
8052
  <!-- ====== -->
8036
8053
  <xsl:template match="*[local-name() = 'termexample']">
8037
8054
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8055
+
8056
+ <xsl:call-template name="setBlockSpanAll"/>
8057
+
8038
8058
  <xsl:apply-templates select="*[local-name()='name']"/>
8039
8059
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8040
8060
  </fo:block>
@@ -8086,6 +8106,8 @@
8086
8106
 
8087
8107
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
8088
8108
 
8109
+ <xsl:call-template name="setBlockSpanAll"/>
8110
+
8089
8111
  <xsl:variable name="fo_element">
8090
8112
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8091
8113
  inline
@@ -8113,6 +8135,35 @@
8113
8135
  </fo:block-container>
8114
8136
  </xsl:when> <!-- end block -->
8115
8137
 
8138
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8139
+
8140
+ <xsl:variable name="provisional_distance_between_starts">
8141
+ 7
8142
+ </xsl:variable>
8143
+ <xsl:variable name="indent">
8144
+ 0
8145
+ </xsl:variable>
8146
+
8147
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8148
+ <fo:list-item>
8149
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8150
+ <fo:block>
8151
+ <xsl:apply-templates select="*[local-name()='name']">
8152
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8153
+ </xsl:apply-templates>
8154
+ </fo:block>
8155
+ </fo:list-item-label>
8156
+ <fo:list-item-body start-indent="body-start()">
8157
+ <fo:block>
8158
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8159
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8160
+ </xsl:apply-templates>
8161
+ </fo:block>
8162
+ </fo:list-item-body>
8163
+ </fo:list-item>
8164
+ </fo:list-block>
8165
+ </xsl:when> <!-- end list -->
8166
+
8116
8167
  <xsl:otherwise> <!-- inline -->
8117
8168
 
8118
8169
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8188,6 +8239,11 @@
8188
8239
  </fo:block>
8189
8240
  </fo:block-container>
8190
8241
  </xsl:when>
8242
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8243
+ <fo:block xsl:use-attribute-sets="example-p-style">
8244
+ <xsl:apply-templates/>
8245
+ </fo:block>
8246
+ </xsl:when>
8191
8247
  <xsl:otherwise>
8192
8248
  <fo:inline xsl:use-attribute-sets="example-p-style">
8193
8249
  <xsl:apply-templates/>
@@ -8305,6 +8361,9 @@
8305
8361
  <!-- ====== -->
8306
8362
  <xsl:template match="*[local-name() = 'quote']">
8307
8363
  <fo:block-container margin-left="0mm">
8364
+
8365
+ <xsl:call-template name="setBlockSpanAll"/>
8366
+
8308
8367
  <xsl:if test="parent::*[local-name() = 'note']">
8309
8368
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8310
8369
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8591,6 +8650,8 @@
8591
8650
  <fo:block>
8592
8651
  <xsl:call-template name="setId"/>
8593
8652
 
8653
+ <xsl:call-template name="setBlockSpanAll"/>
8654
+
8594
8655
  <xsl:apply-templates/>
8595
8656
  </fo:block>
8596
8657
  </xsl:template>
@@ -8605,6 +8666,8 @@
8605
8666
  <fo:block break-after="page"/>
8606
8667
  <fo:block id="{@id}">
8607
8668
 
8669
+ <xsl:call-template name="setBlockSpanAll"/>
8670
+
8608
8671
  </fo:block>
8609
8672
  <xsl:apply-templates/>
8610
8673
  </xsl:template>
@@ -9564,6 +9627,8 @@
9564
9627
  <!-- text in the box -->
9565
9628
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9566
9629
 
9630
+ <xsl:call-template name="setBlockSpanAll"/>
9631
+
9567
9632
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9568
9633
 
9569
9634
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -9739,6 +9804,16 @@
9739
9804
  <xsl:apply-templates mode="update_xml_step1"/>
9740
9805
  </xsl:copy>
9741
9806
  </xsl:template>
9807
+
9808
+ <!-- remove semantic xml -->
9809
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9810
+
9811
+ <!-- remove image/emf -->
9812
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9813
+
9814
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9815
+ <xsl:copy-of select="."/>
9816
+ </xsl:template>
9742
9817
  <!-- =========================================================================== -->
9743
9818
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9744
9819
  <!-- =========================================================================== -->
@@ -9760,7 +9835,7 @@
9760
9835
 
9761
9836
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9762
9837
 
9763
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9838
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9764
9839
 
9765
9840
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9766
9841
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9834,6 +9909,10 @@
9834
9909
 
9835
9910
  </xsl:template>
9836
9911
 
9912
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9913
+ <xsl:copy-of select="."/>
9914
+ </xsl:template>
9915
+
9837
9916
  <xsl:template name="replace_text_tags">
9838
9917
  <xsl:param name="tag_open"/>
9839
9918
  <xsl:param name="tag_close"/>
@@ -9860,6 +9939,194 @@
9860
9939
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9861
9940
  <!-- ===================================== -->
9862
9941
 
9942
+ <!-- ===================================== -->
9943
+ <!-- ===================================== -->
9944
+ <!-- Make linear XML (need for landscape orientation) -->
9945
+ <!-- ===================================== -->
9946
+ <!-- ===================================== -->
9947
+ <xsl:template match="@*|node()" mode="linear_xml">
9948
+ <xsl:copy>
9949
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9950
+ </xsl:copy>
9951
+ </xsl:template>
9952
+
9953
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9954
+ <xsl:copy-of select="."/>
9955
+ </xsl:template>
9956
+
9957
+ <!-- From:
9958
+ <clause>
9959
+ <title>...</title>
9960
+ <p>...</p>
9961
+ </clause>
9962
+ To:
9963
+ <clause/>
9964
+ <title>...</title>
9965
+ <p>...</p>
9966
+ -->
9967
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
9968
+
9969
+ <xsl:copy>
9970
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9971
+
9972
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9973
+
9974
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
9975
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9976
+ </xsl:if>
9977
+ </xsl:copy>
9978
+
9979
+ <xsl:apply-templates mode="linear_xml"/>
9980
+ </xsl:template>
9981
+
9982
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9983
+ <xsl:copy>
9984
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9985
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9986
+ <xsl:variable name="level">
9987
+ <xsl:call-template name="getLevel"/>
9988
+ </xsl:variable>
9989
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9990
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9991
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9992
+ </xsl:copy>
9993
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9994
+ </xsl:template>
9995
+
9996
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
9997
+ <xsl:copy>
9998
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9999
+
10000
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10001
+
10002
+ <xsl:variable name="level">
10003
+ <xsl:call-template name="getLevel"/>
10004
+ </xsl:variable>
10005
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10006
+
10007
+ <xsl:if test="parent::*[local-name() = 'annex']">
10008
+ <xsl:attribute name="depth">1</xsl:attribute>
10009
+ </xsl:if>
10010
+
10011
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
10012
+ <xsl:copy-of select="../@inline-header"/>
10013
+ </xsl:if>
10014
+
10015
+ <xsl:attribute name="ancestor">
10016
+ <xsl:choose>
10017
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
10018
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
10019
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
10020
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
10021
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
10022
+ </xsl:choose>
10023
+ </xsl:attribute>
10024
+
10025
+ <xsl:apply-templates mode="linear_xml"/>
10026
+ </xsl:copy>
10027
+ </xsl:template>
10028
+
10029
+ <!-- add @to = figure, table, clause -->
10030
+ <!-- add @depth = from -->
10031
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
10032
+ <xsl:copy>
10033
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10034
+ <xsl:variable name="target" select="@target"/>
10035
+ <xsl:attribute name="to">
10036
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
10037
+ </xsl:attribute>
10038
+ <xsl:attribute name="depth">
10039
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
10040
+ </xsl:attribute>
10041
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10042
+ </xsl:copy>
10043
+ </xsl:template>
10044
+
10045
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
10046
+ <xsl:choose>
10047
+ <xsl:when test="contains(., $non_breaking_hyphen)">
10048
+ <xsl:call-template name="replaceChar">
10049
+ <xsl:with-param name="text" select="."/>
10050
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
10051
+ <xsl:with-param name="by" select="'-'"/>
10052
+ </xsl:call-template>
10053
+ </xsl:when>
10054
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10055
+ </xsl:choose>
10056
+ </xsl:template>
10057
+
10058
+ <xsl:template name="replaceChar">
10059
+ <xsl:param name="text"/>
10060
+ <xsl:param name="replace"/>
10061
+ <xsl:param name="by"/>
10062
+ <xsl:choose>
10063
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
10064
+ <xsl:value-of select="$text"/>
10065
+ </xsl:when>
10066
+ <xsl:when test="contains($text, $replace)">
10067
+ <xsl:value-of select="substring-before($text,$replace)"/>
10068
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10069
+ <xsl:call-template name="replaceChar">
10070
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10071
+ <xsl:with-param name="replace" select="$replace"/>
10072
+ <xsl:with-param name="by" select="$by"/>
10073
+ </xsl:call-template>
10074
+ </xsl:when>
10075
+ <xsl:otherwise>
10076
+ <xsl:value-of select="$text"/>
10077
+ </xsl:otherwise>
10078
+ </xsl:choose>
10079
+ </xsl:template>
10080
+
10081
+ <xsl:template match="*[local-name() = 'inlineChar']">
10082
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10083
+ </xsl:template>
10084
+
10085
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10086
+ <!--
10087
+ <fn reference="1">
10088
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10089
+ </fn>
10090
+ -->
10091
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
10092
+ <xsl:variable name="p_fn_">
10093
+ <xsl:call-template name="get_fn_list"/>
10094
+ </xsl:variable>
10095
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10096
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10097
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10098
+ <xsl:variable name="reference" select="@reference"/>
10099
+ <!-- fn sequence number in document -->
10100
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10101
+
10102
+ <xsl:copy>
10103
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10104
+ <!-- put actual reference number -->
10105
+ <xsl:attribute name="current_fn_number">
10106
+ <xsl:value-of select="$current_fn_number"/>
10107
+ </xsl:attribute>
10108
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10109
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10110
+ </xsl:attribute>
10111
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10112
+ </xsl:copy>
10113
+ </xsl:template>
10114
+
10115
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10116
+ <xsl:copy>
10117
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10118
+ <xsl:if test="@depth = '1'">
10119
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10120
+ </xsl:if>
10121
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10122
+ </xsl:copy>
10123
+ </xsl:template>
10124
+ <!-- ===================================== -->
10125
+ <!-- ===================================== -->
10126
+ <!-- END: Make linear XML (need for landscape orientation) -->
10127
+ <!-- ===================================== -->
10128
+ <!-- ===================================== -->
10129
+
9863
10130
  <!-- for correct rendering combining chars -->
9864
10131
  <xsl:template match="*[local-name() = 'lang_none']">
9865
10132
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.7.6".freeze
3
+ VERSION = "0.7.7".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-13 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic