metanorma-bipm 2.2.8 → 2.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -342,71 +342,16 @@
342
342
  <xsl:copy-of select="."/>
343
343
  </xsl:variable>
344
344
  <xsl:for-each select="xalan:nodeset($current_document)">
345
- <xsl:variable name="docid">
346
- <xsl:call-template name="getDocumentId"/>
347
- </xsl:variable>
348
-
349
- <!-- Table of Contents -->
350
- <fo:block-container>
351
- <fo:block role="TOC">
352
- <fo:block text-align-last="justify">
353
- <fo:inline font-size="15pt" font-weight="bold" role="H1">
354
- <xsl:call-template name="getLocalizedString">
355
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
356
- </xsl:call-template>
357
- </fo:inline>
358
- <fo:inline keep-together.within-line="always">
359
- <fo:leader leader-pattern="space"/>
360
- <xsl:call-template name="getLocalizedString">
361
- <xsl:with-param name="key">Page.sg</xsl:with-param>
362
- </xsl:call-template>
363
- </fo:inline>
364
- </fo:block>
365
-
366
- <xsl:if test="$debug = 'true'">
367
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
368
- DEBUG
369
- contents=<xsl:copy-of select="$contents"/>
370
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
371
- </xsl:if>
372
-
373
- <xsl:variable name="annexes_title">
374
- <xsl:call-template name="getLocalizedString">
375
- <xsl:with-param name="key">Annex.pl</xsl:with-param>
376
- </xsl:call-template>
377
- </xsl:variable>
378
-
379
- <xsl:for-each select="$contents/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
380
- <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
381
- <fo:block font-size="12pt" space-before="16pt" font-weight="bold" role="TOCI">
382
- <xsl:value-of select="$annexes_title"/>
383
- </fo:block>
384
- </xsl:if>
385
- <xsl:call-template name="print_JCGN_toc_item"/>
386
- </xsl:for-each>
387
-
388
- <!-- List of Tables -->
389
- <xsl:if test="$contents//tables/table">
390
- <xsl:call-template name="insertListOf_Title">
391
- <xsl:with-param name="title" select="$title-list-tables"/>
392
- </xsl:call-template>
393
- <xsl:for-each select="$contents//tables/table">
394
- <xsl:call-template name="insertListOf_Item"/>
395
- </xsl:for-each>
396
- </xsl:if>
397
345
 
398
- <!-- List of Figures -->
399
- <xsl:if test="$contents//figures/figure">
400
- <xsl:call-template name="insertListOf_Title">
401
- <xsl:with-param name="title" select="$title-list-figures"/>
402
- </xsl:call-template>
403
- <xsl:for-each select="$contents//figures/figure">
404
- <xsl:call-template name="insertListOf_Item"/>
405
- </xsl:for-each>
406
- </xsl:if>
346
+ <xsl:if test="$debug = 'true'">
347
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
348
+ DEBUG
349
+ contents=<xsl:copy-of select="$contents"/>
350
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
351
+ </xsl:if>
407
352
 
408
- </fo:block>
409
- </fo:block-container>
353
+ <!-- Table of Contents -->
354
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='clause'][@type = 'toc']"/>
410
355
 
411
356
  </xsl:for-each>
412
357
 
@@ -431,7 +376,7 @@
431
376
  </xsl:for-each>
432
377
  <xsl:for-each select="//*[local-name() = 'bipm-standard']">
433
378
  <fo:block break-after="page"/>
434
- <xsl:apply-templates select="./*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
379
+ <xsl:apply-templates select="./*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition' and not(local-name() = 'clause' and @type = 'toc')]"/>
435
380
  </xsl:for-each>
436
381
  <xsl:for-each select="//*[local-name() = 'bipm-standard']">
437
382
  <fo:block break-after="page"/>
@@ -573,6 +518,69 @@
573
518
  </fo:block>
574
519
  </xsl:template>
575
520
 
521
+ <xsl:template match="jcgm:preface/jcgm:clause[@type = 'toc']" priority="3">
522
+ <fo:block-container>
523
+ <fo:block role="TOC">
524
+
525
+ <xsl:apply-templates/>
526
+
527
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
528
+
529
+ <xsl:variable name="docid">
530
+ <xsl:call-template name="getDocumentId"/>
531
+ </xsl:variable>
532
+
533
+ <xsl:for-each select="$contents/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
534
+ <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
535
+ <fo:block font-size="12pt" space-before="16pt" font-weight="bold" role="TOCI">
536
+ <xsl:call-template name="getLocalizedString">
537
+ <xsl:with-param name="key">Annex.pl</xsl:with-param>
538
+ </xsl:call-template>
539
+ </fo:block>
540
+ </xsl:if>
541
+ <xsl:call-template name="print_JCGN_toc_item"/>
542
+ </xsl:for-each>
543
+
544
+ <!-- List of Tables -->
545
+ <xsl:if test="$contents//tables/table">
546
+ <xsl:call-template name="insertListOf_Title">
547
+ <xsl:with-param name="title" select="$title-list-tables"/>
548
+ </xsl:call-template>
549
+ <xsl:for-each select="$contents//tables/table">
550
+ <xsl:call-template name="insertListOf_Item"/>
551
+ </xsl:for-each>
552
+ </xsl:if>
553
+
554
+ <!-- List of Figures -->
555
+ <xsl:if test="$contents//figures/figure">
556
+ <xsl:call-template name="insertListOf_Title">
557
+ <xsl:with-param name="title" select="$title-list-figures"/>
558
+ </xsl:call-template>
559
+ <xsl:for-each select="$contents//figures/figure">
560
+ <xsl:call-template name="insertListOf_Item"/>
561
+ </xsl:for-each>
562
+ </xsl:if>
563
+ </xsl:if>
564
+ </fo:block>
565
+ </fo:block-container>
566
+ </xsl:template>
567
+
568
+ <xsl:template match="jcgm:preface/jcgm:clause[@type = 'toc']/jcgm:title" priority="3">
569
+ <fo:block text-align-last="justify">
570
+ <fo:inline font-size="15pt" font-weight="bold" role="H1">
571
+ <xsl:call-template name="getLocalizedString">
572
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
573
+ </xsl:call-template>
574
+ </fo:inline>
575
+ <fo:inline keep-together.within-line="always">
576
+ <fo:leader leader-pattern="space"/>
577
+ <xsl:call-template name="getLocalizedString">
578
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
579
+ </xsl:call-template>
580
+ </fo:inline>
581
+ </fo:block>
582
+ </xsl:template>
583
+
576
584
  <xsl:template match="node()">
577
585
  <xsl:apply-templates/>
578
586
  </xsl:template>
@@ -612,6 +620,7 @@
612
620
 
613
621
  <xsl:variable name="skip">
614
622
  <xsl:choose>
623
+ <xsl:when test="@type = 'toc'">true</xsl:when>
615
624
  <xsl:when test="ancestor-or-self::*[local-name()='bibitem']">true</xsl:when>
616
625
  <xsl:when test="ancestor-or-self::*[local-name()='term']">true</xsl:when>
617
626
  <xsl:otherwise>false</xsl:otherwise>
@@ -1145,21 +1154,25 @@
1145
1154
  <!-- =================== -->
1146
1155
 
1147
1156
  <xsl:template match="jcgm:xref" priority="2">
1148
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
1149
- <xsl:choose>
1150
- <xsl:when test="@pagenumber='true'">
1151
- <fo:inline>
1152
- <xsl:if test="@id">
1153
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1154
- </xsl:if>
1155
- <fo:page-number-citation ref-id="{@target}"/>
1156
- </fo:inline>
1157
- </xsl:when>
1158
- <xsl:otherwise>
1159
- <fo:inline><xsl:apply-templates/></fo:inline>
1160
- </xsl:otherwise>
1161
- </xsl:choose>
1162
- </fo:basic-link>
1157
+ <xsl:call-template name="insert_basic_link">
1158
+ <xsl:with-param name="element">
1159
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
1160
+ <xsl:choose>
1161
+ <xsl:when test="@pagenumber='true'">
1162
+ <fo:inline>
1163
+ <xsl:if test="@id">
1164
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1165
+ </xsl:if>
1166
+ <fo:page-number-citation ref-id="{@target}"/>
1167
+ </fo:inline>
1168
+ </xsl:when>
1169
+ <xsl:otherwise>
1170
+ <fo:inline><xsl:apply-templates/></fo:inline>
1171
+ </xsl:otherwise>
1172
+ </xsl:choose>
1173
+ </fo:basic-link>
1174
+ </xsl:with-param>
1175
+ </xsl:call-template>
1163
1176
  </xsl:template>
1164
1177
 
1165
1178
  <!-- =================== -->
@@ -2088,6 +2101,10 @@
2088
2101
 
2089
2102
  </xsl:attribute-set>
2090
2103
 
2104
+ <xsl:template name="refine_link-style">
2105
+
2106
+ </xsl:template> <!-- refine_link-style -->
2107
+
2091
2108
  <xsl:attribute-set name="sourcecode-container-style">
2092
2109
 
2093
2110
  </xsl:attribute-set>
@@ -2102,6 +2119,10 @@
2102
2119
 
2103
2120
  </xsl:attribute-set>
2104
2121
 
2122
+ <xsl:template name="refine_sourcecode-style">
2123
+
2124
+ </xsl:template> <!-- refine_sourcecode-style -->
2125
+
2105
2126
  <xsl:attribute-set name="pre-style">
2106
2127
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2107
2128
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2188,6 +2209,10 @@
2188
2209
 
2189
2210
  </xsl:attribute-set> <!-- example-style -->
2190
2211
 
2212
+ <xsl:template name="refine_example-style">
2213
+
2214
+ </xsl:template> <!-- refine_example-style -->
2215
+
2191
2216
  <xsl:attribute-set name="example-body-style">
2192
2217
 
2193
2218
  </xsl:attribute-set> <!-- example-body-style -->
@@ -2206,6 +2231,10 @@
2206
2231
 
2207
2232
  </xsl:attribute-set> <!-- example-p-style -->
2208
2233
 
2234
+ <xsl:template name="refine_example-p-style">
2235
+
2236
+ </xsl:template> <!-- refine_example-p-style -->
2237
+
2209
2238
  <xsl:attribute-set name="termexample-name-style">
2210
2239
 
2211
2240
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2235,6 +2264,12 @@
2235
2264
 
2236
2265
  </xsl:attribute-set> <!-- table-container-style -->
2237
2266
 
2267
+ <xsl:template name="refine_table-container-style">
2268
+ <xsl:param name="margin-side"/>
2269
+
2270
+ <!-- end table block-container attributes -->
2271
+ </xsl:template> <!-- refine_table-container-style -->
2272
+
2238
2273
  <xsl:attribute-set name="table-style">
2239
2274
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2240
2275
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -2243,6 +2278,17 @@
2243
2278
 
2244
2279
  </xsl:attribute-set><!-- table-style -->
2245
2280
 
2281
+ <xsl:template name="refine_table-style">
2282
+ <xsl:param name="margin-side"/>
2283
+
2284
+ <xsl:call-template name="setBordersTableArray"/>
2285
+
2286
+ <xsl:if test="*[local-name()='thead']">
2287
+ <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
2288
+ </xsl:if>
2289
+
2290
+ </xsl:template> <!-- refine_table-style -->
2291
+
2246
2292
  <xsl:attribute-set name="table-name-style">
2247
2293
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2248
2294
 
@@ -2253,6 +2299,11 @@
2253
2299
 
2254
2300
  </xsl:attribute-set> <!-- table-name-style -->
2255
2301
 
2302
+ <xsl:template name="refine_table-name-style">
2303
+ <xsl:param name="continued"/>
2304
+
2305
+ </xsl:template> <!-- refine_table-name-style -->
2306
+
2256
2307
  <xsl:attribute-set name="table-row-style">
2257
2308
  <xsl:attribute name="min-height">4mm</xsl:attribute>
2258
2309
 
@@ -2266,6 +2317,23 @@
2266
2317
 
2267
2318
  </xsl:attribute-set>
2268
2319
 
2320
+ <xsl:template name="refine_table-header-row-style">
2321
+
2322
+ <xsl:call-template name="setBordersTableArray"/>
2323
+
2324
+ <xsl:choose>
2325
+ <xsl:when test="position() = 1">
2326
+ <xsl:attribute name="border-top">solid black 1.5pt</xsl:attribute>
2327
+ <xsl:attribute name="border-bottom">solid black 1pt</xsl:attribute>
2328
+ </xsl:when>
2329
+ <xsl:when test="position() = last()">
2330
+ <xsl:attribute name="border-top">solid black 1pt</xsl:attribute>
2331
+ <xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute>
2332
+ </xsl:when>
2333
+ </xsl:choose>
2334
+
2335
+ </xsl:template> <!-- refine_table-header-row-style -->
2336
+
2269
2337
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
2270
2338
 
2271
2339
  <xsl:attribute name="font-size">9pt</xsl:attribute>
@@ -2274,10 +2342,20 @@
2274
2342
 
2275
2343
  </xsl:attribute-set>
2276
2344
 
2345
+ <xsl:template name="refine_table-footer-row-style">
2346
+
2347
+ </xsl:template> <!-- refine_table-footer-row-style -->
2348
+
2277
2349
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
2278
2350
 
2279
2351
  </xsl:attribute-set>
2280
2352
 
2353
+ <xsl:template name="refine_table-body-row-style">
2354
+
2355
+ <xsl:call-template name="setBordersTableArray"/>
2356
+
2357
+ </xsl:template> <!-- refine_table-body-row-style -->
2358
+
2281
2359
  <xsl:attribute-set name="table-header-cell-style">
2282
2360
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2283
2361
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2289,6 +2367,18 @@
2289
2367
 
2290
2368
  </xsl:attribute-set> <!-- table-header-cell-style -->
2291
2369
 
2370
+ <xsl:template name="refine_table-header-cell-style">
2371
+
2372
+ <xsl:call-template name="setBordersTableArray"/>
2373
+
2374
+ <xsl:if test="$lang = 'ar'">
2375
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2376
+ </xsl:if>
2377
+
2378
+ <xsl:call-template name="setTableCellAttributes"/>
2379
+
2380
+ </xsl:template> <!-- refine_table-header-cell-style -->
2381
+
2292
2382
  <xsl:attribute-set name="table-cell-style">
2293
2383
  <xsl:attribute name="display-align">center</xsl:attribute>
2294
2384
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2299,6 +2389,25 @@
2299
2389
 
2300
2390
  </xsl:attribute-set> <!-- table-cell-style -->
2301
2391
 
2392
+ <xsl:template name="refine_table-cell-style">
2393
+
2394
+ <xsl:if test="$lang = 'ar'">
2395
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2396
+ </xsl:if>
2397
+
2398
+ <!-- bsi -->
2399
+
2400
+ <xsl:call-template name="setBordersTableArray"/>
2401
+
2402
+ <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
2403
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
2404
+ </xsl:if>
2405
+ <xsl:if test="ancestor::*[local-name() = 'tfoot']">
2406
+ <xsl:attribute name="border">solid black 0</xsl:attribute>
2407
+ </xsl:if>
2408
+
2409
+ </xsl:template> <!-- refine_table-cell-style -->
2410
+
2302
2411
  <xsl:attribute-set name="table-footer-cell-style">
2303
2412
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2304
2413
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2309,6 +2418,10 @@
2309
2418
 
2310
2419
  </xsl:attribute-set> <!-- table-footer-cell-style -->
2311
2420
 
2421
+ <xsl:template name="refine_table-footer-cell-style">
2422
+
2423
+ </xsl:template> <!-- refine_table-footer-cell-style -->
2424
+
2312
2425
  <xsl:attribute-set name="table-note-style">
2313
2426
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2314
2427
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2318,6 +2431,10 @@
2318
2431
 
2319
2432
  </xsl:attribute-set><!-- table-note-style -->
2320
2433
 
2434
+ <xsl:template name="refine_table-note-style">
2435
+
2436
+ </xsl:template> <!-- refine_table-note-style -->
2437
+
2321
2438
  <xsl:attribute-set name="table-fn-style">
2322
2439
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2323
2440
 
@@ -2376,11 +2493,19 @@
2376
2493
 
2377
2494
  </xsl:attribute-set>
2378
2495
 
2496
+ <xsl:template name="refine_dt-cell-style">
2497
+
2498
+ </xsl:template> <!-- refine_dt-cell-style -->
2499
+
2379
2500
  <xsl:attribute-set name="dt-block-style">
2380
2501
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
2381
2502
 
2382
2503
  </xsl:attribute-set>
2383
2504
 
2505
+ <xsl:template name="refine_dt-block-style">
2506
+
2507
+ </xsl:template> <!-- refine_dt-block-style -->
2508
+
2384
2509
  <xsl:attribute-set name="dl-name-style">
2385
2510
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2386
2511
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2394,6 +2519,10 @@
2394
2519
 
2395
2520
  </xsl:attribute-set>
2396
2521
 
2522
+ <xsl:template name="refine_dd-cell-style">
2523
+
2524
+ </xsl:template> <!-- refine_dd-cell-style -->
2525
+
2397
2526
  <!-- ========================== -->
2398
2527
  <!-- END Definition's list styles -->
2399
2528
  <!-- ========================== -->
@@ -2426,6 +2555,12 @@
2426
2555
 
2427
2556
  </xsl:attribute-set>
2428
2557
 
2558
+ <xsl:template name="refine_eref-style">
2559
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
2560
+ <xsl:variable name="text" select="normalize-space()"/>
2561
+
2562
+ </xsl:template> <!-- refine_eref-style -->
2563
+
2429
2564
  <xsl:attribute-set name="note-style">
2430
2565
 
2431
2566
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2435,6 +2570,10 @@
2435
2570
 
2436
2571
  </xsl:attribute-set>
2437
2572
 
2573
+ <xsl:template name="refine_note-style">
2574
+
2575
+ </xsl:template>
2576
+
2438
2577
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
2439
2578
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
2440
2579
 
@@ -2444,11 +2583,19 @@
2444
2583
 
2445
2584
  </xsl:attribute-set>
2446
2585
 
2586
+ <xsl:template name="refine_note-name-style">
2587
+
2588
+ </xsl:template> <!-- refine_note-name-style -->
2589
+
2447
2590
  <xsl:attribute-set name="table-note-name-style">
2448
2591
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
2449
2592
 
2450
2593
  </xsl:attribute-set>
2451
2594
 
2595
+ <xsl:template name="refine_table-note-name-style">
2596
+
2597
+ </xsl:template> <!-- refine_table-note-name-style -->
2598
+
2452
2599
  <xsl:attribute-set name="note-p-style">
2453
2600
 
2454
2601
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
@@ -2465,10 +2612,18 @@
2465
2612
 
2466
2613
  </xsl:attribute-set>
2467
2614
 
2615
+ <xsl:template name="refine_termnote-style">
2616
+
2617
+ </xsl:template> <!-- refine_termnote-style -->
2618
+
2468
2619
  <xsl:attribute-set name="termnote-name-style">
2469
2620
 
2470
2621
  </xsl:attribute-set>
2471
2622
 
2623
+ <xsl:template name="refine_termnote-name-style">
2624
+
2625
+ </xsl:template>
2626
+
2472
2627
  <xsl:attribute-set name="termnote-p-style">
2473
2628
 
2474
2629
  </xsl:attribute-set>
@@ -2483,6 +2638,16 @@
2483
2638
 
2484
2639
  </xsl:attribute-set>
2485
2640
 
2641
+ <xsl:template name="refine_quote-style">
2642
+
2643
+ <xsl:if test="ancestor::*[local-name() = 'boilerplate']">
2644
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2645
+ <xsl:attribute name="margin-right">7mm</xsl:attribute>
2646
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2647
+ </xsl:if>
2648
+
2649
+ </xsl:template>
2650
+
2486
2651
  <xsl:attribute-set name="quote-source-style">
2487
2652
  <xsl:attribute name="text-align">right</xsl:attribute>
2488
2653
 
@@ -2494,6 +2659,10 @@
2494
2659
 
2495
2660
  </xsl:attribute-set>
2496
2661
 
2662
+ <xsl:template name="refine_termsource-style">
2663
+
2664
+ </xsl:template> <!-- refine_termsource-style -->
2665
+
2497
2666
  <xsl:attribute-set name="termsource-text-style">
2498
2667
 
2499
2668
  </xsl:attribute-set>
@@ -2534,6 +2703,10 @@
2534
2703
 
2535
2704
  </xsl:attribute-set>
2536
2705
 
2706
+ <xsl:template name="refine_figure-name-style">
2707
+
2708
+ </xsl:template> <!-- refine_figure-name-style -->
2709
+
2537
2710
  <xsl:attribute-set name="figure-source-style">
2538
2711
 
2539
2712
  </xsl:attribute-set>
@@ -2553,6 +2726,10 @@
2553
2726
 
2554
2727
  </xsl:attribute-set> <!-- formula-stem-block-style -->
2555
2728
 
2729
+ <xsl:template name="refine_formula-stem-block-style">
2730
+
2731
+ </xsl:template> <!-- refine_formula-stem-block-style -->
2732
+
2556
2733
  <xsl:attribute-set name="formula-stem-number-style">
2557
2734
  <xsl:attribute name="text-align">right</xsl:attribute>
2558
2735
 
@@ -2564,6 +2741,10 @@
2564
2741
 
2565
2742
  </xsl:attribute-set>
2566
2743
 
2744
+ <xsl:template name="refine_image-style">
2745
+
2746
+ </xsl:template>
2747
+
2567
2748
  <xsl:attribute-set name="figure-pseudocode-p-style">
2568
2749
 
2569
2750
  </xsl:attribute-set>
@@ -2660,6 +2841,10 @@
2660
2841
 
2661
2842
  </xsl:attribute-set>
2662
2843
 
2844
+ <xsl:template name="refine_mathml-style">
2845
+
2846
+ </xsl:template>
2847
+
2663
2848
  <xsl:attribute-set name="list-style">
2664
2849
 
2665
2850
  <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
@@ -2667,6 +2852,10 @@
2667
2852
 
2668
2853
  </xsl:attribute-set> <!-- list-style -->
2669
2854
 
2855
+ <xsl:template name="refine_list-style">
2856
+
2857
+ </xsl:template> <!-- refine_list-style -->
2858
+
2670
2859
  <xsl:attribute-set name="list-name-style">
2671
2860
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2672
2861
 
@@ -2679,14 +2868,26 @@
2679
2868
 
2680
2869
  </xsl:attribute-set>
2681
2870
 
2871
+ <xsl:template name="refine_list-item-style">
2872
+
2873
+ </xsl:template> <!-- refine_list-item-style -->
2874
+
2682
2875
  <xsl:attribute-set name="list-item-label-style">
2683
2876
 
2684
2877
  </xsl:attribute-set>
2685
2878
 
2879
+ <xsl:template name="refine_list-item-label-style">
2880
+
2881
+ </xsl:template> <!-- refine_list-item-label-style -->
2882
+
2686
2883
  <xsl:attribute-set name="list-item-body-style">
2687
2884
 
2688
2885
  </xsl:attribute-set>
2689
2886
 
2887
+ <xsl:template name="refine_list-item-body-style">
2888
+
2889
+ </xsl:template> <!-- refine_list-item-body-style -->
2890
+
2690
2891
  <xsl:attribute-set name="toc-style">
2691
2892
  <xsl:attribute name="line-height">135%</xsl:attribute>
2692
2893
  </xsl:attribute-set>
@@ -2697,6 +2898,15 @@
2697
2898
 
2698
2899
  </xsl:attribute-set>
2699
2900
 
2901
+ <xsl:template name="refine_fn-reference-style">
2902
+
2903
+ <xsl:if test="ancestor::*[local-name()='table']">
2904
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2905
+ <xsl:attribute name="baseline-shift">15%</xsl:attribute>
2906
+ </xsl:if>
2907
+
2908
+ </xsl:template> <!-- refine_fn-reference-style -->
2909
+
2700
2910
  <xsl:attribute-set name="fn-style">
2701
2911
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2702
2912
  </xsl:attribute-set>
@@ -2722,6 +2932,10 @@
2722
2932
 
2723
2933
  </xsl:attribute-set>
2724
2934
 
2935
+ <xsl:template name="refine_fn-body-style">
2936
+
2937
+ </xsl:template> <!-- refine_fn-body-style -->
2938
+
2725
2939
  <xsl:attribute-set name="fn-body-num-style">
2726
2940
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2727
2941
 
@@ -2731,6 +2945,10 @@
2731
2945
 
2732
2946
  </xsl:attribute-set> <!-- fn-body-num-style -->
2733
2947
 
2948
+ <xsl:template name="refine_fn-body-num-style">
2949
+
2950
+ </xsl:template> <!-- refine_fn-body-num-style -->
2951
+
2734
2952
  <!-- admonition -->
2735
2953
  <xsl:attribute-set name="admonition-style">
2736
2954
 
@@ -3374,7 +3592,9 @@
3374
3592
 
3375
3593
  <fo:block-container xsl:use-attribute-sets="table-container-style">
3376
3594
 
3377
- <!-- end table block-container attributes -->
3595
+ <xsl:call-template name="refine_table-container-style">
3596
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3597
+ </xsl:call-template>
3378
3598
 
3379
3599
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
3380
3600
 
@@ -3395,11 +3615,9 @@
3395
3615
 
3396
3616
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3397
3617
 
3398
- <xsl:call-template name="setBordersTableArray"/>
3399
-
3400
- <xsl:if test="*[local-name()='thead']">
3401
- <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
3402
- </xsl:if>
3618
+ <xsl:call-template name="refine_table-style">
3619
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3620
+ </xsl:call-template>
3403
3621
 
3404
3622
  </xsl:element>
3405
3623
  </xsl:variable>
@@ -3465,7 +3683,7 @@
3465
3683
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3466
3684
  </xsl:when>
3467
3685
  <xsl:otherwise>
3468
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3686
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3469
3687
  </xsl:otherwise>
3470
3688
  </xsl:choose>
3471
3689
 
@@ -3555,6 +3773,10 @@
3555
3773
 
3556
3774
  <fo:block xsl:use-attribute-sets="table-name-style">
3557
3775
 
3776
+ <xsl:call-template name="refine_table-name-style">
3777
+ <xsl:with-param name="continued" select="$continued"/>
3778
+ </xsl:call-template>
3779
+
3558
3780
  <xsl:choose>
3559
3781
  <xsl:when test="$continued = 'true'">
3560
3782
  <!-- $namespace = 'iso' or -->
@@ -3943,6 +4165,8 @@
3943
4165
  <fo:table-row>
3944
4166
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3945
4167
 
4168
+ <xsl:call-template name="refine_table-header-title-style"/>
4169
+
3946
4170
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3947
4171
  <xsl:with-param name="continued">true</xsl:with-param>
3948
4172
  </xsl:apply-templates>
@@ -3964,6 +4188,10 @@
3964
4188
  </fo:table-row>
3965
4189
  </xsl:template> <!-- table-header-title -->
3966
4190
 
4191
+ <xsl:template name="refine_table-header-title-style">
4192
+
4193
+ </xsl:template> <!-- refine_table-header-title-style -->
4194
+
3967
4195
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3968
4196
  <fo:table-body>
3969
4197
  <xsl:apply-templates/>
@@ -3988,7 +4216,7 @@
3988
4216
  <xsl:param name="colwidths"/>
3989
4217
  <xsl:param name="colgroup"/>
3990
4218
 
3991
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4219
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3992
4220
 
3993
4221
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3994
4222
 
@@ -4048,6 +4276,8 @@
4048
4276
  <fo:table-row>
4049
4277
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4050
4278
 
4279
+ <xsl:call-template name="refine_table-footer-cell-style"/>
4280
+
4051
4281
  <xsl:call-template name="setBordersTableArray"/>
4052
4282
 
4053
4283
  <!-- fn will be processed inside 'note' processing -->
@@ -4056,6 +4286,7 @@
4056
4286
 
4057
4287
  <!-- except gb and bsi -->
4058
4288
 
4289
+ <xsl:apply-templates select="../*[local-name()='p']"/>
4059
4290
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4060
4291
  <xsl:apply-templates select="../*[local-name()='note']"/>
4061
4292
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -4228,18 +4459,7 @@
4228
4459
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4229
4460
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4230
4461
 
4231
- <xsl:call-template name="setBordersTableArray"/>
4232
-
4233
- <xsl:choose>
4234
- <xsl:when test="position() = 1">
4235
- <xsl:attribute name="border-top">solid black 1.5pt</xsl:attribute>
4236
- <xsl:attribute name="border-bottom">solid black 1pt</xsl:attribute>
4237
- </xsl:when>
4238
- <xsl:when test="position() = last()">
4239
- <xsl:attribute name="border-top">solid black 1pt</xsl:attribute>
4240
- <xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute>
4241
- </xsl:when>
4242
- </xsl:choose>
4462
+ <xsl:call-template name="refine_table-header-row-style"/>
4243
4463
 
4244
4464
  <xsl:call-template name="setTableRowAttributes"/>
4245
4465
 
@@ -4273,6 +4493,8 @@
4273
4493
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4274
4494
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4275
4495
 
4496
+ <xsl:call-template name="refine_table-footer-row-style"/>
4497
+
4276
4498
  <xsl:call-template name="setTableRowAttributes"/>
4277
4499
  <xsl:apply-templates/>
4278
4500
  </fo:table-row>
@@ -4286,9 +4508,10 @@
4286
4508
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4287
4509
  </xsl:if>
4288
4510
 
4289
- <xsl:call-template name="setBordersTableArray"/>
4511
+ <xsl:call-template name="refine_table-body-row-style"/>
4290
4512
 
4291
4513
  <xsl:call-template name="setTableRowAttributes"/>
4514
+
4292
4515
  <xsl:apply-templates/>
4293
4516
  </fo:table-row>
4294
4517
  </xsl:template>
@@ -4307,13 +4530,7 @@
4307
4530
  <xsl:with-param name="default">center</xsl:with-param>
4308
4531
  </xsl:call-template>
4309
4532
 
4310
- <xsl:call-template name="setBordersTableArray"/>
4311
-
4312
- <xsl:if test="$lang = 'ar'">
4313
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4314
- </xsl:if>
4315
-
4316
- <xsl:call-template name="setTableCellAttributes"/>
4533
+ <xsl:call-template name="refine_table-header-cell-style"/>
4317
4534
 
4318
4535
  <fo:block>
4319
4536
  <xsl:apply-templates/>
@@ -4355,20 +4572,7 @@
4355
4572
  <xsl:with-param name="default">left</xsl:with-param>
4356
4573
  </xsl:call-template>
4357
4574
 
4358
- <xsl:if test="$lang = 'ar'">
4359
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4360
- </xsl:if>
4361
-
4362
- <!-- bsi -->
4363
-
4364
- <xsl:call-template name="setBordersTableArray"/>
4365
-
4366
- <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
4367
- <xsl:attribute name="padding-left">0mm</xsl:attribute>
4368
- </xsl:if>
4369
- <xsl:if test="ancestor::*[local-name() = 'tfoot']">
4370
- <xsl:attribute name="border">solid black 0</xsl:attribute>
4371
- </xsl:if>
4575
+ <xsl:call-template name="refine_table-cell-style"/>
4372
4576
 
4373
4577
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4374
4578
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -4399,9 +4603,13 @@
4399
4603
 
4400
4604
  <fo:block xsl:use-attribute-sets="table-note-style">
4401
4605
 
4606
+ <xsl:call-template name="refine_table-note-style"/>
4607
+
4402
4608
  <!-- Table's note name (NOTE, for example) -->
4403
4609
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
4404
4610
 
4611
+ <xsl:call-template name="refine_table-note-name-style"/>
4612
+
4405
4613
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4406
4614
 
4407
4615
  </fo:inline>
@@ -4429,6 +4637,14 @@
4429
4637
  <!-- list of footnotes to calculate actual footnotes number -->
4430
4638
  <xsl:variable name="p_fn_">
4431
4639
  <xsl:call-template name="get_fn_list"/>
4640
+ <!-- <xsl:choose>
4641
+ <xsl:when test="$namespace = 'jis'">
4642
+ <xsl:call-template name="get_fn_list_for_element"/>
4643
+ </xsl:when>
4644
+ <xsl:otherwise>
4645
+ <xsl:call-template name="get_fn_list"/>
4646
+ </xsl:otherwise>
4647
+ </xsl:choose> -->
4432
4648
  </xsl:variable>
4433
4649
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4434
4650
 
@@ -4453,7 +4669,14 @@
4453
4669
 
4454
4670
  </xsl:variable>
4455
4671
 
4456
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4672
+ <xsl:variable name="ref_id">
4673
+ <xsl:choose>
4674
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4675
+ <xsl:otherwise>
4676
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4677
+ </xsl:otherwise>
4678
+ </xsl:choose>
4679
+ </xsl:variable>
4457
4680
  <xsl:variable name="footnote_inline">
4458
4681
  <fo:inline>
4459
4682
 
@@ -4476,9 +4699,13 @@
4476
4699
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4477
4700
  </xsl:if>
4478
4701
 
4479
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4480
- <xsl:value-of select="$current_fn_number_text"/>
4481
- </fo:basic-link>
4702
+ <xsl:call-template name="insert_basic_link">
4703
+ <xsl:with-param name="element">
4704
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4705
+ <xsl:copy-of select="$current_fn_number_text"/>
4706
+ </fo:basic-link>
4707
+ </xsl:with-param>
4708
+ </xsl:call-template>
4482
4709
  </fo:inline>
4483
4710
  </xsl:variable>
4484
4711
 
@@ -4495,8 +4722,12 @@
4495
4722
 
4496
4723
  <fo:block xsl:use-attribute-sets="fn-body-style">
4497
4724
 
4725
+ <xsl:call-template name="refine_fn-body-style"/>
4726
+
4498
4727
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
4499
4728
 
4729
+ <xsl:call-template name="refine_fn-body-num-style"/>
4730
+
4500
4731
  <xsl:value-of select="$current_fn_number_text"/>
4501
4732
  </fo:inline>
4502
4733
  <xsl:apply-templates/>
@@ -4548,6 +4779,28 @@
4548
4779
  </xsl:choose>
4549
4780
  </xsl:template>
4550
4781
 
4782
+ <xsl:template name="get_fn_list_for_element">
4783
+ <xsl:choose>
4784
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4785
+ <fn gen_id="{generate-id(.)}">
4786
+ <xsl:copy-of select="@*"/>
4787
+ <xsl:copy-of select="node()"/>
4788
+ </fn>
4789
+ </xsl:when>
4790
+ <xsl:otherwise>
4791
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4792
+ <xsl:variable name="element_id" select="@id"/>
4793
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4794
+ <!-- copy unique fn -->
4795
+ <fn gen_id="{generate-id(.)}">
4796
+ <xsl:copy-of select="@*"/>
4797
+ <xsl:copy-of select="node()"/>
4798
+ </fn>
4799
+ </xsl:for-each>
4800
+ </xsl:for-each>
4801
+ </xsl:otherwise>
4802
+ </xsl:choose>
4803
+ </xsl:template>
4551
4804
  <!-- ============================ -->
4552
4805
  <!-- table's footnotes rendering -->
4553
4806
  <!-- ============================ -->
@@ -4722,10 +4975,7 @@
4722
4975
  <xsl:template match="*[local-name()='fn']">
4723
4976
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4724
4977
 
4725
- <xsl:if test="ancestor::*[local-name()='table']">
4726
- <xsl:attribute name="font-weight">normal</xsl:attribute>
4727
- <xsl:attribute name="baseline-shift">15%</xsl:attribute>
4728
- </xsl:if>
4978
+ <xsl:call-template name="refine_fn-reference-style"/>
4729
4979
 
4730
4980
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4731
4981
 
@@ -4820,15 +5070,17 @@
4820
5070
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4821
5071
  <xsl:text> </xsl:text>
4822
5072
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4823
- <xsl:text/>
4824
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5073
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5074
+ <xsl:text> </xsl:text>
5075
+ </xsl:if>
5076
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
4825
5077
  </fo:block>
4826
5078
 
4827
5079
  </xsl:when> <!-- END: only one component -->
4828
5080
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4829
5081
  <fo:block margin-bottom="12pt" text-align="left">
4830
5082
 
4831
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5083
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4832
5084
 
4833
5085
  <!-- <xsl:variable name="title-where">
4834
5086
  <xsl:call-template name="getLocalizedString">
@@ -4843,8 +5095,7 @@
4843
5095
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
4844
5096
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4845
5097
 
4846
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4847
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5098
+ <xsl:call-template name="refine_figure_key_style"/>
4848
5099
 
4849
5100
  <xsl:variable name="title-key">
4850
5101
  <xsl:call-template name="getLocalizedString">
@@ -4860,10 +5111,7 @@
4860
5111
  <xsl:if test="$onlyOneComponent = 'false'">
4861
5112
  <fo:block>
4862
5113
 
4863
- <xsl:if test="$parent = 'formula'">
4864
- <xsl:attribute name="margin-left">4mm</xsl:attribute>
4865
- </xsl:if>
4866
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
5114
+ <xsl:call-template name="refine_multicomponent_style"/>
4867
5115
 
4868
5116
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4869
5117
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -4871,6 +5119,8 @@
4871
5119
 
4872
5120
  <fo:block>
4873
5121
 
5122
+ <xsl:call-template name="refine_multicomponent_block_style"/>
5123
+
4874
5124
  <xsl:apply-templates select="*[local-name() = 'name']">
4875
5125
  <xsl:with-param name="process">true</xsl:with-param>
4876
5126
  </xsl:apply-templates>
@@ -5028,6 +5278,34 @@
5028
5278
 
5029
5279
  </xsl:template> <!-- END: dl -->
5030
5280
 
5281
+ <xsl:template name="refine_dl_formula_where_style">
5282
+
5283
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5284
+
5285
+ </xsl:template> <!-- refine_dl_formula_where_style -->
5286
+
5287
+ <xsl:template name="refine_figure_key_style">
5288
+
5289
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5290
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5291
+
5292
+ </xsl:template> <!-- refine_figure_key_style -->
5293
+
5294
+ <xsl:template name="refine_multicomponent_style">
5295
+ <xsl:variable name="parent" select="local-name(..)"/>
5296
+
5297
+ <xsl:if test="$parent = 'formula'">
5298
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
5299
+ </xsl:if>
5300
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
5301
+
5302
+ </xsl:template> <!-- refine_multicomponent_style -->
5303
+
5304
+ <xsl:template name="refine_multicomponent_block_style">
5305
+ <xsl:variable name="parent" select="local-name(..)"/>
5306
+
5307
+ </xsl:template> <!-- refine_multicomponent_block_style -->
5308
+
5031
5309
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5032
5310
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5033
5311
 
@@ -5247,6 +5525,8 @@
5247
5525
 
5248
5526
  </xsl:if>
5249
5527
 
5528
+ <xsl:call-template name="refine_dt-cell-style"/>
5529
+
5250
5530
  <fo:block xsl:use-attribute-sets="dt-block-style">
5251
5531
  <xsl:copy-of select="@id"/>
5252
5532
 
@@ -5254,6 +5534,8 @@
5254
5534
  <xsl:attribute name="margin-top">0</xsl:attribute>
5255
5535
  </xsl:if>
5256
5536
 
5537
+ <xsl:call-template name="refine_dt-block-style"/>
5538
+
5257
5539
  <xsl:apply-templates>
5258
5540
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5259
5541
  </xsl:apply-templates>
@@ -5273,6 +5555,8 @@
5273
5555
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5274
5556
  </xsl:if>
5275
5557
 
5558
+ <xsl:call-template name="refine_dd-cell-style"/>
5559
+
5276
5560
  <fo:block>
5277
5561
 
5278
5562
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5318,8 +5602,18 @@
5318
5602
  </xsl:if>
5319
5603
  </xsl:template>
5320
5604
 
5321
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5322
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5605
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5606
+ <xsl:variable name="is_inline_element_after_where">
5607
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5608
+ </xsl:variable>
5609
+ <xsl:choose>
5610
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5611
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5612
+ </xsl:when>
5613
+ <xsl:otherwise>
5614
+ <xsl:apply-templates select="."/>
5615
+ </xsl:otherwise>
5616
+ </xsl:choose>
5323
5617
  </xsl:template>
5324
5618
 
5325
5619
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5413,12 +5707,18 @@
5413
5707
  <xsl:param name="split_keep-within-line"/>
5414
5708
  <fo:inline font-weight="bold">
5415
5709
 
5710
+ <xsl:call-template name="refine_strong_style"/>
5711
+
5416
5712
  <xsl:apply-templates>
5417
5713
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5418
5714
  </xsl:apply-templates>
5419
5715
  </fo:inline>
5420
5716
  </xsl:template>
5421
5717
 
5718
+ <xsl:template name="refine_strong_style">
5719
+
5720
+ </xsl:template>
5721
+
5422
5722
  <xsl:template match="*[local-name()='padding']">
5423
5723
  <fo:inline padding-right="{@value}"> </fo:inline>
5424
5724
  </xsl:template>
@@ -6563,6 +6863,11 @@
6563
6863
 
6564
6864
  <fo:inline xsl:use-attribute-sets="mathml-style">
6565
6865
 
6866
+ <!-- DEBUG -->
6867
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
6868
+
6869
+ <xsl:call-template name="refine_mathml-style"/>
6870
+
6566
6871
  <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
6567
6872
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
6568
6873
  </xsl:if>
@@ -6667,12 +6972,7 @@
6667
6972
 
6668
6973
  <fo:instream-foreign-object fox:alt-text="Math">
6669
6974
 
6670
- <xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
6671
- <xsl:attribute name="width">95%</xsl:attribute>
6672
- <xsl:attribute name="content-height">100%</xsl:attribute>
6673
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6674
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6675
- </xsl:if>
6975
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6676
6976
 
6677
6977
  <!-- put MathML in Actual Text -->
6678
6978
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
@@ -6694,6 +6994,17 @@
6694
6994
  </fo:instream-foreign-object>
6695
6995
  </xsl:template>
6696
6996
 
6997
+ <xsl:template name="refine_mathml_insteam_object_style">
6998
+
6999
+ <xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
7000
+ <xsl:attribute name="width">95%</xsl:attribute>
7001
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7002
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7003
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7004
+ </xsl:if>
7005
+
7006
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
7007
+
6697
7008
  <xsl:template match="mathml:*" mode="mathml_actual_text">
6698
7009
  <!-- <xsl:text>a+b</xsl:text> -->
6699
7010
  <xsl:text>&lt;</xsl:text>
@@ -6757,6 +7068,79 @@
6757
7068
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6758
7069
  </xsl:template>
6759
7070
 
7071
+ <!-- special case for:
7072
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7073
+ <mstyle displaystyle="true">
7074
+ <msup>
7075
+ <mi color="#00000000">C</mi>
7076
+ <mtext>R</mtext>
7077
+ </msup>
7078
+ <msubsup>
7079
+ <mtext>C</mtext>
7080
+ <mi>n</mi>
7081
+ <mi>k</mi>
7082
+ </msubsup>
7083
+ </mstyle>
7084
+ </math>
7085
+ -->
7086
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7087
+ <xsl:copy>
7088
+ <xsl:copy-of select="@*"/>
7089
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
7090
+ <xsl:if test="string-length($next_mtext) != ''">
7091
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7092
+ </xsl:if>
7093
+ <xsl:apply-templates/>
7094
+ <xsl:value-of select="$next_mtext"/>
7095
+ </xsl:copy>
7096
+ </xsl:template>
7097
+
7098
+ <!-- special case for:
7099
+ <msup>
7100
+ <mtext/>
7101
+ <mn>1</mn>
7102
+ </msup>
7103
+ convert to (add mspace after mtext and enclose them into mrow):
7104
+ <msup>
7105
+ <mrow>
7106
+ <mtext/>
7107
+ <mspace height="1.47ex"/>
7108
+ </mrow>
7109
+ <mn>1</mn>
7110
+ </msup>
7111
+ -->
7112
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7113
+ <mathml:mrow>
7114
+ <xsl:copy-of select="."/>
7115
+ <mathml:mspace height="1.47ex"/>
7116
+ </mathml:mrow>
7117
+ </xsl:template>
7118
+
7119
+ <!-- add space around vertical line -->
7120
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7121
+ <xsl:copy>
7122
+ <xsl:apply-templates select="@*" mode="mathml"/>
7123
+ <xsl:if test="not(@lspace)">
7124
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7125
+ </xsl:if>
7126
+ <xsl:if test="not(@rspace)">
7127
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7128
+ </xsl:if>
7129
+ <xsl:apply-templates mode="mathml"/>
7130
+ </xsl:copy>
7131
+ </xsl:template>
7132
+
7133
+ <!-- decrease fontsize for 'Circled Times' char -->
7134
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7135
+ <xsl:copy>
7136
+ <xsl:apply-templates select="@*" mode="mathml"/>
7137
+ <xsl:if test="not(@fontsize)">
7138
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7139
+ </xsl:if>
7140
+ <xsl:apply-templates mode="mathml"/>
7141
+ </xsl:copy>
7142
+ </xsl:template>
7143
+
6760
7144
  <!-- Examples:
6761
7145
  <stem type="AsciiMath">x = 1</stem>
6762
7146
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -6765,6 +7149,8 @@
6765
7149
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6766
7150
  <fo:inline xsl:use-attribute-sets="mathml-style">
6767
7151
 
7152
+ <xsl:call-template name="refine_mathml-style"/>
7153
+
6768
7154
  <xsl:choose>
6769
7155
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6770
7156
  <xsl:otherwise>
@@ -6809,24 +7195,30 @@
6809
7195
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6810
7196
  </xsl:if>
6811
7197
 
7198
+ <xsl:call-template name="refine_link-style"/>
7199
+
6812
7200
  <xsl:choose>
6813
7201
  <xsl:when test="$target_text = ''">
6814
7202
  <xsl:apply-templates/>
6815
7203
  </xsl:when>
6816
7204
  <xsl:otherwise>
6817
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6818
- <xsl:choose>
6819
- <xsl:when test="normalize-space(.) = ''">
6820
- <xsl:call-template name="add-zero-spaces-link-java">
6821
- <xsl:with-param name="text" select="$target_text"/>
6822
- </xsl:call-template>
6823
- </xsl:when>
6824
- <xsl:otherwise>
6825
- <!-- output text from <link>text</link> -->
6826
- <xsl:apply-templates/>
6827
- </xsl:otherwise>
6828
- </xsl:choose>
6829
- </fo:basic-link>
7205
+ <xsl:call-template name="insert_basic_link">
7206
+ <xsl:with-param name="element">
7207
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7208
+ <xsl:choose>
7209
+ <xsl:when test="normalize-space(.) = ''">
7210
+ <xsl:call-template name="add-zero-spaces-link-java">
7211
+ <xsl:with-param name="text" select="$target_text"/>
7212
+ </xsl:call-template>
7213
+ </xsl:when>
7214
+ <xsl:otherwise>
7215
+ <!-- output text from <link>text</link> -->
7216
+ <xsl:apply-templates/>
7217
+ </xsl:otherwise>
7218
+ </xsl:choose>
7219
+ </fo:basic-link>
7220
+ </xsl:with-param>
7221
+ </xsl:call-template>
6830
7222
  </xsl:otherwise>
6831
7223
  </xsl:choose>
6832
7224
  </fo:inline>
@@ -6889,12 +7281,19 @@
6889
7281
  </xsl:template>
6890
7282
 
6891
7283
  <xsl:template match="*[local-name() = 'xref']">
6892
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6893
- <xsl:if test="parent::*[local-name() = 'add']">
6894
- <xsl:call-template name="append_add-style"/>
6895
- </xsl:if>
6896
- <xsl:apply-templates/>
6897
- </fo:basic-link>
7284
+ <xsl:call-template name="insert_basic_link">
7285
+ <xsl:with-param name="element">
7286
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7287
+ <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://'))">
7288
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7289
+ </xsl:if>
7290
+ <xsl:if test="parent::*[local-name() = 'add']">
7291
+ <xsl:call-template name="append_add-style"/>
7292
+ </xsl:if>
7293
+ <xsl:apply-templates/>
7294
+ </fo:basic-link>
7295
+ </xsl:with-param>
7296
+ </xsl:call-template>
6898
7297
  </xsl:template>
6899
7298
 
6900
7299
  <!-- ====== -->
@@ -6949,6 +7348,8 @@
6949
7348
  <fo:table-cell display-align="center">
6950
7349
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6951
7350
 
7351
+ <xsl:call-template name="refine_formula-stem-block-style"/>
7352
+
6952
7353
  <xsl:apply-templates/>
6953
7354
  </fo:block>
6954
7355
  </fo:table-cell>
@@ -6990,12 +7391,18 @@
6990
7391
 
6991
7392
  <xsl:call-template name="setBlockSpanAll"/>
6992
7393
 
7394
+ <xsl:call-template name="refine_note-style"/>
7395
+
6993
7396
  <fo:block-container margin-left="0mm" margin-right="0mm">
6994
7397
 
6995
7398
  <fo:block>
6996
7399
 
7400
+ <xsl:call-template name="refine_note_block_style"/>
7401
+
6997
7402
  <fo:inline xsl:use-attribute-sets="note-name-style">
6998
7403
 
7404
+ <xsl:call-template name="refine_note-name-style"/>
7405
+
6999
7406
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7000
7407
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7001
7408
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7021,6 +7428,10 @@
7021
7428
 
7022
7429
  </xsl:template>
7023
7430
 
7431
+ <xsl:template name="refine_note_block_style">
7432
+
7433
+ </xsl:template>
7434
+
7024
7435
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7025
7436
  <xsl:variable name="num"><xsl:number/></xsl:variable>
7026
7437
  <xsl:choose>
@@ -7042,12 +7453,16 @@
7042
7453
 
7043
7454
  <xsl:call-template name="setBlockSpanAll"/>
7044
7455
 
7456
+ <xsl:call-template name="refine_termnote-style"/>
7457
+
7045
7458
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7046
7459
 
7047
7460
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
7048
7461
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7049
7462
  </xsl:if>
7050
7463
 
7464
+ <xsl:call-template name="refine_termnote-name-style"/>
7465
+
7051
7466
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7052
7467
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7053
7468
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7219,6 +7634,8 @@
7219
7634
  <xsl:otherwise>
7220
7635
  <fo:block xsl:use-attribute-sets="image-style">
7221
7636
 
7637
+ <xsl:call-template name="refine_image-style"/>
7638
+
7222
7639
  <xsl:variable name="src">
7223
7640
  <xsl:call-template name="image_src"/>
7224
7641
  </xsl:variable>
@@ -7277,7 +7694,7 @@
7277
7694
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7278
7695
  </xsl:when>
7279
7696
  <xsl:when test="not(starts-with(@src, 'data:'))">
7280
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7697
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7281
7698
  </xsl:when>
7282
7699
  <xsl:otherwise>
7283
7700
  <xsl:value-of select="@src"/>
@@ -7299,7 +7716,7 @@
7299
7716
  </xsl:when>
7300
7717
  <xsl:when test="not(starts-with(@src, 'data:'))">
7301
7718
  <xsl:variable name="src">
7302
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7719
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7303
7720
  </xsl:variable>
7304
7721
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7305
7722
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -7685,15 +8102,19 @@
7685
8102
  <xsl:param name="dest"/>
7686
8103
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
7687
8104
  <fo:block font-size="1pt">
7688
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7689
- <fo:inline-container inline-progression-dimension="100%">
7690
- <fo:block-container height="{$height - 1}px" width="100%">
7691
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
7692
- <xsl:attribute name="background-color">magenta</xsl:attribute>
7693
- </xsl:if> -->
7694
- <fo:block> </fo:block></fo:block-container>
7695
- </fo:inline-container>
7696
- </fo:basic-link>
8105
+ <xsl:call-template name="insert_basic_link">
8106
+ <xsl:with-param name="element">
8107
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8108
+ <fo:inline-container inline-progression-dimension="100%">
8109
+ <fo:block-container height="{$height - 1}px" width="100%">
8110
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8111
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8112
+ </xsl:if> -->
8113
+ <fo:block> </fo:block></fo:block-container>
8114
+ </fo:inline-container>
8115
+ </fo:basic-link>
8116
+ </xsl:with-param>
8117
+ </xsl:call-template>
7697
8118
  </fo:block>
7698
8119
  </fo:block-container>
7699
8120
  </xsl:template>
@@ -8064,6 +8485,8 @@
8064
8485
  <xsl:if test="normalize-space() != ''">
8065
8486
  <fo:block xsl:use-attribute-sets="figure-name-style">
8066
8487
 
8488
+ <xsl:call-template name="refine_figure-name-style"/>
8489
+
8067
8490
  <xsl:apply-templates/>
8068
8491
  </fo:block>
8069
8492
  </xsl:if>
@@ -8328,6 +8751,8 @@
8328
8751
  </xsl:attribute>
8329
8752
  </xsl:for-each>
8330
8753
 
8754
+ <xsl:call-template name="refine_sourcecode-style"/>
8755
+
8331
8756
  <!-- remove margin between rows in the table with sourcecode line numbers -->
8332
8757
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8333
8758
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9032,6 +9457,8 @@
9032
9457
 
9033
9458
  <xsl:call-template name="setBlockSpanAll"/>
9034
9459
 
9460
+ <xsl:call-template name="refine_example-style"/>
9461
+
9035
9462
  <xsl:variable name="fo_element">
9036
9463
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
9037
9464
  inline
@@ -9164,6 +9591,8 @@
9164
9591
  </xsl:if>
9165
9592
  <fo:block xsl:use-attribute-sets="example-p-style">
9166
9593
 
9594
+ <xsl:call-template name="refine_example-p-style"/>
9595
+
9167
9596
  <xsl:apply-templates/>
9168
9597
  </fo:block>
9169
9598
  </fo:block-container>
@@ -9180,6 +9609,7 @@
9180
9609
  </xsl:otherwise>
9181
9610
  </xsl:choose>
9182
9611
  </xsl:template> <!-- example/p -->
9612
+
9183
9613
  <!-- ====== -->
9184
9614
  <!-- ====== -->
9185
9615
 
@@ -9191,6 +9621,8 @@
9191
9621
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
9192
9622
  <fo:block xsl:use-attribute-sets="termsource-style">
9193
9623
 
9624
+ <xsl:call-template name="refine_termsource-style"/>
9625
+
9194
9626
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
9195
9627
  <xsl:variable name="termsource_text">
9196
9628
  <xsl:apply-templates/>
@@ -9243,14 +9675,18 @@
9243
9675
  </xsl:template>
9244
9676
 
9245
9677
  <xsl:template match="*[local-name() = 'origin']">
9246
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9247
- <xsl:if test="normalize-space(@citeas) = ''">
9248
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9249
- </xsl:if>
9250
- <fo:inline xsl:use-attribute-sets="origin-style">
9251
- <xsl:apply-templates/>
9252
- </fo:inline>
9253
- </fo:basic-link>
9678
+ <xsl:call-template name="insert_basic_link">
9679
+ <xsl:with-param name="element">
9680
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9681
+ <xsl:if test="normalize-space(@citeas) = ''">
9682
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9683
+ </xsl:if>
9684
+ <fo:inline xsl:use-attribute-sets="origin-style">
9685
+ <xsl:apply-templates/>
9686
+ </fo:inline>
9687
+ </fo:basic-link>
9688
+ </xsl:with-param>
9689
+ </xsl:call-template>
9254
9690
  </xsl:template>
9255
9691
 
9256
9692
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9306,11 +9742,7 @@
9306
9742
  <fo:block-container margin-left="0mm">
9307
9743
  <fo:block-container xsl:use-attribute-sets="quote-style">
9308
9744
 
9309
- <xsl:if test="ancestor::*[local-name() = 'boilerplate']">
9310
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
9311
- <xsl:attribute name="margin-right">7mm</xsl:attribute>
9312
- <xsl:attribute name="font-style">normal</xsl:attribute>
9313
- </xsl:if>
9745
+ <xsl:call-template name="refine_quote-style"/>
9314
9746
 
9315
9747
  <fo:block-container margin-left="0mm" margin-right="0mm">
9316
9748
  <fo:block role="BlockQuote">
@@ -9334,9 +9766,13 @@
9334
9766
  <xsl:if test="../*[local-name() = 'author']">
9335
9767
  <xsl:text>, </xsl:text>
9336
9768
  </xsl:if>
9337
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9338
- <xsl:apply-templates/>
9339
- </fo:basic-link>
9769
+ <xsl:call-template name="insert_basic_link">
9770
+ <xsl:with-param name="element">
9771
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9772
+ <xsl:apply-templates/>
9773
+ </fo:basic-link>
9774
+ </xsl:with-param>
9775
+ </xsl:call-template>
9340
9776
  </xsl:template>
9341
9777
 
9342
9778
  <xsl:template match="*[local-name() = 'author']">
@@ -9382,28 +9818,33 @@
9382
9818
 
9383
9819
  </xsl:if>
9384
9820
 
9385
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9386
- <xsl:variable name="text" select="normalize-space()"/>
9821
+ <xsl:call-template name="refine_eref-style"/>
9387
9822
 
9388
- <fo:basic-link fox:alt-text="{@citeas}">
9389
- <xsl:if test="normalize-space(@citeas) = ''">
9390
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9391
- </xsl:if>
9392
- <xsl:if test="@type = 'inline'">
9823
+ <xsl:call-template name="insert_basic_link">
9824
+ <xsl:with-param name="element">
9825
+ <fo:basic-link fox:alt-text="{@citeas}">
9826
+ <xsl:if test="normalize-space(@citeas) = ''">
9827
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9828
+ </xsl:if>
9829
+ <xsl:if test="@type = 'inline'">
9393
9830
 
9394
- </xsl:if>
9831
+ <xsl:call-template name="refine_basic_link_style"/>
9395
9832
 
9396
- <xsl:choose>
9397
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9398
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9399
- </xsl:when>
9400
- <xsl:otherwise>
9401
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9402
- </xsl:otherwise>
9403
- </xsl:choose>
9833
+ </xsl:if>
9404
9834
 
9405
- <xsl:apply-templates/>
9406
- </fo:basic-link>
9835
+ <xsl:choose>
9836
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9837
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9838
+ </xsl:when>
9839
+ <xsl:otherwise>
9840
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9841
+ </xsl:otherwise>
9842
+ </xsl:choose>
9843
+
9844
+ <xsl:apply-templates/>
9845
+ </fo:basic-link>
9846
+ </xsl:with-param>
9847
+ </xsl:call-template>
9407
9848
 
9408
9849
  </fo:inline>
9409
9850
  </xsl:when>
@@ -9421,6 +9862,11 @@
9421
9862
  </xsl:otherwise>
9422
9863
  </xsl:choose>
9423
9864
  </xsl:template>
9865
+
9866
+ <xsl:template name="refine_basic_link_style">
9867
+
9868
+ </xsl:template> <!-- refine_basic_link_style -->
9869
+
9424
9870
  <!-- ====== -->
9425
9871
  <!-- END eref -->
9426
9872
  <!-- ====== -->
@@ -9563,16 +10009,22 @@
9563
10009
  <fo:block>
9564
10010
  <xsl:call-template name="setId"/>
9565
10011
 
9566
- <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable>
9567
- <xsl:if test="$pos &gt;= 2">
9568
- <xsl:attribute name="space-before">18pt</xsl:attribute>
9569
- </xsl:if>
10012
+ <xsl:call-template name="sections_element_style"/>
9570
10013
 
9571
10014
  <xsl:apply-templates/>
9572
10015
  </fo:block>
9573
10016
 
9574
10017
  </xsl:template>
9575
10018
 
10019
+ <xsl:template name="sections_element_style">
10020
+
10021
+ <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable>
10022
+ <xsl:if test="$pos &gt;= 2">
10023
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
10024
+ </xsl:if>
10025
+
10026
+ </xsl:template> <!-- sections_element_style -->
10027
+
9576
10028
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9577
10029
  <fo:block break-after="page"/>
9578
10030
  <fo:block>
@@ -9587,14 +10039,20 @@
9587
10039
 
9588
10040
  <xsl:call-template name="setBlockSpanAll"/>
9589
10041
 
9590
- <xsl:if test="@inline-header='true'">
9591
- <xsl:attribute name="text-align">justify</xsl:attribute>
9592
- </xsl:if>
10042
+ <xsl:call-template name="refine_clause_style"/>
9593
10043
 
9594
10044
  <xsl:apply-templates/>
9595
10045
  </fo:block>
9596
10046
  </xsl:template>
9597
10047
 
10048
+ <xsl:template name="refine_clause_style">
10049
+
10050
+ <xsl:if test="@inline-header='true'">
10051
+ <xsl:attribute name="text-align">justify</xsl:attribute>
10052
+ </xsl:if>
10053
+
10054
+ </xsl:template> <!-- refine_clause_style -->
10055
+
9598
10056
  <xsl:template match="*[local-name() = 'definitions']">
9599
10057
  <fo:block id="{@id}">
9600
10058
  <xsl:apply-templates/>
@@ -9607,10 +10065,16 @@
9607
10065
 
9608
10066
  <xsl:call-template name="setBlockSpanAll"/>
9609
10067
 
10068
+ <xsl:call-template name="refine_annex_style"/>
10069
+
9610
10070
  </fo:block>
9611
10071
  <xsl:apply-templates/>
9612
10072
  </xsl:template>
9613
10073
 
10074
+ <xsl:template name="refine_annex_style">
10075
+
10076
+ </xsl:template>
10077
+
9614
10078
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
9615
10079
  <!-- comment 2019-11-29 -->
9616
10080
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -9645,13 +10109,14 @@
9645
10109
  <label level="2">−</label><!-- minus sign -->
9646
10110
  <label level="3" font-size="75%">o</label> <!-- white circle -->
9647
10111
 
9648
- <label>-</label> <!-- full-width hyphen minus -->
9649
-
9650
10112
  </xsl:variable>
9651
10113
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
9652
10114
 
9653
10115
  <xsl:template name="setULLabel">
9654
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10116
+ <xsl:variable name="list_level__">
10117
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10118
+ </xsl:variable>
10119
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
9655
10120
  <xsl:variable name="list_level">
9656
10121
  <xsl:choose>
9657
10122
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -9776,6 +10241,8 @@
9776
10241
  </xsl:choose>
9777
10242
  </xsl:attribute>
9778
10243
 
10244
+ <xsl:call-template name="refine_list_container_style"/>
10245
+
9779
10246
  <fo:block-container margin-left="0mm">
9780
10247
  <fo:block>
9781
10248
  <xsl:apply-templates select="." mode="list"/>
@@ -9784,13 +10251,19 @@
9784
10251
  </fo:block-container>
9785
10252
  </xsl:when>
9786
10253
  <xsl:otherwise>
9787
- <fo:block>
9788
- <xsl:apply-templates select="." mode="list"/>
9789
- </fo:block>
10254
+
10255
+ <fo:block>
10256
+ <xsl:apply-templates select="." mode="list"/>
10257
+ </fo:block>
10258
+
9790
10259
  </xsl:otherwise>
9791
10260
  </xsl:choose>
9792
10261
  </xsl:template>
9793
10262
 
10263
+ <xsl:template name="refine_list_container_style">
10264
+
10265
+ </xsl:template> <!-- refine_list_container_style -->
10266
+
9794
10267
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9795
10268
 
9796
10269
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -9801,7 +10274,7 @@
9801
10274
 
9802
10275
  <xsl:variable name="provisional_distance_between_starts_">
9803
10276
  <attributes xsl:use-attribute-sets="list-style">
9804
-
10277
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
9805
10278
  </attributes>
9806
10279
  </xsl:variable>
9807
10280
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -9837,6 +10310,8 @@
9837
10310
  <addon><xsl:value-of select="$addon"/></addon> -->
9838
10311
  </xsl:if>
9839
10312
 
10313
+ <xsl:call-template name="refine_list-style"/>
10314
+
9840
10315
  <xsl:if test="*[local-name() = 'name']">
9841
10316
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9842
10317
  </xsl:if>
@@ -9849,6 +10324,10 @@
9849
10324
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
9850
10325
  </xsl:template>
9851
10326
 
10327
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
10328
+
10329
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
10330
+
9852
10331
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
9853
10332
  <xsl:param name="process">false</xsl:param>
9854
10333
  <xsl:if test="$process = 'true'">
@@ -9862,20 +10341,27 @@
9862
10341
  <fo:list-item xsl:use-attribute-sets="list-item-style">
9863
10342
  <xsl:copy-of select="@id"/>
9864
10343
 
10344
+ <xsl:call-template name="refine_list-item-style"/>
10345
+
9865
10346
  <fo:list-item-label end-indent="label-end()">
9866
10347
  <fo:block xsl:use-attribute-sets="list-item-label-style">
9867
10348
 
10349
+ <xsl:call-template name="refine_list-item-label-style"/>
10350
+
9868
10351
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9869
10352
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9870
10353
  <xsl:call-template name="append_add-style"/>
9871
10354
  </xsl:if>
9872
10355
 
9873
- <xsl:call-template name="getListItemFormat"/>
10356
+ <xsl:call-template name="getListItemFormat"/>
10357
+
9874
10358
  </fo:block>
9875
10359
  </fo:list-item-label>
9876
10360
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9877
10361
  <fo:block>
9878
10362
 
10363
+ <xsl:call-template name="refine_list-item-body-style"/>
10364
+
9879
10365
  <xsl:apply-templates/>
9880
10366
 
9881
10367
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -10193,6 +10679,7 @@
10193
10679
 
10194
10680
  <fo:block id="{@id}">
10195
10681
  <xsl:apply-templates/>
10682
+
10196
10683
  </fo:block>
10197
10684
  </xsl:template>
10198
10685
 
@@ -10212,6 +10699,7 @@
10212
10699
 
10213
10700
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
10214
10701
  <xsl:apply-templates/>
10702
+
10215
10703
  </fo:block>
10216
10704
 
10217
10705
  </xsl:template> <!-- references -->
@@ -10475,24 +10963,32 @@
10475
10963
  <xsl:for-each select="*[local-name() = 'tab']">
10476
10964
  <xsl:variable name="current_id" select="generate-id()"/>
10477
10965
  <fo:table-cell>
10478
- <fo:block>
10479
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10480
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10481
- <xsl:choose>
10482
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10483
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10484
- </xsl:choose>
10485
- </xsl:for-each>
10486
- </fo:basic-link>
10966
+ <fo:block line-height-shift-adjustment="disregard-shifts">
10967
+ <xsl:call-template name="insert_basic_link">
10968
+ <xsl:with-param name="element">
10969
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10970
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10971
+ <xsl:choose>
10972
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10973
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10974
+ </xsl:choose>
10975
+ </xsl:for-each>
10976
+ </fo:basic-link>
10977
+ </xsl:with-param>
10978
+ </xsl:call-template>
10487
10979
  </fo:block>
10488
10980
  </fo:table-cell>
10489
10981
  </xsl:for-each>
10490
10982
  <!-- last column - for page numbers -->
10491
10983
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10492
10984
  <fo:block>
10493
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10494
- <fo:page-number-citation ref-id="{$target}"/>
10495
- </fo:basic-link>
10985
+ <xsl:call-template name="insert_basic_link">
10986
+ <xsl:with-param name="element">
10987
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10988
+ <fo:page-number-citation ref-id="{$target}"/>
10989
+ </fo:basic-link>
10990
+ </xsl:with-param>
10991
+ </xsl:call-template>
10496
10992
  </fo:block>
10497
10993
  </fo:table-cell>
10498
10994
  </xsl:template>
@@ -10534,6 +11030,27 @@
10534
11030
  <!-- End Table of Contents (ToC) processing -->
10535
11031
  <!-- =================== -->
10536
11032
 
11033
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11034
+ <xsl:template name="insert_basic_link">
11035
+ <xsl:param name="element"/>
11036
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11037
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11038
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11039
+ <xsl:choose>
11040
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11041
+ <xsl:copy-of select="$element_node"/>
11042
+ </xsl:when>
11043
+ <xsl:otherwise>
11044
+ <fo:inline>
11045
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11046
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11047
+ </xsl:for-each>
11048
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11049
+ </fo:inline>
11050
+ </xsl:otherwise>
11051
+ </xsl:choose>
11052
+ </xsl:template>
11053
+
10537
11054
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10538
11055
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10539
11056
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -10770,6 +11287,9 @@
10770
11287
  </xsl:copy>
10771
11288
  </xsl:template>
10772
11289
 
11290
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
11291
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
11292
+
10773
11293
  <xsl:template name="add_id">
10774
11294
  <xsl:if test="not(@id)">
10775
11295
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -11054,6 +11574,14 @@
11054
11574
  <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
11055
11575
  <xsl:variable name="p_fn_">
11056
11576
  <xsl:call-template name="get_fn_list"/>
11577
+ <!-- <xsl:choose>
11578
+ <xsl:when test="$namespace = 'jis'">
11579
+ <xsl:call-template name="get_fn_list_for_element"/>
11580
+ </xsl:when>
11581
+ <xsl:otherwise>
11582
+ <xsl:call-template name="get_fn_list"/>
11583
+ </xsl:otherwise>
11584
+ </xsl:choose> -->
11057
11585
  </xsl:variable>
11058
11586
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11059
11587
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -11068,8 +11596,14 @@
11068
11596
  <xsl:attribute name="current_fn_number">
11069
11597
  <xsl:value-of select="$current_fn_number"/>
11070
11598
  </xsl:attribute>
11599
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11071
11600
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
11072
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11601
+
11602
+ <xsl:value-of select="$skip_footnote_body_"/>
11603
+
11604
+ </xsl:attribute>
11605
+ <xsl:attribute name="ref_id">
11606
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
11073
11607
  </xsl:attribute>
11074
11608
  <xsl:apply-templates select="node()" mode="linear_xml"/>
11075
11609
  </xsl:copy>