metanorma-bipm 1.1.3 → 1.1.6

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) -->
@@ -1112,8 +1149,11 @@
1112
1149
 
1113
1150
  <xsl:variable name="title-toc">
1114
1151
  <fo:inline>
1115
- <xsl:call-template name="getTitle">
1152
+ <!-- <xsl:call-template name="getTitle">
1116
1153
  <xsl:with-param name="name" select="'title-toc'"/>
1154
+ </xsl:call-template> -->
1155
+ <xsl:call-template name="getLocalizedString">
1156
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1117
1157
  </xsl:call-template>
1118
1158
  </fo:inline>
1119
1159
  </xsl:variable>
@@ -1706,9 +1746,9 @@
1706
1746
  <!-- background color -->
1707
1747
  <fo:block-container absolute-position="fixed" left="0" top="-1mm">
1708
1748
  <fo:block>
1709
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
1710
- <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}" height="{$pageHeight}">
1711
- <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"/>
1712
1752
  </svg>
1713
1753
  </fo:instream-foreign-object>
1714
1754
  </fo:block>
@@ -2268,7 +2308,7 @@
2268
2308
  <xsl:when test="$level = 2 and ancestor::bipm:annex">10.5pt</xsl:when>
2269
2309
  <xsl:when test="$level = 2">14pt</xsl:when>
2270
2310
  <xsl:when test="$level = 3 and ancestor::bipm:annex">10pt</xsl:when>
2271
- <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>
2272
2312
  <xsl:when test="$level = 3">12pt</xsl:when>
2273
2313
  <xsl:otherwise>11pt</xsl:otherwise>
2274
2314
  </xsl:choose>
@@ -2364,8 +2404,10 @@
2364
2404
  </xsl:if> -->
2365
2405
  <xsl:choose>
2366
2406
  <xsl:when test="ancestor::bipm:annex and $level &gt;= 2">
2367
- <xsl:if test="$level = 3">
2407
+ <xsl:if test="$level &gt;= 3">
2368
2408
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2409
+ </xsl:if>
2410
+ <xsl:if test="$level = 3">
2369
2411
  <fo:inline padding-right="2.5mm" baseline-shift="15%">
2370
2412
  <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
2371
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">
@@ -2375,7 +2417,6 @@
2375
2417
  </fo:inline>
2376
2418
  </xsl:if>
2377
2419
  <xsl:if test="$level = 4">
2378
- <xsl:attribute name="margin-left">14mm</xsl:attribute>
2379
2420
  <xsl:attribute name="text-align">center</xsl:attribute>
2380
2421
  </xsl:if>
2381
2422
  <xsl:call-template name="extractTitle"/>
@@ -2900,11 +2941,13 @@
2900
2941
  <xsl:choose>
2901
2942
  <xsl:when test="$num = 1">
2902
2943
  <fo:inline xsl:use-attribute-sets="note-p-style">
2944
+ <xsl:attribute name="text-align">left</xsl:attribute>
2903
2945
  <xsl:apply-templates/>
2904
2946
  </fo:inline>
2905
2947
  </xsl:when>
2906
2948
  <xsl:otherwise>
2907
2949
  <fo:block xsl:use-attribute-sets="note-p-style">
2950
+ <xsl:attribute name="text-align">left</xsl:attribute>
2908
2951
  <xsl:apply-templates/>
2909
2952
  </fo:block>
2910
2953
  </xsl:otherwise>
@@ -2968,6 +3011,7 @@
2968
3011
  <xsl:attribute name="text-align">
2969
3012
  <xsl:choose>
2970
3013
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
3014
+ <xsl:when test="ancestor::*[local-name() = 'note_side']">left</xsl:when>
2971
3015
  <xsl:when test="../@align"><xsl:value-of select="../@align"/></xsl:when>
2972
3016
  <xsl:otherwise>justify</xsl:otherwise>
2973
3017
  </xsl:choose>
@@ -3075,9 +3119,10 @@
3075
3119
  <fo:inline>
3076
3120
  <!-- <xsl:if test="@list_type = 'ul'">
3077
3121
  <xsl:attribute name="font-size">15pt</xsl:attribute> -->
3078
- <xsl:if test="@font-size">
3079
- <xsl:attribute name="font-size"><xsl:value-of select="@font-size"/></xsl:attribute>
3080
- <!-- <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>
3081
3126
  </xsl:if>
3082
3127
  <xsl:value-of select="@label"/>
3083
3128
  </fo:inline>
@@ -3175,7 +3220,7 @@
3175
3220
  </xsl:template>
3176
3221
 
3177
3222
  <xsl:template match="bipm:example" priority="2">
3178
- <fo:block margin-top="6pt" margin-bottom="6pt">
3223
+ <fo:block margin-top="6pt" margin-bottom="6pt" keep-together.within-column="1">
3179
3224
  <fo:table table-layout="fixed" width="100%">
3180
3225
  <fo:table-column column-width="27.5mm"/>
3181
3226
  <fo:table-column column-width="108mm"/>
@@ -3321,6 +3366,11 @@
3321
3366
 
3322
3367
  <xsl:template match="bipm:xref" priority="2">
3323
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
+
3324
3374
  <xsl:choose>
3325
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). -->
3326
3376
  <fo:inline> <!-- font-weight="bold" -->
@@ -3477,6 +3527,12 @@
3477
3527
  <xsl:attribute name="separators"/>
3478
3528
  </xsl:if>
3479
3529
  <mathml:mspace width="-0.15em"/> <!-- decrease space between opening brackets and inside text-->
3530
+
3531
+ <!-- if there is previous or next mfenced with superscript, then increase height of Parentheses -->
3532
+ <xsl:if test="following-sibling::mathml:mfenced[.//mathml:msup] or preceding-sibling::mathml:mfenced[.//mathml:msup] or ancestor::*[following-sibling::mathml:mfenced[.//mathml:msup] or preceding-sibling::mathml:mfenced[.//mathml:msup]]">
3533
+ <mathml:mspace height="1.15em"/> <!-- increase height of parentheses -->
3534
+ </xsl:if>
3535
+
3480
3536
  <xsl:apply-templates mode="mathml"/>
3481
3537
  <mathml:mspace width="-0.1em"/> <!-- decrease space between inside text and closing brackets -->
3482
3538
  </xsl:copy>
@@ -3501,12 +3557,41 @@
3501
3557
  </xsl:template> -->
3502
3558
 
3503
3559
  <!-- Decrease height of / and | -->
3560
+ <!-- Decrease space before and after / -->
3504
3561
  <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml">
3505
3562
  <xsl:copy>
3506
3563
  <xsl:apply-templates select="@*" mode="mathml"/>
3507
- <xsl:if test="not(@stretchy) and not(preceding-sibling::*[1][local-name() = 'mfrac'] and following-sibling::*[1][local-name() = 'mfrac'])">
3508
- <xsl:attribute name="stretchy">false</xsl:attribute>
3564
+ <xsl:if test="not(@stretchy) and not(preceding-sibling::*[1][local-name() = 'mfrac'] and following-sibling::*[1][local-name() = 'mfrac'])">
3565
+ <xsl:attribute name="stretchy">false</xsl:attribute>
3566
+ </xsl:if>
3567
+ <xsl:if test="normalize-space(text()) = '/'">
3568
+ <xsl:if test="not(@lspace)">
3569
+ <xsl:attribute name="lspace">0em</xsl:attribute>
3570
+ <xsl:if test="preceding-sibling::*[1][local-name() = 'msub']">
3571
+ <xsl:attribute name="lspace">0.1em</xsl:attribute>
3572
+ </xsl:if>
3573
+ </xsl:if>
3574
+ <xsl:if test="not(@rspace)">
3575
+ <xsl:attribute name="rspace">0em</xsl:attribute>
3576
+ <xsl:if test="following-sibling::*[1][local-name() = 'mfenced']">
3577
+ <xsl:attribute name="rspace">-0.1em</xsl:attribute>
3578
+ </xsl:if>
3509
3579
  </xsl:if>
3580
+ </xsl:if>
3581
+ <xsl:apply-templates mode="mathml"/>
3582
+ </xsl:copy>
3583
+ </xsl:template>
3584
+
3585
+ <!-- Increase space before and after multiplication sign -->
3586
+ <xsl:template match="mathml:mo[normalize-space(text()) = '×']" mode="mathml"> <!-- multiplication sign -->
3587
+ <xsl:copy>
3588
+ <xsl:apply-templates select="@*" mode="mathml"/>
3589
+ <xsl:if test="not(@lspace)">
3590
+ <xsl:attribute name="lspace">0.5em</xsl:attribute>
3591
+ </xsl:if>
3592
+ <xsl:if test="not(@rspace)">
3593
+ <xsl:attribute name="rspace">0.5em</xsl:attribute>
3594
+ </xsl:if>
3510
3595
  <xsl:apply-templates mode="mathml"/>
3511
3596
  </xsl:copy>
3512
3597
  </xsl:template>
@@ -3525,6 +3610,29 @@
3525
3610
  </xsl:copy>
3526
3611
  </xsl:template>
3527
3612
 
3613
+ <!-- decrease space before and after sign 'minus' -->
3614
+ <xsl:template match="mathml:mo[normalize-space(text()) = '−']" mode="mathml"> <!-- minus sign -->
3615
+ <xsl:copy>
3616
+ <xsl:apply-templates select="@*" mode="mathml"/>
3617
+ <xsl:choose>
3618
+ <xsl:when test="not(preceding-sibling::*)"><!-- example: -0.234 -->
3619
+ <xsl:if test="not(@rspace)">
3620
+ <xsl:attribute name="rspace">0em</xsl:attribute>
3621
+ </xsl:if>
3622
+ </xsl:when>
3623
+ <xsl:otherwise>
3624
+ <xsl:if test="not(@lspace)">
3625
+ <xsl:attribute name="lspace">0.2em</xsl:attribute>
3626
+ </xsl:if>
3627
+ <xsl:if test="not(@rspace)">
3628
+ <xsl:attribute name="rspace">0.2em</xsl:attribute>
3629
+ </xsl:if>
3630
+ </xsl:otherwise>
3631
+ </xsl:choose>
3632
+ <xsl:apply-templates mode="mathml"/>
3633
+ </xsl:copy>
3634
+ </xsl:template>
3635
+
3528
3636
  <xsl:template match="mathml:mi[string-length(normalize-space()) &gt; 1]" mode="mathml" priority="2">
3529
3637
  <xsl:if test="preceding-sibling::* and preceding-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3530
3638
  <mathml:mspace width="0.3em"/>
@@ -3535,6 +3643,10 @@
3535
3643
  </xsl:if>
3536
3644
  </xsl:template>
3537
3645
 
3646
+ <xsl:template match="mathml:mn/text()" mode="mathml">
3647
+ <xsl:value-of select="translate(., ' ', ' ')"/>
3648
+ </xsl:template>
3649
+
3538
3650
  <xsl:template name="insertHeaderFooter">
3539
3651
  <xsl:param name="header-title"/>
3540
3652
  <xsl:param name="orientation"/>
@@ -4077,7 +4189,7 @@
4077
4189
  <!-- grey opacity -->
4078
4190
  <fo:block-container absolute-position="fixed" left="0" top="0">
4079
4191
  <fo:block>
4080
- <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">
4081
4193
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
4082
4194
  <rect width="215.9mm" height="279.4mm" style="fill:rgb(255,255,255);stroke-width:0;fill-opacity:0.73"/>
4083
4195
  </svg>
@@ -4396,7 +4508,7 @@
4396
4508
 
4397
4509
 
4398
4510
 
4399
-
4511
+
4400
4512
  </xsl:attribute-set><xsl:attribute-set name="example-style">
4401
4513
 
4402
4514
 
@@ -4456,7 +4568,10 @@
4456
4568
 
4457
4569
 
4458
4570
 
4459
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4571
+
4572
+ </xsl:attribute-set><xsl:variable name="table-border_">
4573
+
4574
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4460
4575
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4461
4576
 
4462
4577
 
@@ -4479,6 +4594,8 @@
4479
4594
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4480
4595
 
4481
4596
 
4597
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
4598
+
4482
4599
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
4483
4600
 
4484
4601
 
@@ -4499,6 +4616,7 @@
4499
4616
 
4500
4617
 
4501
4618
 
4619
+
4502
4620
  </xsl:attribute-set><xsl:attribute-set name="note-style">
4503
4621
 
4504
4622
 
@@ -4517,6 +4635,7 @@
4517
4635
 
4518
4636
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4519
4637
 
4638
+
4520
4639
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
4521
4640
 
4522
4641
 
@@ -4554,12 +4673,14 @@
4554
4673
 
4555
4674
 
4556
4675
 
4676
+
4557
4677
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
4558
4678
 
4559
4679
 
4560
4680
 
4561
4681
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4562
4682
 
4683
+
4563
4684
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
4564
4685
 
4565
4686
 
@@ -4609,6 +4730,7 @@
4609
4730
 
4610
4731
 
4611
4732
 
4733
+
4612
4734
 
4613
4735
 
4614
4736
 
@@ -4678,6 +4800,8 @@
4678
4800
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
4679
4801
 
4680
4802
 
4803
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
4804
+
4681
4805
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
4682
4806
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4683
4807
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -4688,14 +4812,15 @@
4688
4812
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
4689
4813
 
4690
4814
  <!-- Normative references -->
4691
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
4815
+ <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"/>
4692
4816
  <!-- Terms and definitions -->
4693
4817
  <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"/>
4694
4818
  <!-- Another main sections -->
4695
4819
  <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"/>
4696
4820
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
4697
4821
  <!-- Bibliography -->
4698
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
4822
+ <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"/>
4823
+
4699
4824
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
4700
4825
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
4701
4826
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -4731,13 +4856,15 @@
4731
4856
  <xsl:variable name="table">
4732
4857
 
4733
4858
  <xsl:variable name="simple-table">
4734
- <xsl:call-template name="getSimpleTable"/>
4859
+ <xsl:call-template name="getSimpleTable"/>
4735
4860
  </xsl:variable>
4736
4861
 
4737
4862
  <!-- <xsl:if test="$namespace = 'bipm'">
4738
- <fo:block>&#xA0;</fo:block>
4863
+ <fo:block>&#xA0;</fo:block>
4739
4864
  </xsl:if> -->
4740
4865
 
4866
+
4867
+ <!-- Display table's name before table as standalone block -->
4741
4868
  <!-- $namespace = 'iso' or -->
4742
4869
 
4743
4870
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4825,6 +4952,12 @@
4825
4952
  </xsl:if>
4826
4953
 
4827
4954
 
4955
+
4956
+
4957
+
4958
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
4959
+
4960
+
4828
4961
  <xsl:variable name="table_width">
4829
4962
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4830
4963
 
@@ -4848,6 +4981,7 @@
4848
4981
 
4849
4982
 
4850
4983
 
4984
+
4851
4985
 
4852
4986
 
4853
4987
 
@@ -4860,6 +4994,8 @@
4860
4994
  </xsl:if>
4861
4995
  <attribute name="margin-left">0mm</attribute>
4862
4996
  <attribute name="margin-right">0mm</attribute>
4997
+ <!-- <attribute name="keep-together.within-column">1</attribute> --> <!-- integer value instead 'always'! -->
4998
+
4863
4999
 
4864
5000
  </xsl:variable>
4865
5001
 
@@ -5006,6 +5142,9 @@
5006
5142
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
5007
5143
  </xsl:if>
5008
5144
 
5145
+
5146
+
5147
+
5009
5148
  <xsl:choose>
5010
5149
  <xsl:when test="$continued = 'true'">
5011
5150
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -5153,6 +5292,7 @@
5153
5292
  <!-- font-weight="bold" -->
5154
5293
  <fo:table-header>
5155
5294
 
5295
+
5156
5296
  <xsl:apply-templates/>
5157
5297
  </fo:table-header>
5158
5298
  </xsl:template><xsl:template name="table-header-title">
@@ -5279,6 +5419,8 @@
5279
5419
  </xsl:choose>
5280
5420
  </xsl:for-each>
5281
5421
 
5422
+
5423
+
5282
5424
  <xsl:choose>
5283
5425
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5284
5426
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5305,6 +5447,7 @@
5305
5447
 
5306
5448
 
5307
5449
 
5450
+
5308
5451
  <!-- fn will be processed inside 'note' processing -->
5309
5452
 
5310
5453
 
@@ -5313,7 +5456,6 @@
5313
5456
 
5314
5457
 
5315
5458
 
5316
-
5317
5459
  <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
5318
5460
  <fo:block font-weight="bold">
5319
5461
  <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
@@ -5325,6 +5467,12 @@
5325
5467
  </xsl:if>
5326
5468
 
5327
5469
 
5470
+
5471
+
5472
+
5473
+ <!-- for BSI (not PAS) display Notes before footnotes -->
5474
+
5475
+
5328
5476
  <!-- except gb -->
5329
5477
 
5330
5478
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -5350,6 +5498,10 @@
5350
5498
  <!-- fn processing -->
5351
5499
  <xsl:call-template name="fn_display"/>
5352
5500
 
5501
+
5502
+ <!-- for PAS display Notes after footnotes -->
5503
+
5504
+
5353
5505
  </fo:table-cell>
5354
5506
  </fo:table-row>
5355
5507
  </fo:table-body>
@@ -5403,10 +5555,13 @@
5403
5555
 
5404
5556
 
5405
5557
 
5558
+
5559
+
5406
5560
  </xsl:if>
5407
5561
  <xsl:if test="$parent-name = 'tfoot'">
5408
5562
 
5409
5563
 
5564
+
5410
5565
  </xsl:if>
5411
5566
 
5412
5567
 
@@ -5419,6 +5574,12 @@
5419
5574
  <xsl:attribute name="min-height">5mm</xsl:attribute>
5420
5575
  </xsl:if>
5421
5576
 
5577
+
5578
+
5579
+
5580
+
5581
+
5582
+
5422
5583
  <!-- <xsl:if test="$namespace = 'bipm'">
5423
5584
  <xsl:attribute name="height">8mm</xsl:attribute>
5424
5585
  </xsl:if> -->
@@ -5526,6 +5687,7 @@
5526
5687
 
5527
5688
 
5528
5689
 
5690
+
5529
5691
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
5530
5692
  <xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
5531
5693
  <xsl:if test="$rownum = 1">
@@ -5538,6 +5700,9 @@
5538
5700
  <xsl:attribute name="display-align">before</xsl:attribute>
5539
5701
  </xsl:if>
5540
5702
 
5703
+
5704
+
5705
+
5541
5706
  <xsl:if test=".//*[local-name() = 'table']">
5542
5707
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5543
5708
  </xsl:if>
@@ -5557,6 +5722,11 @@
5557
5722
  <xsl:if test="not(.//bipm:image)">
5558
5723
  <xsl:attribute name="line-stacking-strategy">font-height</xsl:attribute>
5559
5724
  </xsl:if>
5725
+ <!-- hanging indent for left column -->
5726
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'td'])">
5727
+ <xsl:attribute name="text-indent">-3mm</xsl:attribute>
5728
+ <xsl:attribute name="start-indent">3mm</xsl:attribute>
5729
+ </xsl:if>
5560
5730
 
5561
5731
  <xsl:apply-templates/>
5562
5732
  </fo:block>
@@ -5569,6 +5739,7 @@
5569
5739
 
5570
5740
 
5571
5741
 
5742
+
5572
5743
 
5573
5744
  <xsl:attribute name="text-align">justify</xsl:attribute>
5574
5745
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -5576,11 +5747,15 @@
5576
5747
  <xsl:attribute name="margin-top">18pt</xsl:attribute>
5577
5748
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
5578
5749
  </xsl:if>
5579
-
5580
5750
 
5581
5751
 
5752
+
5753
+ <!-- Table's note name (NOTE, for example) -->
5754
+
5582
5755
  <fo:inline padding-right="2mm">
5583
5756
 
5757
+
5758
+
5584
5759
 
5585
5760
 
5586
5761
 
@@ -5593,10 +5768,12 @@
5593
5768
 
5594
5769
  </fo:inline>
5595
5770
 
5771
+
5596
5772
  <xsl:if test="ancestor::bipm:preface">
5597
5773
  <fo:block> </fo:block>
5598
5774
  </xsl:if>
5599
5775
 
5776
+
5600
5777
  <xsl:apply-templates mode="process"/>
5601
5778
  </fo:block>
5602
5779
 
@@ -5616,6 +5793,8 @@
5616
5793
  <xsl:variable name="reference" select="@reference"/>
5617
5794
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5618
5795
  <fo:block margin-bottom="12pt">
5796
+
5797
+
5619
5798
 
5620
5799
 
5621
5800
 
@@ -5634,6 +5813,7 @@
5634
5813
 
5635
5814
 
5636
5815
 
5816
+
5637
5817
  <xsl:attribute name="font-style">italic</xsl:attribute>
5638
5818
 
5639
5819
  <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
@@ -5644,6 +5824,7 @@
5644
5824
  <fo:inline font-style="normal">)</fo:inline>
5645
5825
 
5646
5826
 
5827
+
5647
5828
  </fo:inline>
5648
5829
  <fo:inline>
5649
5830
 
@@ -5784,10 +5965,14 @@
5784
5965
 
5785
5966
 
5786
5967
 
5968
+
5969
+
5970
+
5787
5971
  <xsl:attribute name="font-size">70%</xsl:attribute>
5788
5972
  <xsl:attribute name="vertical-align">super</xsl:attribute>
5789
5973
  <xsl:attribute name="font-style">italic</xsl:attribute>
5790
5974
 
5975
+
5791
5976
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5792
5977
 
5793
5978
 
@@ -5797,6 +5982,7 @@
5797
5982
 
5798
5983
  <fo:inline font-style="normal">)</fo:inline>
5799
5984
 
5985
+
5800
5986
  </fo:basic-link>
5801
5987
  </fo:inline>
5802
5988
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -6098,6 +6284,7 @@
6098
6284
 
6099
6285
  <fo:table-row>
6100
6286
 
6287
+
6101
6288
  <fo:table-cell>
6102
6289
 
6103
6290
  <fo:block margin-top="6pt">
@@ -6116,6 +6303,7 @@
6116
6303
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
6117
6304
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
6118
6305
 
6306
+
6119
6307
  <xsl:apply-templates/>
6120
6308
  <!-- <xsl:if test="$namespace = 'gb'">
6121
6309
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -6655,6 +6843,9 @@
6655
6843
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6656
6844
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6657
6845
  </xsl:if>
6846
+ <!-- <xsl:attribute name="fox:alt-text">
6847
+ put AsciiMath/LaTeX math
6848
+ </xsl:attribute> -->
6658
6849
 
6659
6850
 
6660
6851
  <!-- <xsl:copy-of select="."/> -->
@@ -6674,7 +6865,15 @@
6674
6865
  <xsl:copy>
6675
6866
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
6676
6867
  </xsl:copy>
6677
- <mathml:mspace width="0.5ex"/>
6868
+ <xsl:choose>
6869
+ <!-- if in msub, then don't add space -->
6870
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
6871
+ <!-- if next char in digit, don't add space -->
6872
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
6873
+ <xsl:otherwise>
6874
+ <mathml:mspace width="0.5ex"/>
6875
+ </xsl:otherwise>
6876
+ </xsl:choose>
6678
6877
  </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">
6679
6878
  <xsl:variable name="target">
6680
6879
  <xsl:choose>
@@ -6698,6 +6897,8 @@
6698
6897
  </xsl:variable>
6699
6898
  <fo:inline xsl:use-attribute-sets="link-style">
6700
6899
 
6900
+
6901
+
6701
6902
  <xsl:choose>
6702
6903
  <xsl:when test="$target_text = ''">
6703
6904
  <xsl:apply-templates/>
@@ -6806,6 +7007,12 @@
6806
7007
 
6807
7008
 
6808
7009
 
7010
+
7011
+ <xsl:if test="parent::*[local-name() = 'li']">
7012
+ <xsl:attribute name="margin-top">4pt</xsl:attribute>
7013
+ <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
7014
+ </xsl:if>
7015
+
6809
7016
  <fo:block-container margin-left="0mm">
6810
7017
 
6811
7018
 
@@ -6856,6 +7063,7 @@
6856
7063
  </xsl:choose>
6857
7064
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
6858
7065
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
7066
+
6859
7067
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6860
7068
 
6861
7069
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -6937,6 +7145,7 @@
6937
7145
  </xsl:call-template>
6938
7146
 
6939
7147
  <fo:block>
7148
+
6940
7149
  <xsl:apply-templates/>
6941
7150
  </fo:block>
6942
7151
  <xsl:call-template name="fn_display_figure"/>
@@ -6991,7 +7200,24 @@
6991
7200
  </fo:instream-foreign-object>
6992
7201
  </xsl:when>
6993
7202
  <xsl:otherwise>
6994
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7203
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7204
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7205
+
7206
+ <xsl:variable name="img_src">
7207
+ <xsl:choose>
7208
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7209
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7210
+ </xsl:choose>
7211
+ </xsl:variable>
7212
+
7213
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7214
+ <xsl:if test="number($scale) &lt; 100">
7215
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7216
+ </xsl:if>
7217
+
7218
+ </xsl:if>
7219
+
7220
+ </fo:external-graphic>
6995
7221
  </xsl:otherwise>
6996
7222
  </xsl:choose>
6997
7223
 
@@ -7059,6 +7285,253 @@
7059
7285
  <xsl:param name="height"/>
7060
7286
  <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; "/>
7061
7287
  <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; "/>
7288
+ </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">
7289
+ <xsl:param name="name"/>
7290
+
7291
+ <xsl:variable name="svg_content">
7292
+ <xsl:apply-templates select="." mode="svg_update"/>
7293
+ </xsl:variable>
7294
+
7295
+ <xsl:variable name="alt-text">
7296
+ <xsl:choose>
7297
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
7298
+ <xsl:value-of select="../*[local-name() = 'name']"/>
7299
+ </xsl:when>
7300
+ <xsl:when test="normalize-space($name) != ''">
7301
+ <xsl:value-of select="$name"/>
7302
+ </xsl:when>
7303
+ <xsl:otherwise>Figure</xsl:otherwise>
7304
+ </xsl:choose>
7305
+ </xsl:variable>
7306
+
7307
+ <xsl:choose>
7308
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
7309
+ <fo:block>
7310
+ <xsl:variable name="width" select="@width"/>
7311
+ <xsl:variable name="height" select="@height"/>
7312
+
7313
+ <xsl:variable name="scale_x">
7314
+ <xsl:choose>
7315
+ <xsl:when test="$width &gt; $width_effective_px">
7316
+ <xsl:value-of select="$width_effective_px div $width"/>
7317
+ </xsl:when>
7318
+ <xsl:otherwise>1</xsl:otherwise>
7319
+ </xsl:choose>
7320
+ </xsl:variable>
7321
+
7322
+ <xsl:variable name="scale_y">
7323
+ <xsl:choose>
7324
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
7325
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
7326
+ </xsl:when>
7327
+ <xsl:otherwise>1</xsl:otherwise>
7328
+ </xsl:choose>
7329
+ </xsl:variable>
7330
+
7331
+ <xsl:variable name="scale">
7332
+ <xsl:choose>
7333
+ <xsl:when test="$scale_y != 1">
7334
+ <xsl:value-of select="$scale_x * $scale_y"/>
7335
+ </xsl:when>
7336
+ <xsl:otherwise>
7337
+ <xsl:value-of select="$scale_x"/>
7338
+ </xsl:otherwise>
7339
+ </xsl:choose>
7340
+ </xsl:variable>
7341
+
7342
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
7343
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
7344
+
7345
+ <fo:table table-layout="fixed" width="100%">
7346
+ <fo:table-column column-width="proportional-column-width(1)"/>
7347
+ <fo:table-column column-width="{$width_scale}px"/>
7348
+ <fo:table-column column-width="proportional-column-width(1)"/>
7349
+ <fo:table-body>
7350
+ <fo:table-row>
7351
+ <fo:table-cell column-number="2">
7352
+ <fo:block>
7353
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
7354
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
7355
+ <fo:block line-height="0" font-size="0">
7356
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
7357
+ <xsl:call-template name="bookmark"/>
7358
+ </xsl:for-each>
7359
+ </fo:block>
7360
+ </xsl:if>
7361
+ <fo:block text-depth="0" line-height="0" font-size="0">
7362
+
7363
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7364
+ <xsl:attribute name="width">100%</xsl:attribute>
7365
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7366
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7367
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7368
+
7369
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
7370
+ </fo:instream-foreign-object>
7371
+ </fo:block>
7372
+
7373
+ <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">
7374
+ <xsl:with-param name="scale" select="$scale"/>
7375
+ </xsl:apply-templates>
7376
+ </fo:block-container>
7377
+ </fo:block>
7378
+ </fo:table-cell>
7379
+ </fo:table-row>
7380
+ </fo:table-body>
7381
+ </fo:table>
7382
+ </fo:block>
7383
+
7384
+ </xsl:when>
7385
+ <xsl:otherwise>
7386
+ <fo:block xsl:use-attribute-sets="image-style">
7387
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7388
+ <xsl:attribute name="width">100%</xsl:attribute>
7389
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7390
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7391
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7392
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7393
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7394
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7395
+ <!-- effective height / width = 1.48, 1.4 - with title -->
7396
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7397
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7398
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7399
+ </xsl:if>
7400
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7401
+ <xsl:copy-of select="$svg_content"/>
7402
+ </fo:instream-foreign-object>
7403
+ </fo:block>
7404
+ </xsl:otherwise>
7405
+ </xsl:choose>
7406
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
7407
+ <xsl:copy>
7408
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
7409
+ </xsl:copy>
7410
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
7411
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7412
+ <xsl:value-of select="."/>
7413
+ </xsl:attribute>
7414
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7415
+ <xsl:copy>
7416
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7417
+ <xsl:variable name="viewbox">
7418
+ <xsl:call-template name="split">
7419
+ <xsl:with-param name="pText" select="@viewBox"/>
7420
+ <xsl:with-param name="sep" select="' '"/>
7421
+ </xsl:call-template>
7422
+ </xsl:variable>
7423
+ <xsl:attribute name="width">
7424
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7425
+ </xsl:attribute>
7426
+ <xsl:attribute name="height">
7427
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7428
+ </xsl:attribute>
7429
+ <xsl:apply-templates mode="svg_update"/>
7430
+ </xsl:copy>
7431
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7432
+ <xsl:variable name="svg_content" select="document(@src)"/>
7433
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
7434
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
7435
+ <xsl:call-template name="image_svg">
7436
+ <xsl:with-param name="name" select="$name"/>
7437
+ </xsl:call-template>
7438
+ </xsl:for-each>
7439
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
7440
+ <xsl:copy>
7441
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
7442
+ </xsl:copy>
7443
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
7444
+ <xsl:apply-templates mode="svg_remove_a"/>
7445
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
7446
+ <xsl:param name="scale"/>
7447
+ <xsl:variable name="dest">
7448
+ <xsl:choose>
7449
+ <xsl:when test="starts-with(@href, '#')">
7450
+ <xsl:value-of select="substring-after(@href, '#')"/>
7451
+ </xsl:when>
7452
+ <xsl:otherwise>
7453
+ <xsl:value-of select="@href"/>
7454
+ </xsl:otherwise>
7455
+ </xsl:choose>
7456
+ </xsl:variable>
7457
+ <xsl:for-each select="./*[local-name() = 'rect']">
7458
+ <xsl:call-template name="insertSVGMapLink">
7459
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
7460
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
7461
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
7462
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
7463
+ <xsl:with-param name="dest" select="$dest"/>
7464
+ </xsl:call-template>
7465
+ </xsl:for-each>
7466
+
7467
+ <xsl:for-each select="./*[local-name() = 'polygon']">
7468
+ <xsl:variable name="points">
7469
+ <xsl:call-template name="split">
7470
+ <xsl:with-param name="pText" select="@points"/>
7471
+ </xsl:call-template>
7472
+ </xsl:variable>
7473
+ <xsl:variable name="x_coords">
7474
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
7475
+ <xsl:sort select="." data-type="number"/>
7476
+ <x><xsl:value-of select="."/></x>
7477
+ </xsl:for-each>
7478
+ </xsl:variable>
7479
+ <xsl:variable name="y_coords">
7480
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
7481
+ <xsl:sort select="." data-type="number"/>
7482
+ <y><xsl:value-of select="."/></y>
7483
+ </xsl:for-each>
7484
+ </xsl:variable>
7485
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
7486
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
7487
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
7488
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
7489
+ <xsl:call-template name="insertSVGMapLink">
7490
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
7491
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
7492
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
7493
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
7494
+ <xsl:with-param name="dest" select="$dest"/>
7495
+ </xsl:call-template>
7496
+ </xsl:for-each>
7497
+
7498
+ <xsl:for-each select="./*[local-name() = 'circle']">
7499
+ <xsl:call-template name="insertSVGMapLink">
7500
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
7501
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
7502
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
7503
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
7504
+ <xsl:with-param name="dest" select="$dest"/>
7505
+ </xsl:call-template>
7506
+ </xsl:for-each>
7507
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
7508
+ <xsl:call-template name="insertSVGMapLink">
7509
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
7510
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
7511
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
7512
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
7513
+ <xsl:with-param name="dest" select="$dest"/>
7514
+ </xsl:call-template>
7515
+ </xsl:for-each>
7516
+ </xsl:template><xsl:template name="insertSVGMapLink">
7517
+ <xsl:param name="left"/>
7518
+ <xsl:param name="top"/>
7519
+ <xsl:param name="width"/>
7520
+ <xsl:param name="height"/>
7521
+ <xsl:param name="dest"/>
7522
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
7523
+ <fo:block font-size="1pt">
7524
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7525
+ <fo:inline-container inline-progression-dimension="100%">
7526
+ <fo:block-container height="{$height - 1}px" width="100%">
7527
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7528
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7529
+ </xsl:if> -->
7530
+ <fo:block> </fo:block></fo:block-container>
7531
+ </fo:inline-container>
7532
+ </fo:basic-link>
7533
+ </fo:block>
7534
+ </fo:block-container>
7062
7535
  </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">
7063
7536
  <xsl:apply-templates mode="contents"/>
7064
7537
  <xsl:text> </xsl:text>
@@ -7087,28 +7560,39 @@
7087
7560
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
7088
7561
  <xsl:for-each select="xalan:nodeset($contents)/doc">
7089
7562
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7563
+ <xsl:if test="@bundle = 'true'">
7564
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
7565
+ </xsl:if>
7090
7566
  <fo:bookmark-title>
7091
- <xsl:variable name="bookmark-title_">
7092
- <xsl:call-template name="getLangVersion">
7093
- <xsl:with-param name="lang" select="@lang"/>
7094
- <xsl:with-param name="doctype" select="@doctype"/>
7095
- <xsl:with-param name="title" select="@title-part"/>
7096
- </xsl:call-template>
7097
- </xsl:variable>
7098
7567
  <xsl:choose>
7099
- <xsl:when test="normalize-space($bookmark-title_) != ''">
7100
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
7101
- </xsl:when>
7102
- <xsl:otherwise>
7568
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
7569
+ <xsl:variable name="bookmark-title_">
7570
+ <xsl:call-template name="getLangVersion">
7571
+ <xsl:with-param name="lang" select="@lang"/>
7572
+ <xsl:with-param name="doctype" select="@doctype"/>
7573
+ <xsl:with-param name="title" select="@title-part"/>
7574
+ </xsl:call-template>
7575
+ </xsl:variable>
7103
7576
  <xsl:choose>
7104
- <xsl:when test="@lang = 'en'">English</xsl:when>
7105
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
7106
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
7107
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
7577
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
7578
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
7579
+ </xsl:when>
7580
+ <xsl:otherwise>
7581
+ <xsl:choose>
7582
+ <xsl:when test="@lang = 'en'">English</xsl:when>
7583
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
7584
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
7585
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
7586
+ </xsl:choose>
7587
+ </xsl:otherwise>
7108
7588
  </xsl:choose>
7589
+ </xsl:when>
7590
+ <xsl:otherwise>
7591
+ <xsl:value-of select="@title-part"/>
7109
7592
  </xsl:otherwise>
7110
7593
  </xsl:choose>
7111
7594
  </fo:bookmark-title>
7595
+
7112
7596
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
7113
7597
 
7114
7598
  <xsl:call-template name="insertFigureBookmarks">
@@ -7221,20 +7705,28 @@
7221
7705
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
7222
7706
  </xsl:choose>
7223
7707
  </xsl:template><xsl:template match="item" mode="bookmark">
7224
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
7225
- <fo:bookmark-title>
7226
- <xsl:if test="@section != ''">
7227
- <xsl:value-of select="@section"/>
7228
- <xsl:text> </xsl:text>
7229
- </xsl:if>
7230
- <xsl:value-of select="normalize-space(title)"/>
7231
- </fo:bookmark-title>
7232
- <xsl:apply-templates mode="bookmark"/>
7233
- </fo:bookmark>
7708
+ <xsl:choose>
7709
+ <xsl:when test="@id != ''">
7710
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
7711
+ <fo:bookmark-title>
7712
+ <xsl:if test="@section != ''">
7713
+ <xsl:value-of select="@section"/>
7714
+ <xsl:text> </xsl:text>
7715
+ </xsl:if>
7716
+ <xsl:value-of select="normalize-space(title)"/>
7717
+ </fo:bookmark-title>
7718
+ <xsl:apply-templates mode="bookmark"/>
7719
+ </fo:bookmark>
7720
+ </xsl:when>
7721
+ <xsl:otherwise>
7722
+ <xsl:apply-templates mode="bookmark"/>
7723
+ </xsl:otherwise>
7724
+ </xsl:choose>
7234
7725
  </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">
7235
7726
  <xsl:if test="normalize-space() != ''">
7236
7727
  <fo:block xsl:use-attribute-sets="figure-name-style">
7237
7728
 
7729
+
7238
7730
  <xsl:apply-templates/>
7239
7731
  </fo:block>
7240
7732
  </xsl:if>
@@ -7315,6 +7807,7 @@
7315
7807
 
7316
7808
  <fo:block-container margin-left="0mm">
7317
7809
  <xsl:copy-of select="@id"/>
7810
+
7318
7811
  <xsl:if test="parent::*[local-name() = 'note']">
7319
7812
  <xsl:attribute name="margin-left">
7320
7813
  <xsl:choose>
@@ -7325,7 +7818,9 @@
7325
7818
 
7326
7819
  </xsl:if>
7327
7820
  <fo:block-container margin-left="0mm">
7328
-
7821
+
7822
+
7823
+
7329
7824
  <fo:block xsl:use-attribute-sets="sourcecode-style">
7330
7825
  <xsl:variable name="_font-size">
7331
7826
 
@@ -7354,10 +7849,14 @@
7354
7849
  </xsl:choose>
7355
7850
  </xsl:attribute>
7356
7851
  </xsl:if>
7357
- <xsl:apply-templates/>
7358
- </fo:block>
7852
+
7853
+ <xsl:apply-templates/>
7854
+ </fo:block>
7855
+
7856
+
7359
7857
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
7360
7858
 
7859
+
7361
7860
  </fo:block-container>
7362
7861
  </fo:block-container>
7363
7862
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -7702,6 +8201,8 @@
7702
8201
 
7703
8202
 
7704
8203
 
8204
+
8205
+
7705
8206
  <xsl:value-of select="$localized.source"/>
7706
8207
  <xsl:text> </xsl:text>
7707
8208
 
@@ -7777,7 +8278,9 @@
7777
8278
 
7778
8279
 
7779
8280
  </xsl:if>
7780
-
8281
+
8282
+
8283
+
7781
8284
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7782
8285
  <xsl:if test="normalize-space(@citeas) = ''">
7783
8286
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -7788,6 +8291,13 @@
7788
8291
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
7789
8292
 
7790
8293
 
8294
+ <xsl:if test="parent::*[local-name() = 'title']">
8295
+ <xsl:attribute name="color">inherit</xsl:attribute>
8296
+ <xsl:attribute name="text-decoration">inherit</xsl:attribute>
8297
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
8298
+ </xsl:if>
8299
+
8300
+
7791
8301
 
7792
8302
  </xsl:if>
7793
8303
 
@@ -7931,6 +8441,7 @@
7931
8441
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
7932
8442
 
7933
8443
 
8444
+
7934
8445
  <xsl:apply-templates/>
7935
8446
  </fo:block>
7936
8447
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -8207,17 +8718,17 @@
8207
8718
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
8208
8719
  <xsl:choose>
8209
8720
  <xsl:when test="normalize-space($_doc_ident) != ''">
8210
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
8721
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
8211
8722
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8212
8723
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8213
- </xsl:if>
8724
+ </xsl:if> -->
8214
8725
  <xsl:value-of select="$_doc_ident"/>
8215
8726
  </xsl:when>
8216
8727
  <xsl:otherwise>
8217
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8728
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8218
8729
  <xsl:if test="$type != ''">
8219
8730
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8220
- </xsl:if>
8731
+ </xsl:if> -->
8221
8732
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
8222
8733
  </xsl:otherwise>
8223
8734
  </xsl:choose>
@@ -8658,20 +9169,40 @@
8658
9169
  </xsl:call-template>
8659
9170
  </xsl:if>
8660
9171
  </xsl:template><xsl:template name="getLocalizedString">
8661
- <xsl:param name="key"/>
9172
+ <xsl:param name="key"/>
9173
+ <xsl:param name="formatted">false</xsl:param>
8662
9174
 
8663
9175
  <xsl:variable name="curr_lang">
8664
9176
  <xsl:call-template name="getLang"/>
8665
9177
  </xsl:variable>
8666
9178
 
8667
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9179
+ <xsl:variable name="data_value">
9180
+ <xsl:choose>
9181
+ <xsl:when test="$formatted = 'true'">
9182
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9183
+ </xsl:when>
9184
+ <xsl:otherwise>
9185
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
9188
+ </xsl:variable>
8668
9189
 
8669
9190
  <xsl:choose>
8670
- <xsl:when test="$data_value != ''">
8671
- <xsl:value-of select="$data_value"/>
9191
+ <xsl:when test="normalize-space($data_value) != ''">
9192
+ <xsl:choose>
9193
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9194
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9195
+ </xsl:choose>
8672
9196
  </xsl:when>
8673
9197
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
8674
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9198
+ <xsl:choose>
9199
+ <xsl:when test="$formatted = 'true'">
9200
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9201
+ </xsl:when>
9202
+ <xsl:otherwise>
9203
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9204
+ </xsl:otherwise>
9205
+ </xsl:choose>
8675
9206
  </xsl:when>
8676
9207
  <xsl:otherwise>
8677
9208
  <xsl:variable name="key_">
@@ -8682,7 +9213,7 @@
8682
9213
  <xsl:value-of select="$key_"/>
8683
9214
  </xsl:otherwise>
8684
9215
  </xsl:choose>
8685
-
9216
+
8686
9217
  </xsl:template><xsl:template name="setTrackChangesStyles">
8687
9218
  <xsl:param name="isAdded"/>
8688
9219
  <xsl:param name="isDeleted"/>
@@ -8723,4 +9254,110 @@
8723
9254
  <xsl:value-of select="$align"/>
8724
9255
  </xsl:when>
8725
9256
  </xsl:choose>
9257
+ </xsl:template><xsl:template name="setTextAlignment">
9258
+ <xsl:param name="default">left</xsl:param>
9259
+ <xsl:attribute name="text-align">
9260
+ <xsl:choose>
9261
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
9262
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
9263
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
9264
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
9265
+ </xsl:choose>
9266
+ </xsl:attribute>
9267
+ </xsl:template><xsl:template name="number-to-words">
9268
+ <xsl:param name="number"/>
9269
+ <xsl:param name="first"/>
9270
+ <xsl:if test="$number != ''">
9271
+ <xsl:variable name="words">
9272
+ <words>
9273
+ <word cardinal="1">One-</word>
9274
+ <word ordinal="1">First </word>
9275
+ <word cardinal="2">Two-</word>
9276
+ <word ordinal="2">Second </word>
9277
+ <word cardinal="3">Three-</word>
9278
+ <word ordinal="3">Third </word>
9279
+ <word cardinal="4">Four-</word>
9280
+ <word ordinal="4">Fourth </word>
9281
+ <word cardinal="5">Five-</word>
9282
+ <word ordinal="5">Fifth </word>
9283
+ <word cardinal="6">Six-</word>
9284
+ <word ordinal="6">Sixth </word>
9285
+ <word cardinal="7">Seven-</word>
9286
+ <word ordinal="7">Seventh </word>
9287
+ <word cardinal="8">Eight-</word>
9288
+ <word ordinal="8">Eighth </word>
9289
+ <word cardinal="9">Nine-</word>
9290
+ <word ordinal="9">Ninth </word>
9291
+ <word ordinal="10">Tenth </word>
9292
+ <word ordinal="11">Eleventh </word>
9293
+ <word ordinal="12">Twelfth </word>
9294
+ <word ordinal="13">Thirteenth </word>
9295
+ <word ordinal="14">Fourteenth </word>
9296
+ <word ordinal="15">Fifteenth </word>
9297
+ <word ordinal="16">Sixteenth </word>
9298
+ <word ordinal="17">Seventeenth </word>
9299
+ <word ordinal="18">Eighteenth </word>
9300
+ <word ordinal="19">Nineteenth </word>
9301
+ <word cardinal="20">Twenty-</word>
9302
+ <word ordinal="20">Twentieth </word>
9303
+ <word cardinal="30">Thirty-</word>
9304
+ <word ordinal="30">Thirtieth </word>
9305
+ <word cardinal="40">Forty-</word>
9306
+ <word ordinal="40">Fortieth </word>
9307
+ <word cardinal="50">Fifty-</word>
9308
+ <word ordinal="50">Fiftieth </word>
9309
+ <word cardinal="60">Sixty-</word>
9310
+ <word ordinal="60">Sixtieth </word>
9311
+ <word cardinal="70">Seventy-</word>
9312
+ <word ordinal="70">Seventieth </word>
9313
+ <word cardinal="80">Eighty-</word>
9314
+ <word ordinal="80">Eightieth </word>
9315
+ <word cardinal="90">Ninety-</word>
9316
+ <word ordinal="90">Ninetieth </word>
9317
+ <word cardinal="100">Hundred-</word>
9318
+ <word ordinal="100">Hundredth </word>
9319
+ </words>
9320
+ </xsl:variable>
9321
+
9322
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
9323
+
9324
+ <xsl:variable name="value">
9325
+ <xsl:choose>
9326
+ <xsl:when test="$ordinal != ''">
9327
+ <xsl:value-of select="$ordinal"/>
9328
+ </xsl:when>
9329
+ <xsl:otherwise>
9330
+ <xsl:choose>
9331
+ <xsl:when test="$number &lt; 100">
9332
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
9333
+ <xsl:variable name="digit" select="substring($number,2)"/>
9334
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
9335
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
9336
+ </xsl:when>
9337
+ <xsl:otherwise>
9338
+ <!-- more 100 -->
9339
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
9340
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
9341
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
9342
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
9343
+ <xsl:call-template name="number-to-words">
9344
+ <xsl:with-param name="number" select="$digits"/>
9345
+ </xsl:call-template>
9346
+ </xsl:otherwise>
9347
+ </xsl:choose>
9348
+ </xsl:otherwise>
9349
+ </xsl:choose>
9350
+ </xsl:variable>
9351
+ <xsl:choose>
9352
+ <xsl:when test="$first = 'true'">
9353
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
9354
+ <xsl:call-template name="capitalize">
9355
+ <xsl:with-param name="str" select="$value_lc"/>
9356
+ </xsl:call-template>
9357
+ </xsl:when>
9358
+ <xsl:otherwise>
9359
+ <xsl:value-of select="$value"/>
9360
+ </xsl:otherwise>
9361
+ </xsl:choose>
9362
+ </xsl:if>
8726
9363
  </xsl:template></xsl:stylesheet>