metanorma-ribose 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: b6569f96ac8899474552e44500006cf02b8c2e4c3e1da5b9548dbc03d17e1617
4
- data.tar.gz: 1c71fcf61463fdde5a8c40cc1177373d2ca03ab5bd6c428685244b6eacc8a678
3
+ metadata.gz: 7165b810d75c75ae9265cd7536229c31effbf384eca0d8df7bc3886b3104068d
4
+ data.tar.gz: 596450c4cbf2a31dd4294950e86a6762d20f59a26a8a289d8a84ee2b703ccf1a
5
5
  SHA512:
6
- metadata.gz: 66968b01642c0b65450b61e359e0e7e17c80447b0d729f114518d89c585e9188ba86af499a7b8c20636625d2901a90815df9757f8adf1bc8ca99d4f49e192956
7
- data.tar.gz: 8f0d4ab655b1592aa400c0c7844a96e905e9a67c93458380e09c358955e8e4c26762dcda3043302a9b6b0c791ae9e9921ef12320491c2c4dcb8e8107c137e8d4
6
+ metadata.gz: 467db5e091b769e9e0fe6b285e03dd2cdb504420dd2f2f7d5f70bd456131035339d54617bb4e692986af9f56067e3e5c51d40c38523db0c4b79abebd8478d331
7
+ data.tar.gz: 8dcd95606761269f05d2f4cf7eea3a531374fa389b52e55904b682824a56f4be6b7d4861858d1155dace7d16d6791bb76b19ce729e324077e4c64988c0171361
@@ -1876,6 +1876,11 @@
1876
1876
  <!-- ========================== -->
1877
1877
  <!-- Definition's list styles -->
1878
1878
  <!-- ========================== -->
1879
+
1880
+ <xsl:attribute-set name="dl-block-style">
1881
+
1882
+ </xsl:attribute-set>
1883
+
1879
1884
  <xsl:attribute-set name="dt-row-style">
1880
1885
 
1881
1886
  <xsl:attribute name="min-height">7mm</xsl:attribute>
@@ -1883,6 +1888,7 @@
1883
1888
  </xsl:attribute-set>
1884
1889
 
1885
1890
  <xsl:attribute-set name="dt-cell-style">
1891
+
1886
1892
  </xsl:attribute-set>
1887
1893
 
1888
1894
  <xsl:attribute-set name="dt-block-style">
@@ -1904,6 +1910,7 @@
1904
1910
 
1905
1911
  <xsl:attribute-set name="dd-cell-style">
1906
1912
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1913
+
1907
1914
  </xsl:attribute-set>
1908
1915
 
1909
1916
  <!-- ========================== -->
@@ -2026,6 +2033,7 @@
2026
2033
  <xsl:attribute-set name="term-name-style">
2027
2034
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2028
2035
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2036
+
2029
2037
  </xsl:attribute-set>
2030
2038
 
2031
2039
  <xsl:attribute-set name="figure-block-style">
@@ -2057,6 +2065,10 @@
2057
2065
 
2058
2066
  </xsl:attribute-set>
2059
2067
 
2068
+ <xsl:attribute-set name="figure-source-style">
2069
+
2070
+ </xsl:attribute-set>
2071
+
2060
2072
  <!-- Formula's styles -->
2061
2073
  <xsl:attribute-set name="formula-style">
2062
2074
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2625,7 +2637,7 @@
2625
2637
 
2626
2638
  <xsl:template name="processTables_Contents">
2627
2639
  <tables>
2628
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2640
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2629
2641
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2630
2642
  <xsl:copy-of select="*[local-name() = 'name']"/>
2631
2643
  </table>
@@ -2972,7 +2984,7 @@
2972
2984
  </xsl:attribute>
2973
2985
  </xsl:for-each>
2974
2986
 
2975
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2987
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2976
2988
  <xsl:if test="$isNoteOrFnExist = 'true'">
2977
2989
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2978
2990
  </xsl:if>
@@ -3016,7 +3028,7 @@
3016
3028
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3017
3029
  </xsl:when>
3018
3030
  <xsl:otherwise>
3019
- <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 -->
3031
+ <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 -->
3020
3032
  </xsl:otherwise>
3021
3033
  </xsl:choose>
3022
3034
 
@@ -3120,6 +3132,11 @@
3120
3132
  </xsl:if>
3121
3133
  </xsl:template> <!-- table/name -->
3122
3134
 
3135
+ <!-- SOURCE: ... -->
3136
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3137
+ <xsl:call-template name="termsource"/>
3138
+ </xsl:template>
3139
+
3123
3140
  <xsl:template name="calculate-columns-numbers">
3124
3141
  <xsl:param name="table-row"/>
3125
3142
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3476,7 +3493,7 @@
3476
3493
  </fo:table-header>
3477
3494
  </xsl:template> <!-- thead -->
3478
3495
 
3479
- <!-- template is using for iso, jcgm, bsi only -->
3496
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3480
3497
  <xsl:template name="table-header-title">
3481
3498
  <xsl:param name="cols-count"/>
3482
3499
  <!-- row for title -->
@@ -3519,7 +3536,7 @@
3519
3536
  <xsl:param name="colwidths"/>
3520
3537
  <xsl:param name="colgroup"/>
3521
3538
 
3522
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3539
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3523
3540
 
3524
3541
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3525
3542
 
@@ -3587,7 +3604,9 @@
3587
3604
 
3588
3605
  <!-- except gb and bsi -->
3589
3606
 
3607
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3590
3608
  <xsl:apply-templates select="../*[local-name()='note']"/>
3609
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3591
3610
 
3592
3611
  <xsl:variable name="isDisplayRowSeparator">
3593
3612
 
@@ -3712,7 +3731,7 @@
3712
3731
  <!-- ===================== -->
3713
3732
  <!-- Table's row processing -->
3714
3733
  <!-- ===================== -->
3715
- <!-- row in table header (thead) -->
3734
+ <!-- row in table header (thead) thead/tr -->
3716
3735
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3717
3736
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3718
3737
 
@@ -3746,7 +3765,7 @@
3746
3765
  </xsl:choose>
3747
3766
  </xsl:template>
3748
3767
 
3749
- <!-- row in table footer (tfoot) -->
3768
+ <!-- row in table footer (tfoot), tfoot/tr -->
3750
3769
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3751
3770
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3752
3771
 
@@ -4225,12 +4244,26 @@
4225
4244
  <xsl:variable name="isAdded" select="@added"/>
4226
4245
  <xsl:variable name="isDeleted" select="@deleted"/>
4227
4246
  <!-- <dl><xsl:copy-of select="."/></dl> -->
4228
- <fo:block-container>
4247
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
4248
+
4249
+ <xsl:call-template name="setBlockSpanAll"/>
4229
4250
 
4230
4251
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
4231
4252
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4232
4253
  </xsl:if>
4233
4254
 
4255
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
4256
+ <!-- set font-size as sourcecode font-size -->
4257
+ <xsl:variable name="sourcecode_attributes">
4258
+ <xsl:call-template name="get_sourcecode_attributes"/>
4259
+ </xsl:variable>
4260
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
4261
+ <xsl:attribute name="{local-name()}">
4262
+ <xsl:value-of select="."/>
4263
+ </xsl:attribute>
4264
+ </xsl:for-each>
4265
+ </xsl:if>
4266
+
4234
4267
  <xsl:if test="parent::*[local-name() = 'note']">
4235
4268
  <xsl:attribute name="margin-left">
4236
4269
  <xsl:choose>
@@ -4667,6 +4700,7 @@
4667
4700
  <xsl:param name="split_keep-within-line"/>
4668
4701
 
4669
4702
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4703
+
4670
4704
  <xsl:call-template name="insert_dt_cell">
4671
4705
  <xsl:with-param name="key_iso" select="$key_iso"/>
4672
4706
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4688,6 +4722,7 @@
4688
4722
  <!-- border is mandatory, to calculate real width -->
4689
4723
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4690
4724
  <xsl:attribute name="text-align">left</xsl:attribute>
4725
+
4691
4726
  </xsl:if>
4692
4727
 
4693
4728
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -5140,6 +5175,7 @@
5140
5175
  <fo:inline>
5141
5176
  <xsl:for-each select="$styles/style">
5142
5177
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5178
+
5143
5179
  </xsl:for-each>
5144
5180
  <xsl:apply-templates/>
5145
5181
  </fo:inline>
@@ -6308,13 +6344,17 @@
6308
6344
  </xsl:template>
6309
6345
 
6310
6346
  <xsl:template match="*[local-name() = 'callout']">
6311
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
6347
+ <xsl:choose>
6348
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
6349
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
6350
+ </xsl:choose>
6312
6351
  </xsl:template>
6313
6352
 
6314
6353
  <xsl:template match="*[local-name() = 'annotation']">
6315
6354
  <xsl:variable name="annotation-id" select="@id"/>
6316
6355
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
6317
6356
  <fo:block id="{$annotation-id}" white-space="nowrap">
6357
+
6318
6358
  <fo:inline>
6319
6359
  <xsl:apply-templates>
6320
6360
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -6419,6 +6459,10 @@
6419
6459
  <!-- ====== -->
6420
6460
  <!-- ====== -->
6421
6461
 
6462
+ <xsl:template name="setBlockSpanAll">
6463
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
6464
+ </xsl:template>
6465
+
6422
6466
  <!-- ====== -->
6423
6467
  <!-- note -->
6424
6468
  <!-- termnote -->
@@ -6428,6 +6472,8 @@
6428
6472
 
6429
6473
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6430
6474
 
6475
+ <xsl:call-template name="setBlockSpanAll"/>
6476
+
6431
6477
  <xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol and not(ancestor::rsd:note[1]/following-sibling::*)">
6432
6478
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
6433
6479
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -6483,6 +6529,8 @@
6483
6529
  <xsl:template match="*[local-name() = 'termnote']">
6484
6530
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6485
6531
 
6532
+ <xsl:call-template name="setBlockSpanAll"/>
6533
+
6486
6534
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6487
6535
 
6488
6536
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -6641,6 +6689,13 @@
6641
6689
  </fo:block>
6642
6690
  </xsl:template>
6643
6691
 
6692
+ <!-- SOURCE: ... -->
6693
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6694
+
6695
+ <xsl:call-template name="termsource"/>
6696
+
6697
+ </xsl:template>
6698
+
6644
6699
  <xsl:template match="*[local-name() = 'image']">
6645
6700
  <xsl:variable name="isAdded" select="../@added"/>
6646
6701
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7791,9 +7846,11 @@
7791
7846
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7792
7847
  </xsl:if>
7793
7848
 
7794
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7849
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7795
7850
  </fo:block>
7796
7851
 
7852
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7853
+
7797
7854
  </fo:block-container>
7798
7855
  </fo:block-container>
7799
7856
  </xsl:otherwise>
@@ -7823,11 +7880,22 @@
7823
7880
  <!-- add sourcecode highlighting -->
7824
7881
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7825
7882
  <xsl:variable name="class" select="@class"/>
7883
+
7884
+ <!-- Example: <1> -->
7885
+ <xsl:variable name="is_callout">
7886
+ <xsl:if test="parent::*[local-name() = 'dt']">
7887
+ <xsl:variable name="dt_id" select="../@id"/>
7888
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7889
+ </xsl:if>
7890
+ </xsl:variable>
7891
+
7826
7892
  <xsl:choose>
7827
7893
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7828
7894
  <fo:inline>
7829
7895
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7896
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7830
7897
  <xsl:apply-templates/>
7898
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7831
7899
  </fo:inline>
7832
7900
  </xsl:when>
7833
7901
  <xsl:otherwise>
@@ -8251,6 +8319,10 @@
8251
8319
  </fo:block>
8252
8320
  </xsl:template>
8253
8321
 
8322
+ <xsl:template match="*[local-name() = 'div']">
8323
+ <fo:block><xsl:apply-templates/></fo:block>
8324
+ </xsl:template>
8325
+
8254
8326
  <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']">
8255
8327
  <fo:block xsl:use-attribute-sets="inherit-style">
8256
8328
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8414,6 +8486,9 @@
8414
8486
  <!-- ====== -->
8415
8487
  <xsl:template match="*[local-name() = 'termexample']">
8416
8488
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8489
+
8490
+ <xsl:call-template name="setBlockSpanAll"/>
8491
+
8417
8492
  <xsl:apply-templates select="*[local-name()='name']"/>
8418
8493
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8419
8494
  </fo:block>
@@ -8465,6 +8540,8 @@
8465
8540
 
8466
8541
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
8467
8542
 
8543
+ <xsl:call-template name="setBlockSpanAll"/>
8544
+
8468
8545
  <xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol">
8469
8546
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
8470
8547
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -8497,6 +8574,35 @@
8497
8574
  </fo:block-container>
8498
8575
  </xsl:when> <!-- end block -->
8499
8576
 
8577
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8578
+
8579
+ <xsl:variable name="provisional_distance_between_starts">
8580
+ 7
8581
+ </xsl:variable>
8582
+ <xsl:variable name="indent">
8583
+ 0
8584
+ </xsl:variable>
8585
+
8586
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8587
+ <fo:list-item>
8588
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8589
+ <fo:block>
8590
+ <xsl:apply-templates select="*[local-name()='name']">
8591
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8592
+ </xsl:apply-templates>
8593
+ </fo:block>
8594
+ </fo:list-item-label>
8595
+ <fo:list-item-body start-indent="body-start()">
8596
+ <fo:block>
8597
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8598
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8599
+ </xsl:apply-templates>
8600
+ </fo:block>
8601
+ </fo:list-item-body>
8602
+ </fo:list-item>
8603
+ </fo:list-block>
8604
+ </xsl:when> <!-- end list -->
8605
+
8500
8606
  <xsl:otherwise> <!-- inline -->
8501
8607
 
8502
8608
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8577,6 +8683,11 @@
8577
8683
  </fo:block>
8578
8684
  </fo:block-container>
8579
8685
  </xsl:when>
8686
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8687
+ <fo:block xsl:use-attribute-sets="example-p-style">
8688
+ <xsl:apply-templates/>
8689
+ </fo:block>
8690
+ </xsl:when>
8580
8691
  <xsl:otherwise>
8581
8692
  <fo:inline xsl:use-attribute-sets="example-p-style">
8582
8693
  <xsl:apply-templates/>
@@ -8694,6 +8805,9 @@
8694
8805
  <!-- ====== -->
8695
8806
  <xsl:template match="*[local-name() = 'quote']">
8696
8807
  <fo:block-container margin-left="0mm">
8808
+
8809
+ <xsl:call-template name="setBlockSpanAll"/>
8810
+
8697
8811
  <xsl:if test="parent::*[local-name() = 'note']">
8698
8812
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8699
8813
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8908,13 +9022,8 @@
8908
9022
  </xsl:template>
8909
9023
 
8910
9024
  <xsl:template match="*[local-name() = 'deprecates']">
8911
- <xsl:variable name="title-deprecated">
8912
- <xsl:call-template name="getLocalizedString">
8913
- <xsl:with-param name="key">deprecated</xsl:with-param>
8914
- </xsl:call-template>
8915
- </xsl:variable>
8916
9025
  <fo:block xsl:use-attribute-sets="deprecates-style">
8917
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
9026
+ <xsl:apply-templates/>
8918
9027
  </fo:block>
8919
9028
  </xsl:template>
8920
9029
 
@@ -8979,6 +9088,8 @@
8979
9088
  <fo:block>
8980
9089
  <xsl:call-template name="setId"/>
8981
9090
 
9091
+ <xsl:call-template name="setBlockSpanAll"/>
9092
+
8982
9093
  <xsl:apply-templates/>
8983
9094
  </fo:block>
8984
9095
  </xsl:template>
@@ -8993,6 +9104,8 @@
8993
9104
  <fo:block break-after="page"/>
8994
9105
  <fo:block id="{@id}">
8995
9106
 
9107
+ <xsl:call-template name="setBlockSpanAll"/>
9108
+
8996
9109
  </fo:block>
8997
9110
  <xsl:apply-templates/>
8998
9111
  </xsl:template>
@@ -9941,6 +10054,8 @@
9941
10054
  <!-- text in the box -->
9942
10055
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9943
10056
 
10057
+ <xsl:call-template name="setBlockSpanAll"/>
10058
+
9944
10059
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9945
10060
 
9946
10061
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -10119,6 +10234,33 @@
10119
10234
  <xsl:apply-templates mode="update_xml_step1"/>
10120
10235
  </xsl:copy>
10121
10236
  </xsl:template>
10237
+
10238
+ <!-- remove semantic xml -->
10239
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
10240
+
10241
+ <!-- remove image/emf -->
10242
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
10243
+
10244
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
10245
+ <xsl:copy-of select="."/>
10246
+ </xsl:template>
10247
+
10248
+ <!-- add @id, redundant for table auto-layout algorithm -->
10249
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10250
+ <xsl:copy>
10251
+ <xsl:copy-of select="@*"/>
10252
+ <xsl:call-template name="add_id"/>
10253
+ <xsl:apply-templates mode="update_xml_step1"/>
10254
+ </xsl:copy>
10255
+ </xsl:template>
10256
+
10257
+ <xsl:template name="add_id">
10258
+ <xsl:if test="not(@id)">
10259
+ <!-- add @id - first element with @id plus '_element_name' -->
10260
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10261
+ </xsl:if>
10262
+ </xsl:template>
10263
+
10122
10264
  <!-- =========================================================================== -->
10123
10265
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10124
10266
  <!-- =========================================================================== -->
@@ -10140,7 +10282,7 @@
10140
10282
 
10141
10283
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
10142
10284
 
10143
- <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">
10285
+ <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">
10144
10286
 
10145
10287
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
10146
10288
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -10214,6 +10356,10 @@
10214
10356
 
10215
10357
  </xsl:template>
10216
10358
 
10359
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
10360
+ <xsl:copy-of select="."/>
10361
+ </xsl:template>
10362
+
10217
10363
  <xsl:template name="replace_text_tags">
10218
10364
  <xsl:param name="tag_open"/>
10219
10365
  <xsl:param name="tag_close"/>
@@ -10240,6 +10386,194 @@
10240
10386
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10241
10387
  <!-- ===================================== -->
10242
10388
 
10389
+ <!-- ===================================== -->
10390
+ <!-- ===================================== -->
10391
+ <!-- Make linear XML (need for landscape orientation) -->
10392
+ <!-- ===================================== -->
10393
+ <!-- ===================================== -->
10394
+ <xsl:template match="@*|node()" mode="linear_xml">
10395
+ <xsl:copy>
10396
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
10397
+ </xsl:copy>
10398
+ </xsl:template>
10399
+
10400
+ <xsl:template match="processing-instruction()" mode="linear_xml">
10401
+ <xsl:copy-of select="."/>
10402
+ </xsl:template>
10403
+
10404
+ <!-- From:
10405
+ <clause>
10406
+ <title>...</title>
10407
+ <p>...</p>
10408
+ </clause>
10409
+ To:
10410
+ <clause/>
10411
+ <title>...</title>
10412
+ <p>...</p>
10413
+ -->
10414
+ <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">
10415
+
10416
+ <xsl:copy>
10417
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10418
+
10419
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10420
+
10421
+ <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'">
10422
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10423
+ </xsl:if>
10424
+ </xsl:copy>
10425
+
10426
+ <xsl:apply-templates mode="linear_xml"/>
10427
+ </xsl:template>
10428
+
10429
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
10430
+ <xsl:copy>
10431
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10432
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10433
+ <xsl:variable name="level">
10434
+ <xsl:call-template name="getLevel"/>
10435
+ </xsl:variable>
10436
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10437
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
10438
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
10439
+ </xsl:copy>
10440
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
10441
+ </xsl:template>
10442
+
10443
+ <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">
10444
+ <xsl:copy>
10445
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10446
+
10447
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10448
+
10449
+ <xsl:variable name="level">
10450
+ <xsl:call-template name="getLevel"/>
10451
+ </xsl:variable>
10452
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10453
+
10454
+ <xsl:if test="parent::*[local-name() = 'annex']">
10455
+ <xsl:attribute name="depth">1</xsl:attribute>
10456
+ </xsl:if>
10457
+
10458
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
10459
+ <xsl:copy-of select="../@inline-header"/>
10460
+ </xsl:if>
10461
+
10462
+ <xsl:attribute name="ancestor">
10463
+ <xsl:choose>
10464
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
10465
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
10466
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
10467
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
10468
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
10469
+ </xsl:choose>
10470
+ </xsl:attribute>
10471
+
10472
+ <xsl:apply-templates mode="linear_xml"/>
10473
+ </xsl:copy>
10474
+ </xsl:template>
10475
+
10476
+ <!-- add @to = figure, table, clause -->
10477
+ <!-- add @depth = from -->
10478
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
10479
+ <xsl:copy>
10480
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10481
+ <xsl:variable name="target" select="@target"/>
10482
+ <xsl:attribute name="to">
10483
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
10484
+ </xsl:attribute>
10485
+ <xsl:attribute name="depth">
10486
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
10487
+ </xsl:attribute>
10488
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10489
+ </xsl:copy>
10490
+ </xsl:template>
10491
+
10492
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
10493
+ <xsl:choose>
10494
+ <xsl:when test="contains(., $non_breaking_hyphen)">
10495
+ <xsl:call-template name="replaceChar">
10496
+ <xsl:with-param name="text" select="."/>
10497
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
10498
+ <xsl:with-param name="by" select="'-'"/>
10499
+ </xsl:call-template>
10500
+ </xsl:when>
10501
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10502
+ </xsl:choose>
10503
+ </xsl:template>
10504
+
10505
+ <xsl:template name="replaceChar">
10506
+ <xsl:param name="text"/>
10507
+ <xsl:param name="replace"/>
10508
+ <xsl:param name="by"/>
10509
+ <xsl:choose>
10510
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
10511
+ <xsl:value-of select="$text"/>
10512
+ </xsl:when>
10513
+ <xsl:when test="contains($text, $replace)">
10514
+ <xsl:value-of select="substring-before($text,$replace)"/>
10515
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10516
+ <xsl:call-template name="replaceChar">
10517
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10518
+ <xsl:with-param name="replace" select="$replace"/>
10519
+ <xsl:with-param name="by" select="$by"/>
10520
+ </xsl:call-template>
10521
+ </xsl:when>
10522
+ <xsl:otherwise>
10523
+ <xsl:value-of select="$text"/>
10524
+ </xsl:otherwise>
10525
+ </xsl:choose>
10526
+ </xsl:template>
10527
+
10528
+ <xsl:template match="*[local-name() = 'inlineChar']">
10529
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10530
+ </xsl:template>
10531
+
10532
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10533
+ <!--
10534
+ <fn reference="1">
10535
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10536
+ </fn>
10537
+ -->
10538
+ <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">
10539
+ <xsl:variable name="p_fn_">
10540
+ <xsl:call-template name="get_fn_list"/>
10541
+ </xsl:variable>
10542
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10543
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10544
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10545
+ <xsl:variable name="reference" select="@reference"/>
10546
+ <!-- fn sequence number in document -->
10547
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10548
+
10549
+ <xsl:copy>
10550
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10551
+ <!-- put actual reference number -->
10552
+ <xsl:attribute name="current_fn_number">
10553
+ <xsl:value-of select="$current_fn_number"/>
10554
+ </xsl:attribute>
10555
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10556
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10557
+ </xsl:attribute>
10558
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10559
+ </xsl:copy>
10560
+ </xsl:template>
10561
+
10562
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10563
+ <xsl:copy>
10564
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10565
+ <xsl:if test="@depth = '1'">
10566
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10567
+ </xsl:if>
10568
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10569
+ </xsl:copy>
10570
+ </xsl:template>
10571
+ <!-- ===================================== -->
10572
+ <!-- ===================================== -->
10573
+ <!-- END: Make linear XML (need for landscape orientation) -->
10574
+ <!-- ===================================== -->
10575
+ <!-- ===================================== -->
10576
+
10243
10577
  <!-- for correct rendering combining chars -->
10244
10578
  <xsl:template match="*[local-name() = 'lang_none']">
10245
10579
  <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 Ribose
3
- VERSION = "2.2.5".freeze
3
+ VERSION = "2.2.7".freeze
4
4
  end
5
5
  end
@@ -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-ribose
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