metanorma-bipm 1.1.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,19 +2488,17 @@
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>
2478
- <xsl:call-template name="extractTitle"/>
2497
+ <xsl:if test="../@type = 'toc'">
2498
+ <xsl:attribute name="text-align">left</xsl:attribute>
2499
+ </xsl:if>
2500
+ <!-- <xsl:call-template name="extractTitle"/> -->
2501
+ <xsl:apply-templates/>
2479
2502
  <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2480
2503
  </xsl:when>
2481
2504
  <xsl:otherwise>
@@ -2505,6 +2528,7 @@
2505
2528
 
2506
2529
  </xsl:template>
2507
2530
 
2531
+
2508
2532
  <xsl:template match="*" mode="header">
2509
2533
  <xsl:apply-templates mode="header"/>
2510
2534
  </xsl:template>
@@ -3736,6 +3760,7 @@
3736
3760
  <xsl:variable name="mathml_content">
3737
3761
  <xsl:apply-templates select="." mode="mathml_actual_text"/>
3738
3762
  </xsl:variable>
3763
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
3739
3764
 
3740
3765
  <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3741
3766
  <xsl:variable name="comment_text_">
@@ -3748,27 +3773,26 @@
3748
3773
  </xsl:otherwise>
3749
3774
  </xsl:choose>
3750
3775
  </xsl:variable>
3751
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3776
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3777
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
3752
3778
 
3779
+ <xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
3753
3780
  <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>
3781
+ <xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
3782
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
3783
+ <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
3784
+ <xsl:if test="normalize-space($comment_text) != ''">
3785
+ <!-- put Mathin Alternate Text -->
3786
+ <xsl:attribute name="fox:alt-text">
3787
+ <xsl:value-of select="$comment_text"/>
3788
+ </xsl:attribute>
3789
+ </xsl:if>
3790
+ <xsl:call-template name="mathml_instream_object">
3791
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3792
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3793
+ </xsl:call-template>
3794
+ </fo:basic-link>
3795
+ <!-- </xsl:if> -->
3772
3796
  </xsl:when>
3773
3797
  <xsl:otherwise>
3774
3798
  <xsl:call-template name="mathml_instream_object">
@@ -3816,6 +3840,71 @@
3816
3840
  </fo:instream-foreign-object>
3817
3841
  </xsl:template>
3818
3842
 
3843
+
3844
+ <!-- =================== -->
3845
+ <!-- Table of Contents (ToC) processing -->
3846
+ <!-- =================== -->
3847
+ <xsl:template match="bipm:clause[@type = 'toc']" priority="3">
3848
+ <fo:block role="TOC">
3849
+ <xsl:copy-of select="@id"/>
3850
+ <xsl:apply-templates select="bipm:title[1]"/>
3851
+
3852
+ <!-- create virtual table to determine column's width -->
3853
+ <xsl:variable name="toc_table_simple">
3854
+ <tbody>
3855
+ <xsl:apply-templates mode="toc_table_width"/>
3856
+ </tbody>
3857
+ </xsl:variable>
3858
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
3859
+ <xsl:variable name="colwidths">
3860
+ <xsl:call-template name="calculate-column-widths">
3861
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3862
+ <xsl:with-param name="table" select="$toc_table_simple"/>
3863
+ </xsl:call-template>
3864
+ </xsl:variable>
3865
+
3866
+ <fo:table width="100%" table-layout="fixed">
3867
+ <fo:table-column column-width="100%"/>
3868
+ <fo:table-header>
3869
+ <fo:table-row font-weight="bold">
3870
+ <fo:table-cell text-align="right" font-size="9pt" font-family="Arial">
3871
+ <fo:block>
3872
+ <xsl:variable name="page">
3873
+ <xsl:call-template name="getLocalizedString">
3874
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
3875
+ </xsl:call-template>
3876
+ </xsl:variable>
3877
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($page))"/>
3878
+ </fo:block>
3879
+ </fo:table-cell>
3880
+ </fo:table-row>
3881
+ </fo:table-header>
3882
+ <fo:table-body>
3883
+ <fo:table-row>
3884
+ <fo:table-cell>
3885
+ <fo:block>
3886
+ <xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
3887
+ <xsl:apply-templates select="*[not(generate-id() = $title_id)]">
3888
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3889
+ </xsl:apply-templates>
3890
+ </fo:block>
3891
+ </fo:table-cell>
3892
+ </fo:table-row>
3893
+ </fo:table-body>
3894
+ </fo:table>
3895
+ </fo:block>
3896
+ </xsl:template>
3897
+
3898
+
3899
+ <!-- ignore section number before tab -->
3900
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/text()[1][not(preceding-sibling::bipm:tab) and following-sibling::*[1][self::bipm:tab]]"/>
3901
+ <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/bipm:tab" priority="2"/>
3902
+
3903
+ <!-- =================== -->
3904
+ <!-- End Table of Contents (ToC) processing -->
3905
+ <!-- =================== -->
3906
+
3907
+
3819
3908
  <xsl:template name="insertHeaderFooter">
3820
3909
  <xsl:param name="header-title"/>
3821
3910
  <xsl:param name="orientation"/>
@@ -4559,6 +4648,8 @@
4559
4648
 
4560
4649
  <title-list-figures lang="en">List of Figures</title-list-figures>
4561
4650
 
4651
+ <title-table-figures lang="en">Table of Figures</title-table-figures>
4652
+
4562
4653
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
4563
4654
 
4564
4655
  <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
@@ -4826,6 +4917,13 @@
4826
4917
 
4827
4918
 
4828
4919
 
4920
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
4921
+
4922
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4923
+
4924
+
4925
+
4926
+
4829
4927
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
4830
4928
 
4831
4929
 
@@ -4979,13 +5077,20 @@
4979
5077
 
4980
5078
  </xsl:attribute-set><xsl:attribute-set name="list-style">
4981
5079
 
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">
5080
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
5081
+ <xsl:attribute name="line-height">135%</xsl:attribute>
5082
+ </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
5083
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4984
5084
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
4985
5085
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
4986
5086
  <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
5087
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
4988
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5088
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
5089
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5090
+ <xsl:sort select="@displayorder" data-type="number"/>
5091
+ <xsl:apply-templates select="." mode="contents"/>
5092
+ </xsl:for-each>
5093
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
4989
5094
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
4990
5095
 
4991
5096
  <!-- Normative references -->
@@ -4998,13 +5103,33 @@
4998
5103
  <!-- Bibliography -->
4999
5104
  <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
5105
 
5001
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5106
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
5107
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5108
+ <xsl:sort select="@displayorder" data-type="number"/>
5109
+ <xsl:apply-templates select="." mode="contents"/>
5110
+ </xsl:for-each>
5111
+
5112
+ <xsl:for-each select="/*/*[local-name()='annex']">
5113
+ <xsl:sort select="@displayorder" data-type="number"/>
5114
+ <xsl:apply-templates select="." mode="contents"/>
5115
+ </xsl:for-each>
5116
+
5117
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5118
+ <xsl:sort select="@displayorder" data-type="number"/>
5119
+ <xsl:apply-templates select="." mode="contents"/>
5120
+ </xsl:for-each>
5121
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
5002
5122
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
5003
5123
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
5004
5124
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
5005
5125
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
5006
5126
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
5007
- </xsl:template><xsl:template name="processMainSectionsDefault">
5127
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5128
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
5129
+ <xsl:sort select="@displayorder" data-type="number"/>
5130
+ <xsl:apply-templates select="."/>
5131
+ </xsl:for-each>
5132
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
5008
5133
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
5009
5134
 
5010
5135
  <!-- Normative references -->
@@ -5016,6 +5141,22 @@
5016
5141
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
5017
5142
  <!-- Bibliography -->
5018
5143
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
5144
+ </xsl:template><xsl:template name="processMainSectionsDefault">
5145
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5146
+ <xsl:sort select="@displayorder" data-type="number"/>
5147
+ <xsl:apply-templates select="."/>
5148
+
5149
+ </xsl:for-each>
5150
+
5151
+ <xsl:for-each select="/*/*[local-name()='annex']">
5152
+ <xsl:sort select="@displayorder" data-type="number"/>
5153
+ <xsl:apply-templates select="."/>
5154
+ </xsl:for-each>
5155
+
5156
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5157
+ <xsl:sort select="@displayorder" data-type="number"/>
5158
+ <xsl:apply-templates select="."/>
5159
+ </xsl:for-each>
5019
5160
  </xsl:template><xsl:template match="text()">
5020
5161
  <xsl:value-of select="."/>
5021
5162
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -5950,18 +6091,16 @@
5950
6091
 
5951
6092
  <!-- Table's note name (NOTE, for example) -->
5952
6093
 
5953
- <fo:inline padding-right="2mm">
5954
-
5955
-
6094
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
5956
6095
 
5957
6096
 
5958
6097
 
5959
6098
 
5960
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5961
6099
  <xsl:if test="ancestor::bipm:preface">
5962
6100
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
5963
6101
  </xsl:if>
5964
6102
 
6103
+
5965
6104
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5966
6105
 
5967
6106
  </fo:inline>
@@ -6596,6 +6735,8 @@
6596
6735
  <xsl:if test="$font-size != ''">
6597
6736
  <xsl:attribute name="font-size">
6598
6737
  <xsl:choose>
6738
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6739
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6599
6740
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6600
6741
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6601
6742
  </xsl:choose>
@@ -7443,6 +7584,7 @@
7443
7584
  <xsl:otherwise>
7444
7585
  <fo:block xsl:use-attribute-sets="image-style">
7445
7586
 
7587
+
7446
7588
  <xsl:variable name="src">
7447
7589
  <xsl:call-template name="image_src"/>
7448
7590
  </xsl:variable>
@@ -7690,6 +7832,13 @@
7690
7832
  </xsl:attribute>
7691
7833
  <xsl:apply-templates mode="svg_update"/>
7692
7834
  </xsl:copy>
7835
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7836
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7837
+ <xsl:for-each select="*[local-name() = 'svg']">
7838
+ <xsl:call-template name="image_svg">
7839
+ <xsl:with-param name="name" select="$name"/>
7840
+ </xsl:call-template>
7841
+ </xsl:for-each>
7693
7842
  </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
7843
  <xsl:variable name="svg_content" select="document(@src)"/>
7695
7844
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7794,7 +7943,7 @@
7794
7943
  </fo:basic-link>
7795
7944
  </fo:block>
7796
7945
  </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">
7946
+ </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
7947
  <xsl:apply-templates mode="contents"/>
7799
7948
  <xsl:text> </xsl:text>
7800
7949
  </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">
@@ -7802,7 +7951,7 @@
7802
7951
  <xsl:text> </xsl:text>
7803
7952
  </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">
7804
7953
  <xsl:value-of select="."/>
7805
- </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">
7954
+ </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">
7806
7955
  <xsl:value-of select="."/>
7807
7956
  </xsl:template><xsl:template match="node()" mode="contents">
7808
7957
  <xsl:apply-templates mode="contents"/>
@@ -7900,6 +8049,8 @@
7900
8049
 
7901
8050
 
7902
8051
 
8052
+
8053
+
7903
8054
  </fo:bookmark-tree>
7904
8055
  </xsl:if>
7905
8056
  </xsl:template><xsl:template name="insertFigureBookmarks">
@@ -8107,12 +8258,16 @@
8107
8258
  <xsl:if test="$font-size != ''">
8108
8259
  <xsl:attribute name="font-size">
8109
8260
  <xsl:choose>
8261
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
8262
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
8110
8263
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
8111
8264
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
8112
8265
  </xsl:choose>
8113
8266
  </xsl:attribute>
8114
8267
  </xsl:if>
8115
8268
 
8269
+
8270
+
8116
8271
  <xsl:apply-templates/>
8117
8272
  </fo:block>
8118
8273
 
@@ -8460,6 +8615,7 @@
8460
8615
  </xsl:choose>
8461
8616
  </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
8462
8617
  <fo:block xsl:use-attribute-sets="termsource-style">
8618
+
8463
8619
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8464
8620
  <xsl:variable name="termsource_text">
8465
8621
  <xsl:apply-templates/>
@@ -8488,20 +8644,22 @@
8488
8644
  </xsl:if>
8489
8645
  </xsl:template><xsl:variable name="localized.source">
8490
8646
  <xsl:call-template name="getLocalizedString">
8491
- <xsl:with-param name="key">source</xsl:with-param>
8492
- </xsl:call-template>
8647
+ <xsl:with-param name="key">source</xsl:with-param>
8648
+ </xsl:call-template>
8493
8649
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
8494
8650
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8495
8651
  <xsl:if test="normalize-space(@citeas) = ''">
8496
8652
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8497
8653
  </xsl:if>
8498
8654
 
8655
+
8499
8656
  <fo:inline>
8500
8657
 
8501
8658
 
8502
8659
 
8503
8660
 
8504
8661
 
8662
+
8505
8663
  <xsl:value-of select="$localized.source"/>
8506
8664
  <xsl:text> </xsl:text>
8507
8665
 
@@ -8512,6 +8670,7 @@
8512
8670
  <fo:inline xsl:use-attribute-sets="origin-style">
8513
8671
  <xsl:apply-templates/>
8514
8672
  </fo:inline>
8673
+
8515
8674
  </fo:basic-link>
8516
8675
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
8517
8676
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -8578,6 +8737,9 @@
8578
8737
 
8579
8738
  </xsl:if>
8580
8739
 
8740
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8741
+ <xsl:variable name="text" select="normalize-space()"/>
8742
+
8581
8743
 
8582
8744
 
8583
8745
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -8599,7 +8761,9 @@
8599
8761
 
8600
8762
 
8601
8763
  </xsl:if>
8602
-
8764
+
8765
+
8766
+
8603
8767
  <xsl:apply-templates/>
8604
8768
  </fo:basic-link>
8605
8769
 
@@ -8936,6 +9100,7 @@
8936
9100
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
8937
9101
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8938
9102
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
9103
+
8939
9104
  <xsl:apply-templates/>
8940
9105
  </fo:block>
8941
9106
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -9133,9 +9298,97 @@
9133
9298
  <fo:block-container border="1pt solid black" width="50%">
9134
9299
  <fo:block> </fo:block>
9135
9300
  </fo:block-container>
9301
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
9302
+ <xsl:param name="colwidths"/>
9303
+ <xsl:variable name="colwidths_">
9304
+ <xsl:choose>
9305
+ <xsl:when test="not($colwidths)">
9306
+ <xsl:variable name="toc_table_simple">
9307
+ <tbody>
9308
+ <xsl:apply-templates mode="toc_table_width"/>
9309
+ </tbody>
9310
+ </xsl:variable>
9311
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
9312
+ <xsl:call-template name="calculate-column-widths">
9313
+ <xsl:with-param name="cols-count" select="$cols-count"/>
9314
+ <xsl:with-param name="table" select="$toc_table_simple"/>
9315
+ </xsl:call-template>
9316
+ </xsl:when>
9317
+ <xsl:otherwise>
9318
+ <xsl:copy-of select="$colwidths"/>
9319
+ </xsl:otherwise>
9320
+ </xsl:choose>
9321
+ </xsl:variable>
9322
+ <fo:block role="TOCI" space-after="16pt">
9323
+ <fo:table width="100%" table-layout="fixed">
9324
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
9325
+ <fo:table-column column-width="proportional-column-width({.})"/>
9326
+ </xsl:for-each>
9327
+ <fo:table-body>
9328
+ <xsl:apply-templates/>
9329
+ </fo:table-body>
9330
+ </fo:table>
9331
+ </fo:block>
9332
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
9333
+ <fo:table-row min-height="5mm">
9334
+ <xsl:apply-templates/>
9335
+ </fo:table-row>
9336
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
9337
+ <xsl:apply-templates/>
9338
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
9339
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9340
+ <xsl:variable name="target" select="@target"/>
9341
+ <xsl:for-each select="*[local-name() = 'tab']">
9342
+ <xsl:variable name="current_id" select="generate-id()"/>
9343
+ <fo:table-cell>
9344
+ <fo:block>
9345
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9346
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9347
+ <xsl:choose>
9348
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9349
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9350
+ </xsl:choose>
9351
+ </xsl:for-each>
9352
+ </fo:basic-link>
9353
+ </fo:block>
9354
+ </fo:table-cell>
9355
+ </xsl:for-each>
9356
+ <!-- last column - for page numbers -->
9357
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9358
+ <fo:block>
9359
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9360
+ <fo:page-number-citation ref-id="{$target}"/>
9361
+ </fo:basic-link>
9362
+ </fo:block>
9363
+ </fo:table-cell>
9364
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
9365
+ <xsl:apply-templates mode="toc_table_width"/>
9366
+ </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">
9367
+ <tr>
9368
+ <xsl:apply-templates mode="toc_table_width"/>
9369
+ </tr>
9370
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
9371
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9372
+ <xsl:for-each select="*[local-name() = 'tab']">
9373
+ <xsl:variable name="current_id" select="generate-id()"/>
9374
+ <td>
9375
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9376
+ <xsl:copy-of select="."/>
9377
+ </xsl:for-each>
9378
+ </td>
9379
+ </xsl:for-each>
9380
+ <td>333</td> <!-- page number, just for fill -->
9136
9381
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9137
9382
  <fo:inline padding-right="5mm"> </fo:inline>
9138
9383
  <fo:inline><xsl:apply-templates/></fo:inline>
9384
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
9385
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
9386
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
9387
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
9388
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
9389
+ </svg>
9390
+ </fo:instream-foreign-object>
9391
+ </fo:inline>
9139
9392
  </xsl:template><xsl:template name="convertDate">
9140
9393
  <xsl:param name="date"/>
9141
9394
  <xsl:param name="format" select="'short'"/>