metanorma-mpfa 0.6.11 → 0.6.12

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: dfafc3185e7d9e6bddfdde8a22da506f2aec254829aecb6ae57fc6b162a89881
4
- data.tar.gz: 6e0554f7279cbb5458af4d69cadd9ad102b213cf927f603a7e553bd7d1e66d49
3
+ metadata.gz: 8ca5e6dc042e3076f4044c98201b501cc5f9f8bd8a5a801be95cb40558bdfb93
4
+ data.tar.gz: ac9cfc0897213b5d36a38550b4188d179c75d0128ddcc56b8d70eb6fea0d3615
5
5
  SHA512:
6
- metadata.gz: c913d6e10884e68983b282adfc52fe761db5b50a08bd0425b132de02390ae9ff7febac1c99a1bfb32d6a7d0ee2706cfeb7cd257d6d29022f3649f1f1a59805f0
7
- data.tar.gz: 7596c1de95381be729a9fcac5c9a0eacc75c1d63449e64fdaab39af771024fed0fbf45be8a2a8865a80e85f2401f6310fd57eb62b4c7a58615e36e56c0a7aafa
6
+ metadata.gz: 69d4540d1788c18e74782722bba30a6c5c653c015f758ebd835475a45cb533555a82f232a67600297ea045a6a3528357b1d343e94ea654dbab1876fdcabd31d0
7
+ data.tar.gz: 1d48d5c89b729aeb040815a65e2c3961f9a065ac13c94fed43d4f41df530b97ca6e96b2fbc7e81a44f97a1221d6da92ff681f18a9fb8955b1be4a73b449e26be
@@ -1036,6 +1036,7 @@
1036
1036
  <ref name="svgmap"/>
1037
1037
  <ref name="inputform"/>
1038
1038
  <ref name="toc"/>
1039
+ <ref name="passthrough"/>
1039
1040
  </choice>
1040
1041
  </define>
1041
1042
  <define name="toc">
@@ -1043,6 +1044,14 @@
1043
1044
  <ref name="ul"/>
1044
1045
  </element>
1045
1046
  </define>
1047
+ <define name="passthrough">
1048
+ <element name="passthrough">
1049
+ <optional>
1050
+ <attribute name="formats"/>
1051
+ </optional>
1052
+ <text/>
1053
+ </element>
1054
+ </define>
1046
1055
  <define name="inputform">
1047
1056
  <element name="form">
1048
1057
  <attribute name="id">
@@ -6,16 +6,14 @@ module Asciidoctor
6
6
  #
7
7
  class Converter < Standoc::Converter
8
8
 
9
- def sections_cleanup(x)
9
+ def sections_cleanup(xml)
10
10
  super
11
- x.xpath("//*[@inline-header]").each do |h|
11
+ xml.xpath("//*[@inline-header]").each do |h|
12
12
  h.delete("inline-header")
13
13
  end
14
- x.xpath("//*[@guidance]").each do |h|
15
- #c = h.at("./preceding-sibling::clause[last()]") || next
14
+ xml.xpath("//*[@guidance]").each do |h|
16
15
  c = h.xpath("./preceding-sibling::clause")
17
16
  c.empty? and next
18
- #c.add_child h.remove
19
17
  c.last.add_child h.remove
20
18
  end
21
19
  end
@@ -29,7 +27,7 @@ module Asciidoctor
29
27
  end
30
28
 
31
29
  def term_def_title(_toplevel, node)
32
- return node.title
30
+ node.title
33
31
  end
34
32
 
35
33
  def move_sections_into_preface(x, preface)
@@ -1307,13 +1307,20 @@
1307
1307
 
1308
1308
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1309
1309
 
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">
1310
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1311
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1312
+ </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
1313
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1312
1314
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1313
1315
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1314
1316
  <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
1317
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1316
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1318
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1319
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1320
+ <xsl:sort select="@displayorder" data-type="number"/>
1321
+ <xsl:apply-templates select="." mode="contents"/>
1322
+ </xsl:for-each>
1323
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1317
1324
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1318
1325
 
1319
1326
  <!-- Normative references -->
@@ -1326,13 +1333,33 @@
1326
1333
  <!-- Bibliography -->
1327
1334
  <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
1335
 
1329
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1336
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1337
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1338
+ <xsl:sort select="@displayorder" data-type="number"/>
1339
+ <xsl:apply-templates select="." mode="contents"/>
1340
+ </xsl:for-each>
1341
+
1342
+ <xsl:for-each select="/*/*[local-name()='annex']">
1343
+ <xsl:sort select="@displayorder" data-type="number"/>
1344
+ <xsl:apply-templates select="." mode="contents"/>
1345
+ </xsl:for-each>
1346
+
1347
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1348
+ <xsl:sort select="@displayorder" data-type="number"/>
1349
+ <xsl:apply-templates select="." mode="contents"/>
1350
+ </xsl:for-each>
1351
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1330
1352
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1331
1353
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1332
1354
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1333
1355
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1334
1356
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1335
- </xsl:template><xsl:template name="processMainSectionsDefault">
1357
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1358
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1359
+ <xsl:sort select="@displayorder" data-type="number"/>
1360
+ <xsl:apply-templates select="."/>
1361
+ </xsl:for-each>
1362
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1336
1363
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1337
1364
 
1338
1365
  <!-- Normative references -->
@@ -1344,6 +1371,22 @@
1344
1371
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1345
1372
  <!-- Bibliography -->
1346
1373
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1374
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1375
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1376
+ <xsl:sort select="@displayorder" data-type="number"/>
1377
+ <xsl:apply-templates select="."/>
1378
+
1379
+ </xsl:for-each>
1380
+
1381
+ <xsl:for-each select="/*/*[local-name()='annex']">
1382
+ <xsl:sort select="@displayorder" data-type="number"/>
1383
+ <xsl:apply-templates select="."/>
1384
+ </xsl:for-each>
1385
+
1386
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1387
+ <xsl:sort select="@displayorder" data-type="number"/>
1388
+ <xsl:apply-templates select="."/>
1389
+ </xsl:for-each>
1347
1390
  </xsl:template><xsl:template match="text()">
1348
1391
  <xsl:value-of select="."/>
1349
1392
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -3844,6 +3887,13 @@
3844
3887
  </xsl:attribute>
3845
3888
  <xsl:apply-templates mode="svg_update"/>
3846
3889
  </xsl:copy>
3890
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
3891
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3892
+ <xsl:for-each select="*[local-name() = 'svg']">
3893
+ <xsl:call-template name="image_svg">
3894
+ <xsl:with-param name="name" select="$name"/>
3895
+ </xsl:call-template>
3896
+ </xsl:for-each>
3847
3897
  </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
3898
  <xsl:variable name="svg_content" select="document(@src)"/>
3849
3899
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -3948,7 +3998,7 @@
3948
3998
  </fo:basic-link>
3949
3999
  </fo:block>
3950
4000
  </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">
4001
+ </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
4002
  <xsl:apply-templates mode="contents"/>
3953
4003
  <xsl:text> </xsl:text>
3954
4004
  </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">
@@ -4624,14 +4674,15 @@
4624
4674
  </xsl:if>
4625
4675
  </xsl:template><xsl:variable name="localized.source">
4626
4676
  <xsl:call-template name="getLocalizedString">
4627
- <xsl:with-param name="key">source</xsl:with-param>
4628
- </xsl:call-template>
4677
+ <xsl:with-param name="key">source</xsl:with-param>
4678
+ </xsl:call-template>
4629
4679
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4630
4680
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4631
4681
  <xsl:if test="normalize-space(@citeas) = ''">
4632
4682
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4633
4683
  </xsl:if>
4634
4684
 
4685
+
4635
4686
  <fo:inline>
4636
4687
 
4637
4688
 
@@ -4639,6 +4690,7 @@
4639
4690
 
4640
4691
 
4641
4692
 
4693
+
4642
4694
  <xsl:call-template name="getTitle">
4643
4695
  <xsl:with-param name="name" select="'title-source'"/>
4644
4696
  </xsl:call-template>
@@ -4650,6 +4702,7 @@
4650
4702
  <fo:inline xsl:use-attribute-sets="origin-style">
4651
4703
  <xsl:apply-templates/>
4652
4704
  </fo:inline>
4705
+
4653
4706
  </fo:basic-link>
4654
4707
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4655
4708
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4716,6 +4769,9 @@
4716
4769
 
4717
4770
  </xsl:if>
4718
4771
 
4772
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
4773
+ <xsl:variable name="text" select="normalize-space()"/>
4774
+
4719
4775
 
4720
4776
 
4721
4777
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4731,7 +4787,9 @@
4731
4787
 
4732
4788
 
4733
4789
  </xsl:if>
4734
-
4790
+
4791
+
4792
+
4735
4793
  <xsl:apply-templates/>
4736
4794
  </fo:basic-link>
4737
4795
 
@@ -5228,9 +5286,97 @@
5228
5286
  <fo:block-container border="1pt solid black" width="50%">
5229
5287
  <fo:block> </fo:block>
5230
5288
  </fo:block-container>
5289
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5290
+ <xsl:param name="colwidths"/>
5291
+ <xsl:variable name="colwidths_">
5292
+ <xsl:choose>
5293
+ <xsl:when test="not($colwidths)">
5294
+ <xsl:variable name="toc_table_simple">
5295
+ <tbody>
5296
+ <xsl:apply-templates mode="toc_table_width"/>
5297
+ </tbody>
5298
+ </xsl:variable>
5299
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5300
+ <xsl:call-template name="calculate-column-widths">
5301
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5302
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5303
+ </xsl:call-template>
5304
+ </xsl:when>
5305
+ <xsl:otherwise>
5306
+ <xsl:copy-of select="$colwidths"/>
5307
+ </xsl:otherwise>
5308
+ </xsl:choose>
5309
+ </xsl:variable>
5310
+ <fo:block role="TOCI" space-after="16pt">
5311
+ <fo:table width="100%" table-layout="fixed">
5312
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5313
+ <fo:table-column column-width="proportional-column-width({.})"/>
5314
+ </xsl:for-each>
5315
+ <fo:table-body>
5316
+ <xsl:apply-templates/>
5317
+ </fo:table-body>
5318
+ </fo:table>
5319
+ </fo:block>
5320
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5321
+ <fo:table-row min-height="5mm">
5322
+ <xsl:apply-templates/>
5323
+ </fo:table-row>
5324
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5325
+ <xsl:apply-templates/>
5326
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5327
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5328
+ <xsl:variable name="target" select="@target"/>
5329
+ <xsl:for-each select="*[local-name() = 'tab']">
5330
+ <xsl:variable name="current_id" select="generate-id()"/>
5331
+ <fo:table-cell>
5332
+ <fo:block>
5333
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5334
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5335
+ <xsl:choose>
5336
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5337
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5338
+ </xsl:choose>
5339
+ </xsl:for-each>
5340
+ </fo:basic-link>
5341
+ </fo:block>
5342
+ </fo:table-cell>
5343
+ </xsl:for-each>
5344
+ <!-- last column - for page numbers -->
5345
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5346
+ <fo:block>
5347
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5348
+ <fo:page-number-citation ref-id="{$target}"/>
5349
+ </fo:basic-link>
5350
+ </fo:block>
5351
+ </fo:table-cell>
5352
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5353
+ <xsl:apply-templates mode="toc_table_width"/>
5354
+ </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">
5355
+ <tr>
5356
+ <xsl:apply-templates mode="toc_table_width"/>
5357
+ </tr>
5358
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5359
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5360
+ <xsl:for-each select="*[local-name() = 'tab']">
5361
+ <xsl:variable name="current_id" select="generate-id()"/>
5362
+ <td>
5363
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5364
+ <xsl:copy-of select="."/>
5365
+ </xsl:for-each>
5366
+ </td>
5367
+ </xsl:for-each>
5368
+ <td>333</td> <!-- page number, just for fill -->
5231
5369
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5232
5370
  <fo:inline padding-right="5mm"> </fo:inline>
5233
5371
  <fo:inline><xsl:apply-templates/></fo:inline>
5372
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5373
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5374
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5375
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5376
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5377
+ </svg>
5378
+ </fo:instream-foreign-object>
5379
+ </fo:inline>
5234
5380
  </xsl:template><xsl:template name="convertDate">
5235
5381
  <xsl:param name="date"/>
5236
5382
  <xsl:param name="format" select="'short'"/>
@@ -1307,13 +1307,20 @@
1307
1307
 
1308
1308
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1309
1309
 
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">
1310
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1311
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1312
+ </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
1313
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1312
1314
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1313
1315
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1314
1316
  <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
1317
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1316
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1318
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1319
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1320
+ <xsl:sort select="@displayorder" data-type="number"/>
1321
+ <xsl:apply-templates select="." mode="contents"/>
1322
+ </xsl:for-each>
1323
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1317
1324
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1318
1325
 
1319
1326
  <!-- Normative references -->
@@ -1326,13 +1333,33 @@
1326
1333
  <!-- Bibliography -->
1327
1334
  <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
1335
 
1329
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1336
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1337
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1338
+ <xsl:sort select="@displayorder" data-type="number"/>
1339
+ <xsl:apply-templates select="." mode="contents"/>
1340
+ </xsl:for-each>
1341
+
1342
+ <xsl:for-each select="/*/*[local-name()='annex']">
1343
+ <xsl:sort select="@displayorder" data-type="number"/>
1344
+ <xsl:apply-templates select="." mode="contents"/>
1345
+ </xsl:for-each>
1346
+
1347
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1348
+ <xsl:sort select="@displayorder" data-type="number"/>
1349
+ <xsl:apply-templates select="." mode="contents"/>
1350
+ </xsl:for-each>
1351
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1330
1352
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1331
1353
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1332
1354
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1333
1355
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1334
1356
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1335
- </xsl:template><xsl:template name="processMainSectionsDefault">
1357
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1358
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1359
+ <xsl:sort select="@displayorder" data-type="number"/>
1360
+ <xsl:apply-templates select="."/>
1361
+ </xsl:for-each>
1362
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1336
1363
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1337
1364
 
1338
1365
  <!-- Normative references -->
@@ -1344,6 +1371,22 @@
1344
1371
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1345
1372
  <!-- Bibliography -->
1346
1373
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1374
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1375
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1376
+ <xsl:sort select="@displayorder" data-type="number"/>
1377
+ <xsl:apply-templates select="."/>
1378
+
1379
+ </xsl:for-each>
1380
+
1381
+ <xsl:for-each select="/*/*[local-name()='annex']">
1382
+ <xsl:sort select="@displayorder" data-type="number"/>
1383
+ <xsl:apply-templates select="."/>
1384
+ </xsl:for-each>
1385
+
1386
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1387
+ <xsl:sort select="@displayorder" data-type="number"/>
1388
+ <xsl:apply-templates select="."/>
1389
+ </xsl:for-each>
1347
1390
  </xsl:template><xsl:template match="text()">
1348
1391
  <xsl:value-of select="."/>
1349
1392
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -3844,6 +3887,13 @@
3844
3887
  </xsl:attribute>
3845
3888
  <xsl:apply-templates mode="svg_update"/>
3846
3889
  </xsl:copy>
3890
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
3891
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3892
+ <xsl:for-each select="*[local-name() = 'svg']">
3893
+ <xsl:call-template name="image_svg">
3894
+ <xsl:with-param name="name" select="$name"/>
3895
+ </xsl:call-template>
3896
+ </xsl:for-each>
3847
3897
  </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
3898
  <xsl:variable name="svg_content" select="document(@src)"/>
3849
3899
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -3948,7 +3998,7 @@
3948
3998
  </fo:basic-link>
3949
3999
  </fo:block>
3950
4000
  </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">
4001
+ </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
4002
  <xsl:apply-templates mode="contents"/>
3953
4003
  <xsl:text> </xsl:text>
3954
4004
  </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">
@@ -4624,14 +4674,15 @@
4624
4674
  </xsl:if>
4625
4675
  </xsl:template><xsl:variable name="localized.source">
4626
4676
  <xsl:call-template name="getLocalizedString">
4627
- <xsl:with-param name="key">source</xsl:with-param>
4628
- </xsl:call-template>
4677
+ <xsl:with-param name="key">source</xsl:with-param>
4678
+ </xsl:call-template>
4629
4679
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4630
4680
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4631
4681
  <xsl:if test="normalize-space(@citeas) = ''">
4632
4682
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4633
4683
  </xsl:if>
4634
4684
 
4685
+
4635
4686
  <fo:inline>
4636
4687
 
4637
4688
 
@@ -4639,6 +4690,7 @@
4639
4690
 
4640
4691
 
4641
4692
 
4693
+
4642
4694
  <xsl:call-template name="getTitle">
4643
4695
  <xsl:with-param name="name" select="'title-source'"/>
4644
4696
  </xsl:call-template>
@@ -4650,6 +4702,7 @@
4650
4702
  <fo:inline xsl:use-attribute-sets="origin-style">
4651
4703
  <xsl:apply-templates/>
4652
4704
  </fo:inline>
4705
+
4653
4706
  </fo:basic-link>
4654
4707
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4655
4708
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4716,6 +4769,9 @@
4716
4769
 
4717
4770
  </xsl:if>
4718
4771
 
4772
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
4773
+ <xsl:variable name="text" select="normalize-space()"/>
4774
+
4719
4775
 
4720
4776
 
4721
4777
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4731,7 +4787,9 @@
4731
4787
 
4732
4788
 
4733
4789
  </xsl:if>
4734
-
4790
+
4791
+
4792
+
4735
4793
  <xsl:apply-templates/>
4736
4794
  </fo:basic-link>
4737
4795
 
@@ -5228,9 +5286,97 @@
5228
5286
  <fo:block-container border="1pt solid black" width="50%">
5229
5287
  <fo:block> </fo:block>
5230
5288
  </fo:block-container>
5289
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5290
+ <xsl:param name="colwidths"/>
5291
+ <xsl:variable name="colwidths_">
5292
+ <xsl:choose>
5293
+ <xsl:when test="not($colwidths)">
5294
+ <xsl:variable name="toc_table_simple">
5295
+ <tbody>
5296
+ <xsl:apply-templates mode="toc_table_width"/>
5297
+ </tbody>
5298
+ </xsl:variable>
5299
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5300
+ <xsl:call-template name="calculate-column-widths">
5301
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5302
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5303
+ </xsl:call-template>
5304
+ </xsl:when>
5305
+ <xsl:otherwise>
5306
+ <xsl:copy-of select="$colwidths"/>
5307
+ </xsl:otherwise>
5308
+ </xsl:choose>
5309
+ </xsl:variable>
5310
+ <fo:block role="TOCI" space-after="16pt">
5311
+ <fo:table width="100%" table-layout="fixed">
5312
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5313
+ <fo:table-column column-width="proportional-column-width({.})"/>
5314
+ </xsl:for-each>
5315
+ <fo:table-body>
5316
+ <xsl:apply-templates/>
5317
+ </fo:table-body>
5318
+ </fo:table>
5319
+ </fo:block>
5320
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5321
+ <fo:table-row min-height="5mm">
5322
+ <xsl:apply-templates/>
5323
+ </fo:table-row>
5324
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5325
+ <xsl:apply-templates/>
5326
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5327
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5328
+ <xsl:variable name="target" select="@target"/>
5329
+ <xsl:for-each select="*[local-name() = 'tab']">
5330
+ <xsl:variable name="current_id" select="generate-id()"/>
5331
+ <fo:table-cell>
5332
+ <fo:block>
5333
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5334
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5335
+ <xsl:choose>
5336
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5337
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5338
+ </xsl:choose>
5339
+ </xsl:for-each>
5340
+ </fo:basic-link>
5341
+ </fo:block>
5342
+ </fo:table-cell>
5343
+ </xsl:for-each>
5344
+ <!-- last column - for page numbers -->
5345
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5346
+ <fo:block>
5347
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5348
+ <fo:page-number-citation ref-id="{$target}"/>
5349
+ </fo:basic-link>
5350
+ </fo:block>
5351
+ </fo:table-cell>
5352
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5353
+ <xsl:apply-templates mode="toc_table_width"/>
5354
+ </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">
5355
+ <tr>
5356
+ <xsl:apply-templates mode="toc_table_width"/>
5357
+ </tr>
5358
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5359
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5360
+ <xsl:for-each select="*[local-name() = 'tab']">
5361
+ <xsl:variable name="current_id" select="generate-id()"/>
5362
+ <td>
5363
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5364
+ <xsl:copy-of select="."/>
5365
+ </xsl:for-each>
5366
+ </td>
5367
+ </xsl:for-each>
5368
+ <td>333</td> <!-- page number, just for fill -->
5231
5369
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5232
5370
  <fo:inline padding-right="5mm"> </fo:inline>
5233
5371
  <fo:inline><xsl:apply-templates/></fo:inline>
5372
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5373
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5374
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5375
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5376
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5377
+ </svg>
5378
+ </fo:instream-foreign-object>
5379
+ </fo:inline>
5234
5380
  </xsl:template><xsl:template name="convertDate">
5235
5381
  <xsl:param name="date"/>
5236
5382
  <xsl:param name="format" select="'short'"/>