metanorma-bipm 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e96a623225f4f8d6f640f777b05d43831cf9ee6c4a4e424d7e98ef61db445c1
4
- data.tar.gz: '054296b0327fa20b536220d12622275b01b0418802525e57d43b558a0863858a'
3
+ metadata.gz: aa230620357f920249eabd398c0ff5ba7d466a84e0ab618f74d2ba9cb49d111f
4
+ data.tar.gz: f76edf3fc5a2acc792664bf728e3ba66c929e72602c9589250cd4ea0ef89e48c
5
5
  SHA512:
6
- metadata.gz: ec319451abc25e832c5829070895854fa3273ce9cfe2c154d6653ff7edae15158b59e8cf807171db1455c7825a2bdeaa2a39fc6dace80c2a2b1c1e65cdc1032d
7
- data.tar.gz: bfda50e8c689d5a8c7581fe52e0979877b6cf96906e986a6b30f4dd821b45a0dc89307bc1bb0e8240418145fdf6647d72ea549d4d565ff4cd6928033e66ca0b8
6
+ metadata.gz: 24caba048d9114054309d7e93ac6e275c195e1821f4678539bab3585626fede38658d5ade32295334fd8f19f55b6c34f6ae0037cda350a344215fdb73a8f907c
7
+ data.tar.gz: dbc666c0d77b8d29dda0a2f45806a925ee8dfe8a43ad3e042aca15ac070ec42c7ec12bfabbca6e8f065487d457b4dc73efd8ab2892a7095c8a1312f38795b623
@@ -4630,6 +4630,7 @@
4630
4630
  <xsl:attribute-set name="term-name-style">
4631
4631
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4632
4632
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4633
+
4633
4634
  </xsl:attribute-set>
4634
4635
 
4635
4636
  <xsl:attribute-set name="figure-block-style">
@@ -5609,7 +5610,7 @@
5609
5610
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5610
5611
  </xsl:when>
5611
5612
  <xsl:otherwise>
5612
- <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 -->
5613
+ <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 -->
5613
5614
  </xsl:otherwise>
5614
5615
  </xsl:choose>
5615
5616
 
@@ -6129,7 +6130,7 @@
6129
6130
  <xsl:param name="colwidths"/>
6130
6131
  <xsl:param name="colgroup"/>
6131
6132
 
6132
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
6133
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
6133
6134
 
6134
6135
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6135
6136
 
@@ -6207,6 +6208,7 @@
6207
6208
 
6208
6209
  <!-- except gb and bsi -->
6209
6210
 
6211
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
6210
6212
  <xsl:apply-templates select="../*[local-name()='note']"/>
6211
6213
 
6212
6214
  <xsl:variable name="isDisplayRowSeparator">
@@ -6332,7 +6334,7 @@
6332
6334
  <!-- ===================== -->
6333
6335
  <!-- Table's row processing -->
6334
6336
  <!-- ===================== -->
6335
- <!-- row in table header (thead) -->
6337
+ <!-- row in table header (thead) thead/tr -->
6336
6338
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6337
6339
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6338
6340
 
@@ -6366,7 +6368,7 @@
6366
6368
  </xsl:choose>
6367
6369
  </xsl:template>
6368
6370
 
6369
- <!-- row in table footer (tfoot) -->
6371
+ <!-- row in table footer (tfoot), tfoot/tr -->
6370
6372
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6371
6373
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
6372
6374
 
@@ -6901,6 +6903,8 @@
6901
6903
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6902
6904
  <fo:block-container>
6903
6905
 
6906
+ <xsl:call-template name="setBlockSpanAll"/>
6907
+
6904
6908
  <xsl:if test="not(ancestor::*[local-name() = 'li'])">
6905
6909
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
6906
6910
  </xsl:if>
@@ -9004,13 +9008,17 @@
9004
9008
  </xsl:template>
9005
9009
 
9006
9010
  <xsl:template match="*[local-name() = 'callout']">
9007
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
9011
+ <xsl:choose>
9012
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
9013
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
9014
+ </xsl:choose>
9008
9015
  </xsl:template>
9009
9016
 
9010
9017
  <xsl:template match="*[local-name() = 'annotation']">
9011
9018
  <xsl:variable name="annotation-id" select="@id"/>
9012
9019
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
9013
9020
  <fo:block id="{$annotation-id}" white-space="nowrap">
9021
+
9014
9022
  <fo:inline>
9015
9023
  <xsl:apply-templates>
9016
9024
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -9115,6 +9123,10 @@
9115
9123
  <!-- ====== -->
9116
9124
  <!-- ====== -->
9117
9125
 
9126
+ <xsl:template name="setBlockSpanAll">
9127
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
9128
+ </xsl:template>
9129
+
9118
9130
  <!-- ====== -->
9119
9131
  <!-- note -->
9120
9132
  <!-- termnote -->
@@ -9124,6 +9136,8 @@
9124
9136
 
9125
9137
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
9126
9138
 
9139
+ <xsl:call-template name="setBlockSpanAll"/>
9140
+
9127
9141
  <xsl:if test="parent::*[local-name() = 'li']">
9128
9142
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
9129
9143
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
@@ -9186,6 +9200,8 @@
9186
9200
  <xsl:template match="*[local-name() = 'termnote']">
9187
9201
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
9188
9202
 
9203
+ <xsl:call-template name="setBlockSpanAll"/>
9204
+
9189
9205
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9190
9206
 
9191
9207
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -11125,6 +11141,9 @@
11125
11141
  <!-- ====== -->
11126
11142
  <xsl:template match="*[local-name() = 'termexample']">
11127
11143
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
11144
+
11145
+ <xsl:call-template name="setBlockSpanAll"/>
11146
+
11128
11147
  <xsl:apply-templates select="*[local-name()='name']"/>
11129
11148
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
11130
11149
  </fo:block>
@@ -11176,6 +11195,8 @@
11176
11195
 
11177
11196
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
11178
11197
 
11198
+ <xsl:call-template name="setBlockSpanAll"/>
11199
+
11179
11200
  <xsl:variable name="fo_element">
11180
11201
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11181
11202
  block
@@ -11203,6 +11224,35 @@
11203
11224
  </fo:block-container>
11204
11225
  </xsl:when> <!-- end block -->
11205
11226
 
11227
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11228
+
11229
+ <xsl:variable name="provisional_distance_between_starts">
11230
+ 7
11231
+ </xsl:variable>
11232
+ <xsl:variable name="indent">
11233
+ 0
11234
+ </xsl:variable>
11235
+
11236
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11237
+ <fo:list-item>
11238
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11239
+ <fo:block>
11240
+ <xsl:apply-templates select="*[local-name()='name']">
11241
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11242
+ </xsl:apply-templates>
11243
+ </fo:block>
11244
+ </fo:list-item-label>
11245
+ <fo:list-item-body start-indent="body-start()">
11246
+ <fo:block>
11247
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11248
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11249
+ </xsl:apply-templates>
11250
+ </fo:block>
11251
+ </fo:list-item-body>
11252
+ </fo:list-item>
11253
+ </fo:list-block>
11254
+ </xsl:when> <!-- end list -->
11255
+
11206
11256
  <xsl:otherwise> <!-- inline -->
11207
11257
 
11208
11258
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -11278,6 +11328,11 @@
11278
11328
  </fo:block>
11279
11329
  </fo:block-container>
11280
11330
  </xsl:when>
11331
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
11332
+ <fo:block xsl:use-attribute-sets="example-p-style">
11333
+ <xsl:apply-templates/>
11334
+ </fo:block>
11335
+ </xsl:when>
11281
11336
  <xsl:otherwise>
11282
11337
  <fo:inline xsl:use-attribute-sets="example-p-style">
11283
11338
  <xsl:apply-templates/>
@@ -11395,6 +11450,9 @@
11395
11450
  <!-- ====== -->
11396
11451
  <xsl:template match="*[local-name() = 'quote']">
11397
11452
  <fo:block-container margin-left="0mm">
11453
+
11454
+ <xsl:call-template name="setBlockSpanAll"/>
11455
+
11398
11456
  <xsl:if test="parent::*[local-name() = 'note']">
11399
11457
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
11400
11458
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -11686,6 +11744,8 @@
11686
11744
  <fo:block>
11687
11745
  <xsl:call-template name="setId"/>
11688
11746
 
11747
+ <xsl:call-template name="setBlockSpanAll"/>
11748
+
11689
11749
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
11690
11750
 
11691
11751
  <xsl:apply-templates/>
@@ -11702,6 +11762,8 @@
11702
11762
  <fo:block break-after="page"/>
11703
11763
  <fo:block id="{@id}">
11704
11764
 
11765
+ <xsl:call-template name="setBlockSpanAll"/>
11766
+
11705
11767
  </fo:block>
11706
11768
  <xsl:apply-templates/>
11707
11769
  </xsl:template>
@@ -12654,6 +12716,8 @@
12654
12716
  <!-- text in the box -->
12655
12717
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12656
12718
 
12719
+ <xsl:call-template name="setBlockSpanAll"/>
12720
+
12657
12721
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
12658
12722
 
12659
12723
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -12832,6 +12896,16 @@
12832
12896
  <xsl:apply-templates mode="update_xml_step1"/>
12833
12897
  </xsl:copy>
12834
12898
  </xsl:template>
12899
+
12900
+ <!-- remove semantic xml -->
12901
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12902
+
12903
+ <!-- remove image/emf -->
12904
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12905
+
12906
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
12907
+ <xsl:copy-of select="."/>
12908
+ </xsl:template>
12835
12909
  <!-- =========================================================================== -->
12836
12910
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12837
12911
  <!-- =========================================================================== -->
@@ -12853,7 +12927,7 @@
12853
12927
 
12854
12928
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12855
12929
 
12856
- <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">
12930
+ <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">
12857
12931
 
12858
12932
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12859
12933
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -12927,6 +13001,10 @@
12927
13001
 
12928
13002
  </xsl:template>
12929
13003
 
13004
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
13005
+ <xsl:copy-of select="."/>
13006
+ </xsl:template>
13007
+
12930
13008
  <xsl:template name="replace_text_tags">
12931
13009
  <xsl:param name="tag_open"/>
12932
13010
  <xsl:param name="tag_close"/>
@@ -12953,6 +13031,194 @@
12953
13031
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12954
13032
  <!-- ===================================== -->
12955
13033
 
13034
+ <!-- ===================================== -->
13035
+ <!-- ===================================== -->
13036
+ <!-- Make linear XML (need for landscape orientation) -->
13037
+ <!-- ===================================== -->
13038
+ <!-- ===================================== -->
13039
+ <xsl:template match="@*|node()" mode="linear_xml">
13040
+ <xsl:copy>
13041
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
13042
+ </xsl:copy>
13043
+ </xsl:template>
13044
+
13045
+ <xsl:template match="processing-instruction()" mode="linear_xml">
13046
+ <xsl:copy-of select="."/>
13047
+ </xsl:template>
13048
+
13049
+ <!-- From:
13050
+ <clause>
13051
+ <title>...</title>
13052
+ <p>...</p>
13053
+ </clause>
13054
+ To:
13055
+ <clause/>
13056
+ <title>...</title>
13057
+ <p>...</p>
13058
+ -->
13059
+ <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">
13060
+
13061
+ <xsl:copy>
13062
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13063
+
13064
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13065
+
13066
+ <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'">
13067
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13068
+ </xsl:if>
13069
+ </xsl:copy>
13070
+
13071
+ <xsl:apply-templates mode="linear_xml"/>
13072
+ </xsl:template>
13073
+
13074
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
13075
+ <xsl:copy>
13076
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13077
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13078
+ <xsl:variable name="level">
13079
+ <xsl:call-template name="getLevel"/>
13080
+ </xsl:variable>
13081
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13082
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
13083
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
13084
+ </xsl:copy>
13085
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
13086
+ </xsl:template>
13087
+
13088
+ <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">
13089
+ <xsl:copy>
13090
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13091
+
13092
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13093
+
13094
+ <xsl:variable name="level">
13095
+ <xsl:call-template name="getLevel"/>
13096
+ </xsl:variable>
13097
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13098
+
13099
+ <xsl:if test="parent::*[local-name() = 'annex']">
13100
+ <xsl:attribute name="depth">1</xsl:attribute>
13101
+ </xsl:if>
13102
+
13103
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
13104
+ <xsl:copy-of select="../@inline-header"/>
13105
+ </xsl:if>
13106
+
13107
+ <xsl:attribute name="ancestor">
13108
+ <xsl:choose>
13109
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
13110
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
13111
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
13112
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
13113
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
13114
+ </xsl:choose>
13115
+ </xsl:attribute>
13116
+
13117
+ <xsl:apply-templates mode="linear_xml"/>
13118
+ </xsl:copy>
13119
+ </xsl:template>
13120
+
13121
+ <!-- add @to = figure, table, clause -->
13122
+ <!-- add @depth = from -->
13123
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
13124
+ <xsl:copy>
13125
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13126
+ <xsl:variable name="target" select="@target"/>
13127
+ <xsl:attribute name="to">
13128
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
13129
+ </xsl:attribute>
13130
+ <xsl:attribute name="depth">
13131
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
13132
+ </xsl:attribute>
13133
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13134
+ </xsl:copy>
13135
+ </xsl:template>
13136
+
13137
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
13138
+ <xsl:choose>
13139
+ <xsl:when test="contains(., $non_breaking_hyphen)">
13140
+ <xsl:call-template name="replaceChar">
13141
+ <xsl:with-param name="text" select="."/>
13142
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
13143
+ <xsl:with-param name="by" select="'-'"/>
13144
+ </xsl:call-template>
13145
+ </xsl:when>
13146
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13147
+ </xsl:choose>
13148
+ </xsl:template>
13149
+
13150
+ <xsl:template name="replaceChar">
13151
+ <xsl:param name="text"/>
13152
+ <xsl:param name="replace"/>
13153
+ <xsl:param name="by"/>
13154
+ <xsl:choose>
13155
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
13156
+ <xsl:value-of select="$text"/>
13157
+ </xsl:when>
13158
+ <xsl:when test="contains($text, $replace)">
13159
+ <xsl:value-of select="substring-before($text,$replace)"/>
13160
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
13161
+ <xsl:call-template name="replaceChar">
13162
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
13163
+ <xsl:with-param name="replace" select="$replace"/>
13164
+ <xsl:with-param name="by" select="$by"/>
13165
+ </xsl:call-template>
13166
+ </xsl:when>
13167
+ <xsl:otherwise>
13168
+ <xsl:value-of select="$text"/>
13169
+ </xsl:otherwise>
13170
+ </xsl:choose>
13171
+ </xsl:template>
13172
+
13173
+ <xsl:template match="*[local-name() = 'inlineChar']">
13174
+ <fo:inline><xsl:value-of select="."/></fo:inline>
13175
+ </xsl:template>
13176
+
13177
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
13178
+ <!--
13179
+ <fn reference="1">
13180
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13181
+ </fn>
13182
+ -->
13183
+ <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">
13184
+ <xsl:variable name="p_fn_">
13185
+ <xsl:call-template name="get_fn_list"/>
13186
+ </xsl:variable>
13187
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
13188
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
13189
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
13190
+ <xsl:variable name="reference" select="@reference"/>
13191
+ <!-- fn sequence number in document -->
13192
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
13193
+
13194
+ <xsl:copy>
13195
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13196
+ <!-- put actual reference number -->
13197
+ <xsl:attribute name="current_fn_number">
13198
+ <xsl:value-of select="$current_fn_number"/>
13199
+ </xsl:attribute>
13200
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
13201
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13202
+ </xsl:attribute>
13203
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13204
+ </xsl:copy>
13205
+ </xsl:template>
13206
+
13207
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
13208
+ <xsl:copy>
13209
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13210
+ <xsl:if test="@depth = '1'">
13211
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13212
+ </xsl:if>
13213
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13214
+ </xsl:copy>
13215
+ </xsl:template>
13216
+ <!-- ===================================== -->
13217
+ <!-- ===================================== -->
13218
+ <!-- END: Make linear XML (need for landscape orientation) -->
13219
+ <!-- ===================================== -->
13220
+ <!-- ===================================== -->
13221
+
12956
13222
  <!-- for correct rendering combining chars -->
12957
13223
  <xsl:template match="*[local-name() = 'lang_none']">
12958
13224
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>