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">
@@ -19,3 +19,7 @@ norm_with_refs_pref:
19
19
  all_rights_reserved: All rights reserved
20
20
  table_of_contents: Contents
21
21
  source: Adapted from
22
+ note: "Note:"
23
+ prefacenote: "NOTE:"
24
+ listnote: "Note:"
25
+ termnote: "Note % to entry"
@@ -42,3 +42,7 @@ norm_with_refs_pref:
42
42
  all_rights_reserved: Tous droits réservés
43
43
  table_of_contents: Table des matières
44
44
  source: Adapté de
45
+ note: "Note:"
46
+ prefacenote: "NOTE:"
47
+ listnote: "Remarque:"
48
+ termnote: "Note % à l’article:"
@@ -6,8 +6,8 @@ require_relative "i18n"
6
6
  module IsoDoc
7
7
  module BIPM
8
8
  module Init
9
- def metadata_init(lang, script, labels)
10
- @meta = Metadata.new(lang, script, labels)
9
+ def metadata_init(lang, script, locale, labels)
10
+ @meta = Metadata.new(lang, script, locale, labels)
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, _klass, labels, options)
@@ -15,8 +15,9 @@ module IsoDoc
15
15
  @xrefs = Xref.new(lang, script, html, labels, options)
16
16
  end
17
17
 
18
- def i18n_init(lang, script, i18nyaml = nil)
19
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
18
+ def i18n_init(lang, script, locale, i18nyaml = nil)
19
+ @i18n = I18n.new(lang, script, locale: locale,
20
+ i18nyaml: i18nyaml || @i18nyaml)
20
21
  end
21
22
 
22
23
  def omit_docid_prefix(prefix)
@@ -7602,6 +7602,18 @@
7602
7602
  </xsl:copy>
7603
7603
  </xsl:template>
7604
7604
 
7605
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7606
+ <xsl:copy>
7607
+ <xsl:apply-templates mode="contents_item"/>
7608
+ </xsl:copy>
7609
+ </xsl:template>
7610
+
7611
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7612
+ <xsl:copy>
7613
+ <xsl:apply-templates mode="contents_item"/>
7614
+ </xsl:copy>
7615
+ </xsl:template>
7616
+
7605
7617
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7606
7618
  <xsl:copy-of select="."/>
7607
7619
  </xsl:template>
@@ -8562,7 +8574,7 @@
8562
8574
  <!-- ====== -->
8563
8575
  <!-- eref -->
8564
8576
  <!-- ====== -->
8565
- <xsl:template match="*[local-name() = 'eref']">
8577
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8566
8578
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8567
8579
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8568
8580
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9062,21 +9074,29 @@
9062
9074
  </xsl:variable>
9063
9075
 
9064
9076
  <xsl:template match="@*|node()" mode="index_add_id">
9077
+ <xsl:param name="docid"/>
9065
9078
  <xsl:copy>
9066
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9079
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9080
+ <xsl:with-param name="docid" select="$docid"/>
9081
+ </xsl:apply-templates>
9067
9082
  </xsl:copy>
9068
9083
  </xsl:template>
9069
9084
 
9070
9085
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9086
+ <xsl:param name="docid"/>
9071
9087
  <xsl:variable name="id">
9072
- <xsl:call-template name="generateIndexXrefId"/>
9088
+ <xsl:call-template name="generateIndexXrefId">
9089
+ <xsl:with-param name="docid" select="$docid"/>
9090
+ </xsl:call-template>
9073
9091
  </xsl:variable>
9074
9092
  <xsl:copy> <!-- add id to xref -->
9075
9093
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9076
9094
  <xsl:attribute name="id">
9077
9095
  <xsl:value-of select="$id"/>
9078
9096
  </xsl:attribute>
9079
- <xsl:apply-templates mode="index_add_id"/>
9097
+ <xsl:apply-templates mode="index_add_id">
9098
+ <xsl:with-param name="docid" select="$docid"/>
9099
+ </xsl:apply-templates>
9080
9100
  </xsl:copy>
9081
9101
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9082
9102
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9088,7 +9108,9 @@
9088
9108
  <xsl:attribute name="id">
9089
9109
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9090
9110
  </xsl:attribute>
9091
- <xsl:apply-templates mode="index_add_id"/>
9111
+ <xsl:apply-templates mode="index_add_id">
9112
+ <xsl:with-param name="docid" select="$docid"/>
9113
+ </xsl:apply-templates>
9092
9114
  </xsl:copy>
9093
9115
  </xsl:if>
9094
9116
  </xsl:template>
@@ -9125,12 +9147,33 @@
9125
9147
  </xsl:when>
9126
9148
  <xsl:when test="self::* and local-name(.) = 'xref'">
9127
9149
  <xsl:variable name="id" select="@id"/>
9128
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9129
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9130
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9131
9150
 
9151
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9132
9152
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9133
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9153
+
9154
+ <xsl:variable name="pages_">
9155
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9156
+ <xsl:choose>
9157
+ <xsl:when test="@id = $id">
9158
+ <page><xsl:value-of select="."/></page>
9159
+ </xsl:when>
9160
+ <xsl:when test="@id = $id_next">
9161
+ <page_next><xsl:value-of select="."/></page_next>
9162
+ </xsl:when>
9163
+ <xsl:when test="@id = $id_prev">
9164
+ <page_prev><xsl:value-of select="."/></page_prev>
9165
+ </xsl:when>
9166
+ </xsl:choose>
9167
+ </xsl:for-each>
9168
+ </xsl:variable>
9169
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9170
+
9171
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9172
+ <xsl:variable name="page" select="$pages/page"/>
9173
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9174
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9175
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9176
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9134
9177
 
9135
9178
  <xsl:choose>
9136
9179
  <!-- 2nd pass -->
@@ -9190,16 +9233,20 @@
9190
9233
  </xsl:template>
9191
9234
 
9192
9235
  <xsl:template name="generateIndexXrefId">
9236
+ <xsl:param name="docid"/>
9237
+
9193
9238
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9194
9239
 
9195
- <xsl:variable name="docid">
9196
- <xsl:call-template name="getDocumentId"/>
9240
+ <xsl:variable name="docid_curr">
9241
+ <xsl:value-of select="$docid"/>
9242
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9197
9243
  </xsl:variable>
9244
+
9198
9245
  <xsl:variable name="item_number">
9199
9246
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9200
9247
  </xsl:variable>
9201
9248
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9202
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9249
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9203
9250
  </xsl:template>
9204
9251
 
9205
9252
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -11,7 +11,7 @@ module IsoDoc
11
11
  K_k kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA
12
12
  s_deltanu).freeze
13
13
 
14
- def initialize(lang, script, labels)
14
+ def initialize(lang, script, locale, labels)
15
15
  super
16
16
  here = File.join(File.dirname(__FILE__), "html", "si-aspect")
17
17
  si_paths = []
@@ -26,14 +26,14 @@ module IsoDoc
26
26
 
27
27
  def title(isoxml, _out)
28
28
  lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
29
- set(:doctitle, @c.encode(isoxml&.at(
29
+ set(:doctitle, @c.encode(isoxml.at(
30
30
  ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
31
- set(:docsubtitle, @c.encode(isoxml&.at(
31
+ set(:docsubtitle, @c.encode(isoxml.at(
32
32
  ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
33
33
  %w(appendix annex part subtitle provenance).each do |e|
34
- set("#{e}title".to_sym, @c.encode(isoxml&.at(
34
+ set("#{e}title".to_sym, @c.encode(isoxml.at(
35
35
  ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
36
- set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
36
+ set("#{e}subtitle".to_sym, @c.encode(isoxml.at(
37
37
  ns("#{TITLE}[@type='#{e}'][@language='#{lang2}']"))&.text || ""))
38
38
  end
39
39
  end
@@ -51,16 +51,16 @@ module IsoDoc
51
51
  super
52
52
  label1, label2 = @lang == "fr" ? %w(Annexe Appendix) : %w(Appendix Annexe)
53
53
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
54
- dn and set(:appendixid, @i18n.l10n("#{label1} #{dn&.text}"))
55
- dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
54
+ dn and set(:appendixid, @i18n.l10n("#{label1} #{dn.text}"))
55
+ dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn.text}"))
56
56
  label1, label2 = @lang == "fr" ? %w(Appendice Annex) : %w(Annex Appendice)
57
57
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
58
- dn and set(:annexid, @i18n.l10n("#{label1} #{dn&.text}"))
59
- dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
58
+ dn and set(:annexid, @i18n.l10n("#{label1} #{dn.text}"))
59
+ dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn.text}"))
60
60
  label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
61
61
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
62
- dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
63
- dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
62
+ dn and set(:partid, @i18n.l10n("#{label1} #{dn.text}"))
63
+ dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn.text}"))
64
64
  set(:org_abbrev,
65
65
  isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
66
66
  "[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")