metanorma-csa 2.2.5 → 2.2.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: e7dfce83c3b89acac0ccebac4fa674de69935512279e96342e089d7eb8765e83
4
- data.tar.gz: f2207a0524acd460bb56833ac2e5d3b18f56ea215d6b8d5af17c9384831dce45
3
+ metadata.gz: cb85b906d7415059437f5917d7a6819d014559424878cccabbbfadf3ffe9eb7e
4
+ data.tar.gz: 914dce6c827dedb30a4e0d8f1ec4ba2d21284200b31df8a29279032e354035b3
5
5
  SHA512:
6
- metadata.gz: 7ed87e25311faf2aae6d46a0b1e6e7e7436b6f34c29f4fdeb4fa877352b781b8073561f5a4cb86c12aeff6ed9f8b7dde323144f1ca19e892db0f95f509db517a
7
- data.tar.gz: 3674ecdd8c03bd2714427c3c128c6be8525933c78c9b952cd092a8faddca4ef40f194288985ab85020b3e8ca1a23e39cb6070f773c5a4f3b5e132fd2086093a9
6
+ metadata.gz: ddd10adc9ec06af2d72bd0408f313d102c2264e52ef28d7f2d2f649f05c2e0b30c19b130c3d13368a3e52a6405652936cdc19486f49ae0440005f6b5ab6839e0
7
+ data.tar.gz: ffece799b10883d9b98e221e2f069897b1429541f6f7397adf5eb65d407f6f94bac59e5a3b1b40a8bdcdfb13f9af42634ecd50a9c0172c78f2f3827487c32fe7
@@ -1209,11 +1209,17 @@
1209
1209
  <!-- ========================== -->
1210
1210
  <!-- Definition's list styles -->
1211
1211
  <!-- ========================== -->
1212
+
1213
+ <xsl:attribute-set name="dl-block-style">
1214
+
1215
+ </xsl:attribute-set>
1216
+
1212
1217
  <xsl:attribute-set name="dt-row-style">
1213
1218
 
1214
1219
  </xsl:attribute-set>
1215
1220
 
1216
1221
  <xsl:attribute-set name="dt-cell-style">
1222
+
1217
1223
  </xsl:attribute-set>
1218
1224
 
1219
1225
  <xsl:attribute-set name="dt-block-style">
@@ -1229,6 +1235,7 @@
1229
1235
 
1230
1236
  <xsl:attribute-set name="dd-cell-style">
1231
1237
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1238
+
1232
1239
  </xsl:attribute-set>
1233
1240
 
1234
1241
  <!-- ========================== -->
@@ -1342,6 +1349,7 @@
1342
1349
  <xsl:attribute-set name="term-name-style">
1343
1350
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1344
1351
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1352
+
1345
1353
  </xsl:attribute-set>
1346
1354
 
1347
1355
  <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>
@@ -1911,7 +1923,7 @@
1911
1923
 
1912
1924
  <xsl:template name="processTables_Contents">
1913
1925
  <tables>
1914
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1926
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1915
1927
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1916
1928
  <xsl:copy-of select="*[local-name() = 'name']"/>
1917
1929
  </table>
@@ -2261,7 +2273,7 @@
2261
2273
  </xsl:attribute>
2262
2274
  </xsl:for-each>
2263
2275
 
2264
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2276
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2265
2277
  <xsl:if test="$isNoteOrFnExist = 'true'">
2266
2278
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2267
2279
  </xsl:if>
@@ -2305,7 +2317,7 @@
2305
2317
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2306
2318
  </xsl:when>
2307
2319
  <xsl:otherwise>
2308
- <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 -->
2320
+ <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 -->
2309
2321
  </xsl:otherwise>
2310
2322
  </xsl:choose>
2311
2323
 
@@ -2409,6 +2421,11 @@
2409
2421
  </xsl:if>
2410
2422
  </xsl:template> <!-- table/name -->
2411
2423
 
2424
+ <!-- SOURCE: ... -->
2425
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2426
+ <xsl:call-template name="termsource"/>
2427
+ </xsl:template>
2428
+
2412
2429
  <xsl:template name="calculate-columns-numbers">
2413
2430
  <xsl:param name="table-row"/>
2414
2431
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2765,7 +2782,7 @@
2765
2782
  </fo:table-header>
2766
2783
  </xsl:template> <!-- thead -->
2767
2784
 
2768
- <!-- template is using for iso, jcgm, bsi only -->
2785
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2769
2786
  <xsl:template name="table-header-title">
2770
2787
  <xsl:param name="cols-count"/>
2771
2788
  <!-- row for title -->
@@ -2808,7 +2825,7 @@
2808
2825
  <xsl:param name="colwidths"/>
2809
2826
  <xsl:param name="colgroup"/>
2810
2827
 
2811
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2828
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2812
2829
 
2813
2830
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2814
2831
 
@@ -2876,7 +2893,9 @@
2876
2893
 
2877
2894
  <!-- except gb and bsi -->
2878
2895
 
2896
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
2879
2897
  <xsl:apply-templates select="../*[local-name()='note']"/>
2898
+ <xsl:apply-templates select="../*[local-name()='source']"/>
2880
2899
 
2881
2900
  <xsl:variable name="isDisplayRowSeparator">
2882
2901
 
@@ -3001,7 +3020,7 @@
3001
3020
  <!-- ===================== -->
3002
3021
  <!-- Table's row processing -->
3003
3022
  <!-- ===================== -->
3004
- <!-- row in table header (thead) -->
3023
+ <!-- row in table header (thead) thead/tr -->
3005
3024
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3006
3025
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3007
3026
 
@@ -3035,7 +3054,7 @@
3035
3054
  </xsl:choose>
3036
3055
  </xsl:template>
3037
3056
 
3038
- <!-- row in table footer (tfoot) -->
3057
+ <!-- row in table footer (tfoot), tfoot/tr -->
3039
3058
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3040
3059
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3041
3060
 
@@ -3509,12 +3528,26 @@
3509
3528
  <xsl:variable name="isAdded" select="@added"/>
3510
3529
  <xsl:variable name="isDeleted" select="@deleted"/>
3511
3530
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3512
- <fo:block-container>
3531
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3532
+
3533
+ <xsl:call-template name="setBlockSpanAll"/>
3513
3534
 
3514
3535
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3515
3536
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3516
3537
  </xsl:if>
3517
3538
 
3539
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3540
+ <!-- set font-size as sourcecode font-size -->
3541
+ <xsl:variable name="sourcecode_attributes">
3542
+ <xsl:call-template name="get_sourcecode_attributes"/>
3543
+ </xsl:variable>
3544
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3545
+ <xsl:attribute name="{local-name()}">
3546
+ <xsl:value-of select="."/>
3547
+ </xsl:attribute>
3548
+ </xsl:for-each>
3549
+ </xsl:if>
3550
+
3518
3551
  <xsl:if test="parent::*[local-name() = 'note']">
3519
3552
  <xsl:attribute name="margin-left">
3520
3553
  <xsl:choose>
@@ -3948,6 +3981,7 @@
3948
3981
  <xsl:param name="split_keep-within-line"/>
3949
3982
 
3950
3983
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3984
+
3951
3985
  <xsl:call-template name="insert_dt_cell">
3952
3986
  <xsl:with-param name="key_iso" select="$key_iso"/>
3953
3987
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -3969,6 +4003,7 @@
3969
4003
  <!-- border is mandatory, to calculate real width -->
3970
4004
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3971
4005
  <xsl:attribute name="text-align">left</xsl:attribute>
4006
+
3972
4007
  </xsl:if>
3973
4008
 
3974
4009
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4413,6 +4448,7 @@
4413
4448
  <fo:inline>
4414
4449
  <xsl:for-each select="$styles/style">
4415
4450
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4451
+
4416
4452
  </xsl:for-each>
4417
4453
  <xsl:apply-templates/>
4418
4454
  </fo:inline>
@@ -5575,13 +5611,17 @@
5575
5611
  </xsl:template>
5576
5612
 
5577
5613
  <xsl:template match="*[local-name() = 'callout']">
5578
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5614
+ <xsl:choose>
5615
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5616
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5617
+ </xsl:choose>
5579
5618
  </xsl:template>
5580
5619
 
5581
5620
  <xsl:template match="*[local-name() = 'annotation']">
5582
5621
  <xsl:variable name="annotation-id" select="@id"/>
5583
5622
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5584
5623
  <fo:block id="{$annotation-id}" white-space="nowrap">
5624
+
5585
5625
  <fo:inline>
5586
5626
  <xsl:apply-templates>
5587
5627
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -5686,6 +5726,10 @@
5686
5726
  <!-- ====== -->
5687
5727
  <!-- ====== -->
5688
5728
 
5729
+ <xsl:template name="setBlockSpanAll">
5730
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
5731
+ </xsl:template>
5732
+
5689
5733
  <!-- ====== -->
5690
5734
  <!-- note -->
5691
5735
  <!-- termnote -->
@@ -5695,6 +5739,8 @@
5695
5739
 
5696
5740
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5697
5741
 
5742
+ <xsl:call-template name="setBlockSpanAll"/>
5743
+
5698
5744
  <fo:block-container margin-left="0mm" margin-right="0mm">
5699
5745
 
5700
5746
  <xsl:if test="ancestor::csa:ul or ancestor::csa:ol and not(ancestor::csa:note[1]/following-sibling::*)">
@@ -5749,6 +5795,8 @@
5749
5795
  <xsl:template match="*[local-name() = 'termnote']">
5750
5796
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5751
5797
 
5798
+ <xsl:call-template name="setBlockSpanAll"/>
5799
+
5752
5800
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5753
5801
 
5754
5802
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -5902,6 +5950,13 @@
5902
5950
  </fo:block>
5903
5951
  </xsl:template>
5904
5952
 
5953
+ <!-- SOURCE: ... -->
5954
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
5955
+
5956
+ <xsl:call-template name="termsource"/>
5957
+
5958
+ </xsl:template>
5959
+
5905
5960
  <xsl:template match="*[local-name() = 'image']">
5906
5961
  <xsl:variable name="isAdded" select="../@added"/>
5907
5962
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7033,9 +7088,11 @@
7033
7088
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7034
7089
  </xsl:if>
7035
7090
 
7036
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7091
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7037
7092
  </fo:block>
7038
7093
 
7094
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7095
+
7039
7096
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7040
7097
 
7041
7098
  </fo:block-container>
@@ -7067,11 +7124,22 @@
7067
7124
  <!-- add sourcecode highlighting -->
7068
7125
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7069
7126
  <xsl:variable name="class" select="@class"/>
7127
+
7128
+ <!-- Example: <1> -->
7129
+ <xsl:variable name="is_callout">
7130
+ <xsl:if test="parent::*[local-name() = 'dt']">
7131
+ <xsl:variable name="dt_id" select="../@id"/>
7132
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7133
+ </xsl:if>
7134
+ </xsl:variable>
7135
+
7070
7136
  <xsl:choose>
7071
7137
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7072
7138
  <fo:inline>
7073
7139
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7140
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7074
7141
  <xsl:apply-templates/>
7142
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7075
7143
  </fo:inline>
7076
7144
  </xsl:when>
7077
7145
  <xsl:otherwise>
@@ -7495,6 +7563,10 @@
7495
7563
  </fo:block>
7496
7564
  </xsl:template>
7497
7565
 
7566
+ <xsl:template match="*[local-name() = 'div']">
7567
+ <fo:block><xsl:apply-templates/></fo:block>
7568
+ </xsl:template>
7569
+
7498
7570
  <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']">
7499
7571
  <fo:block xsl:use-attribute-sets="inherit-style">
7500
7572
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -7658,6 +7730,9 @@
7658
7730
  <!-- ====== -->
7659
7731
  <xsl:template match="*[local-name() = 'termexample']">
7660
7732
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
7733
+
7734
+ <xsl:call-template name="setBlockSpanAll"/>
7735
+
7661
7736
  <xsl:apply-templates select="*[local-name()='name']"/>
7662
7737
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7663
7738
  </fo:block>
@@ -7709,6 +7784,8 @@
7709
7784
 
7710
7785
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
7711
7786
 
7787
+ <xsl:call-template name="setBlockSpanAll"/>
7788
+
7712
7789
  <xsl:variable name="fo_element">
7713
7790
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
7714
7791
  block
@@ -7736,6 +7813,35 @@
7736
7813
  </fo:block-container>
7737
7814
  </xsl:when> <!-- end block -->
7738
7815
 
7816
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
7817
+
7818
+ <xsl:variable name="provisional_distance_between_starts">
7819
+ 7
7820
+ </xsl:variable>
7821
+ <xsl:variable name="indent">
7822
+ 0
7823
+ </xsl:variable>
7824
+
7825
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
7826
+ <fo:list-item>
7827
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
7828
+ <fo:block>
7829
+ <xsl:apply-templates select="*[local-name()='name']">
7830
+ <xsl:with-param name="fo_element">block</xsl:with-param>
7831
+ </xsl:apply-templates>
7832
+ </fo:block>
7833
+ </fo:list-item-label>
7834
+ <fo:list-item-body start-indent="body-start()">
7835
+ <fo:block>
7836
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
7837
+ <xsl:with-param name="fo_element" select="$fo_element"/>
7838
+ </xsl:apply-templates>
7839
+ </fo:block>
7840
+ </fo:list-item-body>
7841
+ </fo:list-item>
7842
+ </fo:list-block>
7843
+ </xsl:when> <!-- end list -->
7844
+
7739
7845
  <xsl:otherwise> <!-- inline -->
7740
7846
 
7741
7847
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -7811,6 +7917,11 @@
7811
7917
  </fo:block>
7812
7918
  </fo:block-container>
7813
7919
  </xsl:when>
7920
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
7921
+ <fo:block xsl:use-attribute-sets="example-p-style">
7922
+ <xsl:apply-templates/>
7923
+ </fo:block>
7924
+ </xsl:when>
7814
7925
  <xsl:otherwise>
7815
7926
  <fo:inline xsl:use-attribute-sets="example-p-style">
7816
7927
  <xsl:apply-templates/>
@@ -7928,6 +8039,9 @@
7928
8039
  <!-- ====== -->
7929
8040
  <xsl:template match="*[local-name() = 'quote']">
7930
8041
  <fo:block-container margin-left="0mm">
8042
+
8043
+ <xsl:call-template name="setBlockSpanAll"/>
8044
+
7931
8045
  <xsl:if test="parent::*[local-name() = 'note']">
7932
8046
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
7933
8047
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8146,13 +8260,8 @@
8146
8260
  </xsl:template>
8147
8261
 
8148
8262
  <xsl:template match="*[local-name() = 'deprecates']">
8149
- <xsl:variable name="title-deprecated">
8150
- <xsl:call-template name="getLocalizedString">
8151
- <xsl:with-param name="key">deprecated</xsl:with-param>
8152
- </xsl:call-template>
8153
- </xsl:variable>
8154
8263
  <fo:block xsl:use-attribute-sets="deprecates-style">
8155
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8264
+ <xsl:apply-templates/>
8156
8265
  </fo:block>
8157
8266
  </xsl:template>
8158
8267
 
@@ -8217,6 +8326,8 @@
8217
8326
  <fo:block>
8218
8327
  <xsl:call-template name="setId"/>
8219
8328
 
8329
+ <xsl:call-template name="setBlockSpanAll"/>
8330
+
8220
8331
  <xsl:apply-templates/>
8221
8332
  </fo:block>
8222
8333
  </xsl:template>
@@ -8231,6 +8342,8 @@
8231
8342
  <fo:block break-after="page"/>
8232
8343
  <fo:block id="{@id}">
8233
8344
 
8345
+ <xsl:call-template name="setBlockSpanAll"/>
8346
+
8234
8347
  </fo:block>
8235
8348
  <xsl:apply-templates/>
8236
8349
  </xsl:template>
@@ -9165,6 +9278,8 @@
9165
9278
  <!-- text in the box -->
9166
9279
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9167
9280
 
9281
+ <xsl:call-template name="setBlockSpanAll"/>
9282
+
9168
9283
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9169
9284
 
9170
9285
  <fo:block-container margin-left="0mm" margin-right="0mm">
@@ -9339,6 +9454,33 @@
9339
9454
  <xsl:apply-templates mode="update_xml_step1"/>
9340
9455
  </xsl:copy>
9341
9456
  </xsl:template>
9457
+
9458
+ <!-- remove semantic xml -->
9459
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9460
+
9461
+ <!-- remove image/emf -->
9462
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9463
+
9464
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9465
+ <xsl:copy-of select="."/>
9466
+ </xsl:template>
9467
+
9468
+ <!-- add @id, redundant for table auto-layout algorithm -->
9469
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9470
+ <xsl:copy>
9471
+ <xsl:copy-of select="@*"/>
9472
+ <xsl:call-template name="add_id"/>
9473
+ <xsl:apply-templates mode="update_xml_step1"/>
9474
+ </xsl:copy>
9475
+ </xsl:template>
9476
+
9477
+ <xsl:template name="add_id">
9478
+ <xsl:if test="not(@id)">
9479
+ <!-- add @id - first element with @id plus '_element_name' -->
9480
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9481
+ </xsl:if>
9482
+ </xsl:template>
9483
+
9342
9484
  <!-- =========================================================================== -->
9343
9485
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9344
9486
  <!-- =========================================================================== -->
@@ -9360,7 +9502,7 @@
9360
9502
 
9361
9503
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9362
9504
 
9363
- <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">
9505
+ <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">
9364
9506
 
9365
9507
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9366
9508
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9434,6 +9576,10 @@
9434
9576
 
9435
9577
  </xsl:template>
9436
9578
 
9579
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9580
+ <xsl:copy-of select="."/>
9581
+ </xsl:template>
9582
+
9437
9583
  <xsl:template name="replace_text_tags">
9438
9584
  <xsl:param name="tag_open"/>
9439
9585
  <xsl:param name="tag_close"/>
@@ -9460,6 +9606,194 @@
9460
9606
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9461
9607
  <!-- ===================================== -->
9462
9608
 
9609
+ <!-- ===================================== -->
9610
+ <!-- ===================================== -->
9611
+ <!-- Make linear XML (need for landscape orientation) -->
9612
+ <!-- ===================================== -->
9613
+ <!-- ===================================== -->
9614
+ <xsl:template match="@*|node()" mode="linear_xml">
9615
+ <xsl:copy>
9616
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9617
+ </xsl:copy>
9618
+ </xsl:template>
9619
+
9620
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9621
+ <xsl:copy-of select="."/>
9622
+ </xsl:template>
9623
+
9624
+ <!-- From:
9625
+ <clause>
9626
+ <title>...</title>
9627
+ <p>...</p>
9628
+ </clause>
9629
+ To:
9630
+ <clause/>
9631
+ <title>...</title>
9632
+ <p>...</p>
9633
+ -->
9634
+ <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">
9635
+
9636
+ <xsl:copy>
9637
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9638
+
9639
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9640
+
9641
+ <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'">
9642
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9643
+ </xsl:if>
9644
+ </xsl:copy>
9645
+
9646
+ <xsl:apply-templates mode="linear_xml"/>
9647
+ </xsl:template>
9648
+
9649
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9650
+ <xsl:copy>
9651
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9652
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9653
+ <xsl:variable name="level">
9654
+ <xsl:call-template name="getLevel"/>
9655
+ </xsl:variable>
9656
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9657
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9658
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9659
+ </xsl:copy>
9660
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9661
+ </xsl:template>
9662
+
9663
+ <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">
9664
+ <xsl:copy>
9665
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9666
+
9667
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9668
+
9669
+ <xsl:variable name="level">
9670
+ <xsl:call-template name="getLevel"/>
9671
+ </xsl:variable>
9672
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9673
+
9674
+ <xsl:if test="parent::*[local-name() = 'annex']">
9675
+ <xsl:attribute name="depth">1</xsl:attribute>
9676
+ </xsl:if>
9677
+
9678
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
9679
+ <xsl:copy-of select="../@inline-header"/>
9680
+ </xsl:if>
9681
+
9682
+ <xsl:attribute name="ancestor">
9683
+ <xsl:choose>
9684
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
9685
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
9686
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
9687
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
9688
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
9689
+ </xsl:choose>
9690
+ </xsl:attribute>
9691
+
9692
+ <xsl:apply-templates mode="linear_xml"/>
9693
+ </xsl:copy>
9694
+ </xsl:template>
9695
+
9696
+ <!-- add @to = figure, table, clause -->
9697
+ <!-- add @depth = from -->
9698
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
9699
+ <xsl:copy>
9700
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9701
+ <xsl:variable name="target" select="@target"/>
9702
+ <xsl:attribute name="to">
9703
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
9704
+ </xsl:attribute>
9705
+ <xsl:attribute name="depth">
9706
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
9707
+ </xsl:attribute>
9708
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9709
+ </xsl:copy>
9710
+ </xsl:template>
9711
+
9712
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
9713
+ <xsl:choose>
9714
+ <xsl:when test="contains(., $non_breaking_hyphen)">
9715
+ <xsl:call-template name="replaceChar">
9716
+ <xsl:with-param name="text" select="."/>
9717
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
9718
+ <xsl:with-param name="by" select="'-'"/>
9719
+ </xsl:call-template>
9720
+ </xsl:when>
9721
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
9722
+ </xsl:choose>
9723
+ </xsl:template>
9724
+
9725
+ <xsl:template name="replaceChar">
9726
+ <xsl:param name="text"/>
9727
+ <xsl:param name="replace"/>
9728
+ <xsl:param name="by"/>
9729
+ <xsl:choose>
9730
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
9731
+ <xsl:value-of select="$text"/>
9732
+ </xsl:when>
9733
+ <xsl:when test="contains($text, $replace)">
9734
+ <xsl:value-of select="substring-before($text,$replace)"/>
9735
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
9736
+ <xsl:call-template name="replaceChar">
9737
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
9738
+ <xsl:with-param name="replace" select="$replace"/>
9739
+ <xsl:with-param name="by" select="$by"/>
9740
+ </xsl:call-template>
9741
+ </xsl:when>
9742
+ <xsl:otherwise>
9743
+ <xsl:value-of select="$text"/>
9744
+ </xsl:otherwise>
9745
+ </xsl:choose>
9746
+ </xsl:template>
9747
+
9748
+ <xsl:template match="*[local-name() = 'inlineChar']">
9749
+ <fo:inline><xsl:value-of select="."/></fo:inline>
9750
+ </xsl:template>
9751
+
9752
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
9753
+ <!--
9754
+ <fn reference="1">
9755
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9756
+ </fn>
9757
+ -->
9758
+ <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">
9759
+ <xsl:variable name="p_fn_">
9760
+ <xsl:call-template name="get_fn_list"/>
9761
+ </xsl:variable>
9762
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9763
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
9764
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9765
+ <xsl:variable name="reference" select="@reference"/>
9766
+ <!-- fn sequence number in document -->
9767
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
9768
+
9769
+ <xsl:copy>
9770
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9771
+ <!-- put actual reference number -->
9772
+ <xsl:attribute name="current_fn_number">
9773
+ <xsl:value-of select="$current_fn_number"/>
9774
+ </xsl:attribute>
9775
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
9776
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
9777
+ </xsl:attribute>
9778
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9779
+ </xsl:copy>
9780
+ </xsl:template>
9781
+
9782
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
9783
+ <xsl:copy>
9784
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9785
+ <xsl:if test="@depth = '1'">
9786
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9787
+ </xsl:if>
9788
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9789
+ </xsl:copy>
9790
+ </xsl:template>
9791
+ <!-- ===================================== -->
9792
+ <!-- ===================================== -->
9793
+ <!-- END: Make linear XML (need for landscape orientation) -->
9794
+ <!-- ===================================== -->
9795
+ <!-- ===================================== -->
9796
+
9463
9797
  <!-- for correct rendering combining chars -->
9464
9798
  <xsl:template match="*[local-name() = 'lang_none']">
9465
9799
  <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 Csa
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-csa
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