metanorma-iho 0.7.8 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -235,96 +235,7 @@
235
235
 
236
236
  <fo:block break-after="page"/>
237
237
 
238
- <!-- Table of Contents -->
239
- <fo:block role="TOC">
240
- <fo:block font-weight="bold" margin-bottom="7.5pt" role="H1" font-size="12pt" margin-top="4pt">
241
- <fo:block-container width="18.3mm" border-bottom="1.25pt solid black">
242
- <fo:block line-height="75%">
243
- <xsl:call-template name="getLocalizedString">
244
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
245
- </xsl:call-template>
246
- </fo:block>
247
- </fo:block-container>
248
- </fo:block>
249
- <xsl:if test="$debug = 'true'">
250
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
251
- DEBUG
252
- contents=<xsl:copy-of select="$contents"/>
253
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
254
- </xsl:if>
255
-
256
- <fo:block line-height="115%">
257
-
258
- <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
259
- <fo:block role="TOCI">
260
- <!-- <xsl:if test="@level = 1">
261
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
262
- </xsl:if> -->
263
-
264
- <fo:list-block>
265
-
266
- <xsl:attribute name="provisional-distance-between-starts">
267
- <xsl:choose>
268
- <xsl:when test="@level &gt;= 1 and @root = 'preface'">0mm</xsl:when>
269
- <xsl:when test="@level &gt;= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
270
- <xsl:when test="@level &gt;= 1 and not(@type = 'annex')">
271
- <xsl:choose>
272
- <xsl:when test="$toc_level = 3">12.9mm</xsl:when>
273
- <xsl:when test="$toc_level &gt; 3">15mm</xsl:when>
274
- <xsl:otherwise>10mm</xsl:otherwise>
275
- </xsl:choose>
276
- </xsl:when>
277
- <xsl:otherwise>0mm</xsl:otherwise>
278
- </xsl:choose>
279
- </xsl:attribute>
280
- <fo:list-item>
281
- <fo:list-item-label end-indent="label-end()">
282
- <fo:block>
283
- <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
284
- <xsl:value-of select="@section"/>
285
- </xsl:if>
286
- </fo:block>
287
- </fo:list-item-label>
288
- <fo:list-item-body start-indent="body-start()">
289
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
290
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
291
- <xsl:apply-templates select="title"/>
292
- <fo:inline keep-together.within-line="always">
293
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
294
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
295
- </fo:inline>
296
- </fo:basic-link>
297
- </fo:block>
298
- </fo:list-item-body>
299
- </fo:list-item>
300
- </fo:list-block>
301
- </fo:block>
302
-
303
- </xsl:for-each>
304
-
305
- <!-- List of Tables -->
306
- <xsl:if test="$contents//tables/table">
307
- <xsl:call-template name="insertListOf_Title">
308
- <xsl:with-param name="title" select="$title-list-tables"/>
309
- </xsl:call-template>
310
- <xsl:for-each select="$contents//tables/table">
311
- <xsl:call-template name="insertListOf_Item"/>
312
- </xsl:for-each>
313
- </xsl:if>
314
-
315
- <!-- List of Figures -->
316
- <xsl:if test="$contents//figures/figure">
317
- <xsl:call-template name="insertListOf_Title">
318
- <xsl:with-param name="title" select="$title-list-figures"/>
319
- </xsl:call-template>
320
- <xsl:for-each select="$contents//figures/figure">
321
- <xsl:call-template name="insertListOf_Item"/>
322
- </xsl:for-each>
323
- </xsl:if>
324
- </fo:block>
325
- </fo:block>
326
-
327
- <!-- Foreword, Introduction -->
238
+ <!-- Contents, Foreword, Introduction -->
328
239
  <xsl:call-template name="processPrefaceSectionsDefault"/>
329
240
 
330
241
  </fo:flow>
@@ -434,6 +345,101 @@
434
345
  </fo:block>
435
346
  </xsl:template>
436
347
 
348
+ <xsl:template match="iho:preface/iho:clause[@type = 'toc']" priority="4">
349
+ <!-- Table of Contents -->
350
+ <fo:block role="TOC">
351
+
352
+ <xsl:apply-templates/>
353
+
354
+ <xsl:if test="$debug = 'true'">
355
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
356
+ DEBUG
357
+ contents=<xsl:copy-of select="$contents"/>
358
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
359
+ </xsl:if>
360
+
361
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
362
+
363
+ <fo:block line-height="115%">
364
+
365
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
366
+ <fo:block role="TOCI">
367
+ <fo:list-block>
368
+ <xsl:attribute name="provisional-distance-between-starts">
369
+ <xsl:choose>
370
+ <xsl:when test="@level &gt;= 1 and @root = 'preface'">0mm</xsl:when>
371
+ <xsl:when test="@level &gt;= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
372
+ <xsl:when test="@level &gt;= 1 and not(@type = 'annex')">
373
+ <xsl:choose>
374
+ <xsl:when test="$toc_level = 3">12.9mm</xsl:when>
375
+ <xsl:when test="$toc_level &gt; 3">15mm</xsl:when>
376
+ <xsl:otherwise>10mm</xsl:otherwise>
377
+ </xsl:choose>
378
+ </xsl:when>
379
+ <xsl:otherwise>0mm</xsl:otherwise>
380
+ </xsl:choose>
381
+ </xsl:attribute>
382
+ <fo:list-item>
383
+ <fo:list-item-label end-indent="label-end()">
384
+ <fo:block>
385
+ <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
386
+ <xsl:value-of select="@section"/>
387
+ </xsl:if>
388
+ </fo:block>
389
+ </fo:list-item-label>
390
+ <fo:list-item-body start-indent="body-start()">
391
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
392
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
393
+ <xsl:apply-templates select="title"/>
394
+ <fo:inline keep-together.within-line="always">
395
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
396
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
397
+ </fo:inline>
398
+ </fo:basic-link>
399
+ </fo:block>
400
+ </fo:list-item-body>
401
+ </fo:list-item>
402
+ </fo:list-block>
403
+ </fo:block>
404
+ </xsl:for-each>
405
+
406
+ <!-- List of Tables -->
407
+ <xsl:if test="$contents//tables/table">
408
+ <xsl:call-template name="insertListOf_Title">
409
+ <xsl:with-param name="title" select="$title-list-tables"/>
410
+ </xsl:call-template>
411
+ <xsl:for-each select="$contents//tables/table">
412
+ <xsl:call-template name="insertListOf_Item"/>
413
+ </xsl:for-each>
414
+ </xsl:if>
415
+
416
+ <!-- List of Figures -->
417
+ <xsl:if test="$contents//figures/figure">
418
+ <xsl:call-template name="insertListOf_Title">
419
+ <xsl:with-param name="title" select="$title-list-figures"/>
420
+ </xsl:call-template>
421
+ <xsl:for-each select="$contents//figures/figure">
422
+ <xsl:call-template name="insertListOf_Item"/>
423
+ </xsl:for-each>
424
+ </xsl:if>
425
+ </fo:block>
426
+ </xsl:if>
427
+ </fo:block>
428
+ </xsl:template>
429
+
430
+ <xsl:template match="iho:preface/iho:clause[@type = 'toc']/iho:title" priority="3">
431
+ <fo:block font-weight="bold" margin-bottom="7.5pt" role="H1" font-size="12pt" margin-top="4pt">
432
+ <fo:block-container width="18.3mm" border-bottom="1.25pt solid black">
433
+ <fo:block line-height="75%">
434
+ <!-- <xsl:call-template name="getLocalizedString">
435
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
436
+ </xsl:call-template> -->
437
+ <xsl:apply-templates/>
438
+ </fo:block>
439
+ </fo:block-container>
440
+ </fo:block>
441
+ </xsl:template>
442
+
437
443
  <!-- ============================= -->
438
444
  <!-- CONTENTS -->
439
445
  <!-- ============================= -->
@@ -456,6 +462,7 @@
456
462
 
457
463
  <xsl:variable name="skip">
458
464
  <xsl:choose>
465
+ <xsl:when test="@type = 'toc'">true</xsl:when>
459
466
  <xsl:when test="ancestor-or-self::iho:bibitem">true</xsl:when>
460
467
  <xsl:when test="ancestor-or-self::iho:term">true</xsl:when>
461
468
  <xsl:otherwise>false</xsl:otherwise>
@@ -1237,6 +1244,10 @@
1237
1244
 
1238
1245
  </xsl:attribute-set>
1239
1246
 
1247
+ <xsl:template name="refine_link-style">
1248
+
1249
+ </xsl:template> <!-- refine_link-style -->
1250
+
1240
1251
  <xsl:attribute-set name="sourcecode-container-style">
1241
1252
 
1242
1253
  </xsl:attribute-set>
@@ -1253,6 +1264,10 @@
1253
1264
 
1254
1265
  </xsl:attribute-set>
1255
1266
 
1267
+ <xsl:template name="refine_sourcecode-style">
1268
+
1269
+ </xsl:template> <!-- refine_sourcecode-style -->
1270
+
1256
1271
  <xsl:attribute-set name="pre-style">
1257
1272
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1258
1273
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1341,6 +1356,10 @@
1341
1356
 
1342
1357
  </xsl:attribute-set> <!-- example-style -->
1343
1358
 
1359
+ <xsl:template name="refine_example-style">
1360
+
1361
+ </xsl:template> <!-- refine_example-style -->
1362
+
1344
1363
  <xsl:attribute-set name="example-body-style">
1345
1364
 
1346
1365
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1360,6 +1379,10 @@
1360
1379
 
1361
1380
  </xsl:attribute-set> <!-- example-p-style -->
1362
1381
 
1382
+ <xsl:template name="refine_example-p-style">
1383
+
1384
+ </xsl:template> <!-- refine_example-p-style -->
1385
+
1363
1386
  <xsl:attribute-set name="termexample-name-style">
1364
1387
 
1365
1388
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1391,6 +1414,12 @@
1391
1414
 
1392
1415
  </xsl:attribute-set> <!-- table-container-style -->
1393
1416
 
1417
+ <xsl:template name="refine_table-container-style">
1418
+ <xsl:param name="margin-side"/>
1419
+
1420
+ <!-- end table block-container attributes -->
1421
+ </xsl:template> <!-- refine_table-container-style -->
1422
+
1394
1423
  <xsl:attribute-set name="table-style">
1395
1424
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1396
1425
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -1399,6 +1428,13 @@
1399
1428
 
1400
1429
  </xsl:attribute-set><!-- table-style -->
1401
1430
 
1431
+ <xsl:template name="refine_table-style">
1432
+ <xsl:param name="margin-side"/>
1433
+
1434
+ <xsl:call-template name="setBordersTableArray"/>
1435
+
1436
+ </xsl:template> <!-- refine_table-style -->
1437
+
1402
1438
  <xsl:attribute-set name="table-name-style">
1403
1439
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1404
1440
 
@@ -1409,6 +1445,11 @@
1409
1445
 
1410
1446
  </xsl:attribute-set> <!-- table-name-style -->
1411
1447
 
1448
+ <xsl:template name="refine_table-name-style">
1449
+ <xsl:param name="continued"/>
1450
+
1451
+ </xsl:template> <!-- refine_table-name-style -->
1452
+
1412
1453
  <xsl:attribute-set name="table-row-style">
1413
1454
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1414
1455
 
@@ -1423,14 +1464,30 @@
1423
1464
 
1424
1465
  </xsl:attribute-set>
1425
1466
 
1467
+ <xsl:template name="refine_table-header-row-style">
1468
+
1469
+ <xsl:call-template name="setBordersTableArray"/>
1470
+
1471
+ </xsl:template> <!-- refine_table-header-row-style -->
1472
+
1426
1473
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1427
1474
 
1428
1475
  </xsl:attribute-set>
1429
1476
 
1477
+ <xsl:template name="refine_table-footer-row-style">
1478
+
1479
+ </xsl:template> <!-- refine_table-footer-row-style -->
1480
+
1430
1481
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1431
1482
 
1432
1483
  </xsl:attribute-set>
1433
1484
 
1485
+ <xsl:template name="refine_table-body-row-style">
1486
+
1487
+ <xsl:call-template name="setBordersTableArray"/>
1488
+
1489
+ </xsl:template> <!-- refine_table-body-row-style -->
1490
+
1434
1491
  <xsl:attribute-set name="table-header-cell-style">
1435
1492
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1436
1493
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1445,6 +1502,18 @@
1445
1502
 
1446
1503
  </xsl:attribute-set> <!-- table-header-cell-style -->
1447
1504
 
1505
+ <xsl:template name="refine_table-header-cell-style">
1506
+
1507
+ <xsl:call-template name="setBordersTableArray"/>
1508
+
1509
+ <xsl:if test="$lang = 'ar'">
1510
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1511
+ </xsl:if>
1512
+
1513
+ <xsl:call-template name="setTableCellAttributes"/>
1514
+
1515
+ </xsl:template> <!-- refine_table-header-cell-style -->
1516
+
1448
1517
  <xsl:attribute-set name="table-cell-style">
1449
1518
  <xsl:attribute name="display-align">center</xsl:attribute>
1450
1519
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1458,6 +1527,18 @@
1458
1527
 
1459
1528
  </xsl:attribute-set> <!-- table-cell-style -->
1460
1529
 
1530
+ <xsl:template name="refine_table-cell-style">
1531
+
1532
+ <xsl:if test="$lang = 'ar'">
1533
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1534
+ </xsl:if>
1535
+
1536
+ <!-- bsi -->
1537
+
1538
+ <xsl:call-template name="setBordersTableArray"/>
1539
+
1540
+ </xsl:template> <!-- refine_table-cell-style -->
1541
+
1461
1542
  <xsl:attribute-set name="table-footer-cell-style">
1462
1543
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1463
1544
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1468,6 +1549,10 @@
1468
1549
 
1469
1550
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1470
1551
 
1552
+ <xsl:template name="refine_table-footer-cell-style">
1553
+
1554
+ </xsl:template> <!-- refine_table-footer-cell-style -->
1555
+
1471
1556
  <xsl:attribute-set name="table-note-style">
1472
1557
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1473
1558
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1478,6 +1563,10 @@
1478
1563
 
1479
1564
  </xsl:attribute-set><!-- table-note-style -->
1480
1565
 
1566
+ <xsl:template name="refine_table-note-style">
1567
+
1568
+ </xsl:template> <!-- refine_table-note-style -->
1569
+
1481
1570
  <xsl:attribute-set name="table-fn-style">
1482
1571
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1483
1572
 
@@ -1533,6 +1622,10 @@
1533
1622
 
1534
1623
  </xsl:attribute-set>
1535
1624
 
1625
+ <xsl:template name="refine_dt-cell-style">
1626
+
1627
+ </xsl:template> <!-- refine_dt-cell-style -->
1628
+
1536
1629
  <xsl:attribute-set name="dt-block-style">
1537
1630
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1538
1631
 
@@ -1540,6 +1633,10 @@
1540
1633
 
1541
1634
  </xsl:attribute-set>
1542
1635
 
1636
+ <xsl:template name="refine_dt-block-style">
1637
+
1638
+ </xsl:template> <!-- refine_dt-block-style -->
1639
+
1543
1640
  <xsl:attribute-set name="dl-name-style">
1544
1641
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1545
1642
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1553,6 +1650,10 @@
1553
1650
 
1554
1651
  </xsl:attribute-set>
1555
1652
 
1653
+ <xsl:template name="refine_dd-cell-style">
1654
+
1655
+ </xsl:template> <!-- refine_dd-cell-style -->
1656
+
1556
1657
  <!-- ========================== -->
1557
1658
  <!-- END Definition's list styles -->
1558
1659
  <!-- ========================== -->
@@ -1576,6 +1677,12 @@
1576
1677
 
1577
1678
  </xsl:attribute-set>
1578
1679
 
1680
+ <xsl:template name="refine_eref-style">
1681
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
1682
+ <xsl:variable name="text" select="normalize-space()"/>
1683
+
1684
+ </xsl:template> <!-- refine_eref-style -->
1685
+
1579
1686
  <xsl:attribute-set name="note-style">
1580
1687
 
1581
1688
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -1585,6 +1692,10 @@
1585
1692
 
1586
1693
  </xsl:attribute-set>
1587
1694
 
1695
+ <xsl:template name="refine_note-style">
1696
+
1697
+ </xsl:template>
1698
+
1588
1699
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1589
1700
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1590
1701
 
@@ -1595,6 +1706,10 @@
1595
1706
 
1596
1707
  </xsl:attribute-set>
1597
1708
 
1709
+ <xsl:template name="refine_note-name-style">
1710
+
1711
+ </xsl:template> <!-- refine_note-name-style -->
1712
+
1598
1713
  <xsl:attribute-set name="table-note-name-style">
1599
1714
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1600
1715
 
@@ -1602,6 +1717,10 @@
1602
1717
 
1603
1718
  </xsl:attribute-set>
1604
1719
 
1720
+ <xsl:template name="refine_table-note-name-style">
1721
+
1722
+ </xsl:template> <!-- refine_table-note-name-style -->
1723
+
1605
1724
  <xsl:attribute-set name="note-p-style">
1606
1725
 
1607
1726
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
@@ -1618,10 +1737,18 @@
1618
1737
 
1619
1738
  </xsl:attribute-set>
1620
1739
 
1740
+ <xsl:template name="refine_termnote-style">
1741
+
1742
+ </xsl:template> <!-- refine_termnote-style -->
1743
+
1621
1744
  <xsl:attribute-set name="termnote-name-style">
1622
1745
 
1623
1746
  </xsl:attribute-set>
1624
1747
 
1748
+ <xsl:template name="refine_termnote-name-style">
1749
+
1750
+ </xsl:template>
1751
+
1625
1752
  <xsl:attribute-set name="termnote-p-style">
1626
1753
 
1627
1754
  </xsl:attribute-set>
@@ -1636,6 +1763,10 @@
1636
1763
 
1637
1764
  </xsl:attribute-set>
1638
1765
 
1766
+ <xsl:template name="refine_quote-style">
1767
+
1768
+ </xsl:template>
1769
+
1639
1770
  <xsl:attribute-set name="quote-source-style">
1640
1771
  <xsl:attribute name="text-align">right</xsl:attribute>
1641
1772
 
@@ -1647,6 +1778,10 @@
1647
1778
 
1648
1779
  </xsl:attribute-set>
1649
1780
 
1781
+ <xsl:template name="refine_termsource-style">
1782
+
1783
+ </xsl:template> <!-- refine_termsource-style -->
1784
+
1650
1785
  <xsl:attribute-set name="termsource-text-style">
1651
1786
 
1652
1787
  </xsl:attribute-set>
@@ -1691,6 +1826,10 @@
1691
1826
 
1692
1827
  </xsl:attribute-set>
1693
1828
 
1829
+ <xsl:template name="refine_figure-name-style">
1830
+
1831
+ </xsl:template> <!-- refine_figure-name-style -->
1832
+
1694
1833
  <xsl:attribute-set name="figure-source-style">
1695
1834
 
1696
1835
  </xsl:attribute-set>
@@ -1707,6 +1846,10 @@
1707
1846
 
1708
1847
  </xsl:attribute-set> <!-- formula-stem-block-style -->
1709
1848
 
1849
+ <xsl:template name="refine_formula-stem-block-style">
1850
+
1851
+ </xsl:template> <!-- refine_formula-stem-block-style -->
1852
+
1710
1853
  <xsl:attribute-set name="formula-stem-number-style">
1711
1854
  <xsl:attribute name="text-align">right</xsl:attribute>
1712
1855
 
@@ -1718,6 +1861,10 @@
1718
1861
 
1719
1862
  </xsl:attribute-set>
1720
1863
 
1864
+ <xsl:template name="refine_image-style">
1865
+
1866
+ </xsl:template>
1867
+
1721
1868
  <xsl:attribute-set name="figure-pseudocode-p-style">
1722
1869
 
1723
1870
  </xsl:attribute-set>
@@ -1810,12 +1957,20 @@
1810
1957
 
1811
1958
  </xsl:attribute-set>
1812
1959
 
1960
+ <xsl:template name="refine_mathml-style">
1961
+
1962
+ </xsl:template>
1963
+
1813
1964
  <xsl:attribute-set name="list-style">
1814
1965
 
1815
1966
  <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
1816
1967
 
1817
1968
  </xsl:attribute-set> <!-- list-style -->
1818
1969
 
1970
+ <xsl:template name="refine_list-style">
1971
+
1972
+ </xsl:template> <!-- refine_list-style -->
1973
+
1819
1974
  <xsl:attribute-set name="list-name-style">
1820
1975
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1821
1976
 
@@ -1829,16 +1984,28 @@
1829
1984
 
1830
1985
  </xsl:attribute-set>
1831
1986
 
1987
+ <xsl:template name="refine_list-item-style">
1988
+
1989
+ </xsl:template> <!-- refine_list-item-style -->
1990
+
1832
1991
  <xsl:attribute-set name="list-item-label-style">
1833
1992
 
1834
1993
  <xsl:attribute name="line-height">115%</xsl:attribute>
1835
1994
 
1836
1995
  </xsl:attribute-set>
1837
1996
 
1997
+ <xsl:template name="refine_list-item-label-style">
1998
+
1999
+ </xsl:template> <!-- refine_list-item-label-style -->
2000
+
1838
2001
  <xsl:attribute-set name="list-item-body-style">
1839
2002
 
1840
2003
  </xsl:attribute-set>
1841
2004
 
2005
+ <xsl:template name="refine_list-item-body-style">
2006
+
2007
+ </xsl:template> <!-- refine_list-item-body-style -->
2008
+
1842
2009
  <xsl:attribute-set name="toc-style">
1843
2010
  <xsl:attribute name="line-height">135%</xsl:attribute>
1844
2011
  </xsl:attribute-set>
@@ -1849,6 +2016,10 @@
1849
2016
 
1850
2017
  </xsl:attribute-set>
1851
2018
 
2019
+ <xsl:template name="refine_fn-reference-style">
2020
+
2021
+ </xsl:template> <!-- refine_fn-reference-style -->
2022
+
1852
2023
  <xsl:attribute-set name="fn-style">
1853
2024
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1854
2025
  </xsl:attribute-set>
@@ -1872,6 +2043,10 @@
1872
2043
 
1873
2044
  </xsl:attribute-set>
1874
2045
 
2046
+ <xsl:template name="refine_fn-body-style">
2047
+
2048
+ </xsl:template> <!-- refine_fn-body-style -->
2049
+
1875
2050
  <xsl:attribute-set name="fn-body-num-style">
1876
2051
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1877
2052
 
@@ -1881,6 +2056,10 @@
1881
2056
 
1882
2057
  </xsl:attribute-set> <!-- fn-body-num-style -->
1883
2058
 
2059
+ <xsl:template name="refine_fn-body-num-style">
2060
+
2061
+ </xsl:template> <!-- refine_fn-body-num-style -->
2062
+
1884
2063
  <!-- admonition -->
1885
2064
  <xsl:attribute-set name="admonition-style">
1886
2065
 
@@ -2535,7 +2714,9 @@
2535
2714
 
2536
2715
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2537
2716
 
2538
- <!-- end table block-container attributes -->
2717
+ <xsl:call-template name="refine_table-container-style">
2718
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2719
+ </xsl:call-template>
2539
2720
 
2540
2721
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2541
2722
 
@@ -2556,7 +2737,9 @@
2556
2737
 
2557
2738
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2558
2739
 
2559
- <xsl:call-template name="setBordersTableArray"/>
2740
+ <xsl:call-template name="refine_table-style">
2741
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2742
+ </xsl:call-template>
2560
2743
 
2561
2744
  </xsl:element>
2562
2745
  </xsl:variable>
@@ -2622,7 +2805,7 @@
2622
2805
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2623
2806
  </xsl:when>
2624
2807
  <xsl:otherwise>
2625
- <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 -->
2808
+ <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 -->
2626
2809
  </xsl:otherwise>
2627
2810
  </xsl:choose>
2628
2811
 
@@ -2712,6 +2895,10 @@
2712
2895
 
2713
2896
  <fo:block xsl:use-attribute-sets="table-name-style">
2714
2897
 
2898
+ <xsl:call-template name="refine_table-name-style">
2899
+ <xsl:with-param name="continued" select="$continued"/>
2900
+ </xsl:call-template>
2901
+
2715
2902
  <xsl:choose>
2716
2903
  <xsl:when test="$continued = 'true'">
2717
2904
 
@@ -3094,6 +3281,8 @@
3094
3281
  <fo:table-row>
3095
3282
  <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">
3096
3283
 
3284
+ <xsl:call-template name="refine_table-header-title-style"/>
3285
+
3097
3286
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3098
3287
  <xsl:with-param name="continued">true</xsl:with-param>
3099
3288
  </xsl:apply-templates>
@@ -3106,6 +3295,10 @@
3106
3295
  </fo:table-row>
3107
3296
  </xsl:template> <!-- table-header-title -->
3108
3297
 
3298
+ <xsl:template name="refine_table-header-title-style">
3299
+
3300
+ </xsl:template> <!-- refine_table-header-title-style -->
3301
+
3109
3302
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3110
3303
  <fo:table-body>
3111
3304
  <xsl:apply-templates/>
@@ -3130,7 +3323,7 @@
3130
3323
  <xsl:param name="colwidths"/>
3131
3324
  <xsl:param name="colgroup"/>
3132
3325
 
3133
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3326
+ <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']"/>
3134
3327
 
3135
3328
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3136
3329
 
@@ -3190,6 +3383,8 @@
3190
3383
  <fo:table-row>
3191
3384
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3192
3385
 
3386
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3387
+
3193
3388
  <xsl:call-template name="setBordersTableArray"/>
3194
3389
 
3195
3390
  <!-- fn will be processed inside 'note' processing -->
@@ -3198,6 +3393,7 @@
3198
3393
 
3199
3394
  <!-- except gb and bsi -->
3200
3395
 
3396
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3201
3397
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3202
3398
  <xsl:apply-templates select="../*[local-name()='note']"/>
3203
3399
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3329,7 +3525,7 @@
3329
3525
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3330
3526
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3331
3527
 
3332
- <xsl:call-template name="setBordersTableArray"/>
3528
+ <xsl:call-template name="refine_table-header-row-style"/>
3333
3529
 
3334
3530
  <xsl:call-template name="setTableRowAttributes"/>
3335
3531
 
@@ -3363,6 +3559,8 @@
3363
3559
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3364
3560
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3365
3561
 
3562
+ <xsl:call-template name="refine_table-footer-row-style"/>
3563
+
3366
3564
  <xsl:call-template name="setTableRowAttributes"/>
3367
3565
  <xsl:apply-templates/>
3368
3566
  </fo:table-row>
@@ -3376,9 +3574,10 @@
3376
3574
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3377
3575
  </xsl:if>
3378
3576
 
3379
- <xsl:call-template name="setBordersTableArray"/>
3577
+ <xsl:call-template name="refine_table-body-row-style"/>
3380
3578
 
3381
3579
  <xsl:call-template name="setTableRowAttributes"/>
3580
+
3382
3581
  <xsl:apply-templates/>
3383
3582
  </fo:table-row>
3384
3583
  </xsl:template>
@@ -3397,13 +3596,7 @@
3397
3596
  <xsl:with-param name="default">center</xsl:with-param>
3398
3597
  </xsl:call-template>
3399
3598
 
3400
- <xsl:call-template name="setBordersTableArray"/>
3401
-
3402
- <xsl:if test="$lang = 'ar'">
3403
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3404
- </xsl:if>
3405
-
3406
- <xsl:call-template name="setTableCellAttributes"/>
3599
+ <xsl:call-template name="refine_table-header-cell-style"/>
3407
3600
 
3408
3601
  <fo:block>
3409
3602
  <xsl:apply-templates/>
@@ -3445,13 +3638,7 @@
3445
3638
  <xsl:with-param name="default">left</xsl:with-param>
3446
3639
  </xsl:call-template>
3447
3640
 
3448
- <xsl:if test="$lang = 'ar'">
3449
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3450
- </xsl:if>
3451
-
3452
- <!-- bsi -->
3453
-
3454
- <xsl:call-template name="setBordersTableArray"/>
3641
+ <xsl:call-template name="refine_table-cell-style"/>
3455
3642
 
3456
3643
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3457
3644
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3482,9 +3669,13 @@
3482
3669
 
3483
3670
  <fo:block xsl:use-attribute-sets="table-note-style">
3484
3671
 
3672
+ <xsl:call-template name="refine_table-note-style"/>
3673
+
3485
3674
  <!-- Table's note name (NOTE, for example) -->
3486
3675
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3487
3676
 
3677
+ <xsl:call-template name="refine_table-note-name-style"/>
3678
+
3488
3679
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3489
3680
 
3490
3681
  </fo:inline>
@@ -3512,6 +3703,14 @@
3512
3703
  <!-- list of footnotes to calculate actual footnotes number -->
3513
3704
  <xsl:variable name="p_fn_">
3514
3705
  <xsl:call-template name="get_fn_list"/>
3706
+ <!-- <xsl:choose>
3707
+ <xsl:when test="$namespace = 'jis'">
3708
+ <xsl:call-template name="get_fn_list_for_element"/>
3709
+ </xsl:when>
3710
+ <xsl:otherwise>
3711
+ <xsl:call-template name="get_fn_list"/>
3712
+ </xsl:otherwise>
3713
+ </xsl:choose> -->
3515
3714
  </xsl:variable>
3516
3715
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3517
3716
 
@@ -3536,7 +3735,14 @@
3536
3735
 
3537
3736
  </xsl:variable>
3538
3737
 
3539
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3738
+ <xsl:variable name="ref_id">
3739
+ <xsl:choose>
3740
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
3741
+ <xsl:otherwise>
3742
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3743
+ </xsl:otherwise>
3744
+ </xsl:choose>
3745
+ </xsl:variable>
3540
3746
  <xsl:variable name="footnote_inline">
3541
3747
  <fo:inline>
3542
3748
 
@@ -3559,9 +3765,13 @@
3559
3765
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3560
3766
  </xsl:if>
3561
3767
 
3562
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3563
- <xsl:value-of select="$current_fn_number_text"/>
3564
- </fo:basic-link>
3768
+ <xsl:call-template name="insert_basic_link">
3769
+ <xsl:with-param name="element">
3770
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3771
+ <xsl:copy-of select="$current_fn_number_text"/>
3772
+ </fo:basic-link>
3773
+ </xsl:with-param>
3774
+ </xsl:call-template>
3565
3775
  </fo:inline>
3566
3776
  </xsl:variable>
3567
3777
 
@@ -3578,8 +3788,12 @@
3578
3788
 
3579
3789
  <fo:block xsl:use-attribute-sets="fn-body-style">
3580
3790
 
3791
+ <xsl:call-template name="refine_fn-body-style"/>
3792
+
3581
3793
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3582
3794
 
3795
+ <xsl:call-template name="refine_fn-body-num-style"/>
3796
+
3583
3797
  <xsl:value-of select="$current_fn_number_text"/>
3584
3798
  </fo:inline>
3585
3799
  <xsl:apply-templates/>
@@ -3631,6 +3845,28 @@
3631
3845
  </xsl:choose>
3632
3846
  </xsl:template>
3633
3847
 
3848
+ <xsl:template name="get_fn_list_for_element">
3849
+ <xsl:choose>
3850
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
3851
+ <fn gen_id="{generate-id(.)}">
3852
+ <xsl:copy-of select="@*"/>
3853
+ <xsl:copy-of select="node()"/>
3854
+ </fn>
3855
+ </xsl:when>
3856
+ <xsl:otherwise>
3857
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
3858
+ <xsl:variable name="element_id" select="@id"/>
3859
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3860
+ <!-- copy unique fn -->
3861
+ <fn gen_id="{generate-id(.)}">
3862
+ <xsl:copy-of select="@*"/>
3863
+ <xsl:copy-of select="node()"/>
3864
+ </fn>
3865
+ </xsl:for-each>
3866
+ </xsl:for-each>
3867
+ </xsl:otherwise>
3868
+ </xsl:choose>
3869
+ </xsl:template>
3634
3870
  <!-- ============================ -->
3635
3871
  <!-- table's footnotes rendering -->
3636
3872
  <!-- ============================ -->
@@ -3805,6 +4041,8 @@
3805
4041
  <xsl:template match="*[local-name()='fn']">
3806
4042
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
3807
4043
 
4044
+ <xsl:call-template name="refine_fn-reference-style"/>
4045
+
3808
4046
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3809
4047
 
3810
4048
  <xsl:value-of select="@reference"/>
@@ -3894,14 +4132,18 @@
3894
4132
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3895
4133
  <xsl:text> </xsl:text>
3896
4134
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3897
- <xsl:text/>
3898
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4135
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4136
+ <xsl:text> </xsl:text>
4137
+ </xsl:if>
4138
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3899
4139
  </fo:block>
3900
4140
 
3901
4141
  </xsl:when> <!-- END: only one component -->
3902
4142
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3903
4143
  <fo:block margin-bottom="12pt" text-align="left">
3904
4144
 
4145
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4146
+
3905
4147
  <!-- <xsl:variable name="title-where">
3906
4148
  <xsl:call-template name="getLocalizedString">
3907
4149
  <xsl:with-param name="key">where</xsl:with-param>
@@ -3915,6 +4157,8 @@
3915
4157
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3916
4158
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3917
4159
 
4160
+ <xsl:call-template name="refine_figure_key_style"/>
4161
+
3918
4162
  <xsl:variable name="title-key">
3919
4163
  <xsl:call-template name="getLocalizedString">
3920
4164
  <xsl:with-param name="key">key</xsl:with-param>
@@ -3929,7 +4173,7 @@
3929
4173
  <xsl:if test="$onlyOneComponent = 'false'">
3930
4174
  <fo:block>
3931
4175
 
3932
- <!-- <xsl:attribute name="margin-left">7mm</xsl:attribute> -->
4176
+ <xsl:call-template name="refine_multicomponent_style"/>
3933
4177
 
3934
4178
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3935
4179
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -3937,7 +4181,7 @@
3937
4181
 
3938
4182
  <fo:block>
3939
4183
 
3940
- <!-- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute> -->
4184
+ <xsl:call-template name="refine_multicomponent_block_style"/>
3941
4185
 
3942
4186
  <xsl:apply-templates select="*[local-name() = 'name']">
3943
4187
  <xsl:with-param name="process">true</xsl:with-param>
@@ -4098,6 +4342,28 @@
4098
4342
 
4099
4343
  </xsl:template> <!-- END: dl -->
4100
4344
 
4345
+ <xsl:template name="refine_dl_formula_where_style">
4346
+
4347
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4348
+
4349
+ <xsl:template name="refine_figure_key_style">
4350
+
4351
+ </xsl:template> <!-- refine_figure_key_style -->
4352
+
4353
+ <xsl:template name="refine_multicomponent_style">
4354
+ <xsl:variable name="parent" select="local-name(..)"/>
4355
+
4356
+ <!-- <xsl:attribute name="margin-left">7mm</xsl:attribute> -->
4357
+
4358
+ </xsl:template> <!-- refine_multicomponent_style -->
4359
+
4360
+ <xsl:template name="refine_multicomponent_block_style">
4361
+ <xsl:variable name="parent" select="local-name(..)"/>
4362
+
4363
+ <!-- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute> -->
4364
+
4365
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4366
+
4101
4367
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4102
4368
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4103
4369
 
@@ -4317,6 +4583,8 @@
4317
4583
 
4318
4584
  </xsl:if>
4319
4585
 
4586
+ <xsl:call-template name="refine_dt-cell-style"/>
4587
+
4320
4588
  <fo:block xsl:use-attribute-sets="dt-block-style">
4321
4589
  <xsl:copy-of select="@id"/>
4322
4590
 
@@ -4324,6 +4592,8 @@
4324
4592
  <xsl:attribute name="margin-top">0</xsl:attribute>
4325
4593
  </xsl:if>
4326
4594
 
4595
+ <xsl:call-template name="refine_dt-block-style"/>
4596
+
4327
4597
  <xsl:apply-templates>
4328
4598
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4329
4599
  </xsl:apply-templates>
@@ -4343,6 +4613,8 @@
4343
4613
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4344
4614
  </xsl:if>
4345
4615
 
4616
+ <xsl:call-template name="refine_dd-cell-style"/>
4617
+
4346
4618
  <fo:block>
4347
4619
 
4348
4620
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4388,8 +4660,18 @@
4388
4660
  </xsl:if>
4389
4661
  </xsl:template>
4390
4662
 
4391
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4392
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4663
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4664
+ <xsl:variable name="is_inline_element_after_where">
4665
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4666
+ </xsl:variable>
4667
+ <xsl:choose>
4668
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4669
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4670
+ </xsl:when>
4671
+ <xsl:otherwise>
4672
+ <xsl:apply-templates select="."/>
4673
+ </xsl:otherwise>
4674
+ </xsl:choose>
4393
4675
  </xsl:template>
4394
4676
 
4395
4677
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4483,12 +4765,18 @@
4483
4765
  <xsl:param name="split_keep-within-line"/>
4484
4766
  <fo:inline font-weight="bold">
4485
4767
 
4768
+ <xsl:call-template name="refine_strong_style"/>
4769
+
4486
4770
  <xsl:apply-templates>
4487
4771
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4488
4772
  </xsl:apply-templates>
4489
4773
  </fo:inline>
4490
4774
  </xsl:template>
4491
4775
 
4776
+ <xsl:template name="refine_strong_style">
4777
+
4778
+ </xsl:template>
4779
+
4492
4780
  <xsl:template match="*[local-name()='padding']">
4493
4781
  <fo:inline padding-right="{@value}"> </fo:inline>
4494
4782
  </xsl:template>
@@ -5027,7 +5315,10 @@
5027
5315
  </xsl:choose>
5028
5316
  </xsl:variable>
5029
5317
 
5030
- <xsl:value-of select="$text9"/>
5318
+ <!-- replace sequence #x200B and space TO space -->
5319
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5320
+
5321
+ <xsl:value-of select="$text10"/>
5031
5322
  </xsl:template>
5032
5323
 
5033
5324
  <xsl:template name="add-zero-spaces-link-java">
@@ -5702,6 +5993,11 @@
5702
5993
 
5703
5994
  <fo:inline xsl:use-attribute-sets="mathml-style">
5704
5995
 
5996
+ <!-- DEBUG -->
5997
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
5998
+
5999
+ <xsl:call-template name="refine_mathml-style"/>
6000
+
5705
6001
  <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 -->
5706
6002
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5707
6003
  </xsl:if>
@@ -5806,6 +6102,8 @@
5806
6102
 
5807
6103
  <fo:instream-foreign-object fox:alt-text="Math">
5808
6104
 
6105
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6106
+
5809
6107
  <!-- put MathML in Actual Text -->
5810
6108
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5811
6109
  <xsl:attribute name="fox:actual-text">
@@ -5826,6 +6124,10 @@
5826
6124
  </fo:instream-foreign-object>
5827
6125
  </xsl:template>
5828
6126
 
6127
+ <xsl:template name="refine_mathml_insteam_object_style">
6128
+
6129
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6130
+
5829
6131
  <xsl:template match="mathml:*" mode="mathml_actual_text">
5830
6132
  <!-- <xsl:text>a+b</xsl:text> -->
5831
6133
  <xsl:text>&lt;</xsl:text>
@@ -5889,6 +6191,79 @@
5889
6191
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5890
6192
  </xsl:template>
5891
6193
 
6194
+ <!-- special case for:
6195
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6196
+ <mstyle displaystyle="true">
6197
+ <msup>
6198
+ <mi color="#00000000">C</mi>
6199
+ <mtext>R</mtext>
6200
+ </msup>
6201
+ <msubsup>
6202
+ <mtext>C</mtext>
6203
+ <mi>n</mi>
6204
+ <mi>k</mi>
6205
+ </msubsup>
6206
+ </mstyle>
6207
+ </math>
6208
+ -->
6209
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6210
+ <xsl:copy>
6211
+ <xsl:copy-of select="@*"/>
6212
+ <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"/>
6213
+ <xsl:if test="string-length($next_mtext) != ''">
6214
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6215
+ </xsl:if>
6216
+ <xsl:apply-templates/>
6217
+ <xsl:value-of select="$next_mtext"/>
6218
+ </xsl:copy>
6219
+ </xsl:template>
6220
+
6221
+ <!-- special case for:
6222
+ <msup>
6223
+ <mtext/>
6224
+ <mn>1</mn>
6225
+ </msup>
6226
+ convert to (add mspace after mtext and enclose them into mrow):
6227
+ <msup>
6228
+ <mrow>
6229
+ <mtext/>
6230
+ <mspace height="1.47ex"/>
6231
+ </mrow>
6232
+ <mn>1</mn>
6233
+ </msup>
6234
+ -->
6235
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6236
+ <mathml:mrow>
6237
+ <xsl:copy-of select="."/>
6238
+ <mathml:mspace height="1.47ex"/>
6239
+ </mathml:mrow>
6240
+ </xsl:template>
6241
+
6242
+ <!-- add space around vertical line -->
6243
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6244
+ <xsl:copy>
6245
+ <xsl:apply-templates select="@*" mode="mathml"/>
6246
+ <xsl:if test="not(@lspace)">
6247
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6248
+ </xsl:if>
6249
+ <xsl:if test="not(@rspace)">
6250
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6251
+ </xsl:if>
6252
+ <xsl:apply-templates mode="mathml"/>
6253
+ </xsl:copy>
6254
+ </xsl:template>
6255
+
6256
+ <!-- decrease fontsize for 'Circled Times' char -->
6257
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6258
+ <xsl:copy>
6259
+ <xsl:apply-templates select="@*" mode="mathml"/>
6260
+ <xsl:if test="not(@fontsize)">
6261
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6262
+ </xsl:if>
6263
+ <xsl:apply-templates mode="mathml"/>
6264
+ </xsl:copy>
6265
+ </xsl:template>
6266
+
5892
6267
  <!-- Examples:
5893
6268
  <stem type="AsciiMath">x = 1</stem>
5894
6269
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5897,6 +6272,8 @@
5897
6272
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5898
6273
  <fo:inline xsl:use-attribute-sets="mathml-style">
5899
6274
 
6275
+ <xsl:call-template name="refine_mathml-style"/>
6276
+
5900
6277
  <xsl:choose>
5901
6278
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5902
6279
  <xsl:otherwise>
@@ -5941,24 +6318,30 @@
5941
6318
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5942
6319
  </xsl:if>
5943
6320
 
6321
+ <xsl:call-template name="refine_link-style"/>
6322
+
5944
6323
  <xsl:choose>
5945
6324
  <xsl:when test="$target_text = ''">
5946
6325
  <xsl:apply-templates/>
5947
6326
  </xsl:when>
5948
6327
  <xsl:otherwise>
5949
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5950
- <xsl:choose>
5951
- <xsl:when test="normalize-space(.) = ''">
5952
- <xsl:call-template name="add-zero-spaces-link-java">
5953
- <xsl:with-param name="text" select="$target_text"/>
5954
- </xsl:call-template>
5955
- </xsl:when>
5956
- <xsl:otherwise>
5957
- <!-- output text from <link>text</link> -->
5958
- <xsl:apply-templates/>
5959
- </xsl:otherwise>
5960
- </xsl:choose>
5961
- </fo:basic-link>
6328
+ <xsl:call-template name="insert_basic_link">
6329
+ <xsl:with-param name="element">
6330
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6331
+ <xsl:choose>
6332
+ <xsl:when test="normalize-space(.) = ''">
6333
+ <xsl:call-template name="add-zero-spaces-link-java">
6334
+ <xsl:with-param name="text" select="$target_text"/>
6335
+ </xsl:call-template>
6336
+ </xsl:when>
6337
+ <xsl:otherwise>
6338
+ <!-- output text from <link>text</link> -->
6339
+ <xsl:apply-templates/>
6340
+ </xsl:otherwise>
6341
+ </xsl:choose>
6342
+ </fo:basic-link>
6343
+ </xsl:with-param>
6344
+ </xsl:call-template>
5962
6345
  </xsl:otherwise>
5963
6346
  </xsl:choose>
5964
6347
  </fo:inline>
@@ -6021,12 +6404,19 @@
6021
6404
  </xsl:template>
6022
6405
 
6023
6406
  <xsl:template match="*[local-name() = 'xref']">
6024
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6025
- <xsl:if test="parent::*[local-name() = 'add']">
6026
- <xsl:call-template name="append_add-style"/>
6027
- </xsl:if>
6028
- <xsl:apply-templates/>
6029
- </fo:basic-link>
6407
+ <xsl:call-template name="insert_basic_link">
6408
+ <xsl:with-param name="element">
6409
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6410
+ <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
6411
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6412
+ </xsl:if>
6413
+ <xsl:if test="parent::*[local-name() = 'add']">
6414
+ <xsl:call-template name="append_add-style"/>
6415
+ </xsl:if>
6416
+ <xsl:apply-templates/>
6417
+ </fo:basic-link>
6418
+ </xsl:with-param>
6419
+ </xsl:call-template>
6030
6420
  </xsl:template>
6031
6421
 
6032
6422
  <!-- ====== -->
@@ -6081,6 +6471,8 @@
6081
6471
  <fo:table-cell display-align="center">
6082
6472
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6083
6473
 
6474
+ <xsl:call-template name="refine_formula-stem-block-style"/>
6475
+
6084
6476
  <xsl:apply-templates/>
6085
6477
  </fo:block>
6086
6478
  </fo:table-cell>
@@ -6122,12 +6514,18 @@
6122
6514
 
6123
6515
  <xsl:call-template name="setBlockSpanAll"/>
6124
6516
 
6517
+ <xsl:call-template name="refine_note-style"/>
6518
+
6125
6519
  <fo:block-container margin-left="0mm" margin-right="0mm">
6126
6520
 
6127
6521
  <fo:block>
6128
6522
 
6523
+ <xsl:call-template name="refine_note_block_style"/>
6524
+
6129
6525
  <fo:inline xsl:use-attribute-sets="note-name-style">
6130
6526
 
6527
+ <xsl:call-template name="refine_note-name-style"/>
6528
+
6131
6529
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6132
6530
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6133
6531
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6153,6 +6551,10 @@
6153
6551
 
6154
6552
  </xsl:template>
6155
6553
 
6554
+ <xsl:template name="refine_note_block_style">
6555
+
6556
+ </xsl:template>
6557
+
6156
6558
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6157
6559
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6158
6560
  <xsl:choose>
@@ -6174,12 +6576,16 @@
6174
6576
 
6175
6577
  <xsl:call-template name="setBlockSpanAll"/>
6176
6578
 
6579
+ <xsl:call-template name="refine_termnote-style"/>
6580
+
6177
6581
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6178
6582
 
6179
6583
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6180
6584
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6181
6585
  </xsl:if>
6182
6586
 
6587
+ <xsl:call-template name="refine_termnote-name-style"/>
6588
+
6183
6589
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6184
6590
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6185
6591
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6351,6 +6757,8 @@
6351
6757
  <xsl:otherwise>
6352
6758
  <fo:block xsl:use-attribute-sets="image-style">
6353
6759
 
6760
+ <xsl:call-template name="refine_image-style"/>
6761
+
6354
6762
  <xsl:variable name="src">
6355
6763
  <xsl:call-template name="image_src"/>
6356
6764
  </xsl:variable>
@@ -6409,7 +6817,7 @@
6409
6817
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6410
6818
  </xsl:when>
6411
6819
  <xsl:when test="not(starts-with(@src, 'data:'))">
6412
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6820
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6413
6821
  </xsl:when>
6414
6822
  <xsl:otherwise>
6415
6823
  <xsl:value-of select="@src"/>
@@ -6431,7 +6839,7 @@
6431
6839
  </xsl:when>
6432
6840
  <xsl:when test="not(starts-with(@src, 'data:'))">
6433
6841
  <xsl:variable name="src">
6434
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6842
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6435
6843
  </xsl:variable>
6436
6844
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6437
6845
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6817,15 +7225,19 @@
6817
7225
  <xsl:param name="dest"/>
6818
7226
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6819
7227
  <fo:block font-size="1pt">
6820
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6821
- <fo:inline-container inline-progression-dimension="100%">
6822
- <fo:block-container height="{$height - 1}px" width="100%">
6823
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6824
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6825
- </xsl:if> -->
6826
- <fo:block> </fo:block></fo:block-container>
6827
- </fo:inline-container>
6828
- </fo:basic-link>
7228
+ <xsl:call-template name="insert_basic_link">
7229
+ <xsl:with-param name="element">
7230
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7231
+ <fo:inline-container inline-progression-dimension="100%">
7232
+ <fo:block-container height="{$height - 1}px" width="100%">
7233
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7234
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7235
+ </xsl:if> -->
7236
+ <fo:block> </fo:block></fo:block-container>
7237
+ </fo:inline-container>
7238
+ </fo:basic-link>
7239
+ </xsl:with-param>
7240
+ </xsl:call-template>
6829
7241
  </fo:block>
6830
7242
  </fo:block-container>
6831
7243
  </xsl:template>
@@ -7196,6 +7608,8 @@
7196
7608
  <xsl:if test="normalize-space() != ''">
7197
7609
  <fo:block xsl:use-attribute-sets="figure-name-style">
7198
7610
 
7611
+ <xsl:call-template name="refine_figure-name-style"/>
7612
+
7199
7613
  <xsl:apply-templates/>
7200
7614
  </fo:block>
7201
7615
  </xsl:if>
@@ -7460,6 +7874,8 @@
7460
7874
  </xsl:attribute>
7461
7875
  </xsl:for-each>
7462
7876
 
7877
+ <xsl:call-template name="refine_sourcecode-style"/>
7878
+
7463
7879
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7464
7880
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7465
7881
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -8164,6 +8580,8 @@
8164
8580
 
8165
8581
  <xsl:call-template name="setBlockSpanAll"/>
8166
8582
 
8583
+ <xsl:call-template name="refine_example-style"/>
8584
+
8167
8585
  <xsl:variable name="fo_element">
8168
8586
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8169
8587
  inline
@@ -8291,6 +8709,8 @@
8291
8709
  </xsl:if>
8292
8710
  <fo:block xsl:use-attribute-sets="example-p-style">
8293
8711
 
8712
+ <xsl:call-template name="refine_example-p-style"/>
8713
+
8294
8714
  <xsl:apply-templates/>
8295
8715
  </fo:block>
8296
8716
  </fo:block-container>
@@ -8307,6 +8727,7 @@
8307
8727
  </xsl:otherwise>
8308
8728
  </xsl:choose>
8309
8729
  </xsl:template> <!-- example/p -->
8730
+
8310
8731
  <!-- ====== -->
8311
8732
  <!-- ====== -->
8312
8733
 
@@ -8318,6 +8739,8 @@
8318
8739
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8319
8740
  <fo:block xsl:use-attribute-sets="termsource-style">
8320
8741
 
8742
+ <xsl:call-template name="refine_termsource-style"/>
8743
+
8321
8744
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8322
8745
  <xsl:variable name="termsource_text">
8323
8746
  <xsl:apply-templates/>
@@ -8370,14 +8793,18 @@
8370
8793
  </xsl:template>
8371
8794
 
8372
8795
  <xsl:template match="*[local-name() = 'origin']">
8373
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8374
- <xsl:if test="normalize-space(@citeas) = ''">
8375
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8376
- </xsl:if>
8377
- <fo:inline xsl:use-attribute-sets="origin-style">
8378
- <xsl:apply-templates/>
8379
- </fo:inline>
8380
- </fo:basic-link>
8796
+ <xsl:call-template name="insert_basic_link">
8797
+ <xsl:with-param name="element">
8798
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8799
+ <xsl:if test="normalize-space(@citeas) = ''">
8800
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8801
+ </xsl:if>
8802
+ <fo:inline xsl:use-attribute-sets="origin-style">
8803
+ <xsl:apply-templates/>
8804
+ </fo:inline>
8805
+ </fo:basic-link>
8806
+ </xsl:with-param>
8807
+ </xsl:call-template>
8381
8808
  </xsl:template>
8382
8809
 
8383
8810
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8429,6 +8856,8 @@
8429
8856
  <fo:block-container margin-left="0mm">
8430
8857
  <fo:block-container xsl:use-attribute-sets="quote-style">
8431
8858
 
8859
+ <xsl:call-template name="refine_quote-style"/>
8860
+
8432
8861
  <fo:block-container margin-left="0mm" margin-right="0mm">
8433
8862
  <fo:block role="BlockQuote">
8434
8863
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8451,9 +8880,13 @@
8451
8880
  <xsl:if test="../*[local-name() = 'author']">
8452
8881
  <xsl:text>, </xsl:text>
8453
8882
  </xsl:if>
8454
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8455
- <xsl:apply-templates/>
8456
- </fo:basic-link>
8883
+ <xsl:call-template name="insert_basic_link">
8884
+ <xsl:with-param name="element">
8885
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8886
+ <xsl:apply-templates/>
8887
+ </fo:basic-link>
8888
+ </xsl:with-param>
8889
+ </xsl:call-template>
8457
8890
  </xsl:template>
8458
8891
 
8459
8892
  <xsl:template match="*[local-name() = 'author']">
@@ -8499,31 +8932,33 @@
8499
8932
 
8500
8933
  </xsl:if>
8501
8934
 
8502
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8503
- <xsl:variable name="text" select="normalize-space()"/>
8935
+ <xsl:call-template name="refine_eref-style"/>
8504
8936
 
8505
- <fo:basic-link fox:alt-text="{@citeas}">
8506
- <xsl:if test="normalize-space(@citeas) = ''">
8507
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8508
- </xsl:if>
8509
- <xsl:if test="@type = 'inline'">
8937
+ <xsl:call-template name="insert_basic_link">
8938
+ <xsl:with-param name="element">
8939
+ <fo:basic-link fox:alt-text="{@citeas}">
8940
+ <xsl:if test="normalize-space(@citeas) = ''">
8941
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8942
+ </xsl:if>
8943
+ <xsl:if test="@type = 'inline'">
8510
8944
 
8511
- <xsl:attribute name="color">blue</xsl:attribute>
8512
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8945
+ <xsl:call-template name="refine_basic_link_style"/>
8513
8946
 
8514
- </xsl:if>
8947
+ </xsl:if>
8515
8948
 
8516
- <xsl:choose>
8517
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8518
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8519
- </xsl:when>
8520
- <xsl:otherwise>
8521
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8522
- </xsl:otherwise>
8523
- </xsl:choose>
8949
+ <xsl:choose>
8950
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8951
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8952
+ </xsl:when>
8953
+ <xsl:otherwise>
8954
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8955
+ </xsl:otherwise>
8956
+ </xsl:choose>
8524
8957
 
8525
- <xsl:apply-templates/>
8526
- </fo:basic-link>
8958
+ <xsl:apply-templates/>
8959
+ </fo:basic-link>
8960
+ </xsl:with-param>
8961
+ </xsl:call-template>
8527
8962
 
8528
8963
  </fo:inline>
8529
8964
  </xsl:when>
@@ -8541,6 +8976,14 @@
8541
8976
  </xsl:otherwise>
8542
8977
  </xsl:choose>
8543
8978
  </xsl:template>
8979
+
8980
+ <xsl:template name="refine_basic_link_style">
8981
+
8982
+ <xsl:attribute name="color">blue</xsl:attribute>
8983
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8984
+
8985
+ </xsl:template> <!-- refine_basic_link_style -->
8986
+
8544
8987
  <!-- ====== -->
8545
8988
  <!-- END eref -->
8546
8989
  <!-- ====== -->
@@ -8684,11 +9127,17 @@
8684
9127
  <fo:block>
8685
9128
  <xsl:call-template name="setId"/>
8686
9129
 
9130
+ <xsl:call-template name="sections_element_style"/>
9131
+
8687
9132
  <xsl:apply-templates/>
8688
9133
  </fo:block>
8689
9134
 
8690
9135
  </xsl:template>
8691
9136
 
9137
+ <xsl:template name="sections_element_style">
9138
+
9139
+ </xsl:template> <!-- sections_element_style -->
9140
+
8692
9141
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
8693
9142
  <fo:block break-after="page"/>
8694
9143
  <fo:block>
@@ -8703,10 +9152,16 @@
8703
9152
 
8704
9153
  <xsl:call-template name="setBlockSpanAll"/>
8705
9154
 
9155
+ <xsl:call-template name="refine_clause_style"/>
9156
+
8706
9157
  <xsl:apply-templates/>
8707
9158
  </fo:block>
8708
9159
  </xsl:template>
8709
9160
 
9161
+ <xsl:template name="refine_clause_style">
9162
+
9163
+ </xsl:template> <!-- refine_clause_style -->
9164
+
8710
9165
  <xsl:template match="*[local-name() = 'definitions']">
8711
9166
  <fo:block id="{@id}">
8712
9167
  <xsl:apply-templates/>
@@ -8719,10 +9174,16 @@
8719
9174
 
8720
9175
  <xsl:call-template name="setBlockSpanAll"/>
8721
9176
 
9177
+ <xsl:call-template name="refine_annex_style"/>
9178
+
8722
9179
  </fo:block>
8723
9180
  <xsl:apply-templates/>
8724
9181
  </xsl:template>
8725
9182
 
9183
+ <xsl:template name="refine_annex_style">
9184
+
9185
+ </xsl:template>
9186
+
8726
9187
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
8727
9188
  <!-- comment 2019-11-29 -->
8728
9189
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -8762,7 +9223,10 @@
8762
9223
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8763
9224
 
8764
9225
  <xsl:template name="setULLabel">
8765
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9226
+ <xsl:variable name="list_level__">
9227
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9228
+ </xsl:variable>
9229
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8766
9230
  <xsl:variable name="list_level">
8767
9231
  <xsl:choose>
8768
9232
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8887,6 +9351,8 @@
8887
9351
  </xsl:choose>
8888
9352
  </xsl:attribute>
8889
9353
 
9354
+ <xsl:call-template name="refine_list_container_style"/>
9355
+
8890
9356
  <fo:block-container margin-left="0mm">
8891
9357
  <fo:block>
8892
9358
  <xsl:apply-templates select="." mode="list"/>
@@ -8895,13 +9361,19 @@
8895
9361
  </fo:block-container>
8896
9362
  </xsl:when>
8897
9363
  <xsl:otherwise>
8898
- <fo:block>
8899
- <xsl:apply-templates select="." mode="list"/>
8900
- </fo:block>
9364
+
9365
+ <fo:block>
9366
+ <xsl:apply-templates select="." mode="list"/>
9367
+ </fo:block>
9368
+
8901
9369
  </xsl:otherwise>
8902
9370
  </xsl:choose>
8903
9371
  </xsl:template>
8904
9372
 
9373
+ <xsl:template name="refine_list_container_style">
9374
+
9375
+ </xsl:template> <!-- refine_list_container_style -->
9376
+
8905
9377
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8906
9378
 
8907
9379
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -8912,7 +9384,7 @@
8912
9384
 
8913
9385
  <xsl:variable name="provisional_distance_between_starts_">
8914
9386
  <attributes xsl:use-attribute-sets="list-style">
8915
-
9387
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
8916
9388
  </attributes>
8917
9389
  </xsl:variable>
8918
9390
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -8948,6 +9420,8 @@
8948
9420
  <addon><xsl:value-of select="$addon"/></addon> -->
8949
9421
  </xsl:if>
8950
9422
 
9423
+ <xsl:call-template name="refine_list-style"/>
9424
+
8951
9425
  <xsl:if test="*[local-name() = 'name']">
8952
9426
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8953
9427
  </xsl:if>
@@ -8960,6 +9434,10 @@
8960
9434
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8961
9435
  </xsl:template>
8962
9436
 
9437
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9438
+
9439
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9440
+
8963
9441
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8964
9442
  <xsl:param name="process">false</xsl:param>
8965
9443
  <xsl:if test="$process = 'true'">
@@ -8973,20 +9451,27 @@
8973
9451
  <fo:list-item xsl:use-attribute-sets="list-item-style">
8974
9452
  <xsl:copy-of select="@id"/>
8975
9453
 
9454
+ <xsl:call-template name="refine_list-item-style"/>
9455
+
8976
9456
  <fo:list-item-label end-indent="label-end()">
8977
9457
  <fo:block xsl:use-attribute-sets="list-item-label-style">
8978
9458
 
9459
+ <xsl:call-template name="refine_list-item-label-style"/>
9460
+
8979
9461
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8980
9462
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
8981
9463
  <xsl:call-template name="append_add-style"/>
8982
9464
  </xsl:if>
8983
9465
 
8984
9466
  <xsl:call-template name="getListItemFormat"/>
9467
+
8985
9468
  </fo:block>
8986
9469
  </fo:list-item-label>
8987
9470
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
8988
9471
  <fo:block>
8989
9472
 
9473
+ <xsl:call-template name="refine_list-item-body-style"/>
9474
+
8990
9475
  <xsl:apply-templates/>
8991
9476
 
8992
9477
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9304,6 +9789,7 @@
9304
9789
 
9305
9790
  <fo:block id="{@id}">
9306
9791
  <xsl:apply-templates/>
9792
+
9307
9793
  </fo:block>
9308
9794
  </xsl:template>
9309
9795
 
@@ -9321,6 +9807,7 @@
9321
9807
 
9322
9808
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9323
9809
  <xsl:apply-templates/>
9810
+
9324
9811
  </fo:block>
9325
9812
 
9326
9813
  </xsl:template> <!-- references -->
@@ -9587,24 +10074,32 @@
9587
10074
  <xsl:for-each select="*[local-name() = 'tab']">
9588
10075
  <xsl:variable name="current_id" select="generate-id()"/>
9589
10076
  <fo:table-cell>
9590
- <fo:block>
9591
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9592
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9593
- <xsl:choose>
9594
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9595
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9596
- </xsl:choose>
9597
- </xsl:for-each>
9598
- </fo:basic-link>
10077
+ <fo:block line-height-shift-adjustment="disregard-shifts">
10078
+ <xsl:call-template name="insert_basic_link">
10079
+ <xsl:with-param name="element">
10080
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10081
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10082
+ <xsl:choose>
10083
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10084
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10085
+ </xsl:choose>
10086
+ </xsl:for-each>
10087
+ </fo:basic-link>
10088
+ </xsl:with-param>
10089
+ </xsl:call-template>
9599
10090
  </fo:block>
9600
10091
  </fo:table-cell>
9601
10092
  </xsl:for-each>
9602
10093
  <!-- last column - for page numbers -->
9603
10094
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9604
10095
  <fo:block>
9605
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9606
- <fo:page-number-citation ref-id="{$target}"/>
9607
- </fo:basic-link>
10096
+ <xsl:call-template name="insert_basic_link">
10097
+ <xsl:with-param name="element">
10098
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10099
+ <fo:page-number-citation ref-id="{$target}"/>
10100
+ </fo:basic-link>
10101
+ </xsl:with-param>
10102
+ </xsl:call-template>
9608
10103
  </fo:block>
9609
10104
  </fo:table-cell>
9610
10105
  </xsl:template>
@@ -9646,6 +10141,27 @@
9646
10141
  <!-- End Table of Contents (ToC) processing -->
9647
10142
  <!-- =================== -->
9648
10143
 
10144
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10145
+ <xsl:template name="insert_basic_link">
10146
+ <xsl:param name="element"/>
10147
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10148
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10149
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10150
+ <xsl:choose>
10151
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10152
+ <xsl:copy-of select="$element_node"/>
10153
+ </xsl:when>
10154
+ <xsl:otherwise>
10155
+ <fo:inline>
10156
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10157
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10158
+ </xsl:for-each>
10159
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10160
+ </fo:inline>
10161
+ </xsl:otherwise>
10162
+ </xsl:choose>
10163
+ </xsl:template>
10164
+
9649
10165
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9650
10166
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9651
10167
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9875,6 +10391,9 @@
9875
10391
  </xsl:copy>
9876
10392
  </xsl:template>
9877
10393
 
10394
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10395
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10396
+
9878
10397
  <xsl:template name="add_id">
9879
10398
  <xsl:if test="not(@id)">
9880
10399
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10159,6 +10678,14 @@
10159
10678
  <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">
10160
10679
  <xsl:variable name="p_fn_">
10161
10680
  <xsl:call-template name="get_fn_list"/>
10681
+ <!-- <xsl:choose>
10682
+ <xsl:when test="$namespace = 'jis'">
10683
+ <xsl:call-template name="get_fn_list_for_element"/>
10684
+ </xsl:when>
10685
+ <xsl:otherwise>
10686
+ <xsl:call-template name="get_fn_list"/>
10687
+ </xsl:otherwise>
10688
+ </xsl:choose> -->
10162
10689
  </xsl:variable>
10163
10690
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10164
10691
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10173,8 +10700,14 @@
10173
10700
  <xsl:attribute name="current_fn_number">
10174
10701
  <xsl:value-of select="$current_fn_number"/>
10175
10702
  </xsl:attribute>
10703
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10176
10704
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10177
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10705
+
10706
+ <xsl:value-of select="$skip_footnote_body_"/>
10707
+
10708
+ </xsl:attribute>
10709
+ <xsl:attribute name="ref_id">
10710
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
10178
10711
  </xsl:attribute>
10179
10712
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10180
10713
  </xsl:copy>