metanorma-mpfa 0.6.10 → 0.7.0

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.
@@ -881,6 +881,8 @@
881
881
 
882
882
  <title-list-figures lang="en">List of Figures</title-list-figures>
883
883
 
884
+ <title-table-figures lang="en">Table of Figures</title-table-figures>
885
+
884
886
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
885
887
 
886
888
  <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
@@ -1152,6 +1154,11 @@
1152
1154
 
1153
1155
 
1154
1156
 
1157
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1158
+
1159
+
1160
+
1161
+
1155
1162
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1156
1163
 
1157
1164
 
@@ -1307,13 +1314,20 @@
1307
1314
 
1308
1315
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1309
1316
 
1310
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1317
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1318
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1319
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1311
1320
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1312
1321
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1313
1322
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1314
1323
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1315
1324
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1316
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1325
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1326
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1327
+ <xsl:sort select="@displayorder" data-type="number"/>
1328
+ <xsl:apply-templates select="." mode="contents"/>
1329
+ </xsl:for-each>
1330
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1317
1331
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1318
1332
 
1319
1333
  <!-- Normative references -->
@@ -1326,13 +1340,33 @@
1326
1340
  <!-- Bibliography -->
1327
1341
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1328
1342
 
1329
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1343
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1344
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1345
+ <xsl:sort select="@displayorder" data-type="number"/>
1346
+ <xsl:apply-templates select="." mode="contents"/>
1347
+ </xsl:for-each>
1348
+
1349
+ <xsl:for-each select="/*/*[local-name()='annex']">
1350
+ <xsl:sort select="@displayorder" data-type="number"/>
1351
+ <xsl:apply-templates select="." mode="contents"/>
1352
+ </xsl:for-each>
1353
+
1354
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1355
+ <xsl:sort select="@displayorder" data-type="number"/>
1356
+ <xsl:apply-templates select="." mode="contents"/>
1357
+ </xsl:for-each>
1358
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1330
1359
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1331
1360
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1332
1361
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1333
1362
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1334
1363
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1335
- </xsl:template><xsl:template name="processMainSectionsDefault">
1364
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1365
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1366
+ <xsl:sort select="@displayorder" data-type="number"/>
1367
+ <xsl:apply-templates select="."/>
1368
+ </xsl:for-each>
1369
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1336
1370
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1337
1371
 
1338
1372
  <!-- Normative references -->
@@ -1344,6 +1378,22 @@
1344
1378
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1345
1379
  <!-- Bibliography -->
1346
1380
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1381
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1382
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1383
+ <xsl:sort select="@displayorder" data-type="number"/>
1384
+ <xsl:apply-templates select="."/>
1385
+
1386
+ </xsl:for-each>
1387
+
1388
+ <xsl:for-each select="/*/*[local-name()='annex']">
1389
+ <xsl:sort select="@displayorder" data-type="number"/>
1390
+ <xsl:apply-templates select="."/>
1391
+ </xsl:for-each>
1392
+
1393
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1394
+ <xsl:sort select="@displayorder" data-type="number"/>
1395
+ <xsl:apply-templates select="."/>
1396
+ </xsl:for-each>
1347
1397
  </xsl:template><xsl:template match="text()">
1348
1398
  <xsl:value-of select="."/>
1349
1399
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -2188,9 +2238,8 @@
2188
2238
 
2189
2239
  <!-- Table's note name (NOTE, for example) -->
2190
2240
 
2191
- <fo:inline padding-right="2mm">
2241
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2192
2242
 
2193
-
2194
2243
 
2195
2244
 
2196
2245
 
@@ -2798,6 +2847,8 @@
2798
2847
  <xsl:if test="$font-size != ''">
2799
2848
  <xsl:attribute name="font-size">
2800
2849
  <xsl:choose>
2850
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
2851
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
2801
2852
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2802
2853
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2803
2854
  </xsl:choose>
@@ -3597,6 +3648,7 @@
3597
3648
  <xsl:otherwise>
3598
3649
  <fo:block xsl:use-attribute-sets="image-style">
3599
3650
 
3651
+
3600
3652
  <xsl:variable name="src">
3601
3653
  <xsl:call-template name="image_src"/>
3602
3654
  </xsl:variable>
@@ -3844,6 +3896,13 @@
3844
3896
  </xsl:attribute>
3845
3897
  <xsl:apply-templates mode="svg_update"/>
3846
3898
  </xsl:copy>
3899
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
3900
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3901
+ <xsl:for-each select="*[local-name() = 'svg']">
3902
+ <xsl:call-template name="image_svg">
3903
+ <xsl:with-param name="name" select="$name"/>
3904
+ </xsl:call-template>
3905
+ </xsl:for-each>
3847
3906
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3848
3907
  <xsl:variable name="svg_content" select="document(@src)"/>
3849
3908
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -3948,7 +4007,7 @@
3948
4007
  </fo:basic-link>
3949
4008
  </fo:block>
3950
4009
  </fo:block-container>
3951
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4010
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3952
4011
  <xsl:apply-templates mode="contents"/>
3953
4012
  <xsl:text> </xsl:text>
3954
4013
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
@@ -3956,7 +4015,7 @@
3956
4015
  <xsl:text> </xsl:text>
3957
4016
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
3958
4017
  <xsl:value-of select="."/>
3959
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4018
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
3960
4019
  <xsl:value-of select="."/>
3961
4020
  </xsl:template><xsl:template match="node()" mode="contents">
3962
4021
  <xsl:apply-templates mode="contents"/>
@@ -4054,6 +4113,8 @@
4054
4113
 
4055
4114
 
4056
4115
 
4116
+
4117
+
4057
4118
  </fo:bookmark-tree>
4058
4119
  </xsl:if>
4059
4120
  </xsl:template><xsl:template name="insertFigureBookmarks">
@@ -4247,12 +4308,16 @@
4247
4308
  <xsl:if test="$font-size != ''">
4248
4309
  <xsl:attribute name="font-size">
4249
4310
  <xsl:choose>
4311
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4312
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4250
4313
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4251
4314
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4252
4315
  </xsl:choose>
4253
4316
  </xsl:attribute>
4254
4317
  </xsl:if>
4255
4318
 
4319
+
4320
+
4256
4321
  <xsl:apply-templates/>
4257
4322
  </fo:block>
4258
4323
 
@@ -4600,6 +4665,7 @@
4600
4665
  </xsl:choose>
4601
4666
  </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4602
4667
  <fo:block xsl:use-attribute-sets="termsource-style">
4668
+
4603
4669
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4604
4670
  <xsl:variable name="termsource_text">
4605
4671
  <xsl:apply-templates/>
@@ -4624,14 +4690,15 @@
4624
4690
  </xsl:if>
4625
4691
  </xsl:template><xsl:variable name="localized.source">
4626
4692
  <xsl:call-template name="getLocalizedString">
4627
- <xsl:with-param name="key">source</xsl:with-param>
4628
- </xsl:call-template>
4693
+ <xsl:with-param name="key">source</xsl:with-param>
4694
+ </xsl:call-template>
4629
4695
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4630
4696
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4631
4697
  <xsl:if test="normalize-space(@citeas) = ''">
4632
4698
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4633
4699
  </xsl:if>
4634
4700
 
4701
+
4635
4702
  <fo:inline>
4636
4703
 
4637
4704
 
@@ -4639,6 +4706,7 @@
4639
4706
 
4640
4707
 
4641
4708
 
4709
+
4642
4710
  <xsl:call-template name="getTitle">
4643
4711
  <xsl:with-param name="name" select="'title-source'"/>
4644
4712
  </xsl:call-template>
@@ -4650,6 +4718,7 @@
4650
4718
  <fo:inline xsl:use-attribute-sets="origin-style">
4651
4719
  <xsl:apply-templates/>
4652
4720
  </fo:inline>
4721
+
4653
4722
  </fo:basic-link>
4654
4723
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4655
4724
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4716,6 +4785,9 @@
4716
4785
 
4717
4786
  </xsl:if>
4718
4787
 
4788
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
4789
+ <xsl:variable name="text" select="normalize-space()"/>
4790
+
4719
4791
 
4720
4792
 
4721
4793
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4731,7 +4803,9 @@
4731
4803
 
4732
4804
 
4733
4805
  </xsl:if>
4734
-
4806
+
4807
+
4808
+
4735
4809
  <xsl:apply-templates/>
4736
4810
  </fo:basic-link>
4737
4811
 
@@ -5059,6 +5133,7 @@
5059
5133
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5060
5134
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5061
5135
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5136
+
5062
5137
  <xsl:apply-templates/>
5063
5138
  </fo:block>
5064
5139
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5227,9 +5302,97 @@
5227
5302
  <fo:block-container border="1pt solid black" width="50%">
5228
5303
  <fo:block> </fo:block>
5229
5304
  </fo:block-container>
5305
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5306
+ <xsl:param name="colwidths"/>
5307
+ <xsl:variable name="colwidths_">
5308
+ <xsl:choose>
5309
+ <xsl:when test="not($colwidths)">
5310
+ <xsl:variable name="toc_table_simple">
5311
+ <tbody>
5312
+ <xsl:apply-templates mode="toc_table_width"/>
5313
+ </tbody>
5314
+ </xsl:variable>
5315
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5316
+ <xsl:call-template name="calculate-column-widths">
5317
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5318
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5319
+ </xsl:call-template>
5320
+ </xsl:when>
5321
+ <xsl:otherwise>
5322
+ <xsl:copy-of select="$colwidths"/>
5323
+ </xsl:otherwise>
5324
+ </xsl:choose>
5325
+ </xsl:variable>
5326
+ <fo:block role="TOCI" space-after="16pt">
5327
+ <fo:table width="100%" table-layout="fixed">
5328
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5329
+ <fo:table-column column-width="proportional-column-width({.})"/>
5330
+ </xsl:for-each>
5331
+ <fo:table-body>
5332
+ <xsl:apply-templates/>
5333
+ </fo:table-body>
5334
+ </fo:table>
5335
+ </fo:block>
5336
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5337
+ <fo:table-row min-height="5mm">
5338
+ <xsl:apply-templates/>
5339
+ </fo:table-row>
5340
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5341
+ <xsl:apply-templates/>
5342
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5343
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5344
+ <xsl:variable name="target" select="@target"/>
5345
+ <xsl:for-each select="*[local-name() = 'tab']">
5346
+ <xsl:variable name="current_id" select="generate-id()"/>
5347
+ <fo:table-cell>
5348
+ <fo:block>
5349
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5350
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5351
+ <xsl:choose>
5352
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5353
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5354
+ </xsl:choose>
5355
+ </xsl:for-each>
5356
+ </fo:basic-link>
5357
+ </fo:block>
5358
+ </fo:table-cell>
5359
+ </xsl:for-each>
5360
+ <!-- last column - for page numbers -->
5361
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5362
+ <fo:block>
5363
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5364
+ <fo:page-number-citation ref-id="{$target}"/>
5365
+ </fo:basic-link>
5366
+ </fo:block>
5367
+ </fo:table-cell>
5368
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5369
+ <xsl:apply-templates mode="toc_table_width"/>
5370
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
5371
+ <tr>
5372
+ <xsl:apply-templates mode="toc_table_width"/>
5373
+ </tr>
5374
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5375
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5376
+ <xsl:for-each select="*[local-name() = 'tab']">
5377
+ <xsl:variable name="current_id" select="generate-id()"/>
5378
+ <td>
5379
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5380
+ <xsl:copy-of select="."/>
5381
+ </xsl:for-each>
5382
+ </td>
5383
+ </xsl:for-each>
5384
+ <td>333</td> <!-- page number, just for fill -->
5230
5385
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5231
5386
  <fo:inline padding-right="5mm"> </fo:inline>
5232
5387
  <fo:inline><xsl:apply-templates/></fo:inline>
5388
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5389
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5390
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5391
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5392
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5393
+ </svg>
5394
+ </fo:instream-foreign-object>
5395
+ </fo:inline>
5233
5396
  </xsl:template><xsl:template name="convertDate">
5234
5397
  <xsl:param name="date"/>
5235
5398
  <xsl:param name="format" select="'short'"/>