metanorma-iho 0.7.6 → 0.7.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: 92c16323617a6b16e621bab2d77ea28dff47d7780fcaa39abb8dbe00cd6e2024
4
- data.tar.gz: fefa770337465aa7b2038880f289f6c890b24b636e13ef052f45b495b7e00fba
3
+ metadata.gz: 0e7cc94d7e8f9683e2b6188ea75dc4f404e762cab848878e511369a3aa741fd9
4
+ data.tar.gz: baf518a1ee8054dd032220bd45425a80619c594bb50d0b79db6d043de7aad0c3
5
5
  SHA512:
6
- metadata.gz: 46219534717178e1c5285ccc34a1f848142e675a97d7b441bd809af78775f5195862c086259bcd5388580ae165f787065383000650876623e10f67bd766eea14
7
- data.tar.gz: 7e7e93b23714967cd5064de4fb6029b6ff275c236564723ed828aaa2ea0bfc2ec79f8b90da2f03eef86fef2f6a6701f1f532e01bbe1178ffe8946b2329d56a2e
6
+ metadata.gz: 5f0bbf1cb754794a8782e1963ef20ff1eaf435389692ff453138c48403d9947bfb21e031ea5908f0bdf19b11bebd81bb980d49406e6d8e2ed3efde627b0ae36c
7
+ data.tar.gz: 58c891f65f1d4299c81c7806c80a214d24976eed99d65450e9f462effe62aca48f46468b31f6f760797cda5133a94ae71f6a06116624dce24e102b1bf7edcf70
@@ -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
 
@@ -1519,11 +1520,17 @@
1519
1520
  <!-- ========================== -->
1520
1521
  <!-- Definition's list styles -->
1521
1522
  <!-- ========================== -->
1523
+
1524
+ <xsl:attribute-set name="dl-block-style">
1525
+
1526
+ </xsl:attribute-set>
1527
+
1522
1528
  <xsl:attribute-set name="dt-row-style">
1523
1529
 
1524
1530
  </xsl:attribute-set>
1525
1531
 
1526
1532
  <xsl:attribute-set name="dt-cell-style">
1533
+
1527
1534
  </xsl:attribute-set>
1528
1535
 
1529
1536
  <xsl:attribute-set name="dt-block-style">
@@ -1543,6 +1550,7 @@
1543
1550
 
1544
1551
  <xsl:attribute-set name="dd-cell-style">
1545
1552
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1553
+
1546
1554
  </xsl:attribute-set>
1547
1555
 
1548
1556
  <!-- ========================== -->
@@ -1659,6 +1667,7 @@
1659
1667
  <xsl:attribute-set name="term-name-style">
1660
1668
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1661
1669
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1670
+
1662
1671
  </xsl:attribute-set>
1663
1672
 
1664
1673
  <xsl:attribute-set name="figure-block-style">
@@ -1682,6 +1691,10 @@
1682
1691
 
1683
1692
  </xsl:attribute-set>
1684
1693
 
1694
+ <xsl:attribute-set name="figure-source-style">
1695
+
1696
+ </xsl:attribute-set>
1697
+
1685
1698
  <!-- Formula's styles -->
1686
1699
  <xsl:attribute-set name="formula-style">
1687
1700
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2221,7 +2234,7 @@
2221
2234
 
2222
2235
  <xsl:template name="processTables_Contents">
2223
2236
  <tables>
2224
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2237
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2225
2238
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2226
2239
  <xsl:copy-of select="*[local-name() = 'name']"/>
2227
2240
  </table>
@@ -2565,7 +2578,7 @@
2565
2578
  </xsl:attribute>
2566
2579
  </xsl:for-each>
2567
2580
 
2568
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2581
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2569
2582
  <xsl:if test="$isNoteOrFnExist = 'true'">
2570
2583
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2571
2584
  </xsl:if>
@@ -2609,7 +2622,7 @@
2609
2622
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2610
2623
  </xsl:when>
2611
2624
  <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 -->
2625
+ <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 -->
2613
2626
  </xsl:otherwise>
2614
2627
  </xsl:choose>
2615
2628
 
@@ -2713,6 +2726,11 @@
2713
2726
  </xsl:if>
2714
2727
  </xsl:template> <!-- table/name -->
2715
2728
 
2729
+ <!-- SOURCE: ... -->
2730
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2731
+ <xsl:call-template name="termsource"/>
2732
+ </xsl:template>
2733
+
2716
2734
  <xsl:template name="calculate-columns-numbers">
2717
2735
  <xsl:param name="table-row"/>
2718
2736
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3069,7 +3087,7 @@
3069
3087
  </fo:table-header>
3070
3088
  </xsl:template> <!-- thead -->
3071
3089
 
3072
- <!-- template is using for iso, jcgm, bsi only -->
3090
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3073
3091
  <xsl:template name="table-header-title">
3074
3092
  <xsl:param name="cols-count"/>
3075
3093
  <!-- row for title -->
@@ -3112,7 +3130,7 @@
3112
3130
  <xsl:param name="colwidths"/>
3113
3131
  <xsl:param name="colgroup"/>
3114
3132
 
3115
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3133
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3116
3134
 
3117
3135
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3118
3136
 
@@ -3180,7 +3198,9 @@
3180
3198
 
3181
3199
  <!-- except gb and bsi -->
3182
3200
 
3201
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3183
3202
  <xsl:apply-templates select="../*[local-name()='note']"/>
3203
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3184
3204
 
3185
3205
  <xsl:variable name="isDisplayRowSeparator">
3186
3206
 
@@ -3305,7 +3325,7 @@
3305
3325
  <!-- ===================== -->
3306
3326
  <!-- Table's row processing -->
3307
3327
  <!-- ===================== -->
3308
- <!-- row in table header (thead) -->
3328
+ <!-- row in table header (thead) thead/tr -->
3309
3329
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3310
3330
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3311
3331
 
@@ -3339,7 +3359,7 @@
3339
3359
  </xsl:choose>
3340
3360
  </xsl:template>
3341
3361
 
3342
- <!-- row in table footer (tfoot) -->
3362
+ <!-- row in table footer (tfoot), tfoot/tr -->
3343
3363
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3344
3364
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3345
3365
 
@@ -3813,12 +3833,26 @@
3813
3833
  <xsl:variable name="isAdded" select="@added"/>
3814
3834
  <xsl:variable name="isDeleted" select="@deleted"/>
3815
3835
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3816
- <fo:block-container>
3836
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3837
+
3838
+ <xsl:call-template name="setBlockSpanAll"/>
3817
3839
 
3818
3840
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3819
3841
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3820
3842
  </xsl:if>
3821
3843
 
3844
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3845
+ <!-- set font-size as sourcecode font-size -->
3846
+ <xsl:variable name="sourcecode_attributes">
3847
+ <xsl:call-template name="get_sourcecode_attributes"/>
3848
+ </xsl:variable>
3849
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3850
+ <xsl:attribute name="{local-name()}">
3851
+ <xsl:value-of select="."/>
3852
+ </xsl:attribute>
3853
+ </xsl:for-each>
3854
+ </xsl:if>
3855
+
3822
3856
  <xsl:if test="parent::*[local-name() = 'note']">
3823
3857
  <xsl:attribute name="margin-left">
3824
3858
  <xsl:choose>
@@ -4258,6 +4292,7 @@
4258
4292
  <xsl:param name="split_keep-within-line"/>
4259
4293
 
4260
4294
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4295
+
4261
4296
  <xsl:call-template name="insert_dt_cell">
4262
4297
  <xsl:with-param name="key_iso" select="$key_iso"/>
4263
4298
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4279,6 +4314,7 @@
4279
4314
  <!-- border is mandatory, to calculate real width -->
4280
4315
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4281
4316
  <xsl:attribute name="text-align">left</xsl:attribute>
4317
+
4282
4318
  </xsl:if>
4283
4319
 
4284
4320
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4793,6 +4829,7 @@
4793
4829
  <fo:inline>
4794
4830
  <xsl:for-each select="$styles/style">
4795
4831
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4832
+
4796
4833
  </xsl:for-each>
4797
4834
  <xsl:apply-templates/>
4798
4835
  </fo:inline>
@@ -5955,13 +5992,17 @@
5955
5992
  </xsl:template>
5956
5993
 
5957
5994
  <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>
5995
+ <xsl:choose>
5996
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5997
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5998
+ </xsl:choose>
5959
5999
  </xsl:template>
5960
6000
 
5961
6001
  <xsl:template match="*[local-name() = 'annotation']">
5962
6002
  <xsl:variable name="annotation-id" select="@id"/>
5963
6003
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5964
6004
  <fo:block id="{$annotation-id}" white-space="nowrap">
6005
+
5965
6006
  <fo:inline>
5966
6007
  <xsl:apply-templates>
5967
6008
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -6066,6 +6107,10 @@
6066
6107
  <!-- ====== -->
6067
6108
  <!-- ====== -->
6068
6109
 
6110
+ <xsl:template name="setBlockSpanAll">
6111
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
6112
+ </xsl:template>
6113
+
6069
6114
  <!-- ====== -->
6070
6115
  <!-- note -->
6071
6116
  <!-- termnote -->
@@ -6075,6 +6120,8 @@
6075
6120
 
6076
6121
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6077
6122
 
6123
+ <xsl:call-template name="setBlockSpanAll"/>
6124
+
6078
6125
  <fo:block-container margin-left="0mm" margin-right="0mm">
6079
6126
 
6080
6127
  <fo:block>
@@ -6125,6 +6172,8 @@
6125
6172
  <xsl:template match="*[local-name() = 'termnote']">
6126
6173
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6127
6174
 
6175
+ <xsl:call-template name="setBlockSpanAll"/>
6176
+
6128
6177
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6129
6178
 
6130
6179
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -6280,6 +6329,13 @@
6280
6329
  </fo:block>
6281
6330
  </xsl:template>
6282
6331
 
6332
+ <!-- SOURCE: ... -->
6333
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6334
+
6335
+ <xsl:call-template name="termsource"/>
6336
+
6337
+ </xsl:template>
6338
+
6283
6339
  <xsl:template match="*[local-name() = 'image']">
6284
6340
  <xsl:variable name="isAdded" select="../@added"/>
6285
6341
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7410,9 +7466,11 @@
7410
7466
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7411
7467
  </xsl:if>
7412
7468
 
7413
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7469
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7414
7470
  </fo:block>
7415
7471
 
7472
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7473
+
7416
7474
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7417
7475
 
7418
7476
  </fo:block-container>
@@ -7444,11 +7502,22 @@
7444
7502
  <!-- add sourcecode highlighting -->
7445
7503
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7446
7504
  <xsl:variable name="class" select="@class"/>
7505
+
7506
+ <!-- Example: <1> -->
7507
+ <xsl:variable name="is_callout">
7508
+ <xsl:if test="parent::*[local-name() = 'dt']">
7509
+ <xsl:variable name="dt_id" select="../@id"/>
7510
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7511
+ </xsl:if>
7512
+ </xsl:variable>
7513
+
7447
7514
  <xsl:choose>
7448
7515
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7449
7516
  <fo:inline>
7450
7517
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7518
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7451
7519
  <xsl:apply-templates/>
7520
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7452
7521
  </fo:inline>
7453
7522
  </xsl:when>
7454
7523
  <xsl:otherwise>
@@ -7872,6 +7941,10 @@
7872
7941
  </fo:block>
7873
7942
  </xsl:template>
7874
7943
 
7944
+ <xsl:template match="*[local-name() = 'div']">
7945
+ <fo:block><xsl:apply-templates/></fo:block>
7946
+ </xsl:template>
7947
+
7875
7948
  <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']">
7876
7949
  <fo:block xsl:use-attribute-sets="inherit-style">
7877
7950
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8035,6 +8108,9 @@
8035
8108
  <!-- ====== -->
8036
8109
  <xsl:template match="*[local-name() = 'termexample']">
8037
8110
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8111
+
8112
+ <xsl:call-template name="setBlockSpanAll"/>
8113
+
8038
8114
  <xsl:apply-templates select="*[local-name()='name']"/>
8039
8115
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8040
8116
  </fo:block>
@@ -8086,6 +8162,8 @@
8086
8162
 
8087
8163
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
8088
8164
 
8165
+ <xsl:call-template name="setBlockSpanAll"/>
8166
+
8089
8167
  <xsl:variable name="fo_element">
8090
8168
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8091
8169
  inline
@@ -8113,6 +8191,35 @@
8113
8191
  </fo:block-container>
8114
8192
  </xsl:when> <!-- end block -->
8115
8193
 
8194
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8195
+
8196
+ <xsl:variable name="provisional_distance_between_starts">
8197
+ 7
8198
+ </xsl:variable>
8199
+ <xsl:variable name="indent">
8200
+ 0
8201
+ </xsl:variable>
8202
+
8203
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8204
+ <fo:list-item>
8205
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8206
+ <fo:block>
8207
+ <xsl:apply-templates select="*[local-name()='name']">
8208
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8209
+ </xsl:apply-templates>
8210
+ </fo:block>
8211
+ </fo:list-item-label>
8212
+ <fo:list-item-body start-indent="body-start()">
8213
+ <fo:block>
8214
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8215
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8216
+ </xsl:apply-templates>
8217
+ </fo:block>
8218
+ </fo:list-item-body>
8219
+ </fo:list-item>
8220
+ </fo:list-block>
8221
+ </xsl:when> <!-- end list -->
8222
+
8116
8223
  <xsl:otherwise> <!-- inline -->
8117
8224
 
8118
8225
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8188,6 +8295,11 @@
8188
8295
  </fo:block>
8189
8296
  </fo:block-container>
8190
8297
  </xsl:when>
8298
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8299
+ <fo:block xsl:use-attribute-sets="example-p-style">
8300
+ <xsl:apply-templates/>
8301
+ </fo:block>
8302
+ </xsl:when>
8191
8303
  <xsl:otherwise>
8192
8304
  <fo:inline xsl:use-attribute-sets="example-p-style">
8193
8305
  <xsl:apply-templates/>
@@ -8305,6 +8417,9 @@
8305
8417
  <!-- ====== -->
8306
8418
  <xsl:template match="*[local-name() = 'quote']">
8307
8419
  <fo:block-container margin-left="0mm">
8420
+
8421
+ <xsl:call-template name="setBlockSpanAll"/>
8422
+
8308
8423
  <xsl:if test="parent::*[local-name() = 'note']">
8309
8424
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8310
8425
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8525,13 +8640,8 @@
8525
8640
  </xsl:template>
8526
8641
 
8527
8642
  <xsl:template match="*[local-name() = 'deprecates']">
8528
- <xsl:variable name="title-deprecated">
8529
- <xsl:call-template name="getLocalizedString">
8530
- <xsl:with-param name="key">deprecated</xsl:with-param>
8531
- </xsl:call-template>
8532
- </xsl:variable>
8533
8643
  <fo:block xsl:use-attribute-sets="deprecates-style">
8534
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8644
+ <xsl:apply-templates/>
8535
8645
  </fo:block>
8536
8646
  </xsl:template>
8537
8647
 
@@ -8591,6 +8701,8 @@
8591
8701
  <fo:block>
8592
8702
  <xsl:call-template name="setId"/>
8593
8703
 
8704
+ <xsl:call-template name="setBlockSpanAll"/>
8705
+
8594
8706
  <xsl:apply-templates/>
8595
8707
  </fo:block>
8596
8708
  </xsl:template>
@@ -8605,6 +8717,8 @@
8605
8717
  <fo:block break-after="page"/>
8606
8718
  <fo:block id="{@id}">
8607
8719
 
8720
+ <xsl:call-template name="setBlockSpanAll"/>
8721
+
8608
8722
  </fo:block>
8609
8723
  <xsl:apply-templates/>
8610
8724
  </xsl:template>
@@ -9564,6 +9678,8 @@
9564
9678
  <!-- text in the box -->
9565
9679
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9566
9680
 
9681
+ <xsl:call-template name="setBlockSpanAll"/>
9682
+
9567
9683
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9568
9684
 
9569
9685
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -9739,6 +9855,33 @@
9739
9855
  <xsl:apply-templates mode="update_xml_step1"/>
9740
9856
  </xsl:copy>
9741
9857
  </xsl:template>
9858
+
9859
+ <!-- remove semantic xml -->
9860
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9861
+
9862
+ <!-- remove image/emf -->
9863
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9864
+
9865
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9866
+ <xsl:copy-of select="."/>
9867
+ </xsl:template>
9868
+
9869
+ <!-- add @id, redundant for table auto-layout algorithm -->
9870
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9871
+ <xsl:copy>
9872
+ <xsl:copy-of select="@*"/>
9873
+ <xsl:call-template name="add_id"/>
9874
+ <xsl:apply-templates mode="update_xml_step1"/>
9875
+ </xsl:copy>
9876
+ </xsl:template>
9877
+
9878
+ <xsl:template name="add_id">
9879
+ <xsl:if test="not(@id)">
9880
+ <!-- add @id - first element with @id plus '_element_name' -->
9881
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9882
+ </xsl:if>
9883
+ </xsl:template>
9884
+
9742
9885
  <!-- =========================================================================== -->
9743
9886
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9744
9887
  <!-- =========================================================================== -->
@@ -9760,7 +9903,7 @@
9760
9903
 
9761
9904
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9762
9905
 
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">
9906
+ <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
9907
 
9765
9908
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9766
9909
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9834,6 +9977,10 @@
9834
9977
 
9835
9978
  </xsl:template>
9836
9979
 
9980
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9981
+ <xsl:copy-of select="."/>
9982
+ </xsl:template>
9983
+
9837
9984
  <xsl:template name="replace_text_tags">
9838
9985
  <xsl:param name="tag_open"/>
9839
9986
  <xsl:param name="tag_close"/>
@@ -9860,6 +10007,194 @@
9860
10007
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9861
10008
  <!-- ===================================== -->
9862
10009
 
10010
+ <!-- ===================================== -->
10011
+ <!-- ===================================== -->
10012
+ <!-- Make linear XML (need for landscape orientation) -->
10013
+ <!-- ===================================== -->
10014
+ <!-- ===================================== -->
10015
+ <xsl:template match="@*|node()" mode="linear_xml">
10016
+ <xsl:copy>
10017
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
10018
+ </xsl:copy>
10019
+ </xsl:template>
10020
+
10021
+ <xsl:template match="processing-instruction()" mode="linear_xml">
10022
+ <xsl:copy-of select="."/>
10023
+ </xsl:template>
10024
+
10025
+ <!-- From:
10026
+ <clause>
10027
+ <title>...</title>
10028
+ <p>...</p>
10029
+ </clause>
10030
+ To:
10031
+ <clause/>
10032
+ <title>...</title>
10033
+ <p>...</p>
10034
+ -->
10035
+ <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">
10036
+
10037
+ <xsl:copy>
10038
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10039
+
10040
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10041
+
10042
+ <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'">
10043
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10044
+ </xsl:if>
10045
+ </xsl:copy>
10046
+
10047
+ <xsl:apply-templates mode="linear_xml"/>
10048
+ </xsl:template>
10049
+
10050
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
10051
+ <xsl:copy>
10052
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10053
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10054
+ <xsl:variable name="level">
10055
+ <xsl:call-template name="getLevel"/>
10056
+ </xsl:variable>
10057
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10058
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
10059
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
10060
+ </xsl:copy>
10061
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
10062
+ </xsl:template>
10063
+
10064
+ <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">
10065
+ <xsl:copy>
10066
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10067
+
10068
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10069
+
10070
+ <xsl:variable name="level">
10071
+ <xsl:call-template name="getLevel"/>
10072
+ </xsl:variable>
10073
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10074
+
10075
+ <xsl:if test="parent::*[local-name() = 'annex']">
10076
+ <xsl:attribute name="depth">1</xsl:attribute>
10077
+ </xsl:if>
10078
+
10079
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
10080
+ <xsl:copy-of select="../@inline-header"/>
10081
+ </xsl:if>
10082
+
10083
+ <xsl:attribute name="ancestor">
10084
+ <xsl:choose>
10085
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
10086
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
10087
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
10088
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
10089
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
10090
+ </xsl:choose>
10091
+ </xsl:attribute>
10092
+
10093
+ <xsl:apply-templates mode="linear_xml"/>
10094
+ </xsl:copy>
10095
+ </xsl:template>
10096
+
10097
+ <!-- add @to = figure, table, clause -->
10098
+ <!-- add @depth = from -->
10099
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
10100
+ <xsl:copy>
10101
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10102
+ <xsl:variable name="target" select="@target"/>
10103
+ <xsl:attribute name="to">
10104
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
10105
+ </xsl:attribute>
10106
+ <xsl:attribute name="depth">
10107
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
10108
+ </xsl:attribute>
10109
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10110
+ </xsl:copy>
10111
+ </xsl:template>
10112
+
10113
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
10114
+ <xsl:choose>
10115
+ <xsl:when test="contains(., $non_breaking_hyphen)">
10116
+ <xsl:call-template name="replaceChar">
10117
+ <xsl:with-param name="text" select="."/>
10118
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
10119
+ <xsl:with-param name="by" select="'-'"/>
10120
+ </xsl:call-template>
10121
+ </xsl:when>
10122
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10123
+ </xsl:choose>
10124
+ </xsl:template>
10125
+
10126
+ <xsl:template name="replaceChar">
10127
+ <xsl:param name="text"/>
10128
+ <xsl:param name="replace"/>
10129
+ <xsl:param name="by"/>
10130
+ <xsl:choose>
10131
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
10132
+ <xsl:value-of select="$text"/>
10133
+ </xsl:when>
10134
+ <xsl:when test="contains($text, $replace)">
10135
+ <xsl:value-of select="substring-before($text,$replace)"/>
10136
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10137
+ <xsl:call-template name="replaceChar">
10138
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10139
+ <xsl:with-param name="replace" select="$replace"/>
10140
+ <xsl:with-param name="by" select="$by"/>
10141
+ </xsl:call-template>
10142
+ </xsl:when>
10143
+ <xsl:otherwise>
10144
+ <xsl:value-of select="$text"/>
10145
+ </xsl:otherwise>
10146
+ </xsl:choose>
10147
+ </xsl:template>
10148
+
10149
+ <xsl:template match="*[local-name() = 'inlineChar']">
10150
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10151
+ </xsl:template>
10152
+
10153
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10154
+ <!--
10155
+ <fn reference="1">
10156
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10157
+ </fn>
10158
+ -->
10159
+ <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">
10160
+ <xsl:variable name="p_fn_">
10161
+ <xsl:call-template name="get_fn_list"/>
10162
+ </xsl:variable>
10163
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10164
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10165
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10166
+ <xsl:variable name="reference" select="@reference"/>
10167
+ <!-- fn sequence number in document -->
10168
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10169
+
10170
+ <xsl:copy>
10171
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10172
+ <!-- put actual reference number -->
10173
+ <xsl:attribute name="current_fn_number">
10174
+ <xsl:value-of select="$current_fn_number"/>
10175
+ </xsl:attribute>
10176
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10177
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10178
+ </xsl:attribute>
10179
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10180
+ </xsl:copy>
10181
+ </xsl:template>
10182
+
10183
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10184
+ <xsl:copy>
10185
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10186
+ <xsl:if test="@depth = '1'">
10187
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10188
+ </xsl:if>
10189
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10190
+ </xsl:copy>
10191
+ </xsl:template>
10192
+ <!-- ===================================== -->
10193
+ <!-- ===================================== -->
10194
+ <!-- END: Make linear XML (need for landscape orientation) -->
10195
+ <!-- ===================================== -->
10196
+ <!-- ===================================== -->
10197
+
9863
10198
  <!-- for correct rendering combining chars -->
9864
10199
  <xsl:template match="*[local-name() = 'lang_none']">
9865
10200
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>