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.
@@ -76,8 +76,13 @@
76
76
  <xsl:variable name="column_width" select="($page_width - $column_gap) div $docs_count"/>
77
77
 
78
78
  <xsl:variable name="debug">false</xsl:variable>
79
- <xsl:variable name="pageWidth" select="'210mm'"/>
80
- <xsl:variable name="pageHeight" select="'297mm'"/>
79
+ <xsl:variable name="pageWidth" select="210"/>
80
+ <xsl:variable name="pageHeight" select="297"/>
81
+ <xsl:variable name="marginLeftRight1" select="25"/>
82
+ <xsl:variable name="marginLeftRight2" select="15"/>
83
+ <xsl:variable name="marginTop" select="29.5"/>
84
+ <xsl:variable name="marginBottom" select="23.5"/>
85
+
81
86
 
82
87
  <xsl:variable name="all_rights_reserved">
83
88
  <xsl:call-template name="getLocalizedString">
@@ -161,7 +166,7 @@
161
166
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
162
167
  <fo:layout-master-set>
163
168
  <!-- cover page -->
164
- <fo:simple-page-master master-name="cover-page-jcgm" page-width="{$pageWidth}" page-height="{$pageHeight}">
169
+ <fo:simple-page-master master-name="cover-page-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
165
170
  <fo:region-body margin-top="85mm" margin-bottom="30mm" margin-left="100mm" margin-right="19mm"/>
166
171
  <fo:region-before extent="85mm"/>
167
172
  <fo:region-after region-name="cover-page-jcgm-footer" extent="30mm"/>
@@ -169,7 +174,7 @@
169
174
  <fo:region-end extent="19mm"/>
170
175
  </fo:simple-page-master>
171
176
  <!-- internal cover page -->
172
- <fo:simple-page-master master-name="internal-cover-page-jcgm" page-width="{$pageWidth}" page-height="{$pageHeight}">
177
+ <fo:simple-page-master master-name="internal-cover-page-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
173
178
  <fo:region-body margin-top="11mm" margin-bottom="21mm" margin-left="25mm" margin-right="19mm"/>
174
179
  <fo:region-before extent="11mm"/>
175
180
  <fo:region-after region-name="internal-cover-page-jcgm-footer" extent="21mm"/>
@@ -177,19 +182,19 @@
177
182
  <fo:region-end extent="19mm"/>
178
183
  </fo:simple-page-master>
179
184
 
180
- <fo:simple-page-master master-name="odd-jcgm" page-width="{$pageWidth}" page-height="{$pageHeight}">
181
- <fo:region-body margin-top="29.5mm" margin-bottom="23.5mm" margin-left="25mm" margin-right="15mm"/>
182
- <fo:region-before region-name="header-odd-jcgm" extent="29.5mm"/> <!-- display-align="center" -->
183
- <fo:region-after region-name="footer-odd-jcgm" extent="23.5mm"/>
184
- <fo:region-start region-name="left-region" extent="25mm"/>
185
- <fo:region-end region-name="right-region" extent="15mm"/>
185
+ <fo:simple-page-master master-name="odd-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
186
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
187
+ <fo:region-before region-name="header-odd-jcgm" extent="{$marginTop}mm"/> <!-- display-align="center" -->
188
+ <fo:region-after region-name="footer-odd-jcgm" extent="{$marginBottom}mm"/>
189
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
190
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
186
191
  </fo:simple-page-master>
187
- <fo:simple-page-master master-name="even-jcgm" page-width="{$pageWidth}" page-height="{$pageHeight}">
188
- <fo:region-body margin-top="29.5mm" margin-bottom="23.5mm" margin-left="15mm" margin-right="25mm"/>
189
- <fo:region-before region-name="header-even-jcgm" extent="29.5mm"/> <!-- display-align="center" -->
190
- <fo:region-after region-name="footer-even-jcgm" extent="23.5mm"/>
191
- <fo:region-start region-name="left-region" extent="15mm"/>
192
- <fo:region-end region-name="right-region" extent="25mm"/>
192
+ <fo:simple-page-master master-name="even-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
193
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
194
+ <fo:region-before region-name="header-even-jcgm" extent="{$marginTop}mm"/> <!-- display-align="center" -->
195
+ <fo:region-after region-name="footer-even-jcgm" extent="{$marginBottom}mm"/>
196
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
197
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
193
198
  </fo:simple-page-master>
194
199
  <fo:page-sequence-master master-name="document-jcgm">
195
200
  <fo:repeatable-page-master-alternatives>
@@ -1162,89 +1167,6 @@
1162
1167
  </fo:block>
1163
1168
  </xsl:template>
1164
1169
 
1165
-
1166
-
1167
- <xsl:template name="number-to-words">
1168
- <xsl:param name="number"/>
1169
- <xsl:variable name="words">
1170
- <words>
1171
- <word cardinal="1">One-</word>
1172
- <word ordinal="1">First </word>
1173
- <word cardinal="2">Two-</word>
1174
- <word ordinal="2">Second </word>
1175
- <word cardinal="3">Three-</word>
1176
- <word ordinal="3">Third </word>
1177
- <word cardinal="4">Four-</word>
1178
- <word ordinal="4">Fourth </word>
1179
- <word cardinal="5">Five-</word>
1180
- <word ordinal="5">Fifth </word>
1181
- <word cardinal="6">Six-</word>
1182
- <word ordinal="6">Sixth </word>
1183
- <word cardinal="7">Seven-</word>
1184
- <word ordinal="7">Seventh </word>
1185
- <word cardinal="8">Eight-</word>
1186
- <word ordinal="8">Eighth </word>
1187
- <word cardinal="9">Nine-</word>
1188
- <word ordinal="9">Ninth </word>
1189
- <word ordinal="10">Tenth </word>
1190
- <word ordinal="11">Eleventh </word>
1191
- <word ordinal="12">Twelfth </word>
1192
- <word ordinal="13">Thirteenth </word>
1193
- <word ordinal="14">Fourteenth </word>
1194
- <word ordinal="15">Fifteenth </word>
1195
- <word ordinal="16">Sixteenth </word>
1196
- <word ordinal="17">Seventeenth </word>
1197
- <word ordinal="18">Eighteenth </word>
1198
- <word ordinal="19">Nineteenth </word>
1199
- <word cardinal="20">Twenty-</word>
1200
- <word ordinal="20">Twentieth </word>
1201
- <word cardinal="30">Thirty-</word>
1202
- <word ordinal="30">Thirtieth </word>
1203
- <word cardinal="40">Forty-</word>
1204
- <word ordinal="40">Fortieth </word>
1205
- <word cardinal="50">Fifty-</word>
1206
- <word ordinal="50">Fiftieth </word>
1207
- <word cardinal="60">Sixty-</word>
1208
- <word ordinal="60">Sixtieth </word>
1209
- <word cardinal="70">Seventy-</word>
1210
- <word ordinal="70">Seventieth </word>
1211
- <word cardinal="80">Eighty-</word>
1212
- <word ordinal="80">Eightieth </word>
1213
- <word cardinal="90">Ninety-</word>
1214
- <word ordinal="90">Ninetieth </word>
1215
- <word cardinal="100">Hundred-</word>
1216
- <word ordinal="100">Hundredth </word>
1217
- </words>
1218
- </xsl:variable>
1219
-
1220
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1221
-
1222
- <xsl:choose>
1223
- <xsl:when test="$ordinal != ''">
1224
- <xsl:value-of select="$ordinal"/>
1225
- </xsl:when>
1226
- <xsl:otherwise>
1227
- <xsl:choose>
1228
- <xsl:when test="$number &lt; 100">
1229
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1230
- <xsl:variable name="digit" select="substring($number,2)"/>
1231
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1232
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1233
- </xsl:when>
1234
- <xsl:otherwise>
1235
- <!-- more 100 -->
1236
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1237
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1238
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1239
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1240
- <xsl:call-template name="number-to-words">
1241
- <xsl:with-param name="number" select="$digits"/>
1242
- </xsl:call-template>
1243
- </xsl:otherwise>
1244
- </xsl:choose>
1245
- </xsl:otherwise>
1246
- </xsl:choose>
1247
- </xsl:template>
1248
1170
 
1249
1171
  <xsl:template name="printEdition">
1250
1172
  <xsl:variable name="edition" select="normalize-space(//*[local-name()='bibdata']/*[local-name()='edition'])"/>
@@ -2084,7 +2006,7 @@
2084
2006
  <!-- grey opacity -->
2085
2007
  <fo:block-container absolute-position="fixed" left="0" top="0">
2086
2008
  <fo:block>
2087
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
2009
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
2088
2010
  <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="210mm" height="297mm">
2089
2011
  <rect width="210mm" height="297mm" style="fill:rgb(255,255,255);stroke-width:0;fill-opacity:0.73"/>
2090
2012
  </svg>
@@ -2301,7 +2223,7 @@
2301
2223
 
2302
2224
 
2303
2225
 
2304
-
2226
+
2305
2227
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2306
2228
 
2307
2229
 
@@ -2369,7 +2291,10 @@
2369
2291
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2370
2292
 
2371
2293
 
2372
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2294
+
2295
+ </xsl:attribute-set><xsl:variable name="table-border_">
2296
+
2297
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
2373
2298
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2374
2299
 
2375
2300
 
@@ -2391,6 +2316,8 @@
2391
2316
 
2392
2317
 
2393
2318
 
2319
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2320
+
2394
2321
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2395
2322
 
2396
2323
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2423,6 +2350,7 @@
2423
2350
 
2424
2351
 
2425
2352
 
2353
+
2426
2354
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2427
2355
 
2428
2356
 
@@ -2444,6 +2372,7 @@
2444
2372
 
2445
2373
 
2446
2374
 
2375
+
2447
2376
  </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">
2448
2377
 
2449
2378
 
@@ -2489,10 +2418,12 @@
2489
2418
 
2490
2419
 
2491
2420
 
2421
+
2492
2422
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2493
2423
 
2494
2424
 
2495
2425
 
2426
+
2496
2427
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2497
2428
 
2498
2429
 
@@ -2554,6 +2485,7 @@
2554
2485
 
2555
2486
 
2556
2487
 
2488
+
2557
2489
 
2558
2490
 
2559
2491
 
@@ -2629,6 +2561,8 @@
2629
2561
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2630
2562
 
2631
2563
 
2564
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
2565
+
2632
2566
  </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">
2633
2567
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2634
2568
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2639,14 +2573,15 @@
2639
2573
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2640
2574
 
2641
2575
  <!-- Normative references -->
2642
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
2576
+ <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"/>
2643
2577
  <!-- Terms and definitions -->
2644
2578
  <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"/>
2645
2579
  <!-- Another main sections -->
2646
2580
  <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"/>
2647
2581
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
2648
2582
  <!-- Bibliography -->
2649
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
2583
+ <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"/>
2584
+
2650
2585
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2651
2586
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2652
2587
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2682,13 +2617,15 @@
2682
2617
  <xsl:variable name="table">
2683
2618
 
2684
2619
  <xsl:variable name="simple-table">
2685
- <xsl:call-template name="getSimpleTable"/>
2620
+ <xsl:call-template name="getSimpleTable"/>
2686
2621
  </xsl:variable>
2687
2622
 
2688
2623
  <!-- <xsl:if test="$namespace = 'bipm'">
2689
- <fo:block>&#xA0;</fo:block>
2624
+ <fo:block>&#xA0;</fo:block>
2690
2625
  </xsl:if> -->
2691
2626
 
2627
+
2628
+ <!-- Display table's name before table as standalone block -->
2692
2629
  <!-- $namespace = 'iso' or -->
2693
2630
 
2694
2631
 
@@ -2767,6 +2704,12 @@
2767
2704
 
2768
2705
 
2769
2706
 
2707
+
2708
+
2709
+
2710
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2711
+
2712
+
2770
2713
  <xsl:variable name="table_width">
2771
2714
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2772
2715
  100%
@@ -2790,6 +2733,7 @@
2790
2733
 
2791
2734
 
2792
2735
 
2736
+
2793
2737
  <attribute name="margin-left">0mm</attribute>
2794
2738
  <attribute name="margin-right">0mm</attribute>
2795
2739
 
@@ -2799,6 +2743,7 @@
2799
2743
 
2800
2744
 
2801
2745
 
2746
+
2802
2747
  </xsl:variable>
2803
2748
 
2804
2749
 
@@ -2942,6 +2887,9 @@
2942
2887
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2943
2888
 
2944
2889
 
2890
+
2891
+
2892
+
2945
2893
  <xsl:choose>
2946
2894
  <xsl:when test="$continued = 'true'">
2947
2895
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -3095,6 +3043,7 @@
3095
3043
  <xsl:with-param name="cols-count" select="$cols-count"/>
3096
3044
  </xsl:call-template>
3097
3045
 
3046
+
3098
3047
  <xsl:apply-templates/>
3099
3048
  </fo:table-header>
3100
3049
  </xsl:template><xsl:template name="table-header-title">
@@ -3226,6 +3175,8 @@
3226
3175
  </xsl:choose>
3227
3176
  </xsl:for-each>
3228
3177
 
3178
+
3179
+
3229
3180
  <xsl:choose>
3230
3181
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3231
3182
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -3250,6 +3201,7 @@
3250
3201
  <fo:table-row>
3251
3202
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3252
3203
 
3204
+
3253
3205
  <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3254
3206
 
3255
3207
 
@@ -3262,6 +3214,11 @@
3262
3214
 
3263
3215
 
3264
3216
 
3217
+
3218
+
3219
+ <!-- for BSI (not PAS) display Notes before footnotes -->
3220
+
3221
+
3265
3222
  <!-- except gb -->
3266
3223
 
3267
3224
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -3287,6 +3244,10 @@
3287
3244
  <!-- fn processing -->
3288
3245
  <xsl:call-template name="fn_display"/>
3289
3246
 
3247
+
3248
+ <!-- for PAS display Notes after footnotes -->
3249
+
3250
+
3290
3251
  </fo:table-cell>
3291
3252
  </fo:table-row>
3292
3253
  </fo:table-body>
@@ -3331,12 +3292,17 @@
3331
3292
 
3332
3293
  <fo:table-body>
3333
3294
 
3334
- <xsl:variable name="title_continued">
3295
+ <xsl:variable name="title_continued_">
3335
3296
  <xsl:call-template name="getTitle">
3336
3297
  <xsl:with-param name="name" select="'title-continued'"/>
3337
3298
  </xsl:call-template>
3338
3299
  </xsl:variable>
3339
3300
 
3301
+ <xsl:variable name="title_continued">
3302
+ <xsl:value-of select="$title_continued_"/>
3303
+
3304
+ </xsl:variable>
3305
+
3340
3306
  <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3341
3307
  <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3342
3308
 
@@ -3353,8 +3319,8 @@
3353
3319
  <fo:table-cell>
3354
3320
 
3355
3321
  <fo:marker marker-class-name="table_continued">
3356
- <xsl:value-of select="$title_continued"/>
3357
- </fo:marker>
3322
+ <xsl:value-of select="$title_continued"/>
3323
+ </fo:marker>
3358
3324
  <fo:block/>
3359
3325
  </fo:table-cell>
3360
3326
  </fo:table-row>
@@ -3392,9 +3358,12 @@
3392
3358
 
3393
3359
 
3394
3360
 
3361
+
3362
+
3395
3363
  </xsl:if>
3396
3364
  <xsl:if test="$parent-name = 'tfoot'">
3397
3365
 
3366
+
3398
3367
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3399
3368
  <xsl:attribute name="border-left">solid black 1pt</xsl:attribute>
3400
3369
  <xsl:attribute name="border-right">solid black 1pt</xsl:attribute>
@@ -3405,6 +3374,12 @@
3405
3374
 
3406
3375
 
3407
3376
 
3377
+
3378
+
3379
+
3380
+
3381
+
3382
+
3408
3383
  <!-- <xsl:if test="$namespace = 'bipm'">
3409
3384
  <xsl:attribute name="height">8mm</xsl:attribute>
3410
3385
  </xsl:if> -->
@@ -3484,6 +3459,7 @@
3484
3459
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3485
3460
 
3486
3461
 
3462
+
3487
3463
  <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
3488
3464
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
3489
3465
  </xsl:if>
@@ -3502,6 +3478,9 @@
3502
3478
 
3503
3479
 
3504
3480
 
3481
+
3482
+
3483
+
3505
3484
  <xsl:if test=".//*[local-name() = 'table']">
3506
3485
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3507
3486
  </xsl:if>
@@ -3526,6 +3505,7 @@
3526
3505
 
3527
3506
  <fo:block font-size="10pt" margin-bottom="12pt">
3528
3507
 
3508
+
3529
3509
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3530
3510
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3531
3511
 
@@ -3534,8 +3514,13 @@
3534
3514
 
3535
3515
 
3536
3516
 
3517
+
3518
+ <!-- Table's note name (NOTE, for example) -->
3519
+
3537
3520
  <fo:inline padding-right="2mm">
3538
3521
 
3522
+
3523
+
3539
3524
 
3540
3525
 
3541
3526
 
@@ -3543,6 +3528,8 @@
3543
3528
 
3544
3529
  </fo:inline>
3545
3530
 
3531
+
3532
+
3546
3533
  <xsl:apply-templates mode="process"/>
3547
3534
  </fo:block>
3548
3535
 
@@ -3562,6 +3549,8 @@
3562
3549
  <xsl:variable name="reference" select="@reference"/>
3563
3550
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3564
3551
  <fo:block margin-bottom="12pt">
3552
+
3553
+
3565
3554
 
3566
3555
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3567
3556
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -3580,9 +3569,11 @@
3580
3569
 
3581
3570
 
3582
3571
 
3572
+
3583
3573
  <xsl:value-of select="@reference"/>
3584
3574
 
3585
3575
 
3576
+
3586
3577
  </fo:inline>
3587
3578
  <fo:inline>
3588
3579
 
@@ -3718,6 +3709,8 @@
3718
3709
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3719
3710
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3720
3711
 
3712
+
3713
+
3721
3714
  <xsl:if test="ancestor::*[local-name()='td']">
3722
3715
  <xsl:attribute name="font-weight">normal</xsl:attribute>
3723
3716
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
@@ -3729,11 +3722,14 @@
3729
3722
 
3730
3723
 
3731
3724
 
3725
+
3726
+
3732
3727
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3733
3728
 
3734
3729
 
3735
3730
  <xsl:value-of select="@reference"/>
3736
3731
 
3732
+
3737
3733
  </fo:basic-link>
3738
3734
  </fo:inline>
3739
3735
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -4045,6 +4041,7 @@
4045
4041
 
4046
4042
  <fo:table-row>
4047
4043
 
4044
+
4048
4045
  <fo:table-cell>
4049
4046
 
4050
4047
  <fo:block margin-top="6pt">
@@ -4062,6 +4059,7 @@
4062
4059
 
4063
4060
 
4064
4061
 
4062
+
4065
4063
  <xsl:apply-templates/>
4066
4064
  <!-- <xsl:if test="$namespace = 'gb'">
4067
4065
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4609,7 +4607,15 @@
4609
4607
  <xsl:copy>
4610
4608
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4611
4609
  </xsl:copy>
4612
- <mathml:mspace width="0.5ex"/>
4610
+ <xsl:choose>
4611
+ <!-- if in msub, then don't add space -->
4612
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4613
+ <!-- if next char in digit, don't add space -->
4614
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4615
+ <xsl:otherwise>
4616
+ <mathml:mspace width="0.5ex"/>
4617
+ </xsl:otherwise>
4618
+ </xsl:choose>
4613
4619
  </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">
4614
4620
  <xsl:variable name="target">
4615
4621
  <xsl:choose>
@@ -4633,6 +4639,8 @@
4633
4639
  </xsl:variable>
4634
4640
  <fo:inline xsl:use-attribute-sets="link-style">
4635
4641
 
4642
+
4643
+
4636
4644
  <xsl:choose>
4637
4645
  <xsl:when test="$target_text = ''">
4638
4646
  <xsl:apply-templates/>
@@ -4741,6 +4749,7 @@
4741
4749
 
4742
4750
 
4743
4751
 
4752
+
4744
4753
  <fo:block-container margin-left="0mm">
4745
4754
 
4746
4755
 
@@ -4784,6 +4793,7 @@
4784
4793
  </xsl:choose>
4785
4794
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4786
4795
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4796
+
4787
4797
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4788
4798
 
4789
4799
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -4859,6 +4869,7 @@
4859
4869
  </xsl:call-template>
4860
4870
 
4861
4871
  <fo:block>
4872
+
4862
4873
  <xsl:apply-templates/>
4863
4874
  </fo:block>
4864
4875
  <xsl:call-template name="fn_display_figure"/>
@@ -4913,7 +4924,24 @@
4913
4924
  </fo:instream-foreign-object>
4914
4925
  </xsl:when>
4915
4926
  <xsl:otherwise>
4916
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4927
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
4928
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
4929
+
4930
+ <xsl:variable name="img_src">
4931
+ <xsl:choose>
4932
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
4933
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
4934
+ </xsl:choose>
4935
+ </xsl:variable>
4936
+
4937
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4938
+ <xsl:if test="number($scale) &lt; 100">
4939
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4940
+ </xsl:if>
4941
+
4942
+ </xsl:if>
4943
+
4944
+ </fo:external-graphic>
4917
4945
  </xsl:otherwise>
4918
4946
  </xsl:choose>
4919
4947
 
@@ -4981,6 +5009,253 @@
4981
5009
  <xsl:param name="height"/>
4982
5010
  <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; "/>
4983
5011
  <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; "/>
5012
+ </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">
5013
+ <xsl:param name="name"/>
5014
+
5015
+ <xsl:variable name="svg_content">
5016
+ <xsl:apply-templates select="." mode="svg_update"/>
5017
+ </xsl:variable>
5018
+
5019
+ <xsl:variable name="alt-text">
5020
+ <xsl:choose>
5021
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
5022
+ <xsl:value-of select="../*[local-name() = 'name']"/>
5023
+ </xsl:when>
5024
+ <xsl:when test="normalize-space($name) != ''">
5025
+ <xsl:value-of select="$name"/>
5026
+ </xsl:when>
5027
+ <xsl:otherwise>Figure</xsl:otherwise>
5028
+ </xsl:choose>
5029
+ </xsl:variable>
5030
+
5031
+ <xsl:choose>
5032
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
5033
+ <fo:block>
5034
+ <xsl:variable name="width" select="@width"/>
5035
+ <xsl:variable name="height" select="@height"/>
5036
+
5037
+ <xsl:variable name="scale_x">
5038
+ <xsl:choose>
5039
+ <xsl:when test="$width &gt; $width_effective_px">
5040
+ <xsl:value-of select="$width_effective_px div $width"/>
5041
+ </xsl:when>
5042
+ <xsl:otherwise>1</xsl:otherwise>
5043
+ </xsl:choose>
5044
+ </xsl:variable>
5045
+
5046
+ <xsl:variable name="scale_y">
5047
+ <xsl:choose>
5048
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
5049
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
5050
+ </xsl:when>
5051
+ <xsl:otherwise>1</xsl:otherwise>
5052
+ </xsl:choose>
5053
+ </xsl:variable>
5054
+
5055
+ <xsl:variable name="scale">
5056
+ <xsl:choose>
5057
+ <xsl:when test="$scale_y != 1">
5058
+ <xsl:value-of select="$scale_x * $scale_y"/>
5059
+ </xsl:when>
5060
+ <xsl:otherwise>
5061
+ <xsl:value-of select="$scale_x"/>
5062
+ </xsl:otherwise>
5063
+ </xsl:choose>
5064
+ </xsl:variable>
5065
+
5066
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
5067
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
5068
+
5069
+ <fo:table table-layout="fixed" width="100%">
5070
+ <fo:table-column column-width="proportional-column-width(1)"/>
5071
+ <fo:table-column column-width="{$width_scale}px"/>
5072
+ <fo:table-column column-width="proportional-column-width(1)"/>
5073
+ <fo:table-body>
5074
+ <fo:table-row>
5075
+ <fo:table-cell column-number="2">
5076
+ <fo:block>
5077
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
5078
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5079
+ <fo:block line-height="0" font-size="0">
5080
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5081
+ <xsl:call-template name="bookmark"/>
5082
+ </xsl:for-each>
5083
+ </fo:block>
5084
+ </xsl:if>
5085
+ <fo:block text-depth="0" line-height="0" font-size="0">
5086
+
5087
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5088
+ <xsl:attribute name="width">100%</xsl:attribute>
5089
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5090
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5091
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5092
+
5093
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
5094
+ </fo:instream-foreign-object>
5095
+ </fo:block>
5096
+
5097
+ <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">
5098
+ <xsl:with-param name="scale" select="$scale"/>
5099
+ </xsl:apply-templates>
5100
+ </fo:block-container>
5101
+ </fo:block>
5102
+ </fo:table-cell>
5103
+ </fo:table-row>
5104
+ </fo:table-body>
5105
+ </fo:table>
5106
+ </fo:block>
5107
+
5108
+ </xsl:when>
5109
+ <xsl:otherwise>
5110
+ <fo:block xsl:use-attribute-sets="image-style">
5111
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5112
+ <xsl:attribute name="width">100%</xsl:attribute>
5113
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5114
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5115
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
5116
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
5117
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5118
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5119
+ <!-- effective height / width = 1.48, 1.4 - with title -->
5120
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
5121
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
5122
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5123
+ </xsl:if>
5124
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5125
+ <xsl:copy-of select="$svg_content"/>
5126
+ </fo:instream-foreign-object>
5127
+ </fo:block>
5128
+ </xsl:otherwise>
5129
+ </xsl:choose>
5130
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
5131
+ <xsl:copy>
5132
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
5133
+ </xsl:copy>
5134
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
5135
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5136
+ <xsl:value-of select="."/>
5137
+ </xsl:attribute>
5138
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5139
+ <xsl:copy>
5140
+ <xsl:apply-templates select="@*" mode="svg_update"/>
5141
+ <xsl:variable name="viewbox">
5142
+ <xsl:call-template name="split">
5143
+ <xsl:with-param name="pText" select="@viewBox"/>
5144
+ <xsl:with-param name="sep" select="' '"/>
5145
+ </xsl:call-template>
5146
+ </xsl:variable>
5147
+ <xsl:attribute name="width">
5148
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5149
+ </xsl:attribute>
5150
+ <xsl:attribute name="height">
5151
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5152
+ </xsl:attribute>
5153
+ <xsl:apply-templates mode="svg_update"/>
5154
+ </xsl:copy>
5155
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5156
+ <xsl:variable name="svg_content" select="document(@src)"/>
5157
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5158
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
5159
+ <xsl:call-template name="image_svg">
5160
+ <xsl:with-param name="name" select="$name"/>
5161
+ </xsl:call-template>
5162
+ </xsl:for-each>
5163
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
5164
+ <xsl:copy>
5165
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
5166
+ </xsl:copy>
5167
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
5168
+ <xsl:apply-templates mode="svg_remove_a"/>
5169
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
5170
+ <xsl:param name="scale"/>
5171
+ <xsl:variable name="dest">
5172
+ <xsl:choose>
5173
+ <xsl:when test="starts-with(@href, '#')">
5174
+ <xsl:value-of select="substring-after(@href, '#')"/>
5175
+ </xsl:when>
5176
+ <xsl:otherwise>
5177
+ <xsl:value-of select="@href"/>
5178
+ </xsl:otherwise>
5179
+ </xsl:choose>
5180
+ </xsl:variable>
5181
+ <xsl:for-each select="./*[local-name() = 'rect']">
5182
+ <xsl:call-template name="insertSVGMapLink">
5183
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
5184
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
5185
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
5186
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
5187
+ <xsl:with-param name="dest" select="$dest"/>
5188
+ </xsl:call-template>
5189
+ </xsl:for-each>
5190
+
5191
+ <xsl:for-each select="./*[local-name() = 'polygon']">
5192
+ <xsl:variable name="points">
5193
+ <xsl:call-template name="split">
5194
+ <xsl:with-param name="pText" select="@points"/>
5195
+ </xsl:call-template>
5196
+ </xsl:variable>
5197
+ <xsl:variable name="x_coords">
5198
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
5199
+ <xsl:sort select="." data-type="number"/>
5200
+ <x><xsl:value-of select="."/></x>
5201
+ </xsl:for-each>
5202
+ </xsl:variable>
5203
+ <xsl:variable name="y_coords">
5204
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
5205
+ <xsl:sort select="." data-type="number"/>
5206
+ <y><xsl:value-of select="."/></y>
5207
+ </xsl:for-each>
5208
+ </xsl:variable>
5209
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
5210
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
5211
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
5212
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
5213
+ <xsl:call-template name="insertSVGMapLink">
5214
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
5215
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
5216
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
5217
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
5218
+ <xsl:with-param name="dest" select="$dest"/>
5219
+ </xsl:call-template>
5220
+ </xsl:for-each>
5221
+
5222
+ <xsl:for-each select="./*[local-name() = 'circle']">
5223
+ <xsl:call-template name="insertSVGMapLink">
5224
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
5225
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
5226
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
5227
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5228
+ <xsl:with-param name="dest" select="$dest"/>
5229
+ </xsl:call-template>
5230
+ </xsl:for-each>
5231
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5232
+ <xsl:call-template name="insertSVGMapLink">
5233
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5234
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5235
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5236
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5237
+ <xsl:with-param name="dest" select="$dest"/>
5238
+ </xsl:call-template>
5239
+ </xsl:for-each>
5240
+ </xsl:template><xsl:template name="insertSVGMapLink">
5241
+ <xsl:param name="left"/>
5242
+ <xsl:param name="top"/>
5243
+ <xsl:param name="width"/>
5244
+ <xsl:param name="height"/>
5245
+ <xsl:param name="dest"/>
5246
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5247
+ <fo:block font-size="1pt">
5248
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5249
+ <fo:inline-container inline-progression-dimension="100%">
5250
+ <fo:block-container height="{$height - 1}px" width="100%">
5251
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5252
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5253
+ </xsl:if> -->
5254
+ <fo:block> </fo:block></fo:block-container>
5255
+ </fo:inline-container>
5256
+ </fo:basic-link>
5257
+ </fo:block>
5258
+ </fo:block-container>
4984
5259
  </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">
4985
5260
  <xsl:apply-templates mode="contents"/>
4986
5261
  <xsl:text> </xsl:text>
@@ -5009,28 +5284,39 @@
5009
5284
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5010
5285
  <xsl:for-each select="xalan:nodeset($contents)/doc">
5011
5286
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5287
+ <xsl:if test="@bundle = 'true'">
5288
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5289
+ </xsl:if>
5012
5290
  <fo:bookmark-title>
5013
- <xsl:variable name="bookmark-title_">
5014
- <xsl:call-template name="getLangVersion">
5015
- <xsl:with-param name="lang" select="@lang"/>
5016
- <xsl:with-param name="doctype" select="@doctype"/>
5017
- <xsl:with-param name="title" select="@title-part"/>
5018
- </xsl:call-template>
5019
- </xsl:variable>
5020
5291
  <xsl:choose>
5021
- <xsl:when test="normalize-space($bookmark-title_) != ''">
5022
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
5023
- </xsl:when>
5024
- <xsl:otherwise>
5292
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5293
+ <xsl:variable name="bookmark-title_">
5294
+ <xsl:call-template name="getLangVersion">
5295
+ <xsl:with-param name="lang" select="@lang"/>
5296
+ <xsl:with-param name="doctype" select="@doctype"/>
5297
+ <xsl:with-param name="title" select="@title-part"/>
5298
+ </xsl:call-template>
5299
+ </xsl:variable>
5025
5300
  <xsl:choose>
5026
- <xsl:when test="@lang = 'en'">English</xsl:when>
5027
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
5028
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5029
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5301
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5302
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5303
+ </xsl:when>
5304
+ <xsl:otherwise>
5305
+ <xsl:choose>
5306
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5307
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5308
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5309
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5310
+ </xsl:choose>
5311
+ </xsl:otherwise>
5030
5312
  </xsl:choose>
5313
+ </xsl:when>
5314
+ <xsl:otherwise>
5315
+ <xsl:value-of select="@title-part"/>
5031
5316
  </xsl:otherwise>
5032
5317
  </xsl:choose>
5033
5318
  </fo:bookmark-title>
5319
+
5034
5320
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5035
5321
 
5036
5322
  <xsl:call-template name="insertFigureBookmarks">
@@ -5129,20 +5415,28 @@
5129
5415
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
5130
5416
  </xsl:choose>
5131
5417
  </xsl:template><xsl:template match="item" mode="bookmark">
5132
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
5133
- <fo:bookmark-title>
5134
- <xsl:if test="@section != ''">
5135
- <xsl:value-of select="@section"/>
5136
- <xsl:text> </xsl:text>
5137
- </xsl:if>
5138
- <xsl:value-of select="normalize-space(title)"/>
5139
- </fo:bookmark-title>
5140
- <xsl:apply-templates mode="bookmark"/>
5141
- </fo:bookmark>
5418
+ <xsl:choose>
5419
+ <xsl:when test="@id != ''">
5420
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5421
+ <fo:bookmark-title>
5422
+ <xsl:if test="@section != ''">
5423
+ <xsl:value-of select="@section"/>
5424
+ <xsl:text> </xsl:text>
5425
+ </xsl:if>
5426
+ <xsl:value-of select="normalize-space(title)"/>
5427
+ </fo:bookmark-title>
5428
+ <xsl:apply-templates mode="bookmark"/>
5429
+ </fo:bookmark>
5430
+ </xsl:when>
5431
+ <xsl:otherwise>
5432
+ <xsl:apply-templates mode="bookmark"/>
5433
+ </xsl:otherwise>
5434
+ </xsl:choose>
5142
5435
  </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">
5143
5436
  <xsl:if test="normalize-space() != ''">
5144
5437
  <fo:block xsl:use-attribute-sets="figure-name-style">
5145
5438
 
5439
+
5146
5440
  <xsl:apply-templates/>
5147
5441
  </fo:block>
5148
5442
  </xsl:if>
@@ -5223,6 +5517,7 @@
5223
5517
 
5224
5518
  <fo:block-container margin-left="0mm">
5225
5519
  <xsl:copy-of select="@id"/>
5520
+
5226
5521
  <xsl:if test="parent::*[local-name() = 'note']">
5227
5522
  <xsl:attribute name="margin-left">
5228
5523
  <xsl:choose>
@@ -5233,7 +5528,9 @@
5233
5528
 
5234
5529
  </xsl:if>
5235
5530
  <fo:block-container margin-left="0mm">
5236
-
5531
+
5532
+
5533
+
5237
5534
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5238
5535
  <xsl:variable name="_font-size">
5239
5536
 
@@ -5262,10 +5559,14 @@
5262
5559
  </xsl:choose>
5263
5560
  </xsl:attribute>
5264
5561
  </xsl:if>
5265
- <xsl:apply-templates/>
5266
- </fo:block>
5562
+
5563
+ <xsl:apply-templates/>
5564
+ </fo:block>
5565
+
5566
+
5267
5567
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5268
5568
 
5569
+
5269
5570
  </fo:block-container>
5270
5571
  </fo:block-container>
5271
5572
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5615,6 +5916,8 @@
5615
5916
 
5616
5917
 
5617
5918
 
5919
+
5920
+
5618
5921
  <xsl:value-of select="$localized.source"/>
5619
5922
  <xsl:text> </xsl:text>
5620
5923
 
@@ -5700,7 +6003,9 @@
5700
6003
 
5701
6004
 
5702
6005
  </xsl:if>
5703
-
6006
+
6007
+
6008
+
5704
6009
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5705
6010
  <xsl:if test="normalize-space(@citeas) = ''">
5706
6011
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -5709,6 +6014,7 @@
5709
6014
 
5710
6015
 
5711
6016
 
6017
+
5712
6018
  </xsl:if>
5713
6019
 
5714
6020
  <xsl:apply-templates/>
@@ -5854,6 +6160,7 @@
5854
6160
  <xsl:call-template name="setId"/>
5855
6161
 
5856
6162
 
6163
+
5857
6164
  <xsl:if test="@inline-header='true'">
5858
6165
  <xsl:attribute name="text-align">justify</xsl:attribute>
5859
6166
  </xsl:if>
@@ -6104,17 +6411,17 @@
6104
6411
  <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')]"/>
6105
6412
  <xsl:choose>
6106
6413
  <xsl:when test="normalize-space($_doc_ident) != ''">
6107
- <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"/>
6414
+ <!-- <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"/>
6108
6415
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6109
6416
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6110
- </xsl:if>
6417
+ </xsl:if> -->
6111
6418
  <xsl:value-of select="$_doc_ident"/>
6112
6419
  </xsl:when>
6113
6420
  <xsl:otherwise>
6114
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6421
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6115
6422
  <xsl:if test="$type != ''">
6116
6423
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6117
- </xsl:if>
6424
+ </xsl:if> -->
6118
6425
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6119
6426
  </xsl:otherwise>
6120
6427
  </xsl:choose>
@@ -6552,20 +6859,40 @@
6552
6859
  </xsl:call-template>
6553
6860
  </xsl:if>
6554
6861
  </xsl:template><xsl:template name="getLocalizedString">
6555
- <xsl:param name="key"/>
6862
+ <xsl:param name="key"/>
6863
+ <xsl:param name="formatted">false</xsl:param>
6556
6864
 
6557
6865
  <xsl:variable name="curr_lang">
6558
6866
  <xsl:call-template name="getLang"/>
6559
6867
  </xsl:variable>
6560
6868
 
6561
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6869
+ <xsl:variable name="data_value">
6870
+ <xsl:choose>
6871
+ <xsl:when test="$formatted = 'true'">
6872
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6873
+ </xsl:when>
6874
+ <xsl:otherwise>
6875
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6876
+ </xsl:otherwise>
6877
+ </xsl:choose>
6878
+ </xsl:variable>
6562
6879
 
6563
6880
  <xsl:choose>
6564
- <xsl:when test="$data_value != ''">
6565
- <xsl:value-of select="$data_value"/>
6881
+ <xsl:when test="normalize-space($data_value) != ''">
6882
+ <xsl:choose>
6883
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
6884
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
6885
+ </xsl:choose>
6566
6886
  </xsl:when>
6567
6887
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6568
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6888
+ <xsl:choose>
6889
+ <xsl:when test="$formatted = 'true'">
6890
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6891
+ </xsl:when>
6892
+ <xsl:otherwise>
6893
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6894
+ </xsl:otherwise>
6895
+ </xsl:choose>
6569
6896
  </xsl:when>
6570
6897
  <xsl:otherwise>
6571
6898
  <xsl:variable name="key_">
@@ -6576,7 +6903,7 @@
6576
6903
  <xsl:value-of select="$key_"/>
6577
6904
  </xsl:otherwise>
6578
6905
  </xsl:choose>
6579
-
6906
+
6580
6907
  </xsl:template><xsl:template name="setTrackChangesStyles">
6581
6908
  <xsl:param name="isAdded"/>
6582
6909
  <xsl:param name="isDeleted"/>
@@ -6617,4 +6944,110 @@
6617
6944
  <xsl:value-of select="$align"/>
6618
6945
  </xsl:when>
6619
6946
  </xsl:choose>
6947
+ </xsl:template><xsl:template name="setTextAlignment">
6948
+ <xsl:param name="default">left</xsl:param>
6949
+ <xsl:attribute name="text-align">
6950
+ <xsl:choose>
6951
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
6952
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
6953
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
6954
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6955
+ </xsl:choose>
6956
+ </xsl:attribute>
6957
+ </xsl:template><xsl:template name="number-to-words">
6958
+ <xsl:param name="number"/>
6959
+ <xsl:param name="first"/>
6960
+ <xsl:if test="$number != ''">
6961
+ <xsl:variable name="words">
6962
+ <words>
6963
+ <word cardinal="1">One-</word>
6964
+ <word ordinal="1">First </word>
6965
+ <word cardinal="2">Two-</word>
6966
+ <word ordinal="2">Second </word>
6967
+ <word cardinal="3">Three-</word>
6968
+ <word ordinal="3">Third </word>
6969
+ <word cardinal="4">Four-</word>
6970
+ <word ordinal="4">Fourth </word>
6971
+ <word cardinal="5">Five-</word>
6972
+ <word ordinal="5">Fifth </word>
6973
+ <word cardinal="6">Six-</word>
6974
+ <word ordinal="6">Sixth </word>
6975
+ <word cardinal="7">Seven-</word>
6976
+ <word ordinal="7">Seventh </word>
6977
+ <word cardinal="8">Eight-</word>
6978
+ <word ordinal="8">Eighth </word>
6979
+ <word cardinal="9">Nine-</word>
6980
+ <word ordinal="9">Ninth </word>
6981
+ <word ordinal="10">Tenth </word>
6982
+ <word ordinal="11">Eleventh </word>
6983
+ <word ordinal="12">Twelfth </word>
6984
+ <word ordinal="13">Thirteenth </word>
6985
+ <word ordinal="14">Fourteenth </word>
6986
+ <word ordinal="15">Fifteenth </word>
6987
+ <word ordinal="16">Sixteenth </word>
6988
+ <word ordinal="17">Seventeenth </word>
6989
+ <word ordinal="18">Eighteenth </word>
6990
+ <word ordinal="19">Nineteenth </word>
6991
+ <word cardinal="20">Twenty-</word>
6992
+ <word ordinal="20">Twentieth </word>
6993
+ <word cardinal="30">Thirty-</word>
6994
+ <word ordinal="30">Thirtieth </word>
6995
+ <word cardinal="40">Forty-</word>
6996
+ <word ordinal="40">Fortieth </word>
6997
+ <word cardinal="50">Fifty-</word>
6998
+ <word ordinal="50">Fiftieth </word>
6999
+ <word cardinal="60">Sixty-</word>
7000
+ <word ordinal="60">Sixtieth </word>
7001
+ <word cardinal="70">Seventy-</word>
7002
+ <word ordinal="70">Seventieth </word>
7003
+ <word cardinal="80">Eighty-</word>
7004
+ <word ordinal="80">Eightieth </word>
7005
+ <word cardinal="90">Ninety-</word>
7006
+ <word ordinal="90">Ninetieth </word>
7007
+ <word cardinal="100">Hundred-</word>
7008
+ <word ordinal="100">Hundredth </word>
7009
+ </words>
7010
+ </xsl:variable>
7011
+
7012
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
7013
+
7014
+ <xsl:variable name="value">
7015
+ <xsl:choose>
7016
+ <xsl:when test="$ordinal != ''">
7017
+ <xsl:value-of select="$ordinal"/>
7018
+ </xsl:when>
7019
+ <xsl:otherwise>
7020
+ <xsl:choose>
7021
+ <xsl:when test="$number &lt; 100">
7022
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
7023
+ <xsl:variable name="digit" select="substring($number,2)"/>
7024
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
7025
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
7026
+ </xsl:when>
7027
+ <xsl:otherwise>
7028
+ <!-- more 100 -->
7029
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
7030
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
7031
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
7032
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
7033
+ <xsl:call-template name="number-to-words">
7034
+ <xsl:with-param name="number" select="$digits"/>
7035
+ </xsl:call-template>
7036
+ </xsl:otherwise>
7037
+ </xsl:choose>
7038
+ </xsl:otherwise>
7039
+ </xsl:choose>
7040
+ </xsl:variable>
7041
+ <xsl:choose>
7042
+ <xsl:when test="$first = 'true'">
7043
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
7044
+ <xsl:call-template name="capitalize">
7045
+ <xsl:with-param name="str" select="$value_lc"/>
7046
+ </xsl:call-template>
7047
+ </xsl:when>
7048
+ <xsl:otherwise>
7049
+ <xsl:value-of select="$value"/>
7050
+ </xsl:otherwise>
7051
+ </xsl:choose>
7052
+ </xsl:if>
6620
7053
  </xsl:template></xsl:stylesheet>