metanorma-bipm 1.1.4 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,8 +15,12 @@
15
15
 
16
16
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
17
17
 
18
- <xsl:variable name="pageWidth" select="'210mm'"/>
19
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="31.7"/>
21
+ <xsl:variable name="marginLeftRight2" select="40"/>
22
+ <xsl:variable name="marginTop" select="25.4"/>
23
+ <xsl:variable name="marginBottom" select="22"/>
20
24
 
21
25
 
22
26
 
@@ -207,7 +211,7 @@
207
211
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
208
212
  <fo:layout-master-set>
209
213
  <!-- Cover page -->
210
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
214
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
211
215
  <fo:region-body margin-top="36mm" margin-bottom="43mm" margin-left="49mm" margin-right="48mm"/>
212
216
  <fo:region-before extent="36mm"/>
213
217
  <fo:region-after extent="43mm"/>
@@ -216,7 +220,7 @@
216
220
  </fo:simple-page-master>
217
221
 
218
222
  <!-- Cover page -->
219
- <fo:simple-page-master master-name="cover-page-appendix" page-width="{$pageWidth}" page-height="{$pageHeight}">
223
+ <fo:simple-page-master master-name="cover-page-appendix" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
220
224
  <fo:region-body margin-top="90mm" margin-bottom="40mm" margin-left="12.5mm" margin-right="53mm"/>
221
225
  <fo:region-before extent="60mm"/>
222
226
  <fo:region-after extent="40mm"/>
@@ -225,7 +229,7 @@
225
229
  </fo:simple-page-master>
226
230
 
227
231
  <!-- Title page -->
228
- <fo:simple-page-master master-name="title-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
232
+ <fo:simple-page-master master-name="title-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
229
233
  <fo:region-body margin-top="38mm" margin-bottom="25mm" margin-left="95mm" margin-right="12mm"/>
230
234
  <fo:region-before extent="38mm"/>
231
235
  <fo:region-after extent="25mm"/>
@@ -234,17 +238,17 @@
234
238
  </fo:simple-page-master>
235
239
 
236
240
  <!-- Document pages -->
237
- <fo:simple-page-master master-name="document-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
238
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
239
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
240
- <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
241
+ <fo:simple-page-master master-name="document-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
242
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
243
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
244
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- debug: background-color="green" -->
241
245
  <fo:region-start region-name="left-region" extent="17mm"/>
242
246
  <fo:region-end region-name="right-region" extent="26.5mm"/>
243
247
  </fo:simple-page-master>
244
- <fo:simple-page-master master-name="document-even" page-width="{$pageWidth}" page-height="{$pageHeight}">
245
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
246
- <fo:region-before region-name="header-even" extent="25.4mm"/>
247
- <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
248
+ <fo:simple-page-master master-name="document-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
249
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
250
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
251
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- debug: background-color="green" -->
248
252
  <fo:region-start region-name="left-region" extent="17mm"/>
249
253
  <fo:region-end region-name="right-region" extent="26.5mm"/>
250
254
  </fo:simple-page-master>
@@ -256,17 +260,17 @@
256
260
  </fo:page-sequence-master>
257
261
 
258
262
  <!-- Document pages (landscape orientation) -->
259
- <fo:simple-page-master master-name="document-landscape-odd" page-width="{$pageHeight}" page-height="{$pageWidth}">
260
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
261
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
262
- <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
263
+ <fo:simple-page-master master-name="document-landscape-odd" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
264
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
265
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
266
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- debug: background-color="green" -->
263
267
  <fo:region-start region-name="left-region" extent="17mm"/>
264
268
  <fo:region-end region-name="right-region" extent="26.5mm"/>
265
269
  </fo:simple-page-master>
266
- <fo:simple-page-master master-name="document-landscape-even" page-width="{$pageHeight}" page-height="{$pageWidth}">
267
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
268
- <fo:region-before region-name="header-even" extent="25.4mm"/>
269
- <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
270
+ <fo:simple-page-master master-name="document-landscape-even" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
271
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
272
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
273
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- debug: background-color="green" -->
270
274
  <fo:region-start region-name="left-region" extent="17mm"/>
271
275
  <fo:region-end region-name="right-region" extent="26.5mm"/>
272
276
  </fo:simple-page-master>
@@ -278,17 +282,17 @@
278
282
  </fo:page-sequence-master>
279
283
 
280
284
  <!-- Index pages -->
281
- <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
282
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
283
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
284
- <fo:region-after region-name="footer" extent="22mm"/>
285
+ <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
286
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
287
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
288
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
285
289
  <fo:region-start region-name="left-region" extent="17mm"/>
286
290
  <fo:region-end region-name="right-region" extent="26.5mm"/>
287
291
  </fo:simple-page-master>
288
- <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}" page-height="{$pageHeight}">
289
- <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
290
- <fo:region-before region-name="header-even" extent="25.4mm"/>
291
- <fo:region-after region-name="footer" extent="22mm"/>
292
+ <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
293
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
294
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
295
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
292
296
  <fo:region-start region-name="left-region" extent="17mm"/>
293
297
  <fo:region-end region-name="right-region" extent="26.5mm"/>
294
298
  </fo:simple-page-master>
@@ -352,8 +356,12 @@
352
356
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
353
357
  </xsl:variable> -->
354
358
 
359
+ <xsl:variable name="title_eref">
360
+ <xsl:apply-templates select="." mode="title_eref"/>
361
+ </xsl:variable>
362
+
355
363
  <xsl:variable name="flatxml_">
356
- <xsl:apply-templates select="." mode="flatxml"/>
364
+ <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
357
365
  </xsl:variable>
358
366
 
359
367
  <xsl:variable name="flatxml">
@@ -383,8 +391,12 @@
383
391
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
384
392
  </xsl:variable> -->
385
393
 
394
+ <xsl:variable name="title_eref">
395
+ <xsl:apply-templates select="." mode="title_eref"/>
396
+ </xsl:variable>
397
+
386
398
  <xsl:variable name="flatxml_">
387
- <xsl:apply-templates select="." mode="flatxml"/>
399
+ <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
388
400
  </xsl:variable>
389
401
 
390
402
  <xsl:variable name="flatxml">
@@ -403,8 +415,12 @@
403
415
  </xsl:when>
404
416
  <xsl:otherwise>
405
417
 
418
+ <xsl:variable name="title_eref">
419
+ <xsl:apply-templates mode="title_eref"/>
420
+ </xsl:variable>
421
+
406
422
  <xsl:variable name="flatxml_">
407
- <xsl:apply-templates mode="flatxml"/>
423
+ <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
408
424
  </xsl:variable>
409
425
 
410
426
  <xsl:variable name="flatxml">
@@ -426,6 +442,27 @@
426
442
  </fo:root>
427
443
  </xsl:template>
428
444
 
445
+ <!-- ================================= -->
446
+ <!-- Move eref inside title -->
447
+ <!-- ================================= -->
448
+ <xsl:template match="@*|node()" mode="title_eref">
449
+ <xsl:copy>
450
+ <xsl:apply-templates select="@*|node()" mode="title_eref"/>
451
+ </xsl:copy>
452
+ </xsl:template>
453
+
454
+ <xsl:template match="bipm:title[following-sibling::*[1][self::bipm:eref]]" mode="title_eref">
455
+ <xsl:copy>
456
+ <xsl:apply-templates select="@*|node()" mode="title_eref"/>
457
+ <!-- move next eref inside title -->
458
+ <xsl:copy-of select="following-sibling::*[1][self::bipm:eref]"/>
459
+ </xsl:copy>
460
+ </xsl:template>
461
+ <!-- remove eref immediately after title -->
462
+ <xsl:template match="bipm:eref[preceding-sibling::*[1][self::bipm:title]]" mode="title_eref"/>
463
+ <!-- ================================= -->
464
+ <!-- END Move eref inside title -->
465
+ <!-- ================================= -->
429
466
 
430
467
  <!-- ================================= -->
431
468
  <!-- Flattening xml for fit notes at page sides (margins) -->
@@ -1709,9 +1746,9 @@
1709
1746
  <!-- background color -->
1710
1747
  <fo:block-container absolute-position="fixed" left="0" top="-1mm">
1711
1748
  <fo:block>
1712
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
1713
- <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}" height="{$pageHeight}">
1714
- <rect width="{$pageWidth}" height="{$pageHeight}" style="fill:rgb(214,226,239);stroke-width:0"/>
1749
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
1750
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}mm" height="{$pageHeight}mm">
1751
+ <rect width="{$pageWidth}mm" height="{$pageHeight}mm" style="fill:rgb(214,226,239);stroke-width:0"/>
1715
1752
  </svg>
1716
1753
  </fo:instream-foreign-object>
1717
1754
  </fo:block>
@@ -2271,7 +2308,7 @@
2271
2308
  <xsl:when test="$level = 2 and ancestor::bipm:annex">10.5pt</xsl:when>
2272
2309
  <xsl:when test="$level = 2">14pt</xsl:when>
2273
2310
  <xsl:when test="$level = 3 and ancestor::bipm:annex">10pt</xsl:when>
2274
- <xsl:when test="$level = 4 and ancestor::bipm:annex">9pt</xsl:when>
2311
+ <xsl:when test="$level &gt;= 4 and ancestor::bipm:annex">9pt</xsl:when>
2275
2312
  <xsl:when test="$level = 3">12pt</xsl:when>
2276
2313
  <xsl:otherwise>11pt</xsl:otherwise>
2277
2314
  </xsl:choose>
@@ -2367,8 +2404,10 @@
2367
2404
  </xsl:if> -->
2368
2405
  <xsl:choose>
2369
2406
  <xsl:when test="ancestor::bipm:annex and $level &gt;= 2">
2370
- <xsl:if test="$level = 3">
2407
+ <xsl:if test="$level &gt;= 3">
2371
2408
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2409
+ </xsl:if>
2410
+ <xsl:if test="$level = 3">
2372
2411
  <fo:inline padding-right="2.5mm" baseline-shift="15%">
2373
2412
  <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
2374
2413
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
@@ -2378,7 +2417,6 @@
2378
2417
  </fo:inline>
2379
2418
  </xsl:if>
2380
2419
  <xsl:if test="$level = 4">
2381
- <xsl:attribute name="margin-left">14mm</xsl:attribute>
2382
2420
  <xsl:attribute name="text-align">center</xsl:attribute>
2383
2421
  </xsl:if>
2384
2422
  <xsl:call-template name="extractTitle"/>
@@ -2409,17 +2447,8 @@
2409
2447
 
2410
2448
  </xsl:template>
2411
2449
 
2412
- <!-- <xsl:variable name="zero-width-space" select="'&#x200b;'"/> -->
2413
2450
  <xsl:template match="*" mode="header">
2414
2451
  <xsl:apply-templates mode="header"/>
2415
- <!-- <xsl:choose>
2416
- <xsl:when test="contains(preceding-sibling::node()[1], $zero-width-space)"> -->
2417
- <!-- stop further processing -->
2418
- <!-- </xsl:when>
2419
- <xsl:otherwise>
2420
- <xsl:apply-templates mode="header"/>
2421
- </xsl:otherwise>
2422
- </xsl:choose> -->
2423
2452
  </xsl:template>
2424
2453
 
2425
2454
  <xsl:template match="*[local-name() = 'stem']" mode="header">
@@ -2430,11 +2459,6 @@
2430
2459
  <xsl:text> </xsl:text>
2431
2460
  </xsl:template>
2432
2461
 
2433
- <!-- zero-width space - separator for full/short titles. Short titles using in headers -->
2434
- <!-- <xsl:template match="text()[contains(., $zero-width-space)]" mode="header">
2435
- <xsl:value-of select="substring-before(., $zero-width-space)"/>
2436
- </xsl:template> -->
2437
-
2438
2462
  <!-- ====== -->
2439
2463
  <!-- ====== -->
2440
2464
 
@@ -3095,9 +3119,10 @@
3095
3119
  <fo:inline>
3096
3120
  <!-- <xsl:if test="@list_type = 'ul'">
3097
3121
  <xsl:attribute name="font-size">15pt</xsl:attribute> -->
3098
- <xsl:if test="@font-size">
3099
- <xsl:attribute name="font-size"><xsl:value-of select="@font-size"/></xsl:attribute>
3100
- <!-- <xsl:attribute name="baseline-shift">-10%</xsl:attribute> -->
3122
+ <xsl:copy-of select="@font-size"/>
3123
+ <xsl:copy-of select="@baseline-shift"/>
3124
+ <xsl:if test="@list_type = 'ul' and ancestor::bipm:note_side">
3125
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3101
3126
  </xsl:if>
3102
3127
  <xsl:value-of select="@label"/>
3103
3128
  </fo:inline>
@@ -3195,7 +3220,7 @@
3195
3220
  </xsl:template>
3196
3221
 
3197
3222
  <xsl:template match="bipm:example" priority="2">
3198
- <fo:block margin-top="6pt" margin-bottom="6pt">
3223
+ <fo:block margin-top="6pt" margin-bottom="6pt" keep-together.within-column="1">
3199
3224
  <fo:table table-layout="fixed" width="100%">
3200
3225
  <fo:table-column column-width="27.5mm"/>
3201
3226
  <fo:table-column column-width="108mm"/>
@@ -3341,6 +3366,11 @@
3341
3366
 
3342
3367
  <xsl:template match="bipm:xref" priority="2">
3343
3368
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
3369
+
3370
+ <xsl:if test="parent::*[local-name() = 'title']">
3371
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
3372
+ </xsl:if>
3373
+
3344
3374
  <xsl:choose>
3345
3375
  <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix, and page in references like this: « Le BIPM et la Convention du Mètre » (page 5). -->
3346
3376
  <fo:inline> <!-- font-weight="bold" -->
@@ -4159,7 +4189,7 @@
4159
4189
  <!-- grey opacity -->
4160
4190
  <fo:block-container absolute-position="fixed" left="0" top="0">
4161
4191
  <fo:block>
4162
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
4192
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
4163
4193
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
4164
4194
  <rect width="215.9mm" height="279.4mm" style="fill:rgb(255,255,255);stroke-width:0;fill-opacity:0.73"/>
4165
4195
  </svg>
@@ -4533,13 +4563,16 @@
4533
4563
 
4534
4564
 
4535
4565
 
4566
+
4536
4567
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4537
4568
 
4538
4569
 
4539
4570
 
4540
4571
 
4541
4572
 
4542
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4573
+ </xsl:attribute-set><xsl:variable name="table-border_">
4574
+
4575
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4543
4576
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4544
4577
 
4545
4578
 
@@ -4584,6 +4617,7 @@
4584
4617
 
4585
4618
 
4586
4619
 
4620
+
4587
4621
  </xsl:attribute-set><xsl:attribute-set name="note-style">
4588
4622
 
4589
4623
 
@@ -4779,14 +4813,15 @@
4779
4813
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
4780
4814
 
4781
4815
  <!-- Normative references -->
4782
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
4816
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
4783
4817
  <!-- Terms and definitions -->
4784
4818
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
4785
4819
  <!-- Another main sections -->
4786
4820
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
4787
4821
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
4788
4822
  <!-- Bibliography -->
4789
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
4823
+ <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"/>
4824
+
4790
4825
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
4791
4826
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
4792
4827
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -4829,6 +4864,8 @@
4829
4864
  <fo:block>&#xA0;</fo:block>
4830
4865
  </xsl:if> -->
4831
4866
 
4867
+
4868
+ <!-- Display table's name before table as standalone block -->
4832
4869
  <!-- $namespace = 'iso' or -->
4833
4870
 
4834
4871
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4916,6 +4953,12 @@
4916
4953
  </xsl:if>
4917
4954
 
4918
4955
 
4956
+
4957
+
4958
+
4959
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4960
+
4961
+
4919
4962
  <xsl:variable name="table_width">
4920
4963
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4921
4964
 
@@ -4939,6 +4982,7 @@
4939
4982
 
4940
4983
 
4941
4984
 
4985
+
4942
4986
 
4943
4987
 
4944
4988
 
@@ -4970,6 +5014,8 @@
4970
5014
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4971
5015
  </xsl:if>
4972
5016
 
5017
+
5018
+
4973
5019
  <xsl:choose>
4974
5020
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
4975
5021
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -5261,9 +5307,9 @@
5261
5307
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
5262
5308
  <xsl:with-param name="continued">true</xsl:with-param>
5263
5309
  </xsl:apply-templates>
5264
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
5265
- <xsl:call-template name="fn_name_display"/>
5266
- </xsl:for-each>
5310
+
5311
+
5312
+
5267
5313
 
5268
5314
  </fo:table-cell>
5269
5315
  </fo:table-row>
@@ -5347,7 +5393,11 @@
5347
5393
 
5348
5394
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
5349
5395
 
5350
- <xsl:if test="$isNoteOrFnExist = 'true'">
5396
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
5397
+
5398
+ </xsl:variable>
5399
+
5400
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
5351
5401
 
5352
5402
  <xsl:variable name="cols-count">
5353
5403
  <xsl:choose>
@@ -5376,6 +5426,8 @@
5376
5426
  </xsl:choose>
5377
5427
  </xsl:for-each>
5378
5428
 
5429
+
5430
+
5379
5431
  <xsl:choose>
5380
5432
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5381
5433
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5402,6 +5454,7 @@
5402
5454
 
5403
5455
 
5404
5456
 
5457
+
5405
5458
  <!-- fn will be processed inside 'note' processing -->
5406
5459
 
5407
5460
 
@@ -5422,6 +5475,11 @@
5422
5475
 
5423
5476
 
5424
5477
 
5478
+
5479
+
5480
+ <!-- for BSI (not PAS) display Notes before footnotes -->
5481
+
5482
+
5425
5483
  <!-- except gb -->
5426
5484
 
5427
5485
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -5447,6 +5505,10 @@
5447
5505
  <!-- fn processing -->
5448
5506
  <xsl:call-template name="fn_display"/>
5449
5507
 
5508
+
5509
+ <!-- for PAS display Notes after footnotes -->
5510
+
5511
+
5450
5512
  </fo:table-cell>
5451
5513
  </fo:table-row>
5452
5514
  </fo:table-body>
@@ -5488,6 +5550,19 @@
5488
5550
 
5489
5551
  </fo:table-body>
5490
5552
 
5553
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
5554
+ <xsl:choose>
5555
+ <xsl:when test="substring-after(., '—') != ''">
5556
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
5557
+ </xsl:when>
5558
+ <xsl:otherwise>
5559
+ <xsl:value-of select="."/>
5560
+ </xsl:otherwise>
5561
+ </xsl:choose>
5562
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
5563
+ <xsl:apply-templates mode="presentation_name"/>
5564
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
5565
+ <xsl:apply-templates select="."/>
5491
5566
  </xsl:template><xsl:template match="*[local-name()='tr']">
5492
5567
  <xsl:variable name="parent-name" select="local-name(..)"/>
5493
5568
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -5500,10 +5575,13 @@
5500
5575
 
5501
5576
 
5502
5577
 
5578
+
5579
+
5503
5580
  </xsl:if>
5504
5581
  <xsl:if test="$parent-name = 'tfoot'">
5505
5582
 
5506
5583
 
5584
+
5507
5585
  </xsl:if>
5508
5586
 
5509
5587
 
@@ -5520,6 +5598,8 @@
5520
5598
 
5521
5599
 
5522
5600
 
5601
+
5602
+
5523
5603
  <!-- <xsl:if test="$namespace = 'bipm'">
5524
5604
  <xsl:attribute name="height">8mm</xsl:attribute>
5525
5605
  </xsl:if> -->
@@ -5627,6 +5707,7 @@
5627
5707
 
5628
5708
 
5629
5709
 
5710
+
5630
5711
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
5631
5712
  <xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
5632
5713
  <xsl:if test="$rownum = 1">
@@ -5678,6 +5759,7 @@
5678
5759
 
5679
5760
 
5680
5761
 
5762
+
5681
5763
 
5682
5764
  <xsl:attribute name="text-align">justify</xsl:attribute>
5683
5765
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -5685,11 +5767,15 @@
5685
5767
  <xsl:attribute name="margin-top">18pt</xsl:attribute>
5686
5768
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
5687
5769
  </xsl:if>
5688
-
5689
5770
 
5690
5771
 
5772
+
5773
+ <!-- Table's note name (NOTE, for example) -->
5774
+
5691
5775
  <fo:inline padding-right="2mm">
5692
5776
 
5777
+
5778
+
5693
5779
 
5694
5780
 
5695
5781
 
@@ -5702,10 +5788,12 @@
5702
5788
 
5703
5789
  </fo:inline>
5704
5790
 
5791
+
5705
5792
  <xsl:if test="ancestor::bipm:preface">
5706
5793
  <fo:block> </fo:block>
5707
5794
  </xsl:if>
5708
5795
 
5796
+
5709
5797
  <xsl:apply-templates mode="process"/>
5710
5798
  </fo:block>
5711
5799
 
@@ -5713,18 +5801,18 @@
5713
5801
  <xsl:apply-templates/>
5714
5802
  </xsl:template><xsl:template name="fn_display">
5715
5803
  <xsl:variable name="references">
5804
+
5716
5805
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5717
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5718
-
5719
-
5720
- <xsl:apply-templates/>
5721
- </fn>
5806
+ <xsl:call-template name="create_fn"/>
5722
5807
  </xsl:for-each>
5723
5808
  </xsl:variable>
5809
+
5724
5810
  <xsl:for-each select="xalan:nodeset($references)//fn">
5725
5811
  <xsl:variable name="reference" select="@reference"/>
5726
5812
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5727
5813
  <fo:block margin-bottom="12pt">
5814
+
5815
+
5728
5816
 
5729
5817
 
5730
5818
 
@@ -5743,6 +5831,7 @@
5743
5831
 
5744
5832
 
5745
5833
 
5834
+
5746
5835
  <xsl:attribute name="font-style">italic</xsl:attribute>
5747
5836
 
5748
5837
  <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
@@ -5753,6 +5842,7 @@
5753
5842
  <fo:inline font-style="normal">)</fo:inline>
5754
5843
 
5755
5844
 
5845
+
5756
5846
  </fo:inline>
5757
5847
  <fo:inline>
5758
5848
 
@@ -5762,6 +5852,12 @@
5762
5852
  </fo:block>
5763
5853
  </xsl:if>
5764
5854
  </xsl:for-each>
5855
+ </xsl:template><xsl:template name="create_fn">
5856
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5857
+
5858
+
5859
+ <xsl:apply-templates/>
5860
+ </fn>
5765
5861
  </xsl:template><xsl:template name="fn_name_display">
5766
5862
  <!-- <xsl:variable name="references">
5767
5863
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -5893,6 +5989,9 @@
5893
5989
 
5894
5990
 
5895
5991
 
5992
+
5993
+
5994
+
5896
5995
  <xsl:attribute name="font-size">70%</xsl:attribute>
5897
5996
  <xsl:attribute name="vertical-align">super</xsl:attribute>
5898
5997
  <xsl:attribute name="font-style">italic</xsl:attribute>
@@ -5907,6 +6006,7 @@
5907
6006
 
5908
6007
  <fo:inline font-style="normal">)</fo:inline>
5909
6008
 
6009
+
5910
6010
  </fo:basic-link>
5911
6011
  </fo:inline>
5912
6012
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -6785,19 +6885,6 @@
6785
6885
  <!-- replace start and end spaces to non-break space -->
6786
6886
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
6787
6887
  </xsl:copy>
6788
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
6789
- <xsl:copy>
6790
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
6791
- </xsl:copy>
6792
- <xsl:choose>
6793
- <!-- if in msub, then don't add space -->
6794
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
6795
- <!-- if next char in digit, don't add space -->
6796
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
6797
- <xsl:otherwise>
6798
- <mathml:mspace width="0.5ex"/>
6799
- </xsl:otherwise>
6800
- </xsl:choose>
6801
6888
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
6802
6889
  <xsl:variable name="target">
6803
6890
  <xsl:choose>
@@ -6822,6 +6909,7 @@
6822
6909
  <fo:inline xsl:use-attribute-sets="link-style">
6823
6910
 
6824
6911
 
6912
+
6825
6913
  <xsl:choose>
6826
6914
  <xsl:when test="$target_text = ''">
6827
6915
  <xsl:apply-templates/>
@@ -6930,6 +7018,12 @@
6930
7018
 
6931
7019
 
6932
7020
 
7021
+
7022
+ <xsl:if test="parent::*[local-name() = 'li']">
7023
+ <xsl:attribute name="margin-top">4pt</xsl:attribute>
7024
+ <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
7025
+ </xsl:if>
7026
+
6933
7027
  <fo:block-container margin-left="0mm">
6934
7028
 
6935
7029
 
@@ -7117,7 +7211,24 @@
7117
7211
  </fo:instream-foreign-object>
7118
7212
  </xsl:when>
7119
7213
  <xsl:otherwise>
7120
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7214
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7215
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7216
+
7217
+ <xsl:variable name="img_src">
7218
+ <xsl:choose>
7219
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7220
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7221
+ </xsl:choose>
7222
+ </xsl:variable>
7223
+
7224
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7225
+ <xsl:if test="number($scale) &lt; 100">
7226
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7227
+ </xsl:if>
7228
+
7229
+ </xsl:if>
7230
+
7231
+ </fo:external-graphic>
7121
7232
  </xsl:otherwise>
7122
7233
  </xsl:choose>
7123
7234
 
@@ -7185,6 +7296,253 @@
7185
7296
  <xsl:param name="height"/>
7186
7297
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
7187
7298
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
7299
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
7300
+ <xsl:param name="name"/>
7301
+
7302
+ <xsl:variable name="svg_content">
7303
+ <xsl:apply-templates select="." mode="svg_update"/>
7304
+ </xsl:variable>
7305
+
7306
+ <xsl:variable name="alt-text">
7307
+ <xsl:choose>
7308
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
7309
+ <xsl:value-of select="../*[local-name() = 'name']"/>
7310
+ </xsl:when>
7311
+ <xsl:when test="normalize-space($name) != ''">
7312
+ <xsl:value-of select="$name"/>
7313
+ </xsl:when>
7314
+ <xsl:otherwise>Figure</xsl:otherwise>
7315
+ </xsl:choose>
7316
+ </xsl:variable>
7317
+
7318
+ <xsl:choose>
7319
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
7320
+ <fo:block>
7321
+ <xsl:variable name="width" select="@width"/>
7322
+ <xsl:variable name="height" select="@height"/>
7323
+
7324
+ <xsl:variable name="scale_x">
7325
+ <xsl:choose>
7326
+ <xsl:when test="$width &gt; $width_effective_px">
7327
+ <xsl:value-of select="$width_effective_px div $width"/>
7328
+ </xsl:when>
7329
+ <xsl:otherwise>1</xsl:otherwise>
7330
+ </xsl:choose>
7331
+ </xsl:variable>
7332
+
7333
+ <xsl:variable name="scale_y">
7334
+ <xsl:choose>
7335
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
7336
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
7337
+ </xsl:when>
7338
+ <xsl:otherwise>1</xsl:otherwise>
7339
+ </xsl:choose>
7340
+ </xsl:variable>
7341
+
7342
+ <xsl:variable name="scale">
7343
+ <xsl:choose>
7344
+ <xsl:when test="$scale_y != 1">
7345
+ <xsl:value-of select="$scale_x * $scale_y"/>
7346
+ </xsl:when>
7347
+ <xsl:otherwise>
7348
+ <xsl:value-of select="$scale_x"/>
7349
+ </xsl:otherwise>
7350
+ </xsl:choose>
7351
+ </xsl:variable>
7352
+
7353
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
7354
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
7355
+
7356
+ <fo:table table-layout="fixed" width="100%">
7357
+ <fo:table-column column-width="proportional-column-width(1)"/>
7358
+ <fo:table-column column-width="{$width_scale}px"/>
7359
+ <fo:table-column column-width="proportional-column-width(1)"/>
7360
+ <fo:table-body>
7361
+ <fo:table-row>
7362
+ <fo:table-cell column-number="2">
7363
+ <fo:block>
7364
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
7365
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
7366
+ <fo:block line-height="0" font-size="0">
7367
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
7368
+ <xsl:call-template name="bookmark"/>
7369
+ </xsl:for-each>
7370
+ </fo:block>
7371
+ </xsl:if>
7372
+ <fo:block text-depth="0" line-height="0" font-size="0">
7373
+
7374
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7375
+ <xsl:attribute name="width">100%</xsl:attribute>
7376
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7377
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7378
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7379
+
7380
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
7381
+ </fo:instream-foreign-object>
7382
+ </fo:block>
7383
+
7384
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
7385
+ <xsl:with-param name="scale" select="$scale"/>
7386
+ </xsl:apply-templates>
7387
+ </fo:block-container>
7388
+ </fo:block>
7389
+ </fo:table-cell>
7390
+ </fo:table-row>
7391
+ </fo:table-body>
7392
+ </fo:table>
7393
+ </fo:block>
7394
+
7395
+ </xsl:when>
7396
+ <xsl:otherwise>
7397
+ <fo:block xsl:use-attribute-sets="image-style">
7398
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7399
+ <xsl:attribute name="width">100%</xsl:attribute>
7400
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7401
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7402
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7403
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7404
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7405
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7406
+ <!-- effective height / width = 1.48, 1.4 - with title -->
7407
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7408
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7409
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7410
+ </xsl:if>
7411
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7412
+ <xsl:copy-of select="$svg_content"/>
7413
+ </fo:instream-foreign-object>
7414
+ </fo:block>
7415
+ </xsl:otherwise>
7416
+ </xsl:choose>
7417
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
7418
+ <xsl:copy>
7419
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
7420
+ </xsl:copy>
7421
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
7422
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7423
+ <xsl:value-of select="."/>
7424
+ </xsl:attribute>
7425
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7426
+ <xsl:copy>
7427
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7428
+ <xsl:variable name="viewbox">
7429
+ <xsl:call-template name="split">
7430
+ <xsl:with-param name="pText" select="@viewBox"/>
7431
+ <xsl:with-param name="sep" select="' '"/>
7432
+ </xsl:call-template>
7433
+ </xsl:variable>
7434
+ <xsl:attribute name="width">
7435
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7436
+ </xsl:attribute>
7437
+ <xsl:attribute name="height">
7438
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7439
+ </xsl:attribute>
7440
+ <xsl:apply-templates mode="svg_update"/>
7441
+ </xsl:copy>
7442
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7443
+ <xsl:variable name="svg_content" select="document(@src)"/>
7444
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7445
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
7446
+ <xsl:call-template name="image_svg">
7447
+ <xsl:with-param name="name" select="$name"/>
7448
+ </xsl:call-template>
7449
+ </xsl:for-each>
7450
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
7451
+ <xsl:copy>
7452
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
7453
+ </xsl:copy>
7454
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
7455
+ <xsl:apply-templates mode="svg_remove_a"/>
7456
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
7457
+ <xsl:param name="scale"/>
7458
+ <xsl:variable name="dest">
7459
+ <xsl:choose>
7460
+ <xsl:when test="starts-with(@href, '#')">
7461
+ <xsl:value-of select="substring-after(@href, '#')"/>
7462
+ </xsl:when>
7463
+ <xsl:otherwise>
7464
+ <xsl:value-of select="@href"/>
7465
+ </xsl:otherwise>
7466
+ </xsl:choose>
7467
+ </xsl:variable>
7468
+ <xsl:for-each select="./*[local-name() = 'rect']">
7469
+ <xsl:call-template name="insertSVGMapLink">
7470
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
7471
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
7472
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
7473
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
7474
+ <xsl:with-param name="dest" select="$dest"/>
7475
+ </xsl:call-template>
7476
+ </xsl:for-each>
7477
+
7478
+ <xsl:for-each select="./*[local-name() = 'polygon']">
7479
+ <xsl:variable name="points">
7480
+ <xsl:call-template name="split">
7481
+ <xsl:with-param name="pText" select="@points"/>
7482
+ </xsl:call-template>
7483
+ </xsl:variable>
7484
+ <xsl:variable name="x_coords">
7485
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
7486
+ <xsl:sort select="." data-type="number"/>
7487
+ <x><xsl:value-of select="."/></x>
7488
+ </xsl:for-each>
7489
+ </xsl:variable>
7490
+ <xsl:variable name="y_coords">
7491
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
7492
+ <xsl:sort select="." data-type="number"/>
7493
+ <y><xsl:value-of select="."/></y>
7494
+ </xsl:for-each>
7495
+ </xsl:variable>
7496
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
7497
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
7498
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
7499
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
7500
+ <xsl:call-template name="insertSVGMapLink">
7501
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
7502
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
7503
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
7504
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
7505
+ <xsl:with-param name="dest" select="$dest"/>
7506
+ </xsl:call-template>
7507
+ </xsl:for-each>
7508
+
7509
+ <xsl:for-each select="./*[local-name() = 'circle']">
7510
+ <xsl:call-template name="insertSVGMapLink">
7511
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
7512
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
7513
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
7514
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
7515
+ <xsl:with-param name="dest" select="$dest"/>
7516
+ </xsl:call-template>
7517
+ </xsl:for-each>
7518
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
7519
+ <xsl:call-template name="insertSVGMapLink">
7520
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
7521
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
7522
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
7523
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
7524
+ <xsl:with-param name="dest" select="$dest"/>
7525
+ </xsl:call-template>
7526
+ </xsl:for-each>
7527
+ </xsl:template><xsl:template name="insertSVGMapLink">
7528
+ <xsl:param name="left"/>
7529
+ <xsl:param name="top"/>
7530
+ <xsl:param name="width"/>
7531
+ <xsl:param name="height"/>
7532
+ <xsl:param name="dest"/>
7533
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
7534
+ <fo:block font-size="1pt">
7535
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7536
+ <fo:inline-container inline-progression-dimension="100%">
7537
+ <fo:block-container height="{$height - 1}px" width="100%">
7538
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7539
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7540
+ </xsl:if> -->
7541
+ <fo:block> </fo:block></fo:block-container>
7542
+ </fo:inline-container>
7543
+ </fo:basic-link>
7544
+ </fo:block>
7545
+ </fo:block-container>
7188
7546
  </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">
7189
7547
  <xsl:apply-templates mode="contents"/>
7190
7548
  <xsl:text> </xsl:text>
@@ -7213,28 +7571,39 @@
7213
7571
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
7214
7572
  <xsl:for-each select="xalan:nodeset($contents)/doc">
7215
7573
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7574
+ <xsl:if test="@bundle = 'true'">
7575
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
7576
+ </xsl:if>
7216
7577
  <fo:bookmark-title>
7217
- <xsl:variable name="bookmark-title_">
7218
- <xsl:call-template name="getLangVersion">
7219
- <xsl:with-param name="lang" select="@lang"/>
7220
- <xsl:with-param name="doctype" select="@doctype"/>
7221
- <xsl:with-param name="title" select="@title-part"/>
7222
- </xsl:call-template>
7223
- </xsl:variable>
7224
7578
  <xsl:choose>
7225
- <xsl:when test="normalize-space($bookmark-title_) != ''">
7226
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
7227
- </xsl:when>
7228
- <xsl:otherwise>
7579
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
7580
+ <xsl:variable name="bookmark-title_">
7581
+ <xsl:call-template name="getLangVersion">
7582
+ <xsl:with-param name="lang" select="@lang"/>
7583
+ <xsl:with-param name="doctype" select="@doctype"/>
7584
+ <xsl:with-param name="title" select="@title-part"/>
7585
+ </xsl:call-template>
7586
+ </xsl:variable>
7229
7587
  <xsl:choose>
7230
- <xsl:when test="@lang = 'en'">English</xsl:when>
7231
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
7232
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
7233
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
7588
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
7589
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
7590
+ </xsl:when>
7591
+ <xsl:otherwise>
7592
+ <xsl:choose>
7593
+ <xsl:when test="@lang = 'en'">English</xsl:when>
7594
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
7595
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
7596
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
7597
+ </xsl:choose>
7598
+ </xsl:otherwise>
7234
7599
  </xsl:choose>
7600
+ </xsl:when>
7601
+ <xsl:otherwise>
7602
+ <xsl:value-of select="@title-part"/>
7235
7603
  </xsl:otherwise>
7236
7604
  </xsl:choose>
7237
7605
  </fo:bookmark-title>
7606
+
7238
7607
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
7239
7608
 
7240
7609
  <xsl:call-template name="insertFigureBookmarks">
@@ -7347,16 +7716,23 @@
7347
7716
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
7348
7717
  </xsl:choose>
7349
7718
  </xsl:template><xsl:template match="item" mode="bookmark">
7350
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
7351
- <fo:bookmark-title>
7352
- <xsl:if test="@section != ''">
7353
- <xsl:value-of select="@section"/>
7354
- <xsl:text> </xsl:text>
7355
- </xsl:if>
7356
- <xsl:value-of select="normalize-space(title)"/>
7357
- </fo:bookmark-title>
7358
- <xsl:apply-templates mode="bookmark"/>
7359
- </fo:bookmark>
7719
+ <xsl:choose>
7720
+ <xsl:when test="@id != ''">
7721
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
7722
+ <fo:bookmark-title>
7723
+ <xsl:if test="@section != ''">
7724
+ <xsl:value-of select="@section"/>
7725
+ <xsl:text> </xsl:text>
7726
+ </xsl:if>
7727
+ <xsl:value-of select="normalize-space(title)"/>
7728
+ </fo:bookmark-title>
7729
+ <xsl:apply-templates mode="bookmark"/>
7730
+ </fo:bookmark>
7731
+ </xsl:when>
7732
+ <xsl:otherwise>
7733
+ <xsl:apply-templates mode="bookmark"/>
7734
+ </xsl:otherwise>
7735
+ </xsl:choose>
7360
7736
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
7361
7737
  <xsl:if test="normalize-space() != ''">
7362
7738
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -7722,7 +8098,19 @@
7722
8098
  </fo:inline>
7723
8099
  </xsl:if>
7724
8100
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
7725
- <fo:inline><xsl:apply-templates/></fo:inline>
8101
+ <xsl:variable name="element">inline
8102
+
8103
+ </xsl:variable>
8104
+ <xsl:choose>
8105
+ <xsl:when test="contains($element, 'block')">
8106
+ <fo:block xsl:use-attribute-sets="example-p-style">
8107
+ <xsl:apply-templates/>
8108
+ </fo:block>
8109
+ </xsl:when>
8110
+ <xsl:otherwise>
8111
+ <fo:inline><xsl:apply-templates/></fo:inline>
8112
+ </xsl:otherwise>
8113
+ </xsl:choose>
7726
8114
  </xsl:template><xsl:template match="*[local-name() = 'example']">
7727
8115
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
7728
8116
 
@@ -7913,7 +8301,9 @@
7913
8301
 
7914
8302
 
7915
8303
  </xsl:if>
7916
-
8304
+
8305
+
8306
+
7917
8307
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7918
8308
  <xsl:if test="normalize-space(@citeas) = ''">
7919
8309
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -7924,6 +8314,13 @@
7924
8314
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
7925
8315
 
7926
8316
 
8317
+ <xsl:if test="parent::*[local-name() = 'title']">
8318
+ <xsl:attribute name="color">inherit</xsl:attribute>
8319
+ <xsl:attribute name="text-decoration">inherit</xsl:attribute>
8320
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
8321
+ </xsl:if>
8322
+
8323
+
7927
8324
 
7928
8325
  </xsl:if>
7929
8326
 
@@ -8329,8 +8726,8 @@
8329
8726
 
8330
8727
  </xsl:otherwise>
8331
8728
  </xsl:choose>
8729
+ <!-- end BIPM bibitem processing-->
8332
8730
 
8333
- <!-- end BIPM bibitem processing-->
8334
8731
 
8335
8732
 
8336
8733
 
@@ -8795,20 +9192,40 @@
8795
9192
  </xsl:call-template>
8796
9193
  </xsl:if>
8797
9194
  </xsl:template><xsl:template name="getLocalizedString">
8798
- <xsl:param name="key"/>
9195
+ <xsl:param name="key"/>
9196
+ <xsl:param name="formatted">false</xsl:param>
8799
9197
 
8800
9198
  <xsl:variable name="curr_lang">
8801
9199
  <xsl:call-template name="getLang"/>
8802
9200
  </xsl:variable>
8803
9201
 
8804
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9202
+ <xsl:variable name="data_value">
9203
+ <xsl:choose>
9204
+ <xsl:when test="$formatted = 'true'">
9205
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9206
+ </xsl:when>
9207
+ <xsl:otherwise>
9208
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9209
+ </xsl:otherwise>
9210
+ </xsl:choose>
9211
+ </xsl:variable>
8805
9212
 
8806
9213
  <xsl:choose>
8807
- <xsl:when test="$data_value != ''">
8808
- <xsl:value-of select="$data_value"/>
9214
+ <xsl:when test="normalize-space($data_value) != ''">
9215
+ <xsl:choose>
9216
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9217
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9218
+ </xsl:choose>
8809
9219
  </xsl:when>
8810
9220
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
8811
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9221
+ <xsl:choose>
9222
+ <xsl:when test="$formatted = 'true'">
9223
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9224
+ </xsl:when>
9225
+ <xsl:otherwise>
9226
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9227
+ </xsl:otherwise>
9228
+ </xsl:choose>
8812
9229
  </xsl:when>
8813
9230
  <xsl:otherwise>
8814
9231
  <xsl:variable name="key_">
@@ -8819,7 +9236,7 @@
8819
9236
  <xsl:value-of select="$key_"/>
8820
9237
  </xsl:otherwise>
8821
9238
  </xsl:choose>
8822
-
9239
+
8823
9240
  </xsl:template><xsl:template name="setTrackChangesStyles">
8824
9241
  <xsl:param name="isAdded"/>
8825
9242
  <xsl:param name="isDeleted"/>
@@ -8870,4 +9287,100 @@
8870
9287
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
8871
9288
  </xsl:choose>
8872
9289
  </xsl:attribute>
9290
+ </xsl:template><xsl:template name="number-to-words">
9291
+ <xsl:param name="number"/>
9292
+ <xsl:param name="first"/>
9293
+ <xsl:if test="$number != ''">
9294
+ <xsl:variable name="words">
9295
+ <words>
9296
+ <word cardinal="1">One-</word>
9297
+ <word ordinal="1">First </word>
9298
+ <word cardinal="2">Two-</word>
9299
+ <word ordinal="2">Second </word>
9300
+ <word cardinal="3">Three-</word>
9301
+ <word ordinal="3">Third </word>
9302
+ <word cardinal="4">Four-</word>
9303
+ <word ordinal="4">Fourth </word>
9304
+ <word cardinal="5">Five-</word>
9305
+ <word ordinal="5">Fifth </word>
9306
+ <word cardinal="6">Six-</word>
9307
+ <word ordinal="6">Sixth </word>
9308
+ <word cardinal="7">Seven-</word>
9309
+ <word ordinal="7">Seventh </word>
9310
+ <word cardinal="8">Eight-</word>
9311
+ <word ordinal="8">Eighth </word>
9312
+ <word cardinal="9">Nine-</word>
9313
+ <word ordinal="9">Ninth </word>
9314
+ <word ordinal="10">Tenth </word>
9315
+ <word ordinal="11">Eleventh </word>
9316
+ <word ordinal="12">Twelfth </word>
9317
+ <word ordinal="13">Thirteenth </word>
9318
+ <word ordinal="14">Fourteenth </word>
9319
+ <word ordinal="15">Fifteenth </word>
9320
+ <word ordinal="16">Sixteenth </word>
9321
+ <word ordinal="17">Seventeenth </word>
9322
+ <word ordinal="18">Eighteenth </word>
9323
+ <word ordinal="19">Nineteenth </word>
9324
+ <word cardinal="20">Twenty-</word>
9325
+ <word ordinal="20">Twentieth </word>
9326
+ <word cardinal="30">Thirty-</word>
9327
+ <word ordinal="30">Thirtieth </word>
9328
+ <word cardinal="40">Forty-</word>
9329
+ <word ordinal="40">Fortieth </word>
9330
+ <word cardinal="50">Fifty-</word>
9331
+ <word ordinal="50">Fiftieth </word>
9332
+ <word cardinal="60">Sixty-</word>
9333
+ <word ordinal="60">Sixtieth </word>
9334
+ <word cardinal="70">Seventy-</word>
9335
+ <word ordinal="70">Seventieth </word>
9336
+ <word cardinal="80">Eighty-</word>
9337
+ <word ordinal="80">Eightieth </word>
9338
+ <word cardinal="90">Ninety-</word>
9339
+ <word ordinal="90">Ninetieth </word>
9340
+ <word cardinal="100">Hundred-</word>
9341
+ <word ordinal="100">Hundredth </word>
9342
+ </words>
9343
+ </xsl:variable>
9344
+
9345
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
9346
+
9347
+ <xsl:variable name="value">
9348
+ <xsl:choose>
9349
+ <xsl:when test="$ordinal != ''">
9350
+ <xsl:value-of select="$ordinal"/>
9351
+ </xsl:when>
9352
+ <xsl:otherwise>
9353
+ <xsl:choose>
9354
+ <xsl:when test="$number &lt; 100">
9355
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
9356
+ <xsl:variable name="digit" select="substring($number,2)"/>
9357
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
9358
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
9359
+ </xsl:when>
9360
+ <xsl:otherwise>
9361
+ <!-- more 100 -->
9362
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
9363
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
9364
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
9365
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
9366
+ <xsl:call-template name="number-to-words">
9367
+ <xsl:with-param name="number" select="$digits"/>
9368
+ </xsl:call-template>
9369
+ </xsl:otherwise>
9370
+ </xsl:choose>
9371
+ </xsl:otherwise>
9372
+ </xsl:choose>
9373
+ </xsl:variable>
9374
+ <xsl:choose>
9375
+ <xsl:when test="$first = 'true'">
9376
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
9377
+ <xsl:call-template name="capitalize">
9378
+ <xsl:with-param name="str" select="$value_lc"/>
9379
+ </xsl:call-template>
9380
+ </xsl:when>
9381
+ <xsl:otherwise>
9382
+ <xsl:value-of select="$value"/>
9383
+ </xsl:otherwise>
9384
+ </xsl:choose>
9385
+ </xsl:if>
8873
9386
  </xsl:template></xsl:stylesheet>