metanorma-iec 2.2.8 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -452,10 +452,10 @@
452
452
  </fo:block>
453
453
  <fo:block-container margin-left="1.5mm">
454
454
  <fo:block-container margin-left="0mm">
455
- <fo:block-container border="0.5pt solid black" font-size="10pt" margin-top="8mm" font-weight="bold" padding-left="1.5mm" padding-top="0.5mm" width="102%" height="11mm" display-align="center">
456
- <fo:block margin-left="2mm">Warning! Make sure that you obtained this publication from an authorized distributor.</fo:block>
455
+ <fo:block-container border="0.5pt solid black" font-size="10pt" margin-top="8mm" font-weight="bold" padding-left="1.5mm" padding-top="0.5mm" width="102%" height="11mm" display-align="center" id="__internal_layout__warning_block">
456
+ <fo:block margin-left="1mm">Warning! Make sure that you obtained this publication from an authorized distributor.</fo:block>
457
457
  <xsl:if test="//iec:iec-standard/iec:bibdata/iec:title[@language = 'fr']">
458
- <fo:block margin-left="2mm" margin-top="3pt">Attention! Veuillez vous assurer que vous avez obtenu cette publication via un distributeur agréé.</fo:block>
458
+ <fo:block margin-left="1mm" margin-top="3pt">Attention! Veuillez vous assurer que vous avez obtenu cette publication via un distributeur agréé.</fo:block>
459
459
  </xsl:if>
460
460
  </fo:block-container>
461
461
  </fo:block-container>
@@ -869,9 +869,9 @@
869
869
 
870
870
  <xsl:for-each select="xalan:nodeset($current_document)">
871
871
 
872
- <xsl:variable name="docid">
872
+ <!-- <xsl:variable name="docid">
873
873
  <xsl:call-template name="getDocumentId"/>
874
- </xsl:variable>
874
+ </xsl:variable> -->
875
875
 
876
876
  <fo:page-sequence master-reference="document" format="1" force-page-count="no-force"> <!-- initial-page-number="2" -->
877
877
 
@@ -883,17 +883,22 @@
883
883
  </xsl:if>
884
884
 
885
885
  <xsl:call-template name="insertHeaderFooter"/>
886
- <fo:flow flow-name="xsl-region-body">
886
+ <fo:flow flow-name="xsl-region-body">
887
+
888
+ <xsl:call-template name="processPrefaceSectionsDefault"/>
887
889
 
890
+ <!--
888
891
  <xsl:call-template name="insertTOCpages">
889
892
  <xsl:with-param name="contents" select="$contents/doc[@id = $docid]"/>
890
893
  </xsl:call-template>
891
-
894
+
892
895
  <xsl:call-template name="insertPrefacepages">
893
896
  <xsl:with-param name="lang" select="$lang"/>
894
897
  </xsl:call-template>
898
+ -->
895
899
 
896
- </fo:flow>
900
+ <fo:block/> <!-- for prevent empty preface -->
901
+ </fo:flow>
897
902
  </fo:page-sequence>
898
903
 
899
904
  <xsl:call-template name="insertBodypages">
@@ -1191,7 +1196,7 @@
1191
1196
 
1192
1197
  <xsl:template name="insertTOCpages">
1193
1198
  <xsl:param name="contents"/>
1194
- <fo:block-container>
1199
+ <!-- <fo:block-container>
1195
1200
  <fo:block role="TOC">
1196
1201
  <fo:block font-size="12pt" text-align="center" margin-bottom="22pt" role="H1">
1197
1202
  <xsl:variable name="title-toc">
@@ -1202,90 +1207,90 @@
1202
1207
  <xsl:call-template name="addLetterSpacing">
1203
1208
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($title-toc))"/>
1204
1209
  </xsl:call-template>
1205
- </fo:block>
1206
-
1207
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [@display = 'true']
1208
- [@level &lt;= 3]
1209
- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1210
- <fo:block text-align-last="justify" role="TOCI">
1211
- <xsl:if test="@level = 1">
1212
- <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1213
- </xsl:if>
1214
- <xsl:if test="@level = 2">
1215
- <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1216
- </xsl:if>
1217
- <xsl:if test="@level &gt;= 3">
1218
- <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1219
- </xsl:if>
1220
- <xsl:if test="@type = 'indexsect'">
1221
- <xsl:attribute name="space-before">16pt</xsl:attribute>
1222
- </xsl:if>
1223
- <xsl:if test="@type = 'references'">
1224
- <xsl:attribute name="space-before">5pt</xsl:attribute>
1225
- </xsl:if>
1226
-
1227
- <fo:list-block>
1228
- <xsl:attribute name="margin-left">
1229
- <xsl:choose>
1230
- <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1231
- <xsl:when test="@level = 2">8mm</xsl:when>
1232
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1233
- <xsl:otherwise>0mm</xsl:otherwise>
1234
- </xsl:choose>
1235
- </xsl:attribute>
1236
- <xsl:attribute name="provisional-distance-between-starts">
1237
- <xsl:choose>
1238
- <xsl:when test="@section = ''">0mm</xsl:when>
1239
- <xsl:when test="@level = 1">8mm</xsl:when>
1240
- <xsl:when test="@level = 2">15mm</xsl:when>
1241
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1242
- <xsl:otherwise>0mm</xsl:otherwise>
1243
- </xsl:choose>
1244
- </xsl:attribute>
1245
- <fo:list-item>
1246
- <fo:list-item-label end-indent="label-end()">
1247
- <fo:block>
1248
- <xsl:value-of select="@section"/>
1249
- </fo:block>
1250
- </fo:list-item-label>
1251
- <fo:list-item-body start-indent="body-start()">
1252
- <fo:block text-align-last="justify">
1253
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1254
- <xsl:variable name="title">
1255
- <xsl:apply-templates select="title"/>
1256
- </xsl:variable>
1257
- <xsl:call-template name="addLetterSpacing">
1258
- <xsl:with-param name="text" select="$title"/>
1259
- </xsl:call-template>
1260
- <xsl:text> </xsl:text>
1261
- <fo:inline keep-together.within-line="always">
1262
- <fo:leader leader-pattern="dots"/>
1263
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1264
- </fo:inline>
1265
- </fo:basic-link>
1266
- </fo:block>
1267
- </fo:list-item-body>
1268
- </fo:list-item>
1269
- </fo:list-block>
1270
- </fo:block>
1271
- </xsl:for-each>
1272
-
1273
- <xsl:if test="$contents//figures/figure">
1274
- <fo:block margin-bottom="5pt"> </fo:block>
1275
- <xsl:for-each select="$contents//figures/figure">
1276
- <xsl:call-template name="insertListOf_Item"/>
1277
- </xsl:for-each>
1210
+ </fo:block> -->
1211
+
1212
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [@display = 'true']
1213
+ [@level &lt;= 3]
1214
+ [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1215
+ <fo:block text-align-last="justify" role="TOCI">
1216
+ <xsl:if test="@level = 1">
1217
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1278
1218
  </xsl:if>
1279
-
1280
- <xsl:if test="$contents//tables/table">
1281
- <fo:block margin-bottom="5pt"> </fo:block>
1282
- <xsl:for-each select="$contents//tables/table">
1283
- <xsl:call-template name="insertListOf_Item"/>
1284
- </xsl:for-each>
1219
+ <xsl:if test="@level = 2">
1220
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1221
+ </xsl:if>
1222
+ <xsl:if test="@level &gt;= 3">
1223
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1224
+ </xsl:if>
1225
+ <xsl:if test="@type = 'indexsect'">
1226
+ <xsl:attribute name="space-before">16pt</xsl:attribute>
1227
+ </xsl:if>
1228
+ <xsl:if test="@type = 'references'">
1229
+ <xsl:attribute name="space-before">5pt</xsl:attribute>
1285
1230
  </xsl:if>
1286
1231
 
1232
+ <fo:list-block>
1233
+ <xsl:attribute name="margin-left">
1234
+ <xsl:choose>
1235
+ <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1236
+ <xsl:when test="@level = 2">8mm</xsl:when>
1237
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1238
+ <xsl:otherwise>0mm</xsl:otherwise>
1239
+ </xsl:choose>
1240
+ </xsl:attribute>
1241
+ <xsl:attribute name="provisional-distance-between-starts">
1242
+ <xsl:choose>
1243
+ <xsl:when test="@section = ''">0mm</xsl:when>
1244
+ <xsl:when test="@level = 1">8mm</xsl:when>
1245
+ <xsl:when test="@level = 2">15mm</xsl:when>
1246
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1247
+ <xsl:otherwise>0mm</xsl:otherwise>
1248
+ </xsl:choose>
1249
+ </xsl:attribute>
1250
+ <fo:list-item>
1251
+ <fo:list-item-label end-indent="label-end()">
1252
+ <fo:block>
1253
+ <xsl:value-of select="@section"/>
1254
+ </fo:block>
1255
+ </fo:list-item-label>
1256
+ <fo:list-item-body start-indent="body-start()">
1257
+ <fo:block text-align-last="justify">
1258
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1259
+ <xsl:variable name="title">
1260
+ <xsl:apply-templates select="title"/>
1261
+ </xsl:variable>
1262
+ <xsl:call-template name="addLetterSpacing">
1263
+ <xsl:with-param name="text" select="$title"/>
1264
+ </xsl:call-template>
1265
+ <xsl:text> </xsl:text>
1266
+ <fo:inline keep-together.within-line="always">
1267
+ <fo:leader leader-pattern="dots"/>
1268
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1269
+ </fo:inline>
1270
+ </fo:basic-link>
1271
+ </fo:block>
1272
+ </fo:list-item-body>
1273
+ </fo:list-item>
1274
+ </fo:list-block>
1287
1275
  </fo:block>
1288
- </fo:block-container>
1276
+ </xsl:for-each>
1277
+
1278
+ <xsl:if test="$contents//figures/figure">
1279
+ <fo:block margin-bottom="5pt"> </fo:block>
1280
+ <xsl:for-each select="$contents//figures/figure">
1281
+ <xsl:call-template name="insertListOf_Item"/>
1282
+ </xsl:for-each>
1283
+ </xsl:if>
1284
+
1285
+ <xsl:if test="$contents//tables/table">
1286
+ <fo:block margin-bottom="5pt"> </fo:block>
1287
+ <xsl:for-each select="$contents//tables/table">
1288
+ <xsl:call-template name="insertListOf_Item"/>
1289
+ </xsl:for-each>
1290
+ </xsl:if>
1291
+
1292
+ <!-- </fo:block>
1293
+ </fo:block-container> -->
1289
1294
  </xsl:template>
1290
1295
 
1291
1296
  <xsl:template name="insertListOf_Item">
@@ -1300,6 +1305,49 @@
1300
1305
  </fo:block>
1301
1306
  </xsl:template>
1302
1307
 
1308
+ <xsl:template match="iec:preface/iec:clause[@type = 'toc']" priority="3">
1309
+ <fo:block-container>
1310
+ <fo:block role="TOC">
1311
+ <xsl:apply-templates/>
1312
+
1313
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1314
+ <xsl:variable name="docid">
1315
+ <xsl:call-template name="getDocumentId"/>
1316
+ </xsl:variable>
1317
+ <xsl:call-template name="insertTOCpages">
1318
+ <xsl:with-param name="contents" select="$contents/doc[@id = $docid]"/>
1319
+ </xsl:call-template>
1320
+ </xsl:if>
1321
+ </fo:block>
1322
+ </fo:block-container>
1323
+ </xsl:template>
1324
+
1325
+ <xsl:template match="iec:preface/iec:clause[@type = 'toc']/iec:title" priority="3">
1326
+ <fo:block font-size="12pt" text-align="center" margin-bottom="22pt" role="H1">
1327
+ <xsl:call-template name="addLetterSpacing">
1328
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/>
1329
+ </xsl:call-template>
1330
+ </fo:block>
1331
+ </xsl:template>
1332
+
1333
+ <xsl:template match="iec:preface/iec:pagebreak" priority="3">
1334
+ <fo:block break-after="page"/>
1335
+ </xsl:template>
1336
+
1337
+ <xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/iec:p[starts-with(@class, 'zzSTDTitle')]" priority="3">
1338
+ <fo:block-container font-size="12pt" text-align="center">
1339
+ <xsl:if test="following-sibling::*[1][not(self::iec:p[starts-with(@class, 'zzSTDTitle')])]">
1340
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1341
+ </xsl:if>
1342
+ <fo:block>
1343
+ <xsl:if test="iec:strong"> <!-- title -->
1344
+ <xsl:attribute name="role">H1</xsl:attribute>
1345
+ </xsl:if>
1346
+ <xsl:apply-templates/>
1347
+ </fo:block>
1348
+ </fo:block-container>
1349
+ </xsl:template>
1350
+
1303
1351
  <xsl:template name="insertPrefacepages">
1304
1352
  <xsl:param name="lang" select="$lang"/>
1305
1353
  <fo:block break-after="page"/>
@@ -1622,14 +1670,21 @@
1622
1670
  <xsl:with-param name="text" select="iec:title"/>
1623
1671
  </xsl:call-template>
1624
1672
  </fo:block>
1625
- <fo:block font-size="8.2pt" text-align="justify"> <!-- margin-left="6.3mm" -->
1673
+ <!-- margin-left="6.3mm" -->
1674
+ <!-- <fo:block font-size="8.2pt" text-align="justify">
1626
1675
  <xsl:apply-templates select="/iec:iec-standard/iec:boilerplate/iec:legal-statement/*"/>
1627
- </fo:block>
1676
+ </fo:block> -->
1628
1677
  <fo:block>
1629
1678
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1630
1679
  </fo:block>
1631
1680
  </xsl:template>
1632
1681
 
1682
+ <xsl:template match="iec:clause[@type = 'boilerplate_legal']" priority="3">
1683
+ <fo:block font-size="8.2pt" text-align="justify">
1684
+ <xsl:apply-templates/>
1685
+ </fo:block>
1686
+ </xsl:template>
1687
+
1633
1688
  <xsl:template match="iec:annex//iec:clause" priority="2">
1634
1689
  <fo:block id="{@id}" margin-top="5pt" margin-bottom="10pt" text-align="justify">
1635
1690
  <xsl:apply-templates/>
@@ -1806,7 +1861,7 @@
1806
1861
  <xsl:if test="ancestor::iec:ul">
1807
1862
  <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1808
1863
  </xsl:if>
1809
- <xsl:if test="ancestor::iec:legal-statement">
1864
+ <xsl:if test="ancestor::iec:legal-statement or ancestor::iec:clause[@type = 'boilerplate_legal']">
1810
1865
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1811
1866
  </xsl:if>
1812
1867
  <xsl:apply-templates/>
@@ -1844,14 +1899,18 @@
1844
1899
  </xsl:template>
1845
1900
 
1846
1901
  <xsl:template match="iec:xref[@pagenumber = 'true']" priority="2">
1847
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
1848
- <fo:inline>
1849
- <xsl:if test="@id">
1850
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1851
- </xsl:if>
1852
- <fo:page-number-citation ref-id="{@target}"/>
1853
- </fo:inline>
1854
- </fo:basic-link>
1902
+ <xsl:call-template name="insert_basic_link">
1903
+ <xsl:with-param name="element">
1904
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
1905
+ <fo:inline>
1906
+ <xsl:if test="@id">
1907
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1908
+ </xsl:if>
1909
+ <fo:page-number-citation ref-id="{@target}"/>
1910
+ </fo:inline>
1911
+ </fo:basic-link>
1912
+ </xsl:with-param>
1913
+ </xsl:call-template>
1855
1914
  </xsl:template>
1856
1915
 
1857
1916
  <!-- =================== -->
@@ -2430,6 +2489,14 @@
2430
2489
 
2431
2490
  </xsl:attribute-set>
2432
2491
 
2492
+ <xsl:template name="refine_link-style">
2493
+
2494
+ <xsl:if test="ancestor::*[local-name()='feedback-statement' or local-name() = 'copyright-statement']">
2495
+ <xsl:attribute name="color">blue</xsl:attribute>
2496
+ </xsl:if>
2497
+
2498
+ </xsl:template> <!-- refine_link-style -->
2499
+
2433
2500
  <xsl:attribute-set name="sourcecode-container-style">
2434
2501
 
2435
2502
  </xsl:attribute-set>
@@ -2445,6 +2512,10 @@
2445
2512
 
2446
2513
  </xsl:attribute-set>
2447
2514
 
2515
+ <xsl:template name="refine_sourcecode-style">
2516
+
2517
+ </xsl:template> <!-- refine_sourcecode-style -->
2518
+
2448
2519
  <xsl:attribute-set name="pre-style">
2449
2520
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2450
2521
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2529,6 +2600,10 @@
2529
2600
 
2530
2601
  </xsl:attribute-set> <!-- example-style -->
2531
2602
 
2603
+ <xsl:template name="refine_example-style">
2604
+
2605
+ </xsl:template> <!-- refine_example-style -->
2606
+
2532
2607
  <xsl:attribute-set name="example-body-style">
2533
2608
 
2534
2609
  <xsl:attribute name="margin-left">10mm</xsl:attribute>
@@ -2548,6 +2623,10 @@
2548
2623
 
2549
2624
  </xsl:attribute-set> <!-- example-p-style -->
2550
2625
 
2626
+ <xsl:template name="refine_example-p-style">
2627
+
2628
+ </xsl:template> <!-- refine_example-p-style -->
2629
+
2551
2630
  <xsl:attribute-set name="termexample-name-style">
2552
2631
 
2553
2632
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -2576,6 +2655,19 @@
2576
2655
 
2577
2656
  </xsl:attribute-set> <!-- table-container-style -->
2578
2657
 
2658
+ <xsl:template name="refine_table-container-style">
2659
+ <xsl:param name="margin-side"/>
2660
+
2661
+ <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2662
+ <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2663
+
2664
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
2665
+ <xsl:attribute name="space-after">16pt</xsl:attribute>
2666
+ </xsl:if>
2667
+
2668
+ <!-- end table block-container attributes -->
2669
+ </xsl:template> <!-- refine_table-container-style -->
2670
+
2579
2671
  <xsl:attribute-set name="table-style">
2580
2672
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2581
2673
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -2584,6 +2676,18 @@
2584
2676
 
2585
2677
  </xsl:attribute-set><!-- table-style -->
2586
2678
 
2679
+ <xsl:template name="refine_table-style">
2680
+ <xsl:param name="margin-side"/>
2681
+
2682
+ <xsl:if test="$margin-side != 0">
2683
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2684
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2685
+ </xsl:if>
2686
+
2687
+ <xsl:call-template name="setBordersTableArray"/>
2688
+
2689
+ </xsl:template> <!-- refine_table-style -->
2690
+
2587
2691
  <xsl:attribute-set name="table-name-style">
2588
2692
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2589
2693
 
@@ -2595,6 +2699,16 @@
2595
2699
 
2596
2700
  </xsl:attribute-set> <!-- table-name-style -->
2597
2701
 
2702
+ <xsl:template name="refine_table-name-style">
2703
+ <xsl:param name="continued"/>
2704
+
2705
+ <xsl:if test="$continued = 'true'">
2706
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2707
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2708
+ </xsl:if>
2709
+
2710
+ </xsl:template> <!-- refine_table-name-style -->
2711
+
2598
2712
  <xsl:attribute-set name="table-row-style">
2599
2713
  <xsl:attribute name="min-height">4mm</xsl:attribute>
2600
2714
 
@@ -2608,6 +2722,12 @@
2608
2722
 
2609
2723
  </xsl:attribute-set>
2610
2724
 
2725
+ <xsl:template name="refine_table-header-row-style">
2726
+
2727
+ <xsl:call-template name="setBordersTableArray"/>
2728
+
2729
+ </xsl:template> <!-- refine_table-header-row-style -->
2730
+
2611
2731
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
2612
2732
 
2613
2733
  <xsl:attribute name="border-left">solid black 0.5pt</xsl:attribute>
@@ -2615,10 +2735,20 @@
2615
2735
 
2616
2736
  </xsl:attribute-set>
2617
2737
 
2738
+ <xsl:template name="refine_table-footer-row-style">
2739
+
2740
+ </xsl:template> <!-- refine_table-footer-row-style -->
2741
+
2618
2742
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
2619
2743
 
2620
2744
  </xsl:attribute-set>
2621
2745
 
2746
+ <xsl:template name="refine_table-body-row-style">
2747
+
2748
+ <xsl:call-template name="setBordersTableArray"/>
2749
+
2750
+ </xsl:template> <!-- refine_table-body-row-style -->
2751
+
2622
2752
  <xsl:attribute-set name="table-header-cell-style">
2623
2753
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2624
2754
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2631,6 +2761,23 @@
2631
2761
 
2632
2762
  </xsl:attribute-set> <!-- table-header-cell-style -->
2633
2763
 
2764
+ <xsl:template name="refine_table-header-cell-style">
2765
+
2766
+ <xsl:attribute name="text-align">center</xsl:attribute>
2767
+ <xsl:if test="ancestor::*[local-name()='preface']">
2768
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2769
+ </xsl:if>
2770
+
2771
+ <xsl:call-template name="setBordersTableArray"/>
2772
+
2773
+ <xsl:if test="$lang = 'ar'">
2774
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2775
+ </xsl:if>
2776
+
2777
+ <xsl:call-template name="setTableCellAttributes"/>
2778
+
2779
+ </xsl:template> <!-- refine_table-header-cell-style -->
2780
+
2634
2781
  <xsl:attribute-set name="table-cell-style">
2635
2782
  <xsl:attribute name="display-align">center</xsl:attribute>
2636
2783
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2641,6 +2788,22 @@
2641
2788
 
2642
2789
  </xsl:attribute-set> <!-- table-cell-style -->
2643
2790
 
2791
+ <xsl:template name="refine_table-cell-style">
2792
+
2793
+ <xsl:if test="$lang = 'ar'">
2794
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2795
+ </xsl:if>
2796
+
2797
+ <!-- bsi -->
2798
+
2799
+ <xsl:if test="ancestor::*[local-name()='preface']">
2800
+ <xsl:attribute name="text-align">center</xsl:attribute>
2801
+ </xsl:if>
2802
+
2803
+ <xsl:call-template name="setBordersTableArray"/>
2804
+
2805
+ </xsl:template> <!-- refine_table-cell-style -->
2806
+
2644
2807
  <xsl:attribute-set name="table-footer-cell-style">
2645
2808
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
2646
2809
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -2651,6 +2814,10 @@
2651
2814
 
2652
2815
  </xsl:attribute-set> <!-- table-footer-cell-style -->
2653
2816
 
2817
+ <xsl:template name="refine_table-footer-cell-style">
2818
+
2819
+ </xsl:template> <!-- refine_table-footer-cell-style -->
2820
+
2654
2821
  <xsl:attribute-set name="table-note-style">
2655
2822
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2656
2823
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2660,6 +2827,10 @@
2660
2827
 
2661
2828
  </xsl:attribute-set><!-- table-note-style -->
2662
2829
 
2830
+ <xsl:template name="refine_table-note-style">
2831
+
2832
+ </xsl:template> <!-- refine_table-note-style -->
2833
+
2663
2834
  <xsl:attribute-set name="table-fn-style">
2664
2835
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2665
2836
 
@@ -2726,11 +2897,19 @@
2726
2897
 
2727
2898
  </xsl:attribute-set>
2728
2899
 
2900
+ <xsl:template name="refine_dt-cell-style">
2901
+
2902
+ </xsl:template> <!-- refine_dt-cell-style -->
2903
+
2729
2904
  <xsl:attribute-set name="dt-block-style">
2730
2905
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
2731
2906
 
2732
2907
  </xsl:attribute-set>
2733
2908
 
2909
+ <xsl:template name="refine_dt-block-style">
2910
+
2911
+ </xsl:template> <!-- refine_dt-block-style -->
2912
+
2734
2913
  <xsl:attribute-set name="dl-name-style">
2735
2914
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2736
2915
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -2744,6 +2923,10 @@
2744
2923
 
2745
2924
  </xsl:attribute-set>
2746
2925
 
2926
+ <xsl:template name="refine_dd-cell-style">
2927
+
2928
+ </xsl:template> <!-- refine_dd-cell-style -->
2929
+
2747
2930
  <!-- ========================== -->
2748
2931
  <!-- END Definition's list styles -->
2749
2932
  <!-- ========================== -->
@@ -2771,6 +2954,12 @@
2771
2954
 
2772
2955
  </xsl:attribute-set>
2773
2956
 
2957
+ <xsl:template name="refine_eref-style">
2958
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
2959
+ <xsl:variable name="text" select="normalize-space()"/>
2960
+
2961
+ </xsl:template> <!-- refine_eref-style -->
2962
+
2774
2963
  <xsl:attribute-set name="note-style">
2775
2964
 
2776
2965
  <xsl:attribute name="font-size">8pt</xsl:attribute>
@@ -2779,6 +2968,10 @@
2779
2968
 
2780
2969
  </xsl:attribute-set>
2781
2970
 
2971
+ <xsl:template name="refine_note-style">
2972
+
2973
+ </xsl:template>
2974
+
2782
2975
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
2783
2976
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
2784
2977
 
@@ -2788,11 +2981,19 @@
2788
2981
 
2789
2982
  </xsl:attribute-set>
2790
2983
 
2984
+ <xsl:template name="refine_note-name-style">
2985
+
2986
+ </xsl:template> <!-- refine_note-name-style -->
2987
+
2791
2988
  <xsl:attribute-set name="table-note-name-style">
2792
2989
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
2793
2990
 
2794
2991
  </xsl:attribute-set>
2795
2992
 
2993
+ <xsl:template name="refine_table-note-name-style">
2994
+
2995
+ </xsl:template> <!-- refine_table-note-name-style -->
2996
+
2796
2997
  <xsl:attribute-set name="note-p-style">
2797
2998
 
2798
2999
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
@@ -2807,10 +3008,18 @@
2807
3008
 
2808
3009
  </xsl:attribute-set>
2809
3010
 
3011
+ <xsl:template name="refine_termnote-style">
3012
+
3013
+ </xsl:template> <!-- refine_termnote-style -->
3014
+
2810
3015
  <xsl:attribute-set name="termnote-name-style">
2811
3016
 
2812
3017
  </xsl:attribute-set>
2813
3018
 
3019
+ <xsl:template name="refine_termnote-name-style">
3020
+
3021
+ </xsl:template>
3022
+
2814
3023
  <xsl:attribute-set name="termnote-p-style">
2815
3024
 
2816
3025
  </xsl:attribute-set>
@@ -2824,6 +3033,10 @@
2824
3033
 
2825
3034
  </xsl:attribute-set>
2826
3035
 
3036
+ <xsl:template name="refine_quote-style">
3037
+
3038
+ </xsl:template>
3039
+
2827
3040
  <xsl:attribute-set name="quote-source-style">
2828
3041
  <xsl:attribute name="text-align">right</xsl:attribute>
2829
3042
 
@@ -2840,6 +3053,10 @@
2840
3053
 
2841
3054
  </xsl:attribute-set>
2842
3055
 
3056
+ <xsl:template name="refine_termsource-style">
3057
+
3058
+ </xsl:template> <!-- refine_termsource-style -->
3059
+
2843
3060
  <xsl:attribute-set name="termsource-text-style">
2844
3061
 
2845
3062
  </xsl:attribute-set>
@@ -2878,6 +3095,10 @@
2878
3095
 
2879
3096
  </xsl:attribute-set>
2880
3097
 
3098
+ <xsl:template name="refine_figure-name-style">
3099
+
3100
+ </xsl:template> <!-- refine_figure-name-style -->
3101
+
2881
3102
  <xsl:attribute-set name="figure-source-style">
2882
3103
 
2883
3104
  <xsl:attribute name="font-size">6pt</xsl:attribute>
@@ -2898,6 +3119,10 @@
2898
3119
 
2899
3120
  </xsl:attribute-set> <!-- formula-stem-block-style -->
2900
3121
 
3122
+ <xsl:template name="refine_formula-stem-block-style">
3123
+
3124
+ </xsl:template> <!-- refine_formula-stem-block-style -->
3125
+
2901
3126
  <xsl:attribute-set name="formula-stem-number-style">
2902
3127
  <xsl:attribute name="text-align">right</xsl:attribute>
2903
3128
 
@@ -2911,6 +3136,10 @@
2911
3136
 
2912
3137
  </xsl:attribute-set>
2913
3138
 
3139
+ <xsl:template name="refine_image-style">
3140
+
3141
+ </xsl:template>
3142
+
2914
3143
  <xsl:attribute-set name="figure-pseudocode-p-style">
2915
3144
 
2916
3145
  </xsl:attribute-set>
@@ -3009,6 +3238,10 @@
3009
3238
 
3010
3239
  </xsl:attribute-set>
3011
3240
 
3241
+ <xsl:template name="refine_mathml-style">
3242
+
3243
+ </xsl:template>
3244
+
3012
3245
  <xsl:attribute-set name="list-style">
3013
3246
 
3014
3247
  <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
@@ -3016,6 +3249,14 @@
3016
3249
 
3017
3250
  </xsl:attribute-set> <!-- list-style -->
3018
3251
 
3252
+ <xsl:template name="refine_list-style">
3253
+
3254
+ <xsl:if test="ancestor::iec:ul or ancestor::iec:ol">
3255
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3256
+ </xsl:if>
3257
+
3258
+ </xsl:template> <!-- refine_list-style -->
3259
+
3019
3260
  <xsl:attribute-set name="list-name-style">
3020
3261
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3021
3262
 
@@ -3027,14 +3268,26 @@
3027
3268
 
3028
3269
  </xsl:attribute-set>
3029
3270
 
3271
+ <xsl:template name="refine_list-item-style">
3272
+
3273
+ </xsl:template> <!-- refine_list-item-style -->
3274
+
3030
3275
  <xsl:attribute-set name="list-item-label-style">
3031
3276
 
3032
3277
  </xsl:attribute-set>
3033
3278
 
3279
+ <xsl:template name="refine_list-item-label-style">
3280
+
3281
+ </xsl:template> <!-- refine_list-item-label-style -->
3282
+
3034
3283
  <xsl:attribute-set name="list-item-body-style">
3035
3284
 
3036
3285
  </xsl:attribute-set>
3037
3286
 
3287
+ <xsl:template name="refine_list-item-body-style">
3288
+
3289
+ </xsl:template> <!-- refine_list-item-body-style -->
3290
+
3038
3291
  <xsl:attribute-set name="toc-style">
3039
3292
  <xsl:attribute name="line-height">135%</xsl:attribute>
3040
3293
  </xsl:attribute-set>
@@ -3045,6 +3298,15 @@
3045
3298
 
3046
3299
  </xsl:attribute-set>
3047
3300
 
3301
+ <xsl:template name="refine_fn-reference-style">
3302
+
3303
+ <xsl:if test="ancestor::*[local-name()='table']">
3304
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
3305
+ <xsl:attribute name="baseline-shift">15%</xsl:attribute>
3306
+ </xsl:if>
3307
+
3308
+ </xsl:template> <!-- refine_fn-reference-style -->
3309
+
3048
3310
  <xsl:attribute-set name="fn-style">
3049
3311
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3050
3312
  </xsl:attribute-set>
@@ -3068,6 +3330,10 @@
3068
3330
 
3069
3331
  </xsl:attribute-set>
3070
3332
 
3333
+ <xsl:template name="refine_fn-body-style">
3334
+
3335
+ </xsl:template> <!-- refine_fn-body-style -->
3336
+
3071
3337
  <xsl:attribute-set name="fn-body-num-style">
3072
3338
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
3073
3339
 
@@ -3076,6 +3342,10 @@
3076
3342
 
3077
3343
  </xsl:attribute-set> <!-- fn-body-num-style -->
3078
3344
 
3345
+ <xsl:template name="refine_fn-body-num-style">
3346
+
3347
+ </xsl:template> <!-- refine_fn-body-num-style -->
3348
+
3079
3349
  <!-- admonition -->
3080
3350
  <xsl:attribute-set name="admonition-style">
3081
3351
 
@@ -3739,14 +4009,9 @@
3739
4009
 
3740
4010
  <fo:block-container xsl:use-attribute-sets="table-container-style">
3741
4011
 
3742
- <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
3743
- <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
3744
-
3745
- <xsl:if test="ancestor::*[local-name() = 'preface']">
3746
- <xsl:attribute name="space-after">16pt</xsl:attribute>
3747
- </xsl:if>
3748
-
3749
- <!-- end table block-container attributes -->
4012
+ <xsl:call-template name="refine_table-container-style">
4013
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4014
+ </xsl:call-template>
3750
4015
 
3751
4016
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
3752
4017
 
@@ -3767,12 +4032,9 @@
3767
4032
 
3768
4033
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3769
4034
 
3770
- <xsl:if test="$margin-side != 0">
3771
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
3772
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
3773
- </xsl:if>
3774
-
3775
- <xsl:call-template name="setBordersTableArray"/>
4035
+ <xsl:call-template name="refine_table-style">
4036
+ <xsl:with-param name="margin-side" select="$margin-side"/>
4037
+ </xsl:call-template>
3776
4038
 
3777
4039
  </xsl:element>
3778
4040
  </xsl:variable>
@@ -3838,7 +4100,7 @@
3838
4100
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3839
4101
  </xsl:when>
3840
4102
  <xsl:otherwise>
3841
- <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 -->
4103
+ <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 -->
3842
4104
  </xsl:otherwise>
3843
4105
  </xsl:choose>
3844
4106
 
@@ -3933,10 +4195,9 @@
3933
4195
 
3934
4196
  <fo:block xsl:use-attribute-sets="table-name-style">
3935
4197
 
3936
- <xsl:if test="$continued = 'true'">
3937
- <xsl:attribute name="font-size">10pt</xsl:attribute>
3938
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3939
- </xsl:if>
4198
+ <xsl:call-template name="refine_table-name-style">
4199
+ <xsl:with-param name="continued" select="$continued"/>
4200
+ </xsl:call-template>
3940
4201
 
3941
4202
  <xsl:choose>
3942
4203
  <xsl:when test="$continued = 'true'">
@@ -4334,10 +4595,7 @@
4334
4595
  <fo:table-row>
4335
4596
  <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">
4336
4597
 
4337
- <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4338
- <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4339
- <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4340
- <xsl:attribute name="border-bottom">none</xsl:attribute>
4598
+ <xsl:call-template name="refine_table-header-title-style"/>
4341
4599
 
4342
4600
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4343
4601
  <xsl:with-param name="continued">true</xsl:with-param>
@@ -4351,6 +4609,15 @@
4351
4609
  </fo:table-row>
4352
4610
  </xsl:template> <!-- table-header-title -->
4353
4611
 
4612
+ <xsl:template name="refine_table-header-title-style">
4613
+
4614
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4615
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4616
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4617
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
4618
+
4619
+ </xsl:template> <!-- refine_table-header-title-style -->
4620
+
4354
4621
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
4355
4622
  <fo:table-body>
4356
4623
  <xsl:apply-templates/>
@@ -4375,7 +4642,7 @@
4375
4642
  <xsl:param name="colwidths"/>
4376
4643
  <xsl:param name="colgroup"/>
4377
4644
 
4378
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4645
+ <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']"/>
4379
4646
 
4380
4647
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4381
4648
 
@@ -4435,6 +4702,8 @@
4435
4702
  <fo:table-row>
4436
4703
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4437
4704
 
4705
+ <xsl:call-template name="refine_table-footer-cell-style"/>
4706
+
4438
4707
  <xsl:call-template name="setBordersTableArray"/>
4439
4708
 
4440
4709
  <!-- fn will be processed inside 'note' processing -->
@@ -4447,6 +4716,7 @@
4447
4716
 
4448
4717
  <!-- except gb and bsi -->
4449
4718
 
4719
+ <xsl:apply-templates select="../*[local-name()='p']"/>
4450
4720
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4451
4721
  <xsl:apply-templates select="../*[local-name()='note']"/>
4452
4722
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -4623,7 +4893,7 @@
4623
4893
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4624
4894
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4625
4895
 
4626
- <xsl:call-template name="setBordersTableArray"/>
4896
+ <xsl:call-template name="refine_table-header-row-style"/>
4627
4897
 
4628
4898
  <xsl:call-template name="setTableRowAttributes"/>
4629
4899
 
@@ -4657,6 +4927,8 @@
4657
4927
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4658
4928
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4659
4929
 
4930
+ <xsl:call-template name="refine_table-footer-row-style"/>
4931
+
4660
4932
  <xsl:call-template name="setTableRowAttributes"/>
4661
4933
  <xsl:apply-templates/>
4662
4934
  </fo:table-row>
@@ -4670,9 +4942,10 @@
4670
4942
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4671
4943
  </xsl:if>
4672
4944
 
4673
- <xsl:call-template name="setBordersTableArray"/>
4945
+ <xsl:call-template name="refine_table-body-row-style"/>
4674
4946
 
4675
4947
  <xsl:call-template name="setTableRowAttributes"/>
4948
+
4676
4949
  <xsl:apply-templates/>
4677
4950
  </fo:table-row>
4678
4951
  </xsl:template>
@@ -4691,18 +4964,7 @@
4691
4964
  <xsl:with-param name="default">center</xsl:with-param>
4692
4965
  </xsl:call-template>
4693
4966
 
4694
- <xsl:attribute name="text-align">center</xsl:attribute>
4695
- <xsl:if test="ancestor::*[local-name()='preface']">
4696
- <xsl:attribute name="font-weight">normal</xsl:attribute>
4697
- </xsl:if>
4698
-
4699
- <xsl:call-template name="setBordersTableArray"/>
4700
-
4701
- <xsl:if test="$lang = 'ar'">
4702
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4703
- </xsl:if>
4704
-
4705
- <xsl:call-template name="setTableCellAttributes"/>
4967
+ <xsl:call-template name="refine_table-header-cell-style"/>
4706
4968
 
4707
4969
  <fo:block>
4708
4970
  <xsl:apply-templates/>
@@ -4744,17 +5006,7 @@
4744
5006
  <xsl:with-param name="default">left</xsl:with-param>
4745
5007
  </xsl:call-template>
4746
5008
 
4747
- <xsl:if test="$lang = 'ar'">
4748
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
4749
- </xsl:if>
4750
-
4751
- <!-- bsi -->
4752
-
4753
- <xsl:if test="ancestor::*[local-name()='preface']">
4754
- <xsl:attribute name="text-align">center</xsl:attribute>
4755
- </xsl:if>
4756
-
4757
- <xsl:call-template name="setBordersTableArray"/>
5009
+ <xsl:call-template name="refine_table-cell-style"/>
4758
5010
 
4759
5011
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4760
5012
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -4785,9 +5037,13 @@
4785
5037
 
4786
5038
  <fo:block xsl:use-attribute-sets="table-note-style">
4787
5039
 
5040
+ <xsl:call-template name="refine_table-note-style"/>
5041
+
4788
5042
  <!-- Table's note name (NOTE, for example) -->
4789
5043
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
4790
5044
 
5045
+ <xsl:call-template name="refine_table-note-name-style"/>
5046
+
4791
5047
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4792
5048
 
4793
5049
  </fo:inline>
@@ -4815,6 +5071,14 @@
4815
5071
  <!-- list of footnotes to calculate actual footnotes number -->
4816
5072
  <xsl:variable name="p_fn_">
4817
5073
  <xsl:call-template name="get_fn_list"/>
5074
+ <!-- <xsl:choose>
5075
+ <xsl:when test="$namespace = 'jis'">
5076
+ <xsl:call-template name="get_fn_list_for_element"/>
5077
+ </xsl:when>
5078
+ <xsl:otherwise>
5079
+ <xsl:call-template name="get_fn_list"/>
5080
+ </xsl:otherwise>
5081
+ </xsl:choose> -->
4818
5082
  </xsl:variable>
4819
5083
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4820
5084
 
@@ -4839,7 +5103,14 @@
4839
5103
 
4840
5104
  </xsl:variable>
4841
5105
 
4842
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5106
+ <xsl:variable name="ref_id">
5107
+ <xsl:choose>
5108
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
5109
+ <xsl:otherwise>
5110
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5111
+ </xsl:otherwise>
5112
+ </xsl:choose>
5113
+ </xsl:variable>
4843
5114
  <xsl:variable name="footnote_inline">
4844
5115
  <fo:inline>
4845
5116
 
@@ -4862,9 +5133,13 @@
4862
5133
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4863
5134
  </xsl:if>
4864
5135
 
4865
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4866
- <xsl:value-of select="$current_fn_number_text"/>
4867
- </fo:basic-link>
5136
+ <xsl:call-template name="insert_basic_link">
5137
+ <xsl:with-param name="element">
5138
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5139
+ <xsl:copy-of select="$current_fn_number_text"/>
5140
+ </fo:basic-link>
5141
+ </xsl:with-param>
5142
+ </xsl:call-template>
4868
5143
  </fo:inline>
4869
5144
  </xsl:variable>
4870
5145
 
@@ -4881,8 +5156,12 @@
4881
5156
 
4882
5157
  <fo:block xsl:use-attribute-sets="fn-body-style">
4883
5158
 
5159
+ <xsl:call-template name="refine_fn-body-style"/>
5160
+
4884
5161
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
4885
5162
 
5163
+ <xsl:call-template name="refine_fn-body-num-style"/>
5164
+
4886
5165
  <xsl:value-of select="$current_fn_number_text"/>
4887
5166
  </fo:inline>
4888
5167
  <xsl:apply-templates/>
@@ -4934,6 +5213,28 @@
4934
5213
  </xsl:choose>
4935
5214
  </xsl:template>
4936
5215
 
5216
+ <xsl:template name="get_fn_list_for_element">
5217
+ <xsl:choose>
5218
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
5219
+ <fn gen_id="{generate-id(.)}">
5220
+ <xsl:copy-of select="@*"/>
5221
+ <xsl:copy-of select="node()"/>
5222
+ </fn>
5223
+ </xsl:when>
5224
+ <xsl:otherwise>
5225
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
5226
+ <xsl:variable name="element_id" select="@id"/>
5227
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5228
+ <!-- copy unique fn -->
5229
+ <fn gen_id="{generate-id(.)}">
5230
+ <xsl:copy-of select="@*"/>
5231
+ <xsl:copy-of select="node()"/>
5232
+ </fn>
5233
+ </xsl:for-each>
5234
+ </xsl:for-each>
5235
+ </xsl:otherwise>
5236
+ </xsl:choose>
5237
+ </xsl:template>
4937
5238
  <!-- ============================ -->
4938
5239
  <!-- table's footnotes rendering -->
4939
5240
  <!-- ============================ -->
@@ -5108,10 +5409,7 @@
5108
5409
  <xsl:template match="*[local-name()='fn']">
5109
5410
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5110
5411
 
5111
- <xsl:if test="ancestor::*[local-name()='table']">
5112
- <xsl:attribute name="font-weight">normal</xsl:attribute>
5113
- <xsl:attribute name="baseline-shift">15%</xsl:attribute>
5114
- </xsl:if>
5412
+ <xsl:call-template name="refine_fn-reference-style"/>
5115
5413
 
5116
5414
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5117
5415
 
@@ -5210,14 +5508,14 @@
5210
5508
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5211
5509
 
5212
5510
  <xsl:text> </xsl:text>
5213
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5511
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5214
5512
  </fo:block>
5215
5513
 
5216
5514
  </xsl:when> <!-- END: only one component -->
5217
5515
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
5218
5516
  <fo:block margin-bottom="12pt" text-align="left">
5219
5517
 
5220
- <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
5518
+ <xsl:call-template name="refine_dl_formula_where_style"/>
5221
5519
 
5222
5520
  <!-- <xsl:variable name="title-where">
5223
5521
  <xsl:call-template name="getLocalizedString">
@@ -5232,8 +5530,7 @@
5232
5530
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5233
5531
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5234
5532
 
5235
- <xsl:attribute name="font-size">8pt</xsl:attribute>
5236
- <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
5533
+ <xsl:call-template name="refine_figure_key_style"/>
5237
5534
 
5238
5535
  <xsl:variable name="title-key">
5239
5536
  <xsl:call-template name="getLocalizedString">
@@ -5249,12 +5546,16 @@
5249
5546
  <xsl:if test="$onlyOneComponent = 'false'">
5250
5547
  <fo:block>
5251
5548
 
5549
+ <xsl:call-template name="refine_multicomponent_style"/>
5550
+
5252
5551
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
5253
5552
  <xsl:attribute name="margin-top">0</xsl:attribute>
5254
5553
  </xsl:if>
5255
5554
 
5256
5555
  <fo:block>
5257
5556
 
5557
+ <xsl:call-template name="refine_multicomponent_block_style"/>
5558
+
5258
5559
  <xsl:apply-templates select="*[local-name() = 'name']">
5259
5560
  <xsl:with-param name="process">true</xsl:with-param>
5260
5561
  </xsl:apply-templates>
@@ -5414,6 +5715,29 @@
5414
5715
 
5415
5716
  </xsl:template> <!-- END: dl -->
5416
5717
 
5718
+ <xsl:template name="refine_dl_formula_where_style">
5719
+
5720
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
5721
+
5722
+ </xsl:template> <!-- refine_dl_formula_where_style -->
5723
+
5724
+ <xsl:template name="refine_figure_key_style">
5725
+
5726
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
5727
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
5728
+
5729
+ </xsl:template> <!-- refine_figure_key_style -->
5730
+
5731
+ <xsl:template name="refine_multicomponent_style">
5732
+ <xsl:variable name="parent" select="local-name(..)"/>
5733
+
5734
+ </xsl:template> <!-- refine_multicomponent_style -->
5735
+
5736
+ <xsl:template name="refine_multicomponent_block_style">
5737
+ <xsl:variable name="parent" select="local-name(..)"/>
5738
+
5739
+ </xsl:template> <!-- refine_multicomponent_block_style -->
5740
+
5417
5741
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5418
5742
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5419
5743
 
@@ -5633,6 +5957,8 @@
5633
5957
 
5634
5958
  </xsl:if>
5635
5959
 
5960
+ <xsl:call-template name="refine_dt-cell-style"/>
5961
+
5636
5962
  <fo:block xsl:use-attribute-sets="dt-block-style">
5637
5963
  <xsl:copy-of select="@id"/>
5638
5964
 
@@ -5640,6 +5966,8 @@
5640
5966
  <xsl:attribute name="margin-top">0</xsl:attribute>
5641
5967
  </xsl:if>
5642
5968
 
5969
+ <xsl:call-template name="refine_dt-block-style"/>
5970
+
5643
5971
  <xsl:apply-templates>
5644
5972
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5645
5973
  </xsl:apply-templates>
@@ -5659,6 +5987,8 @@
5659
5987
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5660
5988
  </xsl:if>
5661
5989
 
5990
+ <xsl:call-template name="refine_dd-cell-style"/>
5991
+
5662
5992
  <fo:block>
5663
5993
 
5664
5994
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5704,8 +6034,18 @@
5704
6034
  </xsl:if>
5705
6035
  </xsl:template>
5706
6036
 
5707
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5708
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6037
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
6038
+ <xsl:variable name="is_inline_element_after_where">
6039
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
6040
+ </xsl:variable>
6041
+ <xsl:choose>
6042
+ <xsl:when test="$is_inline_element_after_where = 'true'">
6043
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
6044
+ </xsl:when>
6045
+ <xsl:otherwise>
6046
+ <xsl:apply-templates select="."/>
6047
+ </xsl:otherwise>
6048
+ </xsl:choose>
5709
6049
  </xsl:template>
5710
6050
 
5711
6051
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5799,12 +6139,18 @@
5799
6139
  <xsl:param name="split_keep-within-line"/>
5800
6140
  <fo:inline font-weight="bold">
5801
6141
 
6142
+ <xsl:call-template name="refine_strong_style"/>
6143
+
5802
6144
  <xsl:apply-templates>
5803
6145
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5804
6146
  </xsl:apply-templates>
5805
6147
  </fo:inline>
5806
6148
  </xsl:template>
5807
6149
 
6150
+ <xsl:template name="refine_strong_style">
6151
+
6152
+ </xsl:template>
6153
+
5808
6154
  <xsl:template match="*[local-name()='padding']">
5809
6155
  <fo:inline padding-right="{@value}"> </fo:inline>
5810
6156
  </xsl:template>
@@ -6344,7 +6690,10 @@
6344
6690
  </xsl:choose>
6345
6691
  </xsl:variable>
6346
6692
 
6347
- <xsl:value-of select="$text9"/>
6693
+ <!-- replace sequence #x200B and space TO space -->
6694
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
6695
+
6696
+ <xsl:value-of select="$text10"/>
6348
6697
  </xsl:template>
6349
6698
 
6350
6699
  <xsl:template name="add-zero-spaces-link-java">
@@ -7019,6 +7368,11 @@
7019
7368
 
7020
7369
  <fo:inline xsl:use-attribute-sets="mathml-style">
7021
7370
 
7371
+ <!-- DEBUG -->
7372
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
7373
+
7374
+ <xsl:call-template name="refine_mathml-style"/>
7375
+
7022
7376
  <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 -->
7023
7377
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
7024
7378
  </xsl:if>
@@ -7123,6 +7477,8 @@
7123
7477
 
7124
7478
  <fo:instream-foreign-object fox:alt-text="Math">
7125
7479
 
7480
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
7481
+
7126
7482
  <!-- put MathML in Actual Text -->
7127
7483
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7128
7484
  <xsl:attribute name="fox:actual-text">
@@ -7143,6 +7499,10 @@
7143
7499
  </fo:instream-foreign-object>
7144
7500
  </xsl:template>
7145
7501
 
7502
+ <xsl:template name="refine_mathml_insteam_object_style">
7503
+
7504
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
7505
+
7146
7506
  <xsl:template match="mathml:*" mode="mathml_actual_text">
7147
7507
  <!-- <xsl:text>a+b</xsl:text> -->
7148
7508
  <xsl:text>&lt;</xsl:text>
@@ -7206,6 +7566,79 @@
7206
7566
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7207
7567
  </xsl:template>
7208
7568
 
7569
+ <!-- special case for:
7570
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7571
+ <mstyle displaystyle="true">
7572
+ <msup>
7573
+ <mi color="#00000000">C</mi>
7574
+ <mtext>R</mtext>
7575
+ </msup>
7576
+ <msubsup>
7577
+ <mtext>C</mtext>
7578
+ <mi>n</mi>
7579
+ <mi>k</mi>
7580
+ </msubsup>
7581
+ </mstyle>
7582
+ </math>
7583
+ -->
7584
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7585
+ <xsl:copy>
7586
+ <xsl:copy-of select="@*"/>
7587
+ <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"/>
7588
+ <xsl:if test="string-length($next_mtext) != ''">
7589
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7590
+ </xsl:if>
7591
+ <xsl:apply-templates/>
7592
+ <xsl:value-of select="$next_mtext"/>
7593
+ </xsl:copy>
7594
+ </xsl:template>
7595
+
7596
+ <!-- special case for:
7597
+ <msup>
7598
+ <mtext/>
7599
+ <mn>1</mn>
7600
+ </msup>
7601
+ convert to (add mspace after mtext and enclose them into mrow):
7602
+ <msup>
7603
+ <mrow>
7604
+ <mtext/>
7605
+ <mspace height="1.47ex"/>
7606
+ </mrow>
7607
+ <mn>1</mn>
7608
+ </msup>
7609
+ -->
7610
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7611
+ <mathml:mrow>
7612
+ <xsl:copy-of select="."/>
7613
+ <mathml:mspace height="1.47ex"/>
7614
+ </mathml:mrow>
7615
+ </xsl:template>
7616
+
7617
+ <!-- add space around vertical line -->
7618
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7619
+ <xsl:copy>
7620
+ <xsl:apply-templates select="@*" mode="mathml"/>
7621
+ <xsl:if test="not(@lspace)">
7622
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7623
+ </xsl:if>
7624
+ <xsl:if test="not(@rspace)">
7625
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7626
+ </xsl:if>
7627
+ <xsl:apply-templates mode="mathml"/>
7628
+ </xsl:copy>
7629
+ </xsl:template>
7630
+
7631
+ <!-- decrease fontsize for 'Circled Times' char -->
7632
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7633
+ <xsl:copy>
7634
+ <xsl:apply-templates select="@*" mode="mathml"/>
7635
+ <xsl:if test="not(@fontsize)">
7636
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7637
+ </xsl:if>
7638
+ <xsl:apply-templates mode="mathml"/>
7639
+ </xsl:copy>
7640
+ </xsl:template>
7641
+
7209
7642
  <!-- Examples:
7210
7643
  <stem type="AsciiMath">x = 1</stem>
7211
7644
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7214,6 +7647,8 @@
7214
7647
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
7215
7648
  <fo:inline xsl:use-attribute-sets="mathml-style">
7216
7649
 
7650
+ <xsl:call-template name="refine_mathml-style"/>
7651
+
7217
7652
  <xsl:choose>
7218
7653
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
7219
7654
  <xsl:otherwise>
@@ -7258,28 +7693,30 @@
7258
7693
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7259
7694
  </xsl:if>
7260
7695
 
7261
- <xsl:if test="ancestor::*[local-name()='feedback-statement' or local-name() = 'copyright-statement']">
7262
- <xsl:attribute name="color">blue</xsl:attribute>
7263
- </xsl:if>
7696
+ <xsl:call-template name="refine_link-style"/>
7264
7697
 
7265
7698
  <xsl:choose>
7266
7699
  <xsl:when test="$target_text = ''">
7267
7700
  <xsl:apply-templates/>
7268
7701
  </xsl:when>
7269
7702
  <xsl:otherwise>
7270
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7271
- <xsl:choose>
7272
- <xsl:when test="normalize-space(.) = ''">
7273
- <xsl:call-template name="add-zero-spaces-link-java">
7274
- <xsl:with-param name="text" select="$target_text"/>
7275
- </xsl:call-template>
7276
- </xsl:when>
7277
- <xsl:otherwise>
7278
- <!-- output text from <link>text</link> -->
7279
- <xsl:apply-templates/>
7280
- </xsl:otherwise>
7281
- </xsl:choose>
7282
- </fo:basic-link>
7703
+ <xsl:call-template name="insert_basic_link">
7704
+ <xsl:with-param name="element">
7705
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7706
+ <xsl:choose>
7707
+ <xsl:when test="normalize-space(.) = ''">
7708
+ <xsl:call-template name="add-zero-spaces-link-java">
7709
+ <xsl:with-param name="text" select="$target_text"/>
7710
+ </xsl:call-template>
7711
+ </xsl:when>
7712
+ <xsl:otherwise>
7713
+ <!-- output text from <link>text</link> -->
7714
+ <xsl:apply-templates/>
7715
+ </xsl:otherwise>
7716
+ </xsl:choose>
7717
+ </fo:basic-link>
7718
+ </xsl:with-param>
7719
+ </xsl:call-template>
7283
7720
  </xsl:otherwise>
7284
7721
  </xsl:choose>
7285
7722
  </fo:inline>
@@ -7342,12 +7779,19 @@
7342
7779
  </xsl:template>
7343
7780
 
7344
7781
  <xsl:template match="*[local-name() = 'xref']">
7345
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7346
- <xsl:if test="parent::*[local-name() = 'add']">
7347
- <xsl:call-template name="append_add-style"/>
7348
- </xsl:if>
7349
- <xsl:apply-templates/>
7350
- </fo:basic-link>
7782
+ <xsl:call-template name="insert_basic_link">
7783
+ <xsl:with-param name="element">
7784
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7785
+ <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'])">
7786
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7787
+ </xsl:if>
7788
+ <xsl:if test="parent::*[local-name() = 'add']">
7789
+ <xsl:call-template name="append_add-style"/>
7790
+ </xsl:if>
7791
+ <xsl:apply-templates/>
7792
+ </fo:basic-link>
7793
+ </xsl:with-param>
7794
+ </xsl:call-template>
7351
7795
  </xsl:template>
7352
7796
 
7353
7797
  <!-- ====== -->
@@ -7402,6 +7846,8 @@
7402
7846
  <fo:table-cell display-align="center">
7403
7847
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7404
7848
 
7849
+ <xsl:call-template name="refine_formula-stem-block-style"/>
7850
+
7405
7851
  <xsl:apply-templates/>
7406
7852
  </fo:block>
7407
7853
  </fo:table-cell>
@@ -7443,12 +7889,18 @@
7443
7889
 
7444
7890
  <xsl:call-template name="setBlockSpanAll"/>
7445
7891
 
7892
+ <xsl:call-template name="refine_note-style"/>
7893
+
7446
7894
  <fo:block-container margin-left="0mm" margin-right="0mm">
7447
7895
 
7448
7896
  <fo:block>
7449
7897
 
7898
+ <xsl:call-template name="refine_note_block_style"/>
7899
+
7450
7900
  <fo:inline xsl:use-attribute-sets="note-name-style">
7451
7901
 
7902
+ <xsl:call-template name="refine_note-name-style"/>
7903
+
7452
7904
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7453
7905
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7454
7906
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7474,6 +7926,10 @@
7474
7926
 
7475
7927
  </xsl:template>
7476
7928
 
7929
+ <xsl:template name="refine_note_block_style">
7930
+
7931
+ </xsl:template>
7932
+
7477
7933
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7478
7934
  <xsl:variable name="num"><xsl:number/></xsl:variable>
7479
7935
  <xsl:choose>
@@ -7495,12 +7951,16 @@
7495
7951
 
7496
7952
  <xsl:call-template name="setBlockSpanAll"/>
7497
7953
 
7954
+ <xsl:call-template name="refine_termnote-style"/>
7955
+
7498
7956
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7499
7957
 
7500
7958
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
7501
7959
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7502
7960
  </xsl:if>
7503
7961
 
7962
+ <xsl:call-template name="refine_termnote-name-style"/>
7963
+
7504
7964
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7505
7965
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
7506
7966
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -7674,6 +8134,8 @@
7674
8134
  <xsl:otherwise>
7675
8135
  <fo:block xsl:use-attribute-sets="image-style">
7676
8136
 
8137
+ <xsl:call-template name="refine_image-style"/>
8138
+
7677
8139
  <xsl:variable name="src">
7678
8140
  <xsl:call-template name="image_src"/>
7679
8141
  </xsl:variable>
@@ -7732,7 +8194,7 @@
7732
8194
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7733
8195
  </xsl:when>
7734
8196
  <xsl:when test="not(starts-with(@src, 'data:'))">
7735
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8197
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7736
8198
  </xsl:when>
7737
8199
  <xsl:otherwise>
7738
8200
  <xsl:value-of select="@src"/>
@@ -7754,7 +8216,7 @@
7754
8216
  </xsl:when>
7755
8217
  <xsl:when test="not(starts-with(@src, 'data:'))">
7756
8218
  <xsl:variable name="src">
7757
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8219
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7758
8220
  </xsl:variable>
7759
8221
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7760
8222
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8140,15 +8602,19 @@
8140
8602
  <xsl:param name="dest"/>
8141
8603
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8142
8604
  <fo:block font-size="1pt">
8143
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8144
- <fo:inline-container inline-progression-dimension="100%">
8145
- <fo:block-container height="{$height - 1}px" width="100%">
8146
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8147
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8148
- </xsl:if> -->
8149
- <fo:block> </fo:block></fo:block-container>
8150
- </fo:inline-container>
8151
- </fo:basic-link>
8605
+ <xsl:call-template name="insert_basic_link">
8606
+ <xsl:with-param name="element">
8607
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8608
+ <fo:inline-container inline-progression-dimension="100%">
8609
+ <fo:block-container height="{$height - 1}px" width="100%">
8610
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8611
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8612
+ </xsl:if> -->
8613
+ <fo:block> </fo:block></fo:block-container>
8614
+ </fo:inline-container>
8615
+ </fo:basic-link>
8616
+ </xsl:with-param>
8617
+ </xsl:call-template>
8152
8618
  </fo:block>
8153
8619
  </fo:block-container>
8154
8620
  </xsl:template>
@@ -8530,6 +8996,8 @@
8530
8996
  <xsl:if test="normalize-space() != ''">
8531
8997
  <fo:block xsl:use-attribute-sets="figure-name-style">
8532
8998
 
8999
+ <xsl:call-template name="refine_figure-name-style"/>
9000
+
8533
9001
  <xsl:apply-templates/>
8534
9002
  </fo:block>
8535
9003
  </xsl:if>
@@ -8795,6 +9263,8 @@
8795
9263
  </xsl:attribute>
8796
9264
  </xsl:for-each>
8797
9265
 
9266
+ <xsl:call-template name="refine_sourcecode-style"/>
9267
+
8798
9268
  <!-- remove margin between rows in the table with sourcecode line numbers -->
8799
9269
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8800
9270
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -9499,6 +9969,8 @@
9499
9969
 
9500
9970
  <xsl:call-template name="setBlockSpanAll"/>
9501
9971
 
9972
+ <xsl:call-template name="refine_example-style"/>
9973
+
9502
9974
  <xsl:variable name="fo_element">
9503
9975
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
9504
9976
 
@@ -9632,6 +10104,8 @@
9632
10104
  </xsl:if>
9633
10105
  <fo:block xsl:use-attribute-sets="example-p-style">
9634
10106
 
10107
+ <xsl:call-template name="refine_example-p-style"/>
10108
+
9635
10109
  <xsl:apply-templates/>
9636
10110
  </fo:block>
9637
10111
  </fo:block-container>
@@ -9648,6 +10122,7 @@
9648
10122
  </xsl:otherwise>
9649
10123
  </xsl:choose>
9650
10124
  </xsl:template> <!-- example/p -->
10125
+
9651
10126
  <!-- ====== -->
9652
10127
  <!-- ====== -->
9653
10128
 
@@ -9659,6 +10134,8 @@
9659
10134
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
9660
10135
  <fo:block xsl:use-attribute-sets="termsource-style">
9661
10136
 
10137
+ <xsl:call-template name="refine_termsource-style"/>
10138
+
9662
10139
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
9663
10140
  <xsl:variable name="termsource_text">
9664
10141
  <xsl:apply-templates/>
@@ -9711,14 +10188,18 @@
9711
10188
  </xsl:template>
9712
10189
 
9713
10190
  <xsl:template match="*[local-name() = 'origin']">
9714
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9715
- <xsl:if test="normalize-space(@citeas) = ''">
9716
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9717
- </xsl:if>
9718
- <fo:inline xsl:use-attribute-sets="origin-style">
9719
- <xsl:apply-templates/>
9720
- </fo:inline>
9721
- </fo:basic-link>
10191
+ <xsl:call-template name="insert_basic_link">
10192
+ <xsl:with-param name="element">
10193
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10194
+ <xsl:if test="normalize-space(@citeas) = ''">
10195
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10196
+ </xsl:if>
10197
+ <fo:inline xsl:use-attribute-sets="origin-style">
10198
+ <xsl:apply-templates/>
10199
+ </fo:inline>
10200
+ </fo:basic-link>
10201
+ </xsl:with-param>
10202
+ </xsl:call-template>
9722
10203
  </xsl:template>
9723
10204
 
9724
10205
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9770,6 +10251,8 @@
9770
10251
  <fo:block-container margin-left="0mm">
9771
10252
  <fo:block-container xsl:use-attribute-sets="quote-style">
9772
10253
 
10254
+ <xsl:call-template name="refine_quote-style"/>
10255
+
9773
10256
  <fo:block-container margin-left="0mm" margin-right="0mm">
9774
10257
  <fo:block role="BlockQuote">
9775
10258
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -9792,9 +10275,13 @@
9792
10275
  <xsl:if test="../*[local-name() = 'author']">
9793
10276
  <xsl:text>, </xsl:text>
9794
10277
  </xsl:if>
9795
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9796
- <xsl:apply-templates/>
9797
- </fo:basic-link>
10278
+ <xsl:call-template name="insert_basic_link">
10279
+ <xsl:with-param name="element">
10280
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10281
+ <xsl:apply-templates/>
10282
+ </fo:basic-link>
10283
+ </xsl:with-param>
10284
+ </xsl:call-template>
9798
10285
  </xsl:template>
9799
10286
 
9800
10287
  <xsl:template match="*[local-name() = 'author']">
@@ -9840,28 +10327,33 @@
9840
10327
 
9841
10328
  </xsl:if>
9842
10329
 
9843
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9844
- <xsl:variable name="text" select="normalize-space()"/>
10330
+ <xsl:call-template name="refine_eref-style"/>
9845
10331
 
9846
- <fo:basic-link fox:alt-text="{@citeas}">
9847
- <xsl:if test="normalize-space(@citeas) = ''">
9848
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9849
- </xsl:if>
9850
- <xsl:if test="@type = 'inline'">
10332
+ <xsl:call-template name="insert_basic_link">
10333
+ <xsl:with-param name="element">
10334
+ <fo:basic-link fox:alt-text="{@citeas}">
10335
+ <xsl:if test="normalize-space(@citeas) = ''">
10336
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10337
+ </xsl:if>
10338
+ <xsl:if test="@type = 'inline'">
9851
10339
 
9852
- </xsl:if>
10340
+ <xsl:call-template name="refine_basic_link_style"/>
9853
10341
 
9854
- <xsl:choose>
9855
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9856
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9857
- </xsl:when>
9858
- <xsl:otherwise>
9859
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9860
- </xsl:otherwise>
9861
- </xsl:choose>
10342
+ </xsl:if>
9862
10343
 
9863
- <xsl:apply-templates/>
9864
- </fo:basic-link>
10344
+ <xsl:choose>
10345
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10346
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10347
+ </xsl:when>
10348
+ <xsl:otherwise>
10349
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10350
+ </xsl:otherwise>
10351
+ </xsl:choose>
10352
+
10353
+ <xsl:apply-templates/>
10354
+ </fo:basic-link>
10355
+ </xsl:with-param>
10356
+ </xsl:call-template>
9865
10357
 
9866
10358
  </fo:inline>
9867
10359
  </xsl:when>
@@ -9879,6 +10371,11 @@
9879
10371
  </xsl:otherwise>
9880
10372
  </xsl:choose>
9881
10373
  </xsl:template>
10374
+
10375
+ <xsl:template name="refine_basic_link_style">
10376
+
10377
+ </xsl:template> <!-- refine_basic_link_style -->
10378
+
9882
10379
  <!-- ====== -->
9883
10380
  <!-- END eref -->
9884
10381
  <!-- ====== -->
@@ -10027,11 +10524,17 @@
10027
10524
  <fo:block>
10028
10525
  <xsl:call-template name="setId"/>
10029
10526
 
10527
+ <xsl:call-template name="sections_element_style"/>
10528
+
10030
10529
  <xsl:apply-templates/>
10031
10530
  </fo:block>
10032
10531
 
10033
10532
  </xsl:template>
10034
10533
 
10534
+ <xsl:template name="sections_element_style">
10535
+
10536
+ </xsl:template> <!-- sections_element_style -->
10537
+
10035
10538
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10036
10539
  <fo:block break-after="page"/>
10037
10540
  <fo:block>
@@ -10046,10 +10549,16 @@
10046
10549
 
10047
10550
  <xsl:call-template name="setBlockSpanAll"/>
10048
10551
 
10552
+ <xsl:call-template name="refine_clause_style"/>
10553
+
10049
10554
  <xsl:apply-templates/>
10050
10555
  </fo:block>
10051
10556
  </xsl:template>
10052
10557
 
10558
+ <xsl:template name="refine_clause_style">
10559
+
10560
+ </xsl:template> <!-- refine_clause_style -->
10561
+
10053
10562
  <xsl:template match="*[local-name() = 'definitions']">
10054
10563
  <fo:block id="{@id}">
10055
10564
  <xsl:apply-templates/>
@@ -10062,10 +10571,16 @@
10062
10571
 
10063
10572
  <xsl:call-template name="setBlockSpanAll"/>
10064
10573
 
10574
+ <xsl:call-template name="refine_annex_style"/>
10575
+
10065
10576
  </fo:block>
10066
10577
  <xsl:apply-templates/>
10067
10578
  </xsl:template>
10068
10579
 
10580
+ <xsl:template name="refine_annex_style">
10581
+
10582
+ </xsl:template>
10583
+
10069
10584
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10070
10585
  <!-- comment 2019-11-29 -->
10071
10586
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -10104,7 +10619,10 @@
10104
10619
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10105
10620
 
10106
10621
  <xsl:template name="setULLabel">
10107
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10622
+ <xsl:variable name="list_level__">
10623
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10624
+ </xsl:variable>
10625
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10108
10626
  <xsl:variable name="list_level">
10109
10627
  <xsl:choose>
10110
10628
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10229,6 +10747,8 @@
10229
10747
  </xsl:choose>
10230
10748
  </xsl:attribute>
10231
10749
 
10750
+ <xsl:call-template name="refine_list_container_style"/>
10751
+
10232
10752
  <fo:block-container margin-left="0mm">
10233
10753
  <fo:block>
10234
10754
  <xsl:apply-templates select="." mode="list"/>
@@ -10237,13 +10757,19 @@
10237
10757
  </fo:block-container>
10238
10758
  </xsl:when>
10239
10759
  <xsl:otherwise>
10240
- <fo:block>
10241
- <xsl:apply-templates select="." mode="list"/>
10242
- </fo:block>
10760
+
10761
+ <fo:block>
10762
+ <xsl:apply-templates select="." mode="list"/>
10763
+ </fo:block>
10764
+
10243
10765
  </xsl:otherwise>
10244
10766
  </xsl:choose>
10245
10767
  </xsl:template>
10246
10768
 
10769
+ <xsl:template name="refine_list_container_style">
10770
+
10771
+ </xsl:template> <!-- refine_list_container_style -->
10772
+
10247
10773
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
10248
10774
 
10249
10775
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -10254,11 +10780,7 @@
10254
10780
 
10255
10781
  <xsl:variable name="provisional_distance_between_starts_">
10256
10782
  <attributes xsl:use-attribute-sets="list-style">
10257
-
10258
- <xsl:if test="ancestor::iec:legal-statement">
10259
- <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
10260
- </xsl:if>
10261
-
10783
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
10262
10784
  </attributes>
10263
10785
  </xsl:variable>
10264
10786
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -10294,9 +10816,7 @@
10294
10816
  <addon><xsl:value-of select="$addon"/></addon> -->
10295
10817
  </xsl:if>
10296
10818
 
10297
- <xsl:if test="ancestor::iec:ul or ancestor::iec:ol">
10298
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10299
- </xsl:if>
10819
+ <xsl:call-template name="refine_list-style"/>
10300
10820
 
10301
10821
  <xsl:if test="*[local-name() = 'name']">
10302
10822
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -10310,6 +10830,14 @@
10310
10830
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
10311
10831
  </xsl:template>
10312
10832
 
10833
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
10834
+
10835
+ <xsl:if test="ancestor::iec:legal-statement or ancestor::iec:clause[@type = 'boilerplate_legal']">
10836
+ <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
10837
+ </xsl:if>
10838
+
10839
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
10840
+
10313
10841
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
10314
10842
  <xsl:param name="process">false</xsl:param>
10315
10843
  <xsl:if test="$process = 'true'">
@@ -10323,20 +10851,27 @@
10323
10851
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10324
10852
  <xsl:copy-of select="@id"/>
10325
10853
 
10854
+ <xsl:call-template name="refine_list-item-style"/>
10855
+
10326
10856
  <fo:list-item-label end-indent="label-end()">
10327
10857
  <fo:block xsl:use-attribute-sets="list-item-label-style">
10328
10858
 
10859
+ <xsl:call-template name="refine_list-item-label-style"/>
10860
+
10329
10861
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10330
10862
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10331
10863
  <xsl:call-template name="append_add-style"/>
10332
10864
  </xsl:if>
10333
10865
 
10334
10866
  <xsl:call-template name="getListItemFormat"/>
10867
+
10335
10868
  </fo:block>
10336
10869
  </fo:list-item-label>
10337
10870
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
10338
10871
  <fo:block>
10339
10872
 
10873
+ <xsl:call-template name="refine_list-item-body-style"/>
10874
+
10340
10875
  <xsl:apply-templates/>
10341
10876
 
10342
10877
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -10654,6 +11189,7 @@
10654
11189
 
10655
11190
  <fo:block id="{@id}">
10656
11191
  <xsl:apply-templates/>
11192
+
10657
11193
  </fo:block>
10658
11194
  </xsl:template>
10659
11195
 
@@ -10673,6 +11209,7 @@
10673
11209
 
10674
11210
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
10675
11211
  <xsl:apply-templates/>
11212
+
10676
11213
  </fo:block>
10677
11214
 
10678
11215
  <!-- horizontal line -->
@@ -10936,24 +11473,32 @@
10936
11473
  <xsl:for-each select="*[local-name() = 'tab']">
10937
11474
  <xsl:variable name="current_id" select="generate-id()"/>
10938
11475
  <fo:table-cell>
10939
- <fo:block>
10940
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10941
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10942
- <xsl:choose>
10943
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10944
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10945
- </xsl:choose>
10946
- </xsl:for-each>
10947
- </fo:basic-link>
11476
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11477
+ <xsl:call-template name="insert_basic_link">
11478
+ <xsl:with-param name="element">
11479
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11480
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11481
+ <xsl:choose>
11482
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11483
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11484
+ </xsl:choose>
11485
+ </xsl:for-each>
11486
+ </fo:basic-link>
11487
+ </xsl:with-param>
11488
+ </xsl:call-template>
10948
11489
  </fo:block>
10949
11490
  </fo:table-cell>
10950
11491
  </xsl:for-each>
10951
11492
  <!-- last column - for page numbers -->
10952
11493
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10953
11494
  <fo:block>
10954
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10955
- <fo:page-number-citation ref-id="{$target}"/>
10956
- </fo:basic-link>
11495
+ <xsl:call-template name="insert_basic_link">
11496
+ <xsl:with-param name="element">
11497
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11498
+ <fo:page-number-citation ref-id="{$target}"/>
11499
+ </fo:basic-link>
11500
+ </xsl:with-param>
11501
+ </xsl:call-template>
10957
11502
  </fo:block>
10958
11503
  </fo:table-cell>
10959
11504
  </xsl:template>
@@ -10995,6 +11540,27 @@
10995
11540
  <!-- End Table of Contents (ToC) processing -->
10996
11541
  <!-- =================== -->
10997
11542
 
11543
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11544
+ <xsl:template name="insert_basic_link">
11545
+ <xsl:param name="element"/>
11546
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11547
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11548
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11549
+ <xsl:choose>
11550
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11551
+ <xsl:copy-of select="$element_node"/>
11552
+ </xsl:when>
11553
+ <xsl:otherwise>
11554
+ <fo:inline>
11555
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11556
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11557
+ </xsl:for-each>
11558
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11559
+ </fo:inline>
11560
+ </xsl:otherwise>
11561
+ </xsl:choose>
11562
+ </xsl:template>
11563
+
10998
11564
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10999
11565
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
11000
11566
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -11226,6 +11792,9 @@
11226
11792
  </xsl:copy>
11227
11793
  </xsl:template>
11228
11794
 
11795
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
11796
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
11797
+
11229
11798
  <xsl:template name="add_id">
11230
11799
  <xsl:if test="not(@id)">
11231
11800
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -11510,6 +12079,14 @@
11510
12079
  <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">
11511
12080
  <xsl:variable name="p_fn_">
11512
12081
  <xsl:call-template name="get_fn_list"/>
12082
+ <!-- <xsl:choose>
12083
+ <xsl:when test="$namespace = 'jis'">
12084
+ <xsl:call-template name="get_fn_list_for_element"/>
12085
+ </xsl:when>
12086
+ <xsl:otherwise>
12087
+ <xsl:call-template name="get_fn_list"/>
12088
+ </xsl:otherwise>
12089
+ </xsl:choose> -->
11513
12090
  </xsl:variable>
11514
12091
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11515
12092
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -11524,8 +12101,14 @@
11524
12101
  <xsl:attribute name="current_fn_number">
11525
12102
  <xsl:value-of select="$current_fn_number"/>
11526
12103
  </xsl:attribute>
12104
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11527
12105
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
11528
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
12106
+
12107
+ <xsl:value-of select="$skip_footnote_body_"/>
12108
+
12109
+ </xsl:attribute>
12110
+ <xsl:attribute name="ref_id">
12111
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
11529
12112
  </xsl:attribute>
11530
12113
  <xsl:apply-templates select="node()" mode="linear_xml"/>
11531
12114
  </xsl:copy>