metanorma-csa 2.2.6 → 2.2.8

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: 2184d97c9a8c1557149239d93b3f6494a55f36d96ced20809e050bd86a735eaa
4
- data.tar.gz: d0125b0fbb112f4912a4e4cb6e88d23a78dfc31c6a9185f88445a5064948b664
3
+ metadata.gz: 1f026cc5f17710b4c86ca73902875e78167064ddb22c104f5ce43af45bf606f0
4
+ data.tar.gz: b47cd012fbbafaf26c67a39315d764f664830c7a51b980ccf5eb1b9ec03d93ab
5
5
  SHA512:
6
- metadata.gz: bf66ecb04c727773f03abab6381fe68d5fd95f632acc8d61e418c50fe53449e02dc4feea1a733b37433499d9bdd9d2fa52d39e0c3babbc211a5ebd8f22818935
7
- data.tar.gz: 7efa80a1016c8491366ce957533b188ed3aa8677b3d716d66a5622a8f9dc0656eb97e1f3532a1312452d62266add79c6ba36a9f8e67c710a0794e260e0632f43
6
+ metadata.gz: 4ddaf09ae0cad9b65114f73cd40cca31cffb3e32e008e4fbea4f2a9f6e514b98fd307c7f9f023909fd71455ee54192837a0693d6fdabd36da4414530a059ff96
7
+ data.tar.gz: bd3a734091c79751787491eccd5cb97045699db76a2c751822eb9e7a1dbe96ac306e5a3e63a206a848fbc4cb4a8e048cd22b11b63c6bec69bb3e4cb5a4a985c2
@@ -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
  <!-- ========================== -->
@@ -1244,6 +1251,7 @@
1244
1251
  </xsl:attribute-set>
1245
1252
 
1246
1253
  <xsl:attribute-set name="xref-style">
1254
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1247
1255
 
1248
1256
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1249
1257
 
@@ -1366,6 +1374,10 @@
1366
1374
 
1367
1375
  </xsl:attribute-set>
1368
1376
 
1377
+ <xsl:attribute-set name="figure-source-style">
1378
+
1379
+ </xsl:attribute-set>
1380
+
1369
1381
  <!-- Formula's styles -->
1370
1382
  <xsl:attribute-set name="formula-style">
1371
1383
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1912,7 +1924,7 @@
1912
1924
 
1913
1925
  <xsl:template name="processTables_Contents">
1914
1926
  <tables>
1915
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1927
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1916
1928
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1917
1929
  <xsl:copy-of select="*[local-name() = 'name']"/>
1918
1930
  </table>
@@ -2262,7 +2274,7 @@
2262
2274
  </xsl:attribute>
2263
2275
  </xsl:for-each>
2264
2276
 
2265
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2277
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2266
2278
  <xsl:if test="$isNoteOrFnExist = 'true'">
2267
2279
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2268
2280
  </xsl:if>
@@ -2306,7 +2318,7 @@
2306
2318
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2307
2319
  </xsl:when>
2308
2320
  <xsl:otherwise>
2309
- <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 -->
2321
+ <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 -->
2310
2322
  </xsl:otherwise>
2311
2323
  </xsl:choose>
2312
2324
 
@@ -2410,6 +2422,11 @@
2410
2422
  </xsl:if>
2411
2423
  </xsl:template> <!-- table/name -->
2412
2424
 
2425
+ <!-- SOURCE: ... -->
2426
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2427
+ <xsl:call-template name="termsource"/>
2428
+ </xsl:template>
2429
+
2413
2430
  <xsl:template name="calculate-columns-numbers">
2414
2431
  <xsl:param name="table-row"/>
2415
2432
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2766,7 +2783,7 @@
2766
2783
  </fo:table-header>
2767
2784
  </xsl:template> <!-- thead -->
2768
2785
 
2769
- <!-- template is using for iso, jcgm, bsi only -->
2786
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2770
2787
  <xsl:template name="table-header-title">
2771
2788
  <xsl:param name="cols-count"/>
2772
2789
  <!-- row for title -->
@@ -2809,7 +2826,7 @@
2809
2826
  <xsl:param name="colwidths"/>
2810
2827
  <xsl:param name="colgroup"/>
2811
2828
 
2812
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2829
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2813
2830
 
2814
2831
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2815
2832
 
@@ -2879,6 +2896,7 @@
2879
2896
 
2880
2897
  <xsl:apply-templates select="../*[local-name()='dl']"/>
2881
2898
  <xsl:apply-templates select="../*[local-name()='note']"/>
2899
+ <xsl:apply-templates select="../*[local-name()='source']"/>
2882
2900
 
2883
2901
  <xsl:variable name="isDisplayRowSeparator">
2884
2902
 
@@ -3237,9 +3255,13 @@
3237
3255
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3238
3256
  </xsl:if>
3239
3257
 
3240
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3241
- <xsl:value-of select="$current_fn_number_text"/>
3242
- </fo:basic-link>
3258
+ <xsl:call-template name="insert_basic_link">
3259
+ <xsl:with-param name="element">
3260
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3261
+ <xsl:value-of select="$current_fn_number_text"/>
3262
+ </fo:basic-link>
3263
+ </xsl:with-param>
3264
+ </xsl:call-template>
3243
3265
  </fo:inline>
3244
3266
  </xsl:variable>
3245
3267
 
@@ -3511,7 +3533,7 @@
3511
3533
  <xsl:variable name="isAdded" select="@added"/>
3512
3534
  <xsl:variable name="isDeleted" select="@deleted"/>
3513
3535
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3514
- <fo:block-container>
3536
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3515
3537
 
3516
3538
  <xsl:call-template name="setBlockSpanAll"/>
3517
3539
 
@@ -3519,6 +3541,18 @@
3519
3541
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3520
3542
  </xsl:if>
3521
3543
 
3544
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3545
+ <!-- set font-size as sourcecode font-size -->
3546
+ <xsl:variable name="sourcecode_attributes">
3547
+ <xsl:call-template name="get_sourcecode_attributes"/>
3548
+ </xsl:variable>
3549
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3550
+ <xsl:attribute name="{local-name()}">
3551
+ <xsl:value-of select="."/>
3552
+ </xsl:attribute>
3553
+ </xsl:for-each>
3554
+ </xsl:if>
3555
+
3522
3556
  <xsl:if test="parent::*[local-name() = 'note']">
3523
3557
  <xsl:attribute name="margin-left">
3524
3558
  <xsl:choose>
@@ -3560,8 +3594,10 @@
3560
3594
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3561
3595
  <xsl:text> </xsl:text>
3562
3596
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3563
- <xsl:text/>
3564
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3597
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3598
+ <xsl:text> </xsl:text>
3599
+ </xsl:if>
3600
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3565
3601
  </fo:block>
3566
3602
 
3567
3603
  </xsl:when> <!-- END: only one component -->
@@ -3952,6 +3988,7 @@
3952
3988
  <xsl:param name="split_keep-within-line"/>
3953
3989
 
3954
3990
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
3991
+
3955
3992
  <xsl:call-template name="insert_dt_cell">
3956
3993
  <xsl:with-param name="key_iso" select="$key_iso"/>
3957
3994
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -3973,6 +4010,7 @@
3973
4010
  <!-- border is mandatory, to calculate real width -->
3974
4011
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
3975
4012
  <xsl:attribute name="text-align">left</xsl:attribute>
4013
+
3976
4014
  </xsl:if>
3977
4015
 
3978
4016
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4046,8 +4084,18 @@
4046
4084
  </xsl:if>
4047
4085
  </xsl:template>
4048
4086
 
4049
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4050
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4087
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4088
+ <xsl:variable name="is_inline_element_after_where">
4089
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4090
+ </xsl:variable>
4091
+ <xsl:choose>
4092
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4093
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4094
+ </xsl:when>
4095
+ <xsl:otherwise>
4096
+ <xsl:apply-templates select="."/>
4097
+ </xsl:otherwise>
4098
+ </xsl:choose>
4051
4099
  </xsl:template>
4052
4100
 
4053
4101
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4417,6 +4465,7 @@
4417
4465
  <fo:inline>
4418
4466
  <xsl:for-each select="$styles/style">
4419
4467
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4468
+
4420
4469
  </xsl:for-each>
4421
4470
  <xsl:apply-templates/>
4422
4471
  </fo:inline>
@@ -5476,6 +5525,79 @@
5476
5525
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5477
5526
  </xsl:template>
5478
5527
 
5528
+ <!-- special case for:
5529
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5530
+ <mstyle displaystyle="true">
5531
+ <msup>
5532
+ <mi color="#00000000">C</mi>
5533
+ <mtext>R</mtext>
5534
+ </msup>
5535
+ <msubsup>
5536
+ <mtext>C</mtext>
5537
+ <mi>n</mi>
5538
+ <mi>k</mi>
5539
+ </msubsup>
5540
+ </mstyle>
5541
+ </math>
5542
+ -->
5543
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5544
+ <xsl:copy>
5545
+ <xsl:copy-of select="@*"/>
5546
+ <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"/>
5547
+ <xsl:if test="string-length($next_mtext) != ''">
5548
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5549
+ </xsl:if>
5550
+ <xsl:apply-templates/>
5551
+ <xsl:value-of select="$next_mtext"/>
5552
+ </xsl:copy>
5553
+ </xsl:template>
5554
+
5555
+ <!-- special case for:
5556
+ <msup>
5557
+ <mtext/>
5558
+ <mn>1</mn>
5559
+ </msup>
5560
+ convert to (add mspace after mtext and enclose them into mrow):
5561
+ <msup>
5562
+ <mrow>
5563
+ <mtext/>
5564
+ <mspace height="1.47ex"/>
5565
+ </mrow>
5566
+ <mn>1</mn>
5567
+ </msup>
5568
+ -->
5569
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5570
+ <mathml:mrow>
5571
+ <xsl:copy-of select="."/>
5572
+ <mathml:mspace height="1.47ex"/>
5573
+ </mathml:mrow>
5574
+ </xsl:template>
5575
+
5576
+ <!-- add space around vertical line -->
5577
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5578
+ <xsl:copy>
5579
+ <xsl:apply-templates select="@*" mode="mathml"/>
5580
+ <xsl:if test="not(@lspace)">
5581
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5582
+ </xsl:if>
5583
+ <xsl:if test="not(@rspace)">
5584
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5585
+ </xsl:if>
5586
+ <xsl:apply-templates mode="mathml"/>
5587
+ </xsl:copy>
5588
+ </xsl:template>
5589
+
5590
+ <!-- decrease fontsize for 'Circled Times' char -->
5591
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5592
+ <xsl:copy>
5593
+ <xsl:apply-templates select="@*" mode="mathml"/>
5594
+ <xsl:if test="not(@fontsize)">
5595
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5596
+ </xsl:if>
5597
+ <xsl:apply-templates mode="mathml"/>
5598
+ </xsl:copy>
5599
+ </xsl:template>
5600
+
5479
5601
  <!-- Examples:
5480
5602
  <stem type="AsciiMath">x = 1</stem>
5481
5603
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5533,19 +5655,23 @@
5533
5655
  <xsl:apply-templates/>
5534
5656
  </xsl:when>
5535
5657
  <xsl:otherwise>
5536
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5537
- <xsl:choose>
5538
- <xsl:when test="normalize-space(.) = ''">
5539
- <xsl:call-template name="add-zero-spaces-link-java">
5540
- <xsl:with-param name="text" select="$target_text"/>
5541
- </xsl:call-template>
5542
- </xsl:when>
5543
- <xsl:otherwise>
5544
- <!-- output text from <link>text</link> -->
5545
- <xsl:apply-templates/>
5546
- </xsl:otherwise>
5547
- </xsl:choose>
5548
- </fo:basic-link>
5658
+ <xsl:call-template name="insert_basic_link">
5659
+ <xsl:with-param name="element">
5660
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5661
+ <xsl:choose>
5662
+ <xsl:when test="normalize-space(.) = ''">
5663
+ <xsl:call-template name="add-zero-spaces-link-java">
5664
+ <xsl:with-param name="text" select="$target_text"/>
5665
+ </xsl:call-template>
5666
+ </xsl:when>
5667
+ <xsl:otherwise>
5668
+ <!-- output text from <link>text</link> -->
5669
+ <xsl:apply-templates/>
5670
+ </xsl:otherwise>
5671
+ </xsl:choose>
5672
+ </fo:basic-link>
5673
+ </xsl:with-param>
5674
+ </xsl:call-template>
5549
5675
  </xsl:otherwise>
5550
5676
  </xsl:choose>
5551
5677
  </fo:inline>
@@ -5608,12 +5734,16 @@
5608
5734
  </xsl:template>
5609
5735
 
5610
5736
  <xsl:template match="*[local-name() = 'xref']">
5611
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5612
- <xsl:if test="parent::*[local-name() = 'add']">
5613
- <xsl:call-template name="append_add-style"/>
5614
- </xsl:if>
5615
- <xsl:apply-templates/>
5616
- </fo:basic-link>
5737
+ <xsl:call-template name="insert_basic_link">
5738
+ <xsl:with-param name="element">
5739
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5740
+ <xsl:if test="parent::*[local-name() = 'add']">
5741
+ <xsl:call-template name="append_add-style"/>
5742
+ </xsl:if>
5743
+ <xsl:apply-templates/>
5744
+ </fo:basic-link>
5745
+ </xsl:with-param>
5746
+ </xsl:call-template>
5617
5747
  </xsl:template>
5618
5748
 
5619
5749
  <!-- ====== -->
@@ -5918,6 +6048,13 @@
5918
6048
  </fo:block>
5919
6049
  </xsl:template>
5920
6050
 
6051
+ <!-- SOURCE: ... -->
6052
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6053
+
6054
+ <xsl:call-template name="termsource"/>
6055
+
6056
+ </xsl:template>
6057
+
5921
6058
  <xsl:template match="*[local-name() = 'image']">
5922
6059
  <xsl:variable name="isAdded" select="../@added"/>
5923
6060
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -5991,7 +6128,7 @@
5991
6128
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5992
6129
  </xsl:when>
5993
6130
  <xsl:when test="not(starts-with(@src, 'data:'))">
5994
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6131
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
5995
6132
  </xsl:when>
5996
6133
  <xsl:otherwise>
5997
6134
  <xsl:value-of select="@src"/>
@@ -6013,7 +6150,7 @@
6013
6150
  </xsl:when>
6014
6151
  <xsl:when test="not(starts-with(@src, 'data:'))">
6015
6152
  <xsl:variable name="src">
6016
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6153
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6017
6154
  </xsl:variable>
6018
6155
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6019
6156
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6399,15 +6536,19 @@
6399
6536
  <xsl:param name="dest"/>
6400
6537
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6401
6538
  <fo:block font-size="1pt">
6402
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6403
- <fo:inline-container inline-progression-dimension="100%">
6404
- <fo:block-container height="{$height - 1}px" width="100%">
6405
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6406
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6407
- </xsl:if> -->
6408
- <fo:block> </fo:block></fo:block-container>
6409
- </fo:inline-container>
6410
- </fo:basic-link>
6539
+ <xsl:call-template name="insert_basic_link">
6540
+ <xsl:with-param name="element">
6541
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6542
+ <fo:inline-container inline-progression-dimension="100%">
6543
+ <fo:block-container height="{$height - 1}px" width="100%">
6544
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6545
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6546
+ </xsl:if> -->
6547
+ <fo:block> </fo:block></fo:block-container>
6548
+ </fo:inline-container>
6549
+ </fo:basic-link>
6550
+ </xsl:with-param>
6551
+ </xsl:call-template>
6411
6552
  </fo:block>
6412
6553
  </fo:block-container>
6413
6554
  </xsl:template>
@@ -7049,9 +7190,11 @@
7049
7190
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7050
7191
  </xsl:if>
7051
7192
 
7052
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7193
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7053
7194
  </fo:block>
7054
7195
 
7196
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7197
+
7055
7198
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7056
7199
 
7057
7200
  </fo:block-container>
@@ -7083,11 +7226,22 @@
7083
7226
  <!-- add sourcecode highlighting -->
7084
7227
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7085
7228
  <xsl:variable name="class" select="@class"/>
7229
+
7230
+ <!-- Example: <1> -->
7231
+ <xsl:variable name="is_callout">
7232
+ <xsl:if test="parent::*[local-name() = 'dt']">
7233
+ <xsl:variable name="dt_id" select="../@id"/>
7234
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7235
+ </xsl:if>
7236
+ </xsl:variable>
7237
+
7086
7238
  <xsl:choose>
7087
7239
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7088
7240
  <fo:inline>
7089
7241
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7242
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7090
7243
  <xsl:apply-templates/>
7244
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7091
7245
  </fo:inline>
7092
7246
  </xsl:when>
7093
7247
  <xsl:otherwise>
@@ -7511,6 +7665,10 @@
7511
7665
  </fo:block>
7512
7666
  </xsl:template>
7513
7667
 
7668
+ <xsl:template match="*[local-name() = 'div']">
7669
+ <fo:block><xsl:apply-templates/></fo:block>
7670
+ </xsl:template>
7671
+
7514
7672
  <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']">
7515
7673
  <fo:block xsl:use-attribute-sets="inherit-style">
7516
7674
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -7936,14 +8094,18 @@
7936
8094
  </xsl:template>
7937
8095
 
7938
8096
  <xsl:template match="*[local-name() = 'origin']">
7939
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7940
- <xsl:if test="normalize-space(@citeas) = ''">
7941
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7942
- </xsl:if>
7943
- <fo:inline xsl:use-attribute-sets="origin-style">
7944
- <xsl:apply-templates/>
7945
- </fo:inline>
7946
- </fo:basic-link>
8097
+ <xsl:call-template name="insert_basic_link">
8098
+ <xsl:with-param name="element">
8099
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8100
+ <xsl:if test="normalize-space(@citeas) = ''">
8101
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8102
+ </xsl:if>
8103
+ <fo:inline xsl:use-attribute-sets="origin-style">
8104
+ <xsl:apply-templates/>
8105
+ </fo:inline>
8106
+ </fo:basic-link>
8107
+ </xsl:with-param>
8108
+ </xsl:call-template>
7947
8109
  </xsl:template>
7948
8110
 
7949
8111
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8017,9 +8179,13 @@
8017
8179
  <xsl:if test="../*[local-name() = 'author']">
8018
8180
  <xsl:text>, </xsl:text>
8019
8181
  </xsl:if>
8020
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8021
- <xsl:apply-templates/>
8022
- </fo:basic-link>
8182
+ <xsl:call-template name="insert_basic_link">
8183
+ <xsl:with-param name="element">
8184
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8185
+ <xsl:apply-templates/>
8186
+ </fo:basic-link>
8187
+ </xsl:with-param>
8188
+ </xsl:call-template>
8023
8189
  </xsl:template>
8024
8190
 
8025
8191
  <xsl:template match="*[local-name() = 'author']">
@@ -8068,25 +8234,29 @@
8068
8234
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8069
8235
  <xsl:variable name="text" select="normalize-space()"/>
8070
8236
 
8071
- <fo:basic-link fox:alt-text="{@citeas}">
8072
- <xsl:if test="normalize-space(@citeas) = ''">
8073
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8074
- </xsl:if>
8075
- <xsl:if test="@type = 'inline'">
8237
+ <xsl:call-template name="insert_basic_link">
8238
+ <xsl:with-param name="element">
8239
+ <fo:basic-link fox:alt-text="{@citeas}">
8240
+ <xsl:if test="normalize-space(@citeas) = ''">
8241
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8242
+ </xsl:if>
8243
+ <xsl:if test="@type = 'inline'">
8076
8244
 
8077
- </xsl:if>
8245
+ </xsl:if>
8078
8246
 
8079
- <xsl:choose>
8080
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8081
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8082
- </xsl:when>
8083
- <xsl:otherwise>
8084
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8085
- </xsl:otherwise>
8086
- </xsl:choose>
8247
+ <xsl:choose>
8248
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8249
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8250
+ </xsl:when>
8251
+ <xsl:otherwise>
8252
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8253
+ </xsl:otherwise>
8254
+ </xsl:choose>
8087
8255
 
8088
- <xsl:apply-templates/>
8089
- </fo:basic-link>
8256
+ <xsl:apply-templates/>
8257
+ </fo:basic-link>
8258
+ </xsl:with-param>
8259
+ </xsl:call-template>
8090
8260
 
8091
8261
  </fo:inline>
8092
8262
  </xsl:when>
@@ -8204,13 +8374,8 @@
8204
8374
  </xsl:template>
8205
8375
 
8206
8376
  <xsl:template match="*[local-name() = 'deprecates']">
8207
- <xsl:variable name="title-deprecated">
8208
- <xsl:call-template name="getLocalizedString">
8209
- <xsl:with-param name="key">deprecated</xsl:with-param>
8210
- </xsl:call-template>
8211
- </xsl:variable>
8212
8377
  <fo:block xsl:use-attribute-sets="deprecates-style">
8213
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8378
+ <xsl:apply-templates/>
8214
8379
  </fo:block>
8215
8380
  </xsl:template>
8216
8381
 
@@ -8335,7 +8500,10 @@
8335
8500
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8336
8501
 
8337
8502
  <xsl:template name="setULLabel">
8338
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8503
+ <xsl:variable name="list_level__">
8504
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8505
+ </xsl:variable>
8506
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8339
8507
  <xsl:variable name="list_level">
8340
8508
  <xsl:choose>
8341
8509
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8468,9 +8636,11 @@
8468
8636
  </fo:block-container>
8469
8637
  </xsl:when>
8470
8638
  <xsl:otherwise>
8471
- <fo:block>
8472
- <xsl:apply-templates select="." mode="list"/>
8473
- </fo:block>
8639
+
8640
+ <fo:block>
8641
+ <xsl:apply-templates select="." mode="list"/>
8642
+ </fo:block>
8643
+
8474
8644
  </xsl:otherwise>
8475
8645
  </xsl:choose>
8476
8646
  </xsl:template>
@@ -9136,24 +9306,32 @@
9136
9306
  <xsl:for-each select="*[local-name() = 'tab']">
9137
9307
  <xsl:variable name="current_id" select="generate-id()"/>
9138
9308
  <fo:table-cell>
9139
- <fo:block>
9140
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9141
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9142
- <xsl:choose>
9143
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9144
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9145
- </xsl:choose>
9146
- </xsl:for-each>
9147
- </fo:basic-link>
9309
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9310
+ <xsl:call-template name="insert_basic_link">
9311
+ <xsl:with-param name="element">
9312
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9313
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9314
+ <xsl:choose>
9315
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9316
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9317
+ </xsl:choose>
9318
+ </xsl:for-each>
9319
+ </fo:basic-link>
9320
+ </xsl:with-param>
9321
+ </xsl:call-template>
9148
9322
  </fo:block>
9149
9323
  </fo:table-cell>
9150
9324
  </xsl:for-each>
9151
9325
  <!-- last column - for page numbers -->
9152
9326
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9153
9327
  <fo:block>
9154
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9155
- <fo:page-number-citation ref-id="{$target}"/>
9156
- </fo:basic-link>
9328
+ <xsl:call-template name="insert_basic_link">
9329
+ <xsl:with-param name="element">
9330
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9331
+ <fo:page-number-citation ref-id="{$target}"/>
9332
+ </fo:basic-link>
9333
+ </xsl:with-param>
9334
+ </xsl:call-template>
9157
9335
  </fo:block>
9158
9336
  </fo:table-cell>
9159
9337
  </xsl:template>
@@ -9195,6 +9373,27 @@
9195
9373
  <!-- End Table of Contents (ToC) processing -->
9196
9374
  <!-- =================== -->
9197
9375
 
9376
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9377
+ <xsl:template name="insert_basic_link">
9378
+ <xsl:param name="element"/>
9379
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9380
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9381
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9382
+ <xsl:choose>
9383
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9384
+ <xsl:copy-of select="$element_node"/>
9385
+ </xsl:when>
9386
+ <xsl:otherwise>
9387
+ <fo:inline>
9388
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9389
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9390
+ </xsl:for-each>
9391
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9392
+ </fo:inline>
9393
+ </xsl:otherwise>
9394
+ </xsl:choose>
9395
+ </xsl:template>
9396
+
9198
9397
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9199
9398
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9200
9399
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9413,6 +9612,23 @@
9413
9612
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9414
9613
  <xsl:copy-of select="."/>
9415
9614
  </xsl:template>
9615
+
9616
+ <!-- add @id, redundant for table auto-layout algorithm -->
9617
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9618
+ <xsl:copy>
9619
+ <xsl:copy-of select="@*"/>
9620
+ <xsl:call-template name="add_id"/>
9621
+ <xsl:apply-templates mode="update_xml_step1"/>
9622
+ </xsl:copy>
9623
+ </xsl:template>
9624
+
9625
+ <xsl:template name="add_id">
9626
+ <xsl:if test="not(@id)">
9627
+ <!-- add @id - first element with @id plus '_element_name' -->
9628
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9629
+ </xsl:if>
9630
+ </xsl:template>
9631
+
9416
9632
  <!-- =========================================================================== -->
9417
9633
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9418
9634
  <!-- =========================================================================== -->
@@ -1,5 +1,4 @@
1
1
  <nav>
2
- <h1 id="content">Contents</h1>
3
2
  <div id="toc"></div>
4
3
 
5
4
  </nav>
@@ -9,6 +9,3 @@
9
9
 
10
10
  </div>
11
11
 
12
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
13
-
14
- WORDTOC
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/csa" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar ns='https://www.metanorma.org/ns/csa' 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
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
6
  we cannot have a new default namespace: we will end up with a grammar with two different
6
7
  namespaces, one for isostandard and one for csand additions. And we do not want that.
@@ -59,13 +60,7 @@
59
60
  </include>
60
61
  <define name="csand-standard">
61
62
  <element name="csa-standard">
62
- <attribute name="version"/>
63
- <attribute name="type">
64
- <choice>
65
- <value>semantic</value>
66
- <value>presentation</value>
67
- </choice>
68
- </attribute>
63
+ <ref name="Root-Attributes"/>
69
64
  <ref name="bibdata"/>
70
65
  <zeroOrMore>
71
66
  <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 Csa
3
- VERSION = "2.2.6".freeze
3
+ VERSION = "2.2.8".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.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