metanorma-bipm 1.1.9 → 1.2.1

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>
@@ -3302,13 +3326,13 @@
3302
3326
 
3303
3327
  <xsl:template match="bipm:preferred">
3304
3328
  <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3305
- <xsl:if test="ancestor::bipm:term/bipm:name">
3329
+ <xsl:if test="ancestor::bipm:term[1]/bipm:name">
3306
3330
  <xsl:variable name="level">
3307
3331
  <xsl:call-template name="getLevelTermName"/>
3308
3332
  </xsl:variable>
3309
3333
  <fo:inline role="H{$level}">
3310
3334
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
3311
- <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3335
+ <xsl:apply-templates select="ancestor::bipm:term[1]/bipm:name" mode="presentation"/>
3312
3336
  </fo:inline>
3313
3337
  </xsl:if>
3314
3338
  <xsl:apply-templates/>
@@ -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">
6094
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
5954
6095
 
5955
-
5956
6096
 
5957
6097
 
5958
6098
 
5959
-
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>
@@ -6490,6 +6629,7 @@
6490
6629
  <fo:table-cell>
6491
6630
 
6492
6631
  <fo:block margin-top="6pt">
6632
+ <xsl:copy-of select="@id"/>
6493
6633
 
6494
6634
 
6495
6635
  <xsl:if test="normalize-space($key_iso) = 'true'">
@@ -6596,6 +6736,8 @@
6596
6736
  <xsl:if test="$font-size != ''">
6597
6737
  <xsl:attribute name="font-size">
6598
6738
  <xsl:choose>
6739
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6740
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6599
6741
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6600
6742
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6601
6743
  </xsl:choose>
@@ -7370,14 +7512,18 @@
7370
7512
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
7371
7513
  <fo:inline><xsl:apply-templates/></fo:inline>
7372
7514
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
7515
+ <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
7373
7516
  <fo:block id="{@id}">
7374
7517
  <xsl:apply-templates/>
7375
7518
  </fo:block>
7376
7519
  </xsl:template><xsl:template match="*[local-name() = 'term']">
7520
+ <!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
7377
7521
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
7378
7522
 
7379
7523
 
7380
-
7524
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
7525
+
7526
+ </xsl:if>
7381
7527
  <xsl:apply-templates/>
7382
7528
  </fo:block>
7383
7529
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
@@ -7443,6 +7589,7 @@
7443
7589
  <xsl:otherwise>
7444
7590
  <fo:block xsl:use-attribute-sets="image-style">
7445
7591
 
7592
+
7446
7593
  <xsl:variable name="src">
7447
7594
  <xsl:call-template name="image_src"/>
7448
7595
  </xsl:variable>
@@ -7690,6 +7837,13 @@
7690
7837
  </xsl:attribute>
7691
7838
  <xsl:apply-templates mode="svg_update"/>
7692
7839
  </xsl:copy>
7840
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
7841
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7842
+ <xsl:for-each select="*[local-name() = 'svg']">
7843
+ <xsl:call-template name="image_svg">
7844
+ <xsl:with-param name="name" select="$name"/>
7845
+ </xsl:call-template>
7846
+ </xsl:for-each>
7693
7847
  </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
7848
  <xsl:variable name="svg_content" select="document(@src)"/>
7695
7849
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7794,7 +7948,7 @@
7794
7948
  </fo:basic-link>
7795
7949
  </fo:block>
7796
7950
  </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">
7951
+ </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
7952
  <xsl:apply-templates mode="contents"/>
7799
7953
  <xsl:text> </xsl:text>
7800
7954
  </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 +7956,7 @@
7802
7956
  <xsl:text> </xsl:text>
7803
7957
  </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
7958
  <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">
7959
+ </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
7960
  <xsl:value-of select="."/>
7807
7961
  </xsl:template><xsl:template match="node()" mode="contents">
7808
7962
  <xsl:apply-templates mode="contents"/>
@@ -7900,6 +8054,8 @@
7900
8054
 
7901
8055
 
7902
8056
 
8057
+
8058
+
7903
8059
  </fo:bookmark-tree>
7904
8060
  </xsl:if>
7905
8061
  </xsl:template><xsl:template name="insertFigureBookmarks">
@@ -8107,12 +8263,16 @@
8107
8263
  <xsl:if test="$font-size != ''">
8108
8264
  <xsl:attribute name="font-size">
8109
8265
  <xsl:choose>
8266
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
8267
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
8110
8268
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
8111
8269
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
8112
8270
  </xsl:choose>
8113
8271
  </xsl:attribute>
8114
8272
  </xsl:if>
8115
8273
 
8274
+
8275
+
8116
8276
  <xsl:apply-templates/>
8117
8277
  </fo:block>
8118
8278
 
@@ -8355,7 +8515,8 @@
8355
8515
  </fo:block>
8356
8516
  </fo:table-cell>
8357
8517
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
8358
- <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
8518
+ <fo:block font-size="11pt">
8519
+
8359
8520
  <xsl:apply-templates/>
8360
8521
  </fo:block>
8361
8522
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -8460,6 +8621,7 @@
8460
8621
  </xsl:choose>
8461
8622
  </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
8462
8623
  <fo:block xsl:use-attribute-sets="termsource-style">
8624
+
8463
8625
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8464
8626
  <xsl:variable name="termsource_text">
8465
8627
  <xsl:apply-templates/>
@@ -8470,13 +8632,15 @@
8470
8632
  <!-- <xsl:apply-templates /> -->
8471
8633
  <xsl:copy-of select="$termsource_text"/>
8472
8634
  </xsl:when>
8473
- <xsl:otherwise>
8635
+ <xsl:otherwise>
8636
+
8474
8637
 
8475
8638
  <xsl:text>[</xsl:text>
8476
8639
 
8477
8640
  <!-- <xsl:apply-templates /> -->
8478
8641
  <xsl:copy-of select="$termsource_text"/>
8479
8642
 
8643
+
8480
8644
  <xsl:text>]</xsl:text>
8481
8645
 
8482
8646
  </xsl:otherwise>
@@ -8488,20 +8652,22 @@
8488
8652
  </xsl:if>
8489
8653
  </xsl:template><xsl:variable name="localized.source">
8490
8654
  <xsl:call-template name="getLocalizedString">
8491
- <xsl:with-param name="key">source</xsl:with-param>
8492
- </xsl:call-template>
8655
+ <xsl:with-param name="key">source</xsl:with-param>
8656
+ </xsl:call-template>
8493
8657
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
8494
8658
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8495
8659
  <xsl:if test="normalize-space(@citeas) = ''">
8496
8660
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8497
8661
  </xsl:if>
8498
8662
 
8663
+
8499
8664
  <fo:inline>
8500
8665
 
8501
8666
 
8502
8667
 
8503
8668
 
8504
8669
 
8670
+
8505
8671
  <xsl:value-of select="$localized.source"/>
8506
8672
  <xsl:text> </xsl:text>
8507
8673
 
@@ -8512,6 +8678,7 @@
8512
8678
  <fo:inline xsl:use-attribute-sets="origin-style">
8513
8679
  <xsl:apply-templates/>
8514
8680
  </fo:inline>
8681
+
8515
8682
  </fo:basic-link>
8516
8683
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
8517
8684
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -8555,12 +8722,20 @@
8555
8722
  </xsl:template><xsl:template match="*[local-name() = 'author']">
8556
8723
  <xsl:text>— </xsl:text>
8557
8724
  <xsl:apply-templates/>
8558
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
8725
+ </xsl:template><xsl:variable name="bibitem_hidden_">
8726
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
8727
+ <xsl:copy-of select="."/>
8728
+ </xsl:for-each>
8729
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
8730
+ <xsl:copy-of select="."/>
8731
+ </xsl:for-each>
8732
+ </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
8559
8733
 
8560
8734
  <xsl:variable name="bibitemid">
8561
8735
  <xsl:choose>
8562
- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
8563
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
8736
+ <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
8737
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
8738
+ <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
8564
8739
  <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
8565
8740
  </xsl:choose>
8566
8741
  </xsl:variable>
@@ -8578,6 +8753,9 @@
8578
8753
 
8579
8754
  </xsl:if>
8580
8755
 
8756
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8757
+ <xsl:variable name="text" select="normalize-space()"/>
8758
+
8581
8759
 
8582
8760
 
8583
8761
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -8599,7 +8777,9 @@
8599
8777
 
8600
8778
 
8601
8779
  </xsl:if>
8602
-
8780
+
8781
+
8782
+
8603
8783
  <xsl:apply-templates/>
8604
8784
  </fo:basic-link>
8605
8785
 
@@ -8653,10 +8833,10 @@
8653
8833
  </xsl:choose>
8654
8834
  </xsl:variable>
8655
8835
 
8656
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
8836
+ <!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
8657
8837
 
8658
8838
  <xsl:choose>
8659
- <xsl:when test="$language = 'zh'">
8839
+ <xsl:when test="$lang = 'zh'">
8660
8840
  <fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
8661
8841
  </xsl:when>
8662
8842
  <xsl:when test="../../@inline-header = 'true'">
@@ -9134,9 +9314,97 @@
9134
9314
  <fo:block-container border="1pt solid black" width="50%">
9135
9315
  <fo:block> </fo:block>
9136
9316
  </fo:block-container>
9317
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
9318
+ <xsl:param name="colwidths"/>
9319
+ <xsl:variable name="colwidths_">
9320
+ <xsl:choose>
9321
+ <xsl:when test="not($colwidths)">
9322
+ <xsl:variable name="toc_table_simple">
9323
+ <tbody>
9324
+ <xsl:apply-templates mode="toc_table_width"/>
9325
+ </tbody>
9326
+ </xsl:variable>
9327
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
9328
+ <xsl:call-template name="calculate-column-widths">
9329
+ <xsl:with-param name="cols-count" select="$cols-count"/>
9330
+ <xsl:with-param name="table" select="$toc_table_simple"/>
9331
+ </xsl:call-template>
9332
+ </xsl:when>
9333
+ <xsl:otherwise>
9334
+ <xsl:copy-of select="$colwidths"/>
9335
+ </xsl:otherwise>
9336
+ </xsl:choose>
9337
+ </xsl:variable>
9338
+ <fo:block role="TOCI" space-after="16pt">
9339
+ <fo:table width="100%" table-layout="fixed">
9340
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
9341
+ <fo:table-column column-width="proportional-column-width({.})"/>
9342
+ </xsl:for-each>
9343
+ <fo:table-body>
9344
+ <xsl:apply-templates/>
9345
+ </fo:table-body>
9346
+ </fo:table>
9347
+ </fo:block>
9348
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
9349
+ <fo:table-row min-height="5mm">
9350
+ <xsl:apply-templates/>
9351
+ </fo:table-row>
9352
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
9353
+ <xsl:apply-templates/>
9354
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
9355
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9356
+ <xsl:variable name="target" select="@target"/>
9357
+ <xsl:for-each select="*[local-name() = 'tab']">
9358
+ <xsl:variable name="current_id" select="generate-id()"/>
9359
+ <fo:table-cell>
9360
+ <fo:block>
9361
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9362
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9363
+ <xsl:choose>
9364
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9365
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9366
+ </xsl:choose>
9367
+ </xsl:for-each>
9368
+ </fo:basic-link>
9369
+ </fo:block>
9370
+ </fo:table-cell>
9371
+ </xsl:for-each>
9372
+ <!-- last column - for page numbers -->
9373
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9374
+ <fo:block>
9375
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9376
+ <fo:page-number-citation ref-id="{$target}"/>
9377
+ </fo:basic-link>
9378
+ </fo:block>
9379
+ </fo:table-cell>
9380
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
9381
+ <xsl:apply-templates mode="toc_table_width"/>
9382
+ </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">
9383
+ <tr>
9384
+ <xsl:apply-templates mode="toc_table_width"/>
9385
+ </tr>
9386
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
9387
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
9388
+ <xsl:for-each select="*[local-name() = 'tab']">
9389
+ <xsl:variable name="current_id" select="generate-id()"/>
9390
+ <td>
9391
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9392
+ <xsl:copy-of select="."/>
9393
+ </xsl:for-each>
9394
+ </td>
9395
+ </xsl:for-each>
9396
+ <td>333</td> <!-- page number, just for fill -->
9137
9397
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9138
9398
  <fo:inline padding-right="5mm"> </fo:inline>
9139
9399
  <fo:inline><xsl:apply-templates/></fo:inline>
9400
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
9401
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
9402
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
9403
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
9404
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
9405
+ </svg>
9406
+ </fo:instream-foreign-object>
9407
+ </fo:inline>
9140
9408
  </xsl:template><xsl:template name="convertDate">
9141
9409
  <xsl:param name="date"/>
9142
9410
  <xsl:param name="format" select="'short'"/>