metanorma-un 0.8.2 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,25 +2,15 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:param name="svg_images"/>
6
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
- <xsl:variable name="images" select="document($svg_images)"/>
8
- <xsl:param name="basepath"/>
9
-
10
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
6
 
12
7
 
13
8
 
14
9
 
15
10
 
16
- <xsl:variable name="marginLeftRight1" select="40"/>
17
- <xsl:variable name="marginLeftRight2" select="40"/>
18
- <xsl:variable name="marginTop" select="30"/>
19
- <xsl:variable name="marginBottom" select="40"/>
20
-
21
11
  <xsl:variable name="debug">false</xsl:variable>
22
12
 
23
- <xsl:variable name="contents">
13
+ <xsl:variable name="contents_">
24
14
  <contents>
25
15
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
26
16
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -30,12 +20,11 @@
30
20
  <xsl:apply-templates select="/un:un-standard/un:sections/*" mode="contents"/>
31
21
  <xsl:apply-templates select="/un:un-standard/un:annex" mode="contents"/>
32
22
  <xsl:apply-templates select="/un:un-standard/un:bibliography/un:references" mode="contents"/>
23
+
24
+ <xsl:call-template name="processTablesFigures_Contents"/>
33
25
  </contents>
34
26
  </xsl:variable>
35
-
36
- <xsl:variable name="lang">
37
- <xsl:call-template name="getLang"/>
38
- </xsl:variable>
27
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
39
28
 
40
29
  <xsl:variable name="title" select="/un:un-standard/un:bibdata/un:title[@language = 'en' and @type = 'main']"/>
41
30
 
@@ -289,7 +278,7 @@
289
278
  <xsl:if test="$debug = 'true'">
290
279
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
291
280
  DEBUG
292
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
281
+ contents=<xsl:copy-of select="$contents"/>
293
282
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
294
283
  </xsl:if>
295
284
 
@@ -436,15 +425,6 @@
436
425
  <xsl:otherwise>left</xsl:otherwise>
437
426
  </xsl:choose>
438
427
  </xsl:attribute>
439
- <!-- <xsl:choose>
440
- <xsl:when test="ancestor::un:sections">
441
- <fo:inline padding-right="10mm"><xsl:number format="1. " level="any" count="un:sections//un:clause/un:p"/></fo:inline>
442
- </xsl:when>
443
- <xsl:when test="ancestor::un:annex">
444
- <xsl:variable name="annex_id" select="ancestor::un:annex/@id"/>
445
- <fo:inline padding-right="10mm"><xsl:number format="1. " level="any" count="un:annex[@id = $annex_id]//un:clause/un:p"/></fo:inline>
446
- </xsl:when>
447
- </xsl:choose> -->
448
428
  <xsl:apply-templates/>
449
429
  </fo:block>
450
430
  </xsl:template>
@@ -494,56 +474,19 @@
494
474
  </fo:block>
495
475
  </xsl:template>
496
476
 
497
- <xsl:template match="un:p" name="paragraph"> <!-- priority="3" [not(parent::un:note)]-->
498
-
499
- <fo:block margin-bottom="6pt" line-height="122%">
500
- <xsl:if test="following-sibling::*">
501
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
502
- </xsl:if>
503
- <xsl:attribute name="text-align">
504
- <xsl:choose>
505
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
506
- <xsl:otherwise>justify</xsl:otherwise>
507
- </xsl:choose>
508
- </xsl:attribute>
509
- <xsl:apply-templates/>
510
- </fo:block>
511
-
512
- </xsl:template>
513
-
514
- <xsl:template match="un:p2">
515
- <fo:block-container margin-left="1mm">
516
- <fo:block margin-left="-1mm">
517
- <fo:list-block provisional-distance-between-starts="9mm" margin-bottom="6pt" line-height="122%">
518
- <xsl:attribute name="text-align">
519
- <xsl:choose>
520
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
521
- <xsl:otherwise>justify</xsl:otherwise>
522
- </xsl:choose>
523
- </xsl:attribute>
524
- <fo:list-item>
525
- <fo:list-item-label end-indent="label-end()">
526
- <fo:block>
527
- <xsl:choose>
528
- <xsl:when test="ancestor::un:sections">
529
- <xsl:number format="1. " level="any" count="un:sections//un:clause/un:p"/>
530
- </xsl:when>
531
- <xsl:when test="ancestor::un:annex">
532
- <xsl:variable name="annex_id" select="ancestor::un:annex/@id"/>
533
- <xsl:number format="1. " level="any" count="un:annex[@id = $annex_id]//un:p"/> <!-- //un:clause -->
534
- </xsl:when>
535
- </xsl:choose>
536
- </fo:block>
537
- </fo:list-item-label>
538
- <fo:list-item-body text-indent="body-start()">
539
- <fo:block>
540
- <xsl:text> </xsl:text><xsl:apply-templates/>
541
- </fo:block>
542
- </fo:list-item-body>
543
- </fo:list-item>
544
- </fo:list-block>
545
- </fo:block>
546
- </fo:block-container>
477
+ <xsl:template match="un:p" name="paragraph">
478
+ <fo:block margin-bottom="6pt" line-height="122%">
479
+ <xsl:if test="following-sibling::*">
480
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
481
+ </xsl:if>
482
+ <xsl:attribute name="text-align">
483
+ <xsl:choose>
484
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
485
+ <xsl:otherwise>justify</xsl:otherwise>
486
+ </xsl:choose>
487
+ </xsl:attribute>
488
+ <xsl:apply-templates/>
489
+ </fo:block>
547
490
  </xsl:template>
548
491
 
549
492
 
@@ -553,65 +496,13 @@
553
496
  </fo:block>
554
497
  </xsl:template>
555
498
 
556
- <xsl:template match="un:ul | un:ol" mode="ul_ol">
499
+ <xsl:template match="un:ul | un:ol" mode="list" priority="2">
557
500
  <fo:block-container margin-left="8mm" text-indent="0mm">
558
- <fo:list-block provisional-distance-between-starts="4mm" margin-left="-8mm">
559
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
560
- </fo:list-block>
561
- <xsl:apply-templates select="./un:note"/>
501
+ <xsl:call-template name="list"/>
562
502
  </fo:block-container>
563
503
  </xsl:template>
564
504
 
565
505
 
566
- <xsl:template match="un:li">
567
- <xsl:variable name="level">
568
- <xsl:call-template name="getLevel"/>
569
- </xsl:variable>
570
- <fo:list-item>
571
- <fo:list-item-label end-indent="label-end()">
572
- <fo:block>
573
- <xsl:choose>
574
- <xsl:when test="local-name(..) = 'ul'">
575
- <xsl:call-template name="setULLabel"/>
576
- </xsl:when>
577
- <xsl:otherwise> <!-- for ordered lists -->
578
- <xsl:choose>
579
- <xsl:when test="../@type = 'arabic'">
580
- <xsl:number format="1."/>
581
- </xsl:when>
582
- <xsl:when test="../@type = 'alphabet'">
583
- <xsl:number format="1)"/>
584
- </xsl:when>
585
- <xsl:when test="ancestor::*[un:annex]">
586
- <xsl:choose>
587
- <xsl:when test="$level = 1">
588
- <xsl:number format="a)" lang="en"/>
589
- </xsl:when>
590
- <xsl:when test="$level = 2">
591
- <xsl:number format="i)"/>
592
- </xsl:when>
593
- <xsl:otherwise>
594
- <xsl:number format="1.)"/>
595
- </xsl:otherwise>
596
- </xsl:choose>
597
- </xsl:when>
598
- <xsl:otherwise>
599
- <xsl:number format="1."/>
600
- </xsl:otherwise>
601
- </xsl:choose>
602
- </xsl:otherwise>
603
- </xsl:choose>
604
- </fo:block>
605
- </fo:list-item-label>
606
- <fo:list-item-body start-indent="body-start()">
607
- <fo:block>
608
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
609
- <xsl:apply-templates select="./un:note"/>
610
- </fo:block>
611
- </fo:list-item-body>
612
- </fo:list-item>
613
- </xsl:template>
614
-
615
506
  <xsl:template match="un:li//un:p">
616
507
  <fo:block margin-bottom="6pt" line-height="122%" text-align="justify">
617
508
  <xsl:apply-templates/>
@@ -861,49 +752,6 @@
861
752
  <xsl:template match="un:docidentifier"/>
862
753
 
863
754
 
864
- <xsl:template match="un:formula" name="formula-un" priority="2">
865
- <fo:block-container margin-left="0mm">
866
- <xsl:if test="parent::*[local-name() = 'note']">
867
- <xsl:attribute name="margin-left">
868
- <xsl:choose>
869
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
870
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
871
- </xsl:choose>
872
- </xsl:attribute>
873
- </xsl:if>
874
- <fo:block-container margin-left="0mm">
875
-
876
- <fo:block id="{@id}" margin-top="6pt">
877
- <fo:table table-layout="fixed" width="100%">
878
- <fo:table-column column-width="95%"/>
879
- <fo:table-column column-width="5%"/>
880
- <fo:table-body>
881
- <fo:table-row>
882
- <fo:table-cell>
883
- <fo:block text-align="center">
884
- <xsl:if test="ancestor::un:annex">
885
- <xsl:attribute name="text-align">left</xsl:attribute>
886
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
887
- </xsl:if>
888
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
889
- </fo:block>
890
- </fo:table-cell>
891
- <fo:table-cell> <!-- display-align="center" -->
892
- <fo:block text-align="right">
893
- <xsl:apply-templates select="un:name"/>
894
- </fo:block>
895
- </fo:table-cell>
896
- </fo:table-row>
897
- </fo:table-body>
898
- </fo:table>
899
- </fo:block>
900
-
901
- </fo:block-container>
902
- </fo:block-container>
903
- </xsl:template>
904
-
905
-
906
-
907
755
 
908
756
  <xsl:template match="un:dl" priority="2">
909
757
  <fo:block-container margin-left="0mm">
@@ -979,11 +827,21 @@
979
827
  <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG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ETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO8nXeWcqW3QOHeLyryF/Q4L3BoEhzW+fOO0A12vewbTZxj6/yWeCqz4J31WY1ny3/F6UYkeY68LIzhtsxa8myZailU1K6HlxN/x9kjcPp+HcBBgAS2JZd+kqHSQAAAABJRU5ErkJggg==</xsl:text>
980
828
  </xsl:variable>
981
829
 
982
- <xsl:variable name="pageWidth_">
830
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
831
+ <xsl:call-template name="getLang"/>
832
+ </xsl:variable><xsl:variable name="pageWidth_">
983
833
  210
984
834
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
985
835
  297
986
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
836
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
837
+ 40
838
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
839
+ 40
840
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
841
+ 30
842
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
843
+ 40
844
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
987
845
 
988
846
  <title-edition lang="en">
989
847
 
@@ -995,6 +853,10 @@
995
853
  <xsl:text>Édition </xsl:text>
996
854
  </title-edition>
997
855
 
856
+ <title-edition lang="ru">
857
+ <xsl:text>Издание </xsl:text>
858
+ </title-edition>
859
+
998
860
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
999
861
  <title-toc lang="en">
1000
862
 
@@ -1009,7 +871,7 @@
1009
871
  <xsl:text>Contents</xsl:text>
1010
872
 
1011
873
  </title-toc>
1012
-
874
+
1013
875
  <title-descriptors lang="en">Descriptors</title-descriptors>
1014
876
 
1015
877
  <title-part lang="en">
@@ -1021,7 +883,11 @@
1021
883
 
1022
884
 
1023
885
 
1024
- </title-part>
886
+ </title-part>
887
+ <title-part lang="ru">
888
+
889
+
890
+ </title-part>
1025
891
  <title-part lang="zh">第 # 部分:</title-part>
1026
892
 
1027
893
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1037,13 +903,38 @@
1037
903
 
1038
904
  <title-summary lang="en">Summary</title-summary>
1039
905
 
906
+ <title-continued lang="ru">(продолжение)</title-continued>
1040
907
  <title-continued lang="en">(continued)</title-continued>
1041
908
  <title-continued lang="fr">(continué)</title-continued>
1042
909
 
1043
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
910
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
911
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
912
+ <xsl:value-of select="$toc_table_title"/>
913
+ <xsl:if test="normalize-space($toc_table_title) = ''">
914
+ <xsl:call-template name="getTitle">
915
+ <xsl:with-param name="name" select="'title-list-tables'"/>
916
+ </xsl:call-template>
917
+ </xsl:if>
918
+ </xsl:variable><xsl:variable name="title-list-figures">
919
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
920
+ <xsl:value-of select="$toc_figure_title"/>
921
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
922
+ <xsl:call-template name="getTitle">
923
+ <xsl:with-param name="name" select="'title-list-figures'"/>
924
+ </xsl:call-template>
925
+ </xsl:if>
926
+ </xsl:variable><xsl:variable name="title-list-recommendations">
927
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
928
+ <xsl:value-of select="$toc_requirement_title"/>
929
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
930
+ <xsl:call-template name="getTitle">
931
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
932
+ </xsl:call-template>
933
+ </xsl:if>
934
+ </xsl:variable><xsl:variable name="bibdata">
1044
935
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1045
936
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1046
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
937
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
1047
938
  <xsl:param name="name"/>
1048
939
  <xsl:param name="lang"/>
1049
940
  <xsl:variable name="lang_">
@@ -1066,7 +957,7 @@
1066
957
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1067
958
  </xsl:otherwise>
1068
959
  </xsl:choose>
1069
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
960
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:attribute-set name="root-style">
1070
961
 
1071
962
 
1072
963
 
@@ -1221,7 +1112,7 @@
1221
1112
 
1222
1113
 
1223
1114
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1224
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1115
+
1225
1116
 
1226
1117
 
1227
1118
 
@@ -1235,6 +1126,7 @@
1235
1126
 
1236
1127
 
1237
1128
 
1129
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1238
1130
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1239
1131
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1240
1132
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1607,7 +1499,8 @@
1607
1499
 
1608
1500
 
1609
1501
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1610
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
1502
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
1503
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
1611
1504
 
1612
1505
 
1613
1506
 
@@ -1616,9 +1509,9 @@
1616
1509
 
1617
1510
 
1618
1511
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1512
+ <xsl:attribute name="text-align">right</xsl:attribute>
1619
1513
 
1620
1514
 
1621
-
1622
1515
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1623
1516
 
1624
1517
 
@@ -1637,6 +1530,9 @@
1637
1530
 
1638
1531
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1639
1532
 
1533
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
1534
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1535
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1640
1536
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
1641
1537
 
1642
1538
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1665,6 +1561,33 @@
1665
1561
 
1666
1562
 
1667
1563
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1564
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1565
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1566
+
1567
+
1568
+
1569
+
1570
+
1571
+
1572
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
1573
+ <xsl:attribute name="text-align">center</xsl:attribute>
1574
+
1575
+
1576
+
1577
+
1578
+
1579
+
1580
+
1581
+
1582
+
1583
+
1584
+
1585
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1586
+ <xsl:attribute name="text-align">right</xsl:attribute>
1587
+
1588
+
1589
+
1590
+
1668
1591
 
1669
1592
  </xsl:attribute-set><xsl:attribute-set name="image-style">
1670
1593
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1703,6 +1626,18 @@
1703
1626
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1704
1627
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1705
1628
 
1629
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
1637
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1638
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1639
+
1640
+
1706
1641
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1707
1642
 
1708
1643
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1719,13 +1654,19 @@
1719
1654
  </xsl:attribute-set><xsl:variable name="color-added-text">
1720
1655
  <xsl:text>rgb(0, 255, 0)</xsl:text>
1721
1656
  </xsl:variable><xsl:attribute-set name="add-style">
1722
- <xsl:attribute name="color">red</xsl:attribute>
1723
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1724
- <!-- <xsl:attribute name="color">black</xsl:attribute>
1725
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1726
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
1727
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1728
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
1657
+
1658
+ <xsl:attribute name="color">red</xsl:attribute>
1659
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1660
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1661
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1662
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1663
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1664
+
1665
+ </xsl:attribute-set><xsl:variable name="add-style">
1666
+ <add-style xsl:use-attribute-sets="add-style"/>
1667
+ </xsl:variable><xsl:template name="append_add-style">
1668
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
1669
+ </xsl:template><xsl:variable name="color-deleted-text">
1729
1670
  <xsl:text>red</xsl:text>
1730
1671
  </xsl:variable><xsl:attribute-set name="del-style">
1731
1672
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -1736,6 +1677,36 @@
1736
1677
 
1737
1678
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1738
1679
 
1680
+
1681
+
1682
+
1683
+
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+
1695
+ <xsl:attribute name="provisional-distance-between-starts">4mm</xsl:attribute>
1696
+ <xsl:attribute name="margin-left">-8mm</xsl:attribute>
1697
+
1698
+
1699
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1700
+
1701
+
1702
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
1703
+
1704
+
1705
+
1706
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
1707
+
1708
+
1709
+
1739
1710
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1740
1711
  <xsl:attribute name="line-height">135%</xsl:attribute>
1741
1712
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -2018,15 +1989,148 @@
2018
1989
 
2019
1990
 
2020
1991
 
1992
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
1993
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1994
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
1995
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1996
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
1997
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1998
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
1999
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2000
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
2001
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2002
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
2003
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2004
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
2005
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2006
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
2007
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2008
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
2009
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2010
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
2011
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2012
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
2013
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2014
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
2015
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2016
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
2017
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2018
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
2019
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2020
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
2021
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2022
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
2023
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2024
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
2025
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2026
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
2027
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2028
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
2029
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2030
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
2031
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2032
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
2033
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2034
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
2035
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2036
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
2037
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2038
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
2039
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2040
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
2041
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2042
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
2043
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2044
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
2045
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2046
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
2047
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2048
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
2049
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2050
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
2051
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2052
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
2053
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2054
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
2055
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2056
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
2057
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2058
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
2059
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2060
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
2061
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2062
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2063
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
2064
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
2065
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
2066
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2067
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2068
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
2069
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2070
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2071
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
2072
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2073
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
2074
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
2075
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
2076
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
2077
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
2078
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
2079
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
2080
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
2081
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
2082
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
2083
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
2084
+ <xsl:attribute name="role">H1</xsl:attribute>
2085
+
2086
+
2087
+
2088
+
2089
+
2090
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
2091
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2092
+
2093
+
2094
+
2095
+
2096
+
2021
2097
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2098
+ <xsl:variable name="nodes_preface_">
2099
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2100
+ <node id="{@id}"/>
2101
+ </xsl:for-each>
2102
+ </xsl:variable>
2103
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2104
+
2022
2105
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2023
2106
  <xsl:sort select="@displayorder" data-type="number"/>
2107
+
2108
+ <!-- process Section's title -->
2109
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2110
+ <xsl:if test="$preceding-sibling_id != ''">
2111
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2112
+ </xsl:if>
2113
+
2024
2114
  <xsl:apply-templates select="." mode="contents"/>
2025
2115
  </xsl:for-each>
2026
2116
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2027
2117
 
2118
+ <xsl:variable name="nodes_sections_">
2119
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
2120
+ <node id="{@id}"/>
2121
+ </xsl:for-each>
2122
+ </xsl:variable>
2123
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
2124
+
2028
2125
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
2029
2126
  <xsl:sort select="@displayorder" data-type="number"/>
2127
+
2128
+ <!-- process Section's title -->
2129
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2130
+ <xsl:if test="$preceding-sibling_id != ''">
2131
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2132
+ </xsl:if>
2133
+
2030
2134
  <xsl:apply-templates select="." mode="contents"/>
2031
2135
  </xsl:for-each>
2032
2136
 
@@ -2039,6 +2143,30 @@
2039
2143
  <xsl:sort select="@displayorder" data-type="number"/>
2040
2144
  <xsl:apply-templates select="." mode="contents"/>
2041
2145
  </xsl:for-each>
2146
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
2147
+ <xsl:param name="always"/>
2148
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2149
+ <xsl:call-template name="processTables_Contents"/>
2150
+ </xsl:if>
2151
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2152
+ <xsl:call-template name="processFigures_Contents"/>
2153
+ </xsl:if>
2154
+ </xsl:template><xsl:template name="processTables_Contents">
2155
+ <tables>
2156
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2157
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2158
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2159
+ </table>
2160
+ </xsl:for-each>
2161
+ </tables>
2162
+ </xsl:template><xsl:template name="processFigures_Contents">
2163
+ <figures>
2164
+ <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
2165
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
2166
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2167
+ </figure>
2168
+ </xsl:for-each>
2169
+ </figures>
2042
2170
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2043
2171
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2044
2172
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2104,9 +2232,12 @@
2104
2232
 
2105
2233
 
2106
2234
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
2235
+ <xsl:param name="margin"/>
2107
2236
 
2108
2237
  <!-- process in the template 'paragraph' -->
2109
- <xsl:call-template name="paragraph"/>
2238
+ <xsl:call-template name="paragraph">
2239
+ <xsl:with-param name="margin" select="$margin"/>
2240
+ </xsl:call-template>
2110
2241
 
2111
2242
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
2112
2243
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -2118,9 +2249,12 @@
2118
2249
  <xsl:call-template name="title"/>
2119
2250
 
2120
2251
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
2252
+ <xsl:param name="margin"/>
2121
2253
 
2122
2254
  <!-- process in the template 'paragraph' -->
2123
- <xsl:call-template name="paragraph"/>
2255
+ <xsl:call-template name="paragraph">
2256
+ <xsl:with-param name="margin" select="$margin"/>
2257
+ </xsl:call-template>
2124
2258
 
2125
2259
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2126
2260
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -2159,7 +2293,7 @@
2159
2293
  </xsl:call-template>
2160
2294
  </xsl:if>
2161
2295
  </xsl:variable>
2162
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2296
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2163
2297
 
2164
2298
 
2165
2299
  <xsl:variable name="margin-side">
@@ -2427,7 +2561,7 @@
2427
2561
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2428
2562
  <!-- 2009 thinspace -->
2429
2563
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2430
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
2564
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2431
2565
  </xsl:call-template>
2432
2566
  </xsl:variable>
2433
2567
  <xsl:variable name="max_length">
@@ -2468,8 +2602,7 @@
2468
2602
  </xsl:call-template>
2469
2603
  </xsl:if>
2470
2604
  </xsl:template><xsl:template match="text()" mode="td_text">
2471
- <xsl:variable name="zero-space">​</xsl:variable>
2472
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2605
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2473
2606
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2474
2607
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2475
2608
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -2822,37 +2955,7 @@
2822
2955
 
2823
2956
  <!-- list of footnotes to calculate actual footnotes number -->
2824
2957
  <xsl:variable name="p_fn_">
2825
- <xsl:choose>
2826
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2827
- <fn gen_id="{generate-id(.)}">
2828
- <xsl:copy-of select="@*"/>
2829
- <xsl:copy-of select="node()"/>
2830
- </fn>
2831
- </xsl:when>
2832
- <xsl:otherwise>
2833
- <!-- itetation for:
2834
- footnotes in bibdata/title
2835
- footnotes in bibliography
2836
- footnotes in document's body (except table's head/body/foot and figure text)
2837
- -->
2838
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2839
- <fn gen_id="{generate-id(.)}">
2840
- <xsl:copy-of select="@*"/>
2841
- <xsl:copy-of select="node()"/>
2842
- </fn>
2843
- </xsl:for-each>
2844
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
2845
- <xsl:sort select="@displayorder" data-type="number"/>
2846
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
2847
- <!-- copy unique fn -->
2848
- <fn gen_id="{generate-id(.)}">
2849
- <xsl:copy-of select="@*"/>
2850
- <xsl:copy-of select="node()"/>
2851
- </fn>
2852
- </xsl:for-each>
2853
- </xsl:for-each>
2854
- </xsl:otherwise>
2855
- </xsl:choose>
2958
+ <xsl:call-template name="get_fn_list"/>
2856
2959
  </xsl:variable>
2857
2960
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2858
2961
 
@@ -2913,18 +3016,50 @@
2913
3016
  <xsl:copy-of select="$footnote_inline"/>
2914
3017
  </xsl:otherwise>
2915
3018
  </xsl:choose>
2916
- </xsl:template><xsl:template name="table_fn_display">
2917
- <xsl:variable name="references">
2918
-
2919
- <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2920
- <xsl:call-template name="create_fn"/>
2921
- </xsl:for-each>
2922
- </xsl:variable>
2923
-
2924
- <xsl:for-each select="xalan:nodeset($references)//fn">
2925
- <xsl:variable name="reference" select="@reference"/>
2926
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2927
- <fo:block xsl:use-attribute-sets="table-fn-style">
3019
+ </xsl:template><xsl:template name="get_fn_list">
3020
+ <xsl:choose>
3021
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3022
+ <fn gen_id="{generate-id(.)}">
3023
+ <xsl:copy-of select="@*"/>
3024
+ <xsl:copy-of select="node()"/>
3025
+ </fn>
3026
+ </xsl:when>
3027
+ <xsl:otherwise>
3028
+ <!-- itetation for:
3029
+ footnotes in bibdata/title
3030
+ footnotes in bibliography
3031
+ footnotes in document's body (except table's head/body/foot and figure text)
3032
+ -->
3033
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3034
+ <fn gen_id="{generate-id(.)}">
3035
+ <xsl:copy-of select="@*"/>
3036
+ <xsl:copy-of select="node()"/>
3037
+ </fn>
3038
+ </xsl:for-each>
3039
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
3040
+ <xsl:sort select="@displayorder" data-type="number"/>
3041
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3042
+ <!-- copy unique fn -->
3043
+ <fn gen_id="{generate-id(.)}">
3044
+ <xsl:copy-of select="@*"/>
3045
+ <xsl:copy-of select="node()"/>
3046
+ </fn>
3047
+ </xsl:for-each>
3048
+ </xsl:for-each>
3049
+ </xsl:otherwise>
3050
+ </xsl:choose>
3051
+ </xsl:template><xsl:template name="table_fn_display">
3052
+ <xsl:variable name="references">
3053
+
3054
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3055
+ <xsl:call-template name="create_fn"/>
3056
+ </xsl:for-each>
3057
+ </xsl:variable>
3058
+
3059
+ <xsl:for-each select="xalan:nodeset($references)//fn">
3060
+ <xsl:variable name="reference" select="@reference"/>
3061
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3062
+ <fo:block xsl:use-attribute-sets="table-fn-style">
2928
3063
 
2929
3064
 
2930
3065
 
@@ -3084,7 +3219,7 @@
3084
3219
  </fo:inline>
3085
3220
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3086
3221
  <fo:inline><xsl:value-of select="."/></fo:inline>
3087
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3222
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
3088
3223
  <fo:inline>
3089
3224
  <xsl:apply-templates/>
3090
3225
  </fo:inline>
@@ -3447,20 +3582,44 @@
3447
3582
  <fo:inline text-decoration="underline">
3448
3583
  <xsl:apply-templates/>
3449
3584
  </fo:inline>
3450
- </xsl:template><xsl:template match="*[local-name()='add']">
3585
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
3451
3586
  <xsl:param name="skip">true</xsl:param>
3587
+ <xsl:param name="block">false</xsl:param>
3588
+ <xsl:param name="type"/>
3589
+ <xsl:param name="text-align"/>
3452
3590
  <xsl:choose>
3453
3591
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3454
3592
  <xsl:choose>
3455
- <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab'])) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
3593
+ <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
3456
3594
  <xsl:otherwise>
3457
- <fo:inline>
3595
+ <xsl:variable name="tag">
3458
3596
  <xsl:call-template name="insertTag">
3459
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3597
+ <xsl:with-param name="type">
3598
+ <xsl:choose>
3599
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
3600
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
3601
+ </xsl:choose>
3602
+ </xsl:with-param>
3460
3603
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3461
3604
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3462
3605
  </xsl:call-template>
3463
- </fo:inline>
3606
+ </xsl:variable>
3607
+ <xsl:choose>
3608
+ <xsl:when test="$block = 'false'">
3609
+ <fo:inline>
3610
+ <xsl:copy-of select="$tag"/>
3611
+ </fo:inline>
3612
+ </xsl:when>
3613
+ <xsl:otherwise>
3614
+ <fo:block> <!-- for around figures -->
3615
+ <xsl:if test="$text-align != ''">
3616
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
3617
+ </xsl:if>
3618
+ <xsl:copy-of select="$tag"/>
3619
+ </fo:block>
3620
+ </xsl:otherwise>
3621
+ </xsl:choose>
3622
+
3464
3623
  </xsl:otherwise>
3465
3624
  </xsl:choose>
3466
3625
  </xsl:when>
@@ -3819,17 +3978,21 @@
3819
3978
  </xsl:apply-templates>
3820
3979
  </xsl:template><xsl:template name="getLang">
3821
3980
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3822
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3823
3981
  <xsl:variable name="language">
3824
3982
  <xsl:choose>
3825
3983
  <xsl:when test="$language_current != ''">
3826
3984
  <xsl:value-of select="$language_current"/>
3827
3985
  </xsl:when>
3828
- <xsl:when test="$language_current_2 != ''">
3829
- <xsl:value-of select="$language_current_2"/>
3830
- </xsl:when>
3831
3986
  <xsl:otherwise>
3832
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3987
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3988
+ <xsl:choose>
3989
+ <xsl:when test="$language_current_2 != ''">
3990
+ <xsl:value-of select="$language_current_2"/>
3991
+ </xsl:when>
3992
+ <xsl:otherwise>
3993
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3994
+ </xsl:otherwise>
3995
+ </xsl:choose>
3833
3996
  </xsl:otherwise>
3834
3997
  </xsl:choose>
3835
3998
  </xsl:variable>
@@ -4032,6 +4195,9 @@
4032
4195
  </fo:inline>
4033
4196
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4034
4197
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4198
+ <xsl:if test="parent::*[local-name() = 'add']">
4199
+ <xsl:call-template name="append_add-style"/>
4200
+ </xsl:if>
4035
4201
  <xsl:apply-templates/>
4036
4202
  </fo:basic-link>
4037
4203
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -4046,8 +4212,8 @@
4046
4212
 
4047
4213
  </xsl:if>
4048
4214
  <fo:block-container margin-left="0mm">
4049
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
4050
- <xsl:apply-templates/>
4215
+ <fo:block id="{@id}">
4216
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
4051
4217
  </fo:block>
4052
4218
  </fo:block-container>
4053
4219
  </fo:block-container>
@@ -4059,10 +4225,48 @@
4059
4225
  <fo:inline>
4060
4226
  <xsl:apply-templates/>
4061
4227
  </fo:inline>
4062
- </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']" mode="formula_number"> <!-- show by demand -->
4228
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
4063
4229
  <xsl:if test="normalize-space() != ''">
4064
4230
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
4065
4231
  </xsl:if>
4232
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
4233
+ <fo:block xsl:use-attribute-sets="formula-style">
4234
+
4235
+
4236
+
4237
+ <fo:table table-layout="fixed" width="100%">
4238
+ <fo:table-column column-width="95%"/>
4239
+ <fo:table-column column-width="5%"/>
4240
+ <fo:table-body>
4241
+ <fo:table-row>
4242
+ <fo:table-cell display-align="center">
4243
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4244
+
4245
+
4246
+ <xsl:if test="ancestor::*[local-name() ='annex']">
4247
+ <xsl:attribute name="text-align">left</xsl:attribute>
4248
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
4249
+ </xsl:if>
4250
+
4251
+
4252
+ <xsl:apply-templates/>
4253
+ </fo:block>
4254
+ </fo:table-cell>
4255
+ <fo:table-cell display-align="center">
4256
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
4257
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
4258
+ </fo:block>
4259
+ </fo:table-cell>
4260
+ </fo:table-row>
4261
+ </fo:table-body>
4262
+ </fo:table>
4263
+ </fo:block>
4264
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
4265
+ <fo:block xsl:use-attribute-sets="formula-style">
4266
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4267
+ <xsl:apply-templates/>
4268
+ </fo:block>
4269
+ </fo:block>
4066
4270
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4067
4271
 
4068
4272
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -4105,6 +4309,13 @@
4105
4309
 
4106
4310
 
4107
4311
 
4312
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4313
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4314
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4315
+ <xsl:call-template name="append_add-style"/>
4316
+ </xsl:if>
4317
+
4318
+
4108
4319
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
4109
4320
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
4110
4321
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -4143,6 +4354,12 @@
4143
4354
 
4144
4355
 
4145
4356
 
4357
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4358
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4359
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4360
+ <xsl:call-template name="append_add-style"/>
4361
+ </xsl:if>
4362
+
4146
4363
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4147
4364
 
4148
4365
  </fo:inline>
@@ -4196,6 +4413,7 @@
4196
4413
  </fo:block>
4197
4414
  </xsl:template><xsl:template match="*[local-name() = 'term']">
4198
4415
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
4416
+
4199
4417
 
4200
4418
 
4201
4419
 
@@ -4632,7 +4850,11 @@
4632
4850
  <xsl:value-of select="."/>
4633
4851
  </xsl:template><xsl:template match="node()" mode="contents">
4634
4852
  <xsl:apply-templates mode="contents"/>
4635
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
4853
+ </xsl:template><xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" mode="contents_no_displayorder">
4854
+ <xsl:call-template name="contents_section-title"/>
4855
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
4856
+ <xsl:call-template name="contents_section-title"/>
4857
+ </xsl:template><xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
4636
4858
  <xsl:variable name="level">
4637
4859
  <xsl:call-template name="getLevel">
4638
4860
  <xsl:with-param name="depth" select="@depth"/>
@@ -4701,13 +4923,14 @@
4701
4923
  <xsl:apply-templates mode="bookmarks"/>
4702
4924
  </xsl:template><xsl:template name="addBookmarks">
4703
4925
  <xsl:param name="contents"/>
4704
- <xsl:if test="xalan:nodeset($contents)//item">
4926
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4927
+ <xsl:if test="$contents_nodes//item">
4705
4928
  <fo:bookmark-tree>
4706
4929
  <xsl:choose>
4707
- <xsl:when test="xalan:nodeset($contents)/doc">
4930
+ <xsl:when test="$contents_nodes/doc">
4708
4931
  <xsl:choose>
4709
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4710
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4932
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
4933
+ <xsl:for-each select="$contents_nodes/doc">
4711
4934
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4712
4935
  <xsl:if test="@bundle = 'true'">
4713
4936
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -4758,7 +4981,7 @@
4758
4981
  </xsl:for-each>
4759
4982
  </xsl:when>
4760
4983
  <xsl:otherwise>
4761
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4984
+ <xsl:for-each select="$contents_nodes/doc">
4762
4985
 
4763
4986
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4764
4987
 
@@ -4776,25 +4999,36 @@
4776
4999
  </xsl:choose>
4777
5000
  </xsl:when>
4778
5001
  <xsl:otherwise>
4779
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
5002
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
5003
+
5004
+ <xsl:call-template name="insertFigureBookmarks">
5005
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5006
+ </xsl:call-template>
5007
+
5008
+ <xsl:call-template name="insertTableBookmarks">
5009
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5010
+ <xsl:with-param name="lang" select="@lang"/>
5011
+ </xsl:call-template>
5012
+
4780
5013
  </xsl:otherwise>
4781
5014
  </xsl:choose>
4782
5015
 
5016
+
4783
5017
 
4784
5018
 
4785
5019
 
4786
5020
 
4787
-
4788
-
5021
+
4789
5022
 
4790
5023
  </fo:bookmark-tree>
4791
5024
  </xsl:if>
4792
5025
  </xsl:template><xsl:template name="insertFigureBookmarks">
4793
5026
  <xsl:param name="contents"/>
4794
- <xsl:if test="xalan:nodeset($contents)/figure">
4795
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
5027
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5028
+ <xsl:if test="$contents_nodes/figure">
5029
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
4796
5030
  <fo:bookmark-title>Figures</fo:bookmark-title>
4797
- <xsl:for-each select="xalan:nodeset($contents)/figure">
5031
+ <xsl:for-each select="$contents_nodes/figure">
4798
5032
  <fo:bookmark internal-destination="{@id}">
4799
5033
  <fo:bookmark-title>
4800
5034
  <xsl:value-of select="normalize-space(title)"/>
@@ -4803,18 +5037,40 @@
4803
5037
  </xsl:for-each>
4804
5038
  </fo:bookmark>
4805
5039
  </xsl:if>
5040
+
5041
+
5042
+ <xsl:if test="$contents_nodes//figures/figure">
5043
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5044
+
5045
+
5046
+
5047
+ <xsl:variable name="bookmark-title">
5048
+
5049
+ <xsl:value-of select="$title-list-figures"/>
5050
+
5051
+ </xsl:variable>
5052
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
5053
+ <xsl:for-each select="$contents_nodes//figures/figure">
5054
+ <fo:bookmark internal-destination="{@id}">
5055
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
5056
+ </fo:bookmark>
5057
+ </xsl:for-each>
5058
+ </fo:bookmark>
5059
+ </xsl:if>
5060
+
4806
5061
  </xsl:template><xsl:template name="insertTableBookmarks">
4807
5062
  <xsl:param name="contents"/>
4808
5063
  <xsl:param name="lang"/>
4809
- <xsl:if test="xalan:nodeset($contents)/table">
4810
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
5064
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5065
+ <xsl:if test="$contents_nodes/table">
5066
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
4811
5067
  <fo:bookmark-title>
4812
5068
  <xsl:choose>
4813
5069
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4814
5070
  <xsl:otherwise>Tables</xsl:otherwise>
4815
5071
  </xsl:choose>
4816
5072
  </fo:bookmark-title>
4817
- <xsl:for-each select="xalan:nodeset($contents)/table">
5073
+ <xsl:for-each select="$contents_nodes/table">
4818
5074
  <fo:bookmark internal-destination="{@id}">
4819
5075
  <fo:bookmark-title>
4820
5076
  <xsl:value-of select="normalize-space(title)"/>
@@ -4823,6 +5079,29 @@
4823
5079
  </xsl:for-each>
4824
5080
  </fo:bookmark>
4825
5081
  </xsl:if>
5082
+
5083
+
5084
+ <xsl:if test="$contents_nodes//tables/table">
5085
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5086
+
5087
+
5088
+
5089
+ <xsl:variable name="bookmark-title">
5090
+
5091
+ <xsl:value-of select="$title-list-tables"/>
5092
+
5093
+ </xsl:variable>
5094
+
5095
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
5096
+
5097
+ <xsl:for-each select="$contents_nodes//tables/table">
5098
+ <fo:bookmark internal-destination="{@id}">
5099
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
5100
+ </fo:bookmark>
5101
+ </xsl:for-each>
5102
+ </fo:bookmark>
5103
+ </xsl:if>
5104
+
4826
5105
  </xsl:template><xsl:template name="getLangVersion">
4827
5106
  <xsl:param name="lang"/>
4828
5107
  <xsl:param name="doctype" select="''"/>
@@ -5021,12 +5300,140 @@
5021
5300
  </fo:block-container>
5022
5301
  </fo:block-container>
5023
5302
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5024
- <xsl:variable name="text">
5303
+ <xsl:choose>
5304
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
5305
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
5306
+ <xsl:choose>
5307
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
5308
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
5309
+ </xsl:when>
5310
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
5311
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5312
+ </xsl:otherwise>
5313
+ </xsl:choose>
5314
+ </xsl:when>
5315
+ <xsl:otherwise>
5316
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5317
+ </xsl:otherwise>
5318
+ </xsl:choose>
5319
+
5320
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
5321
+ <xsl:variable name="text_step1">
5025
5322
  <xsl:call-template name="add-zero-spaces-equal"/>
5026
5323
  </xsl:variable>
5027
- <xsl:call-template name="add-zero-spaces-java">
5028
- <xsl:with-param name="text" select="$text"/>
5029
- </xsl:call-template>
5324
+ <xsl:variable name="text_step2">
5325
+ <xsl:call-template name="add-zero-spaces-java">
5326
+ <xsl:with-param name="text" select="$text_step1"/>
5327
+ </xsl:call-template>
5328
+ </xsl:variable>
5329
+ <xsl:value-of select="$text_step2"/>
5330
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
5331
+ <xsl:apply-templates mode="syntax_highlight"/>
5332
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
5333
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
5334
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
5335
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
5336
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
5337
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
5338
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
5339
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
5340
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
5341
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
5342
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
5343
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
5344
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
5345
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
5346
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
5347
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
5348
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
5349
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
5350
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
5351
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
5352
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
5353
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
5354
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
5355
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
5356
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
5357
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
5358
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
5359
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
5360
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
5361
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
5362
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
5363
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
5364
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
5365
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
5366
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
5367
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
5368
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
5369
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
5370
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
5371
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
5372
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
5373
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
5374
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
5375
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
5376
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
5377
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
5378
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
5379
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
5380
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
5381
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
5382
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
5383
+ <fo:inline>
5384
+ <xsl:variable name="classes_">
5385
+ <xsl:call-template name="split">
5386
+ <xsl:with-param name="pText" select="@class"/>
5387
+ <xsl:with-param name="sep" select="' '"/>
5388
+ </xsl:call-template>
5389
+ <!-- a few classes together (_and_ suffix) -->
5390
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
5391
+ <item>hljs-char_and_escape_</item>
5392
+ </xsl:if>
5393
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
5394
+ <item>hljs-title_and_class_</item>
5395
+ </xsl:if>
5396
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
5397
+ <item>hljs-title_and_class__and_inherited__</item>
5398
+ </xsl:if>
5399
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
5400
+ <item>hljs-title_and_function_</item>
5401
+ </xsl:if>
5402
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
5403
+ <item>hljs-variable_and_language_</item>
5404
+ </xsl:if>
5405
+ <!-- with parent classes (_ suffix) -->
5406
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
5407
+ <item>hljs-meta_hljs-keyword</item>
5408
+ </xsl:if>
5409
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
5410
+ <item>hljs-meta_hljs-string</item>
5411
+ </xsl:if>
5412
+ </xsl:variable>
5413
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
5414
+
5415
+ <xsl:for-each select="$classes/item">
5416
+ <xsl:variable name="class_name" select="."/>
5417
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5418
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5419
+ </xsl:for-each>
5420
+ </xsl:for-each>
5421
+
5422
+ <!-- <xsl:variable name="class_name">
5423
+ <xsl:choose>
5424
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
5425
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
5426
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
5427
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
5428
+ </xsl:choose>
5429
+ </xsl:variable>
5430
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5431
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5432
+ </xsl:for-each> -->
5433
+
5434
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
5435
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
5436
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5030
5437
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
5031
5438
  <xsl:if test="normalize-space() != ''">
5032
5439
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -5355,6 +5762,8 @@
5355
5762
  </xsl:otherwise>
5356
5763
  </xsl:choose> -->
5357
5764
  </fo:block>
5765
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5766
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5358
5767
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5359
5768
  <xsl:if test="normalize-space() != ''">
5360
5769
  <xsl:value-of select="."/>
@@ -5401,11 +5810,14 @@
5401
5810
 
5402
5811
 
5403
5812
  <fo:block-container margin-left="0mm">
5404
-
5405
- <fo:block xsl:use-attribute-sets="quote-style">
5813
+ <fo:block-container xsl:use-attribute-sets="quote-style">
5406
5814
 
5407
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5408
- </fo:block>
5815
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5816
+ <fo:block role="BlockQuote">
5817
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5818
+ </fo:block>
5819
+ </fo:block-container>
5820
+ </fo:block-container>
5409
5821
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5410
5822
  <fo:block xsl:use-attribute-sets="quote-source-style">
5411
5823
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -5426,26 +5838,11 @@
5426
5838
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5427
5839
  <xsl:text>— </xsl:text>
5428
5840
  <xsl:apply-templates/>
5429
- </xsl:template><xsl:variable name="bibitem_hidden_">
5430
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5431
- <xsl:copy-of select="."/>
5432
- </xsl:for-each>
5433
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
5434
- <xsl:copy-of select="."/>
5435
- </xsl:for-each>
5436
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5437
-
5438
- <xsl:variable name="bibitemid">
5439
- <xsl:choose>
5440
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
5441
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
5442
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5443
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5444
- </xsl:choose>
5445
- </xsl:variable>
5446
-
5841
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
5842
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5843
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5447
5844
  <xsl:choose>
5448
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
5845
+ <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
5449
5846
  <fo:inline xsl:use-attribute-sets="eref-style">
5450
5847
  <xsl:if test="@type = 'footnote'">
5451
5848
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -5459,8 +5856,8 @@
5459
5856
  <xsl:variable name="text" select="normalize-space()"/>
5460
5857
 
5461
5858
 
5462
-
5463
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5859
+
5860
+ <fo:basic-link fox:alt-text="{@citeas}">
5464
5861
  <xsl:if test="normalize-space(@citeas) = ''">
5465
5862
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5466
5863
  </xsl:if>
@@ -5472,14 +5869,21 @@
5472
5869
 
5473
5870
  </xsl:if>
5474
5871
 
5475
-
5872
+ <xsl:choose>
5873
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
5874
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
5875
+ </xsl:when>
5876
+ <xsl:otherwise>
5877
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5878
+ </xsl:otherwise>
5879
+ </xsl:choose>
5476
5880
 
5477
5881
  <xsl:apply-templates/>
5478
5882
  </fo:basic-link>
5479
-
5883
+
5480
5884
  </fo:inline>
5481
5885
  </xsl:when>
5482
- <xsl:otherwise>
5886
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5483
5887
  <fo:inline><xsl:apply-templates/></fo:inline>
5484
5888
  </xsl:otherwise>
5485
5889
  </xsl:choose>
@@ -5552,6 +5956,31 @@
5552
5956
  <xsl:with-param name="count" select="$count - 1"/>
5553
5957
  </xsl:call-template>
5554
5958
  </xsl:if>
5959
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
5960
+ <xsl:variable name="level">
5961
+ <xsl:call-template name="getLevel"/>
5962
+ </xsl:variable>
5963
+ <xsl:variable name="font-size">
5964
+ inherit
5965
+ </xsl:variable>
5966
+ <xsl:variable name="levelTerm">
5967
+ <xsl:call-template name="getLevelTermName"/>
5968
+ </xsl:variable>
5969
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
5970
+
5971
+
5972
+
5973
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
5974
+ <fo:block xsl:use-attribute-sets="term-name-style">
5975
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
5976
+ </fo:block>
5977
+ </xsl:if>
5978
+
5979
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
5980
+ <xsl:call-template name="setStyle_preferred"/>
5981
+ <xsl:apply-templates/>
5982
+ </fo:block>
5983
+ </fo:block>
5555
5984
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
5556
5985
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
5557
5986
  <xsl:text> </xsl:text>
@@ -5645,24 +6074,8 @@
5645
6074
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5646
6075
  </xsl:template><xsl:variable name="ul_labels_">
5647
6076
 
5648
-
5649
-
5650
-
5651
-
5652
-
5653
-
5654
-
5655
-
5656
-
5657
-
5658
-
5659
-
5660
-
5661
-
5662
-
5663
- <label>•</label>
5664
-
5665
-
6077
+ <label>•</label>
6078
+
5666
6079
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5667
6080
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5668
6081
  <xsl:variable name="list_level">
@@ -5688,6 +6101,91 @@
5688
6101
  </xsl:template><xsl:template match="label" mode="ul_labels">
5689
6102
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5690
6103
  <xsl:value-of select="."/>
6104
+ </xsl:template><xsl:template name="getListItemFormat">
6105
+ <!-- Example: for BSI <?list-type loweralpha?> -->
6106
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
6107
+ <xsl:choose>
6108
+ <xsl:when test="local-name(..) = 'ul'">
6109
+ <xsl:choose>
6110
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
6111
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
6112
+ </xsl:choose>
6113
+ </xsl:when>
6114
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
6115
+
6116
+ <!-- Example: for BSI <?list-start 2?> -->
6117
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
6118
+
6119
+ <xsl:variable name="start_value">
6120
+ <xsl:choose>
6121
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
6122
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6123
+ </xsl:when>
6124
+ <xsl:when test="normalize-space(../@start) != ''">
6125
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6126
+ </xsl:when>
6127
+ <xsl:otherwise>0</xsl:otherwise>
6128
+ </xsl:choose>
6129
+ </xsl:variable>
6130
+
6131
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
6132
+
6133
+ <xsl:variable name="type">
6134
+ <xsl:choose>
6135
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
6136
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
6137
+
6138
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
6139
+
6140
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6141
+ <xsl:variable name="list_level">
6142
+ <xsl:choose>
6143
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
6144
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
6145
+ </xsl:choose>
6146
+ </xsl:variable>
6147
+
6148
+ <xsl:choose>
6149
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
6150
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
6151
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
6152
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
6153
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
6154
+ <xsl:otherwise> <!-- level 1 -->
6155
+ <xsl:choose>
6156
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
6157
+ <xsl:otherwise>alphabet</xsl:otherwise>
6158
+ </xsl:choose>
6159
+ </xsl:otherwise>
6160
+ </xsl:choose>
6161
+
6162
+ </xsl:otherwise>
6163
+ </xsl:choose>
6164
+ </xsl:variable>
6165
+
6166
+ <xsl:variable name="format">
6167
+ <xsl:choose>
6168
+ <xsl:when test="$type = 'arabic'">
6169
+ 1.
6170
+ </xsl:when>
6171
+ <xsl:when test="$type = 'alphabet'">
6172
+ a)
6173
+ </xsl:when>
6174
+ <xsl:when test="$type = 'alphabet_upper'">
6175
+ A.
6176
+ </xsl:when>
6177
+ <xsl:when test="$type = 'roman'">
6178
+ i)
6179
+ </xsl:when>
6180
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
6181
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
6182
+ </xsl:choose>
6183
+ </xsl:variable>
6184
+
6185
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
6186
+
6187
+ </xsl:otherwise>
6188
+ </xsl:choose>
5691
6189
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5692
6190
  <xsl:choose>
5693
6191
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5703,18 +6201,71 @@
5703
6201
 
5704
6202
  <fo:block-container margin-left="0mm">
5705
6203
  <fo:block>
5706
- <xsl:apply-templates select="." mode="ul_ol"/>
6204
+ <xsl:apply-templates select="." mode="list"/>
5707
6205
  </fo:block>
5708
6206
  </fo:block-container>
5709
6207
  </fo:block-container>
5710
6208
  </xsl:when>
5711
6209
  <xsl:otherwise>
5712
6210
  <fo:block>
5713
- <xsl:apply-templates select="." mode="ul_ol"/>
6211
+ <xsl:apply-templates select="." mode="list"/>
5714
6212
  </fo:block>
5715
6213
  </xsl:otherwise>
5716
6214
  </xsl:choose>
5717
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6215
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
6216
+ <fo:list-block xsl:use-attribute-sets="list-style">
6217
+
6218
+
6219
+
6220
+
6221
+
6222
+
6223
+
6224
+
6225
+
6226
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6227
+ </fo:list-block>
6228
+ <!-- <xsl:for-each select="./iho:note">
6229
+ <xsl:call-template name="note"/>
6230
+ </xsl:for-each> -->
6231
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
6232
+ </xsl:template><xsl:template match="*[local-name()='li']">
6233
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
6234
+ <xsl:copy-of select="@id"/>
6235
+
6236
+
6237
+
6238
+ <fo:list-item-label end-indent="label-end()">
6239
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
6240
+
6241
+
6242
+
6243
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6244
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
6245
+ <xsl:call-template name="append_add-style"/>
6246
+ </xsl:if>
6247
+
6248
+ <xsl:call-template name="getListItemFormat"/>
6249
+ </fo:block>
6250
+ </fo:list-item-label>
6251
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
6252
+ <fo:block>
6253
+
6254
+
6255
+
6256
+
6257
+
6258
+ <xsl:apply-templates/>
6259
+
6260
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
6261
+
6262
+ <xsl:for-each select="./bsi:note">
6263
+ <xsl:call-template name="note"/>
6264
+ </xsl:for-each> -->
6265
+ </fo:block>
6266
+ </fo:list-item-body>
6267
+ </fo:list-item>
6268
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
5718
6269
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5719
6270
  <bookmark><xsl:value-of select="@id"/></bookmark>
5720
6271
  </xsl:for-each>
@@ -5736,7 +6287,7 @@
5736
6287
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5737
6288
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5738
6289
  <xsl:if test="@to">
5739
- <xsl:value-of select="$dash"/>
6290
+ <xsl:value-of select="$en_dash"/>
5740
6291
  <xsl:copy>
5741
6292
  <xsl:copy-of select="@*"/>
5742
6293
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -5761,7 +6312,7 @@
5761
6312
  <xsl:param name="target"/>
5762
6313
  <!-- <node></node> -->
5763
6314
  <xsl:choose>
5764
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6315
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
5765
6316
  <!-- skip text (i.e. remove it) and process next element -->
5766
6317
  <!-- [removed_<xsl:value-of select="."/>] -->
5767
6318
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -5845,12 +6396,22 @@
5845
6396
  </xsl:variable>
5846
6397
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5847
6398
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6399
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
6400
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
6401
+ <!-- Index -->
6402
+ <xsl:apply-templates/>
6403
+ </fo:block>
6404
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
6405
+ <!-- Letter A, B, C, ... -->
6406
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
6407
+ <xsl:apply-templates/>
6408
+ </fo:block>
5848
6409
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5849
6410
  <xsl:apply-templates/>
5850
6411
  <fo:block>
5851
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
5852
- <fo:block> </fo:block>
5853
- </xsl:if>
6412
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6413
+ <fo:block> </fo:block>
6414
+ </xsl:if>
5854
6415
  </fo:block>
5855
6416
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5856
6417
  <xsl:apply-templates/>
@@ -5860,6 +6421,9 @@
5860
6421
 
5861
6422
  <xsl:apply-templates/>
5862
6423
  </fo:block>
6424
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
6425
+ <!-- to split by '_' and other chars -->
6426
+ <xsl:call-template name="add-zero-spaces-java"/>
5863
6427
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5864
6428
  <fo:inline id="{@id}" font-size="1pt"/>
5865
6429
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -6018,23 +6582,45 @@
6018
6582
  <xsl:apply-templates/>
6019
6583
  </fo:inline>
6020
6584
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
6585
+
6586
+ <!-- list of footnotes to calculate actual footnotes number -->
6587
+ <xsl:variable name="p_fn_">
6588
+ <xsl:call-template name="get_fn_list"/>
6589
+ </xsl:variable>
6590
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6591
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
6592
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6593
+ <!-- fn sequence number in document -->
6594
+ <xsl:variable name="current_fn_number">
6595
+ <xsl:choose>
6596
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6597
+ <xsl:otherwise>
6598
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
6599
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
6600
+ </xsl:otherwise>
6601
+ </xsl:choose>
6602
+ </xsl:variable>
6021
6603
  <fo:footnote>
6022
6604
  <xsl:variable name="number">
6023
6605
 
6024
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6606
+ <xsl:value-of select="$current_fn_number"/>
6025
6607
 
6026
6608
  </xsl:variable>
6609
+
6610
+ <xsl:variable name="current_fn_number_text">
6611
+ <xsl:value-of select="$number"/>
6612
+
6613
+ </xsl:variable>
6614
+
6027
6615
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
6028
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
6029
- <xsl:value-of select="$number"/>
6030
-
6616
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
6617
+ <xsl:value-of select="$current_fn_number_text"/>
6031
6618
  </fo:basic-link>
6032
6619
  </fo:inline>
6033
6620
  <fo:footnote-body>
6034
6621
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
6035
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6036
- <xsl:value-of select="$number"/>
6037
-
6622
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6623
+ <xsl:value-of select="$current_fn_number_text"/>
6038
6624
  </fo:inline>
6039
6625
  <xsl:apply-templates/>
6040
6626
  </fo:block>
@@ -6162,7 +6748,7 @@
6162
6748
  </fo:table-body>
6163
6749
  </fo:table>
6164
6750
  </fo:block>
6165
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6751
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
6166
6752
  <fo:table-row min-height="5mm">
6167
6753
  <xsl:apply-templates/>
6168
6754
  </fo:table-row>
@@ -6285,6 +6871,78 @@
6285
6871
  <xsl:apply-templates/>
6286
6872
  </fo:block>
6287
6873
 
6874
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
6875
+ <xsl:copy>
6876
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
6877
+ </xsl:copy>
6878
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
6879
+ <xsl:copy>
6880
+ <xsl:copy-of select="@*"/>
6881
+
6882
+ <xsl:variable name="nodes_preface_">
6883
+ <xsl:for-each select="*">
6884
+ <node id="{@id}"/>
6885
+ </xsl:for-each>
6886
+ </xsl:variable>
6887
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
6888
+
6889
+ <xsl:for-each select="*">
6890
+ <xsl:sort select="@displayorder" data-type="number"/>
6891
+
6892
+ <!-- process Section's title -->
6893
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6894
+ <xsl:if test="$preceding-sibling_id != ''">
6895
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6896
+ </xsl:if>
6897
+
6898
+ <xsl:choose>
6899
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6900
+ <xsl:otherwise>
6901
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6902
+ </xsl:otherwise>
6903
+ </xsl:choose>
6904
+
6905
+ </xsl:for-each>
6906
+ </xsl:copy>
6907
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
6908
+ <xsl:copy>
6909
+ <xsl:copy-of select="@*"/>
6910
+
6911
+ <xsl:variable name="nodes_sections_">
6912
+ <xsl:for-each select="*">
6913
+ <node id="{@id}"/>
6914
+ </xsl:for-each>
6915
+ </xsl:variable>
6916
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
6917
+
6918
+ <!-- move section 'Normative references' inside 'sections' -->
6919
+ <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
6920
+ <xsl:sort select="@displayorder" data-type="number"/>
6921
+
6922
+ <!-- process Section's title -->
6923
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6924
+ <xsl:if test="$preceding-sibling_id != ''">
6925
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6926
+ </xsl:if>
6927
+
6928
+ <xsl:choose>
6929
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6930
+ <xsl:otherwise>
6931
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6932
+ </xsl:otherwise>
6933
+ </xsl:choose>
6934
+
6935
+ </xsl:for-each>
6936
+ </xsl:copy>
6937
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
6938
+ <xsl:copy>
6939
+ <xsl:copy-of select="@*"/>
6940
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
6941
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
6942
+ <xsl:sort select="@displayorder" data-type="number"/>
6943
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6944
+ </xsl:for-each>
6945
+ </xsl:copy>
6288
6946
  </xsl:template><xsl:template name="convertDate">
6289
6947
  <xsl:param name="date"/>
6290
6948
  <xsl:param name="format" select="'short'"/>
@@ -6398,9 +7056,6 @@
6398
7056
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
6399
7057
  </xsl:choose>
6400
7058
  </xsl:template><xsl:template name="addPDFUAmeta">
6401
- <xsl:variable name="lang">
6402
- <xsl:call-template name="getLang"/>
6403
- </xsl:variable>
6404
7059
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6405
7060
  <pdf:dictionary type="normal" key="ViewerPreferences">
6406
7061
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -6628,10 +7283,12 @@
6628
7283
  <xsl:param name="key"/>
6629
7284
  <xsl:param name="formatted">false</xsl:param>
6630
7285
  <xsl:param name="lang"/>
7286
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
6631
7287
 
6632
7288
  <xsl:variable name="curr_lang">
6633
7289
  <xsl:choose>
6634
7290
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7291
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6635
7292
  <xsl:otherwise>
6636
7293
  <xsl:call-template name="getLang"/>
6637
7294
  </xsl:otherwise>
@@ -6666,6 +7323,7 @@
6666
7323
  </xsl:otherwise>
6667
7324
  </xsl:choose>
6668
7325
  </xsl:when>
7326
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6669
7327
  <xsl:otherwise>
6670
7328
  <xsl:variable name="key_">
6671
7329
  <xsl:call-template name="capitalize">
@@ -6735,53 +7393,153 @@
6735
7393
  <xsl:param name="first"/>
6736
7394
  <xsl:if test="$number != ''">
6737
7395
  <xsl:variable name="words">
6738
- <words>
6739
- <word cardinal="1">One-</word>
6740
- <word ordinal="1">First </word>
6741
- <word cardinal="2">Two-</word>
6742
- <word ordinal="2">Second </word>
6743
- <word cardinal="3">Three-</word>
6744
- <word ordinal="3">Third </word>
6745
- <word cardinal="4">Four-</word>
6746
- <word ordinal="4">Fourth </word>
6747
- <word cardinal="5">Five-</word>
6748
- <word ordinal="5">Fifth </word>
6749
- <word cardinal="6">Six-</word>
6750
- <word ordinal="6">Sixth </word>
6751
- <word cardinal="7">Seven-</word>
6752
- <word ordinal="7">Seventh </word>
6753
- <word cardinal="8">Eight-</word>
6754
- <word ordinal="8">Eighth </word>
6755
- <word cardinal="9">Nine-</word>
6756
- <word ordinal="9">Ninth </word>
6757
- <word ordinal="10">Tenth </word>
6758
- <word ordinal="11">Eleventh </word>
6759
- <word ordinal="12">Twelfth </word>
6760
- <word ordinal="13">Thirteenth </word>
6761
- <word ordinal="14">Fourteenth </word>
6762
- <word ordinal="15">Fifteenth </word>
6763
- <word ordinal="16">Sixteenth </word>
6764
- <word ordinal="17">Seventeenth </word>
6765
- <word ordinal="18">Eighteenth </word>
6766
- <word ordinal="19">Nineteenth </word>
6767
- <word cardinal="20">Twenty-</word>
6768
- <word ordinal="20">Twentieth </word>
6769
- <word cardinal="30">Thirty-</word>
6770
- <word ordinal="30">Thirtieth </word>
6771
- <word cardinal="40">Forty-</word>
6772
- <word ordinal="40">Fortieth </word>
6773
- <word cardinal="50">Fifty-</word>
6774
- <word ordinal="50">Fiftieth </word>
6775
- <word cardinal="60">Sixty-</word>
6776
- <word ordinal="60">Sixtieth </word>
6777
- <word cardinal="70">Seventy-</word>
6778
- <word ordinal="70">Seventieth </word>
6779
- <word cardinal="80">Eighty-</word>
6780
- <word ordinal="80">Eightieth </word>
6781
- <word cardinal="90">Ninety-</word>
6782
- <word ordinal="90">Ninetieth </word>
6783
- <word cardinal="100">Hundred-</word>
6784
- <word ordinal="100">Hundredth </word>
7396
+ <words>
7397
+ <xsl:choose>
7398
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
7399
+ <word cardinal="1">Une-</word>
7400
+ <word ordinal="1">Première </word>
7401
+ <word cardinal="2">Deux-</word>
7402
+ <word ordinal="2">Seconde </word>
7403
+ <word cardinal="3">Trois-</word>
7404
+ <word ordinal="3">Tierce </word>
7405
+ <word cardinal="4">Quatre-</word>
7406
+ <word ordinal="4">Quatrième </word>
7407
+ <word cardinal="5">Cinq-</word>
7408
+ <word ordinal="5">Cinquième </word>
7409
+ <word cardinal="6">Six-</word>
7410
+ <word ordinal="6">Sixième </word>
7411
+ <word cardinal="7">Sept-</word>
7412
+ <word ordinal="7">Septième </word>
7413
+ <word cardinal="8">Huit-</word>
7414
+ <word ordinal="8">Huitième </word>
7415
+ <word cardinal="9">Neuf-</word>
7416
+ <word ordinal="9">Neuvième </word>
7417
+ <word ordinal="10">Dixième </word>
7418
+ <word ordinal="11">Onzième </word>
7419
+ <word ordinal="12">Douzième </word>
7420
+ <word ordinal="13">Treizième </word>
7421
+ <word ordinal="14">Quatorzième </word>
7422
+ <word ordinal="15">Quinzième </word>
7423
+ <word ordinal="16">Seizième </word>
7424
+ <word ordinal="17">Dix-septième </word>
7425
+ <word ordinal="18">Dix-huitième </word>
7426
+ <word ordinal="19">Dix-neuvième </word>
7427
+ <word cardinal="20">Vingt-</word>
7428
+ <word ordinal="20">Vingtième </word>
7429
+ <word cardinal="30">Trente-</word>
7430
+ <word ordinal="30">Trentième </word>
7431
+ <word cardinal="40">Quarante-</word>
7432
+ <word ordinal="40">Quarantième </word>
7433
+ <word cardinal="50">Cinquante-</word>
7434
+ <word ordinal="50">Cinquantième </word>
7435
+ <word cardinal="60">Soixante-</word>
7436
+ <word ordinal="60">Soixantième </word>
7437
+ <word cardinal="70">Septante-</word>
7438
+ <word ordinal="70">Septantième </word>
7439
+ <word cardinal="80">Huitante-</word>
7440
+ <word ordinal="80">Huitantième </word>
7441
+ <word cardinal="90">Nonante-</word>
7442
+ <word ordinal="90">Nonantième </word>
7443
+ <word cardinal="100">Cent-</word>
7444
+ <word ordinal="100">Centième </word>
7445
+ </xsl:when>
7446
+ <xsl:when test="$lang = 'ru'">
7447
+ <word cardinal="1">Одна-</word>
7448
+ <word ordinal="1">Первое </word>
7449
+ <word cardinal="2">Две-</word>
7450
+ <word ordinal="2">Второе </word>
7451
+ <word cardinal="3">Три-</word>
7452
+ <word ordinal="3">Третье </word>
7453
+ <word cardinal="4">Четыре-</word>
7454
+ <word ordinal="4">Четвертое </word>
7455
+ <word cardinal="5">Пять-</word>
7456
+ <word ordinal="5">Пятое </word>
7457
+ <word cardinal="6">Шесть-</word>
7458
+ <word ordinal="6">Шестое </word>
7459
+ <word cardinal="7">Семь-</word>
7460
+ <word ordinal="7">Седьмое </word>
7461
+ <word cardinal="8">Восемь-</word>
7462
+ <word ordinal="8">Восьмое </word>
7463
+ <word cardinal="9">Девять-</word>
7464
+ <word ordinal="9">Девятое </word>
7465
+ <word ordinal="10">Десятое </word>
7466
+ <word ordinal="11">Одиннадцатое </word>
7467
+ <word ordinal="12">Двенадцатое </word>
7468
+ <word ordinal="13">Тринадцатое </word>
7469
+ <word ordinal="14">Четырнадцатое </word>
7470
+ <word ordinal="15">Пятнадцатое </word>
7471
+ <word ordinal="16">Шестнадцатое </word>
7472
+ <word ordinal="17">Семнадцатое </word>
7473
+ <word ordinal="18">Восемнадцатое </word>
7474
+ <word ordinal="19">Девятнадцатое </word>
7475
+ <word cardinal="20">Двадцать-</word>
7476
+ <word ordinal="20">Двадцатое </word>
7477
+ <word cardinal="30">Тридцать-</word>
7478
+ <word ordinal="30">Тридцатое </word>
7479
+ <word cardinal="40">Сорок-</word>
7480
+ <word ordinal="40">Сороковое </word>
7481
+ <word cardinal="50">Пятьдесят-</word>
7482
+ <word ordinal="50">Пятидесятое </word>
7483
+ <word cardinal="60">Шестьдесят-</word>
7484
+ <word ordinal="60">Шестидесятое </word>
7485
+ <word cardinal="70">Семьдесят-</word>
7486
+ <word ordinal="70">Семидесятое </word>
7487
+ <word cardinal="80">Восемьдесят-</word>
7488
+ <word ordinal="80">Восьмидесятое </word>
7489
+ <word cardinal="90">Девяносто-</word>
7490
+ <word ordinal="90">Девяностое </word>
7491
+ <word cardinal="100">Сто-</word>
7492
+ <word ordinal="100">Сотое </word>
7493
+ </xsl:when>
7494
+ <xsl:otherwise> <!-- default english -->
7495
+ <word cardinal="1">One-</word>
7496
+ <word ordinal="1">First </word>
7497
+ <word cardinal="2">Two-</word>
7498
+ <word ordinal="2">Second </word>
7499
+ <word cardinal="3">Three-</word>
7500
+ <word ordinal="3">Third </word>
7501
+ <word cardinal="4">Four-</word>
7502
+ <word ordinal="4">Fourth </word>
7503
+ <word cardinal="5">Five-</word>
7504
+ <word ordinal="5">Fifth </word>
7505
+ <word cardinal="6">Six-</word>
7506
+ <word ordinal="6">Sixth </word>
7507
+ <word cardinal="7">Seven-</word>
7508
+ <word ordinal="7">Seventh </word>
7509
+ <word cardinal="8">Eight-</word>
7510
+ <word ordinal="8">Eighth </word>
7511
+ <word cardinal="9">Nine-</word>
7512
+ <word ordinal="9">Ninth </word>
7513
+ <word ordinal="10">Tenth </word>
7514
+ <word ordinal="11">Eleventh </word>
7515
+ <word ordinal="12">Twelfth </word>
7516
+ <word ordinal="13">Thirteenth </word>
7517
+ <word ordinal="14">Fourteenth </word>
7518
+ <word ordinal="15">Fifteenth </word>
7519
+ <word ordinal="16">Sixteenth </word>
7520
+ <word ordinal="17">Seventeenth </word>
7521
+ <word ordinal="18">Eighteenth </word>
7522
+ <word ordinal="19">Nineteenth </word>
7523
+ <word cardinal="20">Twenty-</word>
7524
+ <word ordinal="20">Twentieth </word>
7525
+ <word cardinal="30">Thirty-</word>
7526
+ <word ordinal="30">Thirtieth </word>
7527
+ <word cardinal="40">Forty-</word>
7528
+ <word ordinal="40">Fortieth </word>
7529
+ <word cardinal="50">Fifty-</word>
7530
+ <word ordinal="50">Fiftieth </word>
7531
+ <word cardinal="60">Sixty-</word>
7532
+ <word ordinal="60">Sixtieth </word>
7533
+ <word cardinal="70">Seventy-</word>
7534
+ <word ordinal="70">Seventieth </word>
7535
+ <word cardinal="80">Eighty-</word>
7536
+ <word ordinal="80">Eightieth </word>
7537
+ <word cardinal="90">Ninety-</word>
7538
+ <word ordinal="90">Ninetieth </word>
7539
+ <word cardinal="100">Hundred-</word>
7540
+ <word ordinal="100">Hundredth </word>
7541
+ </xsl:otherwise>
7542
+ </xsl:choose>
6785
7543
  </words>
6786
7544
  </xsl:variable>
6787
7545
 
@@ -6855,4 +7613,18 @@
6855
7613
  <xsl:otherwise>_</xsl:otherwise>
6856
7614
  </xsl:choose>
6857
7615
  </xsl:attribute>
7616
+ </xsl:template><xsl:template name="substring-after-last">
7617
+ <xsl:param name="value"/>
7618
+ <xsl:param name="delimiter"/>
7619
+ <xsl:choose>
7620
+ <xsl:when test="contains($value, $delimiter)">
7621
+ <xsl:call-template name="substring-after-last">
7622
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
7623
+ <xsl:with-param name="delimiter" select="$delimiter"/>
7624
+ </xsl:call-template>
7625
+ </xsl:when>
7626
+ <xsl:otherwise>
7627
+ <xsl:value-of select="$value"/>
7628
+ </xsl:otherwise>
7629
+ </xsl:choose>
6858
7630
  </xsl:template></xsl:stylesheet>