metanorma-bipm 1.1.9 → 1.1.10

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: df8f742d2d6c42afa7521168765ce2ab2be0bc9d3a4a942fb184bae97aefeb75
4
- data.tar.gz: fbb7b975f0f7b114fb3228ea824f9dd689f76dfb22310f2d450ad82c1bd7da53
3
+ metadata.gz: 86fa29bca65419443c3812628acd23d6125472ee5e1a3ea536a6d6c4758a3a73
4
+ data.tar.gz: 06e241b9292e724447fb4a75e558d7e1a62a47c22f0a65dd026d4afd81b3d150
5
5
  SHA512:
6
- metadata.gz: 886074989dcf59abbfb155eec67d66e44439bd556600666f8385e86c58222c7884d2418bf0c9b87e19f982c9473bc86de9943f388d8820dbab84ebac3db8b93b
7
- data.tar.gz: 322113649ffa804792b6872e6e99004d27d2c128c12cfb4f71cd1c72a7e71dc2c7ce96b8ffb9e036f045f8475e833657770d74496ad96027862d234861ad534e
6
+ metadata.gz: a7623eaca4e9872c151d36ec2538c4ace868d846dd32cc7a5ef3cdb8005e0469059f23bda5caa1b8ba71f9b8effbc8b8053a46e0f7879cd4941f1b9e38d92af7
7
+ data.tar.gz: ce0f7e7fc21bc1aba3d780658cdf00f11e61d3db5cfb35f8fc73de3f7b30dba68d6117aeb7f37cecdbefafa7241b27a240d80af58b1ddc96161e69a0a4280eb5
@@ -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">
@@ -74,12 +74,23 @@ module IsoDoc
74
74
  def termref_cleanup(docxml)
75
75
  docxml
76
76
  .gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
77
- l10n(", #{@i18n.modified} [/TERMREF]"))
77
+ l10n(", #{@i18n.modified} [/TERMREF]"))
78
78
  .gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
79
79
  .gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source} "))
80
80
  .gsub(%r{\s*\[/TERMREF\]\s*}, l10n("]"))
81
81
  .gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} &mdash; "))
82
82
  end
83
+
84
+ def error_parse(node, out)
85
+ case node.name
86
+ when "blacksquare" then blacksquare_parse(node, out)
87
+ else super
88
+ end
89
+ end
90
+
91
+ def blacksquare_parse(_node, out)
92
+ out << "&#x25a0;"
93
+ end
83
94
  end
84
95
  end
85
96
  end
@@ -200,7 +200,9 @@
200
200
  <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
201
201
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
202
202
  <xsl:apply-templates select="/*/bipm:annex" mode="contents"/>
203
- <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
203
+ <xsl:if test="/*/bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
204
+ <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
205
+ </xsl:if>
204
206
 
205
207
  <!-- Index -->
206
208
  <!-- <xsl:apply-templates select="//bipm:clause[@type = 'index']" mode="contents"/> -->
@@ -345,6 +347,7 @@
345
347
  <xsl:call-template name="addPDFUAmeta"/>
346
348
 
347
349
  <xsl:if test="$add_math_as_attachment = 'true'">
350
+ <!-- DEBUG: mathml_attachments=<xsl:copy-of select="$mathml_attachments"/> -->
348
351
  <xsl:for-each select="xalan:nodeset($mathml_attachments)//attachment">
349
352
 
350
353
  <xsl:variable name="mathml_filename" select="@filename"/>
@@ -527,6 +530,10 @@
527
530
  <xsl:apply-templates select="@*|node()" mode="flatxml"/>
528
531
  </xsl:copy>
529
532
  </xsl:template>
533
+
534
+ <xsl:template match="mathml:math" mode="flatxml" priority="2">
535
+ <xsl:copy-of select="."/>
536
+ </xsl:template>
530
537
 
531
538
  <!-- enclosing starting elements annex/... in clause -->
532
539
  <xsl:template match="bipm:annex" mode="flatxml">
@@ -792,6 +799,10 @@
792
799
  </xsl:copy>
793
800
  </xsl:template>
794
801
 
802
+ <xsl:template match="mathml:math" mode="flatxml_list" priority="2">
803
+ <xsl:copy-of select="."/>
804
+ </xsl:template>
805
+
795
806
  <!-- copy 'ol' 'ul' properties to each 'li' -->
796
807
  <!-- OBSOLETE: move note for list (list level note) into latest 'li' -->
797
808
  <!-- NOW: move note for list (list level note) into first 'li' -->
@@ -1283,7 +1294,9 @@
1283
1294
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
1284
1295
 
1285
1296
  <!-- Bibliography -->
1286
- <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1297
+ <xsl:if test="bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
1298
+ <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1299
+ </xsl:if>
1287
1300
 
1288
1301
  <!-- Document Control -->
1289
1302
  <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
@@ -1449,8 +1462,9 @@
1449
1462
 
1450
1463
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
1451
1464
 
1452
-
1453
- <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1465
+ <xsl:if test="bipm:bibliography/bipm:references[not(@normative='true')]/bipm:bibitem[not(contains(bipm:docidentifier, 'si-brochure-'))]">
1466
+ <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1467
+ </xsl:if>
1454
1468
 
1455
1469
  <!-- Document Control -->
1456
1470
  <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
@@ -2360,8 +2374,10 @@
2360
2374
  <!-- <xsl:when test="$level = 1 and $independentAppendix != ''">11.5pt</xsl:when>
2361
2375
  <xsl:when test="$level &gt;= 2 and $independentAppendix != ''">10.5pt</xsl:when> -->
2362
2376
  <xsl:when test="$level = 1">16pt</xsl:when>
2377
+ <xsl:when test="$level = 2 and ancestor::bipm:annex and ../@type = 'toc'">16pt</xsl:when>
2363
2378
  <xsl:when test="$level = 2 and ancestor::bipm:annex">10.5pt</xsl:when>
2364
2379
  <xsl:when test="$level = 2">14pt</xsl:when>
2380
+ <xsl:when test="$level &gt;= 3 and ancestor::bipm:annex and ../@type = 'toc'">9pt</xsl:when>
2365
2381
  <xsl:when test="$level = 3 and ancestor::bipm:annex">10pt</xsl:when>
2366
2382
  <xsl:when test="$level &gt;= 4 and ancestor::bipm:annex">9pt</xsl:when>
2367
2383
  <xsl:when test="$level = 3">12pt</xsl:when>
@@ -2385,6 +2401,7 @@
2385
2401
  <xsl:choose>
2386
2402
  <xsl:when test="$level = 1 and (parent::bipm:annex or ancestor::bipm:annex or parent::bipm:abstract or ancestor::bipm:preface)">84pt</xsl:when>
2387
2403
  <xsl:when test="$level = 1">6pt</xsl:when>
2404
+ <xsl:when test="$level = 2 and ancestor::bipm:annex and ../@type = 'toc'">29mm</xsl:when>
2388
2405
  <xsl:when test="$level = 2 and ancestor::bipm:annex">6pt</xsl:when> <!-- 6pt 12pt -->
2389
2406
  <!-- <xsl:when test="$level = 2 and $independentAppendix != ''">6pt</xsl:when> -->
2390
2407
  <xsl:when test="$level = 2">10pt</xsl:when>
@@ -2415,6 +2432,14 @@
2415
2432
  <xsl:attribute name="space-before">20pt</xsl:attribute>
2416
2433
  </xsl:if>
2417
2434
 
2435
+ <xsl:if test="$level &gt;= 3 and ancestor::bipm:annex and ../@type = 'toc'">
2436
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
2437
+ </xsl:if>
2438
+
2439
+ <xsl:if test="@type = 'quoted'">
2440
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2441
+ </xsl:if>
2442
+
2418
2443
  <fo:block-container margin-left="0mm">
2419
2444
 
2420
2445
  <!-- marker not working for math -->
@@ -2463,18 +2488,15 @@
2463
2488
  <xsl:if test="$level &gt;= 3">
2464
2489
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2465
2490
  </xsl:if>
2466
- <xsl:if test="$level = 3">
2467
- <fo:inline padding-right="2.5mm" baseline-shift="15%">
2468
- <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
2469
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
2470
- <rect x="0" y="0" width="2" height="2" fill="black"/>
2471
- </svg>
2472
- </fo:instream-foreign-object>
2473
- </fo:inline>
2491
+ <xsl:if test="$level = 3 and not(../@type = 'toc')">
2492
+ <!-- <xsl:call-template name="blacksquare"/> -->
2474
2493
  </xsl:if>
2475
2494
  <xsl:if test="$level = 4">
2476
2495
  <xsl:attribute name="text-align">center</xsl:attribute>
2477
2496
  </xsl:if>
2497
+ <xsl:if test="../@type = 'toc'">
2498
+ <xsl:attribute name="text-align">left</xsl:attribute>
2499
+ </xsl:if>
2478
2500
  <xsl:call-template name="extractTitle"/>
2479
2501
  <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2480
2502
  </xsl:when>
@@ -2505,6 +2527,7 @@
2505
2527
 
2506
2528
  </xsl:template>
2507
2529
 
2530
+
2508
2531
  <xsl:template match="*" mode="header">
2509
2532
  <xsl:apply-templates mode="header"/>
2510
2533
  </xsl:template>
@@ -3736,6 +3759,7 @@
3736
3759
  <xsl:variable name="mathml_content">
3737
3760
  <xsl:apply-templates select="." mode="mathml_actual_text"/>
3738
3761
  </xsl:variable>
3762
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
3739
3763
 
3740
3764
  <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3741
3765
  <xsl:variable name="comment_text_">
@@ -3748,27 +3772,26 @@
3748
3772
  </xsl:otherwise>
3749
3773
  </xsl:choose>
3750
3774
  </xsl:variable>
3751
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3775
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3776
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
3752
3777
 
3778
+ <xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
3753
3779
  <xsl:choose>
3754
- <xsl:when test="$add_math_as_attachment = 'true'">
3755
-
3756
- <xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
3757
- <xsl:if test="$filename != ''">
3758
- <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
3759
- <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
3760
- <xsl:if test="normalize-space($comment_text) != ''">
3761
- <!-- put Mathin Alternate Text -->
3762
- <xsl:attribute name="fox:alt-text">
3763
- <xsl:value-of select="$comment_text"/>
3764
- </xsl:attribute>
3765
- </xsl:if>
3766
- <xsl:call-template name="mathml_instream_object">
3767
- <xsl:with-param name="mathml_content" select="$mathml_content"/>
3768
- <xsl:with-param name="comment_text" select="$comment_text"/>
3769
- </xsl:call-template>
3770
- </fo:basic-link>
3771
- </xsl:if>
3780
+ <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
3781
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
3782
+ <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
3783
+ <xsl:if test="normalize-space($comment_text) != ''">
3784
+ <!-- put Mathin Alternate Text -->
3785
+ <xsl:attribute name="fox:alt-text">
3786
+ <xsl:value-of select="$comment_text"/>
3787
+ </xsl:attribute>
3788
+ </xsl:if>
3789
+ <xsl:call-template name="mathml_instream_object">
3790
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3791
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3792
+ </xsl:call-template>
3793
+ </fo:basic-link>
3794
+ <!-- </xsl:if> -->
3772
3795
  </xsl:when>
3773
3796
  <xsl:otherwise>
3774
3797
  <xsl:call-template name="mathml_instream_object">
@@ -3816,6 +3839,71 @@
3816
3839
  </fo:instream-foreign-object>
3817
3840
  </xsl:template>
3818
3841
 
3842
+
3843
+ <!-- =================== -->
3844
+ <!-- Table of Contents (ToC) processing -->
3845
+ <!-- =================== -->
3846
+ <xsl:template match="bipm:clause[@type = 'toc']" priority="3">
3847
+ <fo:block role="TOC">
3848
+ <xsl:copy-of select="@id"/>
3849
+ <xsl:apply-templates select="bipm:title[1]"/>
3850
+
3851
+ <!-- create virtual table to determine column's width -->
3852
+ <xsl:variable name="toc_table_simple">
3853
+ <tbody>
3854
+ <xsl:apply-templates mode="toc_table_width"/>
3855
+ </tbody>
3856
+ </xsl:variable>
3857
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
3858
+ <xsl:variable name="colwidths">
3859
+ <xsl:call-template name="calculate-column-widths">
3860
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3861
+ <xsl:with-param name="table" select="$toc_table_simple"/>
3862
+ </xsl:call-template>
3863
+ </xsl:variable>
3864
+
3865
+ <fo:table width="100%" table-layout="fixed">
3866
+ <fo:table-column column-width="100%"/>
3867
+ <fo:table-header>
3868
+ <fo:table-row font-weight="bold">
3869
+ <fo:table-cell text-align="right" font-size="9pt" font-family="Arial">
3870
+ <fo:block>
3871
+ <xsl:variable name="page">
3872
+ <xsl:call-template name="getLocalizedString">
3873
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
3874
+ </xsl:call-template>
3875
+ </xsl:variable>
3876
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($page))"/>
3877
+ </fo:block>
3878
+ </fo:table-cell>
3879
+ </fo:table-row>
3880
+ </fo:table-header>
3881
+ <fo:table-body>
3882
+ <fo:table-row>
3883
+ <fo:table-cell>
3884
+ <fo:block>
3885
+ <xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
3886
+ <xsl:apply-templates select="*[not(generate-id() = $title_id)]">
3887
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3888
+ </xsl:apply-templates>
3889
+ </fo:block>
3890
+ </fo:table-cell>
3891
+ </fo:table-row>
3892
+ </fo:table-body>
3893
+ </fo:table>
3894
+ </fo:block>
3895
+ </xsl:template>
3896
+
3897
+
3898
+ <!-- ignore section number before tab -->
3899
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/text()[1][not(preceding-sibling::bipm:tab) and following-sibling::*[1][self::bipm:tab]]"/>
3900
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/bipm:tab" priority="2"/>
3901
+
3902
+ <!-- =================== -->
3903
+ <!-- End Table of Contents (ToC) processing -->
3904
+ <!-- =================== -->
3905
+
3906
+
3819
3907
  <xsl:template name="insertHeaderFooter">
3820
3908
  <xsl:param name="header-title"/>
3821
3909
  <xsl:param name="orientation"/>
@@ -4979,13 +5067,20 @@
4979
5067
 
4980
5068
  </xsl:attribute-set><xsl:attribute-set name="list-style">
4981
5069
 
4982
- </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">
5070
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
5071
+ <xsl:attribute name="line-height">135%</xsl:attribute>
5072
+ </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">
4983
5073
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4984
5074
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
4985
5075
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
4986
5076
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
4987
5077
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
4988
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5078
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
5079
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5080
+ <xsl:sort select="@displayorder" data-type="number"/>
5081
+ <xsl:apply-templates select="." mode="contents"/>
5082
+ </xsl:for-each>
5083
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
4989
5084
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
4990
5085
 
4991
5086
  <!-- Normative references -->
@@ -4998,13 +5093,33 @@
4998
5093
  <!-- Bibliography -->
4999
5094
  <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"/>
5000
5095
 
5001
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5096
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5097
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5098
+ <xsl:sort select="@displayorder" data-type="number"/>
5099
+ <xsl:apply-templates select="." mode="contents"/>
5100
+ </xsl:for-each>
5101
+
5102
+ <xsl:for-each select="/*/*[local-name()='annex']">
5103
+ <xsl:sort select="@displayorder" data-type="number"/>
5104
+ <xsl:apply-templates select="." mode="contents"/>
5105
+ </xsl:for-each>
5106
+
5107
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5108
+ <xsl:sort select="@displayorder" data-type="number"/>
5109
+ <xsl:apply-templates select="." mode="contents"/>
5110
+ </xsl:for-each>
5111
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
5002
5112
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
5003
5113
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
5004
5114
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
5005
5115
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
5006
5116
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
5007
- </xsl:template><xsl:template name="processMainSectionsDefault">
5117
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5118
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5119
+ <xsl:sort select="@displayorder" data-type="number"/>
5120
+ <xsl:apply-templates select="."/>
5121
+ </xsl:for-each>
5122
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
5008
5123
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
5009
5124
 
5010
5125
  <!-- Normative references -->
@@ -5016,6 +5131,22 @@
5016
5131
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
5017
5132
  <!-- Bibliography -->
5018
5133
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
5134
+ </xsl:template><xsl:template name="processMainSectionsDefault">
5135
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5136
+ <xsl:sort select="@displayorder" data-type="number"/>
5137
+ <xsl:apply-templates select="."/>
5138
+
5139
+ </xsl:for-each>
5140
+
5141
+ <xsl:for-each select="/*/*[local-name()='annex']">
5142
+ <xsl:sort select="@displayorder" data-type="number"/>
5143
+ <xsl:apply-templates select="."/>
5144
+ </xsl:for-each>
5145
+
5146
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5147
+ <xsl:sort select="@displayorder" data-type="number"/>
5148
+ <xsl:apply-templates select="."/>
5149
+ </xsl:for-each>
5019
5150
  </xsl:template><xsl:template match="text()">
5020
5151
  <xsl:value-of select="."/>
5021
5152
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -7690,6 +7821,13 @@
7690
7821
  </xsl:attribute>
7691
7822
  <xsl:apply-templates mode="svg_update"/>
7692
7823
  </xsl:copy>
7824
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7825
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7826
+ <xsl:for-each select="*[local-name() = 'svg']">
7827
+ <xsl:call-template name="image_svg">
7828
+ <xsl:with-param name="name" select="$name"/>
7829
+ </xsl:call-template>
7830
+ </xsl:for-each>
7693
7831
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7694
7832
  <xsl:variable name="svg_content" select="document(@src)"/>
7695
7833
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7794,7 +7932,7 @@
7794
7932
  </fo:basic-link>
7795
7933
  </fo:block>
7796
7934
  </fo:block-container>
7797
- </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">
7935
+ </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">
7798
7936
  <xsl:apply-templates mode="contents"/>
7799
7937
  <xsl:text> </xsl:text>
7800
7938
  </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">
@@ -8488,20 +8626,22 @@
8488
8626
  </xsl:if>
8489
8627
  </xsl:template><xsl:variable name="localized.source">
8490
8628
  <xsl:call-template name="getLocalizedString">
8491
- <xsl:with-param name="key">source</xsl:with-param>
8492
- </xsl:call-template>
8629
+ <xsl:with-param name="key">source</xsl:with-param>
8630
+ </xsl:call-template>
8493
8631
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
8494
8632
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8495
8633
  <xsl:if test="normalize-space(@citeas) = ''">
8496
8634
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8497
8635
  </xsl:if>
8498
8636
 
8637
+
8499
8638
  <fo:inline>
8500
8639
 
8501
8640
 
8502
8641
 
8503
8642
 
8504
8643
 
8644
+
8505
8645
  <xsl:value-of select="$localized.source"/>
8506
8646
  <xsl:text> </xsl:text>
8507
8647
 
@@ -8512,6 +8652,7 @@
8512
8652
  <fo:inline xsl:use-attribute-sets="origin-style">
8513
8653
  <xsl:apply-templates/>
8514
8654
  </fo:inline>
8655
+
8515
8656
  </fo:basic-link>
8516
8657
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
8517
8658
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -8578,6 +8719,9 @@
8578
8719
 
8579
8720
  </xsl:if>
8580
8721
 
8722
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8723
+ <xsl:variable name="text" select="normalize-space()"/>
8724
+
8581
8725
 
8582
8726
 
8583
8727
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -8599,7 +8743,9 @@
8599
8743
 
8600
8744
 
8601
8745
  </xsl:if>
8602
-
8746
+
8747
+
8748
+
8603
8749
  <xsl:apply-templates/>
8604
8750
  </fo:basic-link>
8605
8751
 
@@ -9134,9 +9280,97 @@
9134
9280
  <fo:block-container border="1pt solid black" width="50%">
9135
9281
  <fo:block> </fo:block>
9136
9282
  </fo:block-container>
9283
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
9284
+ <xsl:param name="colwidths"/>
9285
+ <xsl:variable name="colwidths_">
9286
+ <xsl:choose>
9287
+ <xsl:when test="not($colwidths)">
9288
+ <xsl:variable name="toc_table_simple">
9289
+ <tbody>
9290
+ <xsl:apply-templates mode="toc_table_width"/>
9291
+ </tbody>
9292
+ </xsl:variable>
9293
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
9294
+ <xsl:call-template name="calculate-column-widths">
9295
+ <xsl:with-param name="cols-count" select="$cols-count"/>
9296
+ <xsl:with-param name="table" select="$toc_table_simple"/>
9297
+ </xsl:call-template>
9298
+ </xsl:when>
9299
+ <xsl:otherwise>
9300
+ <xsl:copy-of select="$colwidths"/>
9301
+ </xsl:otherwise>
9302
+ </xsl:choose>
9303
+ </xsl:variable>
9304
+ <fo:block role="TOCI" space-after="16pt">
9305
+ <fo:table width="100%" table-layout="fixed">
9306
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
9307
+ <fo:table-column column-width="proportional-column-width({.})"/>
9308
+ </xsl:for-each>
9309
+ <fo:table-body>
9310
+ <xsl:apply-templates/>
9311
+ </fo:table-body>
9312
+ </fo:table>
9313
+ </fo:block>
9314
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
9315
+ <fo:table-row min-height="5mm">
9316
+ <xsl:apply-templates/>
9317
+ </fo:table-row>
9318
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
9319
+ <xsl:apply-templates/>
9320
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
9321
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9322
+ <xsl:variable name="target" select="@target"/>
9323
+ <xsl:for-each select="*[local-name() = 'tab']">
9324
+ <xsl:variable name="current_id" select="generate-id()"/>
9325
+ <fo:table-cell>
9326
+ <fo:block>
9327
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9328
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9329
+ <xsl:choose>
9330
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9331
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9332
+ </xsl:choose>
9333
+ </xsl:for-each>
9334
+ </fo:basic-link>
9335
+ </fo:block>
9336
+ </fo:table-cell>
9337
+ </xsl:for-each>
9338
+ <!-- last column - for page numbers -->
9339
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9340
+ <fo:block>
9341
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9342
+ <fo:page-number-citation ref-id="{$target}"/>
9343
+ </fo:basic-link>
9344
+ </fo:block>
9345
+ </fo:table-cell>
9346
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
9347
+ <xsl:apply-templates mode="toc_table_width"/>
9348
+ </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">
9349
+ <tr>
9350
+ <xsl:apply-templates mode="toc_table_width"/>
9351
+ </tr>
9352
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
9353
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9354
+ <xsl:for-each select="*[local-name() = 'tab']">
9355
+ <xsl:variable name="current_id" select="generate-id()"/>
9356
+ <td>
9357
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9358
+ <xsl:copy-of select="."/>
9359
+ </xsl:for-each>
9360
+ </td>
9361
+ </xsl:for-each>
9362
+ <td>333</td> <!-- page number, just for fill -->
9137
9363
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9138
9364
  <fo:inline padding-right="5mm"> </fo:inline>
9139
9365
  <fo:inline><xsl:apply-templates/></fo:inline>
9366
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
9367
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
9368
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
9369
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
9370
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
9371
+ </svg>
9372
+ </fo:instream-foreign-object>
9373
+ </fo:inline>
9140
9374
  </xsl:template><xsl:template name="convertDate">
9141
9375
  <xsl:param name="date"/>
9142
9376
  <xsl:param name="format" select="'short'"/>