metanorma-ribose 2.2.7 → 2.2.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rsd="https://www.metanorma.org/ns/rsd" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ribose="https://www.metanorma.org/ns/ribose" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -8,24 +8,24 @@
8
8
 
9
9
  <xsl:variable name="color_blue">rgb(22, 97, 173)</xsl:variable>
10
10
 
11
- <xsl:variable name="copyright_year" select="/rsd:rsd-standard/rsd:bibdata/rsd:copyright/rsd:from"/>
11
+ <xsl:variable name="copyright_year" select="/ribose:rsd-standard/ribose:bibdata/ribose:copyright/ribose:from"/>
12
12
 
13
13
  <xsl:variable name="copyright">
14
14
  <xsl:text>© </xsl:text>
15
15
  <xsl:value-of select="$copyright_year"/>
16
16
  <xsl:text> </xsl:text>
17
- <xsl:value-of select="/rsd:rsd-standard/rsd:bibdata/rsd:copyright/rsd:owner/rsd:organization/rsd:name"/>
17
+ <xsl:value-of select="/ribose:rsd-standard/ribose:bibdata/ribose:copyright/ribose:owner/ribose:organization/ribose:name"/>
18
18
  </xsl:variable>
19
19
 
20
20
  <xsl:variable name="contents_">
21
21
  <contents>
22
22
 
23
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:abstract" mode="contents"/>
24
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:foreword" mode="contents"/>
25
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:executivesummary" mode="contents"/>
26
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:introduction" mode="contents"/>
27
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:clause" mode="contents"/>
28
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:acknowledgements" mode="contents"/>
23
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:abstract" mode="contents"/>
24
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:foreword" mode="contents"/>
25
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:executivesummary" mode="contents"/>
26
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:introduction" mode="contents"/>
27
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause" mode="contents"/>
28
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:acknowledgements" mode="contents"/>
29
29
 
30
30
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
31
31
 
@@ -35,11 +35,11 @@
35
35
  <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
36
36
 
37
37
  <xsl:variable name="docnumber_version">
38
- <xsl:value-of select="/rsd:rsd-standard/rsd:bibdata/rsd:docidentifier[@type = 'rsd' or @type = 'Ribose']"/>
38
+ <xsl:value-of select="/ribose:rsd-standard/ribose:bibdata/ribose:docidentifier[@type = 'rsd' or @type = 'Ribose']"/>
39
39
  <xsl:text>:</xsl:text>
40
40
  <xsl:value-of select="$copyright_year"/>
41
41
 
42
- <xsl:variable name="edition" select="normalize-space(/rsd:rsd-standard/rsd:bibdata/rsd:edition[normalize-space(@language) = ''])"/>
42
+ <xsl:variable name="edition" select="normalize-space(/ribose:rsd-standard/ribose:bibdata/ribose:edition[normalize-space(@language) = ''])"/>
43
43
  <xsl:if test="$edition != ''">
44
44
  <xsl:variable name="title-version">
45
45
  <xsl:call-template name="capitalize">
@@ -342,7 +342,7 @@
342
342
  <fo:table-cell display-align="before" border-right="0.5pt solid black" padding-top="1.5mm" padding-right="5mm">
343
343
  <!-- Author's list -->
344
344
  <fo:block>
345
- <xsl:for-each select="/rsd:rsd-standard/rsd:bibdata/rsd:contributor[rsd:role/@type='author']/rsd:person/rsd:name/rsd:completename">
345
+ <xsl:for-each select="/ribose:rsd-standard/ribose:bibdata/ribose:contributor[ribose:role/@type='author']/ribose:person/ribose:name/ribose:completename">
346
346
  <fo:block>
347
347
  <xsl:apply-templates/>
348
348
  </fo:block>
@@ -351,20 +351,20 @@
351
351
  </fo:table-cell>
352
352
  <fo:table-cell display-align="before" padding-top="1.5mm" padding-left="8mm">
353
353
  <fo:block>
354
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:bibdata/rsd:ext/rsd:security"/>
354
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:bibdata/ribose:ext/ribose:security"/>
355
355
  <fo:block>
356
356
  <xsl:call-template name="convertDate">
357
- <xsl:with-param name="date" select="/rsd:rsd-standard/rsd:bibdata/rsd:date[@type = 'published']/rsd:on"/>
357
+ <xsl:with-param name="date" select="/ribose:rsd-standard/ribose:bibdata/ribose:date[@type = 'published']/ribose:on"/>
358
358
  <xsl:with-param name="format" select="'Month DD, YYYY'"/>
359
359
  </xsl:call-template>
360
360
  </fo:block>
361
361
  <fo:block><xsl:value-of select="$docnumber_version"/></fo:block>
362
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:bibdata/rsd:ext/rsd:editorialgroup/rsd:committee"/>
362
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:bibdata/ribose:ext/ribose:editorialgroup/ribose:committee"/>
363
363
  <fo:block>
364
364
  <xsl:text>© </xsl:text>
365
365
  <xsl:value-of select="$copyright_year"/>
366
366
  <xsl:text> </xsl:text>
367
- <xsl:variable name="publisher" select="/rsd:rsd-standard/rsd:bibdata/rsd:contributor[rsd:role/@type='publisher']/rsd:organization/rsd:name"/>
367
+ <xsl:variable name="publisher" select="/ribose:rsd-standard/ribose:bibdata/ribose:contributor[ribose:role/@type='publisher']/ribose:organization/ribose:name"/>
368
368
  <xsl:value-of select="$publisher"/>
369
369
  <xsl:if test="substring($publisher, string-length($publisher)) != '.'"><xsl:text>.</xsl:text></xsl:if>
370
370
  <xsl:text> </xsl:text>
@@ -388,12 +388,12 @@
388
388
 
389
389
  <!-- title and version -->
390
390
  <fo:block-container margin-top="{$pageHeight - 279.4}mm" height="60mm" display-align="center">
391
- <xsl:variable name="title" select="/rsd:rsd-standard/rsd:bibdata/rsd:title[@language = $lang]"/>
391
+ <xsl:variable name="title" select="/ribose:rsd-standard/ribose:bibdata/ribose:title[@language = $lang]"/>
392
392
  <xsl:if test="string-length($title) &gt; 80">
393
393
  <xsl:attribute name="margin-right">-30mm</xsl:attribute>
394
394
  </xsl:if>
395
395
  <fo:block font-size="27pt" font-weight="bold" role="H1">
396
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:bibdata/rsd:title[@language = $lang]" mode="cover_page"/>
396
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:bibdata/ribose:title[@language = $lang]" mode="cover_page"/>
397
397
  </fo:block>
398
398
  <fo:block space-before="9pt" font-size="16.8pt" font-weight="600">
399
399
  <xsl:value-of select="$docnumber_version"/>
@@ -409,79 +409,12 @@
409
409
  <xsl:with-param name="section">toc</xsl:with-param>
410
410
  </xsl:call-template>
411
411
  <fo:flow flow-name="xsl-region-body">
412
- <xsl:if test="$contents//item[@display = 'true']">
413
- <fo:block role="TOC">
414
- <!-- <fo:block-container absolute-position="fixed" left="13mm" top="15mm"> -->
415
- <fo:block font-size="27pt" font-weight="bold" color="black" margin-left="-15mm" margin-bottom="13mm" role="H1">
416
- <xsl:call-template name="getLocalizedString">
417
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
418
- </xsl:call-template>
419
- </fo:block>
420
- <!-- </fo:block-container> -->
421
412
 
422
- <fo:block-container margin-left="32mm" margin-right="-17mm">
423
- <fo:block-container margin-left="0mm" margin-right="0mm">
424
- <xsl:for-each select="$contents//item[@display = 'true']">
425
- <fo:block font-size="13pt" role="TOCI">
426
- <xsl:if test="@level = 1">
427
- <xsl:if test="preceding-sibling::item[@display = 'true' and @level = 1]">
428
- <xsl:attribute name="space-before">16pt</xsl:attribute>
429
- </xsl:if>
430
- <xsl:attribute name="space-after">4pt</xsl:attribute>
431
- <xsl:attribute name="font-weight">bold</xsl:attribute>
432
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
433
- <xsl:attribute name="color">black</xsl:attribute>
434
- </xsl:if>
435
- <xsl:if test="@level &gt;= 2">
436
- <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 1) * 16.5"/>mm</xsl:attribute>
437
- <xsl:attribute name="space-before">4pt</xsl:attribute>
438
- <xsl:attribute name="space-after">5pt</xsl:attribute>
439
- </xsl:if>
440
- <fo:block text-align-last="justify">
441
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
442
- <xsl:value-of select="@section"/>
443
- <xsl:text> </xsl:text>
444
- <xsl:apply-templates select="title"/>
445
- <xsl:text>  </xsl:text>
446
- <fo:inline>
447
- <fo:leader leader-pattern="rule" rule-thickness="0.2mm"/>
448
- <fo:inline padding-left="2mm"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
449
- </fo:inline>
450
- </fo:basic-link>
451
- </fo:block>
452
- </fo:block>
453
- </xsl:for-each>
413
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[@type = 'toc']"/>
454
414
 
455
- <!-- List of Tables -->
456
- <xsl:if test="$contents//tables/table">
457
- <xsl:call-template name="insertListOf_Title">
458
- <xsl:with-param name="title" select="$title-list-tables"/>
459
- </xsl:call-template>
460
- <xsl:for-each select="$contents//tables/table">
461
- <xsl:call-template name="insertListOf_Item"/>
462
- </xsl:for-each>
463
- </xsl:if>
415
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:legal-statement"/>
464
416
 
465
- <!-- List of Figures -->
466
- <xsl:if test="$contents//figures/figure">
467
- <xsl:call-template name="insertListOf_Title">
468
- <xsl:with-param name="title" select="$title-list-figures"/>
469
- </xsl:call-template>
470
- <xsl:for-each select="$contents//figures/figure">
471
- <xsl:call-template name="insertListOf_Item"/>
472
- </xsl:for-each>
473
- </xsl:if>
474
-
475
- </fo:block-container>
476
- </fo:block-container>
477
- </fo:block>
478
- <fo:block break-after="page"/>
479
- </xsl:if>
480
- <fo:block margin-bottom="12pt"> </fo:block>
481
-
482
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:boilerplate/rsd:legal-statement"/>
483
-
484
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:boilerplate/rsd:feedback-statement"/>
417
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:feedback-statement"/>
485
418
 
486
419
  </fo:flow>
487
420
  </fo:page-sequence>
@@ -502,12 +435,12 @@
502
435
 
503
436
  <fo:block line-height="130%">
504
437
 
505
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:abstract"/>
506
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:foreword"/>
507
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:executivesummary"/>
508
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:introduction"/>
509
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:clause"/>
510
- <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:acknowledgements"/>
438
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:abstract"/>
439
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:foreword"/>
440
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:executivesummary"/>
441
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:introduction"/>
442
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[not(@type = 'toc')]"/>
443
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:acknowledgements"/>
511
444
 
512
445
  <xsl:call-template name="processMainSectionsDefault"/>
513
446
 
@@ -543,11 +476,91 @@
543
476
  </fo:block>
544
477
  </xsl:template>
545
478
 
546
- <xsl:template match="rsd:title" mode="cover_page">
479
+ <xsl:template match="ribose:title" mode="cover_page">
547
480
  <xsl:apply-templates/>
548
481
  </xsl:template>
549
482
 
550
- <xsl:template match="rsd:bibdata/rsd:ext/rsd:security">
483
+ <xsl:template match="ribose:preface/ribose:clause[@type = 'toc']" priority="3">
484
+ <fo:block role="TOC">
485
+ <xsl:apply-templates/>
486
+
487
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
488
+
489
+ <xsl:if test="$contents//item[@display = 'true']">
490
+
491
+ <fo:block-container margin-left="32mm" margin-right="-17mm">
492
+ <fo:block-container margin-left="0mm" margin-right="0mm">
493
+ <xsl:for-each select="$contents//item[@display = 'true']">
494
+ <fo:block font-size="13pt" role="TOCI">
495
+ <xsl:if test="@level = 1">
496
+ <xsl:if test="preceding-sibling::item[@display = 'true' and @level = 1]">
497
+ <xsl:attribute name="space-before">16pt</xsl:attribute>
498
+ </xsl:if>
499
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
500
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
501
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
502
+ <xsl:attribute name="color">black</xsl:attribute>
503
+ </xsl:if>
504
+ <xsl:if test="@level &gt;= 2">
505
+ <xsl:attribute name="margin-left"><xsl:value-of select="(@level - 1) * 16.5"/>mm</xsl:attribute>
506
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
507
+ <xsl:attribute name="space-after">5pt</xsl:attribute>
508
+ </xsl:if>
509
+ <fo:block text-align-last="justify">
510
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
511
+ <xsl:value-of select="@section"/>
512
+ <xsl:text> </xsl:text>
513
+ <xsl:apply-templates select="title"/>
514
+ <xsl:text>  </xsl:text>
515
+ <fo:inline>
516
+ <fo:leader leader-pattern="rule" rule-thickness="0.2mm"/>
517
+ <fo:inline padding-left="2mm"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
518
+ </fo:inline>
519
+ </fo:basic-link>
520
+ </fo:block>
521
+ </fo:block>
522
+ </xsl:for-each>
523
+
524
+ <!-- List of Tables -->
525
+ <xsl:if test="$contents//tables/table">
526
+ <xsl:call-template name="insertListOf_Title">
527
+ <xsl:with-param name="title" select="$title-list-tables"/>
528
+ </xsl:call-template>
529
+ <xsl:for-each select="$contents//tables/table">
530
+ <xsl:call-template name="insertListOf_Item"/>
531
+ </xsl:for-each>
532
+ </xsl:if>
533
+
534
+ <!-- List of Figures -->
535
+ <xsl:if test="$contents//figures/figure">
536
+ <xsl:call-template name="insertListOf_Title">
537
+ <xsl:with-param name="title" select="$title-list-figures"/>
538
+ </xsl:call-template>
539
+ <xsl:for-each select="$contents//figures/figure">
540
+ <xsl:call-template name="insertListOf_Item"/>
541
+ </xsl:for-each>
542
+ </xsl:if>
543
+
544
+ </fo:block-container>
545
+ </fo:block-container>
546
+
547
+ <fo:block break-after="page"/>
548
+ </xsl:if>
549
+ </xsl:if>
550
+ <fo:block margin-bottom="12pt"> </fo:block>
551
+ </fo:block>
552
+ </xsl:template>
553
+
554
+ <xsl:template match="ribose:preface/ribose:clause[@type = 'toc']/ribose:title" priority="3">
555
+ <fo:block font-size="27pt" font-weight="bold" color="black" margin-left="-15mm" margin-bottom="13mm" role="H1">
556
+ <!-- <xsl:call-template name="getLocalizedString">
557
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
558
+ </xsl:call-template> -->
559
+ <xsl:apply-templates/>
560
+ </fo:block>
561
+ </xsl:template>
562
+
563
+ <xsl:template match="ribose:bibdata/ribose:ext/ribose:security">
551
564
  <fo:block>
552
565
  <xsl:call-template name="capitalize">
553
566
  <xsl:with-param name="str" select="."/>
@@ -555,7 +568,7 @@
555
568
  </fo:block>
556
569
  </xsl:template>
557
570
 
558
- <xsl:template match="rsd:bibdata/rsd:ext/rsd:editorialgroup/rsd:committee">
571
+ <xsl:template match="ribose:bibdata/ribose:ext/ribose:editorialgroup/ribose:committee">
559
572
  <fo:block><xsl:apply-templates/></fo:block>
560
573
  </xsl:template>
561
574
 
@@ -568,10 +581,10 @@
568
581
  <!-- ============================= -->
569
582
 
570
583
  <!-- element with title -->
571
- <xsl:template match="*[rsd:title]" mode="contents">
584
+ <xsl:template match="*[ribose:title]" mode="contents">
572
585
  <xsl:variable name="level">
573
586
  <xsl:call-template name="getLevel">
574
- <xsl:with-param name="depth" select="rsd:title/@depth"/>
587
+ <xsl:with-param name="depth" select="ribose:title/@depth"/>
575
588
  </xsl:call-template>
576
589
  </xsl:variable>
577
590
 
@@ -584,8 +597,9 @@
584
597
 
585
598
  <xsl:variable name="skip">
586
599
  <xsl:choose>
587
- <xsl:when test="ancestor-or-self::rsd:bibitem">true</xsl:when>
588
- <xsl:when test="ancestor-or-self::rsd:term">true</xsl:when>
600
+ <xsl:when test="@type = 'toc'">true</xsl:when>
601
+ <xsl:when test="ancestor-or-self::ribose:bibitem">true</xsl:when>
602
+ <xsl:when test="ancestor-or-self::ribose:term">true</xsl:when>
589
603
  <xsl:otherwise>false</xsl:otherwise>
590
604
  </xsl:choose>
591
605
  </xsl:variable>
@@ -618,7 +632,7 @@
618
632
  <!-- ============================= -->
619
633
  <!-- ============================= -->
620
634
 
621
- <xsl:template match="rsd:feedback-statement" priority="2">
635
+ <xsl:template match="ribose:feedback-statement" priority="2">
622
636
  <fo:block-container border="1pt solid black" padding="1mm" padding-left="2mm">
623
637
  <fo:block>
624
638
  <xsl:apply-templates/>
@@ -626,7 +640,7 @@
626
640
  </fo:block-container>
627
641
  </xsl:template>
628
642
 
629
- <xsl:template match="rsd:legal-statement" priority="2">
643
+ <xsl:template match="ribose:legal-statement" priority="2">
630
644
  <xsl:apply-templates/>
631
645
  </xsl:template>
632
646
 
@@ -634,7 +648,7 @@
634
648
  <!-- title -->
635
649
  <!-- ====== -->
636
650
 
637
- <!-- <xsl:template match="rsd:annex/rsd:title">
651
+ <!-- <xsl:template match="ribose:annex/ribose:title">
638
652
  <xsl:variable name="level">
639
653
  <xsl:call-template name="getLevel"/>
640
654
  </xsl:variable>
@@ -649,7 +663,7 @@
649
663
  </fo:block>
650
664
  </xsl:template> -->
651
665
 
652
- <xsl:template match="rsd:title" name="title">
666
+ <xsl:template match="ribose:title" name="title">
653
667
 
654
668
  <xsl:variable name="level">
655
669
  <xsl:call-template name="getLevel"/>
@@ -657,8 +671,8 @@
657
671
 
658
672
  <xsl:variable name="font-size">
659
673
  <xsl:choose>
660
- <!-- <xsl:when test="ancestor::rsd:preface and $level &gt;= 2">12pt</xsl:when>
661
- <xsl:when test="ancestor::rsd:preface">13pt</xsl:when> -->
674
+ <!-- <xsl:when test="ancestor::ribose:preface and $level &gt;= 2">12pt</xsl:when>
675
+ <xsl:when test="ancestor::ribose:preface">13pt</xsl:when> -->
662
676
  <xsl:when test="$level = 1">22pt</xsl:when>
663
677
  <xsl:when test="$level = 2">13pt</xsl:when>
664
678
  <xsl:when test="$level &gt;= 3">11pt</xsl:when>
@@ -769,7 +783,7 @@
769
783
  </fo:block>
770
784
  </xsl:template>
771
785
 
772
- <xsl:template match="rsd:p" name="paragraph">
786
+ <xsl:template match="ribose:p" name="paragraph">
773
787
  <xsl:param name="inline" select="'false'"/>
774
788
  <xsl:param name="split_keep-within-line"/>
775
789
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
@@ -787,19 +801,19 @@
787
801
  </xsl:attribute>
788
802
  <xsl:attribute name="text-align">
789
803
  <xsl:choose>
790
- <!-- <xsl:when test="ancestor::rsd:preface">justify</xsl:when> -->
804
+ <!-- <xsl:when test="ancestor::ribose:preface">justify</xsl:when> -->
791
805
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
792
806
  <xsl:otherwise>left</xsl:otherwise><!-- justify -->
793
807
  </xsl:choose>
794
808
  </xsl:attribute>
795
809
  <xsl:attribute name="space-after">
796
810
  <xsl:choose>
797
- <xsl:when test="ancestor::rsd:li">6pt</xsl:when>
798
- <xsl:when test="ancestor::rsd:feedback-statement and not(following-sibling::rsd:p)">0pt</xsl:when>
811
+ <xsl:when test="ancestor::ribose:li">6pt</xsl:when>
812
+ <xsl:when test="ancestor::ribose:feedback-statement and not(following-sibling::ribose:p)">0pt</xsl:when>
799
813
  <xsl:otherwise>6pt</xsl:otherwise> <!-- 12pt-->
800
814
  </xsl:choose>
801
815
  </xsl:attribute>
802
- <xsl:if test="ancestor::rsd:dl"> <!-- ancestor::rsd:li or -->
816
+ <xsl:if test="ancestor::ribose:dl"> <!-- ancestor::ribose:li or -->
803
817
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
804
818
  </xsl:if>
805
819
 
@@ -810,7 +824,7 @@
810
824
  </xsl:element>
811
825
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
812
826
  <fo:block margin-bottom="12pt">
813
- <xsl:if test="ancestor::rsd:annex">
827
+ <xsl:if test="ancestor::ribose:annex">
814
828
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
815
829
  </xsl:if>
816
830
  <xsl:value-of select="$linebreak"/>
@@ -821,17 +835,17 @@
821
835
  </xsl:if>
822
836
  </xsl:template>
823
837
 
824
- <xsl:template match="rsd:fn/rsd:p">
838
+ <xsl:template match="ribose:fn/ribose:p">
825
839
  <fo:block>
826
840
  <xsl:apply-templates/>
827
841
  </fo:block>
828
842
  </xsl:template>
829
843
 
830
- <xsl:template match="rsd:ul | rsd:ol" mode="list" priority="2">
844
+ <xsl:template match="ribose:ul | ribose:ol" mode="list" priority="2">
831
845
  <fo:block-container>
832
846
  <fo:block-container margin-left="0mm">
833
847
  <xsl:choose>
834
- <xsl:when test="not(ancestor::rsd:ul) and not(ancestor::rsd:ol)">
848
+ <xsl:when test="not(ancestor::ribose:ul) and not(ancestor::ribose:ol)">
835
849
  <fo:block padding-bottom="12pt" padding-top="4pt">
836
850
  <xsl:call-template name="listProcessing"/>
837
851
  </fo:block>
@@ -850,22 +864,22 @@
850
864
  </fo:list-block>
851
865
  </xsl:template>
852
866
 
853
- <xsl:template match="rsd:ul/rsd:note | rsd:ol/rsd:note" priority="2">
867
+ <xsl:template match="ribose:ul/ribose:note | ribose:ol/ribose:note" priority="2">
854
868
  <fo:list-item font-size="10pt">
855
- <xsl:if test="ancestor::rsd:table">
869
+ <xsl:if test="ancestor::ribose:table">
856
870
  <xsl:attribute name="font-size">8pt</xsl:attribute>
857
871
  </xsl:if>
858
872
  <fo:list-item-label><fo:block/></fo:list-item-label>
859
873
  <fo:list-item-body>
860
874
  <fo:block>
861
- <xsl:apply-templates select="rsd:name"/>
875
+ <xsl:apply-templates select="ribose:name"/>
862
876
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
863
877
  </fo:block>
864
878
  </fo:list-item-body>
865
879
  </fo:list-item>
866
880
  </xsl:template>
867
881
 
868
- <xsl:template match="rsd:preferred | rsd:deprecates | rsd:admitted" priority="2">
882
+ <xsl:template match="ribose:preferred | ribose:deprecates | ribose:admitted" priority="2">
869
883
  <xsl:variable name="level">
870
884
  <xsl:call-template name="getLevel"/>
871
885
  </xsl:variable>
@@ -879,10 +893,10 @@
879
893
  <xsl:call-template name="getLevelTermName"/>
880
894
  </xsl:variable>
881
895
  <fo:block font-weight="bold" color="black" font-size="{$font-size}" keep-with-next="always" role="H{$levelTerm}"> <!-- 600 - semibold -->
882
- <xsl:if test="preceding-sibling::*[1][self::rsd:name]">
896
+ <xsl:if test="preceding-sibling::*[1][self::ribose:name]">
883
897
  <xsl:attribute name="space-before">11mm</xsl:attribute>
884
898
  <fo:inline padding-right="1mm">
885
- <xsl:apply-templates select="ancestor::rsd:term[1]/rsd:name"/>
899
+ <xsl:apply-templates select="ancestor::ribose:term[1]/ribose:name"/>
886
900
  </fo:inline>
887
901
  </xsl:if>
888
902
 
@@ -918,7 +932,7 @@
918
932
  </fo:block>
919
933
  </xsl:template>
920
934
 
921
- <xsl:template match="rsd:references[not(@normative='true')]" priority="3">
935
+ <xsl:template match="ribose:references[not(@normative='true')]" priority="3">
922
936
  <fo:block break-after="page"/>
923
937
  <fo:block id="{@id}">
924
938
  <fo:table width="100%" table-layout="fixed">
@@ -932,7 +946,7 @@
932
946
  <xsl:attribute name="margin-bottom">16pt</xsl:attribute>
933
947
  <xsl:attribute name="color">black</xsl:attribute>
934
948
  <xsl:attribute name="line-height">125%</xsl:attribute>
935
- <xsl:apply-templates select="rsd:title/node()"/>
949
+ <xsl:apply-templates select="ribose:title/node()"/>
936
950
  </fo:block>
937
951
  </fo:table-cell>
938
952
  </fo:table-row>
@@ -970,7 +984,7 @@
970
984
  <xsl:template match="*[local-name() = 'clause']" priority="2">
971
985
  <xsl:variable name="level">
972
986
  <xsl:call-template name="getLevel">
973
- <xsl:with-param name="depth" select="rsd:title/@depth"/>
987
+ <xsl:with-param name="depth" select="ribose:title/@depth"/>
974
988
  </xsl:call-template>
975
989
  </xsl:variable>
976
990
  <fo:block-container>
@@ -1094,7 +1108,7 @@
1094
1108
  <xsl:text>Ribose</xsl:text>
1095
1109
  <xsl:text> </xsl:text>
1096
1110
  <xsl:call-template name="capitalize">
1097
- <xsl:with-param name="str" select="/rsd:rsd-standard/rsd:bibdata/rsd:ext/rsd:doctype"/>
1111
+ <xsl:with-param name="str" select="/ribose:rsd-standard/ribose:bibdata/ribose:ext/ribose:doctype"/>
1098
1112
  </xsl:call-template>
1099
1113
  </xsl:variable>
1100
1114
  <fo:static-content flow-name="footer-odd" role="artifact">
@@ -1195,7 +1209,7 @@
1195
1209
  </xsl:if>
1196
1210
  </xsl:template>
1197
1211
 
1198
- <xsl:strip-space elements="rsd:xref"/>
1212
+ <xsl:strip-space elements="ribose:xref"/>
1199
1213
 
1200
1214
  <!-- external parameters -->
1201
1215
 
@@ -1604,6 +1618,16 @@
1604
1618
 
1605
1619
  </xsl:attribute-set>
1606
1620
 
1621
+ <xsl:template name="refine_link-style">
1622
+
1623
+ <xsl:if test="ancestor::*[local-name() = 'bibitem']">
1624
+ <xsl:attribute name="color">black</xsl:attribute>
1625
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
1626
+ <xsl:attribute name="font-weight">300</xsl:attribute>
1627
+ </xsl:if>
1628
+
1629
+ </xsl:template> <!-- refine_link-style -->
1630
+
1607
1631
  <xsl:attribute-set name="sourcecode-container-style">
1608
1632
 
1609
1633
  <xsl:attribute name="space-after">12pt</xsl:attribute>
@@ -1622,6 +1646,23 @@
1622
1646
 
1623
1647
  </xsl:attribute-set>
1624
1648
 
1649
+ <xsl:template name="refine_sourcecode-style">
1650
+ <!-- background for image -->
1651
+ <xsl:if test="starts-with(*[local-name() = 'name']/text()[1], 'Figure ')">
1652
+ <xsl:attribute name="background-color">rgb(236,242,246)</xsl:attribute>
1653
+ <xsl:attribute name="padding-left">11mm</xsl:attribute>
1654
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1655
+ <xsl:attribute name="padding-right">11mm</xsl:attribute>
1656
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1657
+ <xsl:attribute name="padding-top">7.5mm</xsl:attribute>
1658
+ <xsl:attribute name="padding-bottom">7.5mm</xsl:attribute>
1659
+ <xsl:if test="following-sibling::*[1][local-name() = 'sourcecode'] and starts-with(*[local-name() = 'name']/text()[1], 'Figure ')">
1660
+ <xsl:attribute name="margin-bottom">16pt</xsl:attribute>
1661
+ </xsl:if>
1662
+ </xsl:if>
1663
+
1664
+ </xsl:template> <!-- refine_sourcecode-style -->
1665
+
1625
1666
  <xsl:attribute-set name="pre-style">
1626
1667
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1627
1668
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1705,6 +1746,15 @@
1705
1746
 
1706
1747
  </xsl:attribute-set> <!-- example-style -->
1707
1748
 
1749
+ <xsl:template name="refine_example-style">
1750
+
1751
+ <xsl:if test="ancestor::ribose:ul or ancestor::ribose:ol">
1752
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1753
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1754
+ </xsl:if>
1755
+
1756
+ </xsl:template> <!-- refine_example-style -->
1757
+
1708
1758
  <xsl:attribute-set name="example-body-style">
1709
1759
 
1710
1760
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1723,6 +1773,10 @@
1723
1773
 
1724
1774
  </xsl:attribute-set> <!-- example-p-style -->
1725
1775
 
1776
+ <xsl:template name="refine_example-p-style">
1777
+
1778
+ </xsl:template> <!-- refine_example-p-style -->
1779
+
1726
1780
  <xsl:attribute-set name="termexample-name-style">
1727
1781
 
1728
1782
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1752,6 +1806,12 @@
1752
1806
 
1753
1807
  </xsl:attribute-set> <!-- table-container-style -->
1754
1808
 
1809
+ <xsl:template name="refine_table-container-style">
1810
+ <xsl:param name="margin-side"/>
1811
+
1812
+ <!-- end table block-container attributes -->
1813
+ </xsl:template> <!-- refine_table-container-style -->
1814
+
1755
1815
  <xsl:attribute-set name="table-style">
1756
1816
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1757
1817
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -1761,6 +1821,13 @@
1761
1821
 
1762
1822
  </xsl:attribute-set><!-- table-style -->
1763
1823
 
1824
+ <xsl:template name="refine_table-style">
1825
+ <xsl:param name="margin-side"/>
1826
+
1827
+ <xsl:call-template name="setBordersTableArray"/>
1828
+
1829
+ </xsl:template> <!-- refine_table-style -->
1830
+
1764
1831
  <xsl:attribute-set name="table-name-style">
1765
1832
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1766
1833
 
@@ -1773,6 +1840,11 @@
1773
1840
 
1774
1841
  </xsl:attribute-set> <!-- table-name-style -->
1775
1842
 
1843
+ <xsl:template name="refine_table-name-style">
1844
+ <xsl:param name="continued"/>
1845
+
1846
+ </xsl:template> <!-- refine_table-name-style -->
1847
+
1776
1848
  <xsl:attribute-set name="table-row-style">
1777
1849
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1778
1850
 
@@ -1789,14 +1861,35 @@
1789
1861
 
1790
1862
  </xsl:attribute-set>
1791
1863
 
1864
+ <xsl:template name="refine_table-header-row-style">
1865
+
1866
+ <xsl:call-template name="setBordersTableArray"/>
1867
+
1868
+ </xsl:template> <!-- refine_table-header-row-style -->
1869
+
1792
1870
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1793
1871
 
1794
1872
  </xsl:attribute-set>
1795
1873
 
1874
+ <xsl:template name="refine_table-footer-row-style">
1875
+
1876
+ </xsl:template> <!-- refine_table-footer-row-style -->
1877
+
1796
1878
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1797
1879
 
1798
1880
  </xsl:attribute-set>
1799
1881
 
1882
+ <xsl:template name="refine_table-body-row-style">
1883
+
1884
+ <xsl:call-template name="setBordersTableArray"/>
1885
+
1886
+ <xsl:variable name="number"><xsl:number/></xsl:variable>
1887
+ <xsl:if test="$number mod 2 = 0">
1888
+ <xsl:attribute name="background-color">rgb(254, 247, 228)</xsl:attribute>
1889
+ </xsl:if>
1890
+
1891
+ </xsl:template> <!-- refine_table-body-row-style -->
1892
+
1800
1893
  <xsl:attribute-set name="table-header-cell-style">
1801
1894
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1802
1895
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1808,6 +1901,18 @@
1808
1901
 
1809
1902
  </xsl:attribute-set> <!-- table-header-cell-style -->
1810
1903
 
1904
+ <xsl:template name="refine_table-header-cell-style">
1905
+
1906
+ <xsl:call-template name="setBordersTableArray"/>
1907
+
1908
+ <xsl:if test="$lang = 'ar'">
1909
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1910
+ </xsl:if>
1911
+
1912
+ <xsl:call-template name="setTableCellAttributes"/>
1913
+
1914
+ </xsl:template> <!-- refine_table-header-cell-style -->
1915
+
1811
1916
  <xsl:attribute-set name="table-cell-style">
1812
1917
  <xsl:attribute name="display-align">center</xsl:attribute>
1813
1918
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1818,6 +1923,18 @@
1818
1923
 
1819
1924
  </xsl:attribute-set> <!-- table-cell-style -->
1820
1925
 
1926
+ <xsl:template name="refine_table-cell-style">
1927
+
1928
+ <xsl:if test="$lang = 'ar'">
1929
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1930
+ </xsl:if>
1931
+
1932
+ <!-- bsi -->
1933
+
1934
+ <xsl:call-template name="setBordersTableArray"/>
1935
+
1936
+ </xsl:template> <!-- refine_table-cell-style -->
1937
+
1821
1938
  <xsl:attribute-set name="table-footer-cell-style">
1822
1939
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1823
1940
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1828,6 +1945,10 @@
1828
1945
 
1829
1946
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1830
1947
 
1948
+ <xsl:template name="refine_table-footer-cell-style">
1949
+
1950
+ </xsl:template> <!-- refine_table-footer-cell-style -->
1951
+
1831
1952
  <xsl:attribute-set name="table-note-style">
1832
1953
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1833
1954
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1836,6 +1957,10 @@
1836
1957
 
1837
1958
  </xsl:attribute-set><!-- table-note-style -->
1838
1959
 
1960
+ <xsl:template name="refine_table-note-style">
1961
+
1962
+ </xsl:template> <!-- refine_table-note-style -->
1963
+
1839
1964
  <xsl:attribute-set name="table-fn-style">
1840
1965
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1841
1966
 
@@ -1891,6 +2016,10 @@
1891
2016
 
1892
2017
  </xsl:attribute-set>
1893
2018
 
2019
+ <xsl:template name="refine_dt-cell-style">
2020
+
2021
+ </xsl:template> <!-- refine_dt-cell-style -->
2022
+
1894
2023
  <xsl:attribute-set name="dt-block-style">
1895
2024
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1896
2025
 
@@ -1899,6 +2028,10 @@
1899
2028
 
1900
2029
  </xsl:attribute-set>
1901
2030
 
2031
+ <xsl:template name="refine_dt-block-style">
2032
+
2033
+ </xsl:template> <!-- refine_dt-block-style -->
2034
+
1902
2035
  <xsl:attribute-set name="dl-name-style">
1903
2036
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1904
2037
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1913,6 +2046,10 @@
1913
2046
 
1914
2047
  </xsl:attribute-set>
1915
2048
 
2049
+ <xsl:template name="refine_dd-cell-style">
2050
+
2051
+ </xsl:template> <!-- refine_dd-cell-style -->
2052
+
1916
2053
  <!-- ========================== -->
1917
2054
  <!-- END Definition's list styles -->
1918
2055
  <!-- ========================== -->
@@ -1943,6 +2080,12 @@
1943
2080
 
1944
2081
  </xsl:attribute-set>
1945
2082
 
2083
+ <xsl:template name="refine_eref-style">
2084
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
2085
+ <xsl:variable name="text" select="normalize-space()"/>
2086
+
2087
+ </xsl:template> <!-- refine_eref-style -->
2088
+
1946
2089
  <xsl:attribute-set name="note-style">
1947
2090
 
1948
2091
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1950,6 +2093,15 @@
1950
2093
 
1951
2094
  </xsl:attribute-set>
1952
2095
 
2096
+ <xsl:template name="refine_note-style">
2097
+
2098
+ <xsl:if test="ancestor::ribose:ul or ancestor::ribose:ol and not(ancestor::ribose:note[1]/following-sibling::*)">
2099
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2100
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2101
+ </xsl:if>
2102
+
2103
+ </xsl:template>
2104
+
1953
2105
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1954
2106
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1955
2107
 
@@ -1961,6 +2113,10 @@
1961
2113
 
1962
2114
  </xsl:attribute-set>
1963
2115
 
2116
+ <xsl:template name="refine_note-name-style">
2117
+
2118
+ </xsl:template> <!-- refine_note-name-style -->
2119
+
1964
2120
  <xsl:attribute-set name="table-note-name-style">
1965
2121
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1966
2122
 
@@ -1969,6 +2125,10 @@
1969
2125
 
1970
2126
  </xsl:attribute-set>
1971
2127
 
2128
+ <xsl:template name="refine_table-note-name-style">
2129
+
2130
+ </xsl:template> <!-- refine_table-note-name-style -->
2131
+
1972
2132
  <xsl:attribute-set name="note-p-style">
1973
2133
 
1974
2134
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1982,6 +2142,10 @@
1982
2142
 
1983
2143
  </xsl:attribute-set>
1984
2144
 
2145
+ <xsl:template name="refine_termnote-style">
2146
+
2147
+ </xsl:template> <!-- refine_termnote-style -->
2148
+
1985
2149
  <xsl:attribute-set name="termnote-name-style">
1986
2150
 
1987
2151
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1990,6 +2154,10 @@
1990
2154
 
1991
2155
  </xsl:attribute-set>
1992
2156
 
2157
+ <xsl:template name="refine_termnote-name-style">
2158
+
2159
+ </xsl:template>
2160
+
1993
2161
  <xsl:attribute-set name="termnote-p-style">
1994
2162
 
1995
2163
  </xsl:attribute-set>
@@ -2003,6 +2171,10 @@
2003
2171
 
2004
2172
  </xsl:attribute-set>
2005
2173
 
2174
+ <xsl:template name="refine_quote-style">
2175
+
2176
+ </xsl:template>
2177
+
2006
2178
  <xsl:attribute-set name="quote-source-style">
2007
2179
  <xsl:attribute name="text-align">right</xsl:attribute>
2008
2180
 
@@ -2016,6 +2188,10 @@
2016
2188
 
2017
2189
  </xsl:attribute-set>
2018
2190
 
2191
+ <xsl:template name="refine_termsource-style">
2192
+
2193
+ </xsl:template> <!-- refine_termsource-style -->
2194
+
2019
2195
  <xsl:attribute-set name="termsource-text-style">
2020
2196
 
2021
2197
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
@@ -2065,6 +2241,10 @@
2065
2241
 
2066
2242
  </xsl:attribute-set>
2067
2243
 
2244
+ <xsl:template name="refine_figure-name-style">
2245
+
2246
+ </xsl:template> <!-- refine_figure-name-style -->
2247
+
2068
2248
  <xsl:attribute-set name="figure-source-style">
2069
2249
 
2070
2250
  </xsl:attribute-set>
@@ -2084,6 +2264,10 @@
2084
2264
 
2085
2265
  </xsl:attribute-set> <!-- formula-stem-block-style -->
2086
2266
 
2267
+ <xsl:template name="refine_formula-stem-block-style">
2268
+
2269
+ </xsl:template> <!-- refine_formula-stem-block-style -->
2270
+
2087
2271
  <xsl:attribute-set name="formula-stem-number-style">
2088
2272
  <xsl:attribute name="text-align">right</xsl:attribute>
2089
2273
 
@@ -2095,6 +2279,10 @@
2095
2279
 
2096
2280
  </xsl:attribute-set>
2097
2281
 
2282
+ <xsl:template name="refine_image-style">
2283
+
2284
+ </xsl:template>
2285
+
2098
2286
  <xsl:attribute-set name="figure-pseudocode-p-style">
2099
2287
 
2100
2288
  </xsl:attribute-set>
@@ -2201,12 +2389,20 @@
2201
2389
 
2202
2390
  </xsl:attribute-set>
2203
2391
 
2392
+ <xsl:template name="refine_mathml-style">
2393
+
2394
+ </xsl:template>
2395
+
2204
2396
  <xsl:attribute-set name="list-style">
2205
2397
 
2206
2398
  <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
2207
2399
 
2208
2400
  </xsl:attribute-set> <!-- list-style -->
2209
2401
 
2402
+ <xsl:template name="refine_list-style">
2403
+
2404
+ </xsl:template> <!-- refine_list-style -->
2405
+
2210
2406
  <xsl:attribute-set name="list-name-style">
2211
2407
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2212
2408
 
@@ -2221,6 +2417,10 @@
2221
2417
 
2222
2418
  </xsl:attribute-set>
2223
2419
 
2420
+ <xsl:template name="refine_list-item-style">
2421
+
2422
+ </xsl:template> <!-- refine_list-item-style -->
2423
+
2224
2424
  <xsl:attribute-set name="list-item-label-style">
2225
2425
 
2226
2426
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
@@ -2228,12 +2428,20 @@
2228
2428
 
2229
2429
  </xsl:attribute-set>
2230
2430
 
2431
+ <xsl:template name="refine_list-item-label-style">
2432
+
2433
+ </xsl:template> <!-- refine_list-item-label-style -->
2434
+
2231
2435
  <xsl:attribute-set name="list-item-body-style">
2232
2436
 
2233
2437
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2234
2438
 
2235
2439
  </xsl:attribute-set>
2236
2440
 
2441
+ <xsl:template name="refine_list-item-body-style">
2442
+
2443
+ </xsl:template> <!-- refine_list-item-body-style -->
2444
+
2237
2445
  <xsl:attribute-set name="toc-style">
2238
2446
  <xsl:attribute name="line-height">135%</xsl:attribute>
2239
2447
  </xsl:attribute-set>
@@ -2248,6 +2456,10 @@
2248
2456
 
2249
2457
  </xsl:attribute-set>
2250
2458
 
2459
+ <xsl:template name="refine_fn-reference-style">
2460
+
2461
+ </xsl:template> <!-- refine_fn-reference-style -->
2462
+
2251
2463
  <xsl:attribute-set name="fn-style">
2252
2464
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2253
2465
  </xsl:attribute-set>
@@ -2273,6 +2485,10 @@
2273
2485
 
2274
2486
  </xsl:attribute-set>
2275
2487
 
2488
+ <xsl:template name="refine_fn-body-style">
2489
+
2490
+ </xsl:template> <!-- refine_fn-body-style -->
2491
+
2276
2492
  <xsl:attribute-set name="fn-body-num-style">
2277
2493
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2278
2494
 
@@ -2281,6 +2497,10 @@
2281
2497
 
2282
2498
  </xsl:attribute-set> <!-- fn-body-num-style -->
2283
2499
 
2500
+ <xsl:template name="refine_fn-body-num-style">
2501
+
2502
+ </xsl:template> <!-- refine_fn-body-num-style -->
2503
+
2284
2504
  <!-- admonition -->
2285
2505
  <xsl:attribute-set name="admonition-style">
2286
2506
 
@@ -2941,7 +3161,9 @@
2941
3161
 
2942
3162
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2943
3163
 
2944
- <!-- end table block-container attributes -->
3164
+ <xsl:call-template name="refine_table-container-style">
3165
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3166
+ </xsl:call-template>
2945
3167
 
2946
3168
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2947
3169
 
@@ -2962,7 +3184,9 @@
2962
3184
 
2963
3185
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2964
3186
 
2965
- <xsl:call-template name="setBordersTableArray"/>
3187
+ <xsl:call-template name="refine_table-style">
3188
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3189
+ </xsl:call-template>
2966
3190
 
2967
3191
  </xsl:element>
2968
3192
  </xsl:variable>
@@ -3028,7 +3252,7 @@
3028
3252
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3029
3253
  </xsl:when>
3030
3254
  <xsl:otherwise>
3031
- <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 -->
3255
+ <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 -->
3032
3256
  </xsl:otherwise>
3033
3257
  </xsl:choose>
3034
3258
 
@@ -3118,6 +3342,10 @@
3118
3342
 
3119
3343
  <fo:block xsl:use-attribute-sets="table-name-style">
3120
3344
 
3345
+ <xsl:call-template name="refine_table-name-style">
3346
+ <xsl:with-param name="continued" select="$continued"/>
3347
+ </xsl:call-template>
3348
+
3121
3349
  <xsl:choose>
3122
3350
  <xsl:when test="$continued = 'true'">
3123
3351
 
@@ -3500,6 +3728,8 @@
3500
3728
  <fo:table-row>
3501
3729
  <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">
3502
3730
 
3731
+ <xsl:call-template name="refine_table-header-title-style"/>
3732
+
3503
3733
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3504
3734
  <xsl:with-param name="continued">true</xsl:with-param>
3505
3735
  </xsl:apply-templates>
@@ -3512,6 +3742,10 @@
3512
3742
  </fo:table-row>
3513
3743
  </xsl:template> <!-- table-header-title -->
3514
3744
 
3745
+ <xsl:template name="refine_table-header-title-style">
3746
+
3747
+ </xsl:template> <!-- refine_table-header-title-style -->
3748
+
3515
3749
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3516
3750
  <fo:table-body>
3517
3751
  <xsl:apply-templates/>
@@ -3536,7 +3770,7 @@
3536
3770
  <xsl:param name="colwidths"/>
3537
3771
  <xsl:param name="colgroup"/>
3538
3772
 
3539
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3773
+ <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']"/>
3540
3774
 
3541
3775
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3542
3776
 
@@ -3596,6 +3830,8 @@
3596
3830
  <fo:table-row>
3597
3831
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3598
3832
 
3833
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3834
+
3599
3835
  <xsl:call-template name="setBordersTableArray"/>
3600
3836
 
3601
3837
  <!-- fn will be processed inside 'note' processing -->
@@ -3604,6 +3840,7 @@
3604
3840
 
3605
3841
  <!-- except gb and bsi -->
3606
3842
 
3843
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3607
3844
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3608
3845
  <xsl:apply-templates select="../*[local-name()='note']"/>
3609
3846
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3735,7 +3972,7 @@
3735
3972
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3736
3973
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3737
3974
 
3738
- <xsl:call-template name="setBordersTableArray"/>
3975
+ <xsl:call-template name="refine_table-header-row-style"/>
3739
3976
 
3740
3977
  <xsl:call-template name="setTableRowAttributes"/>
3741
3978
 
@@ -3769,6 +4006,8 @@
3769
4006
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3770
4007
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3771
4008
 
4009
+ <xsl:call-template name="refine_table-footer-row-style"/>
4010
+
3772
4011
  <xsl:call-template name="setTableRowAttributes"/>
3773
4012
  <xsl:apply-templates/>
3774
4013
  </fo:table-row>
@@ -3782,14 +4021,10 @@
3782
4021
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3783
4022
  </xsl:if>
3784
4023
 
3785
- <xsl:call-template name="setBordersTableArray"/>
3786
-
3787
- <xsl:variable name="number"><xsl:number/></xsl:variable>
3788
- <xsl:if test="$number mod 2 = 0">
3789
- <xsl:attribute name="background-color">rgb(254, 247, 228)</xsl:attribute>
3790
- </xsl:if>
4024
+ <xsl:call-template name="refine_table-body-row-style"/>
3791
4025
 
3792
4026
  <xsl:call-template name="setTableRowAttributes"/>
4027
+
3793
4028
  <xsl:apply-templates/>
3794
4029
  </fo:table-row>
3795
4030
  </xsl:template>
@@ -3808,13 +4043,7 @@
3808
4043
  <xsl:with-param name="default">center</xsl:with-param>
3809
4044
  </xsl:call-template>
3810
4045
 
3811
- <xsl:call-template name="setBordersTableArray"/>
3812
-
3813
- <xsl:if test="$lang = 'ar'">
3814
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3815
- </xsl:if>
3816
-
3817
- <xsl:call-template name="setTableCellAttributes"/>
4046
+ <xsl:call-template name="refine_table-header-cell-style"/>
3818
4047
 
3819
4048
  <fo:block>
3820
4049
  <xsl:apply-templates/>
@@ -3856,13 +4085,7 @@
3856
4085
  <xsl:with-param name="default">left</xsl:with-param>
3857
4086
  </xsl:call-template>
3858
4087
 
3859
- <xsl:if test="$lang = 'ar'">
3860
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3861
- </xsl:if>
3862
-
3863
- <!-- bsi -->
3864
-
3865
- <xsl:call-template name="setBordersTableArray"/>
4088
+ <xsl:call-template name="refine_table-cell-style"/>
3866
4089
 
3867
4090
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3868
4091
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3893,9 +4116,13 @@
3893
4116
 
3894
4117
  <fo:block xsl:use-attribute-sets="table-note-style">
3895
4118
 
4119
+ <xsl:call-template name="refine_table-note-style"/>
4120
+
3896
4121
  <!-- Table's note name (NOTE, for example) -->
3897
4122
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3898
4123
 
4124
+ <xsl:call-template name="refine_table-note-name-style"/>
4125
+
3899
4126
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3900
4127
 
3901
4128
  </fo:inline>
@@ -3923,6 +4150,14 @@
3923
4150
  <!-- list of footnotes to calculate actual footnotes number -->
3924
4151
  <xsl:variable name="p_fn_">
3925
4152
  <xsl:call-template name="get_fn_list"/>
4153
+ <!-- <xsl:choose>
4154
+ <xsl:when test="$namespace = 'jis'">
4155
+ <xsl:call-template name="get_fn_list_for_element"/>
4156
+ </xsl:when>
4157
+ <xsl:otherwise>
4158
+ <xsl:call-template name="get_fn_list"/>
4159
+ </xsl:otherwise>
4160
+ </xsl:choose> -->
3926
4161
  </xsl:variable>
3927
4162
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3928
4163
 
@@ -3947,7 +4182,14 @@
3947
4182
 
3948
4183
  </xsl:variable>
3949
4184
 
3950
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4185
+ <xsl:variable name="ref_id">
4186
+ <xsl:choose>
4187
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4188
+ <xsl:otherwise>
4189
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4190
+ </xsl:otherwise>
4191
+ </xsl:choose>
4192
+ </xsl:variable>
3951
4193
  <xsl:variable name="footnote_inline">
3952
4194
  <fo:inline>
3953
4195
 
@@ -3970,9 +4212,13 @@
3970
4212
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3971
4213
  </xsl:if>
3972
4214
 
3973
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3974
- <xsl:value-of select="$current_fn_number_text"/>
3975
- </fo:basic-link>
4215
+ <xsl:call-template name="insert_basic_link">
4216
+ <xsl:with-param name="element">
4217
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4218
+ <xsl:copy-of select="$current_fn_number_text"/>
4219
+ </fo:basic-link>
4220
+ </xsl:with-param>
4221
+ </xsl:call-template>
3976
4222
  </fo:inline>
3977
4223
  </xsl:variable>
3978
4224
 
@@ -3989,8 +4235,12 @@
3989
4235
 
3990
4236
  <fo:block xsl:use-attribute-sets="fn-body-style">
3991
4237
 
4238
+ <xsl:call-template name="refine_fn-body-style"/>
4239
+
3992
4240
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3993
4241
 
4242
+ <xsl:call-template name="refine_fn-body-num-style"/>
4243
+
3994
4244
  <xsl:value-of select="$current_fn_number_text"/>
3995
4245
  </fo:inline>
3996
4246
  <xsl:apply-templates/>
@@ -4042,6 +4292,28 @@
4042
4292
  </xsl:choose>
4043
4293
  </xsl:template>
4044
4294
 
4295
+ <xsl:template name="get_fn_list_for_element">
4296
+ <xsl:choose>
4297
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4298
+ <fn gen_id="{generate-id(.)}">
4299
+ <xsl:copy-of select="@*"/>
4300
+ <xsl:copy-of select="node()"/>
4301
+ </fn>
4302
+ </xsl:when>
4303
+ <xsl:otherwise>
4304
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4305
+ <xsl:variable name="element_id" select="@id"/>
4306
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4307
+ <!-- copy unique fn -->
4308
+ <fn gen_id="{generate-id(.)}">
4309
+ <xsl:copy-of select="@*"/>
4310
+ <xsl:copy-of select="node()"/>
4311
+ </fn>
4312
+ </xsl:for-each>
4313
+ </xsl:for-each>
4314
+ </xsl:otherwise>
4315
+ </xsl:choose>
4316
+ </xsl:template>
4045
4317
  <!-- ============================ -->
4046
4318
  <!-- table's footnotes rendering -->
4047
4319
  <!-- ============================ -->
@@ -4216,6 +4488,8 @@
4216
4488
  <xsl:template match="*[local-name()='fn']">
4217
4489
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4218
4490
 
4491
+ <xsl:call-template name="refine_fn-reference-style"/>
4492
+
4219
4493
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4220
4494
 
4221
4495
  <xsl:value-of select="@reference"/>
@@ -4305,14 +4579,18 @@
4305
4579
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4306
4580
  <xsl:text> </xsl:text>
4307
4581
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4308
- <xsl:text/>
4309
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4582
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4583
+ <xsl:text> </xsl:text>
4584
+ </xsl:if>
4585
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
4310
4586
  </fo:block>
4311
4587
 
4312
4588
  </xsl:when> <!-- END: only one component -->
4313
4589
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4314
4590
  <fo:block margin-bottom="12pt" text-align="left">
4315
4591
 
4592
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4593
+
4316
4594
  <!-- <xsl:variable name="title-where">
4317
4595
  <xsl:call-template name="getLocalizedString">
4318
4596
  <xsl:with-param name="key">where</xsl:with-param>
@@ -4326,8 +4604,7 @@
4326
4604
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
4327
4605
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4328
4606
 
4329
- <xsl:attribute name="font-weight">normal</xsl:attribute>
4330
- <xsl:attribute name="color">black</xsl:attribute>
4607
+ <xsl:call-template name="refine_figure_key_style"/>
4331
4608
 
4332
4609
  <xsl:variable name="title-key">
4333
4610
  <xsl:call-template name="getLocalizedString">
@@ -4343,12 +4620,16 @@
4343
4620
  <xsl:if test="$onlyOneComponent = 'false'">
4344
4621
  <fo:block>
4345
4622
 
4623
+ <xsl:call-template name="refine_multicomponent_style"/>
4624
+
4346
4625
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4347
4626
  <xsl:attribute name="margin-top">0</xsl:attribute>
4348
4627
  </xsl:if>
4349
4628
 
4350
4629
  <fo:block>
4351
4630
 
4631
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4632
+
4352
4633
  <xsl:apply-templates select="*[local-name() = 'name']">
4353
4634
  <xsl:with-param name="process">true</xsl:with-param>
4354
4635
  </xsl:apply-templates>
@@ -4506,6 +4787,27 @@
4506
4787
 
4507
4788
  </xsl:template> <!-- END: dl -->
4508
4789
 
4790
+ <xsl:template name="refine_dl_formula_where_style">
4791
+
4792
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4793
+
4794
+ <xsl:template name="refine_figure_key_style">
4795
+
4796
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
4797
+ <xsl:attribute name="color">black</xsl:attribute>
4798
+
4799
+ </xsl:template> <!-- refine_figure_key_style -->
4800
+
4801
+ <xsl:template name="refine_multicomponent_style">
4802
+ <xsl:variable name="parent" select="local-name(..)"/>
4803
+
4804
+ </xsl:template> <!-- refine_multicomponent_style -->
4805
+
4806
+ <xsl:template name="refine_multicomponent_block_style">
4807
+ <xsl:variable name="parent" select="local-name(..)"/>
4808
+
4809
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4810
+
4509
4811
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4510
4812
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4511
4813
 
@@ -4725,6 +5027,8 @@
4725
5027
 
4726
5028
  </xsl:if>
4727
5029
 
5030
+ <xsl:call-template name="refine_dt-cell-style"/>
5031
+
4728
5032
  <fo:block xsl:use-attribute-sets="dt-block-style">
4729
5033
  <xsl:copy-of select="@id"/>
4730
5034
 
@@ -4732,6 +5036,8 @@
4732
5036
  <xsl:attribute name="margin-top">0</xsl:attribute>
4733
5037
  </xsl:if>
4734
5038
 
5039
+ <xsl:call-template name="refine_dt-block-style"/>
5040
+
4735
5041
  <xsl:apply-templates>
4736
5042
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4737
5043
  </xsl:apply-templates>
@@ -4751,6 +5057,8 @@
4751
5057
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4752
5058
  </xsl:if>
4753
5059
 
5060
+ <xsl:call-template name="refine_dd-cell-style"/>
5061
+
4754
5062
  <fo:block>
4755
5063
 
4756
5064
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4796,8 +5104,18 @@
4796
5104
  </xsl:if>
4797
5105
  </xsl:template>
4798
5106
 
4799
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4800
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5107
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5108
+ <xsl:variable name="is_inline_element_after_where">
5109
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5110
+ </xsl:variable>
5111
+ <xsl:choose>
5112
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5113
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5114
+ </xsl:when>
5115
+ <xsl:otherwise>
5116
+ <xsl:apply-templates select="."/>
5117
+ </xsl:otherwise>
5118
+ </xsl:choose>
4801
5119
  </xsl:template>
4802
5120
 
4803
5121
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4891,10 +5209,7 @@
4891
5209
  <xsl:param name="split_keep-within-line"/>
4892
5210
  <fo:inline font-weight="bold">
4893
5211
 
4894
- <xsl:if test="not(parent::*[local-name() = 'termsource'])">
4895
- <xsl:attribute name="font-weight">normal</xsl:attribute>
4896
- <xsl:attribute name="color">black</xsl:attribute>
4897
- </xsl:if>
5212
+ <xsl:call-template name="refine_strong_style"/>
4898
5213
 
4899
5214
  <xsl:apply-templates>
4900
5215
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4902,6 +5217,15 @@
4902
5217
  </fo:inline>
4903
5218
  </xsl:template>
4904
5219
 
5220
+ <xsl:template name="refine_strong_style">
5221
+
5222
+ <xsl:if test="not(parent::*[local-name() = 'termsource'])">
5223
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5224
+ <xsl:attribute name="color">black</xsl:attribute>
5225
+ </xsl:if>
5226
+
5227
+ </xsl:template>
5228
+
4905
5229
  <xsl:template match="*[local-name()='padding']">
4906
5230
  <fo:inline padding-right="{@value}"> </fo:inline>
4907
5231
  </xsl:template>
@@ -5373,7 +5697,10 @@
5373
5697
  </xsl:choose>
5374
5698
  </xsl:variable>
5375
5699
 
5376
- <xsl:value-of select="$text9"/>
5700
+ <!-- replace sequence #x200B and space TO space -->
5701
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5702
+
5703
+ <xsl:value-of select="$text10"/>
5377
5704
  </xsl:template>
5378
5705
 
5379
5706
  <xsl:template name="add-zero-spaces-link-java">
@@ -6048,6 +6375,11 @@
6048
6375
 
6049
6376
  <fo:inline xsl:use-attribute-sets="mathml-style">
6050
6377
 
6378
+ <!-- DEBUG -->
6379
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
6380
+
6381
+ <xsl:call-template name="refine_mathml-style"/>
6382
+
6051
6383
  <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 -->
6052
6384
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
6053
6385
  </xsl:if>
@@ -6152,6 +6484,8 @@
6152
6484
 
6153
6485
  <fo:instream-foreign-object fox:alt-text="Math">
6154
6486
 
6487
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6488
+
6155
6489
  <!-- put MathML in Actual Text -->
6156
6490
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6157
6491
  <xsl:attribute name="fox:actual-text">
@@ -6172,6 +6506,10 @@
6172
6506
  </fo:instream-foreign-object>
6173
6507
  </xsl:template>
6174
6508
 
6509
+ <xsl:template name="refine_mathml_insteam_object_style">
6510
+
6511
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6512
+
6175
6513
  <xsl:template match="mathml:*" mode="mathml_actual_text">
6176
6514
  <!-- <xsl:text>a+b</xsl:text> -->
6177
6515
  <xsl:text>&lt;</xsl:text>
@@ -6235,6 +6573,79 @@
6235
6573
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6236
6574
  </xsl:template>
6237
6575
 
6576
+ <!-- special case for:
6577
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6578
+ <mstyle displaystyle="true">
6579
+ <msup>
6580
+ <mi color="#00000000">C</mi>
6581
+ <mtext>R</mtext>
6582
+ </msup>
6583
+ <msubsup>
6584
+ <mtext>C</mtext>
6585
+ <mi>n</mi>
6586
+ <mi>k</mi>
6587
+ </msubsup>
6588
+ </mstyle>
6589
+ </math>
6590
+ -->
6591
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6592
+ <xsl:copy>
6593
+ <xsl:copy-of select="@*"/>
6594
+ <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"/>
6595
+ <xsl:if test="string-length($next_mtext) != ''">
6596
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6597
+ </xsl:if>
6598
+ <xsl:apply-templates/>
6599
+ <xsl:value-of select="$next_mtext"/>
6600
+ </xsl:copy>
6601
+ </xsl:template>
6602
+
6603
+ <!-- special case for:
6604
+ <msup>
6605
+ <mtext/>
6606
+ <mn>1</mn>
6607
+ </msup>
6608
+ convert to (add mspace after mtext and enclose them into mrow):
6609
+ <msup>
6610
+ <mrow>
6611
+ <mtext/>
6612
+ <mspace height="1.47ex"/>
6613
+ </mrow>
6614
+ <mn>1</mn>
6615
+ </msup>
6616
+ -->
6617
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6618
+ <mathml:mrow>
6619
+ <xsl:copy-of select="."/>
6620
+ <mathml:mspace height="1.47ex"/>
6621
+ </mathml:mrow>
6622
+ </xsl:template>
6623
+
6624
+ <!-- add space around vertical line -->
6625
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6626
+ <xsl:copy>
6627
+ <xsl:apply-templates select="@*" mode="mathml"/>
6628
+ <xsl:if test="not(@lspace)">
6629
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6630
+ </xsl:if>
6631
+ <xsl:if test="not(@rspace)">
6632
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6633
+ </xsl:if>
6634
+ <xsl:apply-templates mode="mathml"/>
6635
+ </xsl:copy>
6636
+ </xsl:template>
6637
+
6638
+ <!-- decrease fontsize for 'Circled Times' char -->
6639
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6640
+ <xsl:copy>
6641
+ <xsl:apply-templates select="@*" mode="mathml"/>
6642
+ <xsl:if test="not(@fontsize)">
6643
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6644
+ </xsl:if>
6645
+ <xsl:apply-templates mode="mathml"/>
6646
+ </xsl:copy>
6647
+ </xsl:template>
6648
+
6238
6649
  <!-- Examples:
6239
6650
  <stem type="AsciiMath">x = 1</stem>
6240
6651
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -6243,6 +6654,8 @@
6243
6654
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6244
6655
  <fo:inline xsl:use-attribute-sets="mathml-style">
6245
6656
 
6657
+ <xsl:call-template name="refine_mathml-style"/>
6658
+
6246
6659
  <xsl:choose>
6247
6660
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6248
6661
  <xsl:otherwise>
@@ -6287,30 +6700,30 @@
6287
6700
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6288
6701
  </xsl:if>
6289
6702
 
6290
- <xsl:if test="ancestor::*[local-name() = 'bibitem']">
6291
- <xsl:attribute name="color">black</xsl:attribute>
6292
- <xsl:attribute name="text-decoration">none</xsl:attribute>
6293
- <xsl:attribute name="font-weight">300</xsl:attribute>
6294
- </xsl:if>
6703
+ <xsl:call-template name="refine_link-style"/>
6295
6704
 
6296
6705
  <xsl:choose>
6297
6706
  <xsl:when test="$target_text = ''">
6298
6707
  <xsl:apply-templates/>
6299
6708
  </xsl:when>
6300
6709
  <xsl:otherwise>
6301
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6302
- <xsl:choose>
6303
- <xsl:when test="normalize-space(.) = ''">
6304
- <xsl:call-template name="add-zero-spaces-link-java">
6305
- <xsl:with-param name="text" select="$target_text"/>
6306
- </xsl:call-template>
6307
- </xsl:when>
6308
- <xsl:otherwise>
6309
- <!-- output text from <link>text</link> -->
6310
- <xsl:apply-templates/>
6311
- </xsl:otherwise>
6312
- </xsl:choose>
6313
- </fo:basic-link>
6710
+ <xsl:call-template name="insert_basic_link">
6711
+ <xsl:with-param name="element">
6712
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6713
+ <xsl:choose>
6714
+ <xsl:when test="normalize-space(.) = ''">
6715
+ <xsl:call-template name="add-zero-spaces-link-java">
6716
+ <xsl:with-param name="text" select="$target_text"/>
6717
+ </xsl:call-template>
6718
+ </xsl:when>
6719
+ <xsl:otherwise>
6720
+ <!-- output text from <link>text</link> -->
6721
+ <xsl:apply-templates/>
6722
+ </xsl:otherwise>
6723
+ </xsl:choose>
6724
+ </fo:basic-link>
6725
+ </xsl:with-param>
6726
+ </xsl:call-template>
6314
6727
  </xsl:otherwise>
6315
6728
  </xsl:choose>
6316
6729
  </fo:inline>
@@ -6373,12 +6786,19 @@
6373
6786
  </xsl:template>
6374
6787
 
6375
6788
  <xsl:template match="*[local-name() = 'xref']">
6376
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6377
- <xsl:if test="parent::*[local-name() = 'add']">
6378
- <xsl:call-template name="append_add-style"/>
6379
- </xsl:if>
6380
- <xsl:apply-templates/>
6381
- </fo:basic-link>
6789
+ <xsl:call-template name="insert_basic_link">
6790
+ <xsl:with-param name="element">
6791
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6792
+ <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'])">
6793
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6794
+ </xsl:if>
6795
+ <xsl:if test="parent::*[local-name() = 'add']">
6796
+ <xsl:call-template name="append_add-style"/>
6797
+ </xsl:if>
6798
+ <xsl:apply-templates/>
6799
+ </fo:basic-link>
6800
+ </xsl:with-param>
6801
+ </xsl:call-template>
6382
6802
  </xsl:template>
6383
6803
 
6384
6804
  <!-- ====== -->
@@ -6433,6 +6853,8 @@
6433
6853
  <fo:table-cell display-align="center">
6434
6854
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6435
6855
 
6856
+ <xsl:call-template name="refine_formula-stem-block-style"/>
6857
+
6436
6858
  <xsl:apply-templates/>
6437
6859
  </fo:block>
6438
6860
  </fo:table-cell>
@@ -6474,17 +6896,18 @@
6474
6896
 
6475
6897
  <xsl:call-template name="setBlockSpanAll"/>
6476
6898
 
6477
- <xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol and not(ancestor::rsd:note[1]/following-sibling::*)">
6478
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
6479
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
6480
- </xsl:if>
6899
+ <xsl:call-template name="refine_note-style"/>
6481
6900
 
6482
6901
  <fo:block-container margin-left="0mm" margin-right="0mm">
6483
6902
 
6484
6903
  <fo:block>
6485
6904
 
6905
+ <xsl:call-template name="refine_note_block_style"/>
6906
+
6486
6907
  <fo:inline xsl:use-attribute-sets="note-name-style">
6487
6908
 
6909
+ <xsl:call-template name="refine_note-name-style"/>
6910
+
6488
6911
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6489
6912
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6490
6913
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6510,6 +6933,10 @@
6510
6933
 
6511
6934
  </xsl:template>
6512
6935
 
6936
+ <xsl:template name="refine_note_block_style">
6937
+
6938
+ </xsl:template>
6939
+
6513
6940
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6514
6941
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6515
6942
  <xsl:choose>
@@ -6531,12 +6958,16 @@
6531
6958
 
6532
6959
  <xsl:call-template name="setBlockSpanAll"/>
6533
6960
 
6961
+ <xsl:call-template name="refine_termnote-style"/>
6962
+
6534
6963
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6535
6964
 
6536
6965
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6537
6966
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6538
6967
  </xsl:if>
6539
6968
 
6969
+ <xsl:call-template name="refine_termnote-name-style"/>
6970
+
6540
6971
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6541
6972
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6542
6973
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6711,6 +7142,8 @@
6711
7142
  <xsl:otherwise>
6712
7143
  <fo:block xsl:use-attribute-sets="image-style">
6713
7144
 
7145
+ <xsl:call-template name="refine_image-style"/>
7146
+
6714
7147
  <xsl:variable name="src">
6715
7148
  <xsl:call-template name="image_src"/>
6716
7149
  </xsl:variable>
@@ -6769,7 +7202,7 @@
6769
7202
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6770
7203
  </xsl:when>
6771
7204
  <xsl:when test="not(starts-with(@src, 'data:'))">
6772
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7205
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6773
7206
  </xsl:when>
6774
7207
  <xsl:otherwise>
6775
7208
  <xsl:value-of select="@src"/>
@@ -6791,7 +7224,7 @@
6791
7224
  </xsl:when>
6792
7225
  <xsl:when test="not(starts-with(@src, 'data:'))">
6793
7226
  <xsl:variable name="src">
6794
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7227
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6795
7228
  </xsl:variable>
6796
7229
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6797
7230
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -7177,15 +7610,19 @@
7177
7610
  <xsl:param name="dest"/>
7178
7611
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
7179
7612
  <fo:block font-size="1pt">
7180
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7181
- <fo:inline-container inline-progression-dimension="100%">
7182
- <fo:block-container height="{$height - 1}px" width="100%">
7183
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
7184
- <xsl:attribute name="background-color">magenta</xsl:attribute>
7185
- </xsl:if> -->
7186
- <fo:block> </fo:block></fo:block-container>
7187
- </fo:inline-container>
7188
- </fo:basic-link>
7613
+ <xsl:call-template name="insert_basic_link">
7614
+ <xsl:with-param name="element">
7615
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7616
+ <fo:inline-container inline-progression-dimension="100%">
7617
+ <fo:block-container height="{$height - 1}px" width="100%">
7618
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7619
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7620
+ </xsl:if> -->
7621
+ <fo:block> </fo:block></fo:block-container>
7622
+ </fo:inline-container>
7623
+ </fo:basic-link>
7624
+ </xsl:with-param>
7625
+ </xsl:call-template>
7189
7626
  </fo:block>
7190
7627
  </fo:block-container>
7191
7628
  </xsl:template>
@@ -7556,6 +7993,8 @@
7556
7993
  <xsl:if test="normalize-space() != ''">
7557
7994
  <fo:block xsl:use-attribute-sets="figure-name-style">
7558
7995
 
7996
+ <xsl:call-template name="refine_figure-name-style"/>
7997
+
7559
7998
  <xsl:apply-templates/>
7560
7999
  </fo:block>
7561
8000
  </xsl:if>
@@ -7826,19 +8265,7 @@
7826
8265
  </xsl:attribute>
7827
8266
  </xsl:for-each>
7828
8267
 
7829
- <!-- background for image -->
7830
- <xsl:if test="starts-with(*[local-name() = 'name']/text()[1], 'Figure ')">
7831
- <xsl:attribute name="background-color">rgb(236,242,246)</xsl:attribute>
7832
- <xsl:attribute name="padding-left">11mm</xsl:attribute>
7833
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
7834
- <xsl:attribute name="padding-right">11mm</xsl:attribute>
7835
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
7836
- <xsl:attribute name="padding-top">7.5mm</xsl:attribute>
7837
- <xsl:attribute name="padding-bottom">7.5mm</xsl:attribute>
7838
- <xsl:if test="following-sibling::*[1][local-name() = 'sourcecode'] and starts-with(*[local-name() = 'name']/text()[1], 'Figure ')">
7839
- <xsl:attribute name="margin-bottom">16pt</xsl:attribute>
7840
- </xsl:if>
7841
- </xsl:if>
8268
+ <xsl:call-template name="refine_sourcecode-style"/>
7842
8269
 
7843
8270
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7844
8271
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
@@ -8542,10 +8969,7 @@
8542
8969
 
8543
8970
  <xsl:call-template name="setBlockSpanAll"/>
8544
8971
 
8545
- <xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol">
8546
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
8547
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
8548
- </xsl:if>
8972
+ <xsl:call-template name="refine_example-style"/>
8549
8973
 
8550
8974
  <xsl:variable name="fo_element">
8551
8975
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
@@ -8679,6 +9103,8 @@
8679
9103
  </xsl:if>
8680
9104
  <fo:block xsl:use-attribute-sets="example-p-style">
8681
9105
 
9106
+ <xsl:call-template name="refine_example-p-style"/>
9107
+
8682
9108
  <xsl:apply-templates/>
8683
9109
  </fo:block>
8684
9110
  </fo:block-container>
@@ -8695,6 +9121,7 @@
8695
9121
  </xsl:otherwise>
8696
9122
  </xsl:choose>
8697
9123
  </xsl:template> <!-- example/p -->
9124
+
8698
9125
  <!-- ====== -->
8699
9126
  <!-- ====== -->
8700
9127
 
@@ -8706,6 +9133,8 @@
8706
9133
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8707
9134
  <fo:block xsl:use-attribute-sets="termsource-style">
8708
9135
 
9136
+ <xsl:call-template name="refine_termsource-style"/>
9137
+
8709
9138
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8710
9139
  <xsl:variable name="termsource_text">
8711
9140
  <xsl:apply-templates/>
@@ -8758,14 +9187,18 @@
8758
9187
  </xsl:template>
8759
9188
 
8760
9189
  <xsl:template match="*[local-name() = 'origin']">
8761
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8762
- <xsl:if test="normalize-space(@citeas) = ''">
8763
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8764
- </xsl:if>
8765
- <fo:inline xsl:use-attribute-sets="origin-style">
8766
- <xsl:apply-templates/>
8767
- </fo:inline>
8768
- </fo:basic-link>
9190
+ <xsl:call-template name="insert_basic_link">
9191
+ <xsl:with-param name="element">
9192
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9193
+ <xsl:if test="normalize-space(@citeas) = ''">
9194
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9195
+ </xsl:if>
9196
+ <fo:inline xsl:use-attribute-sets="origin-style">
9197
+ <xsl:apply-templates/>
9198
+ </fo:inline>
9199
+ </fo:basic-link>
9200
+ </xsl:with-param>
9201
+ </xsl:call-template>
8769
9202
  </xsl:template>
8770
9203
 
8771
9204
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8817,6 +9250,8 @@
8817
9250
  <fo:block-container margin-left="0mm">
8818
9251
  <fo:block-container xsl:use-attribute-sets="quote-style">
8819
9252
 
9253
+ <xsl:call-template name="refine_quote-style"/>
9254
+
8820
9255
  <fo:block-container margin-left="0mm" margin-right="0mm">
8821
9256
  <fo:block role="BlockQuote">
8822
9257
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8839,9 +9274,13 @@
8839
9274
  <xsl:if test="../*[local-name() = 'author']">
8840
9275
  <xsl:text>, </xsl:text>
8841
9276
  </xsl:if>
8842
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8843
- <xsl:apply-templates/>
8844
- </fo:basic-link>
9277
+ <xsl:call-template name="insert_basic_link">
9278
+ <xsl:with-param name="element">
9279
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9280
+ <xsl:apply-templates/>
9281
+ </fo:basic-link>
9282
+ </xsl:with-param>
9283
+ </xsl:call-template>
8845
9284
  </xsl:template>
8846
9285
 
8847
9286
  <xsl:template match="*[local-name() = 'author']">
@@ -8887,28 +9326,33 @@
8887
9326
 
8888
9327
  </xsl:if>
8889
9328
 
8890
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8891
- <xsl:variable name="text" select="normalize-space()"/>
9329
+ <xsl:call-template name="refine_eref-style"/>
8892
9330
 
8893
- <fo:basic-link fox:alt-text="{@citeas}">
8894
- <xsl:if test="normalize-space(@citeas) = ''">
8895
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8896
- </xsl:if>
8897
- <xsl:if test="@type = 'inline'">
9331
+ <xsl:call-template name="insert_basic_link">
9332
+ <xsl:with-param name="element">
9333
+ <fo:basic-link fox:alt-text="{@citeas}">
9334
+ <xsl:if test="normalize-space(@citeas) = ''">
9335
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9336
+ </xsl:if>
9337
+ <xsl:if test="@type = 'inline'">
8898
9338
 
8899
- </xsl:if>
9339
+ <xsl:call-template name="refine_basic_link_style"/>
8900
9340
 
8901
- <xsl:choose>
8902
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8903
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8904
- </xsl:when>
8905
- <xsl:otherwise>
8906
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8907
- </xsl:otherwise>
8908
- </xsl:choose>
9341
+ </xsl:if>
8909
9342
 
8910
- <xsl:apply-templates/>
8911
- </fo:basic-link>
9343
+ <xsl:choose>
9344
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9345
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9346
+ </xsl:when>
9347
+ <xsl:otherwise>
9348
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9349
+ </xsl:otherwise>
9350
+ </xsl:choose>
9351
+
9352
+ <xsl:apply-templates/>
9353
+ </fo:basic-link>
9354
+ </xsl:with-param>
9355
+ </xsl:call-template>
8912
9356
 
8913
9357
  </fo:inline>
8914
9358
  </xsl:when>
@@ -8926,6 +9370,11 @@
8926
9370
  </xsl:otherwise>
8927
9371
  </xsl:choose>
8928
9372
  </xsl:template>
9373
+
9374
+ <xsl:template name="refine_basic_link_style">
9375
+
9376
+ </xsl:template> <!-- refine_basic_link_style -->
9377
+
8929
9378
  <!-- ====== -->
8930
9379
  <!-- END eref -->
8931
9380
  <!-- ====== -->
@@ -9066,16 +9515,22 @@
9066
9515
  <fo:block>
9067
9516
  <xsl:call-template name="setId"/>
9068
9517
 
9069
- <xsl:variable name="pos"><xsl:number count="rsd:sections/rsd:clause[not(@type='scope') and not(@type='conformance')]"/></xsl:variable> <!-- | rsd:sections/rsd:terms -->
9070
- <xsl:if test="$pos &gt;= 2">
9071
- <xsl:attribute name="space-before">18pt</xsl:attribute>
9072
- </xsl:if>
9518
+ <xsl:call-template name="sections_element_style"/>
9073
9519
 
9074
9520
  <xsl:apply-templates/>
9075
9521
  </fo:block>
9076
9522
 
9077
9523
  </xsl:template>
9078
9524
 
9525
+ <xsl:template name="sections_element_style">
9526
+
9527
+ <xsl:variable name="pos"><xsl:number count="ribose:sections/ribose:clause[not(@type='scope') and not(@type='conformance')]"/></xsl:variable> <!-- | ribose:sections/ribose:terms -->
9528
+ <xsl:if test="$pos &gt;= 2">
9529
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
9530
+ </xsl:if>
9531
+
9532
+ </xsl:template> <!-- sections_element_style -->
9533
+
9079
9534
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9080
9535
  <fo:block break-after="page"/>
9081
9536
  <fo:block>
@@ -9090,10 +9545,16 @@
9090
9545
 
9091
9546
  <xsl:call-template name="setBlockSpanAll"/>
9092
9547
 
9548
+ <xsl:call-template name="refine_clause_style"/>
9549
+
9093
9550
  <xsl:apply-templates/>
9094
9551
  </fo:block>
9095
9552
  </xsl:template>
9096
9553
 
9554
+ <xsl:template name="refine_clause_style">
9555
+
9556
+ </xsl:template> <!-- refine_clause_style -->
9557
+
9097
9558
  <xsl:template match="*[local-name() = 'definitions']">
9098
9559
  <fo:block id="{@id}">
9099
9560
  <xsl:apply-templates/>
@@ -9106,10 +9567,16 @@
9106
9567
 
9107
9568
  <xsl:call-template name="setBlockSpanAll"/>
9108
9569
 
9570
+ <xsl:call-template name="refine_annex_style"/>
9571
+
9109
9572
  </fo:block>
9110
9573
  <xsl:apply-templates/>
9111
9574
  </xsl:template>
9112
9575
 
9576
+ <xsl:template name="refine_annex_style">
9577
+
9578
+ </xsl:template>
9579
+
9113
9580
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
9114
9581
  <!-- comment 2019-11-29 -->
9115
9582
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -9148,7 +9615,10 @@
9148
9615
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
9149
9616
 
9150
9617
  <xsl:template name="setULLabel">
9151
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9618
+ <xsl:variable name="list_level__">
9619
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9620
+ </xsl:variable>
9621
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
9152
9622
  <xsl:variable name="list_level">
9153
9623
  <xsl:choose>
9154
9624
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -9273,6 +9743,8 @@
9273
9743
  </xsl:choose>
9274
9744
  </xsl:attribute>
9275
9745
 
9746
+ <xsl:call-template name="refine_list_container_style"/>
9747
+
9276
9748
  <fo:block-container margin-left="0mm">
9277
9749
  <fo:block>
9278
9750
  <xsl:apply-templates select="." mode="list"/>
@@ -9281,13 +9753,19 @@
9281
9753
  </fo:block-container>
9282
9754
  </xsl:when>
9283
9755
  <xsl:otherwise>
9284
- <fo:block>
9285
- <xsl:apply-templates select="." mode="list"/>
9286
- </fo:block>
9756
+
9757
+ <fo:block>
9758
+ <xsl:apply-templates select="." mode="list"/>
9759
+ </fo:block>
9760
+
9287
9761
  </xsl:otherwise>
9288
9762
  </xsl:choose>
9289
9763
  </xsl:template>
9290
9764
 
9765
+ <xsl:template name="refine_list_container_style">
9766
+
9767
+ </xsl:template> <!-- refine_list_container_style -->
9768
+
9291
9769
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9292
9770
 
9293
9771
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -9298,7 +9776,7 @@
9298
9776
 
9299
9777
  <xsl:variable name="provisional_distance_between_starts_">
9300
9778
  <attributes xsl:use-attribute-sets="list-style">
9301
-
9779
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
9302
9780
  </attributes>
9303
9781
  </xsl:variable>
9304
9782
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -9334,6 +9812,8 @@
9334
9812
  <addon><xsl:value-of select="$addon"/></addon> -->
9335
9813
  </xsl:if>
9336
9814
 
9815
+ <xsl:call-template name="refine_list-style"/>
9816
+
9337
9817
  <xsl:if test="*[local-name() = 'name']">
9338
9818
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9339
9819
  </xsl:if>
@@ -9346,6 +9826,10 @@
9346
9826
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
9347
9827
  </xsl:template>
9348
9828
 
9829
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9830
+
9831
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9832
+
9349
9833
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
9350
9834
  <xsl:param name="process">false</xsl:param>
9351
9835
  <xsl:if test="$process = 'true'">
@@ -9359,20 +9843,27 @@
9359
9843
  <fo:list-item xsl:use-attribute-sets="list-item-style">
9360
9844
  <xsl:copy-of select="@id"/>
9361
9845
 
9846
+ <xsl:call-template name="refine_list-item-style"/>
9847
+
9362
9848
  <fo:list-item-label end-indent="label-end()">
9363
9849
  <fo:block xsl:use-attribute-sets="list-item-label-style">
9364
9850
 
9851
+ <xsl:call-template name="refine_list-item-label-style"/>
9852
+
9365
9853
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9366
9854
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
9367
9855
  <xsl:call-template name="append_add-style"/>
9368
9856
  </xsl:if>
9369
9857
 
9370
9858
  <xsl:call-template name="getListItemFormat"/>
9859
+
9371
9860
  </fo:block>
9372
9861
  </fo:list-item-label>
9373
9862
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9374
9863
  <fo:block>
9375
9864
 
9865
+ <xsl:call-template name="refine_list-item-body-style"/>
9866
+
9376
9867
  <xsl:apply-templates/>
9377
9868
 
9378
9869
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9690,6 +10181,7 @@
9690
10181
 
9691
10182
  <fo:block id="{@id}">
9692
10183
  <xsl:apply-templates/>
10184
+
9693
10185
  </fo:block>
9694
10186
  </xsl:template>
9695
10187
 
@@ -9709,6 +10201,7 @@
9709
10201
 
9710
10202
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9711
10203
  <xsl:apply-templates/>
10204
+
9712
10205
  </fo:block>
9713
10206
 
9714
10207
  </xsl:template> <!-- references -->
@@ -9743,7 +10236,7 @@
9743
10236
  <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9744
10237
  <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
9745
10238
  </xsl:apply-templates>
9746
- <xsl:apply-templates select="rsd:formattedref"/>
10239
+ <xsl:apply-templates select="ribose:formattedref"/>
9747
10240
  </fo:block>
9748
10241
  </fo:list-item-body>
9749
10242
  </fo:list-item>
@@ -9963,24 +10456,32 @@
9963
10456
  <xsl:for-each select="*[local-name() = 'tab']">
9964
10457
  <xsl:variable name="current_id" select="generate-id()"/>
9965
10458
  <fo:table-cell>
9966
- <fo:block>
9967
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9968
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9969
- <xsl:choose>
9970
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9971
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9972
- </xsl:choose>
9973
- </xsl:for-each>
9974
- </fo:basic-link>
10459
+ <fo:block line-height-shift-adjustment="disregard-shifts">
10460
+ <xsl:call-template name="insert_basic_link">
10461
+ <xsl:with-param name="element">
10462
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10463
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10464
+ <xsl:choose>
10465
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10466
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10467
+ </xsl:choose>
10468
+ </xsl:for-each>
10469
+ </fo:basic-link>
10470
+ </xsl:with-param>
10471
+ </xsl:call-template>
9975
10472
  </fo:block>
9976
10473
  </fo:table-cell>
9977
10474
  </xsl:for-each>
9978
10475
  <!-- last column - for page numbers -->
9979
10476
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9980
10477
  <fo:block>
9981
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9982
- <fo:page-number-citation ref-id="{$target}"/>
9983
- </fo:basic-link>
10478
+ <xsl:call-template name="insert_basic_link">
10479
+ <xsl:with-param name="element">
10480
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10481
+ <fo:page-number-citation ref-id="{$target}"/>
10482
+ </fo:basic-link>
10483
+ </xsl:with-param>
10484
+ </xsl:call-template>
9984
10485
  </fo:block>
9985
10486
  </fo:table-cell>
9986
10487
  </xsl:template>
@@ -10022,6 +10523,27 @@
10022
10523
  <!-- End Table of Contents (ToC) processing -->
10023
10524
  <!-- =================== -->
10024
10525
 
10526
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10527
+ <xsl:template name="insert_basic_link">
10528
+ <xsl:param name="element"/>
10529
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10530
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10531
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10532
+ <xsl:choose>
10533
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10534
+ <xsl:copy-of select="$element_node"/>
10535
+ </xsl:when>
10536
+ <xsl:otherwise>
10537
+ <fo:inline>
10538
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10539
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10540
+ </xsl:for-each>
10541
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10542
+ </fo:inline>
10543
+ </xsl:otherwise>
10544
+ </xsl:choose>
10545
+ </xsl:template>
10546
+
10025
10547
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10026
10548
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10027
10549
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -10254,6 +10776,9 @@
10254
10776
  </xsl:copy>
10255
10777
  </xsl:template>
10256
10778
 
10779
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10780
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10781
+
10257
10782
  <xsl:template name="add_id">
10258
10783
  <xsl:if test="not(@id)">
10259
10784
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10538,6 +11063,14 @@
10538
11063
  <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">
10539
11064
  <xsl:variable name="p_fn_">
10540
11065
  <xsl:call-template name="get_fn_list"/>
11066
+ <!-- <xsl:choose>
11067
+ <xsl:when test="$namespace = 'jis'">
11068
+ <xsl:call-template name="get_fn_list_for_element"/>
11069
+ </xsl:when>
11070
+ <xsl:otherwise>
11071
+ <xsl:call-template name="get_fn_list"/>
11072
+ </xsl:otherwise>
11073
+ </xsl:choose> -->
10541
11074
  </xsl:variable>
10542
11075
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10543
11076
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10552,8 +11085,14 @@
10552
11085
  <xsl:attribute name="current_fn_number">
10553
11086
  <xsl:value-of select="$current_fn_number"/>
10554
11087
  </xsl:attribute>
11088
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10555
11089
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10556
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11090
+
11091
+ <xsl:value-of select="$skip_footnote_body_"/>
11092
+
11093
+ </xsl:attribute>
11094
+ <xsl:attribute name="ref_id">
11095
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
10557
11096
  </xsl:attribute>
10558
11097
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10559
11098
  </xsl:copy>
@@ -10942,7 +11481,7 @@
10942
11481
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
10943
11482
  <xsl:variable name="XSLNS">
10944
11483
 
10945
- <xsl:value-of select="document('')//*/namespace::rsd"/>
11484
+ <xsl:value-of select="document('')//*/namespace::ribose"/>
10946
11485
 
10947
11486
  </xsl:variable>
10948
11487
  <xsl:if test="$documentNS != $XSLNS">