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.
@@ -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'"/>
@@ -6,7 +6,6 @@ require_relative "base_convert"
6
6
  module IsoDoc
7
7
  module BIPM
8
8
  class HtmlConvert < IsoDoc::Generic::HtmlConvert
9
-
10
9
  def middle(isoxml, out)
11
10
  super
12
11
  doccontrol isoxml, out
@@ -25,15 +24,16 @@ module IsoDoc
25
24
  def counter_reset(node)
26
25
  s = node["start"]
27
26
  return nil unless s && !s.empty? && !s.to_i.zero?
27
+
28
28
  "counter-reset: #{node['type']} #{s.to_i - 1};"
29
29
  end
30
30
 
31
31
  def ol_attrs(node)
32
32
  klass, style = if node["type"] == "roman" &&
33
- !node.at("./ancestor::xmlns:ol[@type = 'roman']") ||
33
+ !node.at("./ancestor::xmlns:ol[@type = 'roman']") ||
34
34
  node["type"] == "alphabet" &&
35
- !node.at("./ancestor::xmlns:ol[@type = 'alphabet']")
36
- [node["type"], counter_reset(node)]
35
+ !node.at("./ancestor::xmlns:ol[@type = 'alphabet']")
36
+ [node["type"], counter_reset(node)]
37
37
  end
38
38
  super.merge(attr_code(type: ol_style((node["type"] || "arabic").to_sym),
39
39
  start: node["start"]), style: style, class: klass)
@@ -44,4 +44,3 @@ module IsoDoc
44
44
  end
45
45
  end
46
46
  end
47
-