metanorma-un 0.10.7 → 0.10.9

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.
@@ -182,119 +182,10 @@
182
182
  </fo:flow>
183
183
  </fo:page-sequence>
184
184
 
185
- <fo:page-sequence master-reference="document-preface-master" force-page-count="even" line-height="115%">
186
- <xsl:call-template name="insertHeaderPreface"/>
187
- <fo:flow flow-name="xsl-region-body" text-align="justify">
188
- <xsl:variable name="title-toc">
189
- <xsl:call-template name="getTitle">
190
- <xsl:with-param name="name" select="'title-toc'"/>
191
- </xsl:call-template>
192
- </xsl:variable>
193
- <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
194
- <xsl:variable name="title-page">
195
- <xsl:call-template name="getLocalizedString">
196
- <xsl:with-param name="key">locality.page</xsl:with-param>
197
- <xsl:with-param name="lang" select="$lang"/>
198
- </xsl:call-template>
199
- </xsl:variable>
200
- <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
201
- <fo:block role="TOC">
202
- <xsl:for-each select="$contents//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']">
203
-
204
- <fo:block role="TOCI">
205
-
206
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
207
- <xsl:if test="@level = 2 and @section != ''">
208
- <xsl:attribute name="margin-left">20mm</xsl:attribute>
209
- </xsl:if>
210
- <xsl:if test="@level &gt;= 3 and @section != ''">
211
- <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 2) * 28"/>mm</xsl:attribute>
212
- </xsl:if>
213
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
214
- <xsl:if test="@section != ''">
215
- <fo:inline>
216
- <xsl:attribute name="padding-right">
217
- <xsl:choose>
218
- <xsl:when test="@level = 1">4mm</xsl:when>
219
- <xsl:when test="@level = 2">5mm</xsl:when>
220
- <xsl:otherwise>4mm</xsl:otherwise>
221
- </xsl:choose>
222
- </xsl:attribute>
223
- <xsl:value-of select="@section"/>
224
- </fo:inline>
225
- </xsl:if>
226
-
227
- <xsl:apply-templates select="title"/>
228
- <xsl:text> </xsl:text>
229
-
230
- <fo:inline keep-together.within-line="always">
231
- <fo:leader leader-pattern="dots"/>
232
- <fo:page-number-citation ref-id="{@id}"/>
233
- </fo:inline>
234
- </fo:basic-link>
235
- </fo:block>
236
- </fo:block>
237
-
238
- </xsl:for-each>
239
-
240
- <xsl:if test="$contents//item[@type = 'annex' and @display = 'true']">
241
- <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-next="always">ANNEXES</fo:block>
242
- <xsl:for-each select="$contents//item[@type = 'annex' and @display = 'true']">
243
- <fo:block role="TOCI">
244
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
245
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
246
- <xsl:if test="@section = ''">
247
- <xsl:attribute name="fox:alt-text">Annex</xsl:attribute>
248
- </xsl:if>
249
- <xsl:if test="@section != ''">
250
- <fo:inline padding-right="3mm">
251
- <xsl:choose>
252
- <xsl:when test="contains(@section, 'Annex')">
253
- <xsl:value-of select="substring-after(@section, 'Annex')"/>
254
- <xsl:text>: </xsl:text>
255
- </xsl:when>
256
- <xsl:otherwise>
257
- <xsl:value-of select="@section"/>
258
- </xsl:otherwise>
259
- </xsl:choose>
260
- </fo:inline>
261
- </xsl:if>
262
-
263
- <xsl:apply-templates/>
264
-
265
- <fo:inline keep-together.within-line="always">
266
- <fo:leader leader-pattern="dots"/>
267
- <fo:page-number-citation ref-id="{@id}"/>
268
- </fo:inline>
269
- </fo:basic-link>
270
- </fo:block>
271
- </fo:block>
272
- </xsl:for-each>
273
- </xsl:if>
274
-
275
- <!-- List of Tables -->
276
- <xsl:if test="$contents//tables/table">
277
- <xsl:call-template name="insertListOf_Title">
278
- <xsl:with-param name="title" select="$title-list-tables"/>
279
- </xsl:call-template>
280
- <xsl:for-each select="$contents//tables/table">
281
- <xsl:call-template name="insertListOf_Item"/>
282
- </xsl:for-each>
283
- </xsl:if>
284
-
285
- <!-- List of Figures -->
286
- <xsl:if test="$contents//figures/figure">
287
- <xsl:call-template name="insertListOf_Title">
288
- <xsl:with-param name="title" select="$title-list-figures"/>
289
- </xsl:call-template>
290
- <xsl:for-each select="$contents//figures/figure">
291
- <xsl:call-template name="insertListOf_Item"/>
292
- </xsl:for-each>
293
- </xsl:if>
294
-
295
- </fo:block>
296
- </fo:flow>
297
- </fo:page-sequence>
185
+ <!-- Table of contents -->
186
+ <xsl:apply-templates select="/*/un:preface/un:clause[@type = 'toc']">
187
+ <xsl:with-param name="process">true</xsl:with-param>
188
+ </xsl:apply-templates>
298
189
 
299
190
  <!-- End Preface Pages -->
300
191
 
@@ -374,6 +265,140 @@
374
265
  </fo:block>
375
266
  </xsl:template>
376
267
 
268
+ <xsl:template match="un:preface/un:clause[@type = 'toc']" priority="4">
269
+ <xsl:param name="process">false</xsl:param>
270
+ <xsl:if test="$process = 'true'">
271
+ <fo:page-sequence master-reference="document-preface-master" force-page-count="even" line-height="115%">
272
+ <xsl:call-template name="insertHeaderPreface"/>
273
+ <fo:flow flow-name="xsl-region-body" text-align="justify">
274
+
275
+ <xsl:apply-templates/>
276
+
277
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
278
+
279
+ <fo:block role="TOC">
280
+ <xsl:for-each select="$contents//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']">
281
+
282
+ <fo:block role="TOCI">
283
+
284
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
285
+ <xsl:if test="@level = 2 and @section != ''">
286
+ <xsl:attribute name="margin-left">20mm</xsl:attribute>
287
+ </xsl:if>
288
+ <xsl:if test="@level &gt;= 3 and @section != ''">
289
+ <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 2) * 28"/>mm</xsl:attribute>
290
+ </xsl:if>
291
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
292
+ <xsl:if test="@section != ''">
293
+ <fo:inline>
294
+ <xsl:attribute name="padding-right">
295
+ <xsl:choose>
296
+ <xsl:when test="@level = 1">4mm</xsl:when>
297
+ <xsl:when test="@level = 2">5mm</xsl:when>
298
+ <xsl:otherwise>4mm</xsl:otherwise>
299
+ </xsl:choose>
300
+ </xsl:attribute>
301
+ <xsl:value-of select="@section"/>
302
+ </fo:inline>
303
+ </xsl:if>
304
+
305
+ <xsl:apply-templates select="title"/>
306
+ <xsl:text> </xsl:text>
307
+
308
+ <fo:inline keep-together.within-line="always">
309
+ <fo:leader leader-pattern="dots"/>
310
+ <fo:page-number-citation ref-id="{@id}"/>
311
+ </fo:inline>
312
+ </fo:basic-link>
313
+ </fo:block>
314
+ </fo:block>
315
+
316
+ </xsl:for-each>
317
+
318
+ <xsl:if test="$contents//item[@type = 'annex' and @display = 'true']">
319
+ <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-next="always">ANNEXES</fo:block>
320
+ <xsl:for-each select="$contents//item[@type = 'annex' and @display = 'true']">
321
+ <fo:block role="TOCI">
322
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
323
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
324
+ <xsl:if test="@section = ''">
325
+ <xsl:attribute name="fox:alt-text">Annex</xsl:attribute>
326
+ </xsl:if>
327
+ <xsl:if test="@section != ''">
328
+ <fo:inline padding-right="3mm">
329
+ <xsl:choose>
330
+ <xsl:when test="contains(@section, 'Annex')">
331
+ <xsl:value-of select="substring-after(@section, 'Annex')"/>
332
+ <xsl:text>: </xsl:text>
333
+ </xsl:when>
334
+ <xsl:otherwise>
335
+ <xsl:value-of select="@section"/>
336
+ </xsl:otherwise>
337
+ </xsl:choose>
338
+ </fo:inline>
339
+ </xsl:if>
340
+
341
+ <xsl:apply-templates/>
342
+
343
+ <fo:inline keep-together.within-line="always">
344
+ <fo:leader leader-pattern="dots"/>
345
+ <fo:page-number-citation ref-id="{@id}"/>
346
+ </fo:inline>
347
+ </fo:basic-link>
348
+ </fo:block>
349
+ </fo:block>
350
+ </xsl:for-each>
351
+ </xsl:if>
352
+
353
+ <!-- List of Tables -->
354
+ <xsl:if test="$contents//tables/table">
355
+ <xsl:call-template name="insertListOf_Title">
356
+ <xsl:with-param name="title" select="$title-list-tables"/>
357
+ </xsl:call-template>
358
+ <xsl:for-each select="$contents//tables/table">
359
+ <xsl:call-template name="insertListOf_Item"/>
360
+ </xsl:for-each>
361
+ </xsl:if>
362
+
363
+ <!-- List of Figures -->
364
+ <xsl:if test="$contents//figures/figure">
365
+ <xsl:call-template name="insertListOf_Title">
366
+ <xsl:with-param name="title" select="$title-list-figures"/>
367
+ </xsl:call-template>
368
+ <xsl:for-each select="$contents//figures/figure">
369
+ <xsl:call-template name="insertListOf_Item"/>
370
+ </xsl:for-each>
371
+ </xsl:if>
372
+
373
+ </fo:block>
374
+ </xsl:if>
375
+ <fo:block/> <!-- prevent empty toc -->
376
+ </fo:flow>
377
+ </fo:page-sequence>
378
+
379
+ </xsl:if>
380
+ </xsl:template>
381
+
382
+ <xsl:template match="un:preface/un:clause[@type = 'toc']/un:title" priority="4">
383
+ <!-- <xsl:variable name="title-toc">
384
+ <xsl:call-template name="getTitle">
385
+ <xsl:with-param name="name" select="'title-toc'"/>
386
+ </xsl:call-template>
387
+ </xsl:variable> -->
388
+ <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt" role="H1">
389
+ <!-- <xsl:value-of select="$title-toc"/> -->
390
+ <xsl:apply-templates/>
391
+ </fo:block>
392
+
393
+ <xsl:variable name="title-page">
394
+ <xsl:call-template name="getLocalizedString">
395
+ <xsl:with-param name="key">locality.page</xsl:with-param>
396
+ <xsl:with-param name="lang" select="$lang"/>
397
+ </xsl:call-template>
398
+ </xsl:variable>
399
+ <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
400
+ </xsl:template>
401
+
377
402
  <!-- ============================= -->
378
403
  <!-- CONTENTS -->
379
404
  <!-- ============================= -->
@@ -401,6 +426,7 @@
401
426
 
402
427
  <xsl:variable name="skip">
403
428
  <xsl:choose>
429
+ <xsl:when test="@type = 'toc'">true</xsl:when>
404
430
  <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
405
431
  <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
406
432
  <xsl:when test="@inline-header='true'">true</xsl:when>
@@ -1212,6 +1238,10 @@
1212
1238
 
1213
1239
  </xsl:attribute-set>
1214
1240
 
1241
+ <xsl:template name="refine_link-style">
1242
+
1243
+ </xsl:template> <!-- refine_link-style -->
1244
+
1215
1245
  <xsl:attribute-set name="sourcecode-container-style">
1216
1246
 
1217
1247
  </xsl:attribute-set>
@@ -1227,6 +1257,10 @@
1227
1257
 
1228
1258
  </xsl:attribute-set>
1229
1259
 
1260
+ <xsl:template name="refine_sourcecode-style">
1261
+
1262
+ </xsl:template> <!-- refine_sourcecode-style -->
1263
+
1230
1264
  <xsl:attribute-set name="pre-style">
1231
1265
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1232
1266
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1304,6 +1338,10 @@
1304
1338
 
1305
1339
  </xsl:attribute-set> <!-- example-style -->
1306
1340
 
1341
+ <xsl:template name="refine_example-style">
1342
+
1343
+ </xsl:template> <!-- refine_example-style -->
1344
+
1307
1345
  <xsl:attribute-set name="example-body-style">
1308
1346
 
1309
1347
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1326,6 +1364,15 @@
1326
1364
 
1327
1365
  </xsl:attribute-set> <!-- example-p-style -->
1328
1366
 
1367
+ <xsl:template name="refine_example-p-style">
1368
+
1369
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1370
+ <xsl:if test="$num = 1">
1371
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
1372
+ </xsl:if>
1373
+
1374
+ </xsl:template> <!-- refine_example-p-style -->
1375
+
1329
1376
  <xsl:attribute-set name="termexample-name-style">
1330
1377
 
1331
1378
  </xsl:attribute-set> <!-- termexample-name-style -->
@@ -1351,12 +1398,42 @@
1351
1398
 
1352
1399
  </xsl:attribute-set> <!-- table-container-style -->
1353
1400
 
1401
+ <xsl:template name="refine_table-container-style">
1402
+ <xsl:param name="margin-side"/>
1403
+
1404
+ <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
1405
+ <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
1406
+
1407
+ <xsl:if test="not(ancestor::*[local-name()='sections'])">
1408
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1409
+ </xsl:if>
1410
+
1411
+ <!-- end table block-container attributes -->
1412
+ </xsl:template> <!-- refine_table-container-style -->
1413
+
1354
1414
  <xsl:attribute-set name="table-style">
1355
1415
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1356
1416
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
1357
1417
 
1358
1418
  </xsl:attribute-set><!-- table-style -->
1359
1419
 
1420
+ <xsl:template name="refine_table-style">
1421
+ <xsl:param name="margin-side"/>
1422
+
1423
+ <xsl:if test="$margin-side != 0">
1424
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
1425
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
1426
+ </xsl:if>
1427
+
1428
+ <xsl:call-template name="setBordersTableArray"/>
1429
+
1430
+ <xsl:if test="ancestor::*[local-name()='sections']">
1431
+ <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute>
1432
+ <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute>
1433
+ </xsl:if>
1434
+
1435
+ </xsl:template> <!-- refine_table-style -->
1436
+
1360
1437
  <xsl:attribute-set name="table-name-style">
1361
1438
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1362
1439
 
@@ -1369,6 +1446,11 @@
1369
1446
 
1370
1447
  </xsl:attribute-set> <!-- table-name-style -->
1371
1448
 
1449
+ <xsl:template name="refine_table-name-style">
1450
+ <xsl:param name="continued"/>
1451
+
1452
+ </xsl:template> <!-- refine_table-name-style -->
1453
+
1372
1454
  <xsl:attribute-set name="table-row-style">
1373
1455
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1374
1456
 
@@ -1379,14 +1461,30 @@
1379
1461
 
1380
1462
  </xsl:attribute-set>
1381
1463
 
1464
+ <xsl:template name="refine_table-header-row-style">
1465
+
1466
+ <xsl:call-template name="setBordersTableArray"/>
1467
+
1468
+ </xsl:template> <!-- refine_table-header-row-style -->
1469
+
1382
1470
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1383
1471
 
1384
1472
  </xsl:attribute-set>
1385
1473
 
1474
+ <xsl:template name="refine_table-footer-row-style">
1475
+
1476
+ </xsl:template> <!-- refine_table-footer-row-style -->
1477
+
1386
1478
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1387
1479
 
1388
1480
  </xsl:attribute-set>
1389
1481
 
1482
+ <xsl:template name="refine_table-body-row-style">
1483
+
1484
+ <xsl:call-template name="setBordersTableArray"/>
1485
+
1486
+ </xsl:template> <!-- refine_table-body-row-style -->
1487
+
1390
1488
  <xsl:attribute-set name="table-header-cell-style">
1391
1489
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1392
1490
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1398,6 +1496,33 @@
1398
1496
 
1399
1497
  </xsl:attribute-set> <!-- table-header-cell-style -->
1400
1498
 
1499
+ <xsl:template name="refine_table-header-cell-style">
1500
+
1501
+ <xsl:call-template name="setBordersTableArray"/>
1502
+
1503
+ <xsl:if test="ancestor::*[local-name()='sections']">
1504
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
1505
+ <xsl:attribute name="display-align">before</xsl:attribute>
1506
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1507
+ </xsl:if>
1508
+ <xsl:if test="ancestor::*[local-name()='annex']">
1509
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1510
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1511
+ <xsl:attribute name="background-color">rgb(218, 218, 218)</xsl:attribute>
1512
+ <xsl:if test="starts-with(text(), '1') or starts-with(text(), '2') or starts-with(text(), '3') or starts-with(text(), '4') or starts-with(text(), '5') or starts-with(text(), '6') or starts-with(text(), '7') or starts-with(text(), '8') or starts-with(text(), '9')">
1513
+ <xsl:attribute name="color">rgb(46, 116, 182)</xsl:attribute>
1514
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1515
+ </xsl:if>
1516
+ </xsl:if>
1517
+
1518
+ <xsl:if test="$lang = 'ar'">
1519
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1520
+ </xsl:if>
1521
+
1522
+ <xsl:call-template name="setTableCellAttributes"/>
1523
+
1524
+ </xsl:template> <!-- refine_table-header-cell-style -->
1525
+
1401
1526
  <xsl:attribute-set name="table-cell-style">
1402
1527
  <xsl:attribute name="display-align">center</xsl:attribute>
1403
1528
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1408,6 +1533,23 @@
1408
1533
 
1409
1534
  </xsl:attribute-set> <!-- table-cell-style -->
1410
1535
 
1536
+ <xsl:template name="refine_table-cell-style">
1537
+
1538
+ <xsl:if test="$lang = 'ar'">
1539
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1540
+ </xsl:if>
1541
+
1542
+ <!-- bsi -->
1543
+
1544
+ <xsl:call-template name="setBordersTableArray"/>
1545
+
1546
+ <xsl:if test="ancestor::*[local-name()='sections']">
1547
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
1548
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1549
+ </xsl:if>
1550
+
1551
+ </xsl:template> <!-- refine_table-cell-style -->
1552
+
1411
1553
  <xsl:attribute-set name="table-footer-cell-style">
1412
1554
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1413
1555
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1416,12 +1558,20 @@
1416
1558
 
1417
1559
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1418
1560
 
1561
+ <xsl:template name="refine_table-footer-cell-style">
1562
+
1563
+ </xsl:template> <!-- refine_table-footer-cell-style -->
1564
+
1419
1565
  <xsl:attribute-set name="table-note-style">
1420
1566
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1421
1567
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1422
1568
 
1423
1569
  </xsl:attribute-set><!-- table-note-style -->
1424
1570
 
1571
+ <xsl:template name="refine_table-note-style">
1572
+
1573
+ </xsl:template> <!-- refine_table-note-style -->
1574
+
1425
1575
  <xsl:attribute-set name="table-fn-style">
1426
1576
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1427
1577
 
@@ -1477,11 +1627,19 @@
1477
1627
 
1478
1628
  </xsl:attribute-set>
1479
1629
 
1630
+ <xsl:template name="refine_dt-cell-style">
1631
+
1632
+ </xsl:template> <!-- refine_dt-cell-style -->
1633
+
1480
1634
  <xsl:attribute-set name="dt-block-style">
1481
1635
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1482
1636
 
1483
1637
  </xsl:attribute-set>
1484
1638
 
1639
+ <xsl:template name="refine_dt-block-style">
1640
+
1641
+ </xsl:template> <!-- refine_dt-block-style -->
1642
+
1485
1643
  <xsl:attribute-set name="dl-name-style">
1486
1644
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1487
1645
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1495,6 +1653,10 @@
1495
1653
 
1496
1654
  </xsl:attribute-set>
1497
1655
 
1656
+ <xsl:template name="refine_dd-cell-style">
1657
+
1658
+ </xsl:template> <!-- refine_dd-cell-style -->
1659
+
1498
1660
  <!-- ========================== -->
1499
1661
  <!-- END Definition's list styles -->
1500
1662
  <!-- ========================== -->
@@ -1515,6 +1677,12 @@
1515
1677
 
1516
1678
  </xsl:attribute-set>
1517
1679
 
1680
+ <xsl:template name="refine_eref-style">
1681
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
1682
+ <xsl:variable name="text" select="normalize-space()"/>
1683
+
1684
+ </xsl:template> <!-- refine_eref-style -->
1685
+
1518
1686
  <xsl:attribute-set name="note-style">
1519
1687
 
1520
1688
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
@@ -1523,6 +1691,14 @@
1523
1691
 
1524
1692
  </xsl:attribute-set>
1525
1693
 
1694
+ <xsl:template name="refine_note-style">
1695
+
1696
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
1697
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1698
+ </xsl:if>
1699
+
1700
+ </xsl:template>
1701
+
1526
1702
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1527
1703
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1528
1704
 
@@ -1530,11 +1706,23 @@
1530
1706
 
1531
1707
  </xsl:attribute-set>
1532
1708
 
1709
+ <xsl:template name="refine_note-name-style">
1710
+
1711
+ </xsl:template> <!-- refine_note-name-style -->
1712
+
1533
1713
  <xsl:attribute-set name="table-note-name-style">
1534
1714
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1535
1715
 
1536
1716
  </xsl:attribute-set>
1537
1717
 
1718
+ <xsl:template name="refine_table-note-name-style">
1719
+
1720
+ <xsl:if test="@type = 'source' or @type = 'abbreviation'">
1721
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1722
+ </xsl:if>
1723
+
1724
+ </xsl:template> <!-- refine_table-note-name-style -->
1725
+
1538
1726
  <xsl:attribute-set name="note-p-style">
1539
1727
 
1540
1728
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
@@ -1551,10 +1739,18 @@
1551
1739
 
1552
1740
  </xsl:attribute-set>
1553
1741
 
1742
+ <xsl:template name="refine_termnote-style">
1743
+
1744
+ </xsl:template> <!-- refine_termnote-style -->
1745
+
1554
1746
  <xsl:attribute-set name="termnote-name-style">
1555
1747
 
1556
1748
  </xsl:attribute-set>
1557
1749
 
1750
+ <xsl:template name="refine_termnote-name-style">
1751
+
1752
+ </xsl:template>
1753
+
1558
1754
  <xsl:attribute-set name="termnote-p-style">
1559
1755
 
1560
1756
  </xsl:attribute-set>
@@ -1565,6 +1761,10 @@
1565
1761
 
1566
1762
  </xsl:attribute-set>
1567
1763
 
1764
+ <xsl:template name="refine_quote-style">
1765
+
1766
+ </xsl:template>
1767
+
1568
1768
  <xsl:attribute-set name="quote-source-style">
1569
1769
  <xsl:attribute name="text-align">right</xsl:attribute>
1570
1770
 
@@ -1574,6 +1774,10 @@
1574
1774
 
1575
1775
  </xsl:attribute-set>
1576
1776
 
1777
+ <xsl:template name="refine_termsource-style">
1778
+
1779
+ </xsl:template> <!-- refine_termsource-style -->
1780
+
1577
1781
  <xsl:attribute-set name="termsource-text-style">
1578
1782
 
1579
1783
  </xsl:attribute-set>
@@ -1612,6 +1816,10 @@
1612
1816
 
1613
1817
  </xsl:attribute-set>
1614
1818
 
1819
+ <xsl:template name="refine_figure-name-style">
1820
+
1821
+ </xsl:template> <!-- refine_figure-name-style -->
1822
+
1615
1823
  <xsl:attribute-set name="figure-source-style">
1616
1824
 
1617
1825
  </xsl:attribute-set>
@@ -1628,6 +1836,15 @@
1628
1836
 
1629
1837
  </xsl:attribute-set> <!-- formula-stem-block-style -->
1630
1838
 
1839
+ <xsl:template name="refine_formula-stem-block-style">
1840
+
1841
+ <xsl:if test="ancestor::*[local-name() ='annex']">
1842
+ <xsl:attribute name="text-align">left</xsl:attribute>
1843
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1844
+ </xsl:if>
1845
+
1846
+ </xsl:template> <!-- refine_formula-stem-block-style -->
1847
+
1631
1848
  <xsl:attribute-set name="formula-stem-number-style">
1632
1849
  <xsl:attribute name="text-align">right</xsl:attribute>
1633
1850
 
@@ -1642,6 +1859,15 @@
1642
1859
 
1643
1860
  </xsl:attribute-set>
1644
1861
 
1862
+ <xsl:template name="refine_image-style">
1863
+
1864
+ <xsl:if test="ancestor::un:admonition">
1865
+ <xsl:attribute name="margin-top">-12mm</xsl:attribute>
1866
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1867
+ </xsl:if>
1868
+
1869
+ </xsl:template>
1870
+
1645
1871
  <xsl:attribute-set name="figure-pseudocode-p-style">
1646
1872
 
1647
1873
  </xsl:attribute-set>
@@ -1728,6 +1954,10 @@
1728
1954
 
1729
1955
  </xsl:attribute-set>
1730
1956
 
1957
+ <xsl:template name="refine_mathml-style">
1958
+
1959
+ </xsl:template>
1960
+
1731
1961
  <xsl:attribute-set name="list-style">
1732
1962
 
1733
1963
  <xsl:attribute name="provisional-distance-between-starts">3.5mm</xsl:attribute>
@@ -1736,6 +1966,10 @@
1736
1966
 
1737
1967
  </xsl:attribute-set> <!-- list-style -->
1738
1968
 
1969
+ <xsl:template name="refine_list-style">
1970
+
1971
+ </xsl:template> <!-- refine_list-style -->
1972
+
1739
1973
  <xsl:attribute-set name="list-name-style">
1740
1974
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1741
1975
 
@@ -1747,14 +1981,26 @@
1747
1981
 
1748
1982
  </xsl:attribute-set>
1749
1983
 
1984
+ <xsl:template name="refine_list-item-style">
1985
+
1986
+ </xsl:template> <!-- refine_list-item-style -->
1987
+
1750
1988
  <xsl:attribute-set name="list-item-label-style">
1751
1989
 
1752
1990
  </xsl:attribute-set>
1753
1991
 
1992
+ <xsl:template name="refine_list-item-label-style">
1993
+
1994
+ </xsl:template> <!-- refine_list-item-label-style -->
1995
+
1754
1996
  <xsl:attribute-set name="list-item-body-style">
1755
1997
 
1756
1998
  </xsl:attribute-set>
1757
1999
 
2000
+ <xsl:template name="refine_list-item-body-style">
2001
+
2002
+ </xsl:template> <!-- refine_list-item-body-style -->
2003
+
1758
2004
  <xsl:attribute-set name="toc-style">
1759
2005
  <xsl:attribute name="line-height">135%</xsl:attribute>
1760
2006
  </xsl:attribute-set>
@@ -1765,6 +2011,10 @@
1765
2011
 
1766
2012
  </xsl:attribute-set>
1767
2013
 
2014
+ <xsl:template name="refine_fn-reference-style">
2015
+
2016
+ </xsl:template> <!-- refine_fn-reference-style -->
2017
+
1768
2018
  <xsl:attribute-set name="fn-style">
1769
2019
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1770
2020
  </xsl:attribute-set>
@@ -1788,6 +2038,10 @@
1788
2038
 
1789
2039
  </xsl:attribute-set>
1790
2040
 
2041
+ <xsl:template name="refine_fn-body-style">
2042
+
2043
+ </xsl:template> <!-- refine_fn-body-style -->
2044
+
1791
2045
  <xsl:attribute-set name="fn-body-num-style">
1792
2046
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1793
2047
 
@@ -1797,6 +2051,10 @@
1797
2051
 
1798
2052
  </xsl:attribute-set> <!-- fn-body-num-style -->
1799
2053
 
2054
+ <xsl:template name="refine_fn-body-num-style">
2055
+
2056
+ </xsl:template> <!-- refine_fn-body-num-style -->
2057
+
1800
2058
  <!-- admonition -->
1801
2059
  <xsl:attribute-set name="admonition-style">
1802
2060
 
@@ -2452,14 +2710,9 @@
2452
2710
 
2453
2711
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2454
2712
 
2455
- <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2456
- <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2457
-
2458
- <xsl:if test="not(ancestor::*[local-name()='sections'])">
2459
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2460
- </xsl:if>
2461
-
2462
- <!-- end table block-container attributes -->
2713
+ <xsl:call-template name="refine_table-container-style">
2714
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2715
+ </xsl:call-template>
2463
2716
 
2464
2717
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2465
2718
 
@@ -2486,17 +2739,9 @@
2486
2739
 
2487
2740
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2488
2741
 
2489
- <xsl:if test="$margin-side != 0">
2490
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2491
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2492
- </xsl:if>
2493
-
2494
- <xsl:call-template name="setBordersTableArray"/>
2495
-
2496
- <xsl:if test="ancestor::*[local-name()='sections']">
2497
- <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute>
2498
- <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute>
2499
- </xsl:if>
2742
+ <xsl:call-template name="refine_table-style">
2743
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2744
+ </xsl:call-template>
2500
2745
 
2501
2746
  </xsl:element>
2502
2747
  </xsl:variable>
@@ -2562,7 +2807,7 @@
2562
2807
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2563
2808
  </xsl:when>
2564
2809
  <xsl:otherwise>
2565
- <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 -->
2810
+ <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 -->
2566
2811
  </xsl:otherwise>
2567
2812
  </xsl:choose>
2568
2813
 
@@ -2649,6 +2894,10 @@
2649
2894
 
2650
2895
  <fo:block xsl:use-attribute-sets="table-name-style">
2651
2896
 
2897
+ <xsl:call-template name="refine_table-name-style">
2898
+ <xsl:with-param name="continued" select="$continued"/>
2899
+ </xsl:call-template>
2900
+
2652
2901
  <xsl:choose>
2653
2902
  <xsl:when test="$continued = 'true'">
2654
2903
 
@@ -3031,6 +3280,8 @@
3031
3280
  <fo:table-row>
3032
3281
  <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">
3033
3282
 
3283
+ <xsl:call-template name="refine_table-header-title-style"/>
3284
+
3034
3285
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3035
3286
  <xsl:with-param name="continued">true</xsl:with-param>
3036
3287
  </xsl:apply-templates>
@@ -3043,6 +3294,10 @@
3043
3294
  </fo:table-row>
3044
3295
  </xsl:template> <!-- table-header-title -->
3045
3296
 
3297
+ <xsl:template name="refine_table-header-title-style">
3298
+
3299
+ </xsl:template> <!-- refine_table-header-title-style -->
3300
+
3046
3301
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3047
3302
  <fo:table-body>
3048
3303
  <xsl:apply-templates/>
@@ -3067,7 +3322,7 @@
3067
3322
  <xsl:param name="colwidths"/>
3068
3323
  <xsl:param name="colgroup"/>
3069
3324
 
3070
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3325
+ <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']"/>
3071
3326
 
3072
3327
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3073
3328
 
@@ -3127,6 +3382,8 @@
3127
3382
  <fo:table-row>
3128
3383
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3129
3384
 
3385
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3386
+
3130
3387
  <xsl:call-template name="setBordersTableArray"/>
3131
3388
 
3132
3389
  <!-- fn will be processed inside 'note' processing -->
@@ -3135,6 +3392,7 @@
3135
3392
 
3136
3393
  <!-- except gb and bsi -->
3137
3394
 
3395
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3138
3396
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3139
3397
  <xsl:apply-templates select="../*[local-name()='note']"/>
3140
3398
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3266,7 +3524,7 @@
3266
3524
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3267
3525
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3268
3526
 
3269
- <xsl:call-template name="setBordersTableArray"/>
3527
+ <xsl:call-template name="refine_table-header-row-style"/>
3270
3528
 
3271
3529
  <xsl:call-template name="setTableRowAttributes"/>
3272
3530
 
@@ -3300,6 +3558,8 @@
3300
3558
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3301
3559
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3302
3560
 
3561
+ <xsl:call-template name="refine_table-footer-row-style"/>
3562
+
3303
3563
  <xsl:call-template name="setTableRowAttributes"/>
3304
3564
  <xsl:apply-templates/>
3305
3565
  </fo:table-row>
@@ -3313,9 +3573,10 @@
3313
3573
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3314
3574
  </xsl:if>
3315
3575
 
3316
- <xsl:call-template name="setBordersTableArray"/>
3576
+ <xsl:call-template name="refine_table-body-row-style"/>
3317
3577
 
3318
3578
  <xsl:call-template name="setTableRowAttributes"/>
3579
+
3319
3580
  <xsl:apply-templates/>
3320
3581
  </fo:table-row>
3321
3582
  </xsl:template>
@@ -3334,28 +3595,7 @@
3334
3595
  <xsl:with-param name="default">center</xsl:with-param>
3335
3596
  </xsl:call-template>
3336
3597
 
3337
- <xsl:call-template name="setBordersTableArray"/>
3338
-
3339
- <xsl:if test="ancestor::*[local-name()='sections']">
3340
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3341
- <xsl:attribute name="display-align">before</xsl:attribute>
3342
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3343
- </xsl:if>
3344
- <xsl:if test="ancestor::*[local-name()='annex']">
3345
- <xsl:attribute name="font-weight">normal</xsl:attribute>
3346
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3347
- <xsl:attribute name="background-color">rgb(218, 218, 218)</xsl:attribute>
3348
- <xsl:if test="starts-with(text(), '1') or starts-with(text(), '2') or starts-with(text(), '3') or starts-with(text(), '4') or starts-with(text(), '5') or starts-with(text(), '6') or starts-with(text(), '7') or starts-with(text(), '8') or starts-with(text(), '9')">
3349
- <xsl:attribute name="color">rgb(46, 116, 182)</xsl:attribute>
3350
- <xsl:attribute name="font-weight">bold</xsl:attribute>
3351
- </xsl:if>
3352
- </xsl:if>
3353
-
3354
- <xsl:if test="$lang = 'ar'">
3355
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3356
- </xsl:if>
3357
-
3358
- <xsl:call-template name="setTableCellAttributes"/>
3598
+ <xsl:call-template name="refine_table-header-cell-style"/>
3359
3599
 
3360
3600
  <fo:block>
3361
3601
  <xsl:apply-templates/>
@@ -3397,18 +3637,7 @@
3397
3637
  <xsl:with-param name="default">left</xsl:with-param>
3398
3638
  </xsl:call-template>
3399
3639
 
3400
- <xsl:if test="$lang = 'ar'">
3401
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3402
- </xsl:if>
3403
-
3404
- <!-- bsi -->
3405
-
3406
- <xsl:call-template name="setBordersTableArray"/>
3407
-
3408
- <xsl:if test="ancestor::*[local-name()='sections']">
3409
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3410
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3411
- </xsl:if>
3640
+ <xsl:call-template name="refine_table-cell-style"/>
3412
3641
 
3413
3642
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3414
3643
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3439,12 +3668,12 @@
3439
3668
 
3440
3669
  <fo:block xsl:use-attribute-sets="table-note-style">
3441
3670
 
3671
+ <xsl:call-template name="refine_table-note-style"/>
3672
+
3442
3673
  <!-- Table's note name (NOTE, for example) -->
3443
3674
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3444
3675
 
3445
- <xsl:if test="@type = 'source' or @type = 'abbreviation'">
3446
- <xsl:attribute name="font-size">9pt</xsl:attribute>
3447
- </xsl:if>
3676
+ <xsl:call-template name="refine_table-note-name-style"/>
3448
3677
 
3449
3678
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3450
3679
 
@@ -3473,6 +3702,14 @@
3473
3702
  <!-- list of footnotes to calculate actual footnotes number -->
3474
3703
  <xsl:variable name="p_fn_">
3475
3704
  <xsl:call-template name="get_fn_list"/>
3705
+ <!-- <xsl:choose>
3706
+ <xsl:when test="$namespace = 'jis'">
3707
+ <xsl:call-template name="get_fn_list_for_element"/>
3708
+ </xsl:when>
3709
+ <xsl:otherwise>
3710
+ <xsl:call-template name="get_fn_list"/>
3711
+ </xsl:otherwise>
3712
+ </xsl:choose> -->
3476
3713
  </xsl:variable>
3477
3714
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3478
3715
 
@@ -3497,7 +3734,14 @@
3497
3734
 
3498
3735
  </xsl:variable>
3499
3736
 
3500
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3737
+ <xsl:variable name="ref_id">
3738
+ <xsl:choose>
3739
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
3740
+ <xsl:otherwise>
3741
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3742
+ </xsl:otherwise>
3743
+ </xsl:choose>
3744
+ </xsl:variable>
3501
3745
  <xsl:variable name="footnote_inline">
3502
3746
  <fo:inline>
3503
3747
 
@@ -3520,9 +3764,13 @@
3520
3764
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3521
3765
  </xsl:if>
3522
3766
 
3523
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3524
- <xsl:value-of select="$current_fn_number_text"/>
3525
- </fo:basic-link>
3767
+ <xsl:call-template name="insert_basic_link">
3768
+ <xsl:with-param name="element">
3769
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3770
+ <xsl:copy-of select="$current_fn_number_text"/>
3771
+ </fo:basic-link>
3772
+ </xsl:with-param>
3773
+ </xsl:call-template>
3526
3774
  </fo:inline>
3527
3775
  </xsl:variable>
3528
3776
 
@@ -3539,8 +3787,12 @@
3539
3787
 
3540
3788
  <fo:block xsl:use-attribute-sets="fn-body-style">
3541
3789
 
3790
+ <xsl:call-template name="refine_fn-body-style"/>
3791
+
3542
3792
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3543
3793
 
3794
+ <xsl:call-template name="refine_fn-body-num-style"/>
3795
+
3544
3796
  <xsl:value-of select="$current_fn_number_text"/>
3545
3797
  </fo:inline>
3546
3798
  <xsl:apply-templates/>
@@ -3592,6 +3844,28 @@
3592
3844
  </xsl:choose>
3593
3845
  </xsl:template>
3594
3846
 
3847
+ <xsl:template name="get_fn_list_for_element">
3848
+ <xsl:choose>
3849
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
3850
+ <fn gen_id="{generate-id(.)}">
3851
+ <xsl:copy-of select="@*"/>
3852
+ <xsl:copy-of select="node()"/>
3853
+ </fn>
3854
+ </xsl:when>
3855
+ <xsl:otherwise>
3856
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
3857
+ <xsl:variable name="element_id" select="@id"/>
3858
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3859
+ <!-- copy unique fn -->
3860
+ <fn gen_id="{generate-id(.)}">
3861
+ <xsl:copy-of select="@*"/>
3862
+ <xsl:copy-of select="node()"/>
3863
+ </fn>
3864
+ </xsl:for-each>
3865
+ </xsl:for-each>
3866
+ </xsl:otherwise>
3867
+ </xsl:choose>
3868
+ </xsl:template>
3595
3869
  <!-- ============================ -->
3596
3870
  <!-- table's footnotes rendering -->
3597
3871
  <!-- ============================ -->
@@ -3766,6 +4040,8 @@
3766
4040
  <xsl:template match="*[local-name()='fn']">
3767
4041
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
3768
4042
 
4043
+ <xsl:call-template name="refine_fn-reference-style"/>
4044
+
3769
4045
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3770
4046
 
3771
4047
  <xsl:value-of select="@reference"/>
@@ -3855,14 +4131,18 @@
3855
4131
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3856
4132
  <xsl:text> </xsl:text>
3857
4133
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3858
- <xsl:text/>
3859
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4134
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4135
+ <xsl:text> </xsl:text>
4136
+ </xsl:if>
4137
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3860
4138
  </fo:block>
3861
4139
 
3862
4140
  </xsl:when> <!-- END: only one component -->
3863
4141
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3864
4142
  <fo:block margin-bottom="12pt" text-align="left">
3865
4143
 
4144
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4145
+
3866
4146
  <!-- <xsl:variable name="title-where">
3867
4147
  <xsl:call-template name="getLocalizedString">
3868
4148
  <xsl:with-param name="key">where</xsl:with-param>
@@ -3876,6 +4156,8 @@
3876
4156
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3877
4157
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3878
4158
 
4159
+ <xsl:call-template name="refine_figure_key_style"/>
4160
+
3879
4161
  <xsl:variable name="title-key">
3880
4162
  <xsl:call-template name="getLocalizedString">
3881
4163
  <xsl:with-param name="key">key</xsl:with-param>
@@ -3890,12 +4172,16 @@
3890
4172
  <xsl:if test="$onlyOneComponent = 'false'">
3891
4173
  <fo:block>
3892
4174
 
4175
+ <xsl:call-template name="refine_multicomponent_style"/>
4176
+
3893
4177
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3894
4178
  <xsl:attribute name="margin-top">0</xsl:attribute>
3895
4179
  </xsl:if>
3896
4180
 
3897
4181
  <fo:block>
3898
4182
 
4183
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4184
+
3899
4185
  <xsl:apply-templates select="*[local-name() = 'name']">
3900
4186
  <xsl:with-param name="process">true</xsl:with-param>
3901
4187
  </xsl:apply-templates>
@@ -4053,6 +4339,24 @@
4053
4339
 
4054
4340
  </xsl:template> <!-- END: dl -->
4055
4341
 
4342
+ <xsl:template name="refine_dl_formula_where_style">
4343
+
4344
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4345
+
4346
+ <xsl:template name="refine_figure_key_style">
4347
+
4348
+ </xsl:template> <!-- refine_figure_key_style -->
4349
+
4350
+ <xsl:template name="refine_multicomponent_style">
4351
+ <xsl:variable name="parent" select="local-name(..)"/>
4352
+
4353
+ </xsl:template> <!-- refine_multicomponent_style -->
4354
+
4355
+ <xsl:template name="refine_multicomponent_block_style">
4356
+ <xsl:variable name="parent" select="local-name(..)"/>
4357
+
4358
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4359
+
4056
4360
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4057
4361
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4058
4362
 
@@ -4272,6 +4576,8 @@
4272
4576
 
4273
4577
  </xsl:if>
4274
4578
 
4579
+ <xsl:call-template name="refine_dt-cell-style"/>
4580
+
4275
4581
  <fo:block xsl:use-attribute-sets="dt-block-style">
4276
4582
  <xsl:copy-of select="@id"/>
4277
4583
 
@@ -4279,6 +4585,8 @@
4279
4585
  <xsl:attribute name="margin-top">0</xsl:attribute>
4280
4586
  </xsl:if>
4281
4587
 
4588
+ <xsl:call-template name="refine_dt-block-style"/>
4589
+
4282
4590
  <xsl:apply-templates>
4283
4591
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4284
4592
  </xsl:apply-templates>
@@ -4298,6 +4606,8 @@
4298
4606
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4299
4607
  </xsl:if>
4300
4608
 
4609
+ <xsl:call-template name="refine_dd-cell-style"/>
4610
+
4301
4611
  <fo:block>
4302
4612
 
4303
4613
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4343,8 +4653,18 @@
4343
4653
  </xsl:if>
4344
4654
  </xsl:template>
4345
4655
 
4346
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4347
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4656
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4657
+ <xsl:variable name="is_inline_element_after_where">
4658
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4659
+ </xsl:variable>
4660
+ <xsl:choose>
4661
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4662
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4663
+ </xsl:when>
4664
+ <xsl:otherwise>
4665
+ <xsl:apply-templates select="."/>
4666
+ </xsl:otherwise>
4667
+ </xsl:choose>
4348
4668
  </xsl:template>
4349
4669
 
4350
4670
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4438,12 +4758,18 @@
4438
4758
  <xsl:param name="split_keep-within-line"/>
4439
4759
  <fo:inline font-weight="bold">
4440
4760
 
4761
+ <xsl:call-template name="refine_strong_style"/>
4762
+
4441
4763
  <xsl:apply-templates>
4442
4764
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4443
4765
  </xsl:apply-templates>
4444
4766
  </fo:inline>
4445
4767
  </xsl:template>
4446
4768
 
4769
+ <xsl:template name="refine_strong_style">
4770
+
4771
+ </xsl:template>
4772
+
4447
4773
  <xsl:template match="*[local-name()='padding']">
4448
4774
  <fo:inline padding-right="{@value}"> </fo:inline>
4449
4775
  </xsl:template>
@@ -4910,7 +5236,10 @@
4910
5236
  </xsl:choose>
4911
5237
  </xsl:variable>
4912
5238
 
4913
- <xsl:value-of select="$text9"/>
5239
+ <!-- replace sequence #x200B and space TO space -->
5240
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5241
+
5242
+ <xsl:value-of select="$text10"/>
4914
5243
  </xsl:template>
4915
5244
 
4916
5245
  <xsl:template name="add-zero-spaces-link-java">
@@ -5585,6 +5914,11 @@
5585
5914
 
5586
5915
  <fo:inline xsl:use-attribute-sets="mathml-style">
5587
5916
 
5917
+ <!-- DEBUG -->
5918
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
5919
+
5920
+ <xsl:call-template name="refine_mathml-style"/>
5921
+
5588
5922
  <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 -->
5589
5923
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5590
5924
  </xsl:if>
@@ -5689,6 +6023,8 @@
5689
6023
 
5690
6024
  <fo:instream-foreign-object fox:alt-text="Math">
5691
6025
 
6026
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6027
+
5692
6028
  <!-- put MathML in Actual Text -->
5693
6029
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5694
6030
  <xsl:attribute name="fox:actual-text">
@@ -5709,6 +6045,10 @@
5709
6045
  </fo:instream-foreign-object>
5710
6046
  </xsl:template>
5711
6047
 
6048
+ <xsl:template name="refine_mathml_insteam_object_style">
6049
+
6050
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6051
+
5712
6052
  <xsl:template match="mathml:*" mode="mathml_actual_text">
5713
6053
  <!-- <xsl:text>a+b</xsl:text> -->
5714
6054
  <xsl:text>&lt;</xsl:text>
@@ -5772,6 +6112,79 @@
5772
6112
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5773
6113
  </xsl:template>
5774
6114
 
6115
+ <!-- special case for:
6116
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6117
+ <mstyle displaystyle="true">
6118
+ <msup>
6119
+ <mi color="#00000000">C</mi>
6120
+ <mtext>R</mtext>
6121
+ </msup>
6122
+ <msubsup>
6123
+ <mtext>C</mtext>
6124
+ <mi>n</mi>
6125
+ <mi>k</mi>
6126
+ </msubsup>
6127
+ </mstyle>
6128
+ </math>
6129
+ -->
6130
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6131
+ <xsl:copy>
6132
+ <xsl:copy-of select="@*"/>
6133
+ <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"/>
6134
+ <xsl:if test="string-length($next_mtext) != ''">
6135
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6136
+ </xsl:if>
6137
+ <xsl:apply-templates/>
6138
+ <xsl:value-of select="$next_mtext"/>
6139
+ </xsl:copy>
6140
+ </xsl:template>
6141
+
6142
+ <!-- special case for:
6143
+ <msup>
6144
+ <mtext/>
6145
+ <mn>1</mn>
6146
+ </msup>
6147
+ convert to (add mspace after mtext and enclose them into mrow):
6148
+ <msup>
6149
+ <mrow>
6150
+ <mtext/>
6151
+ <mspace height="1.47ex"/>
6152
+ </mrow>
6153
+ <mn>1</mn>
6154
+ </msup>
6155
+ -->
6156
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6157
+ <mathml:mrow>
6158
+ <xsl:copy-of select="."/>
6159
+ <mathml:mspace height="1.47ex"/>
6160
+ </mathml:mrow>
6161
+ </xsl:template>
6162
+
6163
+ <!-- add space around vertical line -->
6164
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6165
+ <xsl:copy>
6166
+ <xsl:apply-templates select="@*" mode="mathml"/>
6167
+ <xsl:if test="not(@lspace)">
6168
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6169
+ </xsl:if>
6170
+ <xsl:if test="not(@rspace)">
6171
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6172
+ </xsl:if>
6173
+ <xsl:apply-templates mode="mathml"/>
6174
+ </xsl:copy>
6175
+ </xsl:template>
6176
+
6177
+ <!-- decrease fontsize for 'Circled Times' char -->
6178
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6179
+ <xsl:copy>
6180
+ <xsl:apply-templates select="@*" mode="mathml"/>
6181
+ <xsl:if test="not(@fontsize)">
6182
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6183
+ </xsl:if>
6184
+ <xsl:apply-templates mode="mathml"/>
6185
+ </xsl:copy>
6186
+ </xsl:template>
6187
+
5775
6188
  <!-- Examples:
5776
6189
  <stem type="AsciiMath">x = 1</stem>
5777
6190
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5780,6 +6193,8 @@
5780
6193
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5781
6194
  <fo:inline xsl:use-attribute-sets="mathml-style">
5782
6195
 
6196
+ <xsl:call-template name="refine_mathml-style"/>
6197
+
5783
6198
  <xsl:choose>
5784
6199
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5785
6200
  <xsl:otherwise>
@@ -5824,24 +6239,30 @@
5824
6239
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5825
6240
  </xsl:if>
5826
6241
 
6242
+ <xsl:call-template name="refine_link-style"/>
6243
+
5827
6244
  <xsl:choose>
5828
6245
  <xsl:when test="$target_text = ''">
5829
6246
  <xsl:apply-templates/>
5830
6247
  </xsl:when>
5831
6248
  <xsl:otherwise>
5832
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5833
- <xsl:choose>
5834
- <xsl:when test="normalize-space(.) = ''">
5835
- <xsl:call-template name="add-zero-spaces-link-java">
5836
- <xsl:with-param name="text" select="$target_text"/>
5837
- </xsl:call-template>
5838
- </xsl:when>
5839
- <xsl:otherwise>
5840
- <!-- output text from <link>text</link> -->
5841
- <xsl:apply-templates/>
5842
- </xsl:otherwise>
5843
- </xsl:choose>
5844
- </fo:basic-link>
6249
+ <xsl:call-template name="insert_basic_link">
6250
+ <xsl:with-param name="element">
6251
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6252
+ <xsl:choose>
6253
+ <xsl:when test="normalize-space(.) = ''">
6254
+ <xsl:call-template name="add-zero-spaces-link-java">
6255
+ <xsl:with-param name="text" select="$target_text"/>
6256
+ </xsl:call-template>
6257
+ </xsl:when>
6258
+ <xsl:otherwise>
6259
+ <!-- output text from <link>text</link> -->
6260
+ <xsl:apply-templates/>
6261
+ </xsl:otherwise>
6262
+ </xsl:choose>
6263
+ </fo:basic-link>
6264
+ </xsl:with-param>
6265
+ </xsl:call-template>
5845
6266
  </xsl:otherwise>
5846
6267
  </xsl:choose>
5847
6268
  </fo:inline>
@@ -5904,12 +6325,19 @@
5904
6325
  </xsl:template>
5905
6326
 
5906
6327
  <xsl:template match="*[local-name() = 'xref']">
5907
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5908
- <xsl:if test="parent::*[local-name() = 'add']">
5909
- <xsl:call-template name="append_add-style"/>
5910
- </xsl:if>
5911
- <xsl:apply-templates/>
5912
- </fo:basic-link>
6328
+ <xsl:call-template name="insert_basic_link">
6329
+ <xsl:with-param name="element">
6330
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6331
+ <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'])">
6332
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6333
+ </xsl:if>
6334
+ <xsl:if test="parent::*[local-name() = 'add']">
6335
+ <xsl:call-template name="append_add-style"/>
6336
+ </xsl:if>
6337
+ <xsl:apply-templates/>
6338
+ </fo:basic-link>
6339
+ </xsl:with-param>
6340
+ </xsl:call-template>
5913
6341
  </xsl:template>
5914
6342
 
5915
6343
  <!-- ====== -->
@@ -5964,10 +6392,7 @@
5964
6392
  <fo:table-cell display-align="center">
5965
6393
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5966
6394
 
5967
- <xsl:if test="ancestor::*[local-name() ='annex']">
5968
- <xsl:attribute name="text-align">left</xsl:attribute>
5969
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
5970
- </xsl:if>
6395
+ <xsl:call-template name="refine_formula-stem-block-style"/>
5971
6396
 
5972
6397
  <xsl:apply-templates/>
5973
6398
  </fo:block>
@@ -6010,25 +6435,18 @@
6010
6435
 
6011
6436
  <xsl:call-template name="setBlockSpanAll"/>
6012
6437
 
6013
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6014
- <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
6015
- </xsl:if>
6438
+ <xsl:call-template name="refine_note-style"/>
6016
6439
 
6017
6440
  <fo:block-container margin-left="0mm" margin-right="0mm">
6018
6441
 
6019
6442
  <fo:block>
6020
6443
 
6021
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6022
- <xsl:attribute name="text-indent">0</xsl:attribute>
6023
- <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
6024
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6025
- <xsl:attribute name="font-size">9pt</xsl:attribute>
6026
- <xsl:attribute name="text-align">justify</xsl:attribute>
6027
- <xsl:attribute name="padding-top">0mm</xsl:attribute>
6028
- </xsl:if>
6444
+ <xsl:call-template name="refine_note_block_style"/>
6029
6445
 
6030
6446
  <fo:inline xsl:use-attribute-sets="note-name-style">
6031
6447
 
6448
+ <xsl:call-template name="refine_note-name-style"/>
6449
+
6032
6450
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6033
6451
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6034
6452
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6054,6 +6472,19 @@
6054
6472
 
6055
6473
  </xsl:template>
6056
6474
 
6475
+ <xsl:template name="refine_note_block_style">
6476
+
6477
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6478
+ <xsl:attribute name="text-indent">0</xsl:attribute>
6479
+ <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
6480
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6481
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
6482
+ <xsl:attribute name="text-align">justify</xsl:attribute>
6483
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
6484
+ </xsl:if>
6485
+
6486
+ </xsl:template>
6487
+
6057
6488
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6058
6489
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6059
6490
  <xsl:choose>
@@ -6075,12 +6506,16 @@
6075
6506
 
6076
6507
  <xsl:call-template name="setBlockSpanAll"/>
6077
6508
 
6509
+ <xsl:call-template name="refine_termnote-style"/>
6510
+
6078
6511
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6079
6512
 
6080
6513
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6081
6514
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6082
6515
  </xsl:if>
6083
6516
 
6517
+ <xsl:call-template name="refine_termnote-name-style"/>
6518
+
6084
6519
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6085
6520
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6086
6521
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6254,10 +6689,7 @@
6254
6689
  <xsl:otherwise>
6255
6690
  <fo:block xsl:use-attribute-sets="image-style">
6256
6691
 
6257
- <xsl:if test="ancestor::un:admonition">
6258
- <xsl:attribute name="margin-top">-12mm</xsl:attribute>
6259
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
6260
- </xsl:if>
6692
+ <xsl:call-template name="refine_image-style"/>
6261
6693
 
6262
6694
  <xsl:variable name="src">
6263
6695
  <xsl:call-template name="image_src"/>
@@ -6317,7 +6749,7 @@
6317
6749
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6318
6750
  </xsl:when>
6319
6751
  <xsl:when test="not(starts-with(@src, 'data:'))">
6320
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6752
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6321
6753
  </xsl:when>
6322
6754
  <xsl:otherwise>
6323
6755
  <xsl:value-of select="@src"/>
@@ -6339,7 +6771,7 @@
6339
6771
  </xsl:when>
6340
6772
  <xsl:when test="not(starts-with(@src, 'data:'))">
6341
6773
  <xsl:variable name="src">
6342
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6774
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6343
6775
  </xsl:variable>
6344
6776
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6345
6777
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6725,15 +7157,19 @@
6725
7157
  <xsl:param name="dest"/>
6726
7158
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6727
7159
  <fo:block font-size="1pt">
6728
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6729
- <fo:inline-container inline-progression-dimension="100%">
6730
- <fo:block-container height="{$height - 1}px" width="100%">
6731
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6732
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6733
- </xsl:if> -->
6734
- <fo:block> </fo:block></fo:block-container>
6735
- </fo:inline-container>
6736
- </fo:basic-link>
7160
+ <xsl:call-template name="insert_basic_link">
7161
+ <xsl:with-param name="element">
7162
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7163
+ <fo:inline-container inline-progression-dimension="100%">
7164
+ <fo:block-container height="{$height - 1}px" width="100%">
7165
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7166
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7167
+ </xsl:if> -->
7168
+ <fo:block> </fo:block></fo:block-container>
7169
+ </fo:inline-container>
7170
+ </fo:basic-link>
7171
+ </xsl:with-param>
7172
+ </xsl:call-template>
6737
7173
  </fo:block>
6738
7174
  </fo:block-container>
6739
7175
  </xsl:template>
@@ -7104,6 +7540,8 @@
7104
7540
  <xsl:if test="normalize-space() != ''">
7105
7541
  <fo:block xsl:use-attribute-sets="figure-name-style">
7106
7542
 
7543
+ <xsl:call-template name="refine_figure-name-style"/>
7544
+
7107
7545
  <xsl:apply-templates/>
7108
7546
  </fo:block>
7109
7547
  </xsl:if>
@@ -7368,6 +7806,8 @@
7368
7806
  </xsl:attribute>
7369
7807
  </xsl:for-each>
7370
7808
 
7809
+ <xsl:call-template name="refine_sourcecode-style"/>
7810
+
7371
7811
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7372
7812
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7373
7813
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -8072,6 +8512,8 @@
8072
8512
 
8073
8513
  <xsl:call-template name="setBlockSpanAll"/>
8074
8514
 
8515
+ <xsl:call-template name="refine_example-style"/>
8516
+
8075
8517
  <xsl:variable name="fo_element">
8076
8518
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8077
8519
  block
@@ -8199,9 +8641,7 @@
8199
8641
  </xsl:if>
8200
8642
  <fo:block xsl:use-attribute-sets="example-p-style">
8201
8643
 
8202
- <xsl:if test="$num = 1">
8203
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
8204
- </xsl:if>
8644
+ <xsl:call-template name="refine_example-p-style"/>
8205
8645
 
8206
8646
  <xsl:apply-templates/>
8207
8647
  </fo:block>
@@ -8219,6 +8659,7 @@
8219
8659
  </xsl:otherwise>
8220
8660
  </xsl:choose>
8221
8661
  </xsl:template> <!-- example/p -->
8662
+
8222
8663
  <!-- ====== -->
8223
8664
  <!-- ====== -->
8224
8665
 
@@ -8230,6 +8671,8 @@
8230
8671
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8231
8672
  <fo:block xsl:use-attribute-sets="termsource-style">
8232
8673
 
8674
+ <xsl:call-template name="refine_termsource-style"/>
8675
+
8233
8676
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8234
8677
  <xsl:variable name="termsource_text">
8235
8678
  <xsl:apply-templates/>
@@ -8282,14 +8725,18 @@
8282
8725
  </xsl:template>
8283
8726
 
8284
8727
  <xsl:template match="*[local-name() = 'origin']">
8285
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8286
- <xsl:if test="normalize-space(@citeas) = ''">
8287
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8288
- </xsl:if>
8289
- <fo:inline xsl:use-attribute-sets="origin-style">
8290
- <xsl:apply-templates/>
8291
- </fo:inline>
8292
- </fo:basic-link>
8728
+ <xsl:call-template name="insert_basic_link">
8729
+ <xsl:with-param name="element">
8730
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8731
+ <xsl:if test="normalize-space(@citeas) = ''">
8732
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8733
+ </xsl:if>
8734
+ <fo:inline xsl:use-attribute-sets="origin-style">
8735
+ <xsl:apply-templates/>
8736
+ </fo:inline>
8737
+ </fo:basic-link>
8738
+ </xsl:with-param>
8739
+ </xsl:call-template>
8293
8740
  </xsl:template>
8294
8741
 
8295
8742
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8341,6 +8788,8 @@
8341
8788
  <fo:block-container margin-left="0mm">
8342
8789
  <fo:block-container xsl:use-attribute-sets="quote-style">
8343
8790
 
8791
+ <xsl:call-template name="refine_quote-style"/>
8792
+
8344
8793
  <fo:block-container margin-left="0mm" margin-right="0mm">
8345
8794
  <fo:block role="BlockQuote">
8346
8795
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8363,9 +8812,13 @@
8363
8812
  <xsl:if test="../*[local-name() = 'author']">
8364
8813
  <xsl:text>, </xsl:text>
8365
8814
  </xsl:if>
8366
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8367
- <xsl:apply-templates/>
8368
- </fo:basic-link>
8815
+ <xsl:call-template name="insert_basic_link">
8816
+ <xsl:with-param name="element">
8817
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8818
+ <xsl:apply-templates/>
8819
+ </fo:basic-link>
8820
+ </xsl:with-param>
8821
+ </xsl:call-template>
8369
8822
  </xsl:template>
8370
8823
 
8371
8824
  <xsl:template match="*[local-name() = 'author']">
@@ -8411,28 +8864,33 @@
8411
8864
 
8412
8865
  </xsl:if>
8413
8866
 
8414
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8415
- <xsl:variable name="text" select="normalize-space()"/>
8867
+ <xsl:call-template name="refine_eref-style"/>
8416
8868
 
8417
- <fo:basic-link fox:alt-text="{@citeas}">
8418
- <xsl:if test="normalize-space(@citeas) = ''">
8419
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8420
- </xsl:if>
8421
- <xsl:if test="@type = 'inline'">
8869
+ <xsl:call-template name="insert_basic_link">
8870
+ <xsl:with-param name="element">
8871
+ <fo:basic-link fox:alt-text="{@citeas}">
8872
+ <xsl:if test="normalize-space(@citeas) = ''">
8873
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8874
+ </xsl:if>
8875
+ <xsl:if test="@type = 'inline'">
8422
8876
 
8423
- </xsl:if>
8877
+ <xsl:call-template name="refine_basic_link_style"/>
8424
8878
 
8425
- <xsl:choose>
8426
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8427
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8428
- </xsl:when>
8429
- <xsl:otherwise>
8430
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8431
- </xsl:otherwise>
8432
- </xsl:choose>
8879
+ </xsl:if>
8433
8880
 
8434
- <xsl:apply-templates/>
8435
- </fo:basic-link>
8881
+ <xsl:choose>
8882
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8883
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8884
+ </xsl:when>
8885
+ <xsl:otherwise>
8886
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8887
+ </xsl:otherwise>
8888
+ </xsl:choose>
8889
+
8890
+ <xsl:apply-templates/>
8891
+ </fo:basic-link>
8892
+ </xsl:with-param>
8893
+ </xsl:call-template>
8436
8894
 
8437
8895
  </fo:inline>
8438
8896
  </xsl:when>
@@ -8450,6 +8908,11 @@
8450
8908
  </xsl:otherwise>
8451
8909
  </xsl:choose>
8452
8910
  </xsl:template>
8911
+
8912
+ <xsl:template name="refine_basic_link_style">
8913
+
8914
+ </xsl:template> <!-- refine_basic_link_style -->
8915
+
8453
8916
  <!-- ====== -->
8454
8917
  <!-- END eref -->
8455
8918
  <!-- ====== -->
@@ -8594,16 +9057,22 @@
8594
9057
  <fo:block>
8595
9058
  <xsl:call-template name="setId"/>
8596
9059
 
8597
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8598
- <xsl:if test="$num = 1">
8599
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
8600
- </xsl:if>
9060
+ <xsl:call-template name="sections_element_style"/>
8601
9061
 
8602
9062
  <xsl:apply-templates/>
8603
9063
  </fo:block>
8604
9064
 
8605
9065
  </xsl:template>
8606
9066
 
9067
+ <xsl:template name="sections_element_style">
9068
+
9069
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
9070
+ <xsl:if test="$num = 1">
9071
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
9072
+ </xsl:if>
9073
+
9074
+ </xsl:template> <!-- sections_element_style -->
9075
+
8607
9076
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
8608
9077
  <fo:block break-after="page"/>
8609
9078
  <fo:block>
@@ -8618,10 +9087,16 @@
8618
9087
 
8619
9088
  <xsl:call-template name="setBlockSpanAll"/>
8620
9089
 
9090
+ <xsl:call-template name="refine_clause_style"/>
9091
+
8621
9092
  <xsl:apply-templates/>
8622
9093
  </fo:block>
8623
9094
  </xsl:template>
8624
9095
 
9096
+ <xsl:template name="refine_clause_style">
9097
+
9098
+ </xsl:template> <!-- refine_clause_style -->
9099
+
8625
9100
  <xsl:template match="*[local-name() = 'definitions']">
8626
9101
  <fo:block id="{@id}">
8627
9102
  <xsl:apply-templates/>
@@ -8634,15 +9109,21 @@
8634
9109
 
8635
9110
  <xsl:call-template name="setBlockSpanAll"/>
8636
9111
 
8637
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8638
- <xsl:if test="$num = 1">
8639
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
8640
- </xsl:if>
9112
+ <xsl:call-template name="refine_annex_style"/>
8641
9113
 
8642
9114
  </fo:block>
8643
9115
  <xsl:apply-templates/>
8644
9116
  </xsl:template>
8645
9117
 
9118
+ <xsl:template name="refine_annex_style">
9119
+
9120
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
9121
+ <xsl:if test="$num = 1">
9122
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
9123
+ </xsl:if>
9124
+
9125
+ </xsl:template>
9126
+
8646
9127
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
8647
9128
  <!-- comment 2019-11-29 -->
8648
9129
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -8679,7 +9160,10 @@
8679
9160
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8680
9161
 
8681
9162
  <xsl:template name="setULLabel">
8682
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9163
+ <xsl:variable name="list_level__">
9164
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9165
+ </xsl:variable>
9166
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8683
9167
  <xsl:variable name="list_level">
8684
9168
  <xsl:choose>
8685
9169
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8804,6 +9288,8 @@
8804
9288
  </xsl:choose>
8805
9289
  </xsl:attribute>
8806
9290
 
9291
+ <xsl:call-template name="refine_list_container_style"/>
9292
+
8807
9293
  <fo:block-container margin-left="0mm">
8808
9294
  <fo:block>
8809
9295
  <xsl:apply-templates select="." mode="list"/>
@@ -8812,13 +9298,19 @@
8812
9298
  </fo:block-container>
8813
9299
  </xsl:when>
8814
9300
  <xsl:otherwise>
8815
- <fo:block>
8816
- <xsl:apply-templates select="." mode="list"/>
8817
- </fo:block>
9301
+
9302
+ <fo:block>
9303
+ <xsl:apply-templates select="." mode="list"/>
9304
+ </fo:block>
9305
+
8818
9306
  </xsl:otherwise>
8819
9307
  </xsl:choose>
8820
9308
  </xsl:template>
8821
9309
 
9310
+ <xsl:template name="refine_list_container_style">
9311
+
9312
+ </xsl:template> <!-- refine_list_container_style -->
9313
+
8822
9314
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8823
9315
 
8824
9316
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -8829,11 +9321,7 @@
8829
9321
 
8830
9322
  <xsl:variable name="provisional_distance_between_starts_">
8831
9323
  <attributes xsl:use-attribute-sets="list-style">
8832
-
8833
- <xsl:if test="local-name() = 'ol'">
8834
- <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
8835
- </xsl:if>
8836
-
9324
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
8837
9325
  </attributes>
8838
9326
  </xsl:variable>
8839
9327
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -8869,6 +9357,8 @@
8869
9357
  <addon><xsl:value-of select="$addon"/></addon> -->
8870
9358
  </xsl:if>
8871
9359
 
9360
+ <xsl:call-template name="refine_list-style"/>
9361
+
8872
9362
  <xsl:if test="*[local-name() = 'name']">
8873
9363
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8874
9364
  </xsl:if>
@@ -8881,6 +9371,14 @@
8881
9371
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
8882
9372
  </xsl:template>
8883
9373
 
9374
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9375
+
9376
+ <xsl:if test="local-name() = 'ol'">
9377
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
9378
+ </xsl:if>
9379
+
9380
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9381
+
8884
9382
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
8885
9383
  <xsl:param name="process">false</xsl:param>
8886
9384
  <xsl:if test="$process = 'true'">
@@ -8894,20 +9392,27 @@
8894
9392
  <fo:list-item xsl:use-attribute-sets="list-item-style">
8895
9393
  <xsl:copy-of select="@id"/>
8896
9394
 
9395
+ <xsl:call-template name="refine_list-item-style"/>
9396
+
8897
9397
  <fo:list-item-label end-indent="label-end()">
8898
9398
  <fo:block xsl:use-attribute-sets="list-item-label-style">
8899
9399
 
9400
+ <xsl:call-template name="refine_list-item-label-style"/>
9401
+
8900
9402
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8901
9403
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
8902
9404
  <xsl:call-template name="append_add-style"/>
8903
9405
  </xsl:if>
8904
9406
 
8905
9407
  <xsl:call-template name="getListItemFormat"/>
9408
+
8906
9409
  </fo:block>
8907
9410
  </fo:list-item-label>
8908
9411
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
8909
9412
  <fo:block>
8910
9413
 
9414
+ <xsl:call-template name="refine_list-item-body-style"/>
9415
+
8911
9416
  <xsl:apply-templates/>
8912
9417
 
8913
9418
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9225,6 +9730,7 @@
9225
9730
 
9226
9731
  <fo:block id="{@id}">
9227
9732
  <xsl:apply-templates/>
9733
+
9228
9734
  </fo:block>
9229
9735
  </xsl:template>
9230
9736
 
@@ -9242,6 +9748,7 @@
9242
9748
 
9243
9749
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9244
9750
  <xsl:apply-templates/>
9751
+
9245
9752
  </fo:block>
9246
9753
 
9247
9754
  </xsl:template> <!-- references -->
@@ -9481,24 +9988,32 @@
9481
9988
  <xsl:for-each select="*[local-name() = 'tab']">
9482
9989
  <xsl:variable name="current_id" select="generate-id()"/>
9483
9990
  <fo:table-cell>
9484
- <fo:block>
9485
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9486
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9487
- <xsl:choose>
9488
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9489
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9490
- </xsl:choose>
9491
- </xsl:for-each>
9492
- </fo:basic-link>
9991
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9992
+ <xsl:call-template name="insert_basic_link">
9993
+ <xsl:with-param name="element">
9994
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9995
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9996
+ <xsl:choose>
9997
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9998
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9999
+ </xsl:choose>
10000
+ </xsl:for-each>
10001
+ </fo:basic-link>
10002
+ </xsl:with-param>
10003
+ </xsl:call-template>
9493
10004
  </fo:block>
9494
10005
  </fo:table-cell>
9495
10006
  </xsl:for-each>
9496
10007
  <!-- last column - for page numbers -->
9497
10008
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9498
10009
  <fo:block>
9499
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9500
- <fo:page-number-citation ref-id="{$target}"/>
9501
- </fo:basic-link>
10010
+ <xsl:call-template name="insert_basic_link">
10011
+ <xsl:with-param name="element">
10012
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10013
+ <fo:page-number-citation ref-id="{$target}"/>
10014
+ </fo:basic-link>
10015
+ </xsl:with-param>
10016
+ </xsl:call-template>
9502
10017
  </fo:block>
9503
10018
  </fo:table-cell>
9504
10019
  </xsl:template>
@@ -9540,6 +10055,27 @@
9540
10055
  <!-- End Table of Contents (ToC) processing -->
9541
10056
  <!-- =================== -->
9542
10057
 
10058
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10059
+ <xsl:template name="insert_basic_link">
10060
+ <xsl:param name="element"/>
10061
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10062
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10063
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10064
+ <xsl:choose>
10065
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10066
+ <xsl:copy-of select="$element_node"/>
10067
+ </xsl:when>
10068
+ <xsl:otherwise>
10069
+ <fo:inline>
10070
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10071
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10072
+ </xsl:for-each>
10073
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10074
+ </fo:inline>
10075
+ </xsl:otherwise>
10076
+ </xsl:choose>
10077
+ </xsl:template>
10078
+
9543
10079
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9544
10080
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9545
10081
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9777,6 +10313,9 @@
9777
10313
  </xsl:copy>
9778
10314
  </xsl:template>
9779
10315
 
10316
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10317
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10318
+
9780
10319
  <xsl:template name="add_id">
9781
10320
  <xsl:if test="not(@id)">
9782
10321
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10061,6 +10600,14 @@
10061
10600
  <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">
10062
10601
  <xsl:variable name="p_fn_">
10063
10602
  <xsl:call-template name="get_fn_list"/>
10603
+ <!-- <xsl:choose>
10604
+ <xsl:when test="$namespace = 'jis'">
10605
+ <xsl:call-template name="get_fn_list_for_element"/>
10606
+ </xsl:when>
10607
+ <xsl:otherwise>
10608
+ <xsl:call-template name="get_fn_list"/>
10609
+ </xsl:otherwise>
10610
+ </xsl:choose> -->
10064
10611
  </xsl:variable>
10065
10612
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10066
10613
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10075,8 +10622,14 @@
10075
10622
  <xsl:attribute name="current_fn_number">
10076
10623
  <xsl:value-of select="$current_fn_number"/>
10077
10624
  </xsl:attribute>
10625
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10078
10626
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10079
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10627
+
10628
+ <xsl:value-of select="$skip_footnote_body_"/>
10629
+
10630
+ </xsl:attribute>
10631
+ <xsl:attribute name="ref_id">
10632
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
10080
10633
  </xsl:attribute>
10081
10634
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10082
10635
  </xsl:copy>