metanorma-un 0.10.7 → 0.10.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -284,10 +284,10 @@
284
284
  </xsl:if>
285
285
 
286
286
  <!-- Preface Pages (except Abstract, that showed in Summary on cover page`) -->
287
- <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition')]">
287
+ <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition' or (local-name() = 'clause' and @type = 'toc'))]">
288
288
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
289
289
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
290
- <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']"/>
290
+ <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')]"/>
291
291
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
292
292
  <fo:block break-after="page"/>
293
293
  </xsl:if>
@@ -330,6 +330,7 @@
330
330
 
331
331
  <xsl:variable name="skip">
332
332
  <xsl:choose>
333
+ <xsl:when test="@type = 'toc'">true</xsl:when>
333
334
  <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
334
335
  <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
335
336
  <xsl:when test="@inline-header = 'true'">true</xsl:when>
@@ -1129,6 +1130,10 @@
1129
1130
 
1130
1131
  </xsl:attribute-set>
1131
1132
 
1133
+ <xsl:template name="refine_link-style">
1134
+
1135
+ </xsl:template> <!-- refine_link-style -->
1136
+
1132
1137
  <xsl:attribute-set name="sourcecode-container-style">
1133
1138
 
1134
1139
  </xsl:attribute-set>
@@ -1144,6 +1149,10 @@
1144
1149
 
1145
1150
  </xsl:attribute-set>
1146
1151
 
1152
+ <xsl:template name="refine_sourcecode-style">
1153
+
1154
+ </xsl:template> <!-- refine_sourcecode-style -->
1155
+
1147
1156
  <xsl:attribute-set name="pre-style">
1148
1157
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1149
1158
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1221,6 +1230,10 @@
1221
1230
 
1222
1231
  </xsl:attribute-set> <!-- example-style -->
1223
1232
 
1233
+ <xsl:template name="refine_example-style">
1234
+
1235
+ </xsl:template> <!-- refine_example-style -->
1236
+
1224
1237
  <xsl:attribute-set name="example-body-style">
1225
1238
 
1226
1239
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1243,6 +1256,15 @@
1243
1256
 
1244
1257
  </xsl:attribute-set> <!-- example-p-style -->
1245
1258
 
1259
+ <xsl:template name="refine_example-p-style">
1260
+
1261
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1262
+ <xsl:if test="$num = 1">
1263
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
1264
+ </xsl:if>
1265
+
1266
+ </xsl:template> <!-- refine_example-p-style -->
1267
+
1246
1268
  <xsl:attribute-set name="termexample-name-style">
1247
1269
 
1248
1270
  </xsl:attribute-set> <!-- termexample-name-style -->
@@ -1269,6 +1291,15 @@
1269
1291
 
1270
1292
  </xsl:attribute-set> <!-- table-container-style -->
1271
1293
 
1294
+ <xsl:template name="refine_table-container-style">
1295
+ <xsl:param name="margin-side"/>
1296
+
1297
+ <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
1298
+ <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
1299
+
1300
+ <!-- end table block-container attributes -->
1301
+ </xsl:template> <!-- refine_table-container-style -->
1302
+
1272
1303
  <xsl:attribute-set name="table-style">
1273
1304
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1274
1305
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -1277,6 +1308,18 @@
1277
1308
 
1278
1309
  </xsl:attribute-set><!-- table-style -->
1279
1310
 
1311
+ <xsl:template name="refine_table-style">
1312
+ <xsl:param name="margin-side"/>
1313
+
1314
+ <xsl:if test="$margin-side != 0">
1315
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
1316
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
1317
+ </xsl:if>
1318
+
1319
+ <xsl:call-template name="setBordersTableArray"/>
1320
+
1321
+ </xsl:template> <!-- refine_table-style -->
1322
+
1280
1323
  <xsl:attribute-set name="table-name-style">
1281
1324
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1282
1325
 
@@ -1289,6 +1332,11 @@
1289
1332
 
1290
1333
  </xsl:attribute-set> <!-- table-name-style -->
1291
1334
 
1335
+ <xsl:template name="refine_table-name-style">
1336
+ <xsl:param name="continued"/>
1337
+
1338
+ </xsl:template> <!-- refine_table-name-style -->
1339
+
1292
1340
  <xsl:attribute-set name="table-row-style">
1293
1341
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1294
1342
 
@@ -1299,14 +1347,30 @@
1299
1347
 
1300
1348
  </xsl:attribute-set>
1301
1349
 
1350
+ <xsl:template name="refine_table-header-row-style">
1351
+
1352
+ <xsl:call-template name="setBordersTableArray"/>
1353
+
1354
+ </xsl:template> <!-- refine_table-header-row-style -->
1355
+
1302
1356
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1303
1357
 
1304
1358
  </xsl:attribute-set>
1305
1359
 
1360
+ <xsl:template name="refine_table-footer-row-style">
1361
+
1362
+ </xsl:template> <!-- refine_table-footer-row-style -->
1363
+
1306
1364
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1307
1365
 
1308
1366
  </xsl:attribute-set>
1309
1367
 
1368
+ <xsl:template name="refine_table-body-row-style">
1369
+
1370
+ <xsl:call-template name="setBordersTableArray"/>
1371
+
1372
+ </xsl:template> <!-- refine_table-body-row-style -->
1373
+
1310
1374
  <xsl:attribute-set name="table-header-cell-style">
1311
1375
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1312
1376
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1325,6 +1389,18 @@
1325
1389
 
1326
1390
  </xsl:attribute-set> <!-- table-header-cell-style -->
1327
1391
 
1392
+ <xsl:template name="refine_table-header-cell-style">
1393
+
1394
+ <xsl:call-template name="setBordersTableArray"/>
1395
+
1396
+ <xsl:if test="$lang = 'ar'">
1397
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1398
+ </xsl:if>
1399
+
1400
+ <xsl:call-template name="setTableCellAttributes"/>
1401
+
1402
+ </xsl:template> <!-- refine_table-header-cell-style -->
1403
+
1328
1404
  <xsl:attribute-set name="table-cell-style">
1329
1405
  <xsl:attribute name="display-align">center</xsl:attribute>
1330
1406
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1340,6 +1416,18 @@
1340
1416
 
1341
1417
  </xsl:attribute-set> <!-- table-cell-style -->
1342
1418
 
1419
+ <xsl:template name="refine_table-cell-style">
1420
+
1421
+ <xsl:if test="$lang = 'ar'">
1422
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1423
+ </xsl:if>
1424
+
1425
+ <!-- bsi -->
1426
+
1427
+ <xsl:call-template name="setBordersTableArray"/>
1428
+
1429
+ </xsl:template> <!-- refine_table-cell-style -->
1430
+
1343
1431
  <xsl:attribute-set name="table-footer-cell-style">
1344
1432
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1345
1433
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1348,12 +1436,20 @@
1348
1436
 
1349
1437
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1350
1438
 
1439
+ <xsl:template name="refine_table-footer-cell-style">
1440
+
1441
+ </xsl:template> <!-- refine_table-footer-cell-style -->
1442
+
1351
1443
  <xsl:attribute-set name="table-note-style">
1352
1444
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1353
1445
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1354
1446
 
1355
1447
  </xsl:attribute-set><!-- table-note-style -->
1356
1448
 
1449
+ <xsl:template name="refine_table-note-style">
1450
+
1451
+ </xsl:template> <!-- refine_table-note-style -->
1452
+
1357
1453
  <xsl:attribute-set name="table-fn-style">
1358
1454
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1359
1455
 
@@ -1411,11 +1507,19 @@
1411
1507
 
1412
1508
  </xsl:attribute-set>
1413
1509
 
1510
+ <xsl:template name="refine_dt-cell-style">
1511
+
1512
+ </xsl:template> <!-- refine_dt-cell-style -->
1513
+
1414
1514
  <xsl:attribute-set name="dt-block-style">
1415
1515
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1416
1516
 
1417
1517
  </xsl:attribute-set>
1418
1518
 
1519
+ <xsl:template name="refine_dt-block-style">
1520
+
1521
+ </xsl:template> <!-- refine_dt-block-style -->
1522
+
1419
1523
  <xsl:attribute-set name="dl-name-style">
1420
1524
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1421
1525
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1429,6 +1533,10 @@
1429
1533
 
1430
1534
  </xsl:attribute-set>
1431
1535
 
1536
+ <xsl:template name="refine_dd-cell-style">
1537
+
1538
+ </xsl:template> <!-- refine_dd-cell-style -->
1539
+
1432
1540
  <!-- ========================== -->
1433
1541
  <!-- END Definition's list styles -->
1434
1542
  <!-- ========================== -->
@@ -1451,12 +1559,22 @@
1451
1559
 
1452
1560
  </xsl:attribute-set>
1453
1561
 
1562
+ <xsl:template name="refine_eref-style">
1563
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
1564
+ <xsl:variable name="text" select="normalize-space()"/>
1565
+
1566
+ </xsl:template> <!-- refine_eref-style -->
1567
+
1454
1568
  <xsl:attribute-set name="note-style">
1455
1569
 
1456
1570
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1457
1571
 
1458
1572
  </xsl:attribute-set>
1459
1573
 
1574
+ <xsl:template name="refine_note-style">
1575
+
1576
+ </xsl:template>
1577
+
1460
1578
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1461
1579
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1462
1580
 
@@ -1466,11 +1584,23 @@
1466
1584
 
1467
1585
  </xsl:attribute-set>
1468
1586
 
1587
+ <xsl:template name="refine_note-name-style">
1588
+
1589
+ </xsl:template> <!-- refine_note-name-style -->
1590
+
1469
1591
  <xsl:attribute-set name="table-note-name-style">
1470
1592
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1471
1593
 
1472
1594
  </xsl:attribute-set>
1473
1595
 
1596
+ <xsl:template name="refine_table-note-name-style">
1597
+
1598
+ <xsl:if test="@type = 'source' or @type = 'abbreviation'">
1599
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1600
+ </xsl:if>
1601
+
1602
+ </xsl:template> <!-- refine_table-note-name-style -->
1603
+
1474
1604
  <xsl:attribute-set name="note-p-style">
1475
1605
 
1476
1606
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1484,10 +1614,18 @@
1484
1614
 
1485
1615
  </xsl:attribute-set>
1486
1616
 
1617
+ <xsl:template name="refine_termnote-style">
1618
+
1619
+ </xsl:template> <!-- refine_termnote-style -->
1620
+
1487
1621
  <xsl:attribute-set name="termnote-name-style">
1488
1622
 
1489
1623
  </xsl:attribute-set>
1490
1624
 
1625
+ <xsl:template name="refine_termnote-name-style">
1626
+
1627
+ </xsl:template>
1628
+
1491
1629
  <xsl:attribute-set name="termnote-p-style">
1492
1630
 
1493
1631
  </xsl:attribute-set>
@@ -1498,6 +1636,10 @@
1498
1636
 
1499
1637
  </xsl:attribute-set>
1500
1638
 
1639
+ <xsl:template name="refine_quote-style">
1640
+
1641
+ </xsl:template>
1642
+
1501
1643
  <xsl:attribute-set name="quote-source-style">
1502
1644
  <xsl:attribute name="text-align">right</xsl:attribute>
1503
1645
 
@@ -1507,6 +1649,10 @@
1507
1649
 
1508
1650
  </xsl:attribute-set>
1509
1651
 
1652
+ <xsl:template name="refine_termsource-style">
1653
+
1654
+ </xsl:template> <!-- refine_termsource-style -->
1655
+
1510
1656
  <xsl:attribute-set name="termsource-text-style">
1511
1657
 
1512
1658
  </xsl:attribute-set>
@@ -1543,6 +1689,10 @@
1543
1689
 
1544
1690
  </xsl:attribute-set>
1545
1691
 
1692
+ <xsl:template name="refine_figure-name-style">
1693
+
1694
+ </xsl:template> <!-- refine_figure-name-style -->
1695
+
1546
1696
  <xsl:attribute-set name="figure-source-style">
1547
1697
 
1548
1698
  </xsl:attribute-set>
@@ -1559,6 +1709,15 @@
1559
1709
 
1560
1710
  </xsl:attribute-set> <!-- formula-stem-block-style -->
1561
1711
 
1712
+ <xsl:template name="refine_formula-stem-block-style">
1713
+
1714
+ <xsl:if test="ancestor::*[local-name() ='annex']">
1715
+ <xsl:attribute name="text-align">left</xsl:attribute>
1716
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1717
+ </xsl:if>
1718
+
1719
+ </xsl:template> <!-- refine_formula-stem-block-style -->
1720
+
1562
1721
  <xsl:attribute-set name="formula-stem-number-style">
1563
1722
  <xsl:attribute name="text-align">right</xsl:attribute>
1564
1723
 
@@ -1575,6 +1734,10 @@
1575
1734
 
1576
1735
  </xsl:attribute-set>
1577
1736
 
1737
+ <xsl:template name="refine_image-style">
1738
+
1739
+ </xsl:template>
1740
+
1578
1741
  <xsl:attribute-set name="figure-pseudocode-p-style">
1579
1742
 
1580
1743
  </xsl:attribute-set>
@@ -1661,6 +1824,10 @@
1661
1824
 
1662
1825
  </xsl:attribute-set>
1663
1826
 
1827
+ <xsl:template name="refine_mathml-style">
1828
+
1829
+ </xsl:template>
1830
+
1664
1831
  <xsl:attribute-set name="list-style">
1665
1832
 
1666
1833
  <xsl:attribute name="provisional-distance-between-starts">4mm</xsl:attribute>
@@ -1668,6 +1835,10 @@
1668
1835
 
1669
1836
  </xsl:attribute-set> <!-- list-style -->
1670
1837
 
1838
+ <xsl:template name="refine_list-style">
1839
+
1840
+ </xsl:template> <!-- refine_list-style -->
1841
+
1671
1842
  <xsl:attribute-set name="list-name-style">
1672
1843
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1673
1844
 
@@ -1679,14 +1850,26 @@
1679
1850
 
1680
1851
  </xsl:attribute-set>
1681
1852
 
1853
+ <xsl:template name="refine_list-item-style">
1854
+
1855
+ </xsl:template> <!-- refine_list-item-style -->
1856
+
1682
1857
  <xsl:attribute-set name="list-item-label-style">
1683
1858
 
1684
1859
  </xsl:attribute-set>
1685
1860
 
1861
+ <xsl:template name="refine_list-item-label-style">
1862
+
1863
+ </xsl:template> <!-- refine_list-item-label-style -->
1864
+
1686
1865
  <xsl:attribute-set name="list-item-body-style">
1687
1866
 
1688
1867
  </xsl:attribute-set>
1689
1868
 
1869
+ <xsl:template name="refine_list-item-body-style">
1870
+
1871
+ </xsl:template> <!-- refine_list-item-body-style -->
1872
+
1690
1873
  <xsl:attribute-set name="toc-style">
1691
1874
  <xsl:attribute name="line-height">135%</xsl:attribute>
1692
1875
  </xsl:attribute-set>
@@ -1697,6 +1880,10 @@
1697
1880
 
1698
1881
  </xsl:attribute-set>
1699
1882
 
1883
+ <xsl:template name="refine_fn-reference-style">
1884
+
1885
+ </xsl:template> <!-- refine_fn-reference-style -->
1886
+
1700
1887
  <xsl:attribute-set name="fn-style">
1701
1888
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1702
1889
  </xsl:attribute-set>
@@ -1722,6 +1909,10 @@
1722
1909
 
1723
1910
  </xsl:attribute-set>
1724
1911
 
1912
+ <xsl:template name="refine_fn-body-style">
1913
+
1914
+ </xsl:template> <!-- refine_fn-body-style -->
1915
+
1725
1916
  <xsl:attribute-set name="fn-body-num-style">
1726
1917
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1727
1918
 
@@ -1731,6 +1922,10 @@
1731
1922
 
1732
1923
  </xsl:attribute-set> <!-- fn-body-num-style -->
1733
1924
 
1925
+ <xsl:template name="refine_fn-body-num-style">
1926
+
1927
+ </xsl:template> <!-- refine_fn-body-num-style -->
1928
+
1734
1929
  <!-- admonition -->
1735
1930
  <xsl:attribute-set name="admonition-style">
1736
1931
 
@@ -2382,10 +2577,9 @@
2382
2577
 
2383
2578
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2384
2579
 
2385
- <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2386
- <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2387
-
2388
- <!-- end table block-container attributes -->
2580
+ <xsl:call-template name="refine_table-container-style">
2581
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2582
+ </xsl:call-template>
2389
2583
 
2390
2584
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2391
2585
 
@@ -2412,12 +2606,9 @@
2412
2606
 
2413
2607
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2414
2608
 
2415
- <xsl:if test="$margin-side != 0">
2416
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2417
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2418
- </xsl:if>
2419
-
2420
- <xsl:call-template name="setBordersTableArray"/>
2609
+ <xsl:call-template name="refine_table-style">
2610
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2611
+ </xsl:call-template>
2421
2612
 
2422
2613
  </xsl:element>
2423
2614
  </xsl:variable>
@@ -2483,7 +2674,7 @@
2483
2674
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2484
2675
  </xsl:when>
2485
2676
  <xsl:otherwise>
2486
- <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 -->
2677
+ <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 -->
2487
2678
  </xsl:otherwise>
2488
2679
  </xsl:choose>
2489
2680
 
@@ -2570,6 +2761,10 @@
2570
2761
 
2571
2762
  <fo:block xsl:use-attribute-sets="table-name-style">
2572
2763
 
2764
+ <xsl:call-template name="refine_table-name-style">
2765
+ <xsl:with-param name="continued" select="$continued"/>
2766
+ </xsl:call-template>
2767
+
2573
2768
  <xsl:choose>
2574
2769
  <xsl:when test="$continued = 'true'">
2575
2770
 
@@ -2952,6 +3147,8 @@
2952
3147
  <fo:table-row>
2953
3148
  <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">
2954
3149
 
3150
+ <xsl:call-template name="refine_table-header-title-style"/>
3151
+
2955
3152
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
2956
3153
  <xsl:with-param name="continued">true</xsl:with-param>
2957
3154
  </xsl:apply-templates>
@@ -2964,6 +3161,10 @@
2964
3161
  </fo:table-row>
2965
3162
  </xsl:template> <!-- table-header-title -->
2966
3163
 
3164
+ <xsl:template name="refine_table-header-title-style">
3165
+
3166
+ </xsl:template> <!-- refine_table-header-title-style -->
3167
+
2967
3168
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
2968
3169
  <fo:table-body>
2969
3170
  <xsl:apply-templates/>
@@ -2988,7 +3189,7 @@
2988
3189
  <xsl:param name="colwidths"/>
2989
3190
  <xsl:param name="colgroup"/>
2990
3191
 
2991
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3192
+ <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']"/>
2992
3193
 
2993
3194
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2994
3195
 
@@ -3048,6 +3249,8 @@
3048
3249
  <fo:table-row>
3049
3250
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3050
3251
 
3252
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3253
+
3051
3254
  <xsl:call-template name="setBordersTableArray"/>
3052
3255
 
3053
3256
  <!-- fn will be processed inside 'note' processing -->
@@ -3056,6 +3259,7 @@
3056
3259
 
3057
3260
  <!-- except gb and bsi -->
3058
3261
 
3262
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3059
3263
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3060
3264
  <xsl:apply-templates select="../*[local-name()='note']"/>
3061
3265
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3187,7 +3391,7 @@
3187
3391
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3188
3392
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3189
3393
 
3190
- <xsl:call-template name="setBordersTableArray"/>
3394
+ <xsl:call-template name="refine_table-header-row-style"/>
3191
3395
 
3192
3396
  <xsl:call-template name="setTableRowAttributes"/>
3193
3397
 
@@ -3221,6 +3425,8 @@
3221
3425
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3222
3426
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3223
3427
 
3428
+ <xsl:call-template name="refine_table-footer-row-style"/>
3429
+
3224
3430
  <xsl:call-template name="setTableRowAttributes"/>
3225
3431
  <xsl:apply-templates/>
3226
3432
  </fo:table-row>
@@ -3234,9 +3440,10 @@
3234
3440
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3235
3441
  </xsl:if>
3236
3442
 
3237
- <xsl:call-template name="setBordersTableArray"/>
3443
+ <xsl:call-template name="refine_table-body-row-style"/>
3238
3444
 
3239
3445
  <xsl:call-template name="setTableRowAttributes"/>
3446
+
3240
3447
  <xsl:apply-templates/>
3241
3448
  </fo:table-row>
3242
3449
  </xsl:template>
@@ -3259,13 +3466,7 @@
3259
3466
  <xsl:with-param name="default">center</xsl:with-param>
3260
3467
  </xsl:call-template>
3261
3468
 
3262
- <xsl:call-template name="setBordersTableArray"/>
3263
-
3264
- <xsl:if test="$lang = 'ar'">
3265
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3266
- </xsl:if>
3267
-
3268
- <xsl:call-template name="setTableCellAttributes"/>
3469
+ <xsl:call-template name="refine_table-header-cell-style"/>
3269
3470
 
3270
3471
  <fo:block>
3271
3472
  <xsl:apply-templates/>
@@ -3307,13 +3508,7 @@
3307
3508
  <xsl:with-param name="default">left</xsl:with-param>
3308
3509
  </xsl:call-template>
3309
3510
 
3310
- <xsl:if test="$lang = 'ar'">
3311
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3312
- </xsl:if>
3313
-
3314
- <!-- bsi -->
3315
-
3316
- <xsl:call-template name="setBordersTableArray"/>
3511
+ <xsl:call-template name="refine_table-cell-style"/>
3317
3512
 
3318
3513
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3319
3514
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3344,12 +3539,12 @@
3344
3539
 
3345
3540
  <fo:block xsl:use-attribute-sets="table-note-style">
3346
3541
 
3542
+ <xsl:call-template name="refine_table-note-style"/>
3543
+
3347
3544
  <!-- Table's note name (NOTE, for example) -->
3348
3545
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3349
3546
 
3350
- <xsl:if test="@type = 'source' or @type = 'abbreviation'">
3351
- <xsl:attribute name="font-size">9pt</xsl:attribute>
3352
- </xsl:if>
3547
+ <xsl:call-template name="refine_table-note-name-style"/>
3353
3548
 
3354
3549
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3355
3550
 
@@ -3378,6 +3573,14 @@
3378
3573
  <!-- list of footnotes to calculate actual footnotes number -->
3379
3574
  <xsl:variable name="p_fn_">
3380
3575
  <xsl:call-template name="get_fn_list"/>
3576
+ <!-- <xsl:choose>
3577
+ <xsl:when test="$namespace = 'jis'">
3578
+ <xsl:call-template name="get_fn_list_for_element"/>
3579
+ </xsl:when>
3580
+ <xsl:otherwise>
3581
+ <xsl:call-template name="get_fn_list"/>
3582
+ </xsl:otherwise>
3583
+ </xsl:choose> -->
3381
3584
  </xsl:variable>
3382
3585
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3383
3586
 
@@ -3402,7 +3605,14 @@
3402
3605
 
3403
3606
  </xsl:variable>
3404
3607
 
3405
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3608
+ <xsl:variable name="ref_id">
3609
+ <xsl:choose>
3610
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
3611
+ <xsl:otherwise>
3612
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3613
+ </xsl:otherwise>
3614
+ </xsl:choose>
3615
+ </xsl:variable>
3406
3616
  <xsl:variable name="footnote_inline">
3407
3617
  <fo:inline>
3408
3618
 
@@ -3425,9 +3635,13 @@
3425
3635
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3426
3636
  </xsl:if>
3427
3637
 
3428
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3429
- <xsl:value-of select="$current_fn_number_text"/>
3430
- </fo:basic-link>
3638
+ <xsl:call-template name="insert_basic_link">
3639
+ <xsl:with-param name="element">
3640
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3641
+ <xsl:copy-of select="$current_fn_number_text"/>
3642
+ </fo:basic-link>
3643
+ </xsl:with-param>
3644
+ </xsl:call-template>
3431
3645
  </fo:inline>
3432
3646
  </xsl:variable>
3433
3647
 
@@ -3444,8 +3658,12 @@
3444
3658
 
3445
3659
  <fo:block xsl:use-attribute-sets="fn-body-style">
3446
3660
 
3661
+ <xsl:call-template name="refine_fn-body-style"/>
3662
+
3447
3663
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3448
3664
 
3665
+ <xsl:call-template name="refine_fn-body-num-style"/>
3666
+
3449
3667
  <xsl:value-of select="$current_fn_number_text"/>
3450
3668
  </fo:inline>
3451
3669
  <xsl:apply-templates/>
@@ -3497,6 +3715,28 @@
3497
3715
  </xsl:choose>
3498
3716
  </xsl:template>
3499
3717
 
3718
+ <xsl:template name="get_fn_list_for_element">
3719
+ <xsl:choose>
3720
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
3721
+ <fn gen_id="{generate-id(.)}">
3722
+ <xsl:copy-of select="@*"/>
3723
+ <xsl:copy-of select="node()"/>
3724
+ </fn>
3725
+ </xsl:when>
3726
+ <xsl:otherwise>
3727
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
3728
+ <xsl:variable name="element_id" select="@id"/>
3729
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3730
+ <!-- copy unique fn -->
3731
+ <fn gen_id="{generate-id(.)}">
3732
+ <xsl:copy-of select="@*"/>
3733
+ <xsl:copy-of select="node()"/>
3734
+ </fn>
3735
+ </xsl:for-each>
3736
+ </xsl:for-each>
3737
+ </xsl:otherwise>
3738
+ </xsl:choose>
3739
+ </xsl:template>
3500
3740
  <!-- ============================ -->
3501
3741
  <!-- table's footnotes rendering -->
3502
3742
  <!-- ============================ -->
@@ -3671,6 +3911,8 @@
3671
3911
  <xsl:template match="*[local-name()='fn']">
3672
3912
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
3673
3913
 
3914
+ <xsl:call-template name="refine_fn-reference-style"/>
3915
+
3674
3916
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3675
3917
 
3676
3918
  <xsl:value-of select="@reference"/>
@@ -3760,14 +4002,18 @@
3760
4002
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3761
4003
  <xsl:text> </xsl:text>
3762
4004
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3763
- <xsl:text/>
3764
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4005
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4006
+ <xsl:text> </xsl:text>
4007
+ </xsl:if>
4008
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3765
4009
  </fo:block>
3766
4010
 
3767
4011
  </xsl:when> <!-- END: only one component -->
3768
4012
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3769
4013
  <fo:block margin-bottom="12pt" text-align="left">
3770
4014
 
4015
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4016
+
3771
4017
  <!-- <xsl:variable name="title-where">
3772
4018
  <xsl:call-template name="getLocalizedString">
3773
4019
  <xsl:with-param name="key">where</xsl:with-param>
@@ -3781,6 +4027,8 @@
3781
4027
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3782
4028
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3783
4029
 
4030
+ <xsl:call-template name="refine_figure_key_style"/>
4031
+
3784
4032
  <xsl:variable name="title-key">
3785
4033
  <xsl:call-template name="getLocalizedString">
3786
4034
  <xsl:with-param name="key">key</xsl:with-param>
@@ -3795,12 +4043,16 @@
3795
4043
  <xsl:if test="$onlyOneComponent = 'false'">
3796
4044
  <fo:block>
3797
4045
 
4046
+ <xsl:call-template name="refine_multicomponent_style"/>
4047
+
3798
4048
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3799
4049
  <xsl:attribute name="margin-top">0</xsl:attribute>
3800
4050
  </xsl:if>
3801
4051
 
3802
4052
  <fo:block>
3803
4053
 
4054
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4055
+
3804
4056
  <xsl:apply-templates select="*[local-name() = 'name']">
3805
4057
  <xsl:with-param name="process">true</xsl:with-param>
3806
4058
  </xsl:apply-templates>
@@ -3958,6 +4210,24 @@
3958
4210
 
3959
4211
  </xsl:template> <!-- END: dl -->
3960
4212
 
4213
+ <xsl:template name="refine_dl_formula_where_style">
4214
+
4215
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4216
+
4217
+ <xsl:template name="refine_figure_key_style">
4218
+
4219
+ </xsl:template> <!-- refine_figure_key_style -->
4220
+
4221
+ <xsl:template name="refine_multicomponent_style">
4222
+ <xsl:variable name="parent" select="local-name(..)"/>
4223
+
4224
+ </xsl:template> <!-- refine_multicomponent_style -->
4225
+
4226
+ <xsl:template name="refine_multicomponent_block_style">
4227
+ <xsl:variable name="parent" select="local-name(..)"/>
4228
+
4229
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4230
+
3961
4231
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
3962
4232
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
3963
4233
 
@@ -4177,6 +4447,8 @@
4177
4447
 
4178
4448
  </xsl:if>
4179
4449
 
4450
+ <xsl:call-template name="refine_dt-cell-style"/>
4451
+
4180
4452
  <fo:block xsl:use-attribute-sets="dt-block-style">
4181
4453
  <xsl:copy-of select="@id"/>
4182
4454
 
@@ -4184,6 +4456,8 @@
4184
4456
  <xsl:attribute name="margin-top">0</xsl:attribute>
4185
4457
  </xsl:if>
4186
4458
 
4459
+ <xsl:call-template name="refine_dt-block-style"/>
4460
+
4187
4461
  <xsl:apply-templates>
4188
4462
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4189
4463
  </xsl:apply-templates>
@@ -4203,6 +4477,8 @@
4203
4477
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4204
4478
  </xsl:if>
4205
4479
 
4480
+ <xsl:call-template name="refine_dd-cell-style"/>
4481
+
4206
4482
  <fo:block>
4207
4483
 
4208
4484
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4248,8 +4524,18 @@
4248
4524
  </xsl:if>
4249
4525
  </xsl:template>
4250
4526
 
4251
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4252
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4527
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4528
+ <xsl:variable name="is_inline_element_after_where">
4529
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4530
+ </xsl:variable>
4531
+ <xsl:choose>
4532
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4533
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4534
+ </xsl:when>
4535
+ <xsl:otherwise>
4536
+ <xsl:apply-templates select="."/>
4537
+ </xsl:otherwise>
4538
+ </xsl:choose>
4253
4539
  </xsl:template>
4254
4540
 
4255
4541
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4343,12 +4629,18 @@
4343
4629
  <xsl:param name="split_keep-within-line"/>
4344
4630
  <fo:inline font-weight="bold">
4345
4631
 
4632
+ <xsl:call-template name="refine_strong_style"/>
4633
+
4346
4634
  <xsl:apply-templates>
4347
4635
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4348
4636
  </xsl:apply-templates>
4349
4637
  </fo:inline>
4350
4638
  </xsl:template>
4351
4639
 
4640
+ <xsl:template name="refine_strong_style">
4641
+
4642
+ </xsl:template>
4643
+
4352
4644
  <xsl:template match="*[local-name()='padding']">
4353
4645
  <fo:inline padding-right="{@value}"> </fo:inline>
4354
4646
  </xsl:template>
@@ -4815,7 +5107,10 @@
4815
5107
  </xsl:choose>
4816
5108
  </xsl:variable>
4817
5109
 
4818
- <xsl:value-of select="$text9"/>
5110
+ <!-- replace sequence #x200B and space TO space -->
5111
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5112
+
5113
+ <xsl:value-of select="$text10"/>
4819
5114
  </xsl:template>
4820
5115
 
4821
5116
  <xsl:template name="add-zero-spaces-link-java">
@@ -5490,6 +5785,11 @@
5490
5785
 
5491
5786
  <fo:inline xsl:use-attribute-sets="mathml-style">
5492
5787
 
5788
+ <!-- DEBUG -->
5789
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
5790
+
5791
+ <xsl:call-template name="refine_mathml-style"/>
5792
+
5493
5793
  <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 -->
5494
5794
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5495
5795
  </xsl:if>
@@ -5594,6 +5894,8 @@
5594
5894
 
5595
5895
  <fo:instream-foreign-object fox:alt-text="Math">
5596
5896
 
5897
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
5898
+
5597
5899
  <!-- put MathML in Actual Text -->
5598
5900
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5599
5901
  <xsl:attribute name="fox:actual-text">
@@ -5614,6 +5916,10 @@
5614
5916
  </fo:instream-foreign-object>
5615
5917
  </xsl:template>
5616
5918
 
5919
+ <xsl:template name="refine_mathml_insteam_object_style">
5920
+
5921
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
5922
+
5617
5923
  <xsl:template match="mathml:*" mode="mathml_actual_text">
5618
5924
  <!-- <xsl:text>a+b</xsl:text> -->
5619
5925
  <xsl:text>&lt;</xsl:text>
@@ -5677,6 +5983,79 @@
5677
5983
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5678
5984
  </xsl:template>
5679
5985
 
5986
+ <!-- special case for:
5987
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5988
+ <mstyle displaystyle="true">
5989
+ <msup>
5990
+ <mi color="#00000000">C</mi>
5991
+ <mtext>R</mtext>
5992
+ </msup>
5993
+ <msubsup>
5994
+ <mtext>C</mtext>
5995
+ <mi>n</mi>
5996
+ <mi>k</mi>
5997
+ </msubsup>
5998
+ </mstyle>
5999
+ </math>
6000
+ -->
6001
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6002
+ <xsl:copy>
6003
+ <xsl:copy-of select="@*"/>
6004
+ <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"/>
6005
+ <xsl:if test="string-length($next_mtext) != ''">
6006
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6007
+ </xsl:if>
6008
+ <xsl:apply-templates/>
6009
+ <xsl:value-of select="$next_mtext"/>
6010
+ </xsl:copy>
6011
+ </xsl:template>
6012
+
6013
+ <!-- special case for:
6014
+ <msup>
6015
+ <mtext/>
6016
+ <mn>1</mn>
6017
+ </msup>
6018
+ convert to (add mspace after mtext and enclose them into mrow):
6019
+ <msup>
6020
+ <mrow>
6021
+ <mtext/>
6022
+ <mspace height="1.47ex"/>
6023
+ </mrow>
6024
+ <mn>1</mn>
6025
+ </msup>
6026
+ -->
6027
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6028
+ <mathml:mrow>
6029
+ <xsl:copy-of select="."/>
6030
+ <mathml:mspace height="1.47ex"/>
6031
+ </mathml:mrow>
6032
+ </xsl:template>
6033
+
6034
+ <!-- add space around vertical line -->
6035
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6036
+ <xsl:copy>
6037
+ <xsl:apply-templates select="@*" mode="mathml"/>
6038
+ <xsl:if test="not(@lspace)">
6039
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6040
+ </xsl:if>
6041
+ <xsl:if test="not(@rspace)">
6042
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6043
+ </xsl:if>
6044
+ <xsl:apply-templates mode="mathml"/>
6045
+ </xsl:copy>
6046
+ </xsl:template>
6047
+
6048
+ <!-- decrease fontsize for 'Circled Times' char -->
6049
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6050
+ <xsl:copy>
6051
+ <xsl:apply-templates select="@*" mode="mathml"/>
6052
+ <xsl:if test="not(@fontsize)">
6053
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6054
+ </xsl:if>
6055
+ <xsl:apply-templates mode="mathml"/>
6056
+ </xsl:copy>
6057
+ </xsl:template>
6058
+
5680
6059
  <!-- Examples:
5681
6060
  <stem type="AsciiMath">x = 1</stem>
5682
6061
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5685,6 +6064,8 @@
5685
6064
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5686
6065
  <fo:inline xsl:use-attribute-sets="mathml-style">
5687
6066
 
6067
+ <xsl:call-template name="refine_mathml-style"/>
6068
+
5688
6069
  <xsl:choose>
5689
6070
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5690
6071
  <xsl:otherwise>
@@ -5729,24 +6110,30 @@
5729
6110
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5730
6111
  </xsl:if>
5731
6112
 
6113
+ <xsl:call-template name="refine_link-style"/>
6114
+
5732
6115
  <xsl:choose>
5733
6116
  <xsl:when test="$target_text = ''">
5734
6117
  <xsl:apply-templates/>
5735
6118
  </xsl:when>
5736
6119
  <xsl:otherwise>
5737
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5738
- <xsl:choose>
5739
- <xsl:when test="normalize-space(.) = ''">
5740
- <xsl:call-template name="add-zero-spaces-link-java">
5741
- <xsl:with-param name="text" select="$target_text"/>
5742
- </xsl:call-template>
5743
- </xsl:when>
5744
- <xsl:otherwise>
5745
- <!-- output text from <link>text</link> -->
5746
- <xsl:apply-templates/>
5747
- </xsl:otherwise>
5748
- </xsl:choose>
5749
- </fo:basic-link>
6120
+ <xsl:call-template name="insert_basic_link">
6121
+ <xsl:with-param name="element">
6122
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6123
+ <xsl:choose>
6124
+ <xsl:when test="normalize-space(.) = ''">
6125
+ <xsl:call-template name="add-zero-spaces-link-java">
6126
+ <xsl:with-param name="text" select="$target_text"/>
6127
+ </xsl:call-template>
6128
+ </xsl:when>
6129
+ <xsl:otherwise>
6130
+ <!-- output text from <link>text</link> -->
6131
+ <xsl:apply-templates/>
6132
+ </xsl:otherwise>
6133
+ </xsl:choose>
6134
+ </fo:basic-link>
6135
+ </xsl:with-param>
6136
+ </xsl:call-template>
5750
6137
  </xsl:otherwise>
5751
6138
  </xsl:choose>
5752
6139
  </fo:inline>
@@ -5809,12 +6196,19 @@
5809
6196
  </xsl:template>
5810
6197
 
5811
6198
  <xsl:template match="*[local-name() = 'xref']">
5812
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5813
- <xsl:if test="parent::*[local-name() = 'add']">
5814
- <xsl:call-template name="append_add-style"/>
5815
- </xsl:if>
5816
- <xsl:apply-templates/>
5817
- </fo:basic-link>
6199
+ <xsl:call-template name="insert_basic_link">
6200
+ <xsl:with-param name="element">
6201
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6202
+ <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'])">
6203
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6204
+ </xsl:if>
6205
+ <xsl:if test="parent::*[local-name() = 'add']">
6206
+ <xsl:call-template name="append_add-style"/>
6207
+ </xsl:if>
6208
+ <xsl:apply-templates/>
6209
+ </fo:basic-link>
6210
+ </xsl:with-param>
6211
+ </xsl:call-template>
5818
6212
  </xsl:template>
5819
6213
 
5820
6214
  <!-- ====== -->
@@ -5869,10 +6263,7 @@
5869
6263
  <fo:table-cell display-align="center">
5870
6264
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5871
6265
 
5872
- <xsl:if test="ancestor::*[local-name() ='annex']">
5873
- <xsl:attribute name="text-align">left</xsl:attribute>
5874
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
5875
- </xsl:if>
6266
+ <xsl:call-template name="refine_formula-stem-block-style"/>
5876
6267
 
5877
6268
  <xsl:apply-templates/>
5878
6269
  </fo:block>
@@ -5915,21 +6306,18 @@
5915
6306
 
5916
6307
  <xsl:call-template name="setBlockSpanAll"/>
5917
6308
 
6309
+ <xsl:call-template name="refine_note-style"/>
6310
+
5918
6311
  <fo:block-container margin-left="0mm" margin-right="0mm">
5919
6312
 
5920
6313
  <fo:block>
5921
6314
 
5922
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5923
- <xsl:attribute name="text-indent">0</xsl:attribute>
5924
- <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
5925
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
5926
- <xsl:attribute name="font-size">9pt</xsl:attribute>
5927
- <xsl:attribute name="text-align">justify</xsl:attribute>
5928
- <xsl:attribute name="padding-top">0mm</xsl:attribute>
5929
- </xsl:if>
6315
+ <xsl:call-template name="refine_note_block_style"/>
5930
6316
 
5931
6317
  <fo:inline xsl:use-attribute-sets="note-name-style">
5932
6318
 
6319
+ <xsl:call-template name="refine_note-name-style"/>
6320
+
5933
6321
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5934
6322
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5935
6323
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -5955,6 +6343,19 @@
5955
6343
 
5956
6344
  </xsl:template>
5957
6345
 
6346
+ <xsl:template name="refine_note_block_style">
6347
+
6348
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6349
+ <xsl:attribute name="text-indent">0</xsl:attribute>
6350
+ <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
6351
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6352
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
6353
+ <xsl:attribute name="text-align">justify</xsl:attribute>
6354
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
6355
+ </xsl:if>
6356
+
6357
+ </xsl:template>
6358
+
5958
6359
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
5959
6360
  <xsl:variable name="num"><xsl:number/></xsl:variable>
5960
6361
  <xsl:choose>
@@ -5976,12 +6377,16 @@
5976
6377
 
5977
6378
  <xsl:call-template name="setBlockSpanAll"/>
5978
6379
 
6380
+ <xsl:call-template name="refine_termnote-style"/>
6381
+
5979
6382
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5980
6383
 
5981
6384
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5982
6385
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5983
6386
  </xsl:if>
5984
6387
 
6388
+ <xsl:call-template name="refine_termnote-name-style"/>
6389
+
5985
6390
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5986
6391
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5987
6392
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6155,6 +6560,8 @@
6155
6560
  <xsl:otherwise>
6156
6561
  <fo:block xsl:use-attribute-sets="image-style">
6157
6562
 
6563
+ <xsl:call-template name="refine_image-style"/>
6564
+
6158
6565
  <xsl:variable name="src">
6159
6566
  <xsl:call-template name="image_src"/>
6160
6567
  </xsl:variable>
@@ -6213,7 +6620,7 @@
6213
6620
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6214
6621
  </xsl:when>
6215
6622
  <xsl:when test="not(starts-with(@src, 'data:'))">
6216
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6623
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6217
6624
  </xsl:when>
6218
6625
  <xsl:otherwise>
6219
6626
  <xsl:value-of select="@src"/>
@@ -6235,7 +6642,7 @@
6235
6642
  </xsl:when>
6236
6643
  <xsl:when test="not(starts-with(@src, 'data:'))">
6237
6644
  <xsl:variable name="src">
6238
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6645
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6239
6646
  </xsl:variable>
6240
6647
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6241
6648
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6621,15 +7028,19 @@
6621
7028
  <xsl:param name="dest"/>
6622
7029
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6623
7030
  <fo:block font-size="1pt">
6624
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6625
- <fo:inline-container inline-progression-dimension="100%">
6626
- <fo:block-container height="{$height - 1}px" width="100%">
6627
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6628
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6629
- </xsl:if> -->
6630
- <fo:block> </fo:block></fo:block-container>
6631
- </fo:inline-container>
6632
- </fo:basic-link>
7031
+ <xsl:call-template name="insert_basic_link">
7032
+ <xsl:with-param name="element">
7033
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7034
+ <fo:inline-container inline-progression-dimension="100%">
7035
+ <fo:block-container height="{$height - 1}px" width="100%">
7036
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7037
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7038
+ </xsl:if> -->
7039
+ <fo:block> </fo:block></fo:block-container>
7040
+ </fo:inline-container>
7041
+ </fo:basic-link>
7042
+ </xsl:with-param>
7043
+ </xsl:call-template>
6633
7044
  </fo:block>
6634
7045
  </fo:block-container>
6635
7046
  </xsl:template>
@@ -7000,6 +7411,8 @@
7000
7411
  <xsl:if test="normalize-space() != ''">
7001
7412
  <fo:block xsl:use-attribute-sets="figure-name-style">
7002
7413
 
7414
+ <xsl:call-template name="refine_figure-name-style"/>
7415
+
7003
7416
  <xsl:apply-templates/>
7004
7417
  </fo:block>
7005
7418
  </xsl:if>
@@ -7264,6 +7677,8 @@
7264
7677
  </xsl:attribute>
7265
7678
  </xsl:for-each>
7266
7679
 
7680
+ <xsl:call-template name="refine_sourcecode-style"/>
7681
+
7267
7682
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7268
7683
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7269
7684
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -7968,6 +8383,8 @@
7968
8383
 
7969
8384
  <xsl:call-template name="setBlockSpanAll"/>
7970
8385
 
8386
+ <xsl:call-template name="refine_example-style"/>
8387
+
7971
8388
  <xsl:variable name="fo_element">
7972
8389
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
7973
8390
  block
@@ -8095,9 +8512,7 @@
8095
8512
  </xsl:if>
8096
8513
  <fo:block xsl:use-attribute-sets="example-p-style">
8097
8514
 
8098
- <xsl:if test="$num = 1">
8099
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
8100
- </xsl:if>
8515
+ <xsl:call-template name="refine_example-p-style"/>
8101
8516
 
8102
8517
  <xsl:apply-templates/>
8103
8518
  </fo:block>
@@ -8115,6 +8530,7 @@
8115
8530
  </xsl:otherwise>
8116
8531
  </xsl:choose>
8117
8532
  </xsl:template> <!-- example/p -->
8533
+
8118
8534
  <!-- ====== -->
8119
8535
  <!-- ====== -->
8120
8536
 
@@ -8126,6 +8542,8 @@
8126
8542
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8127
8543
  <fo:block xsl:use-attribute-sets="termsource-style">
8128
8544
 
8545
+ <xsl:call-template name="refine_termsource-style"/>
8546
+
8129
8547
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8130
8548
  <xsl:variable name="termsource_text">
8131
8549
  <xsl:apply-templates/>
@@ -8178,14 +8596,18 @@
8178
8596
  </xsl:template>
8179
8597
 
8180
8598
  <xsl:template match="*[local-name() = 'origin']">
8181
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8182
- <xsl:if test="normalize-space(@citeas) = ''">
8183
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8184
- </xsl:if>
8185
- <fo:inline xsl:use-attribute-sets="origin-style">
8186
- <xsl:apply-templates/>
8187
- </fo:inline>
8188
- </fo:basic-link>
8599
+ <xsl:call-template name="insert_basic_link">
8600
+ <xsl:with-param name="element">
8601
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8602
+ <xsl:if test="normalize-space(@citeas) = ''">
8603
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8604
+ </xsl:if>
8605
+ <fo:inline xsl:use-attribute-sets="origin-style">
8606
+ <xsl:apply-templates/>
8607
+ </fo:inline>
8608
+ </fo:basic-link>
8609
+ </xsl:with-param>
8610
+ </xsl:call-template>
8189
8611
  </xsl:template>
8190
8612
 
8191
8613
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8237,6 +8659,8 @@
8237
8659
  <fo:block-container margin-left="0mm">
8238
8660
  <fo:block-container xsl:use-attribute-sets="quote-style">
8239
8661
 
8662
+ <xsl:call-template name="refine_quote-style"/>
8663
+
8240
8664
  <fo:block-container margin-left="0mm" margin-right="0mm">
8241
8665
  <fo:block role="BlockQuote">
8242
8666
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8259,9 +8683,13 @@
8259
8683
  <xsl:if test="../*[local-name() = 'author']">
8260
8684
  <xsl:text>, </xsl:text>
8261
8685
  </xsl:if>
8262
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8263
- <xsl:apply-templates/>
8264
- </fo:basic-link>
8686
+ <xsl:call-template name="insert_basic_link">
8687
+ <xsl:with-param name="element">
8688
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8689
+ <xsl:apply-templates/>
8690
+ </fo:basic-link>
8691
+ </xsl:with-param>
8692
+ </xsl:call-template>
8265
8693
  </xsl:template>
8266
8694
 
8267
8695
  <xsl:template match="*[local-name() = 'author']">
@@ -8307,30 +8735,33 @@
8307
8735
 
8308
8736
  </xsl:if>
8309
8737
 
8310
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8311
- <xsl:variable name="text" select="normalize-space()"/>
8738
+ <xsl:call-template name="refine_eref-style"/>
8312
8739
 
8313
- <fo:basic-link fox:alt-text="{@citeas}">
8314
- <xsl:if test="normalize-space(@citeas) = ''">
8315
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8316
- </xsl:if>
8317
- <xsl:if test="@type = 'inline'">
8740
+ <xsl:call-template name="insert_basic_link">
8741
+ <xsl:with-param name="element">
8742
+ <fo:basic-link fox:alt-text="{@citeas}">
8743
+ <xsl:if test="normalize-space(@citeas) = ''">
8744
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8745
+ </xsl:if>
8746
+ <xsl:if test="@type = 'inline'">
8318
8747
 
8319
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8748
+ <xsl:call-template name="refine_basic_link_style"/>
8320
8749
 
8321
- </xsl:if>
8750
+ </xsl:if>
8322
8751
 
8323
- <xsl:choose>
8324
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8325
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8326
- </xsl:when>
8327
- <xsl:otherwise>
8328
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8329
- </xsl:otherwise>
8330
- </xsl:choose>
8752
+ <xsl:choose>
8753
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8754
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8755
+ </xsl:when>
8756
+ <xsl:otherwise>
8757
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8758
+ </xsl:otherwise>
8759
+ </xsl:choose>
8331
8760
 
8332
- <xsl:apply-templates/>
8333
- </fo:basic-link>
8761
+ <xsl:apply-templates/>
8762
+ </fo:basic-link>
8763
+ </xsl:with-param>
8764
+ </xsl:call-template>
8334
8765
 
8335
8766
  </fo:inline>
8336
8767
  </xsl:when>
@@ -8348,6 +8779,13 @@
8348
8779
  </xsl:otherwise>
8349
8780
  </xsl:choose>
8350
8781
  </xsl:template>
8782
+
8783
+ <xsl:template name="refine_basic_link_style">
8784
+
8785
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8786
+
8787
+ </xsl:template> <!-- refine_basic_link_style -->
8788
+
8351
8789
  <!-- ====== -->
8352
8790
  <!-- END eref -->
8353
8791
  <!-- ====== -->
@@ -8490,16 +8928,22 @@
8490
8928
  <fo:block>
8491
8929
  <xsl:call-template name="setId"/>
8492
8930
 
8493
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8494
- <xsl:if test="$num = 1">
8495
- <xsl:attribute name="margin-top">20pt</xsl:attribute>
8496
- </xsl:if>
8931
+ <xsl:call-template name="sections_element_style"/>
8497
8932
 
8498
8933
  <xsl:apply-templates/>
8499
8934
  </fo:block>
8500
8935
 
8501
8936
  </xsl:template>
8502
8937
 
8938
+ <xsl:template name="sections_element_style">
8939
+
8940
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
8941
+ <xsl:if test="$num = 1">
8942
+ <xsl:attribute name="margin-top">20pt</xsl:attribute>
8943
+ </xsl:if>
8944
+
8945
+ </xsl:template> <!-- sections_element_style -->
8946
+
8503
8947
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
8504
8948
  <fo:block break-after="page"/>
8505
8949
  <fo:block>
@@ -8514,10 +8958,16 @@
8514
8958
 
8515
8959
  <xsl:call-template name="setBlockSpanAll"/>
8516
8960
 
8961
+ <xsl:call-template name="refine_clause_style"/>
8962
+
8517
8963
  <xsl:apply-templates/>
8518
8964
  </fo:block>
8519
8965
  </xsl:template>
8520
8966
 
8967
+ <xsl:template name="refine_clause_style">
8968
+
8969
+ </xsl:template> <!-- refine_clause_style -->
8970
+
8521
8971
  <xsl:template match="*[local-name() = 'definitions']">
8522
8972
  <fo:block id="{@id}">
8523
8973
  <xsl:apply-templates/>
@@ -8530,15 +8980,21 @@
8530
8980
 
8531
8981
  <xsl:call-template name="setBlockSpanAll"/>
8532
8982
 
8533
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8534
- <xsl:if test="$num = 1">
8535
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
8536
- </xsl:if>
8983
+ <xsl:call-template name="refine_annex_style"/>
8537
8984
 
8538
8985
  </fo:block>
8539
8986
  <xsl:apply-templates/>
8540
8987
  </xsl:template>
8541
8988
 
8989
+ <xsl:template name="refine_annex_style">
8990
+
8991
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
8992
+ <xsl:if test="$num = 1">
8993
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
8994
+ </xsl:if>
8995
+
8996
+ </xsl:template>
8997
+
8542
8998
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
8543
8999
  <!-- comment 2019-11-29 -->
8544
9000
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -8575,7 +9031,10 @@
8575
9031
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8576
9032
 
8577
9033
  <xsl:template name="setULLabel">
8578
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9034
+ <xsl:variable name="list_level__">
9035
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9036
+ </xsl:variable>
9037
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8579
9038
  <xsl:variable name="list_level">
8580
9039
  <xsl:choose>
8581
9040
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8700,6 +9159,8 @@
8700
9159
  </xsl:choose>
8701
9160
  </xsl:attribute>
8702
9161
 
9162
+ <xsl:call-template name="refine_list_container_style"/>
9163
+
8703
9164
  <fo:block-container margin-left="0mm">
8704
9165
  <fo:block>
8705
9166
  <xsl:apply-templates select="." mode="list"/>
@@ -8708,13 +9169,19 @@
8708
9169
  </fo:block-container>
8709
9170
  </xsl:when>
8710
9171
  <xsl:otherwise>
8711
- <fo:block>
8712
- <xsl:apply-templates select="." mode="list"/>
8713
- </fo:block>
9172
+
9173
+ <fo:block>
9174
+ <xsl:apply-templates select="." mode="list"/>
9175
+ </fo:block>
9176
+
8714
9177
  </xsl:otherwise>
8715
9178
  </xsl:choose>
8716
9179
  </xsl:template>
8717
9180
 
9181
+ <xsl:template name="refine_list_container_style">
9182
+
9183
+ </xsl:template> <!-- refine_list_container_style -->
9184
+
8718
9185
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8719
9186
 
8720
9187
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -8725,11 +9192,7 @@
8725
9192
 
8726
9193
  <xsl:variable name="provisional_distance_between_starts_">
8727
9194
  <attributes xsl:use-attribute-sets="list-style">
8728
-
8729
- <xsl:if test="local-name() = 'ol'">
8730
- <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
8731
- </xsl:if>
8732
-
9195
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
8733
9196
  </attributes>
8734
9197
  </xsl:variable>
8735
9198
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -8765,6 +9228,8 @@
8765
9228
  <addon><xsl:value-of select="$addon"/></addon> -->
8766
9229
  </xsl:if>
8767
9230
 
9231
+ <xsl:call-template name="refine_list-style"/>
9232
+
8768
9233
  <xsl:if test="*[local-name() = 'name']">
8769
9234
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8770
9235
  </xsl:if>
@@ -8777,6 +9242,14 @@
8777
9242
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8778
9243
  </xsl:template>
8779
9244
 
9245
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9246
+
9247
+ <xsl:if test="local-name() = 'ol'">
9248
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
9249
+ </xsl:if>
9250
+
9251
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9252
+
8780
9253
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8781
9254
  <xsl:param name="process">false</xsl:param>
8782
9255
  <xsl:if test="$process = 'true'">
@@ -8790,20 +9263,27 @@
8790
9263
  <fo:list-item xsl:use-attribute-sets="list-item-style">
8791
9264
  <xsl:copy-of select="@id"/>
8792
9265
 
9266
+ <xsl:call-template name="refine_list-item-style"/>
9267
+
8793
9268
  <fo:list-item-label end-indent="label-end()">
8794
9269
  <fo:block xsl:use-attribute-sets="list-item-label-style">
8795
9270
 
9271
+ <xsl:call-template name="refine_list-item-label-style"/>
9272
+
8796
9273
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8797
9274
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
8798
9275
  <xsl:call-template name="append_add-style"/>
8799
9276
  </xsl:if>
8800
9277
 
8801
9278
  <xsl:call-template name="getListItemFormat"/>
9279
+
8802
9280
  </fo:block>
8803
9281
  </fo:list-item-label>
8804
9282
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
8805
9283
  <fo:block>
8806
9284
 
9285
+ <xsl:call-template name="refine_list-item-body-style"/>
9286
+
8807
9287
  <xsl:apply-templates/>
8808
9288
 
8809
9289
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9121,6 +9601,7 @@
9121
9601
 
9122
9602
  <fo:block id="{@id}">
9123
9603
  <xsl:apply-templates/>
9604
+
9124
9605
  </fo:block>
9125
9606
  </xsl:template>
9126
9607
 
@@ -9138,6 +9619,7 @@
9138
9619
 
9139
9620
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9140
9621
  <xsl:apply-templates/>
9622
+
9141
9623
  </fo:block>
9142
9624
 
9143
9625
  </xsl:template> <!-- references -->
@@ -9377,24 +9859,32 @@
9377
9859
  <xsl:for-each select="*[local-name() = 'tab']">
9378
9860
  <xsl:variable name="current_id" select="generate-id()"/>
9379
9861
  <fo:table-cell>
9380
- <fo:block>
9381
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9382
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9383
- <xsl:choose>
9384
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9385
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9386
- </xsl:choose>
9387
- </xsl:for-each>
9388
- </fo:basic-link>
9862
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9863
+ <xsl:call-template name="insert_basic_link">
9864
+ <xsl:with-param name="element">
9865
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9866
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9867
+ <xsl:choose>
9868
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9869
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9870
+ </xsl:choose>
9871
+ </xsl:for-each>
9872
+ </fo:basic-link>
9873
+ </xsl:with-param>
9874
+ </xsl:call-template>
9389
9875
  </fo:block>
9390
9876
  </fo:table-cell>
9391
9877
  </xsl:for-each>
9392
9878
  <!-- last column - for page numbers -->
9393
9879
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9394
9880
  <fo:block>
9395
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9396
- <fo:page-number-citation ref-id="{$target}"/>
9397
- </fo:basic-link>
9881
+ <xsl:call-template name="insert_basic_link">
9882
+ <xsl:with-param name="element">
9883
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9884
+ <fo:page-number-citation ref-id="{$target}"/>
9885
+ </fo:basic-link>
9886
+ </xsl:with-param>
9887
+ </xsl:call-template>
9398
9888
  </fo:block>
9399
9889
  </fo:table-cell>
9400
9890
  </xsl:template>
@@ -9436,6 +9926,27 @@
9436
9926
  <!-- End Table of Contents (ToC) processing -->
9437
9927
  <!-- =================== -->
9438
9928
 
9929
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9930
+ <xsl:template name="insert_basic_link">
9931
+ <xsl:param name="element"/>
9932
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9933
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9934
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9935
+ <xsl:choose>
9936
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9937
+ <xsl:copy-of select="$element_node"/>
9938
+ </xsl:when>
9939
+ <xsl:otherwise>
9940
+ <fo:inline>
9941
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9942
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9943
+ </xsl:for-each>
9944
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9945
+ </fo:inline>
9946
+ </xsl:otherwise>
9947
+ </xsl:choose>
9948
+ </xsl:template>
9949
+
9439
9950
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9440
9951
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9441
9952
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9672,6 +10183,9 @@
9672
10183
  </xsl:copy>
9673
10184
  </xsl:template>
9674
10185
 
10186
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10187
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10188
+
9675
10189
  <xsl:template name="add_id">
9676
10190
  <xsl:if test="not(@id)">
9677
10191
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -9956,6 +10470,14 @@
9956
10470
  <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">
9957
10471
  <xsl:variable name="p_fn_">
9958
10472
  <xsl:call-template name="get_fn_list"/>
10473
+ <!-- <xsl:choose>
10474
+ <xsl:when test="$namespace = 'jis'">
10475
+ <xsl:call-template name="get_fn_list_for_element"/>
10476
+ </xsl:when>
10477
+ <xsl:otherwise>
10478
+ <xsl:call-template name="get_fn_list"/>
10479
+ </xsl:otherwise>
10480
+ </xsl:choose> -->
9959
10481
  </xsl:variable>
9960
10482
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9961
10483
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -9970,8 +10492,14 @@
9970
10492
  <xsl:attribute name="current_fn_number">
9971
10493
  <xsl:value-of select="$current_fn_number"/>
9972
10494
  </xsl:attribute>
10495
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
9973
10496
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
9974
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10497
+
10498
+ <xsl:value-of select="$skip_footnote_body_"/>
10499
+
10500
+ </xsl:attribute>
10501
+ <xsl:attribute name="ref_id">
10502
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
9975
10503
  </xsl:attribute>
9976
10504
  <xsl:apply-templates select="node()" mode="linear_xml"/>
9977
10505
  </xsl:copy>