metanorma-un 0.10.8 → 0.10.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
  <!-- ========================== -->
@@ -1508,7 +1670,6 @@
1508
1670
  </xsl:attribute-set>
1509
1671
 
1510
1672
  <xsl:attribute-set name="xref-style">
1511
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1512
1673
 
1513
1674
  </xsl:attribute-set>
1514
1675
 
@@ -1516,6 +1677,12 @@
1516
1677
 
1517
1678
  </xsl:attribute-set>
1518
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
+
1519
1686
  <xsl:attribute-set name="note-style">
1520
1687
 
1521
1688
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
@@ -1524,6 +1691,14 @@
1524
1691
 
1525
1692
  </xsl:attribute-set>
1526
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
+
1527
1702
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1528
1703
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1529
1704
 
@@ -1531,11 +1706,23 @@
1531
1706
 
1532
1707
  </xsl:attribute-set>
1533
1708
 
1709
+ <xsl:template name="refine_note-name-style">
1710
+
1711
+ </xsl:template> <!-- refine_note-name-style -->
1712
+
1534
1713
  <xsl:attribute-set name="table-note-name-style">
1535
1714
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1536
1715
 
1537
1716
  </xsl:attribute-set>
1538
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
+
1539
1726
  <xsl:attribute-set name="note-p-style">
1540
1727
 
1541
1728
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
@@ -1552,10 +1739,18 @@
1552
1739
 
1553
1740
  </xsl:attribute-set>
1554
1741
 
1742
+ <xsl:template name="refine_termnote-style">
1743
+
1744
+ </xsl:template> <!-- refine_termnote-style -->
1745
+
1555
1746
  <xsl:attribute-set name="termnote-name-style">
1556
1747
 
1557
1748
  </xsl:attribute-set>
1558
1749
 
1750
+ <xsl:template name="refine_termnote-name-style">
1751
+
1752
+ </xsl:template>
1753
+
1559
1754
  <xsl:attribute-set name="termnote-p-style">
1560
1755
 
1561
1756
  </xsl:attribute-set>
@@ -1566,6 +1761,10 @@
1566
1761
 
1567
1762
  </xsl:attribute-set>
1568
1763
 
1764
+ <xsl:template name="refine_quote-style">
1765
+
1766
+ </xsl:template>
1767
+
1569
1768
  <xsl:attribute-set name="quote-source-style">
1570
1769
  <xsl:attribute name="text-align">right</xsl:attribute>
1571
1770
 
@@ -1575,6 +1774,10 @@
1575
1774
 
1576
1775
  </xsl:attribute-set>
1577
1776
 
1777
+ <xsl:template name="refine_termsource-style">
1778
+
1779
+ </xsl:template> <!-- refine_termsource-style -->
1780
+
1578
1781
  <xsl:attribute-set name="termsource-text-style">
1579
1782
 
1580
1783
  </xsl:attribute-set>
@@ -1613,6 +1816,10 @@
1613
1816
 
1614
1817
  </xsl:attribute-set>
1615
1818
 
1819
+ <xsl:template name="refine_figure-name-style">
1820
+
1821
+ </xsl:template> <!-- refine_figure-name-style -->
1822
+
1616
1823
  <xsl:attribute-set name="figure-source-style">
1617
1824
 
1618
1825
  </xsl:attribute-set>
@@ -1629,6 +1836,15 @@
1629
1836
 
1630
1837
  </xsl:attribute-set> <!-- formula-stem-block-style -->
1631
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
+
1632
1848
  <xsl:attribute-set name="formula-stem-number-style">
1633
1849
  <xsl:attribute name="text-align">right</xsl:attribute>
1634
1850
 
@@ -1643,6 +1859,15 @@
1643
1859
 
1644
1860
  </xsl:attribute-set>
1645
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
+
1646
1871
  <xsl:attribute-set name="figure-pseudocode-p-style">
1647
1872
 
1648
1873
  </xsl:attribute-set>
@@ -1729,6 +1954,10 @@
1729
1954
 
1730
1955
  </xsl:attribute-set>
1731
1956
 
1957
+ <xsl:template name="refine_mathml-style">
1958
+
1959
+ </xsl:template>
1960
+
1732
1961
  <xsl:attribute-set name="list-style">
1733
1962
 
1734
1963
  <xsl:attribute name="provisional-distance-between-starts">3.5mm</xsl:attribute>
@@ -1737,6 +1966,10 @@
1737
1966
 
1738
1967
  </xsl:attribute-set> <!-- list-style -->
1739
1968
 
1969
+ <xsl:template name="refine_list-style">
1970
+
1971
+ </xsl:template> <!-- refine_list-style -->
1972
+
1740
1973
  <xsl:attribute-set name="list-name-style">
1741
1974
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1742
1975
 
@@ -1748,14 +1981,26 @@
1748
1981
 
1749
1982
  </xsl:attribute-set>
1750
1983
 
1984
+ <xsl:template name="refine_list-item-style">
1985
+
1986
+ </xsl:template> <!-- refine_list-item-style -->
1987
+
1751
1988
  <xsl:attribute-set name="list-item-label-style">
1752
1989
 
1753
1990
  </xsl:attribute-set>
1754
1991
 
1992
+ <xsl:template name="refine_list-item-label-style">
1993
+
1994
+ </xsl:template> <!-- refine_list-item-label-style -->
1995
+
1755
1996
  <xsl:attribute-set name="list-item-body-style">
1756
1997
 
1757
1998
  </xsl:attribute-set>
1758
1999
 
2000
+ <xsl:template name="refine_list-item-body-style">
2001
+
2002
+ </xsl:template> <!-- refine_list-item-body-style -->
2003
+
1759
2004
  <xsl:attribute-set name="toc-style">
1760
2005
  <xsl:attribute name="line-height">135%</xsl:attribute>
1761
2006
  </xsl:attribute-set>
@@ -1766,6 +2011,10 @@
1766
2011
 
1767
2012
  </xsl:attribute-set>
1768
2013
 
2014
+ <xsl:template name="refine_fn-reference-style">
2015
+
2016
+ </xsl:template> <!-- refine_fn-reference-style -->
2017
+
1769
2018
  <xsl:attribute-set name="fn-style">
1770
2019
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1771
2020
  </xsl:attribute-set>
@@ -1789,6 +2038,10 @@
1789
2038
 
1790
2039
  </xsl:attribute-set>
1791
2040
 
2041
+ <xsl:template name="refine_fn-body-style">
2042
+
2043
+ </xsl:template> <!-- refine_fn-body-style -->
2044
+
1792
2045
  <xsl:attribute-set name="fn-body-num-style">
1793
2046
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1794
2047
 
@@ -1798,6 +2051,10 @@
1798
2051
 
1799
2052
  </xsl:attribute-set> <!-- fn-body-num-style -->
1800
2053
 
2054
+ <xsl:template name="refine_fn-body-num-style">
2055
+
2056
+ </xsl:template> <!-- refine_fn-body-num-style -->
2057
+
1801
2058
  <!-- admonition -->
1802
2059
  <xsl:attribute-set name="admonition-style">
1803
2060
 
@@ -2453,14 +2710,9 @@
2453
2710
 
2454
2711
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2455
2712
 
2456
- <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2457
- <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
2458
-
2459
- <xsl:if test="not(ancestor::*[local-name()='sections'])">
2460
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2461
- </xsl:if>
2462
-
2463
- <!-- 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>
2464
2716
 
2465
2717
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2466
2718
 
@@ -2487,17 +2739,9 @@
2487
2739
 
2488
2740
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2489
2741
 
2490
- <xsl:if test="$margin-side != 0">
2491
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2492
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2493
- </xsl:if>
2494
-
2495
- <xsl:call-template name="setBordersTableArray"/>
2496
-
2497
- <xsl:if test="ancestor::*[local-name()='sections']">
2498
- <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute>
2499
- <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute>
2500
- </xsl:if>
2742
+ <xsl:call-template name="refine_table-style">
2743
+ <xsl:with-param name="margin-side" select="$margin-side"/>
2744
+ </xsl:call-template>
2501
2745
 
2502
2746
  </xsl:element>
2503
2747
  </xsl:variable>
@@ -2519,7 +2763,7 @@
2519
2763
  </xsl:attribute>
2520
2764
  </xsl:for-each>
2521
2765
 
2522
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2766
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2523
2767
  <xsl:if test="$isNoteOrFnExist = 'true'">
2524
2768
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2525
2769
  </xsl:if>
@@ -2563,7 +2807,7 @@
2563
2807
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2564
2808
  </xsl:when>
2565
2809
  <xsl:otherwise>
2566
- <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() = 'example') 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 -->
2567
2811
  </xsl:otherwise>
2568
2812
  </xsl:choose>
2569
2813
 
@@ -2650,6 +2894,10 @@
2650
2894
 
2651
2895
  <fo:block xsl:use-attribute-sets="table-name-style">
2652
2896
 
2897
+ <xsl:call-template name="refine_table-name-style">
2898
+ <xsl:with-param name="continued" select="$continued"/>
2899
+ </xsl:call-template>
2900
+
2653
2901
  <xsl:choose>
2654
2902
  <xsl:when test="$continued = 'true'">
2655
2903
 
@@ -3032,6 +3280,8 @@
3032
3280
  <fo:table-row>
3033
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">
3034
3282
 
3283
+ <xsl:call-template name="refine_table-header-title-style"/>
3284
+
3035
3285
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3036
3286
  <xsl:with-param name="continued">true</xsl:with-param>
3037
3287
  </xsl:apply-templates>
@@ -3044,6 +3294,10 @@
3044
3294
  </fo:table-row>
3045
3295
  </xsl:template> <!-- table-header-title -->
3046
3296
 
3297
+ <xsl:template name="refine_table-header-title-style">
3298
+
3299
+ </xsl:template> <!-- refine_table-header-title-style -->
3300
+
3047
3301
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3048
3302
  <fo:table-body>
3049
3303
  <xsl:apply-templates/>
@@ -3068,7 +3322,7 @@
3068
3322
  <xsl:param name="colwidths"/>
3069
3323
  <xsl:param name="colgroup"/>
3070
3324
 
3071
- <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()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3072
3326
 
3073
3327
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3074
3328
 
@@ -3128,6 +3382,8 @@
3128
3382
  <fo:table-row>
3129
3383
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3130
3384
 
3385
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3386
+
3131
3387
  <xsl:call-template name="setBordersTableArray"/>
3132
3388
 
3133
3389
  <!-- fn will be processed inside 'note' processing -->
@@ -3136,8 +3392,10 @@
3136
3392
 
3137
3393
  <!-- except gb and bsi -->
3138
3394
 
3395
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3139
3396
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3140
3397
  <xsl:apply-templates select="../*[local-name()='note']"/>
3398
+ <xsl:apply-templates select="../*[local-name()='example']"/>
3141
3399
  <xsl:apply-templates select="../*[local-name()='source']"/>
3142
3400
 
3143
3401
  <xsl:variable name="isDisplayRowSeparator">
@@ -3146,7 +3404,7 @@
3146
3404
 
3147
3405
  <!-- horizontal row separator -->
3148
3406
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3149
- <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
3407
+ <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3150
3408
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3151
3409
 
3152
3410
  <xsl:call-template name="setBordersTableArray"/>
@@ -3267,7 +3525,7 @@
3267
3525
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3268
3526
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3269
3527
 
3270
- <xsl:call-template name="setBordersTableArray"/>
3528
+ <xsl:call-template name="refine_table-header-row-style"/>
3271
3529
 
3272
3530
  <xsl:call-template name="setTableRowAttributes"/>
3273
3531
 
@@ -3301,6 +3559,8 @@
3301
3559
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3302
3560
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3303
3561
 
3562
+ <xsl:call-template name="refine_table-footer-row-style"/>
3563
+
3304
3564
  <xsl:call-template name="setTableRowAttributes"/>
3305
3565
  <xsl:apply-templates/>
3306
3566
  </fo:table-row>
@@ -3314,9 +3574,10 @@
3314
3574
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3315
3575
  </xsl:if>
3316
3576
 
3317
- <xsl:call-template name="setBordersTableArray"/>
3577
+ <xsl:call-template name="refine_table-body-row-style"/>
3318
3578
 
3319
3579
  <xsl:call-template name="setTableRowAttributes"/>
3580
+
3320
3581
  <xsl:apply-templates/>
3321
3582
  </fo:table-row>
3322
3583
  </xsl:template>
@@ -3335,28 +3596,7 @@
3335
3596
  <xsl:with-param name="default">center</xsl:with-param>
3336
3597
  </xsl:call-template>
3337
3598
 
3338
- <xsl:call-template name="setBordersTableArray"/>
3339
-
3340
- <xsl:if test="ancestor::*[local-name()='sections']">
3341
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3342
- <xsl:attribute name="display-align">before</xsl:attribute>
3343
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3344
- </xsl:if>
3345
- <xsl:if test="ancestor::*[local-name()='annex']">
3346
- <xsl:attribute name="font-weight">normal</xsl:attribute>
3347
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3348
- <xsl:attribute name="background-color">rgb(218, 218, 218)</xsl:attribute>
3349
- <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')">
3350
- <xsl:attribute name="color">rgb(46, 116, 182)</xsl:attribute>
3351
- <xsl:attribute name="font-weight">bold</xsl:attribute>
3352
- </xsl:if>
3353
- </xsl:if>
3354
-
3355
- <xsl:if test="$lang = 'ar'">
3356
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3357
- </xsl:if>
3358
-
3359
- <xsl:call-template name="setTableCellAttributes"/>
3599
+ <xsl:call-template name="refine_table-header-cell-style"/>
3360
3600
 
3361
3601
  <fo:block>
3362
3602
  <xsl:apply-templates/>
@@ -3398,18 +3638,7 @@
3398
3638
  <xsl:with-param name="default">left</xsl:with-param>
3399
3639
  </xsl:call-template>
3400
3640
 
3401
- <xsl:if test="$lang = 'ar'">
3402
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3403
- </xsl:if>
3404
-
3405
- <!-- bsi -->
3406
-
3407
- <xsl:call-template name="setBordersTableArray"/>
3408
-
3409
- <xsl:if test="ancestor::*[local-name()='sections']">
3410
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3411
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3412
- </xsl:if>
3641
+ <xsl:call-template name="refine_table-cell-style"/>
3413
3642
 
3414
3643
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3415
3644
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3436,16 +3665,16 @@
3436
3665
  </fo:table-cell>
3437
3666
  </xsl:template> <!-- td -->
3438
3667
 
3439
- <xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
3668
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
3440
3669
 
3441
3670
  <fo:block xsl:use-attribute-sets="table-note-style">
3442
3671
 
3443
- <!-- Table's note name (NOTE, for example) -->
3672
+ <xsl:call-template name="refine_table-note-style"/>
3673
+
3674
+ <!-- Table's note/example name (NOTE, for example) -->
3444
3675
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3445
3676
 
3446
- <xsl:if test="@type = 'source' or @type = 'abbreviation'">
3447
- <xsl:attribute name="font-size">9pt</xsl:attribute>
3448
- </xsl:if>
3677
+ <xsl:call-template name="refine_table-note-name-style"/>
3449
3678
 
3450
3679
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3451
3680
 
@@ -3456,7 +3685,7 @@
3456
3685
 
3457
3686
  </xsl:template> <!-- table/note -->
3458
3687
 
3459
- <xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" priority="2">
3688
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
3460
3689
  <xsl:apply-templates/>
3461
3690
  </xsl:template>
3462
3691
 
@@ -3474,6 +3703,14 @@
3474
3703
  <!-- list of footnotes to calculate actual footnotes number -->
3475
3704
  <xsl:variable name="p_fn_">
3476
3705
  <xsl:call-template name="get_fn_list"/>
3706
+ <!-- <xsl:choose>
3707
+ <xsl:when test="$namespace = 'jis'">
3708
+ <xsl:call-template name="get_fn_list_for_element"/>
3709
+ </xsl:when>
3710
+ <xsl:otherwise>
3711
+ <xsl:call-template name="get_fn_list"/>
3712
+ </xsl:otherwise>
3713
+ </xsl:choose> -->
3477
3714
  </xsl:variable>
3478
3715
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3479
3716
 
@@ -3498,7 +3735,14 @@
3498
3735
 
3499
3736
  </xsl:variable>
3500
3737
 
3501
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3738
+ <xsl:variable name="ref_id">
3739
+ <xsl:choose>
3740
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
3741
+ <xsl:otherwise>
3742
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3743
+ </xsl:otherwise>
3744
+ </xsl:choose>
3745
+ </xsl:variable>
3502
3746
  <xsl:variable name="footnote_inline">
3503
3747
  <fo:inline>
3504
3748
 
@@ -3524,7 +3768,7 @@
3524
3768
  <xsl:call-template name="insert_basic_link">
3525
3769
  <xsl:with-param name="element">
3526
3770
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3527
- <xsl:value-of select="$current_fn_number_text"/>
3771
+ <xsl:copy-of select="$current_fn_number_text"/>
3528
3772
  </fo:basic-link>
3529
3773
  </xsl:with-param>
3530
3774
  </xsl:call-template>
@@ -3544,8 +3788,12 @@
3544
3788
 
3545
3789
  <fo:block xsl:use-attribute-sets="fn-body-style">
3546
3790
 
3791
+ <xsl:call-template name="refine_fn-body-style"/>
3792
+
3547
3793
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3548
3794
 
3795
+ <xsl:call-template name="refine_fn-body-num-style"/>
3796
+
3549
3797
  <xsl:value-of select="$current_fn_number_text"/>
3550
3798
  </fo:inline>
3551
3799
  <xsl:apply-templates/>
@@ -3597,6 +3845,28 @@
3597
3845
  </xsl:choose>
3598
3846
  </xsl:template>
3599
3847
 
3848
+ <xsl:template name="get_fn_list_for_element">
3849
+ <xsl:choose>
3850
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
3851
+ <fn gen_id="{generate-id(.)}">
3852
+ <xsl:copy-of select="@*"/>
3853
+ <xsl:copy-of select="node()"/>
3854
+ </fn>
3855
+ </xsl:when>
3856
+ <xsl:otherwise>
3857
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
3858
+ <xsl:variable name="element_id" select="@id"/>
3859
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3860
+ <!-- copy unique fn -->
3861
+ <fn gen_id="{generate-id(.)}">
3862
+ <xsl:copy-of select="@*"/>
3863
+ <xsl:copy-of select="node()"/>
3864
+ </fn>
3865
+ </xsl:for-each>
3866
+ </xsl:for-each>
3867
+ </xsl:otherwise>
3868
+ </xsl:choose>
3869
+ </xsl:template>
3600
3870
  <!-- ============================ -->
3601
3871
  <!-- table's footnotes rendering -->
3602
3872
  <!-- ============================ -->
@@ -3771,6 +4041,8 @@
3771
4041
  <xsl:template match="*[local-name()='fn']">
3772
4042
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
3773
4043
 
4044
+ <xsl:call-template name="refine_fn-reference-style"/>
4045
+
3774
4046
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3775
4047
 
3776
4048
  <xsl:value-of select="@reference"/>
@@ -3870,6 +4142,8 @@
3870
4142
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
3871
4143
  <fo:block margin-bottom="12pt" text-align="left">
3872
4144
 
4145
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4146
+
3873
4147
  <!-- <xsl:variable name="title-where">
3874
4148
  <xsl:call-template name="getLocalizedString">
3875
4149
  <xsl:with-param name="key">where</xsl:with-param>
@@ -3883,6 +4157,8 @@
3883
4157
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
3884
4158
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3885
4159
 
4160
+ <xsl:call-template name="refine_figure_key_style"/>
4161
+
3886
4162
  <xsl:variable name="title-key">
3887
4163
  <xsl:call-template name="getLocalizedString">
3888
4164
  <xsl:with-param name="key">key</xsl:with-param>
@@ -3897,12 +4173,16 @@
3897
4173
  <xsl:if test="$onlyOneComponent = 'false'">
3898
4174
  <fo:block>
3899
4175
 
4176
+ <xsl:call-template name="refine_multicomponent_style"/>
4177
+
3900
4178
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3901
4179
  <xsl:attribute name="margin-top">0</xsl:attribute>
3902
4180
  </xsl:if>
3903
4181
 
3904
4182
  <fo:block>
3905
4183
 
4184
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4185
+
3906
4186
  <xsl:apply-templates select="*[local-name() = 'name']">
3907
4187
  <xsl:with-param name="process">true</xsl:with-param>
3908
4188
  </xsl:apply-templates>
@@ -4060,6 +4340,24 @@
4060
4340
 
4061
4341
  </xsl:template> <!-- END: dl -->
4062
4342
 
4343
+ <xsl:template name="refine_dl_formula_where_style">
4344
+
4345
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4346
+
4347
+ <xsl:template name="refine_figure_key_style">
4348
+
4349
+ </xsl:template> <!-- refine_figure_key_style -->
4350
+
4351
+ <xsl:template name="refine_multicomponent_style">
4352
+ <xsl:variable name="parent" select="local-name(..)"/>
4353
+
4354
+ </xsl:template> <!-- refine_multicomponent_style -->
4355
+
4356
+ <xsl:template name="refine_multicomponent_block_style">
4357
+ <xsl:variable name="parent" select="local-name(..)"/>
4358
+
4359
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4360
+
4063
4361
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4064
4362
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4065
4363
 
@@ -4279,6 +4577,8 @@
4279
4577
 
4280
4578
  </xsl:if>
4281
4579
 
4580
+ <xsl:call-template name="refine_dt-cell-style"/>
4581
+
4282
4582
  <fo:block xsl:use-attribute-sets="dt-block-style">
4283
4583
  <xsl:copy-of select="@id"/>
4284
4584
 
@@ -4286,6 +4586,8 @@
4286
4586
  <xsl:attribute name="margin-top">0</xsl:attribute>
4287
4587
  </xsl:if>
4288
4588
 
4589
+ <xsl:call-template name="refine_dt-block-style"/>
4590
+
4289
4591
  <xsl:apply-templates>
4290
4592
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4291
4593
  </xsl:apply-templates>
@@ -4305,6 +4607,8 @@
4305
4607
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4306
4608
  </xsl:if>
4307
4609
 
4610
+ <xsl:call-template name="refine_dd-cell-style"/>
4611
+
4308
4612
  <fo:block>
4309
4613
 
4310
4614
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4447,20 +4751,31 @@
4447
4751
  <!-- ========================= -->
4448
4752
  <xsl:template match="*[local-name()='em']">
4449
4753
  <fo:inline font-style="italic">
4754
+ <xsl:call-template name="refine_italic_style"/>
4450
4755
  <xsl:apply-templates/>
4451
4756
  </fo:inline>
4452
4757
  </xsl:template>
4453
4758
 
4759
+ <xsl:template name="refine_italic_style">
4760
+
4761
+ </xsl:template>
4762
+
4454
4763
  <xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
4455
4764
  <xsl:param name="split_keep-within-line"/>
4456
4765
  <fo:inline font-weight="bold">
4457
4766
 
4767
+ <xsl:call-template name="refine_strong_style"/>
4768
+
4458
4769
  <xsl:apply-templates>
4459
4770
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4460
4771
  </xsl:apply-templates>
4461
4772
  </fo:inline>
4462
4773
  </xsl:template>
4463
4774
 
4775
+ <xsl:template name="refine_strong_style">
4776
+
4777
+ </xsl:template>
4778
+
4464
4779
  <xsl:template match="*[local-name()='padding']">
4465
4780
  <fo:inline padding-right="{@value}"> </fo:inline>
4466
4781
  </xsl:template>
@@ -4927,7 +5242,10 @@
4927
5242
  </xsl:choose>
4928
5243
  </xsl:variable>
4929
5244
 
4930
- <xsl:value-of select="$text9"/>
5245
+ <!-- replace sequence #x200B and space TO space -->
5246
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5247
+
5248
+ <xsl:value-of select="$text10"/>
4931
5249
  </xsl:template>
4932
5250
 
4933
5251
  <xsl:template name="add-zero-spaces-link-java">
@@ -5602,6 +5920,11 @@
5602
5920
 
5603
5921
  <fo:inline xsl:use-attribute-sets="mathml-style">
5604
5922
 
5923
+ <!-- DEBUG -->
5924
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
5925
+
5926
+ <xsl:call-template name="refine_mathml-style"/>
5927
+
5605
5928
  <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 -->
5606
5929
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5607
5930
  </xsl:if>
@@ -5706,6 +6029,8 @@
5706
6029
 
5707
6030
  <fo:instream-foreign-object fox:alt-text="Math">
5708
6031
 
6032
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6033
+
5709
6034
  <!-- put MathML in Actual Text -->
5710
6035
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5711
6036
  <xsl:attribute name="fox:actual-text">
@@ -5726,6 +6051,10 @@
5726
6051
  </fo:instream-foreign-object>
5727
6052
  </xsl:template>
5728
6053
 
6054
+ <xsl:template name="refine_mathml_insteam_object_style">
6055
+
6056
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6057
+
5729
6058
  <xsl:template match="mathml:*" mode="mathml_actual_text">
5730
6059
  <!-- <xsl:text>a+b</xsl:text> -->
5731
6060
  <xsl:text>&lt;</xsl:text>
@@ -5870,6 +6199,8 @@
5870
6199
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
5871
6200
  <fo:inline xsl:use-attribute-sets="mathml-style">
5872
6201
 
6202
+ <xsl:call-template name="refine_mathml-style"/>
6203
+
5873
6204
  <xsl:choose>
5874
6205
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5875
6206
  <xsl:otherwise>
@@ -5914,6 +6245,8 @@
5914
6245
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5915
6246
  </xsl:if>
5916
6247
 
6248
+ <xsl:call-template name="refine_link-style"/>
6249
+
5917
6250
  <xsl:choose>
5918
6251
  <xsl:when test="$target_text = ''">
5919
6252
  <xsl:apply-templates/>
@@ -6001,6 +6334,9 @@
6001
6334
  <xsl:call-template name="insert_basic_link">
6002
6335
  <xsl:with-param name="element">
6003
6336
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6337
+ <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'])">
6338
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6339
+ </xsl:if>
6004
6340
  <xsl:if test="parent::*[local-name() = 'add']">
6005
6341
  <xsl:call-template name="append_add-style"/>
6006
6342
  </xsl:if>
@@ -6062,10 +6398,7 @@
6062
6398
  <fo:table-cell display-align="center">
6063
6399
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6064
6400
 
6065
- <xsl:if test="ancestor::*[local-name() ='annex']">
6066
- <xsl:attribute name="text-align">left</xsl:attribute>
6067
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
6068
- </xsl:if>
6401
+ <xsl:call-template name="refine_formula-stem-block-style"/>
6069
6402
 
6070
6403
  <xsl:apply-templates/>
6071
6404
  </fo:block>
@@ -6108,25 +6441,18 @@
6108
6441
 
6109
6442
  <xsl:call-template name="setBlockSpanAll"/>
6110
6443
 
6111
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6112
- <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
6113
- </xsl:if>
6444
+ <xsl:call-template name="refine_note-style"/>
6114
6445
 
6115
6446
  <fo:block-container margin-left="0mm" margin-right="0mm">
6116
6447
 
6117
6448
  <fo:block>
6118
6449
 
6119
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6120
- <xsl:attribute name="text-indent">0</xsl:attribute>
6121
- <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
6122
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6123
- <xsl:attribute name="font-size">9pt</xsl:attribute>
6124
- <xsl:attribute name="text-align">justify</xsl:attribute>
6125
- <xsl:attribute name="padding-top">0mm</xsl:attribute>
6126
- </xsl:if>
6450
+ <xsl:call-template name="refine_note_block_style"/>
6127
6451
 
6128
6452
  <fo:inline xsl:use-attribute-sets="note-name-style">
6129
6453
 
6454
+ <xsl:call-template name="refine_note-name-style"/>
6455
+
6130
6456
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6131
6457
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6132
6458
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6152,6 +6478,19 @@
6152
6478
 
6153
6479
  </xsl:template>
6154
6480
 
6481
+ <xsl:template name="refine_note_block_style">
6482
+
6483
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6484
+ <xsl:attribute name="text-indent">0</xsl:attribute>
6485
+ <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
6486
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
6487
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
6488
+ <xsl:attribute name="text-align">justify</xsl:attribute>
6489
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
6490
+ </xsl:if>
6491
+
6492
+ </xsl:template>
6493
+
6155
6494
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6156
6495
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6157
6496
  <xsl:choose>
@@ -6173,12 +6512,16 @@
6173
6512
 
6174
6513
  <xsl:call-template name="setBlockSpanAll"/>
6175
6514
 
6515
+ <xsl:call-template name="refine_termnote-style"/>
6516
+
6176
6517
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6177
6518
 
6178
6519
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6179
6520
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6180
6521
  </xsl:if>
6181
6522
 
6523
+ <xsl:call-template name="refine_termnote-name-style"/>
6524
+
6182
6525
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6183
6526
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6184
6527
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6352,10 +6695,7 @@
6352
6695
  <xsl:otherwise>
6353
6696
  <fo:block xsl:use-attribute-sets="image-style">
6354
6697
 
6355
- <xsl:if test="ancestor::un:admonition">
6356
- <xsl:attribute name="margin-top">-12mm</xsl:attribute>
6357
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
6358
- </xsl:if>
6698
+ <xsl:call-template name="refine_image-style"/>
6359
6699
 
6360
6700
  <xsl:variable name="src">
6361
6701
  <xsl:call-template name="image_src"/>
@@ -7206,6 +7546,8 @@
7206
7546
  <xsl:if test="normalize-space() != ''">
7207
7547
  <fo:block xsl:use-attribute-sets="figure-name-style">
7208
7548
 
7549
+ <xsl:call-template name="refine_figure-name-style"/>
7550
+
7209
7551
  <xsl:apply-templates/>
7210
7552
  </fo:block>
7211
7553
  </xsl:if>
@@ -7470,6 +7812,8 @@
7470
7812
  </xsl:attribute>
7471
7813
  </xsl:for-each>
7472
7814
 
7815
+ <xsl:call-template name="refine_sourcecode-style"/>
7816
+
7473
7817
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7474
7818
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7475
7819
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -8174,6 +8518,8 @@
8174
8518
 
8175
8519
  <xsl:call-template name="setBlockSpanAll"/>
8176
8520
 
8521
+ <xsl:call-template name="refine_example-style"/>
8522
+
8177
8523
  <xsl:variable name="fo_element">
8178
8524
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8179
8525
  block
@@ -8284,6 +8630,12 @@
8284
8630
 
8285
8631
  </xsl:template>
8286
8632
 
8633
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
8634
+ <fo:inline xsl:use-attribute-sets="example-name-style">
8635
+ <xsl:apply-templates/>
8636
+ </fo:inline>
8637
+ </xsl:template>
8638
+
8287
8639
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
8288
8640
  <xsl:param name="fo_element">block</xsl:param>
8289
8641
 
@@ -8301,9 +8653,7 @@
8301
8653
  </xsl:if>
8302
8654
  <fo:block xsl:use-attribute-sets="example-p-style">
8303
8655
 
8304
- <xsl:if test="$num = 1">
8305
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
8306
- </xsl:if>
8656
+ <xsl:call-template name="refine_example-p-style"/>
8307
8657
 
8308
8658
  <xsl:apply-templates/>
8309
8659
  </fo:block>
@@ -8321,6 +8671,7 @@
8321
8671
  </xsl:otherwise>
8322
8672
  </xsl:choose>
8323
8673
  </xsl:template> <!-- example/p -->
8674
+
8324
8675
  <!-- ====== -->
8325
8676
  <!-- ====== -->
8326
8677
 
@@ -8332,6 +8683,8 @@
8332
8683
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8333
8684
  <fo:block xsl:use-attribute-sets="termsource-style">
8334
8685
 
8686
+ <xsl:call-template name="refine_termsource-style"/>
8687
+
8335
8688
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8336
8689
  <xsl:variable name="termsource_text">
8337
8690
  <xsl:apply-templates/>
@@ -8447,6 +8800,8 @@
8447
8800
  <fo:block-container margin-left="0mm">
8448
8801
  <fo:block-container xsl:use-attribute-sets="quote-style">
8449
8802
 
8803
+ <xsl:call-template name="refine_quote-style"/>
8804
+
8450
8805
  <fo:block-container margin-left="0mm" margin-right="0mm">
8451
8806
  <fo:block role="BlockQuote">
8452
8807
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8521,8 +8876,7 @@
8521
8876
 
8522
8877
  </xsl:if>
8523
8878
 
8524
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8525
- <xsl:variable name="text" select="normalize-space()"/>
8879
+ <xsl:call-template name="refine_eref-style"/>
8526
8880
 
8527
8881
  <xsl:call-template name="insert_basic_link">
8528
8882
  <xsl:with-param name="element">
@@ -8532,6 +8886,8 @@
8532
8886
  </xsl:if>
8533
8887
  <xsl:if test="@type = 'inline'">
8534
8888
 
8889
+ <xsl:call-template name="refine_basic_link_style"/>
8890
+
8535
8891
  </xsl:if>
8536
8892
 
8537
8893
  <xsl:choose>
@@ -8564,6 +8920,11 @@
8564
8920
  </xsl:otherwise>
8565
8921
  </xsl:choose>
8566
8922
  </xsl:template>
8923
+
8924
+ <xsl:template name="refine_basic_link_style">
8925
+
8926
+ </xsl:template> <!-- refine_basic_link_style -->
8927
+
8567
8928
  <!-- ====== -->
8568
8929
  <!-- END eref -->
8569
8930
  <!-- ====== -->
@@ -8708,16 +9069,22 @@
8708
9069
  <fo:block>
8709
9070
  <xsl:call-template name="setId"/>
8710
9071
 
8711
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8712
- <xsl:if test="$num = 1">
8713
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
8714
- </xsl:if>
9072
+ <xsl:call-template name="sections_element_style"/>
8715
9073
 
8716
9074
  <xsl:apply-templates/>
8717
9075
  </fo:block>
8718
9076
 
8719
9077
  </xsl:template>
8720
9078
 
9079
+ <xsl:template name="sections_element_style">
9080
+
9081
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
9082
+ <xsl:if test="$num = 1">
9083
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
9084
+ </xsl:if>
9085
+
9086
+ </xsl:template> <!-- sections_element_style -->
9087
+
8721
9088
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
8722
9089
  <fo:block break-after="page"/>
8723
9090
  <fo:block>
@@ -8732,10 +9099,16 @@
8732
9099
 
8733
9100
  <xsl:call-template name="setBlockSpanAll"/>
8734
9101
 
9102
+ <xsl:call-template name="refine_clause_style"/>
9103
+
8735
9104
  <xsl:apply-templates/>
8736
9105
  </fo:block>
8737
9106
  </xsl:template>
8738
9107
 
9108
+ <xsl:template name="refine_clause_style">
9109
+
9110
+ </xsl:template> <!-- refine_clause_style -->
9111
+
8739
9112
  <xsl:template match="*[local-name() = 'definitions']">
8740
9113
  <fo:block id="{@id}">
8741
9114
  <xsl:apply-templates/>
@@ -8748,15 +9121,21 @@
8748
9121
 
8749
9122
  <xsl:call-template name="setBlockSpanAll"/>
8750
9123
 
8751
- <xsl:variable name="num"><xsl:number/></xsl:variable>
8752
- <xsl:if test="$num = 1">
8753
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
8754
- </xsl:if>
9124
+ <xsl:call-template name="refine_annex_style"/>
8755
9125
 
8756
9126
  </fo:block>
8757
9127
  <xsl:apply-templates/>
8758
9128
  </xsl:template>
8759
9129
 
9130
+ <xsl:template name="refine_annex_style">
9131
+
9132
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
9133
+ <xsl:if test="$num = 1">
9134
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
9135
+ </xsl:if>
9136
+
9137
+ </xsl:template>
9138
+
8760
9139
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
8761
9140
  <!-- comment 2019-11-29 -->
8762
9141
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -8833,6 +9212,9 @@
8833
9212
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
8834
9213
  </xsl:choose>
8835
9214
  </xsl:when>
9215
+ <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
9216
+ <xsl:value-of select="@label"/>
9217
+ </xsl:when>
8836
9218
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
8837
9219
 
8838
9220
  <!-- Example: for BSI <?list-start 2?> -->
@@ -8890,10 +9272,10 @@
8890
9272
  <xsl:when test="$type = 'arabic'">
8891
9273
  1)
8892
9274
  </xsl:when>
8893
- <xsl:when test="$type = 'alphabet'">
9275
+ <xsl:when test="$type = 'alphabet' or $type = 'alphabetic'">
8894
9276
  a)
8895
9277
  </xsl:when>
8896
- <xsl:when test="$type = 'alphabet_upper'">
9278
+ <xsl:when test="$type = 'alphabet_upper' or $type = 'alphabetic_upper'">
8897
9279
  A.
8898
9280
  </xsl:when>
8899
9281
  <xsl:when test="$type = 'roman'">
@@ -8921,6 +9303,8 @@
8921
9303
  </xsl:choose>
8922
9304
  </xsl:attribute>
8923
9305
 
9306
+ <xsl:call-template name="refine_list_container_style"/>
9307
+
8924
9308
  <fo:block-container margin-left="0mm">
8925
9309
  <fo:block>
8926
9310
  <xsl:apply-templates select="." mode="list"/>
@@ -8938,6 +9322,10 @@
8938
9322
  </xsl:choose>
8939
9323
  </xsl:template>
8940
9324
 
9325
+ <xsl:template name="refine_list_container_style">
9326
+
9327
+ </xsl:template> <!-- refine_list_container_style -->
9328
+
8941
9329
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
8942
9330
 
8943
9331
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -8948,11 +9336,7 @@
8948
9336
 
8949
9337
  <xsl:variable name="provisional_distance_between_starts_">
8950
9338
  <attributes xsl:use-attribute-sets="list-style">
8951
-
8952
- <xsl:if test="local-name() = 'ol'">
8953
- <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
8954
- </xsl:if>
8955
-
9339
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
8956
9340
  </attributes>
8957
9341
  </xsl:variable>
8958
9342
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -8988,6 +9372,8 @@
8988
9372
  <addon><xsl:value-of select="$addon"/></addon> -->
8989
9373
  </xsl:if>
8990
9374
 
9375
+ <xsl:call-template name="refine_list-style"/>
9376
+
8991
9377
  <xsl:if test="*[local-name() = 'name']">
8992
9378
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
8993
9379
  </xsl:if>
@@ -9000,6 +9386,14 @@
9000
9386
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
9001
9387
  </xsl:template>
9002
9388
 
9389
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9390
+
9391
+ <xsl:if test="local-name() = 'ol'">
9392
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
9393
+ </xsl:if>
9394
+
9395
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9396
+
9003
9397
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
9004
9398
  <xsl:param name="process">false</xsl:param>
9005
9399
  <xsl:if test="$process = 'true'">
@@ -9013,20 +9407,27 @@
9013
9407
  <fo:list-item xsl:use-attribute-sets="list-item-style">
9014
9408
  <xsl:copy-of select="@id"/>
9015
9409
 
9410
+ <xsl:call-template name="refine_list-item-style"/>
9411
+
9016
9412
  <fo:list-item-label end-indent="label-end()">
9017
9413
  <fo:block xsl:use-attribute-sets="list-item-label-style">
9018
9414
 
9415
+ <xsl:call-template name="refine_list-item-label-style"/>
9416
+
9019
9417
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9020
9418
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9021
9419
  <xsl:call-template name="append_add-style"/>
9022
9420
  </xsl:if>
9023
9421
 
9024
9422
  <xsl:call-template name="getListItemFormat"/>
9423
+
9025
9424
  </fo:block>
9026
9425
  </fo:list-item-label>
9027
9426
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9028
9427
  <fo:block>
9029
9428
 
9429
+ <xsl:call-template name="refine_list-item-body-style"/>
9430
+
9030
9431
  <xsl:apply-templates/>
9031
9432
 
9032
9433
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9344,6 +9745,7 @@
9344
9745
 
9345
9746
  <fo:block id="{@id}">
9346
9747
  <xsl:apply-templates/>
9748
+
9347
9749
  </fo:block>
9348
9750
  </xsl:template>
9349
9751
 
@@ -9361,6 +9763,7 @@
9361
9763
 
9362
9764
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9363
9765
  <xsl:apply-templates/>
9766
+
9364
9767
  </fo:block>
9365
9768
 
9366
9769
  </xsl:template> <!-- references -->
@@ -9925,6 +10328,9 @@
9925
10328
  </xsl:copy>
9926
10329
  </xsl:template>
9927
10330
 
10331
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10332
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10333
+
9928
10334
  <xsl:template name="add_id">
9929
10335
  <xsl:if test="not(@id)">
9930
10336
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10209,6 +10615,14 @@
10209
10615
  <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">
10210
10616
  <xsl:variable name="p_fn_">
10211
10617
  <xsl:call-template name="get_fn_list"/>
10618
+ <!-- <xsl:choose>
10619
+ <xsl:when test="$namespace = 'jis'">
10620
+ <xsl:call-template name="get_fn_list_for_element"/>
10621
+ </xsl:when>
10622
+ <xsl:otherwise>
10623
+ <xsl:call-template name="get_fn_list"/>
10624
+ </xsl:otherwise>
10625
+ </xsl:choose> -->
10212
10626
  </xsl:variable>
10213
10627
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10214
10628
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10223,8 +10637,14 @@
10223
10637
  <xsl:attribute name="current_fn_number">
10224
10638
  <xsl:value-of select="$current_fn_number"/>
10225
10639
  </xsl:attribute>
10640
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10226
10641
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10227
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10642
+
10643
+ <xsl:value-of select="$skip_footnote_body_"/>
10644
+
10645
+ </xsl:attribute>
10646
+ <xsl:attribute name="ref_id">
10647
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
10228
10648
  </xsl:attribute>
10229
10649
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10230
10650
  </xsl:copy>