metanorma-cc 2.2.6 → 2.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c89b2284f9823a6a9f9282947db3051b536a434be52cb0003e6704fe2aff7983
4
- data.tar.gz: faf115d44576453efa7005ee323c74589dc3d4c59afe2aa1b7a4db57e7b8040c
3
+ metadata.gz: 9962f9287fd441fee8c3f00975e367e9a9e5ee8aed89e4a1f6c27036154ee35c
4
+ data.tar.gz: 71d90e7c27c7a10dfb445dda45e9c66bdfae4a1f1dab8fa645bc00d8b447c0e3
5
5
  SHA512:
6
- metadata.gz: 357c53a3d1d2b1191e6a6b7ac35b56738f2152d7d1364cd0b58f933192e02cf36f597a33f7d7c393e99afb0557fee750ebf301b77094fa1e150342ec45bf25fc
7
- data.tar.gz: 1c92c580436ba4332f6cc59a35e68d41f595a24d8bdcd823e7f8e2eb582e30f9033758a0ce76f4b218d28a00579d246e97694e0b839ef1e40a83fdb6001d6bdc
6
+ metadata.gz: af6ad89ffd8a096eac22cc9430bfc5d96fb70c9ebca2aeaa21f4ee973ffccb2bc38f9f238d8c594e63439d95b56b35835e4ff52959f219bdc110552731f25dca
7
+ data.tar.gz: 8bed035725149c2fef222f813cc62a431f46e4c6b1efa3ffdda626c4019f04f35ee19908c8e8edcd5e84b596b883eb96f17482b6100e5f70e3e1f696ad98aef5
@@ -494,13 +494,17 @@
494
494
  </xsl:template>
495
495
 
496
496
  <xsl:template match="csd:xref" priority="2">
497
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
498
- <xsl:if test="not(starts-with(text(), 'Figure') or starts-with(text(), 'Table'))">
499
- <xsl:attribute name="color">blue</xsl:attribute>
500
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
501
- </xsl:if>
502
- <xsl:apply-templates/>
503
- </fo:basic-link>
497
+ <xsl:call-template name="insert_basic_link">
498
+ <xsl:with-param name="element">
499
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
500
+ <xsl:if test="not(starts-with(text(), 'Figure') or starts-with(text(), 'Table'))">
501
+ <xsl:attribute name="color">blue</xsl:attribute>
502
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
503
+ </xsl:if>
504
+ <xsl:apply-templates/>
505
+ </fo:basic-link>
506
+ </xsl:with-param>
507
+ </xsl:call-template>
504
508
  </xsl:template>
505
509
 
506
510
  <xsl:template name="insertHeaderFooter">
@@ -1208,11 +1212,17 @@
1208
1212
  <!-- ========================== -->
1209
1213
  <!-- Definition's list styles -->
1210
1214
  <!-- ========================== -->
1215
+
1216
+ <xsl:attribute-set name="dl-block-style">
1217
+
1218
+ </xsl:attribute-set>
1219
+
1211
1220
  <xsl:attribute-set name="dt-row-style">
1212
1221
 
1213
1222
  </xsl:attribute-set>
1214
1223
 
1215
1224
  <xsl:attribute-set name="dt-cell-style">
1225
+
1216
1226
  </xsl:attribute-set>
1217
1227
 
1218
1228
  <xsl:attribute-set name="dt-block-style">
@@ -1232,6 +1242,7 @@
1232
1242
 
1233
1243
  <xsl:attribute-set name="dd-cell-style">
1234
1244
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1245
+
1235
1246
  </xsl:attribute-set>
1236
1247
 
1237
1248
  <!-- ========================== -->
@@ -1256,6 +1267,7 @@
1256
1267
  </xsl:attribute-set>
1257
1268
 
1258
1269
  <xsl:attribute-set name="xref-style">
1270
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1259
1271
 
1260
1272
  </xsl:attribute-set>
1261
1273
 
@@ -1366,6 +1378,10 @@
1366
1378
 
1367
1379
  </xsl:attribute-set>
1368
1380
 
1381
+ <xsl:attribute-set name="figure-source-style">
1382
+
1383
+ </xsl:attribute-set>
1384
+
1369
1385
  <!-- Formula's styles -->
1370
1386
  <xsl:attribute-set name="formula-style">
1371
1387
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1884,7 +1900,7 @@
1884
1900
 
1885
1901
  <xsl:template name="processTables_Contents">
1886
1902
  <tables>
1887
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1903
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1888
1904
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1889
1905
  <xsl:copy-of select="*[local-name() = 'name']"/>
1890
1906
  </table>
@@ -2236,7 +2252,7 @@
2236
2252
  </xsl:attribute>
2237
2253
  </xsl:for-each>
2238
2254
 
2239
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2255
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2240
2256
  <xsl:if test="$isNoteOrFnExist = 'true'">
2241
2257
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2242
2258
  </xsl:if>
@@ -2280,7 +2296,7 @@
2280
2296
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2281
2297
  </xsl:when>
2282
2298
  <xsl:otherwise>
2283
- <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 -->
2299
+ <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 -->
2284
2300
  </xsl:otherwise>
2285
2301
  </xsl:choose>
2286
2302
 
@@ -2384,6 +2400,11 @@
2384
2400
  </xsl:if>
2385
2401
  </xsl:template> <!-- table/name -->
2386
2402
 
2403
+ <!-- SOURCE: ... -->
2404
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2405
+ <xsl:call-template name="termsource"/>
2406
+ </xsl:template>
2407
+
2387
2408
  <xsl:template name="calculate-columns-numbers">
2388
2409
  <xsl:param name="table-row"/>
2389
2410
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2740,7 +2761,7 @@
2740
2761
  </fo:table-header>
2741
2762
  </xsl:template> <!-- thead -->
2742
2763
 
2743
- <!-- template is using for iso, jcgm, bsi only -->
2764
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2744
2765
  <xsl:template name="table-header-title">
2745
2766
  <xsl:param name="cols-count"/>
2746
2767
  <!-- row for title -->
@@ -2783,7 +2804,7 @@
2783
2804
  <xsl:param name="colwidths"/>
2784
2805
  <xsl:param name="colgroup"/>
2785
2806
 
2786
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2807
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2787
2808
 
2788
2809
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2789
2810
 
@@ -2853,6 +2874,7 @@
2853
2874
 
2854
2875
  <xsl:apply-templates select="../*[local-name()='dl']"/>
2855
2876
  <xsl:apply-templates select="../*[local-name()='note']"/>
2877
+ <xsl:apply-templates select="../*[local-name()='source']"/>
2856
2878
 
2857
2879
  <xsl:variable name="isDisplayRowSeparator">
2858
2880
 
@@ -3211,9 +3233,13 @@
3211
3233
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3212
3234
  </xsl:if>
3213
3235
 
3214
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3215
- <xsl:value-of select="$current_fn_number_text"/>
3216
- </fo:basic-link>
3236
+ <xsl:call-template name="insert_basic_link">
3237
+ <xsl:with-param name="element">
3238
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3239
+ <xsl:value-of select="$current_fn_number_text"/>
3240
+ </fo:basic-link>
3241
+ </xsl:with-param>
3242
+ </xsl:call-template>
3217
3243
  </fo:inline>
3218
3244
  </xsl:variable>
3219
3245
 
@@ -3485,7 +3511,7 @@
3485
3511
  <xsl:variable name="isAdded" select="@added"/>
3486
3512
  <xsl:variable name="isDeleted" select="@deleted"/>
3487
3513
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3488
- <fo:block-container>
3514
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3489
3515
 
3490
3516
  <xsl:call-template name="setBlockSpanAll"/>
3491
3517
 
@@ -3493,6 +3519,18 @@
3493
3519
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3494
3520
  </xsl:if>
3495
3521
 
3522
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3523
+ <!-- set font-size as sourcecode font-size -->
3524
+ <xsl:variable name="sourcecode_attributes">
3525
+ <xsl:call-template name="get_sourcecode_attributes"/>
3526
+ </xsl:variable>
3527
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3528
+ <xsl:attribute name="{local-name()}">
3529
+ <xsl:value-of select="."/>
3530
+ </xsl:attribute>
3531
+ </xsl:for-each>
3532
+ </xsl:if>
3533
+
3496
3534
  <xsl:if test="parent::*[local-name() = 'note']">
3497
3535
  <xsl:attribute name="margin-left">
3498
3536
  <xsl:choose>
@@ -3534,8 +3572,10 @@
3534
3572
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3535
3573
  <xsl:text> </xsl:text>
3536
3574
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3537
- <xsl:text/>
3538
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3575
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3576
+ <xsl:text> </xsl:text>
3577
+ </xsl:if>
3578
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3539
3579
  </fo:block>
3540
3580
 
3541
3581
  </xsl:when> <!-- END: only one component -->
@@ -3926,6 +3966,7 @@
3926
3966
  <xsl:param name="split_keep-within-line"/>
3927
3967
 
3928
3968
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3969
+
3929
3970
  <xsl:call-template name="insert_dt_cell">
3930
3971
  <xsl:with-param name="key_iso" select="$key_iso"/>
3931
3972
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -3947,6 +3988,7 @@
3947
3988
  <!-- border is mandatory, to calculate real width -->
3948
3989
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3949
3990
  <xsl:attribute name="text-align">left</xsl:attribute>
3991
+
3950
3992
  </xsl:if>
3951
3993
 
3952
3994
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4020,8 +4062,18 @@
4020
4062
  </xsl:if>
4021
4063
  </xsl:template>
4022
4064
 
4023
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4024
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4065
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4066
+ <xsl:variable name="is_inline_element_after_where">
4067
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4068
+ </xsl:variable>
4069
+ <xsl:choose>
4070
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4071
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4072
+ </xsl:when>
4073
+ <xsl:otherwise>
4074
+ <xsl:apply-templates select="."/>
4075
+ </xsl:otherwise>
4076
+ </xsl:choose>
4025
4077
  </xsl:template>
4026
4078
 
4027
4079
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4392,6 +4444,7 @@
4392
4444
  <fo:inline>
4393
4445
  <xsl:for-each select="$styles/style">
4394
4446
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4447
+
4395
4448
  </xsl:for-each>
4396
4449
  <xsl:apply-templates/>
4397
4450
  </fo:inline>
@@ -5451,6 +5504,79 @@
5451
5504
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5452
5505
  </xsl:template>
5453
5506
 
5507
+ <!-- special case for:
5508
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5509
+ <mstyle displaystyle="true">
5510
+ <msup>
5511
+ <mi color="#00000000">C</mi>
5512
+ <mtext>R</mtext>
5513
+ </msup>
5514
+ <msubsup>
5515
+ <mtext>C</mtext>
5516
+ <mi>n</mi>
5517
+ <mi>k</mi>
5518
+ </msubsup>
5519
+ </mstyle>
5520
+ </math>
5521
+ -->
5522
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5523
+ <xsl:copy>
5524
+ <xsl:copy-of select="@*"/>
5525
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
5526
+ <xsl:if test="string-length($next_mtext) != ''">
5527
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5528
+ </xsl:if>
5529
+ <xsl:apply-templates/>
5530
+ <xsl:value-of select="$next_mtext"/>
5531
+ </xsl:copy>
5532
+ </xsl:template>
5533
+
5534
+ <!-- special case for:
5535
+ <msup>
5536
+ <mtext/>
5537
+ <mn>1</mn>
5538
+ </msup>
5539
+ convert to (add mspace after mtext and enclose them into mrow):
5540
+ <msup>
5541
+ <mrow>
5542
+ <mtext/>
5543
+ <mspace height="1.47ex"/>
5544
+ </mrow>
5545
+ <mn>1</mn>
5546
+ </msup>
5547
+ -->
5548
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5549
+ <mathml:mrow>
5550
+ <xsl:copy-of select="."/>
5551
+ <mathml:mspace height="1.47ex"/>
5552
+ </mathml:mrow>
5553
+ </xsl:template>
5554
+
5555
+ <!-- add space around vertical line -->
5556
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5557
+ <xsl:copy>
5558
+ <xsl:apply-templates select="@*" mode="mathml"/>
5559
+ <xsl:if test="not(@lspace)">
5560
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5561
+ </xsl:if>
5562
+ <xsl:if test="not(@rspace)">
5563
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5564
+ </xsl:if>
5565
+ <xsl:apply-templates mode="mathml"/>
5566
+ </xsl:copy>
5567
+ </xsl:template>
5568
+
5569
+ <!-- decrease fontsize for 'Circled Times' char -->
5570
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5571
+ <xsl:copy>
5572
+ <xsl:apply-templates select="@*" mode="mathml"/>
5573
+ <xsl:if test="not(@fontsize)">
5574
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5575
+ </xsl:if>
5576
+ <xsl:apply-templates mode="mathml"/>
5577
+ </xsl:copy>
5578
+ </xsl:template>
5579
+
5454
5580
  <!-- Examples:
5455
5581
  <stem type="AsciiMath">x = 1</stem>
5456
5582
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5508,19 +5634,23 @@
5508
5634
  <xsl:apply-templates/>
5509
5635
  </xsl:when>
5510
5636
  <xsl:otherwise>
5511
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5512
- <xsl:choose>
5513
- <xsl:when test="normalize-space(.) = ''">
5514
- <xsl:call-template name="add-zero-spaces-link-java">
5515
- <xsl:with-param name="text" select="$target_text"/>
5516
- </xsl:call-template>
5517
- </xsl:when>
5518
- <xsl:otherwise>
5519
- <!-- output text from <link>text</link> -->
5520
- <xsl:apply-templates/>
5521
- </xsl:otherwise>
5522
- </xsl:choose>
5523
- </fo:basic-link>
5637
+ <xsl:call-template name="insert_basic_link">
5638
+ <xsl:with-param name="element">
5639
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5640
+ <xsl:choose>
5641
+ <xsl:when test="normalize-space(.) = ''">
5642
+ <xsl:call-template name="add-zero-spaces-link-java">
5643
+ <xsl:with-param name="text" select="$target_text"/>
5644
+ </xsl:call-template>
5645
+ </xsl:when>
5646
+ <xsl:otherwise>
5647
+ <!-- output text from <link>text</link> -->
5648
+ <xsl:apply-templates/>
5649
+ </xsl:otherwise>
5650
+ </xsl:choose>
5651
+ </fo:basic-link>
5652
+ </xsl:with-param>
5653
+ </xsl:call-template>
5524
5654
  </xsl:otherwise>
5525
5655
  </xsl:choose>
5526
5656
  </fo:inline>
@@ -5583,12 +5713,16 @@
5583
5713
  </xsl:template>
5584
5714
 
5585
5715
  <xsl:template match="*[local-name() = 'xref']">
5586
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5587
- <xsl:if test="parent::*[local-name() = 'add']">
5588
- <xsl:call-template name="append_add-style"/>
5589
- </xsl:if>
5590
- <xsl:apply-templates/>
5591
- </fo:basic-link>
5716
+ <xsl:call-template name="insert_basic_link">
5717
+ <xsl:with-param name="element">
5718
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5719
+ <xsl:if test="parent::*[local-name() = 'add']">
5720
+ <xsl:call-template name="append_add-style"/>
5721
+ </xsl:if>
5722
+ <xsl:apply-templates/>
5723
+ </fo:basic-link>
5724
+ </xsl:with-param>
5725
+ </xsl:call-template>
5592
5726
  </xsl:template>
5593
5727
 
5594
5728
  <!-- ====== -->
@@ -5889,6 +6023,13 @@
5889
6023
  </fo:block>
5890
6024
  </xsl:template>
5891
6025
 
6026
+ <!-- SOURCE: ... -->
6027
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6028
+
6029
+ <xsl:call-template name="termsource"/>
6030
+
6031
+ </xsl:template>
6032
+
5892
6033
  <xsl:template match="*[local-name() = 'image']">
5893
6034
  <xsl:variable name="isAdded" select="../@added"/>
5894
6035
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -5962,7 +6103,7 @@
5962
6103
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5963
6104
  </xsl:when>
5964
6105
  <xsl:when test="not(starts-with(@src, 'data:'))">
5965
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6106
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
5966
6107
  </xsl:when>
5967
6108
  <xsl:otherwise>
5968
6109
  <xsl:value-of select="@src"/>
@@ -5984,7 +6125,7 @@
5984
6125
  </xsl:when>
5985
6126
  <xsl:when test="not(starts-with(@src, 'data:'))">
5986
6127
  <xsl:variable name="src">
5987
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6128
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
5988
6129
  </xsl:variable>
5989
6130
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5990
6131
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6370,15 +6511,19 @@
6370
6511
  <xsl:param name="dest"/>
6371
6512
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6372
6513
  <fo:block font-size="1pt">
6373
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6374
- <fo:inline-container inline-progression-dimension="100%">
6375
- <fo:block-container height="{$height - 1}px" width="100%">
6376
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6377
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6378
- </xsl:if> -->
6379
- <fo:block> </fo:block></fo:block-container>
6380
- </fo:inline-container>
6381
- </fo:basic-link>
6514
+ <xsl:call-template name="insert_basic_link">
6515
+ <xsl:with-param name="element">
6516
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6517
+ <fo:inline-container inline-progression-dimension="100%">
6518
+ <fo:block-container height="{$height - 1}px" width="100%">
6519
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6520
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6521
+ </xsl:if> -->
6522
+ <fo:block> </fo:block></fo:block-container>
6523
+ </fo:inline-container>
6524
+ </fo:basic-link>
6525
+ </xsl:with-param>
6526
+ </xsl:call-template>
6382
6527
  </fo:block>
6383
6528
  </fo:block-container>
6384
6529
  </xsl:template>
@@ -7021,9 +7166,11 @@
7021
7166
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7022
7167
  </xsl:if>
7023
7168
 
7024
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7169
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7025
7170
  </fo:block>
7026
7171
 
7172
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7173
+
7027
7174
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7028
7175
 
7029
7176
  </fo:block-container>
@@ -7055,11 +7202,22 @@
7055
7202
  <!-- add sourcecode highlighting -->
7056
7203
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7057
7204
  <xsl:variable name="class" select="@class"/>
7205
+
7206
+ <!-- Example: <1> -->
7207
+ <xsl:variable name="is_callout">
7208
+ <xsl:if test="parent::*[local-name() = 'dt']">
7209
+ <xsl:variable name="dt_id" select="../@id"/>
7210
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7211
+ </xsl:if>
7212
+ </xsl:variable>
7213
+
7058
7214
  <xsl:choose>
7059
7215
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7060
7216
  <fo:inline>
7061
7217
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7218
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7062
7219
  <xsl:apply-templates/>
7220
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7063
7221
  </fo:inline>
7064
7222
  </xsl:when>
7065
7223
  <xsl:otherwise>
@@ -7483,6 +7641,10 @@
7483
7641
  </fo:block>
7484
7642
  </xsl:template>
7485
7643
 
7644
+ <xsl:template match="*[local-name() = 'div']">
7645
+ <fo:block><xsl:apply-templates/></fo:block>
7646
+ </xsl:template>
7647
+
7486
7648
  <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']">
7487
7649
  <fo:block xsl:use-attribute-sets="inherit-style">
7488
7650
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -7908,14 +8070,18 @@
7908
8070
  </xsl:template>
7909
8071
 
7910
8072
  <xsl:template match="*[local-name() = 'origin']">
7911
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7912
- <xsl:if test="normalize-space(@citeas) = ''">
7913
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7914
- </xsl:if>
7915
- <fo:inline xsl:use-attribute-sets="origin-style">
7916
- <xsl:apply-templates/>
7917
- </fo:inline>
7918
- </fo:basic-link>
8073
+ <xsl:call-template name="insert_basic_link">
8074
+ <xsl:with-param name="element">
8075
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8076
+ <xsl:if test="normalize-space(@citeas) = ''">
8077
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8078
+ </xsl:if>
8079
+ <fo:inline xsl:use-attribute-sets="origin-style">
8080
+ <xsl:apply-templates/>
8081
+ </fo:inline>
8082
+ </fo:basic-link>
8083
+ </xsl:with-param>
8084
+ </xsl:call-template>
7919
8085
  </xsl:template>
7920
8086
 
7921
8087
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -7989,9 +8155,13 @@
7989
8155
  <xsl:if test="../*[local-name() = 'author']">
7990
8156
  <xsl:text>, </xsl:text>
7991
8157
  </xsl:if>
7992
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7993
- <xsl:apply-templates/>
7994
- </fo:basic-link>
8158
+ <xsl:call-template name="insert_basic_link">
8159
+ <xsl:with-param name="element">
8160
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8161
+ <xsl:apply-templates/>
8162
+ </fo:basic-link>
8163
+ </xsl:with-param>
8164
+ </xsl:call-template>
7995
8165
  </xsl:template>
7996
8166
 
7997
8167
  <xsl:template match="*[local-name() = 'author']">
@@ -8040,28 +8210,32 @@
8040
8210
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8041
8211
  <xsl:variable name="text" select="normalize-space()"/>
8042
8212
 
8043
- <fo:basic-link fox:alt-text="{@citeas}">
8044
- <xsl:if test="normalize-space(@citeas) = ''">
8045
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8046
- </xsl:if>
8047
- <xsl:if test="@type = 'inline'">
8213
+ <xsl:call-template name="insert_basic_link">
8214
+ <xsl:with-param name="element">
8215
+ <fo:basic-link fox:alt-text="{@citeas}">
8216
+ <xsl:if test="normalize-space(@citeas) = ''">
8217
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8218
+ </xsl:if>
8219
+ <xsl:if test="@type = 'inline'">
8048
8220
 
8049
- <xsl:attribute name="color">blue</xsl:attribute>
8050
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8221
+ <xsl:attribute name="color">blue</xsl:attribute>
8222
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8051
8223
 
8052
- </xsl:if>
8224
+ </xsl:if>
8053
8225
 
8054
- <xsl:choose>
8055
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8056
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8057
- </xsl:when>
8058
- <xsl:otherwise>
8059
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8060
- </xsl:otherwise>
8061
- </xsl:choose>
8226
+ <xsl:choose>
8227
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8228
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8229
+ </xsl:when>
8230
+ <xsl:otherwise>
8231
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8232
+ </xsl:otherwise>
8233
+ </xsl:choose>
8062
8234
 
8063
- <xsl:apply-templates/>
8064
- </fo:basic-link>
8235
+ <xsl:apply-templates/>
8236
+ </fo:basic-link>
8237
+ </xsl:with-param>
8238
+ </xsl:call-template>
8065
8239
 
8066
8240
  </fo:inline>
8067
8241
  </xsl:when>
@@ -8183,13 +8357,8 @@
8183
8357
  </xsl:template>
8184
8358
 
8185
8359
  <xsl:template match="*[local-name() = 'deprecates']">
8186
- <xsl:variable name="title-deprecated">
8187
- <xsl:call-template name="getLocalizedString">
8188
- <xsl:with-param name="key">deprecated</xsl:with-param>
8189
- </xsl:call-template>
8190
- </xsl:variable>
8191
8360
  <fo:block xsl:use-attribute-sets="deprecates-style">
8192
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8361
+ <xsl:apply-templates/>
8193
8362
  </fo:block>
8194
8363
  </xsl:template>
8195
8364
 
@@ -8312,7 +8481,10 @@
8312
8481
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8313
8482
 
8314
8483
  <xsl:template name="setULLabel">
8315
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8484
+ <xsl:variable name="list_level__">
8485
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8486
+ </xsl:variable>
8487
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8316
8488
  <xsl:variable name="list_level">
8317
8489
  <xsl:choose>
8318
8490
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8445,9 +8617,11 @@
8445
8617
  </fo:block-container>
8446
8618
  </xsl:when>
8447
8619
  <xsl:otherwise>
8448
- <fo:block>
8449
- <xsl:apply-templates select="." mode="list"/>
8450
- </fo:block>
8620
+
8621
+ <fo:block>
8622
+ <xsl:apply-templates select="." mode="list"/>
8623
+ </fo:block>
8624
+
8451
8625
  </xsl:otherwise>
8452
8626
  </xsl:choose>
8453
8627
  </xsl:template>
@@ -9135,24 +9309,32 @@
9135
9309
  <xsl:for-each select="*[local-name() = 'tab']">
9136
9310
  <xsl:variable name="current_id" select="generate-id()"/>
9137
9311
  <fo:table-cell>
9138
- <fo:block>
9139
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9140
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9141
- <xsl:choose>
9142
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9143
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9144
- </xsl:choose>
9145
- </xsl:for-each>
9146
- </fo:basic-link>
9312
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9313
+ <xsl:call-template name="insert_basic_link">
9314
+ <xsl:with-param name="element">
9315
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9316
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9317
+ <xsl:choose>
9318
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9319
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9320
+ </xsl:choose>
9321
+ </xsl:for-each>
9322
+ </fo:basic-link>
9323
+ </xsl:with-param>
9324
+ </xsl:call-template>
9147
9325
  </fo:block>
9148
9326
  </fo:table-cell>
9149
9327
  </xsl:for-each>
9150
9328
  <!-- last column - for page numbers -->
9151
9329
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9152
9330
  <fo:block>
9153
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9154
- <fo:page-number-citation ref-id="{$target}"/>
9155
- </fo:basic-link>
9331
+ <xsl:call-template name="insert_basic_link">
9332
+ <xsl:with-param name="element">
9333
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9334
+ <fo:page-number-citation ref-id="{$target}"/>
9335
+ </fo:basic-link>
9336
+ </xsl:with-param>
9337
+ </xsl:call-template>
9156
9338
  </fo:block>
9157
9339
  </fo:table-cell>
9158
9340
  </xsl:template>
@@ -9194,6 +9376,27 @@
9194
9376
  <!-- End Table of Contents (ToC) processing -->
9195
9377
  <!-- =================== -->
9196
9378
 
9379
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9380
+ <xsl:template name="insert_basic_link">
9381
+ <xsl:param name="element"/>
9382
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9383
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9384
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9385
+ <xsl:choose>
9386
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9387
+ <xsl:copy-of select="$element_node"/>
9388
+ </xsl:when>
9389
+ <xsl:otherwise>
9390
+ <fo:inline>
9391
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9392
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9393
+ </xsl:for-each>
9394
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9395
+ </fo:inline>
9396
+ </xsl:otherwise>
9397
+ </xsl:choose>
9398
+ </xsl:template>
9399
+
9197
9400
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9198
9401
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9199
9402
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9420,6 +9623,23 @@
9420
9623
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9421
9624
  <xsl:copy-of select="."/>
9422
9625
  </xsl:template>
9626
+
9627
+ <!-- add @id, redundant for table auto-layout algorithm -->
9628
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9629
+ <xsl:copy>
9630
+ <xsl:copy-of select="@*"/>
9631
+ <xsl:call-template name="add_id"/>
9632
+ <xsl:apply-templates mode="update_xml_step1"/>
9633
+ </xsl:copy>
9634
+ </xsl:template>
9635
+
9636
+ <xsl:template name="add_id">
9637
+ <xsl:if test="not(@id)">
9638
+ <!-- add @id - first element with @id plus '_element_name' -->
9639
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9640
+ </xsl:if>
9641
+ </xsl:template>
9642
+
9423
9643
  <!-- =========================================================================== -->
9424
9644
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9425
9645
  <!-- =========================================================================== -->
@@ -1,5 +1,4 @@
1
1
  <nav>
2
- <h1 id="content">Contents</h1>
3
2
  <div id="toc"></div>
4
3
 
5
4
  </nav>
@@ -14,6 +14,3 @@
14
14
 
15
15
  </div>
16
16
 
17
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
18
-
19
- WORDTOC
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/csd" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar ns='https://www.metanorma.org/ns/cc' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
3
  <!--
4
+ VERSION v1.2.1
4
5
  default namespace = "http://riboseinc.com/csd"
5
6
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
6
7
  we cannot have a new default namespace: we will end up with a grammar with two different
@@ -60,13 +61,7 @@
60
61
  </include>
61
62
  <define name="csd-standard">
62
63
  <element name="csd-standard">
63
- <attribute name="version"/>
64
- <attribute name="type">
65
- <choice>
66
- <value>semantic</value>
67
- <value>presentation</value>
68
- </choice>
69
- </attribute>
64
+ <ref name="Root-Attributes"/>
70
65
  <ref name="bibdata"/>
71
66
  <zeroOrMore>
72
67
  <ref name="termdocsource"/>
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.1 -->
20
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -382,6 +383,9 @@
382
383
  <optional>
383
384
  <ref name="dl"/>
384
385
  </optional>
386
+ <optional>
387
+ <ref name="source"/>
388
+ </optional>
385
389
  </element>
386
390
  </define>
387
391
  <define name="figure">
@@ -404,9 +408,6 @@
404
408
  <attribute name="class"/>
405
409
  </optional>
406
410
  <ref name="BlockAttributes"/>
407
- <optional>
408
- <ref name="source"/>
409
- </optional>
410
411
  <optional>
411
412
  <ref name="tname"/>
412
413
  </optional>
@@ -431,6 +432,20 @@
431
432
  <zeroOrMore>
432
433
  <ref name="note"/>
433
434
  </zeroOrMore>
435
+ <optional>
436
+ <ref name="source"/>
437
+ </optional>
438
+ </element>
439
+ </define>
440
+ <define name="source">
441
+ <element name="source">
442
+ <attribute name="status">
443
+ <ref name="SourceStatusType"/>
444
+ </attribute>
445
+ <ref name="origin"/>
446
+ <optional>
447
+ <ref name="modification"/>
448
+ </optional>
434
449
  </element>
435
450
  </define>
436
451
  <define name="sourcecode">
@@ -1335,15 +1350,19 @@
1335
1350
  </choice>
1336
1351
  </element>
1337
1352
  </define>
1353
+ <define name="Root-Attributes">
1354
+ <attribute name="version"/>
1355
+ <attribute name="schema-version"/>
1356
+ <attribute name="type">
1357
+ <choice>
1358
+ <value>semantic</value>
1359
+ <value>presentation</value>
1360
+ </choice>
1361
+ </attribute>
1362
+ </define>
1338
1363
  <define name="standard-document">
1339
1364
  <element name="standard-document">
1340
- <attribute name="version"/>
1341
- <attribute name="type">
1342
- <choice>
1343
- <value>semantic</value>
1344
- <value>presentation</value>
1345
- </choice>
1346
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1347
1366
  <ref name="bibdata"/>
1348
1367
  <optional>
1349
1368
  <ref name="misccontainer"/>
@@ -2099,10 +2118,7 @@
2099
2118
  <define name="termsource">
2100
2119
  <element name="termsource">
2101
2120
  <attribute name="status">
2102
- <choice>
2103
- <value>identical</value>
2104
- <value>modified</value>
2105
- </choice>
2121
+ <ref name="SourceStatusType"/>
2106
2122
  </attribute>
2107
2123
  <attribute name="type">
2108
2124
  <choice>
@@ -2116,6 +2132,17 @@
2116
2132
  </optional>
2117
2133
  </element>
2118
2134
  </define>
2135
+ <define name="SourceStatusType">
2136
+ <choice>
2137
+ <value>identical</value>
2138
+ <value>modified</value>
2139
+ <value>restyled</value>
2140
+ <value>context-added</value>
2141
+ <value>generalisation</value>
2142
+ <value>specialisation</value>
2143
+ <value>unspecified</value>
2144
+ </choice>
2145
+ </define>
2119
2146
  <define name="origin">
2120
2147
  <element name="origin">
2121
2148
  <choice>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.2.6".freeze
3
+ VERSION = "2.2.8".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.4.0"
32
+ spec.add_dependency "metanorma-generic", "~> 2.4.1"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.6
4
+ version: 2.2.8
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-25 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