metanorma-cc 2.2.5 → 2.2.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: b9409829ee76874795daca563b1a53ce680be430a1bab2c173c6befb8dba8645
4
- data.tar.gz: '05784a026b5e1c1ea5699e25ecfd5c1949c3241e31de11dbc4352a771c58de5f'
3
+ metadata.gz: 5192dc9cce37d02987f3bab06b15ae0e3c443445f95fd24bdc877102e6c5101c
4
+ data.tar.gz: 3d495638ef0b8c2aab53fd0d15861be049c27986658b390123236e47a0c74196
5
5
  SHA512:
6
- metadata.gz: 57630940fdb5039b666c33a0494c1465734954995c8ba4f0bbf2e5d18b69bc9c30bc46f48dacc55d7e044ead8c667954c4036c7478deb703533cea17cf80f32e
7
- data.tar.gz: 9d14496986bf088b87a5a0995bc02497d23d96e2066ad5ef96c4675ebb30a06aeb82481c0a93d9bc987fe7a8a59b717e2eea354bb596016cc3588e3f67e8cbac
6
+ metadata.gz: fe10656b3cbccaf5d9b7fe6913a007979cb80bff505f96c56afd2955bf6777f24679795671b269eb96768538ec595700b19a17d1040ce30203fa9d670533c381
7
+ data.tar.gz: dc90327c73898c498aab019fd4b1baa69ef900ce8231b9386c4a263282f5175c5b902e686b09306035cda679645cb35c81c5c7fe341f540b585c4458993cc61f
@@ -1208,11 +1208,17 @@
1208
1208
  <!-- ========================== -->
1209
1209
  <!-- Definition's list styles -->
1210
1210
  <!-- ========================== -->
1211
+
1212
+ <xsl:attribute-set name="dl-block-style">
1213
+
1214
+ </xsl:attribute-set>
1215
+
1211
1216
  <xsl:attribute-set name="dt-row-style">
1212
1217
 
1213
1218
  </xsl:attribute-set>
1214
1219
 
1215
1220
  <xsl:attribute-set name="dt-cell-style">
1221
+
1216
1222
  </xsl:attribute-set>
1217
1223
 
1218
1224
  <xsl:attribute-set name="dt-block-style">
@@ -1232,6 +1238,7 @@
1232
1238
 
1233
1239
  <xsl:attribute-set name="dd-cell-style">
1234
1240
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1241
+
1235
1242
  </xsl:attribute-set>
1236
1243
 
1237
1244
  <!-- ========================== -->
@@ -1343,6 +1350,7 @@
1343
1350
  <xsl:attribute-set name="term-name-style">
1344
1351
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1345
1352
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1353
+
1346
1354
  </xsl:attribute-set>
1347
1355
 
1348
1356
  <xsl:attribute-set name="figure-block-style">
@@ -1365,6 +1373,10 @@
1365
1373
 
1366
1374
  </xsl:attribute-set>
1367
1375
 
1376
+ <xsl:attribute-set name="figure-source-style">
1377
+
1378
+ </xsl:attribute-set>
1379
+
1368
1380
  <!-- Formula's styles -->
1369
1381
  <xsl:attribute-set name="formula-style">
1370
1382
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1883,7 +1895,7 @@
1883
1895
 
1884
1896
  <xsl:template name="processTables_Contents">
1885
1897
  <tables>
1886
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1898
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1887
1899
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1888
1900
  <xsl:copy-of select="*[local-name() = 'name']"/>
1889
1901
  </table>
@@ -2235,7 +2247,7 @@
2235
2247
  </xsl:attribute>
2236
2248
  </xsl:for-each>
2237
2249
 
2238
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2250
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2239
2251
  <xsl:if test="$isNoteOrFnExist = 'true'">
2240
2252
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2241
2253
  </xsl:if>
@@ -2279,7 +2291,7 @@
2279
2291
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2280
2292
  </xsl:when>
2281
2293
  <xsl:otherwise>
2282
- <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 -->
2294
+ <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 -->
2283
2295
  </xsl:otherwise>
2284
2296
  </xsl:choose>
2285
2297
 
@@ -2383,6 +2395,11 @@
2383
2395
  </xsl:if>
2384
2396
  </xsl:template> <!-- table/name -->
2385
2397
 
2398
+ <!-- SOURCE: ... -->
2399
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2400
+ <xsl:call-template name="termsource"/>
2401
+ </xsl:template>
2402
+
2386
2403
  <xsl:template name="calculate-columns-numbers">
2387
2404
  <xsl:param name="table-row"/>
2388
2405
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2739,7 +2756,7 @@
2739
2756
  </fo:table-header>
2740
2757
  </xsl:template> <!-- thead -->
2741
2758
 
2742
- <!-- template is using for iso, jcgm, bsi only -->
2759
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2743
2760
  <xsl:template name="table-header-title">
2744
2761
  <xsl:param name="cols-count"/>
2745
2762
  <!-- row for title -->
@@ -2782,7 +2799,7 @@
2782
2799
  <xsl:param name="colwidths"/>
2783
2800
  <xsl:param name="colgroup"/>
2784
2801
 
2785
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2802
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2786
2803
 
2787
2804
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2788
2805
 
@@ -2850,7 +2867,9 @@
2850
2867
 
2851
2868
  <!-- except gb and bsi -->
2852
2869
 
2870
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
2853
2871
  <xsl:apply-templates select="../*[local-name()='note']"/>
2872
+ <xsl:apply-templates select="../*[local-name()='source']"/>
2854
2873
 
2855
2874
  <xsl:variable name="isDisplayRowSeparator">
2856
2875
 
@@ -2975,7 +2994,7 @@
2975
2994
  <!-- ===================== -->
2976
2995
  <!-- Table's row processing -->
2977
2996
  <!-- ===================== -->
2978
- <!-- row in table header (thead) -->
2997
+ <!-- row in table header (thead) thead/tr -->
2979
2998
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
2980
2999
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
2981
3000
 
@@ -3009,7 +3028,7 @@
3009
3028
  </xsl:choose>
3010
3029
  </xsl:template>
3011
3030
 
3012
- <!-- row in table footer (tfoot) -->
3031
+ <!-- row in table footer (tfoot), tfoot/tr -->
3013
3032
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3014
3033
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3015
3034
 
@@ -3483,12 +3502,26 @@
3483
3502
  <xsl:variable name="isAdded" select="@added"/>
3484
3503
  <xsl:variable name="isDeleted" select="@deleted"/>
3485
3504
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3486
- <fo:block-container>
3505
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3506
+
3507
+ <xsl:call-template name="setBlockSpanAll"/>
3487
3508
 
3488
3509
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3489
3510
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3490
3511
  </xsl:if>
3491
3512
 
3513
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3514
+ <!-- set font-size as sourcecode font-size -->
3515
+ <xsl:variable name="sourcecode_attributes">
3516
+ <xsl:call-template name="get_sourcecode_attributes"/>
3517
+ </xsl:variable>
3518
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3519
+ <xsl:attribute name="{local-name()}">
3520
+ <xsl:value-of select="."/>
3521
+ </xsl:attribute>
3522
+ </xsl:for-each>
3523
+ </xsl:if>
3524
+
3492
3525
  <xsl:if test="parent::*[local-name() = 'note']">
3493
3526
  <xsl:attribute name="margin-left">
3494
3527
  <xsl:choose>
@@ -3922,6 +3955,7 @@
3922
3955
  <xsl:param name="split_keep-within-line"/>
3923
3956
 
3924
3957
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3958
+
3925
3959
  <xsl:call-template name="insert_dt_cell">
3926
3960
  <xsl:with-param name="key_iso" select="$key_iso"/>
3927
3961
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -3943,6 +3977,7 @@
3943
3977
  <!-- border is mandatory, to calculate real width -->
3944
3978
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3945
3979
  <xsl:attribute name="text-align">left</xsl:attribute>
3980
+
3946
3981
  </xsl:if>
3947
3982
 
3948
3983
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4388,6 +4423,7 @@
4388
4423
  <fo:inline>
4389
4424
  <xsl:for-each select="$styles/style">
4390
4425
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4426
+
4391
4427
  </xsl:for-each>
4392
4428
  <xsl:apply-templates/>
4393
4429
  </fo:inline>
@@ -5550,13 +5586,17 @@
5550
5586
  </xsl:template>
5551
5587
 
5552
5588
  <xsl:template match="*[local-name() = 'callout']">
5553
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5589
+ <xsl:choose>
5590
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5591
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5592
+ </xsl:choose>
5554
5593
  </xsl:template>
5555
5594
 
5556
5595
  <xsl:template match="*[local-name() = 'annotation']">
5557
5596
  <xsl:variable name="annotation-id" select="@id"/>
5558
5597
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5559
5598
  <fo:block id="{$annotation-id}" white-space="nowrap">
5599
+
5560
5600
  <fo:inline>
5561
5601
  <xsl:apply-templates>
5562
5602
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -5661,6 +5701,10 @@
5661
5701
  <!-- ====== -->
5662
5702
  <!-- ====== -->
5663
5703
 
5704
+ <xsl:template name="setBlockSpanAll">
5705
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
5706
+ </xsl:template>
5707
+
5664
5708
  <!-- ====== -->
5665
5709
  <!-- note -->
5666
5710
  <!-- termnote -->
@@ -5670,6 +5714,8 @@
5670
5714
 
5671
5715
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5672
5716
 
5717
+ <xsl:call-template name="setBlockSpanAll"/>
5718
+
5673
5719
  <fo:block-container margin-left="0mm" margin-right="0mm">
5674
5720
 
5675
5721
  <fo:block>
@@ -5720,6 +5766,8 @@
5720
5766
  <xsl:template match="*[local-name() = 'termnote']">
5721
5767
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5722
5768
 
5769
+ <xsl:call-template name="setBlockSpanAll"/>
5770
+
5723
5771
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5724
5772
 
5725
5773
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -5873,6 +5921,13 @@
5873
5921
  </fo:block>
5874
5922
  </xsl:template>
5875
5923
 
5924
+ <!-- SOURCE: ... -->
5925
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
5926
+
5927
+ <xsl:call-template name="termsource"/>
5928
+
5929
+ </xsl:template>
5930
+
5876
5931
  <xsl:template match="*[local-name() = 'image']">
5877
5932
  <xsl:variable name="isAdded" select="../@added"/>
5878
5933
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7005,9 +7060,11 @@
7005
7060
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7006
7061
  </xsl:if>
7007
7062
 
7008
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7063
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7009
7064
  </fo:block>
7010
7065
 
7066
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7067
+
7011
7068
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7012
7069
 
7013
7070
  </fo:block-container>
@@ -7039,11 +7096,22 @@
7039
7096
  <!-- add sourcecode highlighting -->
7040
7097
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7041
7098
  <xsl:variable name="class" select="@class"/>
7099
+
7100
+ <!-- Example: <1> -->
7101
+ <xsl:variable name="is_callout">
7102
+ <xsl:if test="parent::*[local-name() = 'dt']">
7103
+ <xsl:variable name="dt_id" select="../@id"/>
7104
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7105
+ </xsl:if>
7106
+ </xsl:variable>
7107
+
7042
7108
  <xsl:choose>
7043
7109
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7044
7110
  <fo:inline>
7045
7111
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7112
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7046
7113
  <xsl:apply-templates/>
7114
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7047
7115
  </fo:inline>
7048
7116
  </xsl:when>
7049
7117
  <xsl:otherwise>
@@ -7467,6 +7535,10 @@
7467
7535
  </fo:block>
7468
7536
  </xsl:template>
7469
7537
 
7538
+ <xsl:template match="*[local-name() = 'div']">
7539
+ <fo:block><xsl:apply-templates/></fo:block>
7540
+ </xsl:template>
7541
+
7470
7542
  <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']">
7471
7543
  <fo:block xsl:use-attribute-sets="inherit-style">
7472
7544
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -7630,6 +7702,9 @@
7630
7702
  <!-- ====== -->
7631
7703
  <xsl:template match="*[local-name() = 'termexample']">
7632
7704
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
7705
+
7706
+ <xsl:call-template name="setBlockSpanAll"/>
7707
+
7633
7708
  <xsl:apply-templates select="*[local-name()='name']"/>
7634
7709
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7635
7710
  </fo:block>
@@ -7681,6 +7756,8 @@
7681
7756
 
7682
7757
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
7683
7758
 
7759
+ <xsl:call-template name="setBlockSpanAll"/>
7760
+
7684
7761
  <xsl:variable name="fo_element">
7685
7762
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
7686
7763
  block
@@ -7708,6 +7785,35 @@
7708
7785
  </fo:block-container>
7709
7786
  </xsl:when> <!-- end block -->
7710
7787
 
7788
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
7789
+
7790
+ <xsl:variable name="provisional_distance_between_starts">
7791
+ 7
7792
+ </xsl:variable>
7793
+ <xsl:variable name="indent">
7794
+ 0
7795
+ </xsl:variable>
7796
+
7797
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
7798
+ <fo:list-item>
7799
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
7800
+ <fo:block>
7801
+ <xsl:apply-templates select="*[local-name()='name']">
7802
+ <xsl:with-param name="fo_element">block</xsl:with-param>
7803
+ </xsl:apply-templates>
7804
+ </fo:block>
7805
+ </fo:list-item-label>
7806
+ <fo:list-item-body start-indent="body-start()">
7807
+ <fo:block>
7808
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
7809
+ <xsl:with-param name="fo_element" select="$fo_element"/>
7810
+ </xsl:apply-templates>
7811
+ </fo:block>
7812
+ </fo:list-item-body>
7813
+ </fo:list-item>
7814
+ </fo:list-block>
7815
+ </xsl:when> <!-- end list -->
7816
+
7711
7817
  <xsl:otherwise> <!-- inline -->
7712
7818
 
7713
7819
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -7783,6 +7889,11 @@
7783
7889
  </fo:block>
7784
7890
  </fo:block-container>
7785
7891
  </xsl:when>
7892
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
7893
+ <fo:block xsl:use-attribute-sets="example-p-style">
7894
+ <xsl:apply-templates/>
7895
+ </fo:block>
7896
+ </xsl:when>
7786
7897
  <xsl:otherwise>
7787
7898
  <fo:inline xsl:use-attribute-sets="example-p-style">
7788
7899
  <xsl:apply-templates/>
@@ -7900,6 +8011,9 @@
7900
8011
  <!-- ====== -->
7901
8012
  <xsl:template match="*[local-name() = 'quote']">
7902
8013
  <fo:block-container margin-left="0mm">
8014
+
8015
+ <xsl:call-template name="setBlockSpanAll"/>
8016
+
7903
8017
  <xsl:if test="parent::*[local-name() = 'note']">
7904
8018
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
7905
8019
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8125,13 +8239,8 @@
8125
8239
  </xsl:template>
8126
8240
 
8127
8241
  <xsl:template match="*[local-name() = 'deprecates']">
8128
- <xsl:variable name="title-deprecated">
8129
- <xsl:call-template name="getLocalizedString">
8130
- <xsl:with-param name="key">deprecated</xsl:with-param>
8131
- </xsl:call-template>
8132
- </xsl:variable>
8133
8242
  <fo:block xsl:use-attribute-sets="deprecates-style">
8134
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8243
+ <xsl:apply-templates/>
8135
8244
  </fo:block>
8136
8245
  </xsl:template>
8137
8246
 
@@ -8196,6 +8305,8 @@
8196
8305
  <fo:block>
8197
8306
  <xsl:call-template name="setId"/>
8198
8307
 
8308
+ <xsl:call-template name="setBlockSpanAll"/>
8309
+
8199
8310
  <xsl:apply-templates/>
8200
8311
  </fo:block>
8201
8312
  </xsl:template>
@@ -8210,6 +8321,8 @@
8210
8321
  <fo:block break-after="page"/>
8211
8322
  <fo:block id="{@id}">
8212
8323
 
8324
+ <xsl:call-template name="setBlockSpanAll"/>
8325
+
8213
8326
  </fo:block>
8214
8327
  <xsl:apply-templates/>
8215
8328
  </xsl:template>
@@ -9163,6 +9276,8 @@
9163
9276
 
9164
9277
  <fo:block xsl:use-attribute-sets="admonition-style">
9165
9278
 
9279
+ <xsl:call-template name="setBlockSpanAll"/>
9280
+
9166
9281
  <xsl:if test="@type = 'editorial'">
9167
9282
  <xsl:attribute name="color">green</xsl:attribute>
9168
9283
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -9346,6 +9461,33 @@
9346
9461
  <xsl:apply-templates mode="update_xml_step1"/>
9347
9462
  </xsl:copy>
9348
9463
  </xsl:template>
9464
+
9465
+ <!-- remove semantic xml -->
9466
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9467
+
9468
+ <!-- remove image/emf -->
9469
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9470
+
9471
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9472
+ <xsl:copy-of select="."/>
9473
+ </xsl:template>
9474
+
9475
+ <!-- add @id, redundant for table auto-layout algorithm -->
9476
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9477
+ <xsl:copy>
9478
+ <xsl:copy-of select="@*"/>
9479
+ <xsl:call-template name="add_id"/>
9480
+ <xsl:apply-templates mode="update_xml_step1"/>
9481
+ </xsl:copy>
9482
+ </xsl:template>
9483
+
9484
+ <xsl:template name="add_id">
9485
+ <xsl:if test="not(@id)">
9486
+ <!-- add @id - first element with @id plus '_element_name' -->
9487
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9488
+ </xsl:if>
9489
+ </xsl:template>
9490
+
9349
9491
  <!-- =========================================================================== -->
9350
9492
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9351
9493
  <!-- =========================================================================== -->
@@ -9367,7 +9509,7 @@
9367
9509
 
9368
9510
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9369
9511
 
9370
- <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">
9512
+ <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">
9371
9513
 
9372
9514
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9373
9515
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9441,6 +9583,10 @@
9441
9583
 
9442
9584
  </xsl:template>
9443
9585
 
9586
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9587
+ <xsl:copy-of select="."/>
9588
+ </xsl:template>
9589
+
9444
9590
  <xsl:template name="replace_text_tags">
9445
9591
  <xsl:param name="tag_open"/>
9446
9592
  <xsl:param name="tag_close"/>
@@ -9467,6 +9613,194 @@
9467
9613
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9468
9614
  <!-- ===================================== -->
9469
9615
 
9616
+ <!-- ===================================== -->
9617
+ <!-- ===================================== -->
9618
+ <!-- Make linear XML (need for landscape orientation) -->
9619
+ <!-- ===================================== -->
9620
+ <!-- ===================================== -->
9621
+ <xsl:template match="@*|node()" mode="linear_xml">
9622
+ <xsl:copy>
9623
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9624
+ </xsl:copy>
9625
+ </xsl:template>
9626
+
9627
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9628
+ <xsl:copy-of select="."/>
9629
+ </xsl:template>
9630
+
9631
+ <!-- From:
9632
+ <clause>
9633
+ <title>...</title>
9634
+ <p>...</p>
9635
+ </clause>
9636
+ To:
9637
+ <clause/>
9638
+ <title>...</title>
9639
+ <p>...</p>
9640
+ -->
9641
+ <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">
9642
+
9643
+ <xsl:copy>
9644
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9645
+
9646
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9647
+
9648
+ <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'">
9649
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9650
+ </xsl:if>
9651
+ </xsl:copy>
9652
+
9653
+ <xsl:apply-templates mode="linear_xml"/>
9654
+ </xsl:template>
9655
+
9656
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9657
+ <xsl:copy>
9658
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9659
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9660
+ <xsl:variable name="level">
9661
+ <xsl:call-template name="getLevel"/>
9662
+ </xsl:variable>
9663
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9664
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9665
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9666
+ </xsl:copy>
9667
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9668
+ </xsl:template>
9669
+
9670
+ <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">
9671
+ <xsl:copy>
9672
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9673
+
9674
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9675
+
9676
+ <xsl:variable name="level">
9677
+ <xsl:call-template name="getLevel"/>
9678
+ </xsl:variable>
9679
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9680
+
9681
+ <xsl:if test="parent::*[local-name() = 'annex']">
9682
+ <xsl:attribute name="depth">1</xsl:attribute>
9683
+ </xsl:if>
9684
+
9685
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
9686
+ <xsl:copy-of select="../@inline-header"/>
9687
+ </xsl:if>
9688
+
9689
+ <xsl:attribute name="ancestor">
9690
+ <xsl:choose>
9691
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
9692
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
9693
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
9694
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
9695
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
9696
+ </xsl:choose>
9697
+ </xsl:attribute>
9698
+
9699
+ <xsl:apply-templates mode="linear_xml"/>
9700
+ </xsl:copy>
9701
+ </xsl:template>
9702
+
9703
+ <!-- add @to = figure, table, clause -->
9704
+ <!-- add @depth = from -->
9705
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
9706
+ <xsl:copy>
9707
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9708
+ <xsl:variable name="target" select="@target"/>
9709
+ <xsl:attribute name="to">
9710
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
9711
+ </xsl:attribute>
9712
+ <xsl:attribute name="depth">
9713
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
9714
+ </xsl:attribute>
9715
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9716
+ </xsl:copy>
9717
+ </xsl:template>
9718
+
9719
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
9720
+ <xsl:choose>
9721
+ <xsl:when test="contains(., $non_breaking_hyphen)">
9722
+ <xsl:call-template name="replaceChar">
9723
+ <xsl:with-param name="text" select="."/>
9724
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
9725
+ <xsl:with-param name="by" select="'-'"/>
9726
+ </xsl:call-template>
9727
+ </xsl:when>
9728
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
9729
+ </xsl:choose>
9730
+ </xsl:template>
9731
+
9732
+ <xsl:template name="replaceChar">
9733
+ <xsl:param name="text"/>
9734
+ <xsl:param name="replace"/>
9735
+ <xsl:param name="by"/>
9736
+ <xsl:choose>
9737
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
9738
+ <xsl:value-of select="$text"/>
9739
+ </xsl:when>
9740
+ <xsl:when test="contains($text, $replace)">
9741
+ <xsl:value-of select="substring-before($text,$replace)"/>
9742
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
9743
+ <xsl:call-template name="replaceChar">
9744
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
9745
+ <xsl:with-param name="replace" select="$replace"/>
9746
+ <xsl:with-param name="by" select="$by"/>
9747
+ </xsl:call-template>
9748
+ </xsl:when>
9749
+ <xsl:otherwise>
9750
+ <xsl:value-of select="$text"/>
9751
+ </xsl:otherwise>
9752
+ </xsl:choose>
9753
+ </xsl:template>
9754
+
9755
+ <xsl:template match="*[local-name() = 'inlineChar']">
9756
+ <fo:inline><xsl:value-of select="."/></fo:inline>
9757
+ </xsl:template>
9758
+
9759
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
9760
+ <!--
9761
+ <fn reference="1">
9762
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9763
+ </fn>
9764
+ -->
9765
+ <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">
9766
+ <xsl:variable name="p_fn_">
9767
+ <xsl:call-template name="get_fn_list"/>
9768
+ </xsl:variable>
9769
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9770
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
9771
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9772
+ <xsl:variable name="reference" select="@reference"/>
9773
+ <!-- fn sequence number in document -->
9774
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
9775
+
9776
+ <xsl:copy>
9777
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9778
+ <!-- put actual reference number -->
9779
+ <xsl:attribute name="current_fn_number">
9780
+ <xsl:value-of select="$current_fn_number"/>
9781
+ </xsl:attribute>
9782
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
9783
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
9784
+ </xsl:attribute>
9785
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9786
+ </xsl:copy>
9787
+ </xsl:template>
9788
+
9789
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
9790
+ <xsl:copy>
9791
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9792
+ <xsl:if test="@depth = '1'">
9793
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9794
+ </xsl:if>
9795
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9796
+ </xsl:copy>
9797
+ </xsl:template>
9798
+ <!-- ===================================== -->
9799
+ <!-- ===================================== -->
9800
+ <!-- END: Make linear XML (need for landscape orientation) -->
9801
+ <!-- ===================================== -->
9802
+ <!-- ===================================== -->
9803
+
9470
9804
  <!-- for correct rendering combining chars -->
9471
9805
  <xsl:template match="*[local-name() = 'lang_none']">
9472
9806
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
@@ -382,6 +382,9 @@
382
382
  <optional>
383
383
  <ref name="dl"/>
384
384
  </optional>
385
+ <optional>
386
+ <ref name="source"/>
387
+ </optional>
385
388
  </element>
386
389
  </define>
387
390
  <define name="figure">
@@ -404,9 +407,6 @@
404
407
  <attribute name="class"/>
405
408
  </optional>
406
409
  <ref name="BlockAttributes"/>
407
- <optional>
408
- <ref name="source"/>
409
- </optional>
410
410
  <optional>
411
411
  <ref name="tname"/>
412
412
  </optional>
@@ -431,6 +431,20 @@
431
431
  <zeroOrMore>
432
432
  <ref name="note"/>
433
433
  </zeroOrMore>
434
+ <optional>
435
+ <ref name="source"/>
436
+ </optional>
437
+ </element>
438
+ </define>
439
+ <define name="source">
440
+ <element name="source">
441
+ <attribute name="status">
442
+ <ref name="SourceStatusType"/>
443
+ </attribute>
444
+ <ref name="origin"/>
445
+ <optional>
446
+ <ref name="modification"/>
447
+ </optional>
434
448
  </element>
435
449
  </define>
436
450
  <define name="sourcecode">
@@ -2099,10 +2113,7 @@
2099
2113
  <define name="termsource">
2100
2114
  <element name="termsource">
2101
2115
  <attribute name="status">
2102
- <choice>
2103
- <value>identical</value>
2104
- <value>modified</value>
2105
- </choice>
2116
+ <ref name="SourceStatusType"/>
2106
2117
  </attribute>
2107
2118
  <attribute name="type">
2108
2119
  <choice>
@@ -2116,6 +2127,17 @@
2116
2127
  </optional>
2117
2128
  </element>
2118
2129
  </define>
2130
+ <define name="SourceStatusType">
2131
+ <choice>
2132
+ <value>identical</value>
2133
+ <value>modified</value>
2134
+ <value>restyled</value>
2135
+ <value>context-added</value>
2136
+ <value>generalisation</value>
2137
+ <value>specialisation</value>
2138
+ <value>unspecified</value>
2139
+ </choice>
2140
+ </define>
2119
2141
  <define name="origin">
2120
2142
  <element name="origin">
2121
2143
  <choice>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.2.5".freeze
3
+ VERSION = "2.2.7".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.4.0"
32
+ spec.add_dependency "metanorma-generic", "~> 2.4.1"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.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-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 2.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 2.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement