metanorma-itu 2.2.9 → 2.2.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -974,7 +974,7 @@
974
974
 
975
975
  <fo:flow flow-name="xsl-region-body">
976
976
 
977
- <xsl:if test="/itu:itu-standard/itu:preface/* or /itu:itu-standard/itu:bibdata/itu:keyword">
977
+ <xsl:if test="/itu:itu-standard/itu:preface/*[not(@type = 'toc')] or /itu:itu-standard/itu:bibdata/itu:keyword">
978
978
  <fo:block-container font-size="14pt" font-weight="bold">
979
979
  <xsl:choose>
980
980
  <xsl:when test="$doctype = 'implementers-guide'"/>
@@ -1038,111 +1038,9 @@
1038
1038
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1039
1039
  </xsl:if>
1040
1040
 
1041
- <xsl:if test="$contents//item[@display = 'true'] and $doctype != 'resolution' and $doctype != 'service-publication'">
1042
- <fo:block break-after="page"/>
1043
- <fo:block-container>
1044
- <fo:block role="TOC">
1045
- <fo:block margin-top="6pt" text-align="center" font-weight="bold" role="H1">
1046
- <xsl:call-template name="getLocalizedString">
1047
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1048
- </xsl:call-template>
1049
- </fo:block>
1050
- <fo:block margin-top="6pt" text-align="end" font-weight="bold">
1051
- <xsl:call-template name="getLocalizedString">
1052
- <xsl:with-param name="key">Page.sg</xsl:with-param>
1053
- </xsl:call-template>
1054
- </fo:block>
1055
-
1056
- <xsl:for-each select="$contents//item[@display = 'true']">
1057
- <fo:block role="TOCI">
1058
- <xsl:if test="@level = 1">
1059
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
1060
- </xsl:if>
1061
- <xsl:if test="@level &gt;= 2">
1062
- <xsl:attribute name="margin-top">4pt</xsl:attribute>
1063
- <!-- <xsl:attribute name="margin-left">12mm</xsl:attribute> -->
1064
- </xsl:if>
1065
- <fo:list-block provisional-label-separation="3mm">
1066
- <xsl:attribute name="provisional-distance-between-starts">
1067
- <xsl:choose>
1068
- <xsl:when test="@section != ''">
1069
- <xsl:if test="@level = 1">
1070
- <xsl:choose>
1071
- <xsl:when test="string-length(@section) &gt; 10">27mm</xsl:when>
1072
- <xsl:when test="string-length(@section) &gt; 5">22mm</xsl:when>
1073
- <!-- <xsl:when test="@type = 'annex'">20mm</xsl:when> -->
1074
- <xsl:otherwise>12mm</xsl:otherwise>
1075
- </xsl:choose>
1076
- </xsl:if>
1077
- <xsl:if test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 26"/>mm</xsl:if>
1078
- </xsl:when> <!-- -->
1079
- <xsl:otherwise>0mm</xsl:otherwise>
1080
- </xsl:choose>
1081
- </xsl:attribute>
1082
- <fo:list-item>
1083
- <fo:list-item-label end-indent="label-end()">
1084
- <xsl:if test="@level &gt;= 2">
1085
- <xsl:attribute name="start-indent"><xsl:value-of select="(@level - 1) * 12"/>mm</xsl:attribute>
1086
- </xsl:if>
1087
- <fo:block>
1088
- <xsl:if test="@section">
1089
- <xsl:value-of select="@section"/>
1090
- </xsl:if>
1091
- </fo:block>
1092
- </fo:list-item-label>
1093
- <fo:list-item-body start-indent="body-start()">
1094
- <fo:block text-align-last="justify">
1095
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1096
- <xsl:apply-templates select="title"/>
1097
- <fo:inline keep-together.within-line="always">
1098
- <fo:leader leader-pattern="dots"/>
1099
- <fo:page-number-citation ref-id="{@id}"/>
1100
- </fo:inline>
1101
- </fo:basic-link>
1102
- </fo:block>
1103
- </fo:list-item-body>
1104
- </fo:list-item>
1105
- </fo:list-block>
1106
- </fo:block>
1107
- </xsl:for-each>
1108
-
1109
- <!-- List of Tables -->
1110
- <xsl:if test="$contents//tables/table">
1111
- <xsl:call-template name="insertListOf_Title">
1112
- <xsl:with-param name="title" select="$title-list-tables"/>
1113
- </xsl:call-template>
1114
- <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1115
- <xsl:call-template name="getLocalizedString">
1116
- <xsl:with-param name="key">Page.sg</xsl:with-param>
1117
- </xsl:call-template>
1118
- </fo:block>
1119
- <fo:block-container>
1120
- <xsl:for-each select="$contents//tables/table">
1121
- <xsl:call-template name="insertListOf_Item"/>
1122
- </xsl:for-each>
1123
- </fo:block-container>
1124
- </xsl:if>
1125
-
1126
- <!-- List of Figures -->
1127
- <xsl:if test="$contents//figures/figure">
1128
- <xsl:call-template name="insertListOf_Title">
1129
- <xsl:with-param name="title" select="$title-list-figures"/>
1130
- </xsl:call-template>
1131
- <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1132
- <xsl:call-template name="getLocalizedString">
1133
- <xsl:with-param name="key">Page.sg</xsl:with-param>
1134
- </xsl:call-template>
1135
- </fo:block>
1136
- <fo:block-container>
1137
- <xsl:for-each select="$contents//figures/figure">
1138
- <xsl:call-template name="insertListOf_Item"/>
1139
- </xsl:for-each>
1140
- </fo:block-container>
1141
- </xsl:if>
1142
-
1143
- </fo:block>
1144
- </fo:block-container>
1145
- </xsl:if>
1041
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']">
1042
+ <xsl:with-param name="process">true</xsl:with-param>
1043
+ </xsl:apply-templates>
1146
1044
 
1147
1045
  </fo:flow>
1148
1046
  </fo:page-sequence>
@@ -1258,6 +1156,127 @@
1258
1156
  </fo:block>
1259
1157
  </xsl:template>
1260
1158
 
1159
+ <xsl:template match="itu:preface/itu:clause[@type = 'toc']" priority="4">
1160
+ <xsl:param name="process">false</xsl:param>
1161
+
1162
+ <xsl:if test="$process = 'true'">
1163
+ <xsl:if test="$doctype != 'resolution' and $doctype != 'service-publication'">
1164
+ <fo:block break-after="page"/>
1165
+ <fo:block-container>
1166
+ <fo:block role="TOC">
1167
+
1168
+ <xsl:apply-templates/>
1169
+
1170
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1171
+
1172
+ <xsl:for-each select="$contents//item[@display = 'true']">
1173
+ <fo:block role="TOCI">
1174
+ <xsl:if test="@level = 1">
1175
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1176
+ </xsl:if>
1177
+ <xsl:if test="@level &gt;= 2">
1178
+ <xsl:attribute name="margin-top">4pt</xsl:attribute>
1179
+ <!-- <xsl:attribute name="margin-left">12mm</xsl:attribute> -->
1180
+ </xsl:if>
1181
+ <fo:list-block provisional-label-separation="3mm">
1182
+ <xsl:attribute name="provisional-distance-between-starts">
1183
+ <xsl:choose>
1184
+ <xsl:when test="@section != ''">
1185
+ <xsl:if test="@level = 1">
1186
+ <xsl:choose>
1187
+ <xsl:when test="string-length(@section) &gt; 10">27mm</xsl:when>
1188
+ <xsl:when test="string-length(@section) &gt; 5">22mm</xsl:when>
1189
+ <!-- <xsl:when test="@type = 'annex'">20mm</xsl:when> -->
1190
+ <xsl:otherwise>12mm</xsl:otherwise>
1191
+ </xsl:choose>
1192
+ </xsl:if>
1193
+ <xsl:if test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 26"/>mm</xsl:if>
1194
+ </xsl:when> <!-- -->
1195
+ <xsl:otherwise>0mm</xsl:otherwise>
1196
+ </xsl:choose>
1197
+ </xsl:attribute>
1198
+ <fo:list-item>
1199
+ <fo:list-item-label end-indent="label-end()">
1200
+ <xsl:if test="@level &gt;= 2">
1201
+ <xsl:attribute name="start-indent"><xsl:value-of select="(@level - 1) * 12"/>mm</xsl:attribute>
1202
+ </xsl:if>
1203
+ <fo:block>
1204
+ <xsl:if test="@section">
1205
+ <xsl:value-of select="@section"/>
1206
+ </xsl:if>
1207
+ </fo:block>
1208
+ </fo:list-item-label>
1209
+ <fo:list-item-body start-indent="body-start()">
1210
+ <fo:block text-align-last="justify">
1211
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1212
+ <xsl:apply-templates select="title"/>
1213
+ <fo:inline keep-together.within-line="always">
1214
+ <fo:leader leader-pattern="dots"/>
1215
+ <fo:page-number-citation ref-id="{@id}"/>
1216
+ </fo:inline>
1217
+ </fo:basic-link>
1218
+ </fo:block>
1219
+ </fo:list-item-body>
1220
+ </fo:list-item>
1221
+ </fo:list-block>
1222
+ </fo:block>
1223
+ </xsl:for-each>
1224
+
1225
+ <!-- List of Tables -->
1226
+ <xsl:if test="$contents//tables/table">
1227
+ <xsl:call-template name="insertListOf_Title">
1228
+ <xsl:with-param name="title" select="$title-list-tables"/>
1229
+ </xsl:call-template>
1230
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1231
+ <xsl:call-template name="getLocalizedString">
1232
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
1233
+ </xsl:call-template>
1234
+ </fo:block>
1235
+ <fo:block-container>
1236
+ <xsl:for-each select="$contents//tables/table">
1237
+ <xsl:call-template name="insertListOf_Item"/>
1238
+ </xsl:for-each>
1239
+ </fo:block-container>
1240
+ </xsl:if>
1241
+
1242
+ <!-- List of Figures -->
1243
+ <xsl:if test="$contents//figures/figure">
1244
+ <xsl:call-template name="insertListOf_Title">
1245
+ <xsl:with-param name="title" select="$title-list-figures"/>
1246
+ </xsl:call-template>
1247
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
1248
+ <xsl:call-template name="getLocalizedString">
1249
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
1250
+ </xsl:call-template>
1251
+ </fo:block>
1252
+ <fo:block-container>
1253
+ <xsl:for-each select="$contents//figures/figure">
1254
+ <xsl:call-template name="insertListOf_Item"/>
1255
+ </xsl:for-each>
1256
+ </fo:block-container>
1257
+ </xsl:if>
1258
+
1259
+ </xsl:if>
1260
+ </fo:block>
1261
+ </fo:block-container>
1262
+ </xsl:if>
1263
+ </xsl:if>
1264
+ </xsl:template>
1265
+
1266
+ <xsl:template match="itu:preface/itu:clause[@type = 'toc']/itu:title" priority="4">
1267
+ <fo:block margin-top="6pt" text-align="center" font-weight="bold" role="H1">
1268
+ <!-- <xsl:call-template name="getLocalizedString">
1269
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1270
+ </xsl:call-template> -->
1271
+ <xsl:apply-templates/>
1272
+ </fo:block>
1273
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold">
1274
+ <xsl:call-template name="getLocalizedString">
1275
+ <xsl:with-param name="key">Page.sg</xsl:with-param>
1276
+ </xsl:call-template>
1277
+ </fo:block>
1278
+ </xsl:template>
1279
+
1261
1280
  <xsl:template match="node()">
1262
1281
  <xsl:apply-templates/>
1263
1282
  </xsl:template>
@@ -1295,6 +1314,7 @@
1295
1314
 
1296
1315
  <xsl:variable name="skip">
1297
1316
  <xsl:choose>
1317
+ <xsl:when test="@type = 'toc'">true</xsl:when>
1298
1318
  <xsl:when test="ancestor-or-self::itu:bibitem">true</xsl:when>
1299
1319
  <xsl:when test="ancestor-or-self::itu:term">true</xsl:when>
1300
1320
  <xsl:when test="@inline-header = 'true' and not(*[local-name() = 'title']/*[local-name() = 'tab'])">true</xsl:when>
@@ -1644,19 +1664,23 @@
1644
1664
  <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/>
1645
1665
  <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/>
1646
1666
 
1647
- <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1648
- <xsl:choose>
1649
- <xsl:when test="$origin_text != ''">
1650
- <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1651
- </xsl:when>
1652
- <xsl:when test="contains($citeas, '[')">
1653
- <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1654
- </xsl:when>
1655
- <xsl:otherwise>
1656
- <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1657
- </xsl:otherwise>
1658
- </xsl:choose>
1659
- </fo:basic-link>
1667
+ <xsl:call-template name="insert_basic_link">
1668
+ <xsl:with-param name="element">
1669
+ <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1670
+ <xsl:choose>
1671
+ <xsl:when test="$origin_text != ''">
1672
+ <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1673
+ </xsl:when>
1674
+ <xsl:when test="contains($citeas, '[')">
1675
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1676
+ </xsl:when>
1677
+ <xsl:otherwise>
1678
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1679
+ </xsl:otherwise>
1680
+ </xsl:choose>
1681
+ </fo:basic-link>
1682
+ </xsl:with-param>
1683
+ </xsl:call-template>
1660
1684
  </xsl:if>
1661
1685
  <xsl:if test="following-sibling::itu:definition/node()">
1662
1686
  <xsl:text>: </xsl:text>
@@ -2509,6 +2533,10 @@
2509
2533
 
2510
2534
  </xsl:attribute-set>
2511
2535
 
2536
+ <xsl:template name="refine_link-style">
2537
+
2538
+ </xsl:template> <!-- refine_link-style -->
2539
+
2512
2540
  <xsl:attribute-set name="sourcecode-container-style">
2513
2541
 
2514
2542
  </xsl:attribute-set>
@@ -2524,6 +2552,10 @@
2524
2552
 
2525
2553
  </xsl:attribute-set>
2526
2554
 
2555
+ <xsl:template name="refine_sourcecode-style">
2556
+
2557
+ </xsl:template> <!-- refine_sourcecode-style -->
2558
+
2527
2559
  <xsl:attribute-set name="pre-style">
2528
2560
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2529
2561
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2604,6 +2636,10 @@
2604
2636
 
2605
2637
  </xsl:attribute-set> <!-- example-style -->
2606
2638
 
2639
+ <xsl:template name="refine_example-style">
2640
+
2641
+ </xsl:template> <!-- refine_example-style -->
2642
+
2607
2643
  <xsl:attribute-set name="example-body-style">
2608
2644
 
2609
2645
  </xsl:attribute-set> <!-- example-body-style -->
@@ -2623,6 +2659,10 @@
2623
2659
 
2624
2660
  </xsl:attribute-set> <!-- example-p-style -->
2625
2661
 
2662
+ <xsl:template name="refine_example-p-style">
2663
+
2664
+ </xsl:template> <!-- refine_example-p-style -->
2665
+
2626
2666
  <xsl:attribute-set name="termexample-name-style">
2627
2667
 
2628
2668
  </xsl:attribute-set> <!-- termexample-name-style -->
@@ -2649,12 +2689,33 @@
2649
2689
 
2650
2690
  </xsl:attribute-set> <!-- table-container-style -->
2651
2691
 
2692
+ <xsl:template name="refine_table-container-style">
2693
+ <xsl:param name="margin-side"/>
2694
+
2695
+ <xsl:if test="$doctype = 'service-publication' and $lang != 'ar'">
2696
+ <xsl:attribute name="font-family">Calibri</xsl:attribute>
2697
+ </xsl:if>
2698
+
2699
+ <!-- end table block-container attributes -->
2700
+ </xsl:template> <!-- refine_table-container-style -->
2701
+
2652
2702
  <xsl:attribute-set name="table-style">
2653
2703
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2654
2704
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
2655
2705
 
2656
2706
  </xsl:attribute-set><!-- table-style -->
2657
2707
 
2708
+ <xsl:template name="refine_table-style">
2709
+ <xsl:param name="margin-side"/>
2710
+
2711
+ <xsl:call-template name="setBordersTableArray"/>
2712
+
2713
+ <xsl:if test="$doctype = 'service-publication'">
2714
+ <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
2715
+ </xsl:if>
2716
+
2717
+ </xsl:template> <!-- refine_table-style -->
2718
+
2658
2719
  <xsl:attribute-set name="table-name-style">
2659
2720
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2660
2721
 
@@ -2664,6 +2725,11 @@
2664
2725
 
2665
2726
  </xsl:attribute-set> <!-- table-name-style -->
2666
2727
 
2728
+ <xsl:template name="refine_table-name-style">
2729
+ <xsl:param name="continued"/>
2730
+
2731
+ </xsl:template> <!-- refine_table-name-style -->
2732
+
2667
2733
  <xsl:attribute-set name="table-row-style">
2668
2734
  <xsl:attribute name="min-height">4mm</xsl:attribute>
2669
2735
 
@@ -2674,14 +2740,34 @@
2674
2740
 
2675
2741
  </xsl:attribute-set>
2676
2742
 
2743
+ <xsl:template name="refine_table-header-row-style">
2744
+
2745
+ <xsl:call-template name="setBordersTableArray"/>
2746
+
2747
+ <xsl:if test="$doctype = 'service-publication'">
2748
+ <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute>
2749
+ </xsl:if>
2750
+
2751
+ </xsl:template> <!-- refine_table-header-row-style -->
2752
+
2677
2753
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
2678
2754
 
2679
2755
  </xsl:attribute-set>
2680
2756
 
2757
+ <xsl:template name="refine_table-footer-row-style">
2758
+
2759
+ </xsl:template> <!-- refine_table-footer-row-style -->
2760
+
2681
2761
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
2682
2762
 
2683
2763
  </xsl:attribute-set>
2684
2764
 
2765
+ <xsl:template name="refine_table-body-row-style">
2766
+
2767
+ <xsl:call-template name="setBordersTableArray"/>
2768
+
2769
+ </xsl:template> <!-- refine_table-body-row-style -->
2770
+
2685
2771
  <xsl:attribute-set name="table-header-cell-style">
2686
2772
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2687
2773
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2690,6 +2776,29 @@
2690
2776
 
2691
2777
  </xsl:attribute-set> <!-- table-header-cell-style -->
2692
2778
 
2779
+ <xsl:template name="refine_table-header-cell-style">
2780
+
2781
+ <xsl:call-template name="setBordersTableArray"/>
2782
+
2783
+ <xsl:if test="ancestor::*[local-name()='preface']">
2784
+ <xsl:if test="$doctype != 'service-publication'">
2785
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
2786
+ </xsl:if>
2787
+ </xsl:if>
2788
+ <xsl:if test="$doctype = 'service-publication'">
2789
+ <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
2790
+ <xsl:attribute name="border-bottom">1pt solid black</xsl:attribute>
2791
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2792
+ </xsl:if>
2793
+
2794
+ <xsl:if test="$lang = 'ar'">
2795
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2796
+ </xsl:if>
2797
+
2798
+ <xsl:call-template name="setTableCellAttributes"/>
2799
+
2800
+ </xsl:template> <!-- refine_table-header-cell-style -->
2801
+
2693
2802
  <xsl:attribute-set name="table-cell-style">
2694
2803
  <xsl:attribute name="display-align">center</xsl:attribute>
2695
2804
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2700,6 +2809,26 @@
2700
2809
 
2701
2810
  </xsl:attribute-set> <!-- table-cell-style -->
2702
2811
 
2812
+ <xsl:template name="refine_table-cell-style">
2813
+
2814
+ <xsl:if test="$lang = 'ar'">
2815
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2816
+ </xsl:if>
2817
+
2818
+ <!-- bsi -->
2819
+
2820
+ <xsl:call-template name="setBordersTableArray"/>
2821
+
2822
+ <xsl:if test="ancestor::*[local-name()='preface']">
2823
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
2824
+ </xsl:if>
2825
+ <xsl:if test="$doctype = 'service-publication'">
2826
+ <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
2827
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2828
+ </xsl:if>
2829
+
2830
+ </xsl:template> <!-- refine_table-cell-style -->
2831
+
2703
2832
  <xsl:attribute-set name="table-footer-cell-style">
2704
2833
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2705
2834
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2708,12 +2837,29 @@
2708
2837
 
2709
2838
  </xsl:attribute-set> <!-- table-footer-cell-style -->
2710
2839
 
2840
+ <xsl:template name="refine_table-footer-cell-style">
2841
+
2842
+ <xsl:if test="ancestor::*[local-name()='preface']">
2843
+ <xsl:if test="$doctype != 'service-publication'">
2844
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
2845
+ </xsl:if>
2846
+ </xsl:if>
2847
+ <xsl:if test="$doctype = 'service-publication'">
2848
+ <xsl:attribute name="border">none</xsl:attribute>
2849
+ </xsl:if>
2850
+
2851
+ </xsl:template> <!-- refine_table-footer-cell-style -->
2852
+
2711
2853
  <xsl:attribute-set name="table-note-style">
2712
2854
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2713
2855
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2714
2856
 
2715
2857
  </xsl:attribute-set><!-- table-note-style -->
2716
2858
 
2859
+ <xsl:template name="refine_table-note-style">
2860
+
2861
+ </xsl:template> <!-- refine_table-note-style -->
2862
+
2717
2863
  <xsl:attribute-set name="table-fn-style">
2718
2864
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2719
2865
 
@@ -2776,6 +2922,14 @@
2776
2922
 
2777
2923
  </xsl:attribute-set>
2778
2924
 
2925
+ <xsl:template name="refine_dt-cell-style">
2926
+
2927
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
2928
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
2929
+ </xsl:if>
2930
+
2931
+ </xsl:template> <!-- refine_dt-cell-style -->
2932
+
2779
2933
  <xsl:attribute-set name="dt-block-style">
2780
2934
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
2781
2935
 
@@ -2783,6 +2937,14 @@
2783
2937
 
2784
2938
  </xsl:attribute-set>
2785
2939
 
2940
+ <xsl:template name="refine_dt-block-style">
2941
+
2942
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
2943
+ <xsl:attribute name="text-align">right</xsl:attribute>
2944
+ </xsl:if>
2945
+
2946
+ </xsl:template> <!-- refine_dt-block-style -->
2947
+
2786
2948
  <xsl:attribute-set name="dl-name-style">
2787
2949
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2788
2950
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2796,6 +2958,10 @@
2796
2958
 
2797
2959
  </xsl:attribute-set>
2798
2960
 
2961
+ <xsl:template name="refine_dd-cell-style">
2962
+
2963
+ </xsl:template> <!-- refine_dd-cell-style -->
2964
+
2799
2965
  <!-- ========================== -->
2800
2966
  <!-- END Definition's list styles -->
2801
2967
  <!-- ========================== -->
@@ -2822,6 +2988,12 @@
2822
2988
 
2823
2989
  </xsl:attribute-set>
2824
2990
 
2991
+ <xsl:template name="refine_eref-style">
2992
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
2993
+ <xsl:variable name="text" select="normalize-space()"/>
2994
+
2995
+ </xsl:template> <!-- refine_eref-style -->
2996
+
2825
2997
  <xsl:attribute-set name="note-style">
2826
2998
 
2827
2999
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -2830,6 +3002,10 @@
2830
3002
 
2831
3003
  </xsl:attribute-set>
2832
3004
 
3005
+ <xsl:template name="refine_note-style">
3006
+
3007
+ </xsl:template>
3008
+
2833
3009
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
2834
3010
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
2835
3011
 
@@ -2837,11 +3013,19 @@
2837
3013
 
2838
3014
  </xsl:attribute-set>
2839
3015
 
3016
+ <xsl:template name="refine_note-name-style">
3017
+
3018
+ </xsl:template> <!-- refine_note-name-style -->
3019
+
2840
3020
  <xsl:attribute-set name="table-note-name-style">
2841
3021
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
2842
3022
 
2843
3023
  </xsl:attribute-set>
2844
3024
 
3025
+ <xsl:template name="refine_table-note-name-style">
3026
+
3027
+ </xsl:template> <!-- refine_table-note-name-style -->
3028
+
2845
3029
  <xsl:attribute-set name="note-p-style">
2846
3030
 
2847
3031
  <xsl:attribute name="space-before">4pt</xsl:attribute>
@@ -2854,10 +3038,18 @@
2854
3038
 
2855
3039
  </xsl:attribute-set>
2856
3040
 
3041
+ <xsl:template name="refine_termnote-style">
3042
+
3043
+ </xsl:template> <!-- refine_termnote-style -->
3044
+
2857
3045
  <xsl:attribute-set name="termnote-name-style">
2858
3046
 
2859
3047
  </xsl:attribute-set>
2860
3048
 
3049
+ <xsl:template name="refine_termnote-name-style">
3050
+
3051
+ </xsl:template>
3052
+
2861
3053
  <xsl:attribute-set name="termnote-p-style">
2862
3054
 
2863
3055
  </xsl:attribute-set>
@@ -2870,6 +3062,10 @@
2870
3062
 
2871
3063
  </xsl:attribute-set>
2872
3064
 
3065
+ <xsl:template name="refine_quote-style">
3066
+
3067
+ </xsl:template>
3068
+
2873
3069
  <xsl:attribute-set name="quote-source-style">
2874
3070
  <xsl:attribute name="text-align">right</xsl:attribute>
2875
3071
 
@@ -2879,6 +3075,10 @@
2879
3075
 
2880
3076
  </xsl:attribute-set>
2881
3077
 
3078
+ <xsl:template name="refine_termsource-style">
3079
+
3080
+ </xsl:template> <!-- refine_termsource-style -->
3081
+
2882
3082
  <xsl:attribute-set name="termsource-text-style">
2883
3083
 
2884
3084
  </xsl:attribute-set>
@@ -2917,6 +3117,10 @@
2917
3117
 
2918
3118
  </xsl:attribute-set>
2919
3119
 
3120
+ <xsl:template name="refine_figure-name-style">
3121
+
3122
+ </xsl:template> <!-- refine_figure-name-style -->
3123
+
2920
3124
  <xsl:attribute-set name="figure-source-style">
2921
3125
 
2922
3126
  </xsl:attribute-set>
@@ -2937,6 +3141,10 @@
2937
3141
 
2938
3142
  </xsl:attribute-set> <!-- formula-stem-block-style -->
2939
3143
 
3144
+ <xsl:template name="refine_formula-stem-block-style">
3145
+
3146
+ </xsl:template> <!-- refine_formula-stem-block-style -->
3147
+
2940
3148
  <xsl:attribute-set name="formula-stem-number-style">
2941
3149
  <xsl:attribute name="text-align">right</xsl:attribute>
2942
3150
 
@@ -2950,6 +3158,10 @@
2950
3158
 
2951
3159
  </xsl:attribute-set>
2952
3160
 
3161
+ <xsl:template name="refine_image-style">
3162
+
3163
+ </xsl:template>
3164
+
2953
3165
  <xsl:attribute-set name="figure-pseudocode-p-style">
2954
3166
 
2955
3167
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3043,10 +3255,18 @@
3043
3255
 
3044
3256
  </xsl:attribute-set>
3045
3257
 
3258
+ <xsl:template name="refine_mathml-style">
3259
+
3260
+ </xsl:template>
3261
+
3046
3262
  <xsl:attribute-set name="list-style">
3047
3263
 
3048
3264
  </xsl:attribute-set> <!-- list-style -->
3049
3265
 
3266
+ <xsl:template name="refine_list-style">
3267
+
3268
+ </xsl:template> <!-- refine_list-style -->
3269
+
3050
3270
  <xsl:attribute-set name="list-name-style">
3051
3271
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3052
3272
 
@@ -3058,14 +3278,26 @@
3058
3278
 
3059
3279
  </xsl:attribute-set>
3060
3280
 
3281
+ <xsl:template name="refine_list-item-style">
3282
+
3283
+ </xsl:template> <!-- refine_list-item-style -->
3284
+
3061
3285
  <xsl:attribute-set name="list-item-label-style">
3062
3286
 
3063
3287
  </xsl:attribute-set>
3064
3288
 
3289
+ <xsl:template name="refine_list-item-label-style">
3290
+
3291
+ </xsl:template> <!-- refine_list-item-label-style -->
3292
+
3065
3293
  <xsl:attribute-set name="list-item-body-style">
3066
3294
 
3067
3295
  </xsl:attribute-set>
3068
3296
 
3297
+ <xsl:template name="refine_list-item-body-style">
3298
+
3299
+ </xsl:template> <!-- refine_list-item-body-style -->
3300
+
3069
3301
  <xsl:attribute-set name="toc-style">
3070
3302
  <xsl:attribute name="line-height">135%</xsl:attribute>
3071
3303
  </xsl:attribute-set>
@@ -3079,6 +3311,10 @@
3079
3311
 
3080
3312
  </xsl:attribute-set>
3081
3313
 
3314
+ <xsl:template name="refine_fn-reference-style">
3315
+
3316
+ </xsl:template> <!-- refine_fn-reference-style -->
3317
+
3082
3318
  <xsl:attribute-set name="fn-style">
3083
3319
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3084
3320
  </xsl:attribute-set>
@@ -3103,6 +3339,14 @@
3103
3339
 
3104
3340
  </xsl:attribute-set>
3105
3341
 
3342
+ <xsl:template name="refine_fn-body-style">
3343
+
3344
+ <xsl:if test="$doctype = 'service-publication'">
3345
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3346
+ </xsl:if>
3347
+
3348
+ </xsl:template> <!-- refine_fn-body-style -->
3349
+
3106
3350
  <xsl:attribute-set name="fn-body-num-style">
3107
3351
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
3108
3352
 
@@ -3112,6 +3356,10 @@
3112
3356
 
3113
3357
  </xsl:attribute-set> <!-- fn-body-num-style -->
3114
3358
 
3359
+ <xsl:template name="refine_fn-body-num-style">
3360
+
3361
+ </xsl:template> <!-- refine_fn-body-num-style -->
3362
+
3115
3363
  <!-- admonition -->
3116
3364
  <xsl:attribute-set name="admonition-style">
3117
3365
 
@@ -3782,11 +4030,9 @@
3782
4030
 
3783
4031
  <fo:block-container xsl:use-attribute-sets="table-container-style">
3784
4032
 
3785
- <xsl:if test="$doctype = 'service-publication' and $lang != 'ar'">
3786
- <xsl:attribute name="font-family">Calibri</xsl:attribute>
3787
- </xsl:if>
3788
-
3789
- <!-- end table block-container attributes -->
4033
+ <xsl:call-template name="refine_table-container-style">
4034
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4035
+ </xsl:call-template>
3790
4036
 
3791
4037
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
3792
4038
 
@@ -3807,11 +4053,9 @@
3807
4053
 
3808
4054
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3809
4055
 
3810
- <xsl:call-template name="setBordersTableArray"/>
3811
-
3812
- <xsl:if test="$doctype = 'service-publication'">
3813
- <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
3814
- </xsl:if>
4056
+ <xsl:call-template name="refine_table-style">
4057
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4058
+ </xsl:call-template>
3815
4059
 
3816
4060
  </xsl:element>
3817
4061
  </xsl:variable>
@@ -3877,7 +4121,7 @@
3877
4121
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3878
4122
  </xsl:when>
3879
4123
  <xsl:otherwise>
3880
- <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 -->
4124
+ <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 -->
3881
4125
  </xsl:otherwise>
3882
4126
  </xsl:choose>
3883
4127
 
@@ -3967,6 +4211,10 @@
3967
4211
 
3968
4212
  <fo:block xsl:use-attribute-sets="table-name-style">
3969
4213
 
4214
+ <xsl:call-template name="refine_table-name-style">
4215
+ <xsl:with-param name="continued" select="$continued"/>
4216
+ </xsl:call-template>
4217
+
3970
4218
  <xsl:choose>
3971
4219
  <xsl:when test="$continued = 'true'">
3972
4220
 
@@ -4349,6 +4597,8 @@
4349
4597
  <fo:table-row>
4350
4598
  <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">
4351
4599
 
4600
+ <xsl:call-template name="refine_table-header-title-style"/>
4601
+
4352
4602
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4353
4603
  <xsl:with-param name="continued">true</xsl:with-param>
4354
4604
  </xsl:apply-templates>
@@ -4361,6 +4611,10 @@
4361
4611
  </fo:table-row>
4362
4612
  </xsl:template> <!-- table-header-title -->
4363
4613
 
4614
+ <xsl:template name="refine_table-header-title-style">
4615
+
4616
+ </xsl:template> <!-- refine_table-header-title-style -->
4617
+
4364
4618
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
4365
4619
  <fo:table-body>
4366
4620
  <xsl:apply-templates/>
@@ -4385,7 +4639,7 @@
4385
4639
  <xsl:param name="colwidths"/>
4386
4640
  <xsl:param name="colgroup"/>
4387
4641
 
4388
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4642
+ <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']"/>
4389
4643
 
4390
4644
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4391
4645
 
@@ -4451,14 +4705,7 @@
4451
4705
  <fo:table-row>
4452
4706
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4453
4707
 
4454
- <xsl:if test="ancestor::*[local-name()='preface']">
4455
- <xsl:if test="$doctype != 'service-publication'">
4456
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
4457
- </xsl:if>
4458
- </xsl:if>
4459
- <xsl:if test="$doctype = 'service-publication'">
4460
- <xsl:attribute name="border">none</xsl:attribute>
4461
- </xsl:if>
4708
+ <xsl:call-template name="refine_table-footer-cell-style"/>
4462
4709
 
4463
4710
  <xsl:call-template name="setBordersTableArray"/>
4464
4711
 
@@ -4472,6 +4719,7 @@
4472
4719
 
4473
4720
  <!-- except gb and bsi -->
4474
4721
 
4722
+ <xsl:apply-templates select="../*[local-name()='p']"/>
4475
4723
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4476
4724
  <xsl:apply-templates select="../*[local-name()='note']"/>
4477
4725
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -4603,11 +4851,7 @@
4603
4851
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4604
4852
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4605
4853
 
4606
- <xsl:call-template name="setBordersTableArray"/>
4607
-
4608
- <xsl:if test="$doctype = 'service-publication'">
4609
- <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute>
4610
- </xsl:if>
4854
+ <xsl:call-template name="refine_table-header-row-style"/>
4611
4855
 
4612
4856
  <xsl:call-template name="setTableRowAttributes"/>
4613
4857
 
@@ -4641,6 +4885,8 @@
4641
4885
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4642
4886
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4643
4887
 
4888
+ <xsl:call-template name="refine_table-footer-row-style"/>
4889
+
4644
4890
  <xsl:call-template name="setTableRowAttributes"/>
4645
4891
  <xsl:apply-templates/>
4646
4892
  </fo:table-row>
@@ -4654,9 +4900,10 @@
4654
4900
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4655
4901
  </xsl:if>
4656
4902
 
4657
- <xsl:call-template name="setBordersTableArray"/>
4903
+ <xsl:call-template name="refine_table-body-row-style"/>
4658
4904
 
4659
4905
  <xsl:call-template name="setTableRowAttributes"/>
4906
+
4660
4907
  <xsl:apply-templates/>
4661
4908
  </fo:table-row>
4662
4909
  </xsl:template>
@@ -4679,24 +4926,7 @@
4679
4926
  <xsl:with-param name="default">center</xsl:with-param>
4680
4927
  </xsl:call-template>
4681
4928
 
4682
- <xsl:call-template name="setBordersTableArray"/>
4683
-
4684
- <xsl:if test="ancestor::*[local-name()='preface']">
4685
- <xsl:if test="$doctype != 'service-publication'">
4686
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
4687
- </xsl:if>
4688
- </xsl:if>
4689
- <xsl:if test="$doctype = 'service-publication'">
4690
- <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
4691
- <xsl:attribute name="border-bottom">1pt solid black</xsl:attribute>
4692
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
4693
- </xsl:if>
4694
-
4695
- <xsl:if test="$lang = 'ar'">
4696
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4697
- </xsl:if>
4698
-
4699
- <xsl:call-template name="setTableCellAttributes"/>
4929
+ <xsl:call-template name="refine_table-header-cell-style"/>
4700
4930
 
4701
4931
  <fo:block>
4702
4932
  <xsl:apply-templates/>
@@ -4735,24 +4965,10 @@
4735
4965
  <xsl:template match="*[local-name()='td']" name="td">
4736
4966
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
4737
4967
  <xsl:call-template name="setTextAlignment">
4738
- <xsl:with-param name="default">left</xsl:with-param>
4739
- </xsl:call-template>
4740
-
4741
- <xsl:if test="$lang = 'ar'">
4742
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4743
- </xsl:if>
4744
-
4745
- <!-- bsi -->
4746
-
4747
- <xsl:call-template name="setBordersTableArray"/>
4748
-
4749
- <xsl:if test="ancestor::*[local-name()='preface']">
4750
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
4751
- </xsl:if>
4752
- <xsl:if test="$doctype = 'service-publication'">
4753
- <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute>
4754
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
4755
- </xsl:if>
4968
+ <xsl:with-param name="default">left</xsl:with-param>
4969
+ </xsl:call-template>
4970
+
4971
+ <xsl:call-template name="refine_table-cell-style"/>
4756
4972
 
4757
4973
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4758
4974
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -4783,9 +4999,13 @@
4783
4999
 
4784
5000
  <fo:block xsl:use-attribute-sets="table-note-style">
4785
5001
 
5002
+ <xsl:call-template name="refine_table-note-style"/>
5003
+
4786
5004
  <!-- Table's note name (NOTE, for example) -->
4787
5005
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
4788
5006
 
5007
+ <xsl:call-template name="refine_table-note-name-style"/>
5008
+
4789
5009
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4790
5010
 
4791
5011
  </fo:inline>
@@ -4813,6 +5033,14 @@
4813
5033
  <!-- list of footnotes to calculate actual footnotes number -->
4814
5034
  <xsl:variable name="p_fn_">
4815
5035
  <xsl:call-template name="get_fn_list"/>
5036
+ <!-- <xsl:choose>
5037
+ <xsl:when test="$namespace = 'jis'">
5038
+ <xsl:call-template name="get_fn_list_for_element"/>
5039
+ </xsl:when>
5040
+ <xsl:otherwise>
5041
+ <xsl:call-template name="get_fn_list"/>
5042
+ </xsl:otherwise>
5043
+ </xsl:choose> -->
4816
5044
  </xsl:variable>
4817
5045
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4818
5046
 
@@ -4837,7 +5065,14 @@
4837
5065
 
4838
5066
  </xsl:variable>
4839
5067
 
4840
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5068
+ <xsl:variable name="ref_id">
5069
+ <xsl:choose>
5070
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
5071
+ <xsl:otherwise>
5072
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5073
+ </xsl:otherwise>
5074
+ </xsl:choose>
5075
+ </xsl:variable>
4841
5076
  <xsl:variable name="footnote_inline">
4842
5077
  <fo:inline>
4843
5078
 
@@ -4860,9 +5095,13 @@
4860
5095
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4861
5096
  </xsl:if>
4862
5097
 
4863
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4864
- <xsl:value-of select="$current_fn_number_text"/>
4865
- </fo:basic-link>
5098
+ <xsl:call-template name="insert_basic_link">
5099
+ <xsl:with-param name="element">
5100
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5101
+ <xsl:copy-of select="$current_fn_number_text"/>
5102
+ </fo:basic-link>
5103
+ </xsl:with-param>
5104
+ </xsl:call-template>
4866
5105
  </fo:inline>
4867
5106
  </xsl:variable>
4868
5107
 
@@ -4879,12 +5118,12 @@
4879
5118
 
4880
5119
  <fo:block xsl:use-attribute-sets="fn-body-style">
4881
5120
 
4882
- <xsl:if test="$doctype = 'service-publication'">
4883
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4884
- </xsl:if>
5121
+ <xsl:call-template name="refine_fn-body-style"/>
4885
5122
 
4886
5123
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
4887
5124
 
5125
+ <xsl:call-template name="refine_fn-body-num-style"/>
5126
+
4888
5127
  <xsl:value-of select="$current_fn_number_text"/>
4889
5128
  </fo:inline>
4890
5129
  <xsl:apply-templates/>
@@ -4936,6 +5175,28 @@
4936
5175
  </xsl:choose>
4937
5176
  </xsl:template>
4938
5177
 
5178
+ <xsl:template name="get_fn_list_for_element">
5179
+ <xsl:choose>
5180
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
5181
+ <fn gen_id="{generate-id(.)}">
5182
+ <xsl:copy-of select="@*"/>
5183
+ <xsl:copy-of select="node()"/>
5184
+ </fn>
5185
+ </xsl:when>
5186
+ <xsl:otherwise>
5187
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
5188
+ <xsl:variable name="element_id" select="@id"/>
5189
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5190
+ <!-- copy unique fn -->
5191
+ <fn gen_id="{generate-id(.)}">
5192
+ <xsl:copy-of select="@*"/>
5193
+ <xsl:copy-of select="node()"/>
5194
+ </fn>
5195
+ </xsl:for-each>
5196
+ </xsl:for-each>
5197
+ </xsl:otherwise>
5198
+ </xsl:choose>
5199
+ </xsl:template>
4939
5200
  <!-- ============================ -->
4940
5201
  <!-- table's footnotes rendering -->
4941
5202
  <!-- ============================ -->
@@ -5116,6 +5377,8 @@
5116
5377
  <xsl:template match="*[local-name()='fn']">
5117
5378
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5118
5379
 
5380
+ <xsl:call-template name="refine_fn-reference-style"/>
5381
+
5119
5382
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5120
5383
 
5121
5384
  <xsl:value-of select="@reference"/>
@@ -5205,15 +5468,17 @@
5205
5468
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5206
5469
  <xsl:text> </xsl:text>
5207
5470
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5208
- <xsl:text/>
5209
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5471
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5472
+ <xsl:text> </xsl:text>
5473
+ </xsl:if>
5474
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5210
5475
  </fo:block>
5211
5476
 
5212
5477
  </xsl:when> <!-- END: only one component -->
5213
5478
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
5214
5479
  <fo:block margin-bottom="12pt" text-align="left">
5215
5480
 
5216
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5481
+ <xsl:call-template name="refine_dl_formula_where_style"/>
5217
5482
 
5218
5483
  <!-- <xsl:variable name="title-where">
5219
5484
  <xsl:call-template name="getLocalizedString">
@@ -5228,6 +5493,8 @@
5228
5493
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5229
5494
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5230
5495
 
5496
+ <xsl:call-template name="refine_figure_key_style"/>
5497
+
5231
5498
  <xsl:variable name="title-key">
5232
5499
  <xsl:call-template name="getLocalizedString">
5233
5500
  <xsl:with-param name="key">key</xsl:with-param>
@@ -5242,9 +5509,7 @@
5242
5509
  <xsl:if test="$onlyOneComponent = 'false'">
5243
5510
  <fo:block>
5244
5511
 
5245
- <xsl:if test="$parent = 'figure' or $parent = 'formula'">
5246
- <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
5247
- </xsl:if>
5512
+ <xsl:call-template name="refine_multicomponent_style"/>
5248
5513
 
5249
5514
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5250
5515
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -5252,6 +5517,8 @@
5252
5517
 
5253
5518
  <fo:block>
5254
5519
 
5520
+ <xsl:call-template name="refine_multicomponent_block_style"/>
5521
+
5255
5522
  <xsl:apply-templates select="*[local-name() = 'name']">
5256
5523
  <xsl:with-param name="process">true</xsl:with-param>
5257
5524
  </xsl:apply-templates>
@@ -5409,6 +5676,30 @@
5409
5676
 
5410
5677
  </xsl:template> <!-- END: dl -->
5411
5678
 
5679
+ <xsl:template name="refine_dl_formula_where_style">
5680
+
5681
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5682
+
5683
+ </xsl:template> <!-- refine_dl_formula_where_style -->
5684
+
5685
+ <xsl:template name="refine_figure_key_style">
5686
+
5687
+ </xsl:template> <!-- refine_figure_key_style -->
5688
+
5689
+ <xsl:template name="refine_multicomponent_style">
5690
+ <xsl:variable name="parent" select="local-name(..)"/>
5691
+
5692
+ <xsl:if test="$parent = 'figure' or $parent = 'formula'">
5693
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
5694
+ </xsl:if>
5695
+
5696
+ </xsl:template> <!-- refine_multicomponent_style -->
5697
+
5698
+ <xsl:template name="refine_multicomponent_block_style">
5699
+ <xsl:variable name="parent" select="local-name(..)"/>
5700
+
5701
+ </xsl:template> <!-- refine_multicomponent_block_style -->
5702
+
5412
5703
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5413
5704
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5414
5705
 
@@ -5628,9 +5919,7 @@
5628
5919
 
5629
5920
  </xsl:if>
5630
5921
 
5631
- <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
5632
- <xsl:attribute name="padding-right">3mm</xsl:attribute>
5633
- </xsl:if>
5922
+ <xsl:call-template name="refine_dt-cell-style"/>
5634
5923
 
5635
5924
  <fo:block xsl:use-attribute-sets="dt-block-style">
5636
5925
  <xsl:copy-of select="@id"/>
@@ -5639,9 +5928,7 @@
5639
5928
  <xsl:attribute name="margin-top">0</xsl:attribute>
5640
5929
  </xsl:if>
5641
5930
 
5642
- <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
5643
- <xsl:attribute name="text-align">right</xsl:attribute>
5644
- </xsl:if>
5931
+ <xsl:call-template name="refine_dt-block-style"/>
5645
5932
 
5646
5933
  <xsl:apply-templates>
5647
5934
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5662,6 +5949,8 @@
5662
5949
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5663
5950
  </xsl:if>
5664
5951
 
5952
+ <xsl:call-template name="refine_dd-cell-style"/>
5953
+
5665
5954
  <fo:block>
5666
5955
 
5667
5956
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5709,8 +5998,18 @@
5709
5998
  </xsl:if>
5710
5999
  </xsl:template>
5711
6000
 
5712
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5713
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6001
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
6002
+ <xsl:variable name="is_inline_element_after_where">
6003
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
6004
+ </xsl:variable>
6005
+ <xsl:choose>
6006
+ <xsl:when test="$is_inline_element_after_where = 'true'">
6007
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6008
+ </xsl:when>
6009
+ <xsl:otherwise>
6010
+ <xsl:apply-templates select="."/>
6011
+ </xsl:otherwise>
6012
+ </xsl:choose>
5714
6013
  </xsl:template>
5715
6014
 
5716
6015
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5804,12 +6103,18 @@
5804
6103
  <xsl:param name="split_keep-within-line"/>
5805
6104
  <fo:inline font-weight="bold">
5806
6105
 
6106
+ <xsl:call-template name="refine_strong_style"/>
6107
+
5807
6108
  <xsl:apply-templates>
5808
6109
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5809
6110
  </xsl:apply-templates>
5810
6111
  </fo:inline>
5811
6112
  </xsl:template>
5812
6113
 
6114
+ <xsl:template name="refine_strong_style">
6115
+
6116
+ </xsl:template>
6117
+
5813
6118
  <xsl:template match="*[local-name()='padding']">
5814
6119
  <fo:inline padding-right="{@value}"> </fo:inline>
5815
6120
  </xsl:template>
@@ -6276,7 +6581,10 @@
6276
6581
  </xsl:choose>
6277
6582
  </xsl:variable>
6278
6583
 
6279
- <xsl:value-of select="$text9"/>
6584
+ <!-- replace sequence #x200B and space TO space -->
6585
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
6586
+
6587
+ <xsl:value-of select="$text10"/>
6280
6588
  </xsl:template>
6281
6589
 
6282
6590
  <xsl:template name="add-zero-spaces-link-java">
@@ -6951,6 +7259,11 @@
6951
7259
 
6952
7260
  <fo:inline xsl:use-attribute-sets="mathml-style">
6953
7261
 
7262
+ <!-- DEBUG -->
7263
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
7264
+
7265
+ <xsl:call-template name="refine_mathml-style"/>
7266
+
6954
7267
  <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 -->
6955
7268
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
6956
7269
  </xsl:if>
@@ -7055,6 +7368,8 @@
7055
7368
 
7056
7369
  <fo:instream-foreign-object fox:alt-text="Math">
7057
7370
 
7371
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
7372
+
7058
7373
  <!-- put MathML in Actual Text -->
7059
7374
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7060
7375
  <xsl:attribute name="fox:actual-text">
@@ -7075,6 +7390,10 @@
7075
7390
  </fo:instream-foreign-object>
7076
7391
  </xsl:template>
7077
7392
 
7393
+ <xsl:template name="refine_mathml_insteam_object_style">
7394
+
7395
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
7396
+
7078
7397
  <xsl:template match="mathml:*" mode="mathml_actual_text">
7079
7398
  <!-- <xsl:text>a+b</xsl:text> -->
7080
7399
  <xsl:text>&lt;</xsl:text>
@@ -7138,6 +7457,79 @@
7138
7457
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7139
7458
  </xsl:template>
7140
7459
 
7460
+ <!-- special case for:
7461
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7462
+ <mstyle displaystyle="true">
7463
+ <msup>
7464
+ <mi color="#00000000">C</mi>
7465
+ <mtext>R</mtext>
7466
+ </msup>
7467
+ <msubsup>
7468
+ <mtext>C</mtext>
7469
+ <mi>n</mi>
7470
+ <mi>k</mi>
7471
+ </msubsup>
7472
+ </mstyle>
7473
+ </math>
7474
+ -->
7475
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7476
+ <xsl:copy>
7477
+ <xsl:copy-of select="@*"/>
7478
+ <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"/>
7479
+ <xsl:if test="string-length($next_mtext) != ''">
7480
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7481
+ </xsl:if>
7482
+ <xsl:apply-templates/>
7483
+ <xsl:value-of select="$next_mtext"/>
7484
+ </xsl:copy>
7485
+ </xsl:template>
7486
+
7487
+ <!-- special case for:
7488
+ <msup>
7489
+ <mtext/>
7490
+ <mn>1</mn>
7491
+ </msup>
7492
+ convert to (add mspace after mtext and enclose them into mrow):
7493
+ <msup>
7494
+ <mrow>
7495
+ <mtext/>
7496
+ <mspace height="1.47ex"/>
7497
+ </mrow>
7498
+ <mn>1</mn>
7499
+ </msup>
7500
+ -->
7501
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7502
+ <mathml:mrow>
7503
+ <xsl:copy-of select="."/>
7504
+ <mathml:mspace height="1.47ex"/>
7505
+ </mathml:mrow>
7506
+ </xsl:template>
7507
+
7508
+ <!-- add space around vertical line -->
7509
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7510
+ <xsl:copy>
7511
+ <xsl:apply-templates select="@*" mode="mathml"/>
7512
+ <xsl:if test="not(@lspace)">
7513
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7514
+ </xsl:if>
7515
+ <xsl:if test="not(@rspace)">
7516
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7517
+ </xsl:if>
7518
+ <xsl:apply-templates mode="mathml"/>
7519
+ </xsl:copy>
7520
+ </xsl:template>
7521
+
7522
+ <!-- decrease fontsize for 'Circled Times' char -->
7523
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7524
+ <xsl:copy>
7525
+ <xsl:apply-templates select="@*" mode="mathml"/>
7526
+ <xsl:if test="not(@fontsize)">
7527
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7528
+ </xsl:if>
7529
+ <xsl:apply-templates mode="mathml"/>
7530
+ </xsl:copy>
7531
+ </xsl:template>
7532
+
7141
7533
  <!-- Examples:
7142
7534
  <stem type="AsciiMath">x = 1</stem>
7143
7535
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7146,6 +7538,8 @@
7146
7538
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
7147
7539
  <fo:inline xsl:use-attribute-sets="mathml-style">
7148
7540
 
7541
+ <xsl:call-template name="refine_mathml-style"/>
7542
+
7149
7543
  <xsl:choose>
7150
7544
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
7151
7545
  <xsl:otherwise>
@@ -7190,24 +7584,30 @@
7190
7584
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7191
7585
  </xsl:if>
7192
7586
 
7587
+ <xsl:call-template name="refine_link-style"/>
7588
+
7193
7589
  <xsl:choose>
7194
7590
  <xsl:when test="$target_text = ''">
7195
7591
  <xsl:apply-templates/>
7196
7592
  </xsl:when>
7197
7593
  <xsl:otherwise>
7198
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7199
- <xsl:choose>
7200
- <xsl:when test="normalize-space(.) = ''">
7201
- <xsl:call-template name="add-zero-spaces-link-java">
7202
- <xsl:with-param name="text" select="$target_text"/>
7203
- </xsl:call-template>
7204
- </xsl:when>
7205
- <xsl:otherwise>
7206
- <!-- output text from <link>text</link> -->
7207
- <xsl:apply-templates/>
7208
- </xsl:otherwise>
7209
- </xsl:choose>
7210
- </fo:basic-link>
7594
+ <xsl:call-template name="insert_basic_link">
7595
+ <xsl:with-param name="element">
7596
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7597
+ <xsl:choose>
7598
+ <xsl:when test="normalize-space(.) = ''">
7599
+ <xsl:call-template name="add-zero-spaces-link-java">
7600
+ <xsl:with-param name="text" select="$target_text"/>
7601
+ </xsl:call-template>
7602
+ </xsl:when>
7603
+ <xsl:otherwise>
7604
+ <!-- output text from <link>text</link> -->
7605
+ <xsl:apply-templates/>
7606
+ </xsl:otherwise>
7607
+ </xsl:choose>
7608
+ </fo:basic-link>
7609
+ </xsl:with-param>
7610
+ </xsl:call-template>
7211
7611
  </xsl:otherwise>
7212
7612
  </xsl:choose>
7213
7613
  </fo:inline>
@@ -7270,12 +7670,19 @@
7270
7670
  </xsl:template>
7271
7671
 
7272
7672
  <xsl:template match="*[local-name() = 'xref']">
7273
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7274
- <xsl:if test="parent::*[local-name() = 'add']">
7275
- <xsl:call-template name="append_add-style"/>
7276
- </xsl:if>
7277
- <xsl:apply-templates/>
7278
- </fo:basic-link>
7673
+ <xsl:call-template name="insert_basic_link">
7674
+ <xsl:with-param name="element">
7675
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7676
+ <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'])">
7677
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7678
+ </xsl:if>
7679
+ <xsl:if test="parent::*[local-name() = 'add']">
7680
+ <xsl:call-template name="append_add-style"/>
7681
+ </xsl:if>
7682
+ <xsl:apply-templates/>
7683
+ </fo:basic-link>
7684
+ </xsl:with-param>
7685
+ </xsl:call-template>
7279
7686
  </xsl:template>
7280
7687
 
7281
7688
  <!-- ====== -->
@@ -7330,6 +7737,8 @@
7330
7737
  <fo:table-cell display-align="center">
7331
7738
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7332
7739
 
7740
+ <xsl:call-template name="refine_formula-stem-block-style"/>
7741
+
7333
7742
  <xsl:apply-templates/>
7334
7743
  </fo:block>
7335
7744
  </fo:table-cell>
@@ -7371,16 +7780,18 @@
7371
7780
 
7372
7781
  <xsl:call-template name="setBlockSpanAll"/>
7373
7782
 
7783
+ <xsl:call-template name="refine_note-style"/>
7784
+
7374
7785
  <fo:block-container margin-left="0mm" margin-right="0mm">
7375
7786
 
7376
7787
  <fo:block>
7377
7788
 
7378
- <xsl:if test="ancestor::itu:figure">
7379
- <xsl:attribute name="keep-with-previous">always</xsl:attribute>
7380
- </xsl:if>
7789
+ <xsl:call-template name="refine_note_block_style"/>
7381
7790
 
7382
7791
  <fo:inline xsl:use-attribute-sets="note-name-style">
7383
7792
 
7793
+ <xsl:call-template name="refine_note-name-style"/>
7794
+
7384
7795
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7385
7796
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7386
7797
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7406,6 +7817,14 @@
7406
7817
 
7407
7818
  </xsl:template>
7408
7819
 
7820
+ <xsl:template name="refine_note_block_style">
7821
+
7822
+ <xsl:if test="ancestor::itu:figure">
7823
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
7824
+ </xsl:if>
7825
+
7826
+ </xsl:template>
7827
+
7409
7828
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7410
7829
  <xsl:variable name="num"><xsl:number/></xsl:variable>
7411
7830
  <xsl:choose>
@@ -7427,12 +7846,16 @@
7427
7846
 
7428
7847
  <xsl:call-template name="setBlockSpanAll"/>
7429
7848
 
7849
+ <xsl:call-template name="refine_termnote-style"/>
7850
+
7430
7851
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7431
7852
 
7432
7853
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
7433
7854
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7434
7855
  </xsl:if>
7435
7856
 
7857
+ <xsl:call-template name="refine_termnote-name-style"/>
7858
+
7436
7859
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7437
7860
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7438
7861
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7606,6 +8029,8 @@
7606
8029
  <xsl:otherwise>
7607
8030
  <fo:block xsl:use-attribute-sets="image-style">
7608
8031
 
8032
+ <xsl:call-template name="refine_image-style"/>
8033
+
7609
8034
  <xsl:variable name="src">
7610
8035
  <xsl:call-template name="image_src"/>
7611
8036
  </xsl:variable>
@@ -7664,7 +8089,7 @@
7664
8089
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7665
8090
  </xsl:when>
7666
8091
  <xsl:when test="not(starts-with(@src, 'data:'))">
7667
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8092
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7668
8093
  </xsl:when>
7669
8094
  <xsl:otherwise>
7670
8095
  <xsl:value-of select="@src"/>
@@ -7686,7 +8111,7 @@
7686
8111
  </xsl:when>
7687
8112
  <xsl:when test="not(starts-with(@src, 'data:'))">
7688
8113
  <xsl:variable name="src">
7689
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8114
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7690
8115
  </xsl:variable>
7691
8116
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7692
8117
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8072,15 +8497,19 @@
8072
8497
  <xsl:param name="dest"/>
8073
8498
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8074
8499
  <fo:block font-size="1pt">
8075
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8076
- <fo:inline-container inline-progression-dimension="100%">
8077
- <fo:block-container height="{$height - 1}px" width="100%">
8078
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8079
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8080
- </xsl:if> -->
8081
- <fo:block> </fo:block></fo:block-container>
8082
- </fo:inline-container>
8083
- </fo:basic-link>
8500
+ <xsl:call-template name="insert_basic_link">
8501
+ <xsl:with-param name="element">
8502
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8503
+ <fo:inline-container inline-progression-dimension="100%">
8504
+ <fo:block-container height="{$height - 1}px" width="100%">
8505
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8506
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8507
+ </xsl:if> -->
8508
+ <fo:block> </fo:block></fo:block-container>
8509
+ </fo:inline-container>
8510
+ </fo:basic-link>
8511
+ </xsl:with-param>
8512
+ </xsl:call-template>
8084
8513
  </fo:block>
8085
8514
  </fo:block-container>
8086
8515
  </xsl:template>
@@ -8451,6 +8880,8 @@
8451
8880
  <xsl:if test="normalize-space() != ''">
8452
8881
  <fo:block xsl:use-attribute-sets="figure-name-style">
8453
8882
 
8883
+ <xsl:call-template name="refine_figure-name-style"/>
8884
+
8454
8885
  <xsl:apply-templates/>
8455
8886
  </fo:block>
8456
8887
  </xsl:if>
@@ -8716,6 +9147,8 @@
8716
9147
  </xsl:attribute>
8717
9148
  </xsl:for-each>
8718
9149
 
9150
+ <xsl:call-template name="refine_sourcecode-style"/>
9151
+
8719
9152
  <!-- remove margin between rows in the table with sourcecode line numbers -->
8720
9153
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8721
9154
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9420,6 +9853,8 @@
9420
9853
 
9421
9854
  <xsl:call-template name="setBlockSpanAll"/>
9422
9855
 
9856
+ <xsl:call-template name="refine_example-style"/>
9857
+
9423
9858
  <xsl:variable name="fo_element">
9424
9859
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
9425
9860
  block
@@ -9547,6 +9982,8 @@
9547
9982
  </xsl:if>
9548
9983
  <fo:block xsl:use-attribute-sets="example-p-style">
9549
9984
 
9985
+ <xsl:call-template name="refine_example-p-style"/>
9986
+
9550
9987
  <xsl:apply-templates/>
9551
9988
  </fo:block>
9552
9989
  </fo:block-container>
@@ -9563,6 +10000,7 @@
9563
10000
  </xsl:otherwise>
9564
10001
  </xsl:choose>
9565
10002
  </xsl:template> <!-- example/p -->
10003
+
9566
10004
  <!-- ====== -->
9567
10005
  <!-- ====== -->
9568
10006
 
@@ -9574,6 +10012,8 @@
9574
10012
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
9575
10013
  <fo:block xsl:use-attribute-sets="termsource-style">
9576
10014
 
10015
+ <xsl:call-template name="refine_termsource-style"/>
10016
+
9577
10017
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
9578
10018
  <xsl:variable name="termsource_text">
9579
10019
  <xsl:apply-templates/>
@@ -9626,14 +10066,18 @@
9626
10066
  </xsl:template>
9627
10067
 
9628
10068
  <xsl:template match="*[local-name() = 'origin']">
9629
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9630
- <xsl:if test="normalize-space(@citeas) = ''">
9631
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9632
- </xsl:if>
9633
- <fo:inline xsl:use-attribute-sets="origin-style">
9634
- <xsl:apply-templates/>
9635
- </fo:inline>
9636
- </fo:basic-link>
10069
+ <xsl:call-template name="insert_basic_link">
10070
+ <xsl:with-param name="element">
10071
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10072
+ <xsl:if test="normalize-space(@citeas) = ''">
10073
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10074
+ </xsl:if>
10075
+ <fo:inline xsl:use-attribute-sets="origin-style">
10076
+ <xsl:apply-templates/>
10077
+ </fo:inline>
10078
+ </fo:basic-link>
10079
+ </xsl:with-param>
10080
+ </xsl:call-template>
9637
10081
  </xsl:template>
9638
10082
 
9639
10083
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9685,6 +10129,8 @@
9685
10129
  <fo:block-container margin-left="0mm">
9686
10130
  <fo:block-container xsl:use-attribute-sets="quote-style">
9687
10131
 
10132
+ <xsl:call-template name="refine_quote-style"/>
10133
+
9688
10134
  <fo:block-container margin-left="0mm" margin-right="0mm">
9689
10135
  <fo:block role="BlockQuote">
9690
10136
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -9707,9 +10153,13 @@
9707
10153
  <xsl:if test="../*[local-name() = 'author']">
9708
10154
  <xsl:text>, </xsl:text>
9709
10155
  </xsl:if>
9710
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9711
- <xsl:apply-templates/>
9712
- </fo:basic-link>
10156
+ <xsl:call-template name="insert_basic_link">
10157
+ <xsl:with-param name="element">
10158
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10159
+ <xsl:apply-templates/>
10160
+ </fo:basic-link>
10161
+ </xsl:with-param>
10162
+ </xsl:call-template>
9713
10163
  </xsl:template>
9714
10164
 
9715
10165
  <xsl:template match="*[local-name() = 'author']">
@@ -9755,28 +10205,33 @@
9755
10205
 
9756
10206
  </xsl:if>
9757
10207
 
9758
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9759
- <xsl:variable name="text" select="normalize-space()"/>
10208
+ <xsl:call-template name="refine_eref-style"/>
9760
10209
 
9761
- <fo:basic-link fox:alt-text="{@citeas}">
9762
- <xsl:if test="normalize-space(@citeas) = ''">
9763
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9764
- </xsl:if>
9765
- <xsl:if test="@type = 'inline'">
10210
+ <xsl:call-template name="insert_basic_link">
10211
+ <xsl:with-param name="element">
10212
+ <fo:basic-link fox:alt-text="{@citeas}">
10213
+ <xsl:if test="normalize-space(@citeas) = ''">
10214
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10215
+ </xsl:if>
10216
+ <xsl:if test="@type = 'inline'">
9766
10217
 
9767
- </xsl:if>
10218
+ <xsl:call-template name="refine_basic_link_style"/>
9768
10219
 
9769
- <xsl:choose>
9770
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9771
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9772
- </xsl:when>
9773
- <xsl:otherwise>
9774
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9775
- </xsl:otherwise>
9776
- </xsl:choose>
10220
+ </xsl:if>
9777
10221
 
9778
- <xsl:apply-templates/>
9779
- </fo:basic-link>
10222
+ <xsl:choose>
10223
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10224
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10225
+ </xsl:when>
10226
+ <xsl:otherwise>
10227
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10228
+ </xsl:otherwise>
10229
+ </xsl:choose>
10230
+
10231
+ <xsl:apply-templates/>
10232
+ </fo:basic-link>
10233
+ </xsl:with-param>
10234
+ </xsl:call-template>
9780
10235
 
9781
10236
  </fo:inline>
9782
10237
  </xsl:when>
@@ -9794,6 +10249,11 @@
9794
10249
  </xsl:otherwise>
9795
10250
  </xsl:choose>
9796
10251
  </xsl:template>
10252
+
10253
+ <xsl:template name="refine_basic_link_style">
10254
+
10255
+ </xsl:template> <!-- refine_basic_link_style -->
10256
+
9797
10257
  <!-- ====== -->
9798
10258
  <!-- END eref -->
9799
10259
  <!-- ====== -->
@@ -9939,18 +10399,24 @@
9939
10399
  <fo:block>
9940
10400
  <xsl:call-template name="setId"/>
9941
10401
 
9942
- <xsl:if test="*[1][@class='supertitle']">
9943
- <xsl:attribute name="space-before">36pt</xsl:attribute>
9944
- </xsl:if>
9945
- <xsl:if test="@inline-header='true'">
9946
- <xsl:attribute name="text-align">justify</xsl:attribute>
9947
- </xsl:if>
10402
+ <xsl:call-template name="sections_element_style"/>
9948
10403
 
9949
10404
  <xsl:apply-templates/>
9950
10405
  </fo:block>
9951
10406
 
9952
10407
  </xsl:template>
9953
10408
 
10409
+ <xsl:template name="sections_element_style">
10410
+
10411
+ <xsl:if test="*[1][@class='supertitle']">
10412
+ <xsl:attribute name="space-before">36pt</xsl:attribute>
10413
+ </xsl:if>
10414
+ <xsl:if test="@inline-header='true'">
10415
+ <xsl:attribute name="text-align">justify</xsl:attribute>
10416
+ </xsl:if>
10417
+
10418
+ </xsl:template> <!-- sections_element_style -->
10419
+
9954
10420
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9955
10421
  <fo:block break-after="page"/>
9956
10422
  <fo:block>
@@ -9965,14 +10431,20 @@
9965
10431
 
9966
10432
  <xsl:call-template name="setBlockSpanAll"/>
9967
10433
 
9968
- <xsl:if test="@inline-header='true'">
9969
- <xsl:attribute name="text-align">justify</xsl:attribute>
9970
- </xsl:if>
10434
+ <xsl:call-template name="refine_clause_style"/>
9971
10435
 
9972
10436
  <xsl:apply-templates/>
9973
10437
  </fo:block>
9974
10438
  </xsl:template>
9975
10439
 
10440
+ <xsl:template name="refine_clause_style">
10441
+
10442
+ <xsl:if test="@inline-header='true'">
10443
+ <xsl:attribute name="text-align">justify</xsl:attribute>
10444
+ </xsl:if>
10445
+
10446
+ </xsl:template> <!-- refine_clause_style -->
10447
+
9976
10448
  <xsl:template match="*[local-name() = 'definitions']">
9977
10449
  <fo:block id="{@id}">
9978
10450
  <xsl:apply-templates/>
@@ -9985,10 +10457,16 @@
9985
10457
 
9986
10458
  <xsl:call-template name="setBlockSpanAll"/>
9987
10459
 
10460
+ <xsl:call-template name="refine_annex_style"/>
10461
+
9988
10462
  </fo:block>
9989
10463
  <xsl:apply-templates/>
9990
10464
  </xsl:template>
9991
10465
 
10466
+ <xsl:template name="refine_annex_style">
10467
+
10468
+ </xsl:template>
10469
+
9992
10470
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
9993
10471
  <!-- comment 2019-11-29 -->
9994
10472
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -10027,7 +10505,10 @@
10027
10505
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10028
10506
 
10029
10507
  <xsl:template name="setULLabel">
10030
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10508
+ <xsl:variable name="list_level__">
10509
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10510
+ </xsl:variable>
10511
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10031
10512
  <xsl:variable name="list_level">
10032
10513
  <xsl:choose>
10033
10514
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10152,6 +10633,8 @@
10152
10633
  </xsl:choose>
10153
10634
  </xsl:attribute>
10154
10635
 
10636
+ <xsl:call-template name="refine_list_container_style"/>
10637
+
10155
10638
  <fo:block-container margin-left="0mm">
10156
10639
  <fo:block>
10157
10640
  <xsl:apply-templates select="." mode="list"/>
@@ -10160,13 +10643,19 @@
10160
10643
  </fo:block-container>
10161
10644
  </xsl:when>
10162
10645
  <xsl:otherwise>
10163
- <fo:block>
10164
- <xsl:apply-templates select="." mode="list"/>
10165
- </fo:block>
10646
+
10647
+ <fo:block>
10648
+ <xsl:apply-templates select="." mode="list"/>
10649
+ </fo:block>
10650
+
10166
10651
  </xsl:otherwise>
10167
10652
  </xsl:choose>
10168
10653
  </xsl:template>
10169
10654
 
10655
+ <xsl:template name="refine_list_container_style">
10656
+
10657
+ </xsl:template> <!-- refine_list_container_style -->
10658
+
10170
10659
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
10171
10660
 
10172
10661
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -10177,7 +10666,7 @@
10177
10666
 
10178
10667
  <xsl:variable name="provisional_distance_between_starts_">
10179
10668
  <attributes xsl:use-attribute-sets="list-style">
10180
-
10669
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
10181
10670
  </attributes>
10182
10671
  </xsl:variable>
10183
10672
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -10213,6 +10702,8 @@
10213
10702
  <addon><xsl:value-of select="$addon"/></addon> -->
10214
10703
  </xsl:if>
10215
10704
 
10705
+ <xsl:call-template name="refine_list-style"/>
10706
+
10216
10707
  <xsl:if test="*[local-name() = 'name']">
10217
10708
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
10218
10709
  </xsl:if>
@@ -10225,6 +10716,10 @@
10225
10716
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
10226
10717
  </xsl:template>
10227
10718
 
10719
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
10720
+
10721
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
10722
+
10228
10723
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
10229
10724
  <xsl:param name="process">false</xsl:param>
10230
10725
  <xsl:if test="$process = 'true'">
@@ -10238,20 +10733,27 @@
10238
10733
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10239
10734
  <xsl:copy-of select="@id"/>
10240
10735
 
10736
+ <xsl:call-template name="refine_list-item-style"/>
10737
+
10241
10738
  <fo:list-item-label end-indent="label-end()">
10242
10739
  <fo:block xsl:use-attribute-sets="list-item-label-style">
10243
10740
 
10741
+ <xsl:call-template name="refine_list-item-label-style"/>
10742
+
10244
10743
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10245
10744
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10246
10745
  <xsl:call-template name="append_add-style"/>
10247
10746
  </xsl:if>
10248
10747
 
10249
10748
  <xsl:call-template name="getListItemFormat"/>
10749
+
10250
10750
  </fo:block>
10251
10751
  </fo:list-item-label>
10252
10752
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
10253
10753
  <fo:block>
10254
10754
 
10755
+ <xsl:call-template name="refine_list-item-body-style"/>
10756
+
10255
10757
  <xsl:apply-templates/>
10256
10758
 
10257
10759
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -10569,6 +11071,7 @@
10569
11071
 
10570
11072
  <fo:block id="{@id}">
10571
11073
  <xsl:apply-templates/>
11074
+
10572
11075
  </fo:block>
10573
11076
  </xsl:template>
10574
11077
 
@@ -10588,6 +11091,7 @@
10588
11091
 
10589
11092
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
10590
11093
  <xsl:apply-templates/>
11094
+
10591
11095
  </fo:block>
10592
11096
 
10593
11097
  </xsl:template> <!-- references -->
@@ -10874,24 +11378,32 @@
10874
11378
  <xsl:for-each select="*[local-name() = 'tab']">
10875
11379
  <xsl:variable name="current_id" select="generate-id()"/>
10876
11380
  <fo:table-cell>
10877
- <fo:block>
10878
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10879
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10880
- <xsl:choose>
10881
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10882
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10883
- </xsl:choose>
10884
- </xsl:for-each>
10885
- </fo:basic-link>
11381
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11382
+ <xsl:call-template name="insert_basic_link">
11383
+ <xsl:with-param name="element">
11384
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11385
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11386
+ <xsl:choose>
11387
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11388
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11389
+ </xsl:choose>
11390
+ </xsl:for-each>
11391
+ </fo:basic-link>
11392
+ </xsl:with-param>
11393
+ </xsl:call-template>
10886
11394
  </fo:block>
10887
11395
  </fo:table-cell>
10888
11396
  </xsl:for-each>
10889
11397
  <!-- last column - for page numbers -->
10890
11398
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10891
11399
  <fo:block>
10892
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10893
- <fo:page-number-citation ref-id="{$target}"/>
10894
- </fo:basic-link>
11400
+ <xsl:call-template name="insert_basic_link">
11401
+ <xsl:with-param name="element">
11402
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11403
+ <fo:page-number-citation ref-id="{$target}"/>
11404
+ </fo:basic-link>
11405
+ </xsl:with-param>
11406
+ </xsl:call-template>
10895
11407
  </fo:block>
10896
11408
  </fo:table-cell>
10897
11409
  </xsl:template>
@@ -10933,6 +11445,27 @@
10933
11445
  <!-- End Table of Contents (ToC) processing -->
10934
11446
  <!-- =================== -->
10935
11447
 
11448
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11449
+ <xsl:template name="insert_basic_link">
11450
+ <xsl:param name="element"/>
11451
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11452
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11453
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11454
+ <xsl:choose>
11455
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11456
+ <xsl:copy-of select="$element_node"/>
11457
+ </xsl:when>
11458
+ <xsl:otherwise>
11459
+ <fo:inline>
11460
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11461
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11462
+ </xsl:for-each>
11463
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11464
+ </fo:inline>
11465
+ </xsl:otherwise>
11466
+ </xsl:choose>
11467
+ </xsl:template>
11468
+
10936
11469
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10937
11470
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10938
11471
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -11165,6 +11698,9 @@
11165
11698
  </xsl:copy>
11166
11699
  </xsl:template>
11167
11700
 
11701
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
11702
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
11703
+
11168
11704
  <xsl:template name="add_id">
11169
11705
  <xsl:if test="not(@id)">
11170
11706
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -11449,6 +11985,14 @@
11449
11985
  <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">
11450
11986
  <xsl:variable name="p_fn_">
11451
11987
  <xsl:call-template name="get_fn_list"/>
11988
+ <!-- <xsl:choose>
11989
+ <xsl:when test="$namespace = 'jis'">
11990
+ <xsl:call-template name="get_fn_list_for_element"/>
11991
+ </xsl:when>
11992
+ <xsl:otherwise>
11993
+ <xsl:call-template name="get_fn_list"/>
11994
+ </xsl:otherwise>
11995
+ </xsl:choose> -->
11452
11996
  </xsl:variable>
11453
11997
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11454
11998
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -11463,8 +12007,14 @@
11463
12007
  <xsl:attribute name="current_fn_number">
11464
12008
  <xsl:value-of select="$current_fn_number"/>
11465
12009
  </xsl:attribute>
12010
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11466
12011
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
11467
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
12012
+
12013
+ <xsl:value-of select="$skip_footnote_body_"/>
12014
+
12015
+ </xsl:attribute>
12016
+ <xsl:attribute name="ref_id">
12017
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
11468
12018
  </xsl:attribute>
11469
12019
  <xsl:apply-templates select="node()" mode="linear_xml"/>
11470
12020
  </xsl:copy>