metanorma-un 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13fff374aafdafa6d161fede1185537264028684bee832b5f7621bf6a123b59b
4
- data.tar.gz: 0c8aa1357775cd80b6e40d8d2ae741de66138677ef5ea2d01ee694b01fcf37c6
3
+ metadata.gz: 07114d1e32b69ac6b36edb86273058d1e9e7cc66962ca18d710be70c51e8e3f8
4
+ data.tar.gz: e48bfe9b62640242b24a609bb8ee7e858e01c9fbcb700647d7597565a8168c26
5
5
  SHA512:
6
- metadata.gz: bb1e37afcafb4c86209c90ba71886364bf14ee28533524973b38948d578a06766a7385099cded6e71c88fd8ae38ebb7e443ee63a235014c35847da2a0b18fe98
7
- data.tar.gz: 19b02d8f0fc9ff5f5149d1a35d498ceef5b70e15bd1d4ef88576dba0e4c7cea48d164c7c70060d2ca152746c7cf853870edf8c94f0f29bd36b870eb2f629a9af
6
+ metadata.gz: afb9c24220d815c2bfddceeb0484768954f120465177d24d6c9abaeac1f0fd155359910c2b4de8b3a56374783f463aa2452504ff1484aebba81a8814160e46c4
7
+ data.tar.gz: 31b47dd6d2c2d929eb5c9be33e54d89240ea6ce24cea1a4ac627b9aa16f3284c9971a40796282c079cf03998749837ed5bc5ab39d6a175cc567c16b260b6b1d2
@@ -1398,11 +1398,17 @@
1398
1398
  <!-- ========================== -->
1399
1399
  <!-- Definition's list styles -->
1400
1400
  <!-- ========================== -->
1401
+
1402
+ <xsl:attribute-set name="dl-block-style">
1403
+
1404
+ </xsl:attribute-set>
1405
+
1401
1406
  <xsl:attribute-set name="dt-row-style">
1402
1407
 
1403
1408
  </xsl:attribute-set>
1404
1409
 
1405
1410
  <xsl:attribute-set name="dt-cell-style">
1411
+
1406
1412
  </xsl:attribute-set>
1407
1413
 
1408
1414
  <xsl:attribute-set name="dt-block-style">
@@ -1420,6 +1426,7 @@
1420
1426
 
1421
1427
  <xsl:attribute-set name="dd-cell-style">
1422
1428
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1429
+
1423
1430
  </xsl:attribute-set>
1424
1431
 
1425
1432
  <!-- ========================== -->
@@ -1536,6 +1543,10 @@
1536
1543
 
1537
1544
  </xsl:attribute-set>
1538
1545
 
1546
+ <xsl:attribute-set name="figure-source-style">
1547
+
1548
+ </xsl:attribute-set>
1549
+
1539
1550
  <!-- Formula's styles -->
1540
1551
  <xsl:attribute-set name="formula-style">
1541
1552
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2070,7 +2081,7 @@
2070
2081
 
2071
2082
  <xsl:template name="processTables_Contents">
2072
2083
  <tables>
2073
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2084
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2074
2085
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2075
2086
  <xsl:copy-of select="*[local-name() = 'name']"/>
2076
2087
  </table>
@@ -2428,7 +2439,7 @@
2428
2439
  </xsl:attribute>
2429
2440
  </xsl:for-each>
2430
2441
 
2431
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2442
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2432
2443
  <xsl:if test="$isNoteOrFnExist = 'true'">
2433
2444
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2434
2445
  </xsl:if>
@@ -2472,7 +2483,7 @@
2472
2483
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2473
2484
  </xsl:when>
2474
2485
  <xsl:otherwise>
2475
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2486
+ <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 -->
2476
2487
  </xsl:otherwise>
2477
2488
  </xsl:choose>
2478
2489
 
@@ -2573,6 +2584,11 @@
2573
2584
  </xsl:if>
2574
2585
  </xsl:template> <!-- table/name -->
2575
2586
 
2587
+ <!-- SOURCE: ... -->
2588
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2589
+ <xsl:call-template name="termsource"/>
2590
+ </xsl:template>
2591
+
2576
2592
  <xsl:template name="calculate-columns-numbers">
2577
2593
  <xsl:param name="table-row"/>
2578
2594
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2929,7 +2945,7 @@
2929
2945
  </fo:table-header>
2930
2946
  </xsl:template> <!-- thead -->
2931
2947
 
2932
- <!-- template is using for iso, jcgm, bsi only -->
2948
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2933
2949
  <xsl:template name="table-header-title">
2934
2950
  <xsl:param name="cols-count"/>
2935
2951
  <!-- row for title -->
@@ -2972,7 +2988,7 @@
2972
2988
  <xsl:param name="colwidths"/>
2973
2989
  <xsl:param name="colgroup"/>
2974
2990
 
2975
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2991
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2976
2992
 
2977
2993
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2978
2994
 
@@ -3042,6 +3058,7 @@
3042
3058
 
3043
3059
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3044
3060
  <xsl:apply-templates select="../*[local-name()='note']"/>
3061
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3045
3062
 
3046
3063
  <xsl:variable name="isDisplayRowSeparator">
3047
3064
 
@@ -3682,7 +3699,7 @@
3682
3699
  <xsl:variable name="isAdded" select="@added"/>
3683
3700
  <xsl:variable name="isDeleted" select="@deleted"/>
3684
3701
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3685
- <fo:block-container>
3702
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3686
3703
 
3687
3704
  <xsl:call-template name="setBlockSpanAll"/>
3688
3705
 
@@ -3690,6 +3707,18 @@
3690
3707
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3691
3708
  </xsl:if>
3692
3709
 
3710
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3711
+ <!-- set font-size as sourcecode font-size -->
3712
+ <xsl:variable name="sourcecode_attributes">
3713
+ <xsl:call-template name="get_sourcecode_attributes"/>
3714
+ </xsl:variable>
3715
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3716
+ <xsl:attribute name="{local-name()}">
3717
+ <xsl:value-of select="."/>
3718
+ </xsl:attribute>
3719
+ </xsl:for-each>
3720
+ </xsl:if>
3721
+
3693
3722
  <xsl:if test="parent::*[local-name() = 'note']">
3694
3723
  <xsl:attribute name="margin-left">
3695
3724
  <xsl:choose>
@@ -4123,6 +4152,7 @@
4123
4152
  <xsl:param name="split_keep-within-line"/>
4124
4153
 
4125
4154
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4155
+
4126
4156
  <xsl:call-template name="insert_dt_cell">
4127
4157
  <xsl:with-param name="key_iso" select="$key_iso"/>
4128
4158
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4144,6 +4174,7 @@
4144
4174
  <!-- border is mandatory, to calculate real width -->
4145
4175
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4146
4176
  <xsl:attribute name="text-align">left</xsl:attribute>
4177
+
4147
4178
  </xsl:if>
4148
4179
 
4149
4180
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4586,6 +4617,7 @@
4586
4617
  <fo:inline>
4587
4618
  <xsl:for-each select="$styles/style">
4588
4619
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4620
+
4589
4621
  </xsl:for-each>
4590
4622
  <xsl:apply-templates/>
4591
4623
  </fo:inline>
@@ -6101,6 +6133,13 @@
6101
6133
  </fo:block>
6102
6134
  </xsl:template>
6103
6135
 
6136
+ <!-- SOURCE: ... -->
6137
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6138
+
6139
+ <xsl:call-template name="termsource"/>
6140
+
6141
+ </xsl:template>
6142
+
6104
6143
  <xsl:template match="*[local-name() = 'image']">
6105
6144
  <xsl:variable name="isAdded" select="../@added"/>
6106
6145
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7231,9 +7270,11 @@
7231
7270
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7232
7271
  </xsl:if>
7233
7272
 
7234
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7273
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7235
7274
  </fo:block>
7236
7275
 
7276
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7277
+
7237
7278
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7238
7279
 
7239
7280
  </fo:block-container>
@@ -7265,11 +7306,22 @@
7265
7306
  <!-- add sourcecode highlighting -->
7266
7307
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7267
7308
  <xsl:variable name="class" select="@class"/>
7309
+
7310
+ <!-- Example: <1> -->
7311
+ <xsl:variable name="is_callout">
7312
+ <xsl:if test="parent::*[local-name() = 'dt']">
7313
+ <xsl:variable name="dt_id" select="../@id"/>
7314
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7315
+ </xsl:if>
7316
+ </xsl:variable>
7317
+
7268
7318
  <xsl:choose>
7269
7319
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7270
7320
  <fo:inline>
7271
7321
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7322
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7272
7323
  <xsl:apply-templates/>
7324
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7273
7325
  </fo:inline>
7274
7326
  </xsl:when>
7275
7327
  <xsl:otherwise>
@@ -7693,6 +7745,10 @@
7693
7745
  </fo:block>
7694
7746
  </xsl:template>
7695
7747
 
7748
+ <xsl:template match="*[local-name() = 'div']">
7749
+ <fo:block><xsl:apply-templates/></fo:block>
7750
+ </xsl:template>
7751
+
7696
7752
  <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']">
7697
7753
  <fo:block xsl:use-attribute-sets="inherit-style">
7698
7754
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8390,13 +8446,8 @@
8390
8446
  </xsl:template>
8391
8447
 
8392
8448
  <xsl:template match="*[local-name() = 'deprecates']">
8393
- <xsl:variable name="title-deprecated">
8394
- <xsl:call-template name="getLocalizedString">
8395
- <xsl:with-param name="key">deprecated</xsl:with-param>
8396
- </xsl:call-template>
8397
- </xsl:variable>
8398
8449
  <fo:block xsl:use-attribute-sets="deprecates-style">
8399
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8450
+ <xsl:apply-templates/>
8400
8451
  </fo:block>
8401
8452
  </xsl:template>
8402
8453
 
@@ -9611,6 +9662,23 @@
9611
9662
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9612
9663
  <xsl:copy-of select="."/>
9613
9664
  </xsl:template>
9665
+
9666
+ <!-- add @id, redundant for table auto-layout algorithm -->
9667
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9668
+ <xsl:copy>
9669
+ <xsl:copy-of select="@*"/>
9670
+ <xsl:call-template name="add_id"/>
9671
+ <xsl:apply-templates mode="update_xml_step1"/>
9672
+ </xsl:copy>
9673
+ </xsl:template>
9674
+
9675
+ <xsl:template name="add_id">
9676
+ <xsl:if test="not(@id)">
9677
+ <!-- add @id - first element with @id plus '_element_name' -->
9678
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9679
+ </xsl:if>
9680
+ </xsl:template>
9681
+
9614
9682
  <!-- =========================================================================== -->
9615
9683
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9616
9684
  <!-- =========================================================================== -->
@@ -1398,11 +1398,17 @@
1398
1398
  <!-- ========================== -->
1399
1399
  <!-- Definition's list styles -->
1400
1400
  <!-- ========================== -->
1401
+
1402
+ <xsl:attribute-set name="dl-block-style">
1403
+
1404
+ </xsl:attribute-set>
1405
+
1401
1406
  <xsl:attribute-set name="dt-row-style">
1402
1407
 
1403
1408
  </xsl:attribute-set>
1404
1409
 
1405
1410
  <xsl:attribute-set name="dt-cell-style">
1411
+
1406
1412
  </xsl:attribute-set>
1407
1413
 
1408
1414
  <xsl:attribute-set name="dt-block-style">
@@ -1420,6 +1426,7 @@
1420
1426
 
1421
1427
  <xsl:attribute-set name="dd-cell-style">
1422
1428
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1429
+
1423
1430
  </xsl:attribute-set>
1424
1431
 
1425
1432
  <!-- ========================== -->
@@ -1536,6 +1543,10 @@
1536
1543
 
1537
1544
  </xsl:attribute-set>
1538
1545
 
1546
+ <xsl:attribute-set name="figure-source-style">
1547
+
1548
+ </xsl:attribute-set>
1549
+
1539
1550
  <!-- Formula's styles -->
1540
1551
  <xsl:attribute-set name="formula-style">
1541
1552
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2070,7 +2081,7 @@
2070
2081
 
2071
2082
  <xsl:template name="processTables_Contents">
2072
2083
  <tables>
2073
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2084
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2074
2085
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2075
2086
  <xsl:copy-of select="*[local-name() = 'name']"/>
2076
2087
  </table>
@@ -2428,7 +2439,7 @@
2428
2439
  </xsl:attribute>
2429
2440
  </xsl:for-each>
2430
2441
 
2431
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2442
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2432
2443
  <xsl:if test="$isNoteOrFnExist = 'true'">
2433
2444
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2434
2445
  </xsl:if>
@@ -2472,7 +2483,7 @@
2472
2483
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2473
2484
  </xsl:when>
2474
2485
  <xsl:otherwise>
2475
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2486
+ <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 -->
2476
2487
  </xsl:otherwise>
2477
2488
  </xsl:choose>
2478
2489
 
@@ -2573,6 +2584,11 @@
2573
2584
  </xsl:if>
2574
2585
  </xsl:template> <!-- table/name -->
2575
2586
 
2587
+ <!-- SOURCE: ... -->
2588
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2589
+ <xsl:call-template name="termsource"/>
2590
+ </xsl:template>
2591
+
2576
2592
  <xsl:template name="calculate-columns-numbers">
2577
2593
  <xsl:param name="table-row"/>
2578
2594
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2929,7 +2945,7 @@
2929
2945
  </fo:table-header>
2930
2946
  </xsl:template> <!-- thead -->
2931
2947
 
2932
- <!-- template is using for iso, jcgm, bsi only -->
2948
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2933
2949
  <xsl:template name="table-header-title">
2934
2950
  <xsl:param name="cols-count"/>
2935
2951
  <!-- row for title -->
@@ -2972,7 +2988,7 @@
2972
2988
  <xsl:param name="colwidths"/>
2973
2989
  <xsl:param name="colgroup"/>
2974
2990
 
2975
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2991
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2976
2992
 
2977
2993
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2978
2994
 
@@ -3042,6 +3058,7 @@
3042
3058
 
3043
3059
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3044
3060
  <xsl:apply-templates select="../*[local-name()='note']"/>
3061
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3045
3062
 
3046
3063
  <xsl:variable name="isDisplayRowSeparator">
3047
3064
 
@@ -3682,7 +3699,7 @@
3682
3699
  <xsl:variable name="isAdded" select="@added"/>
3683
3700
  <xsl:variable name="isDeleted" select="@deleted"/>
3684
3701
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3685
- <fo:block-container>
3702
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3686
3703
 
3687
3704
  <xsl:call-template name="setBlockSpanAll"/>
3688
3705
 
@@ -3690,6 +3707,18 @@
3690
3707
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3691
3708
  </xsl:if>
3692
3709
 
3710
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3711
+ <!-- set font-size as sourcecode font-size -->
3712
+ <xsl:variable name="sourcecode_attributes">
3713
+ <xsl:call-template name="get_sourcecode_attributes"/>
3714
+ </xsl:variable>
3715
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3716
+ <xsl:attribute name="{local-name()}">
3717
+ <xsl:value-of select="."/>
3718
+ </xsl:attribute>
3719
+ </xsl:for-each>
3720
+ </xsl:if>
3721
+
3693
3722
  <xsl:if test="parent::*[local-name() = 'note']">
3694
3723
  <xsl:attribute name="margin-left">
3695
3724
  <xsl:choose>
@@ -4123,6 +4152,7 @@
4123
4152
  <xsl:param name="split_keep-within-line"/>
4124
4153
 
4125
4154
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4155
+
4126
4156
  <xsl:call-template name="insert_dt_cell">
4127
4157
  <xsl:with-param name="key_iso" select="$key_iso"/>
4128
4158
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4144,6 +4174,7 @@
4144
4174
  <!-- border is mandatory, to calculate real width -->
4145
4175
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4146
4176
  <xsl:attribute name="text-align">left</xsl:attribute>
4177
+
4147
4178
  </xsl:if>
4148
4179
 
4149
4180
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4586,6 +4617,7 @@
4586
4617
  <fo:inline>
4587
4618
  <xsl:for-each select="$styles/style">
4588
4619
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4620
+
4589
4621
  </xsl:for-each>
4590
4622
  <xsl:apply-templates/>
4591
4623
  </fo:inline>
@@ -6101,6 +6133,13 @@
6101
6133
  </fo:block>
6102
6134
  </xsl:template>
6103
6135
 
6136
+ <!-- SOURCE: ... -->
6137
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6138
+
6139
+ <xsl:call-template name="termsource"/>
6140
+
6141
+ </xsl:template>
6142
+
6104
6143
  <xsl:template match="*[local-name() = 'image']">
6105
6144
  <xsl:variable name="isAdded" select="../@added"/>
6106
6145
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7231,9 +7270,11 @@
7231
7270
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7232
7271
  </xsl:if>
7233
7272
 
7234
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7273
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7235
7274
  </fo:block>
7236
7275
 
7276
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7277
+
7237
7278
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7238
7279
 
7239
7280
  </fo:block-container>
@@ -7265,11 +7306,22 @@
7265
7306
  <!-- add sourcecode highlighting -->
7266
7307
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7267
7308
  <xsl:variable name="class" select="@class"/>
7309
+
7310
+ <!-- Example: <1> -->
7311
+ <xsl:variable name="is_callout">
7312
+ <xsl:if test="parent::*[local-name() = 'dt']">
7313
+ <xsl:variable name="dt_id" select="../@id"/>
7314
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7315
+ </xsl:if>
7316
+ </xsl:variable>
7317
+
7268
7318
  <xsl:choose>
7269
7319
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7270
7320
  <fo:inline>
7271
7321
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7322
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7272
7323
  <xsl:apply-templates/>
7324
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7273
7325
  </fo:inline>
7274
7326
  </xsl:when>
7275
7327
  <xsl:otherwise>
@@ -7693,6 +7745,10 @@
7693
7745
  </fo:block>
7694
7746
  </xsl:template>
7695
7747
 
7748
+ <xsl:template match="*[local-name() = 'div']">
7749
+ <fo:block><xsl:apply-templates/></fo:block>
7750
+ </xsl:template>
7751
+
7696
7752
  <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']">
7697
7753
  <fo:block xsl:use-attribute-sets="inherit-style">
7698
7754
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8390,13 +8446,8 @@
8390
8446
  </xsl:template>
8391
8447
 
8392
8448
  <xsl:template match="*[local-name() = 'deprecates']">
8393
- <xsl:variable name="title-deprecated">
8394
- <xsl:call-template name="getLocalizedString">
8395
- <xsl:with-param name="key">deprecated</xsl:with-param>
8396
- </xsl:call-template>
8397
- </xsl:variable>
8398
8449
  <fo:block xsl:use-attribute-sets="deprecates-style">
8399
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8450
+ <xsl:apply-templates/>
8400
8451
  </fo:block>
8401
8452
  </xsl:template>
8402
8453
 
@@ -9611,6 +9662,23 @@
9611
9662
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9612
9663
  <xsl:copy-of select="."/>
9613
9664
  </xsl:template>
9665
+
9666
+ <!-- add @id, redundant for table auto-layout algorithm -->
9667
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9668
+ <xsl:copy>
9669
+ <xsl:copy-of select="@*"/>
9670
+ <xsl:call-template name="add_id"/>
9671
+ <xsl:apply-templates mode="update_xml_step1"/>
9672
+ </xsl:copy>
9673
+ </xsl:template>
9674
+
9675
+ <xsl:template name="add_id">
9676
+ <xsl:if test="not(@id)">
9677
+ <!-- add @id - first element with @id plus '_element_name' -->
9678
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9679
+ </xsl:if>
9680
+ </xsl:template>
9681
+
9614
9682
  <!-- =========================================================================== -->
9615
9683
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9616
9684
  <!-- =========================================================================== -->
@@ -1464,11 +1464,17 @@
1464
1464
  <!-- ========================== -->
1465
1465
  <!-- Definition's list styles -->
1466
1466
  <!-- ========================== -->
1467
+
1468
+ <xsl:attribute-set name="dl-block-style">
1469
+
1470
+ </xsl:attribute-set>
1471
+
1467
1472
  <xsl:attribute-set name="dt-row-style">
1468
1473
 
1469
1474
  </xsl:attribute-set>
1470
1475
 
1471
1476
  <xsl:attribute-set name="dt-cell-style">
1477
+
1472
1478
  </xsl:attribute-set>
1473
1479
 
1474
1480
  <xsl:attribute-set name="dt-block-style">
@@ -1486,6 +1492,7 @@
1486
1492
 
1487
1493
  <xsl:attribute-set name="dd-cell-style">
1488
1494
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1495
+
1489
1496
  </xsl:attribute-set>
1490
1497
 
1491
1498
  <!-- ========================== -->
@@ -1605,6 +1612,10 @@
1605
1612
 
1606
1613
  </xsl:attribute-set>
1607
1614
 
1615
+ <xsl:attribute-set name="figure-source-style">
1616
+
1617
+ </xsl:attribute-set>
1618
+
1608
1619
  <!-- Formula's styles -->
1609
1620
  <xsl:attribute-set name="formula-style">
1610
1621
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2140,7 +2151,7 @@
2140
2151
 
2141
2152
  <xsl:template name="processTables_Contents">
2142
2153
  <tables>
2143
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2154
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2144
2155
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2145
2156
  <xsl:copy-of select="*[local-name() = 'name']"/>
2146
2157
  </table>
@@ -2507,7 +2518,7 @@
2507
2518
  </xsl:attribute>
2508
2519
  </xsl:for-each>
2509
2520
 
2510
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2521
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2511
2522
  <xsl:if test="$isNoteOrFnExist = 'true'">
2512
2523
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2513
2524
  </xsl:if>
@@ -2551,7 +2562,7 @@
2551
2562
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2552
2563
  </xsl:when>
2553
2564
  <xsl:otherwise>
2554
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2565
+ <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 -->
2555
2566
  </xsl:otherwise>
2556
2567
  </xsl:choose>
2557
2568
 
@@ -2652,6 +2663,11 @@
2652
2663
  </xsl:if>
2653
2664
  </xsl:template> <!-- table/name -->
2654
2665
 
2666
+ <!-- SOURCE: ... -->
2667
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2668
+ <xsl:call-template name="termsource"/>
2669
+ </xsl:template>
2670
+
2655
2671
  <xsl:template name="calculate-columns-numbers">
2656
2672
  <xsl:param name="table-row"/>
2657
2673
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3008,7 +3024,7 @@
3008
3024
  </fo:table-header>
3009
3025
  </xsl:template> <!-- thead -->
3010
3026
 
3011
- <!-- template is using for iso, jcgm, bsi only -->
3027
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3012
3028
  <xsl:template name="table-header-title">
3013
3029
  <xsl:param name="cols-count"/>
3014
3030
  <!-- row for title -->
@@ -3051,7 +3067,7 @@
3051
3067
  <xsl:param name="colwidths"/>
3052
3068
  <xsl:param name="colgroup"/>
3053
3069
 
3054
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3070
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3055
3071
 
3056
3072
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3057
3073
 
@@ -3121,6 +3137,7 @@
3121
3137
 
3122
3138
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3123
3139
  <xsl:apply-templates select="../*[local-name()='note']"/>
3140
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3124
3141
 
3125
3142
  <xsl:variable name="isDisplayRowSeparator">
3126
3143
 
@@ -3777,7 +3794,7 @@
3777
3794
  <xsl:variable name="isAdded" select="@added"/>
3778
3795
  <xsl:variable name="isDeleted" select="@deleted"/>
3779
3796
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3780
- <fo:block-container>
3797
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3781
3798
 
3782
3799
  <xsl:call-template name="setBlockSpanAll"/>
3783
3800
 
@@ -3785,6 +3802,18 @@
3785
3802
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3786
3803
  </xsl:if>
3787
3804
 
3805
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3806
+ <!-- set font-size as sourcecode font-size -->
3807
+ <xsl:variable name="sourcecode_attributes">
3808
+ <xsl:call-template name="get_sourcecode_attributes"/>
3809
+ </xsl:variable>
3810
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3811
+ <xsl:attribute name="{local-name()}">
3812
+ <xsl:value-of select="."/>
3813
+ </xsl:attribute>
3814
+ </xsl:for-each>
3815
+ </xsl:if>
3816
+
3788
3817
  <xsl:if test="parent::*[local-name() = 'note']">
3789
3818
  <xsl:attribute name="margin-left">
3790
3819
  <xsl:choose>
@@ -4218,6 +4247,7 @@
4218
4247
  <xsl:param name="split_keep-within-line"/>
4219
4248
 
4220
4249
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4250
+
4221
4251
  <xsl:call-template name="insert_dt_cell">
4222
4252
  <xsl:with-param name="key_iso" select="$key_iso"/>
4223
4253
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4239,6 +4269,7 @@
4239
4269
  <!-- border is mandatory, to calculate real width -->
4240
4270
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4241
4271
  <xsl:attribute name="text-align">left</xsl:attribute>
4272
+
4242
4273
  </xsl:if>
4243
4274
 
4244
4275
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4681,6 +4712,7 @@
4681
4712
  <fo:inline>
4682
4713
  <xsl:for-each select="$styles/style">
4683
4714
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4715
+
4684
4716
  </xsl:for-each>
4685
4717
  <xsl:apply-templates/>
4686
4718
  </fo:inline>
@@ -6200,6 +6232,13 @@
6200
6232
  </fo:block>
6201
6233
  </xsl:template>
6202
6234
 
6235
+ <!-- SOURCE: ... -->
6236
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6237
+
6238
+ <xsl:call-template name="termsource"/>
6239
+
6240
+ </xsl:template>
6241
+
6203
6242
  <xsl:template match="*[local-name() = 'image']">
6204
6243
  <xsl:variable name="isAdded" select="../@added"/>
6205
6244
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7335,9 +7374,11 @@
7335
7374
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7336
7375
  </xsl:if>
7337
7376
 
7338
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7377
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7339
7378
  </fo:block>
7340
7379
 
7380
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7381
+
7341
7382
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7342
7383
 
7343
7384
  </fo:block-container>
@@ -7369,11 +7410,22 @@
7369
7410
  <!-- add sourcecode highlighting -->
7370
7411
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7371
7412
  <xsl:variable name="class" select="@class"/>
7413
+
7414
+ <!-- Example: <1> -->
7415
+ <xsl:variable name="is_callout">
7416
+ <xsl:if test="parent::*[local-name() = 'dt']">
7417
+ <xsl:variable name="dt_id" select="../@id"/>
7418
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7419
+ </xsl:if>
7420
+ </xsl:variable>
7421
+
7372
7422
  <xsl:choose>
7373
7423
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7374
7424
  <fo:inline>
7375
7425
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7426
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7376
7427
  <xsl:apply-templates/>
7428
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7377
7429
  </fo:inline>
7378
7430
  </xsl:when>
7379
7431
  <xsl:otherwise>
@@ -7797,6 +7849,10 @@
7797
7849
  </fo:block>
7798
7850
  </xsl:template>
7799
7851
 
7852
+ <xsl:template match="*[local-name() = 'div']">
7853
+ <fo:block><xsl:apply-templates/></fo:block>
7854
+ </xsl:template>
7855
+
7800
7856
  <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']">
7801
7857
  <fo:block xsl:use-attribute-sets="inherit-style">
7802
7858
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8492,13 +8548,8 @@
8492
8548
  </xsl:template>
8493
8549
 
8494
8550
  <xsl:template match="*[local-name() = 'deprecates']">
8495
- <xsl:variable name="title-deprecated">
8496
- <xsl:call-template name="getLocalizedString">
8497
- <xsl:with-param name="key">deprecated</xsl:with-param>
8498
- </xsl:call-template>
8499
- </xsl:variable>
8500
8551
  <fo:block xsl:use-attribute-sets="deprecates-style">
8501
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8552
+ <xsl:apply-templates/>
8502
8553
  </fo:block>
8503
8554
  </xsl:template>
8504
8555
 
@@ -9716,6 +9767,23 @@
9716
9767
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9717
9768
  <xsl:copy-of select="."/>
9718
9769
  </xsl:template>
9770
+
9771
+ <!-- add @id, redundant for table auto-layout algorithm -->
9772
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9773
+ <xsl:copy>
9774
+ <xsl:copy-of select="@*"/>
9775
+ <xsl:call-template name="add_id"/>
9776
+ <xsl:apply-templates mode="update_xml_step1"/>
9777
+ </xsl:copy>
9778
+ </xsl:template>
9779
+
9780
+ <xsl:template name="add_id">
9781
+ <xsl:if test="not(@id)">
9782
+ <!-- add @id - first element with @id plus '_element_name' -->
9783
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9784
+ </xsl:if>
9785
+ </xsl:template>
9786
+
9719
9787
  <!-- =========================================================================== -->
9720
9788
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9721
9789
  <!-- =========================================================================== -->
@@ -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 UN
3
- VERSION = "0.10.6".freeze
3
+ VERSION = "0.10.7".freeze
4
4
  end
5
5
  end
data/metanorma-un.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "roman-numerals"
32
32
  spec.add_dependency "twitter_cldr"
33
33
 
34
- spec.add_dependency "metanorma-standoc", "~> 2.4.0"
34
+ spec.add_dependency "metanorma-standoc", "~> 2.4.2"
35
35
 
36
36
  spec.add_development_dependency "debug"
37
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.6
4
+ version: 0.10.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-27 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: iso-639
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.4.0
61
+ version: 2.4.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.4.0
68
+ version: 2.4.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debug
71
71
  requirement: !ruby/object:Gem::Requirement