metanorma-bipm 2.2.6 → 2.2.8

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: 5e96a623225f4f8d6f640f777b05d43831cf9ee6c4a4e424d7e98ef61db445c1
4
- data.tar.gz: '054296b0327fa20b536220d12622275b01b0418802525e57d43b558a0863858a'
3
+ metadata.gz: 18aade47b63bc0551b4439a34d7d0cb0fd4f5f42bfdb926054c8ba64676d74c1
4
+ data.tar.gz: 8c08b33bfa3563c8e38f7476143de4e30522d69369a24e6155ead528cae370e1
5
5
  SHA512:
6
- metadata.gz: ec319451abc25e832c5829070895854fa3273ce9cfe2c154d6653ff7edae15158b59e8cf807171db1455c7825a2bdeaa2a39fc6dace80c2a2b1c1e65cdc1032d
7
- data.tar.gz: bfda50e8c689d5a8c7581fe52e0979877b6cf96906e986a6b30f4dd821b45a0dc89307bc1bb0e8240418145fdf6647d72ea549d4d565ff4cd6928033e66ca0b8
6
+ metadata.gz: 485d5311a31adb2a4e1ea103e515693253c11c08fa8eb0164c01b59b1ab658d7c8140423f5ee2d7d1f652f9a2b488a3ebaa8abeaf0a475e82382daea11f25f51
7
+ data.tar.gz: 67cb70e9a0da69535856eab4f4b13323df59cb5fd716365124be8ae684ab3631ed6fee79265217f4e61f3b550604d29b5b059ac3a4768f1e7307b060f1a03d25
@@ -4508,11 +4508,17 @@
4508
4508
  <!-- ========================== -->
4509
4509
  <!-- Definition's list styles -->
4510
4510
  <!-- ========================== -->
4511
+
4512
+ <xsl:attribute-set name="dl-block-style">
4513
+
4514
+ </xsl:attribute-set>
4515
+
4511
4516
  <xsl:attribute-set name="dt-row-style">
4512
4517
 
4513
4518
  </xsl:attribute-set>
4514
4519
 
4515
4520
  <xsl:attribute-set name="dt-cell-style">
4521
+
4516
4522
  </xsl:attribute-set>
4517
4523
 
4518
4524
  <xsl:attribute-set name="dt-block-style">
@@ -4532,6 +4538,7 @@
4532
4538
 
4533
4539
  <xsl:attribute-set name="dd-cell-style">
4534
4540
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
4541
+
4535
4542
  </xsl:attribute-set>
4536
4543
 
4537
4544
  <!-- ========================== -->
@@ -4630,6 +4637,7 @@
4630
4637
  <xsl:attribute-set name="term-name-style">
4631
4638
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4632
4639
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4640
+
4633
4641
  </xsl:attribute-set>
4634
4642
 
4635
4643
  <xsl:attribute-set name="figure-block-style">
@@ -4650,6 +4658,10 @@
4650
4658
 
4651
4659
  </xsl:attribute-set>
4652
4660
 
4661
+ <xsl:attribute-set name="figure-source-style">
4662
+
4663
+ </xsl:attribute-set>
4664
+
4653
4665
  <!-- Formula's styles -->
4654
4666
  <xsl:attribute-set name="formula-style">
4655
4667
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -5196,7 +5208,7 @@
5196
5208
 
5197
5209
  <xsl:template name="processTables_Contents">
5198
5210
  <tables>
5199
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5211
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5200
5212
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
5201
5213
  <xsl:copy-of select="*[local-name() = 'name']"/>
5202
5214
  </table>
@@ -5565,7 +5577,7 @@
5565
5577
  </xsl:attribute>
5566
5578
  </xsl:for-each>
5567
5579
 
5568
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
5580
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5569
5581
  <xsl:if test="$isNoteOrFnExist = 'true'">
5570
5582
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5571
5583
  </xsl:if>
@@ -5609,7 +5621,7 @@
5609
5621
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5610
5622
  </xsl:when>
5611
5623
  <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 -->
5624
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5613
5625
  </xsl:otherwise>
5614
5626
  </xsl:choose>
5615
5627
 
@@ -5730,6 +5742,11 @@
5730
5742
  </xsl:if>
5731
5743
  </xsl:template> <!-- table/name -->
5732
5744
 
5745
+ <!-- SOURCE: ... -->
5746
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
5747
+ <xsl:call-template name="termsource"/>
5748
+ </xsl:template>
5749
+
5733
5750
  <xsl:template name="calculate-columns-numbers">
5734
5751
  <xsl:param name="table-row"/>
5735
5752
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -6086,7 +6103,7 @@
6086
6103
  </fo:table-header>
6087
6104
  </xsl:template> <!-- thead -->
6088
6105
 
6089
- <!-- template is using for iso, jcgm, bsi only -->
6106
+ <!-- template is using for iec, iso, jcgm, bsi only -->
6090
6107
  <xsl:template name="table-header-title">
6091
6108
  <xsl:param name="cols-count"/>
6092
6109
  <!-- row for title -->
@@ -6129,7 +6146,7 @@
6129
6146
  <xsl:param name="colwidths"/>
6130
6147
  <xsl:param name="colgroup"/>
6131
6148
 
6132
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
6149
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
6133
6150
 
6134
6151
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6135
6152
 
@@ -6207,7 +6224,9 @@
6207
6224
 
6208
6225
  <!-- except gb and bsi -->
6209
6226
 
6227
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
6210
6228
  <xsl:apply-templates select="../*[local-name()='note']"/>
6229
+ <xsl:apply-templates select="../*[local-name()='source']"/>
6211
6230
 
6212
6231
  <xsl:variable name="isDisplayRowSeparator">
6213
6232
 
@@ -6332,7 +6351,7 @@
6332
6351
  <!-- ===================== -->
6333
6352
  <!-- Table's row processing -->
6334
6353
  <!-- ===================== -->
6335
- <!-- row in table header (thead) -->
6354
+ <!-- row in table header (thead) thead/tr -->
6336
6355
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6337
6356
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6338
6357
 
@@ -6366,7 +6385,7 @@
6366
6385
  </xsl:choose>
6367
6386
  </xsl:template>
6368
6387
 
6369
- <!-- row in table footer (tfoot) -->
6388
+ <!-- row in table footer (tfoot), tfoot/tr -->
6370
6389
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6371
6390
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
6372
6391
 
@@ -6899,7 +6918,9 @@
6899
6918
  <xsl:variable name="isAdded" select="@added"/>
6900
6919
  <xsl:variable name="isDeleted" select="@deleted"/>
6901
6920
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6902
- <fo:block-container>
6921
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
6922
+
6923
+ <xsl:call-template name="setBlockSpanAll"/>
6903
6924
 
6904
6925
  <xsl:if test="not(ancestor::*[local-name() = 'li'])">
6905
6926
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -6908,6 +6929,18 @@
6908
6929
  <xsl:attribute name="margin-left">6.5mm</xsl:attribute><!-- 8 mm -->
6909
6930
  </xsl:if>
6910
6931
 
6932
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
6933
+ <!-- set font-size as sourcecode font-size -->
6934
+ <xsl:variable name="sourcecode_attributes">
6935
+ <xsl:call-template name="get_sourcecode_attributes"/>
6936
+ </xsl:variable>
6937
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
6938
+ <xsl:attribute name="{local-name()}">
6939
+ <xsl:value-of select="."/>
6940
+ </xsl:attribute>
6941
+ </xsl:for-each>
6942
+ </xsl:if>
6943
+
6911
6944
  <xsl:if test="parent::*[local-name() = 'note']">
6912
6945
  <xsl:attribute name="margin-left">
6913
6946
  <xsl:choose>
@@ -7339,6 +7372,7 @@
7339
7372
  <xsl:param name="split_keep-within-line"/>
7340
7373
 
7341
7374
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
7375
+
7342
7376
  <xsl:call-template name="insert_dt_cell">
7343
7377
  <xsl:with-param name="key_iso" select="$key_iso"/>
7344
7378
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -7360,6 +7394,7 @@
7360
7394
  <!-- border is mandatory, to calculate real width -->
7361
7395
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
7362
7396
  <xsl:attribute name="text-align">left</xsl:attribute>
7397
+
7363
7398
  </xsl:if>
7364
7399
 
7365
7400
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -7802,6 +7837,7 @@
7802
7837
  <fo:inline>
7803
7838
  <xsl:for-each select="$styles/style">
7804
7839
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
7840
+
7805
7841
  </xsl:for-each>
7806
7842
  <xsl:apply-templates/>
7807
7843
  </fo:inline>
@@ -9004,13 +9040,17 @@
9004
9040
  </xsl:template>
9005
9041
 
9006
9042
  <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>
9043
+ <xsl:choose>
9044
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
9045
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
9046
+ </xsl:choose>
9008
9047
  </xsl:template>
9009
9048
 
9010
9049
  <xsl:template match="*[local-name() = 'annotation']">
9011
9050
  <xsl:variable name="annotation-id" select="@id"/>
9012
9051
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
9013
9052
  <fo:block id="{$annotation-id}" white-space="nowrap">
9053
+
9014
9054
  <fo:inline>
9015
9055
  <xsl:apply-templates>
9016
9056
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -9115,6 +9155,10 @@
9115
9155
  <!-- ====== -->
9116
9156
  <!-- ====== -->
9117
9157
 
9158
+ <xsl:template name="setBlockSpanAll">
9159
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
9160
+ </xsl:template>
9161
+
9118
9162
  <!-- ====== -->
9119
9163
  <!-- note -->
9120
9164
  <!-- termnote -->
@@ -9124,6 +9168,8 @@
9124
9168
 
9125
9169
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
9126
9170
 
9171
+ <xsl:call-template name="setBlockSpanAll"/>
9172
+
9127
9173
  <xsl:if test="parent::*[local-name() = 'li']">
9128
9174
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
9129
9175
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
@@ -9186,6 +9232,8 @@
9186
9232
  <xsl:template match="*[local-name() = 'termnote']">
9187
9233
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
9188
9234
 
9235
+ <xsl:call-template name="setBlockSpanAll"/>
9236
+
9189
9237
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9190
9238
 
9191
9239
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -9357,6 +9405,13 @@
9357
9405
  </fo:block>
9358
9406
  </xsl:template>
9359
9407
 
9408
+ <!-- SOURCE: ... -->
9409
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
9410
+
9411
+ <xsl:call-template name="termsource"/>
9412
+
9413
+ </xsl:template>
9414
+
9360
9415
  <xsl:template match="*[local-name() = 'image']">
9361
9416
  <xsl:variable name="isAdded" select="../@added"/>
9362
9417
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -10500,9 +10555,11 @@
10500
10555
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10501
10556
  </xsl:if>
10502
10557
 
10503
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10558
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
10504
10559
  </fo:block>
10505
10560
 
10561
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
10562
+
10506
10563
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
10507
10564
 
10508
10565
  </fo:block-container>
@@ -10534,11 +10591,22 @@
10534
10591
  <!-- add sourcecode highlighting -->
10535
10592
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
10536
10593
  <xsl:variable name="class" select="@class"/>
10594
+
10595
+ <!-- Example: <1> -->
10596
+ <xsl:variable name="is_callout">
10597
+ <xsl:if test="parent::*[local-name() = 'dt']">
10598
+ <xsl:variable name="dt_id" select="../@id"/>
10599
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
10600
+ </xsl:if>
10601
+ </xsl:variable>
10602
+
10537
10603
  <xsl:choose>
10538
10604
  <xsl:when test="$sourcecode_css//class[@name = $class]">
10539
10605
  <fo:inline>
10540
10606
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
10607
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
10541
10608
  <xsl:apply-templates/>
10609
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
10542
10610
  </fo:inline>
10543
10611
  </xsl:when>
10544
10612
  <xsl:otherwise>
@@ -10962,6 +11030,10 @@
10962
11030
  </fo:block>
10963
11031
  </xsl:template>
10964
11032
 
11033
+ <xsl:template match="*[local-name() = 'div']">
11034
+ <fo:block><xsl:apply-templates/></fo:block>
11035
+ </xsl:template>
11036
+
10965
11037
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
10966
11038
  <fo:block xsl:use-attribute-sets="inherit-style">
10967
11039
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -11125,6 +11197,9 @@
11125
11197
  <!-- ====== -->
11126
11198
  <xsl:template match="*[local-name() = 'termexample']">
11127
11199
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
11200
+
11201
+ <xsl:call-template name="setBlockSpanAll"/>
11202
+
11128
11203
  <xsl:apply-templates select="*[local-name()='name']"/>
11129
11204
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
11130
11205
  </fo:block>
@@ -11176,6 +11251,8 @@
11176
11251
 
11177
11252
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
11178
11253
 
11254
+ <xsl:call-template name="setBlockSpanAll"/>
11255
+
11179
11256
  <xsl:variable name="fo_element">
11180
11257
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11181
11258
  block
@@ -11203,6 +11280,35 @@
11203
11280
  </fo:block-container>
11204
11281
  </xsl:when> <!-- end block -->
11205
11282
 
11283
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11284
+
11285
+ <xsl:variable name="provisional_distance_between_starts">
11286
+ 7
11287
+ </xsl:variable>
11288
+ <xsl:variable name="indent">
11289
+ 0
11290
+ </xsl:variable>
11291
+
11292
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11293
+ <fo:list-item>
11294
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11295
+ <fo:block>
11296
+ <xsl:apply-templates select="*[local-name()='name']">
11297
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11298
+ </xsl:apply-templates>
11299
+ </fo:block>
11300
+ </fo:list-item-label>
11301
+ <fo:list-item-body start-indent="body-start()">
11302
+ <fo:block>
11303
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11304
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11305
+ </xsl:apply-templates>
11306
+ </fo:block>
11307
+ </fo:list-item-body>
11308
+ </fo:list-item>
11309
+ </fo:list-block>
11310
+ </xsl:when> <!-- end list -->
11311
+
11206
11312
  <xsl:otherwise> <!-- inline -->
11207
11313
 
11208
11314
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -11278,6 +11384,11 @@
11278
11384
  </fo:block>
11279
11385
  </fo:block-container>
11280
11386
  </xsl:when>
11387
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
11388
+ <fo:block xsl:use-attribute-sets="example-p-style">
11389
+ <xsl:apply-templates/>
11390
+ </fo:block>
11391
+ </xsl:when>
11281
11392
  <xsl:otherwise>
11282
11393
  <fo:inline xsl:use-attribute-sets="example-p-style">
11283
11394
  <xsl:apply-templates/>
@@ -11395,6 +11506,9 @@
11395
11506
  <!-- ====== -->
11396
11507
  <xsl:template match="*[local-name() = 'quote']">
11397
11508
  <fo:block-container margin-left="0mm">
11509
+
11510
+ <xsl:call-template name="setBlockSpanAll"/>
11511
+
11398
11512
  <xsl:if test="parent::*[local-name() = 'note']">
11399
11513
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
11400
11514
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -11620,13 +11734,8 @@
11620
11734
  </xsl:template>
11621
11735
 
11622
11736
  <xsl:template match="*[local-name() = 'deprecates']">
11623
- <xsl:variable name="title-deprecated">
11624
- <xsl:call-template name="getLocalizedString">
11625
- <xsl:with-param name="key">deprecated</xsl:with-param>
11626
- </xsl:call-template>
11627
- </xsl:variable>
11628
11737
  <fo:block xsl:use-attribute-sets="deprecates-style">
11629
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
11738
+ <xsl:apply-templates/>
11630
11739
  </fo:block>
11631
11740
  </xsl:template>
11632
11741
 
@@ -11686,6 +11795,8 @@
11686
11795
  <fo:block>
11687
11796
  <xsl:call-template name="setId"/>
11688
11797
 
11798
+ <xsl:call-template name="setBlockSpanAll"/>
11799
+
11689
11800
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
11690
11801
 
11691
11802
  <xsl:apply-templates/>
@@ -11702,6 +11813,8 @@
11702
11813
  <fo:block break-after="page"/>
11703
11814
  <fo:block id="{@id}">
11704
11815
 
11816
+ <xsl:call-template name="setBlockSpanAll"/>
11817
+
11705
11818
  </fo:block>
11706
11819
  <xsl:apply-templates/>
11707
11820
  </xsl:template>
@@ -12654,6 +12767,8 @@
12654
12767
  <!-- text in the box -->
12655
12768
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12656
12769
 
12770
+ <xsl:call-template name="setBlockSpanAll"/>
12771
+
12657
12772
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
12658
12773
 
12659
12774
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -12832,6 +12947,33 @@
12832
12947
  <xsl:apply-templates mode="update_xml_step1"/>
12833
12948
  </xsl:copy>
12834
12949
  </xsl:template>
12950
+
12951
+ <!-- remove semantic xml -->
12952
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12953
+
12954
+ <!-- remove image/emf -->
12955
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12956
+
12957
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
12958
+ <xsl:copy-of select="."/>
12959
+ </xsl:template>
12960
+
12961
+ <!-- add @id, redundant for table auto-layout algorithm -->
12962
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12963
+ <xsl:copy>
12964
+ <xsl:copy-of select="@*"/>
12965
+ <xsl:call-template name="add_id"/>
12966
+ <xsl:apply-templates mode="update_xml_step1"/>
12967
+ </xsl:copy>
12968
+ </xsl:template>
12969
+
12970
+ <xsl:template name="add_id">
12971
+ <xsl:if test="not(@id)">
12972
+ <!-- add @id - first element with @id plus '_element_name' -->
12973
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12974
+ </xsl:if>
12975
+ </xsl:template>
12976
+
12835
12977
  <!-- =========================================================================== -->
12836
12978
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12837
12979
  <!-- =========================================================================== -->
@@ -12853,7 +12995,7 @@
12853
12995
 
12854
12996
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12855
12997
 
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">
12998
+ <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
12999
 
12858
13000
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12859
13001
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -12927,6 +13069,10 @@
12927
13069
 
12928
13070
  </xsl:template>
12929
13071
 
13072
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
13073
+ <xsl:copy-of select="."/>
13074
+ </xsl:template>
13075
+
12930
13076
  <xsl:template name="replace_text_tags">
12931
13077
  <xsl:param name="tag_open"/>
12932
13078
  <xsl:param name="tag_close"/>
@@ -12953,6 +13099,194 @@
12953
13099
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12954
13100
  <!-- ===================================== -->
12955
13101
 
13102
+ <!-- ===================================== -->
13103
+ <!-- ===================================== -->
13104
+ <!-- Make linear XML (need for landscape orientation) -->
13105
+ <!-- ===================================== -->
13106
+ <!-- ===================================== -->
13107
+ <xsl:template match="@*|node()" mode="linear_xml">
13108
+ <xsl:copy>
13109
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
13110
+ </xsl:copy>
13111
+ </xsl:template>
13112
+
13113
+ <xsl:template match="processing-instruction()" mode="linear_xml">
13114
+ <xsl:copy-of select="."/>
13115
+ </xsl:template>
13116
+
13117
+ <!-- From:
13118
+ <clause>
13119
+ <title>...</title>
13120
+ <p>...</p>
13121
+ </clause>
13122
+ To:
13123
+ <clause/>
13124
+ <title>...</title>
13125
+ <p>...</p>
13126
+ -->
13127
+ <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">
13128
+
13129
+ <xsl:copy>
13130
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13131
+
13132
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13133
+
13134
+ <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'">
13135
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13136
+ </xsl:if>
13137
+ </xsl:copy>
13138
+
13139
+ <xsl:apply-templates mode="linear_xml"/>
13140
+ </xsl:template>
13141
+
13142
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
13143
+ <xsl:copy>
13144
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13145
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13146
+ <xsl:variable name="level">
13147
+ <xsl:call-template name="getLevel"/>
13148
+ </xsl:variable>
13149
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13150
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
13151
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
13152
+ </xsl:copy>
13153
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
13154
+ </xsl:template>
13155
+
13156
+ <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">
13157
+ <xsl:copy>
13158
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13159
+
13160
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13161
+
13162
+ <xsl:variable name="level">
13163
+ <xsl:call-template name="getLevel"/>
13164
+ </xsl:variable>
13165
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13166
+
13167
+ <xsl:if test="parent::*[local-name() = 'annex']">
13168
+ <xsl:attribute name="depth">1</xsl:attribute>
13169
+ </xsl:if>
13170
+
13171
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
13172
+ <xsl:copy-of select="../@inline-header"/>
13173
+ </xsl:if>
13174
+
13175
+ <xsl:attribute name="ancestor">
13176
+ <xsl:choose>
13177
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
13178
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
13179
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
13180
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
13181
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
13182
+ </xsl:choose>
13183
+ </xsl:attribute>
13184
+
13185
+ <xsl:apply-templates mode="linear_xml"/>
13186
+ </xsl:copy>
13187
+ </xsl:template>
13188
+
13189
+ <!-- add @to = figure, table, clause -->
13190
+ <!-- add @depth = from -->
13191
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
13192
+ <xsl:copy>
13193
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13194
+ <xsl:variable name="target" select="@target"/>
13195
+ <xsl:attribute name="to">
13196
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
13197
+ </xsl:attribute>
13198
+ <xsl:attribute name="depth">
13199
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
13200
+ </xsl:attribute>
13201
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13202
+ </xsl:copy>
13203
+ </xsl:template>
13204
+
13205
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
13206
+ <xsl:choose>
13207
+ <xsl:when test="contains(., $non_breaking_hyphen)">
13208
+ <xsl:call-template name="replaceChar">
13209
+ <xsl:with-param name="text" select="."/>
13210
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
13211
+ <xsl:with-param name="by" select="'-'"/>
13212
+ </xsl:call-template>
13213
+ </xsl:when>
13214
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13215
+ </xsl:choose>
13216
+ </xsl:template>
13217
+
13218
+ <xsl:template name="replaceChar">
13219
+ <xsl:param name="text"/>
13220
+ <xsl:param name="replace"/>
13221
+ <xsl:param name="by"/>
13222
+ <xsl:choose>
13223
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
13224
+ <xsl:value-of select="$text"/>
13225
+ </xsl:when>
13226
+ <xsl:when test="contains($text, $replace)">
13227
+ <xsl:value-of select="substring-before($text,$replace)"/>
13228
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
13229
+ <xsl:call-template name="replaceChar">
13230
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
13231
+ <xsl:with-param name="replace" select="$replace"/>
13232
+ <xsl:with-param name="by" select="$by"/>
13233
+ </xsl:call-template>
13234
+ </xsl:when>
13235
+ <xsl:otherwise>
13236
+ <xsl:value-of select="$text"/>
13237
+ </xsl:otherwise>
13238
+ </xsl:choose>
13239
+ </xsl:template>
13240
+
13241
+ <xsl:template match="*[local-name() = 'inlineChar']">
13242
+ <fo:inline><xsl:value-of select="."/></fo:inline>
13243
+ </xsl:template>
13244
+
13245
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
13246
+ <!--
13247
+ <fn reference="1">
13248
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13249
+ </fn>
13250
+ -->
13251
+ <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">
13252
+ <xsl:variable name="p_fn_">
13253
+ <xsl:call-template name="get_fn_list"/>
13254
+ </xsl:variable>
13255
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
13256
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
13257
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
13258
+ <xsl:variable name="reference" select="@reference"/>
13259
+ <!-- fn sequence number in document -->
13260
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
13261
+
13262
+ <xsl:copy>
13263
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13264
+ <!-- put actual reference number -->
13265
+ <xsl:attribute name="current_fn_number">
13266
+ <xsl:value-of select="$current_fn_number"/>
13267
+ </xsl:attribute>
13268
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
13269
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13270
+ </xsl:attribute>
13271
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13272
+ </xsl:copy>
13273
+ </xsl:template>
13274
+
13275
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
13276
+ <xsl:copy>
13277
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13278
+ <xsl:if test="@depth = '1'">
13279
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13280
+ </xsl:if>
13281
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13282
+ </xsl:copy>
13283
+ </xsl:template>
13284
+ <!-- ===================================== -->
13285
+ <!-- ===================================== -->
13286
+ <!-- END: Make linear XML (need for landscape orientation) -->
13287
+ <!-- ===================================== -->
13288
+ <!-- ===================================== -->
13289
+
12956
13290
  <!-- for correct rendering combining chars -->
12957
13291
  <xsl:template match="*[local-name() = 'lang_none']">
12958
13292
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>