metanorma-iso 2.4.2 → 2.4.4

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.
@@ -1307,123 +1307,15 @@
1307
1307
  </fo:block>
1308
1308
  </fo:block>
1309
1309
  </fo:block-container>
1310
+ <xsl:if test="/iso:iso-standard/iso:preface/*">
1311
+ <fo:block break-after="page"/>
1312
+ </xsl:if>
1310
1313
  </xsl:if>
1311
1314
 
1312
- <xsl:choose>
1313
- <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1314
-
1315
- <xsl:otherwise>
1316
- <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1317
- <fo:block break-after="page"/>
1318
- </xsl:if>
1319
- <fo:block-container font-weight="bold">
1320
- <fo:block role="TOC">
1321
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1322
- <fo:inline font-size="16pt" font-weight="bold" role="H1">
1323
- <!-- Contents -->
1324
- <xsl:call-template name="getLocalizedString">
1325
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1326
- </xsl:call-template>
1327
- </fo:inline>
1328
- <fo:inline keep-together.within-line="always">
1329
- <fo:leader leader-pattern="space"/>
1330
- <fo:inline font-weight="normal" font-size="10pt">
1331
- <!-- Page -->
1332
- <xsl:call-template name="getLocalizedString">
1333
- <xsl:with-param name="key">locality.page</xsl:with-param>
1334
- </xsl:call-template>
1335
- </fo:inline>
1336
- </fo:inline>
1337
- </fo:block>
1338
-
1339
- <xsl:if test="$debug = 'true'">
1340
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1341
- DEBUG
1342
- contents=<xsl:copy-of select="$contents"/>
1343
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1344
- </xsl:if>
1345
-
1346
- <xsl:variable name="margin-left">12</xsl:variable>
1347
- <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1348
-
1349
- <fo:block role="TOCI">
1350
- <xsl:if test="@level = 1">
1351
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1352
- </xsl:if>
1353
- <xsl:if test="@level = 3">
1354
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1355
- </xsl:if>
1356
- <fo:list-block>
1357
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1358
- <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1359
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1360
- </xsl:if>
1361
- <xsl:attribute name="provisional-distance-between-starts">
1362
- <xsl:choose>
1363
- <!-- skip 0 section without subsections -->
1364
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1365
- <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1366
- <xsl:otherwise>0mm</xsl:otherwise>
1367
- </xsl:choose>
1368
- </xsl:attribute>
1369
- <fo:list-item>
1370
- <fo:list-item-label end-indent="label-end()">
1371
- <fo:block>
1372
- <xsl:value-of select="@section"/>
1373
- </fo:block>
1374
- </fo:list-item-label>
1375
- <fo:list-item-body start-indent="body-start()">
1376
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1377
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1378
-
1379
- <xsl:apply-templates select="title"/>
1380
-
1381
- <fo:inline keep-together.within-line="always">
1382
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1383
- <fo:inline>
1384
- <xsl:if test="@level = 1 and @type = 'annex'">
1385
- <xsl:attribute name="font-weight">bold</xsl:attribute>
1386
- </xsl:if>
1387
- <fo:page-number-citation ref-id="{@id}"/>
1388
- </fo:inline>
1389
- </fo:inline>
1390
- </fo:basic-link>
1391
- </fo:block>
1392
- </fo:list-item-body>
1393
- </fo:list-item>
1394
- </fo:list-block>
1395
- </fo:block>
1396
-
1397
- </xsl:for-each>
1398
-
1399
- <!-- List of Tables -->
1400
- <xsl:if test="$contents//tables/table">
1401
- <xsl:call-template name="insertListOf_Title">
1402
- <xsl:with-param name="title" select="$title-list-tables"/>
1403
- </xsl:call-template>
1404
- <xsl:for-each select="$contents//tables/table">
1405
- <xsl:call-template name="insertListOf_Item"/>
1406
- </xsl:for-each>
1407
- </xsl:if>
1408
-
1409
- <!-- List of Figures -->
1410
- <xsl:if test="$contents//figures/figure">
1411
- <xsl:call-template name="insertListOf_Title">
1412
- <xsl:with-param name="title" select="$title-list-figures"/>
1413
- </xsl:call-template>
1414
- <xsl:for-each select="$contents//figures/figure">
1415
- <xsl:call-template name="insertListOf_Item"/>
1416
- </xsl:for-each>
1417
- </xsl:if>
1418
-
1419
- </fo:block>
1420
- </fo:block-container>
1421
- </xsl:otherwise>
1422
- </xsl:choose>
1423
-
1424
- <!-- Foreword, Introduction -->
1315
+ <!-- ToC, Foreword, Introduction -->
1425
1316
  <xsl:call-template name="processPrefaceSectionsDefault"/>
1426
1317
 
1318
+ <fo:block/> <!-- for prevent empty preface -->
1427
1319
  </fo:flow>
1428
1320
  </fo:page-sequence>
1429
1321
 
@@ -1595,6 +1487,126 @@
1595
1487
 
1596
1488
  </xsl:template>
1597
1489
 
1490
+ <xsl:template match="iso:preface/iso:clause[@type = 'toc']" priority="3">
1491
+ <xsl:choose>
1492
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1493
+ <xsl:otherwise>
1494
+
1495
+ <fo:block-container font-weight="bold">
1496
+ <fo:block role="TOC">
1497
+
1498
+ <xsl:apply-templates/>
1499
+
1500
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1501
+
1502
+ <xsl:if test="$debug = 'true'">
1503
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1504
+ DEBUG
1505
+ contents=<xsl:copy-of select="$contents"/>
1506
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1507
+ </xsl:if>
1508
+
1509
+ <xsl:variable name="margin-left">12</xsl:variable>
1510
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1511
+
1512
+ <fo:block role="TOCI">
1513
+ <xsl:if test="@level = 1">
1514
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
1515
+ </xsl:if>
1516
+ <xsl:if test="@level = 3">
1517
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1518
+ </xsl:if>
1519
+ <fo:list-block>
1520
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1521
+ <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1522
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1523
+ </xsl:if>
1524
+ <xsl:attribute name="provisional-distance-between-starts">
1525
+ <xsl:choose>
1526
+ <!-- skip 0 section without subsections -->
1527
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1528
+ <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1529
+ <xsl:otherwise>0mm</xsl:otherwise>
1530
+ </xsl:choose>
1531
+ </xsl:attribute>
1532
+ <fo:list-item>
1533
+ <fo:list-item-label end-indent="label-end()">
1534
+ <fo:block>
1535
+ <xsl:value-of select="@section"/>
1536
+ </fo:block>
1537
+ </fo:list-item-label>
1538
+ <fo:list-item-body start-indent="body-start()">
1539
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1540
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1541
+
1542
+ <xsl:apply-templates select="title"/>
1543
+
1544
+ <fo:inline keep-together.within-line="always">
1545
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1546
+ <fo:inline>
1547
+ <xsl:if test="@level = 1 and @type = 'annex'">
1548
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1549
+ </xsl:if>
1550
+ <fo:page-number-citation ref-id="{@id}"/>
1551
+ </fo:inline>
1552
+ </fo:inline>
1553
+ </fo:basic-link>
1554
+ </fo:block>
1555
+ </fo:list-item-body>
1556
+ </fo:list-item>
1557
+ </fo:list-block>
1558
+ </fo:block>
1559
+
1560
+ </xsl:for-each>
1561
+
1562
+ <!-- List of Tables -->
1563
+ <xsl:if test="$contents//tables/table">
1564
+ <xsl:call-template name="insertListOf_Title">
1565
+ <xsl:with-param name="title" select="$title-list-tables"/>
1566
+ </xsl:call-template>
1567
+ <xsl:for-each select="$contents//tables/table">
1568
+ <xsl:call-template name="insertListOf_Item"/>
1569
+ </xsl:for-each>
1570
+ </xsl:if>
1571
+
1572
+ <!-- List of Figures -->
1573
+ <xsl:if test="$contents//figures/figure">
1574
+ <xsl:call-template name="insertListOf_Title">
1575
+ <xsl:with-param name="title" select="$title-list-figures"/>
1576
+ </xsl:call-template>
1577
+ <xsl:for-each select="$contents//figures/figure">
1578
+ <xsl:call-template name="insertListOf_Item"/>
1579
+ </xsl:for-each>
1580
+ </xsl:if>
1581
+
1582
+ </xsl:if>
1583
+ </fo:block>
1584
+ </fo:block-container>
1585
+ </xsl:otherwise>
1586
+ </xsl:choose>
1587
+ </xsl:template>
1588
+
1589
+ <xsl:template match="iso:preface/iso:clause[@type = 'toc']/iso:title" priority="3">
1590
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1591
+ <fo:inline font-size="16pt" font-weight="bold" role="H1">
1592
+ <!-- Contents -->
1593
+ <!-- <xsl:call-template name="getLocalizedString">
1594
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1595
+ </xsl:call-template> -->
1596
+ <xsl:apply-templates/>
1597
+ </fo:inline>
1598
+ <fo:inline keep-together.within-line="always">
1599
+ <fo:leader leader-pattern="space"/>
1600
+ <fo:inline font-weight="normal" font-size="10pt">
1601
+ <!-- Page -->
1602
+ <xsl:call-template name="getLocalizedString">
1603
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1604
+ </xsl:call-template>
1605
+ </fo:inline>
1606
+ </fo:inline>
1607
+ </fo:block>
1608
+ </xsl:template>
1609
+
1598
1610
  <xsl:template match="iso:pagebreak" priority="2">
1599
1611
  <xsl:copy-of select="."/>
1600
1612
  </xsl:template>
@@ -2094,7 +2106,7 @@
2094
2106
  <xsl:template match="iso:indexsect" mode="index">
2095
2107
 
2096
2108
  <fo:page-sequence master-reference="index" force-page-count="no-force">
2097
- <xsl:variable name="header-title">
2109
+ <!-- <xsl:variable name="header-title">
2098
2110
  <xsl:choose>
2099
2111
  <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2100
2112
  <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
@@ -2103,13 +2115,14 @@
2103
2115
  <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2104
2116
  </xsl:otherwise>
2105
2117
  </xsl:choose>
2106
- </xsl:variable>
2118
+ </xsl:variable> -->
2107
2119
  <xsl:call-template name="insertHeaderFooter">
2108
- <xsl:with-param name="header-title" select="$header-title"/>
2120
+ <!-- <xsl:with-param name="header-title" select="$header-title"/> -->
2121
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
2109
2122
  </xsl:call-template>
2110
2123
 
2111
2124
  <fo:flow flow-name="xsl-region-body">
2112
- <fo:block id="{@id}" span="all">
2125
+ <fo:block id="{@id}" text-align="center" span="all">
2113
2126
  <xsl:apply-templates select="iso:title"/>
2114
2127
  </fo:block>
2115
2128
  <fo:block role="Index">
@@ -2120,21 +2133,25 @@
2120
2133
  </xsl:template>
2121
2134
 
2122
2135
  <xsl:template match="iso:xref" priority="2">
2123
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2124
- <xsl:choose>
2125
- <xsl:when test="@pagenumber='true'">
2126
- <fo:inline>
2127
- <xsl:if test="@id">
2128
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2129
- </xsl:if>
2130
- <fo:page-number-citation ref-id="{@target}"/>
2131
- </fo:inline>
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
- <xsl:apply-templates/>
2135
- </xsl:otherwise>
2136
- </xsl:choose>
2137
- </fo:basic-link>
2136
+ <xsl:call-template name="insert_basic_link">
2137
+ <xsl:with-param name="element">
2138
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2139
+ <xsl:choose>
2140
+ <xsl:when test="@pagenumber='true'">
2141
+ <fo:inline>
2142
+ <xsl:if test="@id">
2143
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2144
+ </xsl:if>
2145
+ <fo:page-number-citation ref-id="{@target}"/>
2146
+ </fo:inline>
2147
+ </xsl:when>
2148
+ <xsl:otherwise>
2149
+ <xsl:apply-templates/>
2150
+ </xsl:otherwise>
2151
+ </xsl:choose>
2152
+ </fo:basic-link>
2153
+ </xsl:with-param>
2154
+ </xsl:call-template>
2138
2155
  </xsl:template>
2139
2156
 
2140
2157
  <!-- =================== -->
@@ -2680,6 +2697,10 @@
2680
2697
 
2681
2698
  </xsl:attribute-set>
2682
2699
 
2700
+ <xsl:template name="refine_link-style">
2701
+
2702
+ </xsl:template> <!-- refine_link-style -->
2703
+
2683
2704
  <xsl:attribute-set name="sourcecode-container-style">
2684
2705
 
2685
2706
  </xsl:attribute-set>
@@ -2694,6 +2715,10 @@
2694
2715
 
2695
2716
  </xsl:attribute-set>
2696
2717
 
2718
+ <xsl:template name="refine_sourcecode-style">
2719
+
2720
+ </xsl:template> <!-- refine_sourcecode-style -->
2721
+
2697
2722
  <xsl:attribute-set name="pre-style">
2698
2723
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2699
2724
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2787,6 +2812,10 @@
2787
2812
 
2788
2813
  </xsl:attribute-set> <!-- example-style -->
2789
2814
 
2815
+ <xsl:template name="refine_example-style">
2816
+
2817
+ </xsl:template> <!-- refine_example-style -->
2818
+
2790
2819
  <xsl:attribute-set name="example-body-style">
2791
2820
 
2792
2821
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
@@ -2812,6 +2841,10 @@
2812
2841
 
2813
2842
  </xsl:attribute-set> <!-- example-p-style -->
2814
2843
 
2844
+ <xsl:template name="refine_example-p-style">
2845
+
2846
+ </xsl:template> <!-- refine_example-p-style -->
2847
+
2815
2848
  <xsl:attribute-set name="termexample-name-style">
2816
2849
 
2817
2850
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2843,6 +2876,19 @@
2843
2876
 
2844
2877
  </xsl:attribute-set> <!-- table-container-style -->
2845
2878
 
2879
+ <xsl:template name="refine_table-container-style">
2880
+ <xsl:param name="margin-side"/>
2881
+
2882
+ <xsl:if test="not(*[local-name() = 'name'])">
2883
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2884
+ </xsl:if>
2885
+ <xsl:if test="starts-with(@id, 'array_')">
2886
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2887
+ </xsl:if>
2888
+
2889
+ <!-- end table block-container attributes -->
2890
+ </xsl:template> <!-- refine_table-container-style -->
2891
+
2846
2892
  <xsl:attribute-set name="table-style">
2847
2893
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2848
2894
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -2851,6 +2897,21 @@
2851
2897
 
2852
2898
  </xsl:attribute-set><!-- table-style -->
2853
2899
 
2900
+ <xsl:template name="refine_table-style">
2901
+ <xsl:param name="margin-side"/>
2902
+
2903
+ <xsl:if test="*[local-name()='thead']">
2904
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
2905
+ </xsl:if>
2906
+ <xsl:if test="ancestor::*[local-name() = 'table']">
2907
+ <!-- for internal table in table cell -->
2908
+ <xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2909
+ </xsl:if>
2910
+
2911
+ <xsl:call-template name="setBordersTableArray"/>
2912
+
2913
+ </xsl:template> <!-- refine_table-style -->
2914
+
2854
2915
  <xsl:attribute-set name="table-name-style">
2855
2916
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2856
2917
 
@@ -2861,6 +2922,15 @@
2861
2922
 
2862
2923
  </xsl:attribute-set> <!-- table-name-style -->
2863
2924
 
2925
+ <xsl:template name="refine_table-name-style">
2926
+ <xsl:param name="continued"/>
2927
+
2928
+ <xsl:if test="$continued = 'true'">
2929
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
2930
+ </xsl:if>
2931
+
2932
+ </xsl:template> <!-- refine_table-name-style -->
2933
+
2864
2934
  <xsl:attribute-set name="table-row-style">
2865
2935
  <xsl:attribute name="min-height">4mm</xsl:attribute>
2866
2936
 
@@ -2874,6 +2944,23 @@
2874
2944
 
2875
2945
  </xsl:attribute-set>
2876
2946
 
2947
+ <xsl:template name="refine_table-header-row-style">
2948
+
2949
+ <xsl:choose>
2950
+ <xsl:when test="position() = 1">
2951
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
2952
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2953
+ </xsl:when>
2954
+ <xsl:when test="position() = last()">
2955
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2956
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
2957
+ </xsl:when>
2958
+ </xsl:choose>
2959
+
2960
+ <xsl:call-template name="setBordersTableArray"/>
2961
+
2962
+ </xsl:template> <!-- refine_table-header-row-style -->
2963
+
2877
2964
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
2878
2965
 
2879
2966
  <xsl:attribute name="font-size">9pt</xsl:attribute>
@@ -2882,10 +2969,24 @@
2882
2969
 
2883
2970
  </xsl:attribute-set>
2884
2971
 
2972
+ <xsl:template name="refine_table-footer-row-style">
2973
+
2974
+ </xsl:template> <!-- refine_table-footer-row-style -->
2975
+
2885
2976
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
2886
2977
 
2887
2978
  </xsl:attribute-set>
2888
2979
 
2980
+ <xsl:template name="refine_table-body-row-style">
2981
+
2982
+ <xsl:if test="position() = 1 and not(ancestor::*[local-name() = 'table']/*[local-name() = 'thead']) and ancestor::*[local-name() = 'table']/*[local-name() = 'name']">
2983
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
2984
+ </xsl:if>
2985
+
2986
+ <xsl:call-template name="setBordersTableArray"/>
2987
+
2988
+ </xsl:template> <!-- refine_table-body-row-style -->
2989
+
2889
2990
  <xsl:attribute-set name="table-header-cell-style">
2890
2991
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2891
2992
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2899,6 +3000,23 @@
2899
3000
 
2900
3001
  </xsl:attribute-set> <!-- table-header-cell-style -->
2901
3002
 
3003
+ <xsl:template name="refine_table-header-cell-style">
3004
+
3005
+ <xsl:if test="../parent::*[local-name() = 'tbody'] and (following-sibling::*[local-name() = 'td'] or preceding-sibling::*[local-name() = 'td'])">
3006
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
3007
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
3008
+ </xsl:if>
3009
+
3010
+ <xsl:call-template name="setBordersTableArray"/>
3011
+
3012
+ <xsl:if test="$lang = 'ar'">
3013
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3014
+ </xsl:if>
3015
+
3016
+ <xsl:call-template name="setTableCellAttributes"/>
3017
+
3018
+ </xsl:template> <!-- refine_table-header-cell-style -->
3019
+
2902
3020
  <xsl:attribute-set name="table-cell-style">
2903
3021
  <xsl:attribute name="display-align">center</xsl:attribute>
2904
3022
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2909,6 +3027,29 @@
2909
3027
 
2910
3028
  </xsl:attribute-set> <!-- table-cell-style -->
2911
3029
 
3030
+ <xsl:template name="refine_table-cell-style">
3031
+
3032
+ <xsl:if test="$lang = 'ar'">
3033
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3034
+ </xsl:if>
3035
+
3036
+ <!-- bsi -->
3037
+
3038
+ <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3039
+ <xsl:attribute name="border">solid black 0</xsl:attribute>
3040
+ </xsl:if>
3041
+ <xsl:if test="starts-with(ancestor::*[local-name() = 'table'][1]/@type, 'recommend')">
3042
+ <xsl:attribute name="display-align">before</xsl:attribute>
3043
+ </xsl:if>
3044
+ <xsl:if test="ancestor::*[local-name() = 'tbody'] and not(../preceding-sibling::*[local-name() = 'tr']) and ancestor::*[local-name() = 'table'][1]/*[local-name() = 'thead']"> <!-- cells in 1st row in the table body, and if thead exists -->
3045
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
3046
+ </xsl:if>
3047
+ <!-- <xsl:attribute name="page-break-inside">avoid</xsl:attribute> -->
3048
+
3049
+ <xsl:call-template name="setBordersTableArray"/>
3050
+
3051
+ </xsl:template> <!-- refine_table-cell-style -->
3052
+
2912
3053
  <xsl:attribute-set name="table-footer-cell-style">
2913
3054
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2914
3055
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2920,6 +3061,10 @@
2920
3061
 
2921
3062
  </xsl:attribute-set> <!-- table-footer-cell-style -->
2922
3063
 
3064
+ <xsl:template name="refine_table-footer-cell-style">
3065
+
3066
+ </xsl:template> <!-- refine_table-footer-cell-style -->
3067
+
2923
3068
  <xsl:attribute-set name="table-note-style">
2924
3069
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2925
3070
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2929,6 +3074,10 @@
2929
3074
 
2930
3075
  </xsl:attribute-set><!-- table-note-style -->
2931
3076
 
3077
+ <xsl:template name="refine_table-note-style">
3078
+
3079
+ </xsl:template> <!-- refine_table-note-style -->
3080
+
2932
3081
  <xsl:attribute-set name="table-fn-style">
2933
3082
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2934
3083
 
@@ -2987,11 +3136,21 @@
2987
3136
 
2988
3137
  </xsl:attribute-set>
2989
3138
 
3139
+ <xsl:template name="refine_dt-cell-style">
3140
+
3141
+ </xsl:template> <!-- refine_dt-cell-style -->
3142
+
2990
3143
  <xsl:attribute-set name="dt-block-style">
2991
3144
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
2992
3145
 
3146
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3147
+
2993
3148
  </xsl:attribute-set>
2994
3149
 
3150
+ <xsl:template name="refine_dt-block-style">
3151
+
3152
+ </xsl:template> <!-- refine_dt-block-style -->
3153
+
2995
3154
  <xsl:attribute-set name="dl-name-style">
2996
3155
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2997
3156
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -3005,6 +3164,10 @@
3005
3164
 
3006
3165
  </xsl:attribute-set>
3007
3166
 
3167
+ <xsl:template name="refine_dd-cell-style">
3168
+
3169
+ </xsl:template> <!-- refine_dd-cell-style -->
3170
+
3008
3171
  <!-- ========================== -->
3009
3172
  <!-- END Definition's list styles -->
3010
3173
  <!-- ========================== -->
@@ -3037,6 +3200,12 @@
3037
3200
 
3038
3201
  </xsl:attribute-set>
3039
3202
 
3203
+ <xsl:template name="refine_eref-style">
3204
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
3205
+ <xsl:variable name="text" select="normalize-space()"/>
3206
+
3207
+ </xsl:template> <!-- refine_eref-style -->
3208
+
3040
3209
  <xsl:attribute-set name="note-style">
3041
3210
 
3042
3211
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3046,6 +3215,14 @@
3046
3215
 
3047
3216
  </xsl:attribute-set>
3048
3217
 
3218
+ <xsl:template name="refine_note-style">
3219
+
3220
+ <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
3221
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
3222
+ </xsl:if>
3223
+
3224
+ </xsl:template>
3225
+
3049
3226
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
3050
3227
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
3051
3228
 
@@ -3055,11 +3232,19 @@
3055
3232
 
3056
3233
  </xsl:attribute-set>
3057
3234
 
3235
+ <xsl:template name="refine_note-name-style">
3236
+
3237
+ </xsl:template> <!-- refine_note-name-style -->
3238
+
3058
3239
  <xsl:attribute-set name="table-note-name-style">
3059
3240
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
3060
3241
 
3061
3242
  </xsl:attribute-set>
3062
3243
 
3244
+ <xsl:template name="refine_table-note-name-style">
3245
+
3246
+ </xsl:template> <!-- refine_table-note-name-style -->
3247
+
3063
3248
  <xsl:attribute-set name="note-p-style">
3064
3249
 
3065
3250
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
@@ -3076,10 +3261,22 @@
3076
3261
 
3077
3262
  </xsl:attribute-set>
3078
3263
 
3264
+ <xsl:template name="refine_termnote-style">
3265
+
3266
+ <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
3267
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
3268
+ </xsl:if>
3269
+
3270
+ </xsl:template> <!-- refine_termnote-style -->
3271
+
3079
3272
  <xsl:attribute-set name="termnote-name-style">
3080
3273
 
3081
3274
  </xsl:attribute-set>
3082
3275
 
3276
+ <xsl:template name="refine_termnote-name-style">
3277
+
3278
+ </xsl:template>
3279
+
3083
3280
  <xsl:attribute-set name="termnote-p-style">
3084
3281
 
3085
3282
  </xsl:attribute-set>
@@ -3092,6 +3289,15 @@
3092
3289
 
3093
3290
  </xsl:attribute-set>
3094
3291
 
3292
+ <xsl:template name="refine_quote-style">
3293
+
3294
+ <xsl:if test="$doctype = 'amendment' and (*[local-name() = 'note'] or *[local-name() = 'termnote'])">
3295
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
3296
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3297
+ </xsl:if>
3298
+
3299
+ </xsl:template>
3300
+
3095
3301
  <xsl:attribute-set name="quote-source-style">
3096
3302
  <xsl:attribute name="text-align">right</xsl:attribute>
3097
3303
 
@@ -3103,6 +3309,10 @@
3103
3309
 
3104
3310
  </xsl:attribute-set>
3105
3311
 
3312
+ <xsl:template name="refine_termsource-style">
3313
+
3314
+ </xsl:template> <!-- refine_termsource-style -->
3315
+
3106
3316
  <xsl:attribute-set name="termsource-text-style">
3107
3317
 
3108
3318
  </xsl:attribute-set>
@@ -3143,6 +3353,10 @@
3143
3353
 
3144
3354
  </xsl:attribute-set>
3145
3355
 
3356
+ <xsl:template name="refine_figure-name-style">
3357
+
3358
+ </xsl:template> <!-- refine_figure-name-style -->
3359
+
3146
3360
  <xsl:attribute-set name="figure-source-style">
3147
3361
 
3148
3362
  </xsl:attribute-set>
@@ -3162,6 +3376,10 @@
3162
3376
 
3163
3377
  </xsl:attribute-set> <!-- formula-stem-block-style -->
3164
3378
 
3379
+ <xsl:template name="refine_formula-stem-block-style">
3380
+
3381
+ </xsl:template> <!-- refine_formula-stem-block-style -->
3382
+
3165
3383
  <xsl:attribute-set name="formula-stem-number-style">
3166
3384
  <xsl:attribute name="text-align">right</xsl:attribute>
3167
3385
 
@@ -3173,6 +3391,10 @@
3173
3391
 
3174
3392
  </xsl:attribute-set>
3175
3393
 
3394
+ <xsl:template name="refine_image-style">
3395
+
3396
+ </xsl:template>
3397
+
3176
3398
  <xsl:attribute-set name="figure-pseudocode-p-style">
3177
3399
 
3178
3400
  </xsl:attribute-set>
@@ -3267,6 +3489,10 @@
3267
3489
 
3268
3490
  </xsl:attribute-set>
3269
3491
 
3492
+ <xsl:template name="refine_mathml-style">
3493
+
3494
+ </xsl:template>
3495
+
3270
3496
  <xsl:attribute-set name="list-style">
3271
3497
 
3272
3498
  <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
@@ -3274,6 +3500,14 @@
3274
3500
 
3275
3501
  </xsl:attribute-set> <!-- list-style -->
3276
3502
 
3503
+ <xsl:template name="refine_list-style">
3504
+
3505
+ <xsl:if test="not(ancestor::*[local-name() = 'ul' or local-name() = 'ol'])">
3506
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3507
+ </xsl:if>
3508
+
3509
+ </xsl:template> <!-- refine_list-style -->
3510
+
3277
3511
  <xsl:attribute-set name="list-name-style">
3278
3512
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3279
3513
 
@@ -3286,14 +3520,26 @@
3286
3520
 
3287
3521
  </xsl:attribute-set>
3288
3522
 
3523
+ <xsl:template name="refine_list-item-style">
3524
+
3525
+ </xsl:template> <!-- refine_list-item-style -->
3526
+
3289
3527
  <xsl:attribute-set name="list-item-label-style">
3290
3528
 
3291
3529
  </xsl:attribute-set>
3292
3530
 
3531
+ <xsl:template name="refine_list-item-label-style">
3532
+
3533
+ </xsl:template> <!-- refine_list-item-label-style -->
3534
+
3293
3535
  <xsl:attribute-set name="list-item-body-style">
3294
3536
 
3295
3537
  </xsl:attribute-set>
3296
3538
 
3539
+ <xsl:template name="refine_list-item-body-style">
3540
+
3541
+ </xsl:template> <!-- refine_list-item-body-style -->
3542
+
3297
3543
  <xsl:attribute-set name="toc-style">
3298
3544
  <xsl:attribute name="line-height">135%</xsl:attribute>
3299
3545
  </xsl:attribute-set>
@@ -3304,6 +3550,15 @@
3304
3550
 
3305
3551
  </xsl:attribute-set>
3306
3552
 
3553
+ <xsl:template name="refine_fn-reference-style">
3554
+
3555
+ <xsl:if test="ancestor::*[local-name()='table']">
3556
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
3557
+ <xsl:attribute name="baseline-shift">15%</xsl:attribute>
3558
+ </xsl:if>
3559
+
3560
+ </xsl:template> <!-- refine_fn-reference-style -->
3561
+
3307
3562
  <xsl:attribute-set name="fn-style">
3308
3563
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3309
3564
  </xsl:attribute-set>
@@ -3327,6 +3582,10 @@
3327
3582
 
3328
3583
  </xsl:attribute-set>
3329
3584
 
3585
+ <xsl:template name="refine_fn-body-style">
3586
+
3587
+ </xsl:template> <!-- refine_fn-body-style -->
3588
+
3330
3589
  <xsl:attribute-set name="fn-body-num-style">
3331
3590
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
3332
3591
 
@@ -3334,6 +3593,10 @@
3334
3593
 
3335
3594
  </xsl:attribute-set> <!-- fn-body-num-style -->
3336
3595
 
3596
+ <xsl:template name="refine_fn-body-num-style">
3597
+
3598
+ </xsl:template> <!-- refine_fn-body-num-style -->
3599
+
3337
3600
  <!-- admonition -->
3338
3601
  <xsl:attribute-set name="admonition-style">
3339
3602
 
@@ -3980,14 +4243,9 @@
3980
4243
 
3981
4244
  <fo:block-container xsl:use-attribute-sets="table-container-style">
3982
4245
 
3983
- <xsl:if test="not(*[local-name() = 'name'])">
3984
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
3985
- </xsl:if>
3986
- <xsl:if test="starts-with(@id, 'array_')">
3987
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
3988
- </xsl:if>
3989
-
3990
- <!-- end table block-container attributes -->
4246
+ <xsl:call-template name="refine_table-container-style">
4247
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4248
+ </xsl:call-template>
3991
4249
 
3992
4250
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
3993
4251
 
@@ -4008,15 +4266,9 @@
4008
4266
 
4009
4267
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
4010
4268
 
4011
- <xsl:if test="*[local-name()='thead']">
4012
- <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
4013
- </xsl:if>
4014
- <xsl:if test="ancestor::*[local-name() = 'table']">
4015
- <!-- for internal table in table cell -->
4016
- <xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4017
- </xsl:if>
4018
-
4019
- <xsl:call-template name="setBordersTableArray"/>
4269
+ <xsl:call-template name="refine_table-style">
4270
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4271
+ </xsl:call-template>
4020
4272
 
4021
4273
  </xsl:element>
4022
4274
  </xsl:variable>
@@ -4082,7 +4334,7 @@
4082
4334
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4083
4335
  </xsl:when>
4084
4336
  <xsl:otherwise>
4085
- <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 -->
4337
+ <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 -->
4086
4338
  </xsl:otherwise>
4087
4339
  </xsl:choose>
4088
4340
 
@@ -4177,9 +4429,9 @@
4177
4429
 
4178
4430
  <fo:block xsl:use-attribute-sets="table-name-style">
4179
4431
 
4180
- <xsl:if test="$continued = 'true'">
4181
- <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
4182
- </xsl:if>
4432
+ <xsl:call-template name="refine_table-name-style">
4433
+ <xsl:with-param name="continued" select="$continued"/>
4434
+ </xsl:call-template>
4183
4435
 
4184
4436
  <xsl:choose>
4185
4437
  <xsl:when test="$continued = 'true'">
@@ -4577,11 +4829,7 @@
4577
4829
  <fo:table-row>
4578
4830
  <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">
4579
4831
 
4580
- <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4581
- <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4582
- <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4583
- <!-- <xsl:attribute name="border-bottom">0.5pt solid white</xsl:attribute> -->
4584
- <xsl:attribute name="border-bottom">none</xsl:attribute>
4832
+ <xsl:call-template name="refine_table-header-title-style"/>
4585
4833
 
4586
4834
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4587
4835
  <xsl:with-param name="continued">true</xsl:with-param>
@@ -4599,6 +4847,16 @@
4599
4847
  </fo:table-row>
4600
4848
  </xsl:template> <!-- table-header-title -->
4601
4849
 
4850
+ <xsl:template name="refine_table-header-title-style">
4851
+
4852
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4853
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4854
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4855
+ <!-- <xsl:attribute name="border-bottom">0.5pt solid white</xsl:attribute> -->
4856
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
4857
+
4858
+ </xsl:template> <!-- refine_table-header-title-style -->
4859
+
4602
4860
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
4603
4861
  <fo:table-body>
4604
4862
  <xsl:apply-templates/>
@@ -4623,7 +4881,7 @@
4623
4881
  <xsl:param name="colwidths"/>
4624
4882
  <xsl:param name="colgroup"/>
4625
4883
 
4626
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4884
+ <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']"/>
4627
4885
 
4628
4886
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4629
4887
 
@@ -4683,6 +4941,8 @@
4683
4941
  <fo:table-row>
4684
4942
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4685
4943
 
4944
+ <xsl:call-template name="refine_table-footer-cell-style"/>
4945
+
4686
4946
  <xsl:call-template name="setBordersTableArray"/>
4687
4947
 
4688
4948
  <!-- fn will be processed inside 'note' processing -->
@@ -4691,6 +4951,7 @@
4691
4951
 
4692
4952
  <!-- except gb and bsi -->
4693
4953
 
4954
+ <xsl:apply-templates select="../*[local-name()='p']"/>
4694
4955
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4695
4956
  <xsl:apply-templates select="../*[local-name()='note']"/>
4696
4957
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -4866,18 +5127,7 @@
4866
5127
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4867
5128
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4868
5129
 
4869
- <xsl:choose>
4870
- <xsl:when test="position() = 1">
4871
- <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
4872
- <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4873
- </xsl:when>
4874
- <xsl:when test="position() = last()">
4875
- <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4876
- <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4877
- </xsl:when>
4878
- </xsl:choose>
4879
-
4880
- <xsl:call-template name="setBordersTableArray"/>
5130
+ <xsl:call-template name="refine_table-header-row-style"/>
4881
5131
 
4882
5132
  <xsl:call-template name="setTableRowAttributes"/>
4883
5133
 
@@ -4911,6 +5161,8 @@
4911
5161
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4912
5162
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4913
5163
 
5164
+ <xsl:call-template name="refine_table-footer-row-style"/>
5165
+
4914
5166
  <xsl:call-template name="setTableRowAttributes"/>
4915
5167
  <xsl:apply-templates/>
4916
5168
  </fo:table-row>
@@ -4924,13 +5176,10 @@
4924
5176
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4925
5177
  </xsl:if>
4926
5178
 
4927
- <xsl:if test="position() = 1 and not(ancestor::*[local-name() = 'table']/*[local-name() = 'thead']) and ancestor::*[local-name() = 'table']/*[local-name() = 'name']">
4928
- <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
4929
- </xsl:if>
4930
-
4931
- <xsl:call-template name="setBordersTableArray"/>
5179
+ <xsl:call-template name="refine_table-body-row-style"/>
4932
5180
 
4933
5181
  <xsl:call-template name="setTableRowAttributes"/>
5182
+
4934
5183
  <xsl:apply-templates/>
4935
5184
  </fo:table-row>
4936
5185
  </xsl:template>
@@ -4949,18 +5198,7 @@
4949
5198
  <xsl:with-param name="default">center</xsl:with-param>
4950
5199
  </xsl:call-template>
4951
5200
 
4952
- <xsl:if test="../parent::*[local-name() = 'tbody'] and (following-sibling::*[local-name() = 'td'] or preceding-sibling::*[local-name() = 'td'])">
4953
- <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4954
- <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4955
- </xsl:if>
4956
-
4957
- <xsl:call-template name="setBordersTableArray"/>
4958
-
4959
- <xsl:if test="$lang = 'ar'">
4960
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4961
- </xsl:if>
4962
-
4963
- <xsl:call-template name="setTableCellAttributes"/>
5201
+ <xsl:call-template name="refine_table-header-cell-style"/>
4964
5202
 
4965
5203
  <fo:block>
4966
5204
  <xsl:apply-templates/>
@@ -4998,28 +5236,11 @@
4998
5236
  <!-- cell in table body, footer -->
4999
5237
  <xsl:template match="*[local-name()='td']" name="td">
5000
5238
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
5001
- <xsl:call-template name="setTextAlignment">
5002
- <xsl:with-param name="default">left</xsl:with-param>
5003
- </xsl:call-template>
5004
-
5005
- <xsl:if test="$lang = 'ar'">
5006
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
5007
- </xsl:if>
5008
-
5009
- <!-- bsi -->
5010
-
5011
- <xsl:if test="ancestor::*[local-name() = 'tfoot']">
5012
- <xsl:attribute name="border">solid black 0</xsl:attribute>
5013
- </xsl:if>
5014
- <xsl:if test="starts-with(ancestor::*[local-name() = 'table'][1]/@type, 'recommend')">
5015
- <xsl:attribute name="display-align">before</xsl:attribute>
5016
- </xsl:if>
5017
- <xsl:if test="ancestor::*[local-name() = 'tbody'] and not(../preceding-sibling::*[local-name() = 'tr']) and ancestor::*[local-name() = 'table'][1]/*[local-name() = 'thead']"> <!-- cells in 1st row in the table body, and if thead exists -->
5018
- <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
5019
- </xsl:if>
5020
- <!-- <xsl:attribute name="page-break-inside">avoid</xsl:attribute> -->
5239
+ <xsl:call-template name="setTextAlignment">
5240
+ <xsl:with-param name="default">left</xsl:with-param>
5241
+ </xsl:call-template>
5021
5242
 
5022
- <xsl:call-template name="setBordersTableArray"/>
5243
+ <xsl:call-template name="refine_table-cell-style"/>
5023
5244
 
5024
5245
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
5025
5246
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -5050,9 +5271,13 @@
5050
5271
 
5051
5272
  <fo:block xsl:use-attribute-sets="table-note-style">
5052
5273
 
5274
+ <xsl:call-template name="refine_table-note-style"/>
5275
+
5053
5276
  <!-- Table's note name (NOTE, for example) -->
5054
5277
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
5055
5278
 
5279
+ <xsl:call-template name="refine_table-note-name-style"/>
5280
+
5056
5281
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5057
5282
 
5058
5283
  </fo:inline>
@@ -5080,6 +5305,14 @@
5080
5305
  <!-- list of footnotes to calculate actual footnotes number -->
5081
5306
  <xsl:variable name="p_fn_">
5082
5307
  <xsl:call-template name="get_fn_list"/>
5308
+ <!-- <xsl:choose>
5309
+ <xsl:when test="$namespace = 'jis'">
5310
+ <xsl:call-template name="get_fn_list_for_element"/>
5311
+ </xsl:when>
5312
+ <xsl:otherwise>
5313
+ <xsl:call-template name="get_fn_list"/>
5314
+ </xsl:otherwise>
5315
+ </xsl:choose> -->
5083
5316
  </xsl:variable>
5084
5317
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5085
5318
 
@@ -5106,7 +5339,14 @@
5106
5339
 
5107
5340
  </xsl:variable>
5108
5341
 
5109
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5342
+ <xsl:variable name="ref_id">
5343
+ <xsl:choose>
5344
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
5345
+ <xsl:otherwise>
5346
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5347
+ </xsl:otherwise>
5348
+ </xsl:choose>
5349
+ </xsl:variable>
5110
5350
  <xsl:variable name="footnote_inline">
5111
5351
  <fo:inline>
5112
5352
 
@@ -5129,9 +5369,13 @@
5129
5369
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
5130
5370
  </xsl:if>
5131
5371
 
5132
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5133
- <xsl:value-of select="$current_fn_number_text"/>
5134
- </fo:basic-link>
5372
+ <xsl:call-template name="insert_basic_link">
5373
+ <xsl:with-param name="element">
5374
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5375
+ <xsl:copy-of select="$current_fn_number_text"/>
5376
+ </fo:basic-link>
5377
+ </xsl:with-param>
5378
+ </xsl:call-template>
5135
5379
  </fo:inline>
5136
5380
  </xsl:variable>
5137
5381
 
@@ -5148,8 +5392,12 @@
5148
5392
 
5149
5393
  <fo:block xsl:use-attribute-sets="fn-body-style">
5150
5394
 
5395
+ <xsl:call-template name="refine_fn-body-style"/>
5396
+
5151
5397
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
5152
5398
 
5399
+ <xsl:call-template name="refine_fn-body-num-style"/>
5400
+
5153
5401
  <xsl:value-of select="$current_fn_number_text"/>
5154
5402
  </fo:inline>
5155
5403
  <xsl:apply-templates/>
@@ -5201,6 +5449,28 @@
5201
5449
  </xsl:choose>
5202
5450
  </xsl:template>
5203
5451
 
5452
+ <xsl:template name="get_fn_list_for_element">
5453
+ <xsl:choose>
5454
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
5455
+ <fn gen_id="{generate-id(.)}">
5456
+ <xsl:copy-of select="@*"/>
5457
+ <xsl:copy-of select="node()"/>
5458
+ </fn>
5459
+ </xsl:when>
5460
+ <xsl:otherwise>
5461
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
5462
+ <xsl:variable name="element_id" select="@id"/>
5463
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5464
+ <!-- copy unique fn -->
5465
+ <fn gen_id="{generate-id(.)}">
5466
+ <xsl:copy-of select="@*"/>
5467
+ <xsl:copy-of select="node()"/>
5468
+ </fn>
5469
+ </xsl:for-each>
5470
+ </xsl:for-each>
5471
+ </xsl:otherwise>
5472
+ </xsl:choose>
5473
+ </xsl:template>
5204
5474
  <!-- ============================ -->
5205
5475
  <!-- table's footnotes rendering -->
5206
5476
  <!-- ============================ -->
@@ -5375,10 +5645,7 @@
5375
5645
  <xsl:template match="*[local-name()='fn']">
5376
5646
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5377
5647
 
5378
- <xsl:if test="ancestor::*[local-name()='table']">
5379
- <xsl:attribute name="font-weight">normal</xsl:attribute>
5380
- <xsl:attribute name="baseline-shift">15%</xsl:attribute>
5381
- </xsl:if>
5648
+ <xsl:call-template name="refine_fn-reference-style"/>
5382
5649
 
5383
5650
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5384
5651
 
@@ -5473,15 +5740,17 @@
5473
5740
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5474
5741
  <xsl:text> </xsl:text>
5475
5742
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5476
- <xsl:text/>
5477
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5743
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5744
+ <xsl:text> </xsl:text>
5745
+ </xsl:if>
5746
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5478
5747
  </fo:block>
5479
5748
 
5480
5749
  </xsl:when> <!-- END: only one component -->
5481
5750
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
5482
5751
  <fo:block margin-bottom="12pt" text-align="left">
5483
5752
 
5484
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5753
+ <xsl:call-template name="refine_dl_formula_where_style"/>
5485
5754
 
5486
5755
  <!-- <xsl:variable name="title-where">
5487
5756
  <xsl:call-template name="getLocalizedString">
@@ -5496,8 +5765,7 @@
5496
5765
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5497
5766
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5498
5767
 
5499
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5500
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5768
+ <xsl:call-template name="refine_figure_key_style"/>
5501
5769
 
5502
5770
  <xsl:variable name="title-key">
5503
5771
  <xsl:call-template name="getLocalizedString">
@@ -5513,10 +5781,7 @@
5513
5781
  <xsl:if test="$onlyOneComponent = 'false'">
5514
5782
  <fo:block>
5515
5783
 
5516
- <xsl:if test="$parent = 'formula'">
5517
- <xsl:attribute name="margin-left">4mm</xsl:attribute>
5518
- </xsl:if>
5519
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
5784
+ <xsl:call-template name="refine_multicomponent_style"/>
5520
5785
 
5521
5786
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5522
5787
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -5524,6 +5789,8 @@
5524
5789
 
5525
5790
  <fo:block>
5526
5791
 
5792
+ <xsl:call-template name="refine_multicomponent_block_style"/>
5793
+
5527
5794
  <xsl:apply-templates select="*[local-name() = 'name']">
5528
5795
  <xsl:with-param name="process">true</xsl:with-param>
5529
5796
  </xsl:apply-templates>
@@ -5685,6 +5952,34 @@
5685
5952
 
5686
5953
  </xsl:template> <!-- END: dl -->
5687
5954
 
5955
+ <xsl:template name="refine_dl_formula_where_style">
5956
+
5957
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5958
+
5959
+ </xsl:template> <!-- refine_dl_formula_where_style -->
5960
+
5961
+ <xsl:template name="refine_figure_key_style">
5962
+
5963
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5964
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5965
+
5966
+ </xsl:template> <!-- refine_figure_key_style -->
5967
+
5968
+ <xsl:template name="refine_multicomponent_style">
5969
+ <xsl:variable name="parent" select="local-name(..)"/>
5970
+
5971
+ <xsl:if test="$parent = 'formula'">
5972
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
5973
+ </xsl:if>
5974
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
5975
+
5976
+ </xsl:template> <!-- refine_multicomponent_style -->
5977
+
5978
+ <xsl:template name="refine_multicomponent_block_style">
5979
+ <xsl:variable name="parent" select="local-name(..)"/>
5980
+
5981
+ </xsl:template> <!-- refine_multicomponent_block_style -->
5982
+
5688
5983
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5689
5984
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5690
5985
 
@@ -5904,6 +6199,8 @@
5904
6199
 
5905
6200
  </xsl:if>
5906
6201
 
6202
+ <xsl:call-template name="refine_dt-cell-style"/>
6203
+
5907
6204
  <fo:block xsl:use-attribute-sets="dt-block-style">
5908
6205
  <xsl:copy-of select="@id"/>
5909
6206
 
@@ -5911,6 +6208,8 @@
5911
6208
  <xsl:attribute name="margin-top">0</xsl:attribute>
5912
6209
  </xsl:if>
5913
6210
 
6211
+ <xsl:call-template name="refine_dt-block-style"/>
6212
+
5914
6213
  <xsl:apply-templates>
5915
6214
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5916
6215
  </xsl:apply-templates>
@@ -5930,6 +6229,8 @@
5930
6229
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5931
6230
  </xsl:if>
5932
6231
 
6232
+ <xsl:call-template name="refine_dd-cell-style"/>
6233
+
5933
6234
  <fo:block>
5934
6235
 
5935
6236
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5975,8 +6276,18 @@
5975
6276
  </xsl:if>
5976
6277
  </xsl:template>
5977
6278
 
5978
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5979
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6279
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
6280
+ <xsl:variable name="is_inline_element_after_where">
6281
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
6282
+ </xsl:variable>
6283
+ <xsl:choose>
6284
+ <xsl:when test="$is_inline_element_after_where = 'true'">
6285
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6286
+ </xsl:when>
6287
+ <xsl:otherwise>
6288
+ <xsl:apply-templates select="."/>
6289
+ </xsl:otherwise>
6290
+ </xsl:choose>
5980
6291
  </xsl:template>
5981
6292
 
5982
6293
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -6070,12 +6381,18 @@
6070
6381
  <xsl:param name="split_keep-within-line"/>
6071
6382
  <fo:inline font-weight="bold">
6072
6383
 
6384
+ <xsl:call-template name="refine_strong_style"/>
6385
+
6073
6386
  <xsl:apply-templates>
6074
6387
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
6075
6388
  </xsl:apply-templates>
6076
6389
  </fo:inline>
6077
6390
  </xsl:template>
6078
6391
 
6392
+ <xsl:template name="refine_strong_style">
6393
+
6394
+ </xsl:template>
6395
+
6079
6396
  <xsl:template match="*[local-name()='padding']">
6080
6397
  <fo:inline padding-right="{@value}"> </fo:inline>
6081
6398
  </xsl:template>
@@ -6613,7 +6930,10 @@
6613
6930
  </xsl:choose>
6614
6931
  </xsl:variable>
6615
6932
 
6616
- <xsl:value-of select="$text9"/>
6933
+ <!-- replace sequence #x200B and space TO space -->
6934
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
6935
+
6936
+ <xsl:value-of select="$text10"/>
6617
6937
  </xsl:template>
6618
6938
 
6619
6939
  <xsl:template name="add-zero-spaces-link-java">
@@ -7288,6 +7608,11 @@
7288
7608
 
7289
7609
  <fo:inline xsl:use-attribute-sets="mathml-style">
7290
7610
 
7611
+ <!-- DEBUG -->
7612
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
7613
+
7614
+ <xsl:call-template name="refine_mathml-style"/>
7615
+
7291
7616
  <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 -->
7292
7617
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
7293
7618
  </xsl:if>
@@ -7392,12 +7717,7 @@
7392
7717
 
7393
7718
  <fo:instream-foreign-object fox:alt-text="Math">
7394
7719
 
7395
- <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
7396
- <xsl:attribute name="width">95%</xsl:attribute>
7397
- <xsl:attribute name="content-height">100%</xsl:attribute>
7398
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7399
- <xsl:attribute name="scaling">uniform</xsl:attribute>
7400
- </xsl:if>
7720
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
7401
7721
 
7402
7722
  <!-- put MathML in Actual Text -->
7403
7723
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
@@ -7419,6 +7739,17 @@
7419
7739
  </fo:instream-foreign-object>
7420
7740
  </xsl:template>
7421
7741
 
7742
+ <xsl:template name="refine_mathml_insteam_object_style">
7743
+
7744
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
7745
+ <xsl:attribute name="width">95%</xsl:attribute>
7746
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7747
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7748
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
7749
+ </xsl:if>
7750
+
7751
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
7752
+
7422
7753
  <xsl:template match="mathml:*" mode="mathml_actual_text">
7423
7754
  <!-- <xsl:text>a+b</xsl:text> -->
7424
7755
  <xsl:text>&lt;</xsl:text>
@@ -7482,6 +7813,79 @@
7482
7813
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7483
7814
  </xsl:template>
7484
7815
 
7816
+ <!-- special case for:
7817
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7818
+ <mstyle displaystyle="true">
7819
+ <msup>
7820
+ <mi color="#00000000">C</mi>
7821
+ <mtext>R</mtext>
7822
+ </msup>
7823
+ <msubsup>
7824
+ <mtext>C</mtext>
7825
+ <mi>n</mi>
7826
+ <mi>k</mi>
7827
+ </msubsup>
7828
+ </mstyle>
7829
+ </math>
7830
+ -->
7831
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7832
+ <xsl:copy>
7833
+ <xsl:copy-of select="@*"/>
7834
+ <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"/>
7835
+ <xsl:if test="string-length($next_mtext) != ''">
7836
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7837
+ </xsl:if>
7838
+ <xsl:apply-templates/>
7839
+ <xsl:value-of select="$next_mtext"/>
7840
+ </xsl:copy>
7841
+ </xsl:template>
7842
+
7843
+ <!-- special case for:
7844
+ <msup>
7845
+ <mtext/>
7846
+ <mn>1</mn>
7847
+ </msup>
7848
+ convert to (add mspace after mtext and enclose them into mrow):
7849
+ <msup>
7850
+ <mrow>
7851
+ <mtext/>
7852
+ <mspace height="1.47ex"/>
7853
+ </mrow>
7854
+ <mn>1</mn>
7855
+ </msup>
7856
+ -->
7857
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7858
+ <mathml:mrow>
7859
+ <xsl:copy-of select="."/>
7860
+ <mathml:mspace height="1.47ex"/>
7861
+ </mathml:mrow>
7862
+ </xsl:template>
7863
+
7864
+ <!-- add space around vertical line -->
7865
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7866
+ <xsl:copy>
7867
+ <xsl:apply-templates select="@*" mode="mathml"/>
7868
+ <xsl:if test="not(@lspace)">
7869
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7870
+ </xsl:if>
7871
+ <xsl:if test="not(@rspace)">
7872
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7873
+ </xsl:if>
7874
+ <xsl:apply-templates mode="mathml"/>
7875
+ </xsl:copy>
7876
+ </xsl:template>
7877
+
7878
+ <!-- decrease fontsize for 'Circled Times' char -->
7879
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7880
+ <xsl:copy>
7881
+ <xsl:apply-templates select="@*" mode="mathml"/>
7882
+ <xsl:if test="not(@fontsize)">
7883
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7884
+ </xsl:if>
7885
+ <xsl:apply-templates mode="mathml"/>
7886
+ </xsl:copy>
7887
+ </xsl:template>
7888
+
7485
7889
  <!-- Examples:
7486
7890
  <stem type="AsciiMath">x = 1</stem>
7487
7891
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7490,6 +7894,8 @@
7490
7894
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
7491
7895
  <fo:inline xsl:use-attribute-sets="mathml-style">
7492
7896
 
7897
+ <xsl:call-template name="refine_mathml-style"/>
7898
+
7493
7899
  <xsl:choose>
7494
7900
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
7495
7901
  <xsl:otherwise>
@@ -7534,24 +7940,30 @@
7534
7940
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7535
7941
  </xsl:if>
7536
7942
 
7943
+ <xsl:call-template name="refine_link-style"/>
7944
+
7537
7945
  <xsl:choose>
7538
7946
  <xsl:when test="$target_text = ''">
7539
7947
  <xsl:apply-templates/>
7540
7948
  </xsl:when>
7541
7949
  <xsl:otherwise>
7542
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7543
- <xsl:choose>
7544
- <xsl:when test="normalize-space(.) = ''">
7545
- <xsl:call-template name="add-zero-spaces-link-java">
7546
- <xsl:with-param name="text" select="$target_text"/>
7547
- </xsl:call-template>
7548
- </xsl:when>
7549
- <xsl:otherwise>
7550
- <!-- output text from <link>text</link> -->
7551
- <xsl:apply-templates/>
7552
- </xsl:otherwise>
7553
- </xsl:choose>
7554
- </fo:basic-link>
7950
+ <xsl:call-template name="insert_basic_link">
7951
+ <xsl:with-param name="element">
7952
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7953
+ <xsl:choose>
7954
+ <xsl:when test="normalize-space(.) = ''">
7955
+ <xsl:call-template name="add-zero-spaces-link-java">
7956
+ <xsl:with-param name="text" select="$target_text"/>
7957
+ </xsl:call-template>
7958
+ </xsl:when>
7959
+ <xsl:otherwise>
7960
+ <!-- output text from <link>text</link> -->
7961
+ <xsl:apply-templates/>
7962
+ </xsl:otherwise>
7963
+ </xsl:choose>
7964
+ </fo:basic-link>
7965
+ </xsl:with-param>
7966
+ </xsl:call-template>
7555
7967
  </xsl:otherwise>
7556
7968
  </xsl:choose>
7557
7969
  </fo:inline>
@@ -7614,12 +8026,19 @@
7614
8026
  </xsl:template>
7615
8027
 
7616
8028
  <xsl:template match="*[local-name() = 'xref']">
7617
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7618
- <xsl:if test="parent::*[local-name() = 'add']">
7619
- <xsl:call-template name="append_add-style"/>
7620
- </xsl:if>
7621
- <xsl:apply-templates/>
7622
- </fo:basic-link>
8029
+ <xsl:call-template name="insert_basic_link">
8030
+ <xsl:with-param name="element">
8031
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8032
+ <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'])">
8033
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8034
+ </xsl:if>
8035
+ <xsl:if test="parent::*[local-name() = 'add']">
8036
+ <xsl:call-template name="append_add-style"/>
8037
+ </xsl:if>
8038
+ <xsl:apply-templates/>
8039
+ </fo:basic-link>
8040
+ </xsl:with-param>
8041
+ </xsl:call-template>
7623
8042
  </xsl:template>
7624
8043
 
7625
8044
  <!-- ====== -->
@@ -7674,6 +8093,8 @@
7674
8093
  <fo:table-cell display-align="center">
7675
8094
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7676
8095
 
8096
+ <xsl:call-template name="refine_formula-stem-block-style"/>
8097
+
7677
8098
  <xsl:apply-templates/>
7678
8099
  </fo:block>
7679
8100
  </fo:table-cell>
@@ -7715,16 +8136,18 @@
7715
8136
 
7716
8137
  <xsl:call-template name="setBlockSpanAll"/>
7717
8138
 
7718
- <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
7719
- <xsl:attribute name="font-size">inherit</xsl:attribute>
7720
- </xsl:if>
8139
+ <xsl:call-template name="refine_note-style"/>
7721
8140
 
7722
8141
  <fo:block-container margin-left="0mm" margin-right="0mm">
7723
8142
 
7724
8143
  <fo:block>
7725
8144
 
8145
+ <xsl:call-template name="refine_note_block_style"/>
8146
+
7726
8147
  <fo:inline xsl:use-attribute-sets="note-name-style">
7727
8148
 
8149
+ <xsl:call-template name="refine_note-name-style"/>
8150
+
7728
8151
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7729
8152
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7730
8153
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7750,6 +8173,10 @@
7750
8173
 
7751
8174
  </xsl:template>
7752
8175
 
8176
+ <xsl:template name="refine_note_block_style">
8177
+
8178
+ </xsl:template>
8179
+
7753
8180
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7754
8181
  <xsl:variable name="num"><xsl:number/></xsl:variable>
7755
8182
  <xsl:choose>
@@ -7771,9 +8198,7 @@
7771
8198
 
7772
8199
  <xsl:call-template name="setBlockSpanAll"/>
7773
8200
 
7774
- <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
7775
- <xsl:attribute name="font-size">inherit</xsl:attribute>
7776
- </xsl:if>
8201
+ <xsl:call-template name="refine_termnote-style"/>
7777
8202
 
7778
8203
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7779
8204
 
@@ -7781,6 +8206,8 @@
7781
8206
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7782
8207
  </xsl:if>
7783
8208
 
8209
+ <xsl:call-template name="refine_termnote-name-style"/>
8210
+
7784
8211
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7785
8212
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7786
8213
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7954,6 +8381,8 @@
7954
8381
  <xsl:otherwise>
7955
8382
  <fo:block xsl:use-attribute-sets="image-style">
7956
8383
 
8384
+ <xsl:call-template name="refine_image-style"/>
8385
+
7957
8386
  <xsl:variable name="src">
7958
8387
  <xsl:call-template name="image_src"/>
7959
8388
  </xsl:variable>
@@ -8012,7 +8441,7 @@
8012
8441
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8013
8442
  </xsl:when>
8014
8443
  <xsl:when test="not(starts-with(@src, 'data:'))">
8015
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8444
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8016
8445
  </xsl:when>
8017
8446
  <xsl:otherwise>
8018
8447
  <xsl:value-of select="@src"/>
@@ -8034,7 +8463,7 @@
8034
8463
  </xsl:when>
8035
8464
  <xsl:when test="not(starts-with(@src, 'data:'))">
8036
8465
  <xsl:variable name="src">
8037
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8466
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8038
8467
  </xsl:variable>
8039
8468
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8040
8469
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8420,15 +8849,19 @@
8420
8849
  <xsl:param name="dest"/>
8421
8850
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8422
8851
  <fo:block font-size="1pt">
8423
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8424
- <fo:inline-container inline-progression-dimension="100%">
8425
- <fo:block-container height="{$height - 1}px" width="100%">
8426
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8427
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8428
- </xsl:if> -->
8429
- <fo:block> </fo:block></fo:block-container>
8430
- </fo:inline-container>
8431
- </fo:basic-link>
8852
+ <xsl:call-template name="insert_basic_link">
8853
+ <xsl:with-param name="element">
8854
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8855
+ <fo:inline-container inline-progression-dimension="100%">
8856
+ <fo:block-container height="{$height - 1}px" width="100%">
8857
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8858
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8859
+ </xsl:if> -->
8860
+ <fo:block> </fo:block></fo:block-container>
8861
+ </fo:inline-container>
8862
+ </fo:basic-link>
8863
+ </xsl:with-param>
8864
+ </xsl:call-template>
8432
8865
  </fo:block>
8433
8866
  </fo:block-container>
8434
8867
  </xsl:template>
@@ -8799,6 +9232,8 @@
8799
9232
  <xsl:if test="normalize-space() != ''">
8800
9233
  <fo:block xsl:use-attribute-sets="figure-name-style">
8801
9234
 
9235
+ <xsl:call-template name="refine_figure-name-style"/>
9236
+
8802
9237
  <xsl:apply-templates/>
8803
9238
  </fo:block>
8804
9239
  </xsl:if>
@@ -9062,6 +9497,8 @@
9062
9497
  </xsl:attribute>
9063
9498
  </xsl:for-each>
9064
9499
 
9500
+ <xsl:call-template name="refine_sourcecode-style"/>
9501
+
9065
9502
  <!-- remove margin between rows in the table with sourcecode line numbers -->
9066
9503
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
9067
9504
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9768,6 +10205,8 @@
9768
10205
 
9769
10206
  <xsl:call-template name="setBlockSpanAll"/>
9770
10207
 
10208
+ <xsl:call-template name="refine_example-style"/>
10209
+
9771
10210
  <xsl:variable name="fo_element">
9772
10211
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
9773
10212
  inline
@@ -9900,6 +10339,8 @@
9900
10339
  </xsl:if>
9901
10340
  <fo:block xsl:use-attribute-sets="example-p-style">
9902
10341
 
10342
+ <xsl:call-template name="refine_example-p-style"/>
10343
+
9903
10344
  <xsl:apply-templates/>
9904
10345
  </fo:block>
9905
10346
  </fo:block-container>
@@ -9916,6 +10357,7 @@
9916
10357
  </xsl:otherwise>
9917
10358
  </xsl:choose>
9918
10359
  </xsl:template> <!-- example/p -->
10360
+
9919
10361
  <!-- ====== -->
9920
10362
  <!-- ====== -->
9921
10363
 
@@ -9927,6 +10369,8 @@
9927
10369
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
9928
10370
  <fo:block xsl:use-attribute-sets="termsource-style">
9929
10371
 
10372
+ <xsl:call-template name="refine_termsource-style"/>
10373
+
9930
10374
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
9931
10375
  <xsl:variable name="termsource_text">
9932
10376
  <xsl:apply-templates/>
@@ -9979,14 +10423,18 @@
9979
10423
  </xsl:template>
9980
10424
 
9981
10425
  <xsl:template match="*[local-name() = 'origin']">
9982
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9983
- <xsl:if test="normalize-space(@citeas) = ''">
9984
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9985
- </xsl:if>
9986
- <fo:inline xsl:use-attribute-sets="origin-style">
9987
- <xsl:apply-templates/>
9988
- </fo:inline>
9989
- </fo:basic-link>
10426
+ <xsl:call-template name="insert_basic_link">
10427
+ <xsl:with-param name="element">
10428
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10429
+ <xsl:if test="normalize-space(@citeas) = ''">
10430
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10431
+ </xsl:if>
10432
+ <fo:inline xsl:use-attribute-sets="origin-style">
10433
+ <xsl:apply-templates/>
10434
+ </fo:inline>
10435
+ </fo:basic-link>
10436
+ </xsl:with-param>
10437
+ </xsl:call-template>
9990
10438
  </xsl:template>
9991
10439
 
9992
10440
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -10038,10 +10486,7 @@
10038
10486
  <fo:block-container margin-left="0mm">
10039
10487
  <fo:block-container xsl:use-attribute-sets="quote-style">
10040
10488
 
10041
- <xsl:if test="$doctype = 'amendment' and (*[local-name() = 'note'] or *[local-name() = 'termnote'])">
10042
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
10043
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
10044
- </xsl:if>
10489
+ <xsl:call-template name="refine_quote-style"/>
10045
10490
 
10046
10491
  <fo:block-container margin-left="0mm" margin-right="0mm">
10047
10492
  <fo:block role="BlockQuote">
@@ -10065,9 +10510,13 @@
10065
10510
  <xsl:if test="../*[local-name() = 'author']">
10066
10511
  <xsl:text>, </xsl:text>
10067
10512
  </xsl:if>
10068
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10069
- <xsl:apply-templates/>
10070
- </fo:basic-link>
10513
+ <xsl:call-template name="insert_basic_link">
10514
+ <xsl:with-param name="element">
10515
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10516
+ <xsl:apply-templates/>
10517
+ </fo:basic-link>
10518
+ </xsl:with-param>
10519
+ </xsl:call-template>
10071
10520
  </xsl:template>
10072
10521
 
10073
10522
  <xsl:template match="*[local-name() = 'author']">
@@ -10113,28 +10562,33 @@
10113
10562
 
10114
10563
  </xsl:if>
10115
10564
 
10116
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
10117
- <xsl:variable name="text" select="normalize-space()"/>
10565
+ <xsl:call-template name="refine_eref-style"/>
10118
10566
 
10119
- <fo:basic-link fox:alt-text="{@citeas}">
10120
- <xsl:if test="normalize-space(@citeas) = ''">
10121
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10122
- </xsl:if>
10123
- <xsl:if test="@type = 'inline'">
10567
+ <xsl:call-template name="insert_basic_link">
10568
+ <xsl:with-param name="element">
10569
+ <fo:basic-link fox:alt-text="{@citeas}">
10570
+ <xsl:if test="normalize-space(@citeas) = ''">
10571
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10572
+ </xsl:if>
10573
+ <xsl:if test="@type = 'inline'">
10124
10574
 
10125
- </xsl:if>
10575
+ <xsl:call-template name="refine_basic_link_style"/>
10126
10576
 
10127
- <xsl:choose>
10128
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10129
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10130
- </xsl:when>
10131
- <xsl:otherwise>
10132
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10133
- </xsl:otherwise>
10134
- </xsl:choose>
10577
+ </xsl:if>
10135
10578
 
10136
- <xsl:apply-templates/>
10137
- </fo:basic-link>
10579
+ <xsl:choose>
10580
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10581
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10582
+ </xsl:when>
10583
+ <xsl:otherwise>
10584
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10585
+ </xsl:otherwise>
10586
+ </xsl:choose>
10587
+
10588
+ <xsl:apply-templates/>
10589
+ </fo:basic-link>
10590
+ </xsl:with-param>
10591
+ </xsl:call-template>
10138
10592
 
10139
10593
  </fo:inline>
10140
10594
  </xsl:when>
@@ -10152,6 +10606,11 @@
10152
10606
  </xsl:otherwise>
10153
10607
  </xsl:choose>
10154
10608
  </xsl:template>
10609
+
10610
+ <xsl:template name="refine_basic_link_style">
10611
+
10612
+ </xsl:template> <!-- refine_basic_link_style -->
10613
+
10155
10614
  <!-- ====== -->
10156
10615
  <!-- END eref -->
10157
10616
  <!-- ====== -->
@@ -10294,16 +10753,22 @@
10294
10753
  <fo:block>
10295
10754
  <xsl:call-template name="setId"/>
10296
10755
 
10297
- <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable>
10298
- <xsl:if test="$pos &gt;= 2">
10299
- <xsl:attribute name="space-before">18pt</xsl:attribute>
10300
- </xsl:if>
10756
+ <xsl:call-template name="sections_element_style"/>
10301
10757
 
10302
10758
  <xsl:apply-templates/>
10303
10759
  </fo:block>
10304
10760
 
10305
10761
  </xsl:template>
10306
10762
 
10763
+ <xsl:template name="sections_element_style">
10764
+
10765
+ <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable>
10766
+ <xsl:if test="$pos &gt;= 2">
10767
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
10768
+ </xsl:if>
10769
+
10770
+ </xsl:template> <!-- sections_element_style -->
10771
+
10307
10772
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10308
10773
  <fo:block break-after="page"/>
10309
10774
  <fo:block>
@@ -10318,10 +10783,16 @@
10318
10783
 
10319
10784
  <xsl:call-template name="setBlockSpanAll"/>
10320
10785
 
10786
+ <xsl:call-template name="refine_clause_style"/>
10787
+
10321
10788
  <xsl:apply-templates/>
10322
10789
  </fo:block>
10323
10790
  </xsl:template>
10324
10791
 
10792
+ <xsl:template name="refine_clause_style">
10793
+
10794
+ </xsl:template> <!-- refine_clause_style -->
10795
+
10325
10796
  <xsl:template match="*[local-name() = 'definitions']">
10326
10797
  <fo:block id="{@id}">
10327
10798
  <xsl:apply-templates/>
@@ -10334,10 +10805,16 @@
10334
10805
 
10335
10806
  <xsl:call-template name="setBlockSpanAll"/>
10336
10807
 
10808
+ <xsl:call-template name="refine_annex_style"/>
10809
+
10337
10810
  </fo:block>
10338
10811
  <xsl:apply-templates/>
10339
10812
  </xsl:template>
10340
10813
 
10814
+ <xsl:template name="refine_annex_style">
10815
+
10816
+ </xsl:template>
10817
+
10341
10818
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10342
10819
  <!-- comment 2019-11-29 -->
10343
10820
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -10374,7 +10851,10 @@
10374
10851
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10375
10852
 
10376
10853
  <xsl:template name="setULLabel">
10377
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10854
+ <xsl:variable name="list_level__">
10855
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10856
+ </xsl:variable>
10857
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10378
10858
  <xsl:variable name="list_level">
10379
10859
  <xsl:choose>
10380
10860
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10499,6 +10979,8 @@
10499
10979
  </xsl:choose>
10500
10980
  </xsl:attribute>
10501
10981
 
10982
+ <xsl:call-template name="refine_list_container_style"/>
10983
+
10502
10984
  <fo:block-container margin-left="0mm">
10503
10985
  <fo:block>
10504
10986
  <xsl:apply-templates select="." mode="list"/>
@@ -10507,13 +10989,19 @@
10507
10989
  </fo:block-container>
10508
10990
  </xsl:when>
10509
10991
  <xsl:otherwise>
10510
- <fo:block>
10511
- <xsl:apply-templates select="." mode="list"/>
10512
- </fo:block>
10992
+
10993
+ <fo:block>
10994
+ <xsl:apply-templates select="." mode="list"/>
10995
+ </fo:block>
10996
+
10513
10997
  </xsl:otherwise>
10514
10998
  </xsl:choose>
10515
10999
  </xsl:template>
10516
11000
 
11001
+ <xsl:template name="refine_list_container_style">
11002
+
11003
+ </xsl:template> <!-- refine_list_container_style -->
11004
+
10517
11005
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
10518
11006
 
10519
11007
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -10524,7 +11012,7 @@
10524
11012
 
10525
11013
  <xsl:variable name="provisional_distance_between_starts_">
10526
11014
  <attributes xsl:use-attribute-sets="list-style">
10527
-
11015
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
10528
11016
  </attributes>
10529
11017
  </xsl:variable>
10530
11018
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -10560,9 +11048,7 @@
10560
11048
  <addon><xsl:value-of select="$addon"/></addon> -->
10561
11049
  </xsl:if>
10562
11050
 
10563
- <xsl:if test="not(ancestor::*[local-name() = 'ul' or local-name() = 'ol'])">
10564
- <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
10565
- </xsl:if>
11051
+ <xsl:call-template name="refine_list-style"/>
10566
11052
 
10567
11053
  <xsl:if test="*[local-name() = 'name']">
10568
11054
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -10576,6 +11062,10 @@
10576
11062
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
10577
11063
  </xsl:template>
10578
11064
 
11065
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
11066
+
11067
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
11068
+
10579
11069
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
10580
11070
  <xsl:param name="process">false</xsl:param>
10581
11071
  <xsl:if test="$process = 'true'">
@@ -10589,20 +11079,27 @@
10589
11079
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10590
11080
  <xsl:copy-of select="@id"/>
10591
11081
 
11082
+ <xsl:call-template name="refine_list-item-style"/>
11083
+
10592
11084
  <fo:list-item-label end-indent="label-end()">
10593
11085
  <fo:block xsl:use-attribute-sets="list-item-label-style">
10594
11086
 
11087
+ <xsl:call-template name="refine_list-item-label-style"/>
11088
+
10595
11089
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10596
11090
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10597
11091
  <xsl:call-template name="append_add-style"/>
10598
11092
  </xsl:if>
10599
11093
 
10600
11094
  <xsl:call-template name="getListItemFormat"/>
11095
+
10601
11096
  </fo:block>
10602
11097
  </fo:list-item-label>
10603
11098
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
10604
11099
  <fo:block>
10605
11100
 
11101
+ <xsl:call-template name="refine_list-item-body-style"/>
11102
+
10606
11103
  <xsl:apply-templates/>
10607
11104
 
10608
11105
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -10920,6 +11417,7 @@
10920
11417
 
10921
11418
  <fo:block id="{@id}">
10922
11419
  <xsl:apply-templates/>
11420
+
10923
11421
  </fo:block>
10924
11422
  </xsl:template>
10925
11423
 
@@ -10939,6 +11437,7 @@
10939
11437
 
10940
11438
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
10941
11439
  <xsl:apply-templates/>
11440
+
10942
11441
  </fo:block>
10943
11442
 
10944
11443
  </xsl:template> <!-- references -->
@@ -11197,24 +11696,32 @@
11197
11696
  <xsl:for-each select="*[local-name() = 'tab']">
11198
11697
  <xsl:variable name="current_id" select="generate-id()"/>
11199
11698
  <fo:table-cell>
11200
- <fo:block>
11201
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11202
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11203
- <xsl:choose>
11204
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11205
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11206
- </xsl:choose>
11207
- </xsl:for-each>
11208
- </fo:basic-link>
11699
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11700
+ <xsl:call-template name="insert_basic_link">
11701
+ <xsl:with-param name="element">
11702
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11703
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11704
+ <xsl:choose>
11705
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11706
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11707
+ </xsl:choose>
11708
+ </xsl:for-each>
11709
+ </fo:basic-link>
11710
+ </xsl:with-param>
11711
+ </xsl:call-template>
11209
11712
  </fo:block>
11210
11713
  </fo:table-cell>
11211
11714
  </xsl:for-each>
11212
11715
  <!-- last column - for page numbers -->
11213
11716
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
11214
11717
  <fo:block>
11215
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11216
- <fo:page-number-citation ref-id="{$target}"/>
11217
- </fo:basic-link>
11718
+ <xsl:call-template name="insert_basic_link">
11719
+ <xsl:with-param name="element">
11720
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11721
+ <fo:page-number-citation ref-id="{$target}"/>
11722
+ </fo:basic-link>
11723
+ </xsl:with-param>
11724
+ </xsl:call-template>
11218
11725
  </fo:block>
11219
11726
  </fo:table-cell>
11220
11727
  </xsl:template>
@@ -11256,6 +11763,27 @@
11256
11763
  <!-- End Table of Contents (ToC) processing -->
11257
11764
  <!-- =================== -->
11258
11765
 
11766
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11767
+ <xsl:template name="insert_basic_link">
11768
+ <xsl:param name="element"/>
11769
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11770
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11771
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11772
+ <xsl:choose>
11773
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11774
+ <xsl:copy-of select="$element_node"/>
11775
+ </xsl:when>
11776
+ <xsl:otherwise>
11777
+ <fo:inline>
11778
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11779
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11780
+ </xsl:for-each>
11781
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11782
+ </fo:inline>
11783
+ </xsl:otherwise>
11784
+ </xsl:choose>
11785
+ </xsl:template>
11786
+
11259
11787
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
11260
11788
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
11261
11789
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -11491,6 +12019,9 @@
11491
12019
  </xsl:copy>
11492
12020
  </xsl:template>
11493
12021
 
12022
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
12023
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
12024
+
11494
12025
  <xsl:template name="add_id">
11495
12026
  <xsl:if test="not(@id)">
11496
12027
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -11887,6 +12418,14 @@
11887
12418
  <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">
11888
12419
  <xsl:variable name="p_fn_">
11889
12420
  <xsl:call-template name="get_fn_list"/>
12421
+ <!-- <xsl:choose>
12422
+ <xsl:when test="$namespace = 'jis'">
12423
+ <xsl:call-template name="get_fn_list_for_element"/>
12424
+ </xsl:when>
12425
+ <xsl:otherwise>
12426
+ <xsl:call-template name="get_fn_list"/>
12427
+ </xsl:otherwise>
12428
+ </xsl:choose> -->
11890
12429
  </xsl:variable>
11891
12430
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11892
12431
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -11901,8 +12440,14 @@
11901
12440
  <xsl:attribute name="current_fn_number">
11902
12441
  <xsl:value-of select="$current_fn_number"/>
11903
12442
  </xsl:attribute>
12443
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11904
12444
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
11905
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
12445
+
12446
+ <xsl:value-of select="$skip_footnote_body_"/>
12447
+
12448
+ </xsl:attribute>
12449
+ <xsl:attribute name="ref_id">
12450
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
11906
12451
  </xsl:attribute>
11907
12452
  <xsl:apply-templates select="node()" mode="linear_xml"/>
11908
12453
  </xsl:copy>