metanorma-bipm 2.1.8.1 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1065,16 +1065,18 @@
1065
1065
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1066
1066
  <xsl:call-template name="insertContentItem"/>
1067
1067
  </xsl:for-each>
1068
- <xsl:if test="$doctype ='brochure'">
1069
- <!-- insert page break between main sections and appendixes in ToC -->
1068
+ <!-- insert page break between main sections and appendixes in ToC -->
1069
+ <!-- <xsl:if test="$doctype ='brochure'">
1070
1070
  <fo:table-row>
1071
1071
  <fo:table-cell number-columns-spanned="2">
1072
1072
  <fo:block break-after="page"/>
1073
1073
  </fo:table-cell>
1074
1074
  </fo:table-row>
1075
- </xsl:if>
1075
+ </xsl:if> -->
1076
1076
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'annex')]"> <!-- or (@level = 2 and @parent = 'annex') -->
1077
- <xsl:call-template name="insertContentItem"/>
1077
+ <xsl:call-template name="insertContentItem">
1078
+ <xsl:with-param name="keep-with-next">true</xsl:with-param>
1079
+ </xsl:call-template>
1078
1080
  </xsl:for-each>
1079
1081
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'index')]">
1080
1082
  <xsl:call-template name="insertContentItem"/>
@@ -1191,10 +1193,10 @@
1191
1193
 
1192
1194
  </fo:block>
1193
1195
 
1194
- <xsl:variable name="part_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:part)"/>
1195
- <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']">
1196
+ <!-- <xsl:variable name="part_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:part)"/> -->
1197
+ <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part-with-numbering']">
1196
1198
  <fo:block role="H2">
1197
- <xsl:if test="$part_num != ''">
1199
+ <!-- <xsl:if test="$part_num != ''">
1198
1200
  <xsl:call-template name="getLocalizedString">
1199
1201
  <xsl:with-param name="key">Part.sg</xsl:with-param>
1200
1202
  <xsl:with-param name="lang" select="$curr_lang"/>
@@ -1202,18 +1204,18 @@
1202
1204
  <xsl:text> </xsl:text>
1203
1205
  <xsl:value-of select="$part_num"/>
1204
1206
  </xsl:if>
1205
- <xsl:text>: </xsl:text>
1206
- <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']" mode="title"/>
1207
+ <xsl:text>: </xsl:text> -->
1208
+ <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part-with-numbering']" mode="title"/>
1207
1209
  </fo:block>
1208
1210
  </xsl:if>
1209
- <xsl:variable name="subpart_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/>
1210
- <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']">
1211
+ <!-- <xsl:variable name="subpart_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/> -->
1212
+ <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart-with-numbering']">
1211
1213
  <fo:block role="H3">
1212
- <xsl:if test="$subpart_num != ''">
1214
+ <!-- <xsl:if test="$subpart_num != ''">
1213
1215
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang=$curr_lang]),'#',$subpart_num)"/>
1214
1216
  </xsl:if>
1215
- <xsl:text>: </xsl:text>
1216
- <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']" mode="title"/>
1217
+ <xsl:text>: </xsl:text> -->
1218
+ <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart-with-numbering']" mode="title"/>
1217
1219
  </fo:block>
1218
1220
  </xsl:if>
1219
1221
 
@@ -1733,7 +1735,11 @@
1733
1735
  </xsl:template>
1734
1736
 
1735
1737
  <xsl:template name="insertContentItem">
1738
+ <xsl:param name="keep-with-next"/>
1736
1739
  <fo:table-row>
1740
+ <xsl:if test="$keep-with-next = 'true'">
1741
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1742
+ </xsl:if>
1737
1743
  <xsl:variable name="space-before">
1738
1744
  <xsl:if test="@level = 1">
1739
1745
  <xsl:if test="@type = 'annex'">14pt</xsl:if>
@@ -2224,6 +2230,14 @@
2224
2230
  <xsl:text> </xsl:text>
2225
2231
  </xsl:template>
2226
2232
 
2233
+ <xsl:template match="*[local-name() = 'sub']" mode="header">
2234
+ <xsl:apply-templates select="."/>
2235
+ </xsl:template>
2236
+
2237
+ <xsl:template match="*[local-name() = 'sup']" mode="header">
2238
+ <xsl:apply-templates select="."/>
2239
+ </xsl:template>
2240
+
2227
2241
  <!-- ====== -->
2228
2242
  <!-- ====== -->
2229
2243
 
@@ -2747,6 +2761,10 @@
2747
2761
  <xsl:attribute name="role">BlockQuote</xsl:attribute>
2748
2762
  </xsl:if>
2749
2763
 
2764
+ <xsl:if test="ancestor::bipm:preface">
2765
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2766
+ </xsl:if>
2767
+
2750
2768
  <!-- last item -->
2751
2769
  <xsl:if test="not(following-sibling::*[1][local-name() = 'li'])">
2752
2770
  <xsl:attribute name="space-after">6pt</xsl:attribute>
@@ -2909,16 +2927,18 @@
2909
2927
  <xsl:template match="bipm:note[not(ancestor::bipm:preface)]/bipm:name" priority="2">
2910
2928
  <xsl:choose>
2911
2929
  <xsl:when test="not(../preceding-sibling::bipm:note) and not((../following-sibling::bipm:note))">
2912
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2930
+ <!-- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2913
2931
  <xsl:choose>
2914
2932
  <xsl:when test="$curr_lang = 'fr'">
2915
2933
  <xsl:choose>
2916
- <xsl:when test="ancestor::bipm:li">Remarque: </xsl:when>
2917
- <xsl:otherwise>Note: </xsl:otherwise>
2934
+ <xsl:when test="ancestor::bipm:li">Remarque&#xa0;: </xsl:when>
2935
+ <xsl:otherwise>Note&#xa0;: </xsl:otherwise>
2918
2936
  </xsl:choose>
2919
2937
  </xsl:when>
2920
2938
  <xsl:otherwise>Note: </xsl:otherwise>
2921
- </xsl:choose>
2939
+ </xsl:choose> -->
2940
+ <xsl:apply-templates/>
2941
+ <xsl:text> </xsl:text>
2922
2942
  </xsl:when>
2923
2943
  <xsl:when test="ancestor::bipm:table and count(ancestor::bipm:table//bipm:note) &gt; 0">
2924
2944
  <xsl:variable name="table_id" select="ancestor::bipm:table/@id"/>
@@ -2928,11 +2948,30 @@
2928
2948
  </xsl:template>
2929
2949
 
2930
2950
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']" priority="3">
2931
- <fo:inline xsl:use-attribute-sets="note-p-style">
2932
- <xsl:apply-templates/>
2933
- </fo:inline>
2934
- <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2951
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
2952
+ <xsl:choose>
2953
+ <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
2954
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2955
+ <xsl:apply-templates/>
2956
+ </fo:inline>
2957
+ </xsl:when>
2958
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
2959
+ <fo:block xsl:use-attribute-sets="note-p-style">
2960
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
2961
+ <xsl:apply-templates/>
2962
+ </fo:block>
2963
+ </xsl:when>
2964
+ <xsl:otherwise>
2965
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2966
+ <xsl:apply-templates/>
2967
+ </fo:inline>
2968
+ <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2969
+ </xsl:otherwise>
2970
+ </xsl:choose>
2971
+ </xsl:template>
2935
2972
 
2973
+ <xsl:template match="*[local-name() = 'name']/text()" priority="2">
2974
+ <xsl:value-of select="."/>
2936
2975
  </xsl:template>
2937
2976
 
2938
2977
  <xsl:template match="*[local-name() = 'sup_fn']">
@@ -4297,8 +4336,8 @@
4297
4336
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4298
4337
  <xsl:attribute name="text-align">left</xsl:attribute>
4299
4338
  <xsl:attribute name="margin-top">24pt</xsl:attribute>
4300
- <xsl:attribute name="margin-left">25mm</xsl:attribute>
4301
- <xsl:attribute name="text-indent">-25mm</xsl:attribute>
4339
+ <!-- <xsl:attribute name="margin-left">25mm</xsl:attribute>
4340
+ <xsl:attribute name="text-indent">-25mm</xsl:attribute> -->
4302
4341
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4303
4342
 
4304
4343
  </xsl:attribute-set> <!-- table-name-style -->
@@ -4462,6 +4501,7 @@
4462
4501
  <xsl:attribute-set name="note-style">
4463
4502
 
4464
4503
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4504
+ <xsl:attribute name="text-align">justify</xsl:attribute>
4465
4505
 
4466
4506
  </xsl:attribute-set>
4467
4507
 
@@ -5571,25 +5611,38 @@
5571
5611
  <xsl:param name="continued"/>
5572
5612
  <xsl:if test="normalize-space() != ''">
5573
5613
 
5574
- <fo:block xsl:use-attribute-sets="table-name-style">
5614
+ <fo:list-block xsl:use-attribute-sets="table-name-style">
5575
5615
 
5576
- <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
5577
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
5578
- </xsl:if>
5579
- <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
5580
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
5581
- </xsl:if>
5616
+ <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
5617
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
5618
+ </xsl:if>
5619
+ <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
5620
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
5621
+ </xsl:if>
5582
5622
 
5583
- <xsl:choose>
5584
- <xsl:when test="$continued = 'true'">
5623
+ <xsl:attribute name="provisional-distance-between-starts">25mm</xsl:attribute>
5585
5624
 
5586
- </xsl:when>
5587
- <xsl:otherwise>
5588
- <xsl:apply-templates/>
5589
- </xsl:otherwise>
5590
- </xsl:choose>
5591
-
5592
- </fo:block>
5625
+ <fo:list-item>
5626
+ <fo:list-item-label end-indent="label-end()">
5627
+ <fo:block>
5628
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5629
+ </fo:block>
5630
+ </fo:list-item-label>
5631
+ <fo:list-item-body start-indent="body-start()">
5632
+ <fo:block>
5633
+ <xsl:choose>
5634
+ <xsl:when test="./*[local-name() = 'tab']">
5635
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
5636
+ </xsl:when>
5637
+ <xsl:otherwise>
5638
+ <xsl:apply-templates/>
5639
+ </xsl:otherwise>
5640
+ </xsl:choose>
5641
+ </fo:block>
5642
+ </fo:list-item-body>
5643
+ </fo:list-item>
5644
+ </fo:list-block>
5645
+ <!-- bipm -->
5593
5646
 
5594
5647
  </xsl:if>
5595
5648
  </xsl:template> <!-- table/name -->
@@ -8680,7 +8733,12 @@
8680
8733
  </xsl:when>
8681
8734
  <xsl:otherwise>
8682
8735
 
8683
- <xsl:text>:</xsl:text>
8736
+ <!-- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8737
+ <xsl:choose>
8738
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text>&#xa0;: </xsl:text></xsl:when>
8739
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8740
+ </xsl:choose> -->
8741
+ <xsl:text> </xsl:text>
8684
8742
 
8685
8743
  </xsl:otherwise>
8686
8744
  </xsl:choose>
@@ -8700,7 +8758,12 @@
8700
8758
  </xsl:when>
8701
8759
  <xsl:otherwise>
8702
8760
 
8703
- <xsl:text>:</xsl:text>
8761
+ <!-- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8762
+ <xsl:choose>
8763
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text>&#xa0;: </xsl:text></xsl:when>
8764
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8765
+ </xsl:choose> -->
8766
+ <xsl:text> </xsl:text>
8704
8767
 
8705
8768
  </xsl:otherwise>
8706
8769
  </xsl:choose>
@@ -9709,6 +9772,18 @@
9709
9772
  </xsl:copy>
9710
9773
  </xsl:template>
9711
9774
 
9775
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
9776
+ <xsl:copy>
9777
+ <xsl:apply-templates mode="contents_item"/>
9778
+ </xsl:copy>
9779
+ </xsl:template>
9780
+
9781
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
9782
+ <xsl:copy>
9783
+ <xsl:apply-templates mode="contents_item"/>
9784
+ </xsl:copy>
9785
+ </xsl:template>
9786
+
9712
9787
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
9713
9788
  <xsl:copy-of select="."/>
9714
9789
  </xsl:template>
@@ -10653,7 +10728,7 @@
10653
10728
  <!-- ====== -->
10654
10729
  <!-- eref -->
10655
10730
  <!-- ====== -->
10656
- <xsl:template match="*[local-name() = 'eref']">
10731
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
10657
10732
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
10658
10733
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
10659
10734
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -11157,21 +11232,29 @@
11157
11232
  </xsl:variable>
11158
11233
 
11159
11234
  <xsl:template match="@*|node()" mode="index_add_id">
11235
+ <xsl:param name="docid"/>
11160
11236
  <xsl:copy>
11161
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
11237
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
11238
+ <xsl:with-param name="docid" select="$docid"/>
11239
+ </xsl:apply-templates>
11162
11240
  </xsl:copy>
11163
11241
  </xsl:template>
11164
11242
 
11165
11243
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
11244
+ <xsl:param name="docid"/>
11166
11245
  <xsl:variable name="id">
11167
- <xsl:call-template name="generateIndexXrefId"/>
11246
+ <xsl:call-template name="generateIndexXrefId">
11247
+ <xsl:with-param name="docid" select="$docid"/>
11248
+ </xsl:call-template>
11168
11249
  </xsl:variable>
11169
11250
  <xsl:copy> <!-- add id to xref -->
11170
11251
  <xsl:apply-templates select="@*" mode="index_add_id"/>
11171
11252
  <xsl:attribute name="id">
11172
11253
  <xsl:value-of select="$id"/>
11173
11254
  </xsl:attribute>
11174
- <xsl:apply-templates mode="index_add_id"/>
11255
+ <xsl:apply-templates mode="index_add_id">
11256
+ <xsl:with-param name="docid" select="$docid"/>
11257
+ </xsl:apply-templates>
11175
11258
  </xsl:copy>
11176
11259
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
11177
11260
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -11183,7 +11266,9 @@
11183
11266
  <xsl:attribute name="id">
11184
11267
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
11185
11268
  </xsl:attribute>
11186
- <xsl:apply-templates mode="index_add_id"/>
11269
+ <xsl:apply-templates mode="index_add_id">
11270
+ <xsl:with-param name="docid" select="$docid"/>
11271
+ </xsl:apply-templates>
11187
11272
  </xsl:copy>
11188
11273
  </xsl:if>
11189
11274
  </xsl:template>
@@ -11220,12 +11305,33 @@
11220
11305
  </xsl:when>
11221
11306
  <xsl:when test="self::* and local-name(.) = 'xref'">
11222
11307
  <xsl:variable name="id" select="@id"/>
11223
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
11224
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11225
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
11226
11308
 
11309
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11227
11310
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
11228
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
11311
+
11312
+ <xsl:variable name="pages_">
11313
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
11314
+ <xsl:choose>
11315
+ <xsl:when test="@id = $id">
11316
+ <page><xsl:value-of select="."/></page>
11317
+ </xsl:when>
11318
+ <xsl:when test="@id = $id_next">
11319
+ <page_next><xsl:value-of select="."/></page_next>
11320
+ </xsl:when>
11321
+ <xsl:when test="@id = $id_prev">
11322
+ <page_prev><xsl:value-of select="."/></page_prev>
11323
+ </xsl:when>
11324
+ </xsl:choose>
11325
+ </xsl:for-each>
11326
+ </xsl:variable>
11327
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
11328
+
11329
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
11330
+ <xsl:variable name="page" select="$pages/page"/>
11331
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
11332
+ <xsl:variable name="page_next" select="$pages/page_next"/>
11333
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
11334
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
11229
11335
 
11230
11336
  <xsl:choose>
11231
11337
  <!-- 2nd pass -->
@@ -11285,16 +11391,20 @@
11285
11391
  </xsl:template>
11286
11392
 
11287
11393
  <xsl:template name="generateIndexXrefId">
11394
+ <xsl:param name="docid"/>
11395
+
11288
11396
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
11289
11397
 
11290
- <xsl:variable name="docid">
11291
- <xsl:call-template name="getDocumentId"/>
11398
+ <xsl:variable name="docid_curr">
11399
+ <xsl:value-of select="$docid"/>
11400
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
11292
11401
  </xsl:variable>
11402
+
11293
11403
  <xsl:variable name="item_number">
11294
11404
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
11295
11405
  </xsl:variable>
11296
11406
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
11297
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11407
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11298
11408
  </xsl:template>
11299
11409
 
11300
11410
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">