metanorma-bipm 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,6 @@
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:param name="svg_images"/>
6
- <xsl:variable name="images" select="document($svg_images)"/>
7
- <xsl:param name="basepath"/>
8
-
9
- <!-- <item id="#">N_page</item> -->
10
- <!-- param for second pass -->
11
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
12
-
13
5
  <xsl:param name="align-cross-elements"/>
14
6
 
15
7
 
@@ -86,12 +78,6 @@
86
78
 
87
79
  <xsl:variable name="debug">false</xsl:variable>
88
80
 
89
- <xsl:variable name="marginLeftRight1" select="25"/>
90
- <xsl:variable name="marginLeftRight2" select="15"/>
91
- <xsl:variable name="marginTop" select="29.5"/>
92
- <xsl:variable name="marginBottom" select="23.5"/>
93
-
94
-
95
81
  <xsl:variable name="all_rights_reserved">
96
82
  <xsl:call-template name="getLocalizedString">
97
83
  <xsl:with-param name="key">all_rights_reserved</xsl:with-param>
@@ -105,7 +91,7 @@
105
91
  <item level="1" id="Foreword" display="true">Foreword</item>
106
92
  <item id="term-script" display="false">3.2</item>
107
93
  -->
108
- <xsl:variable name="contents">
94
+ <xsl:variable name="contents_">
109
95
 
110
96
  <xsl:for-each select="//*[contains(local-name(), '-standard')]">
111
97
  <xsl:variable name="lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
@@ -123,11 +109,14 @@
123
109
  <!-- Index -->
124
110
  <!-- <xsl:apply-templates select="//jcgm:clause[@type = 'index']" mode="contents"/> -->
125
111
  <xsl:apply-templates select="//jcgm:indexsect" mode="contents"/>
112
+
113
+ <xsl:call-template name="processTablesFigures_Contents"/>
126
114
  </contents>
127
115
  </doc>
128
116
  </xsl:for-each>
129
117
  </xsl:for-each>
130
118
  </xsl:variable>
119
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
131
120
 
132
121
 
133
122
  <xsl:variable name="indexes">
@@ -162,14 +151,9 @@
162
151
  </xsl:for-each>
163
152
 
164
153
  </xsl:for-each>
165
-
166
154
  </xsl:variable>
167
155
 
168
156
 
169
- <xsl:variable name="lang">
170
- <xsl:call-template name="getLang"/>
171
- </xsl:variable>
172
-
173
157
  <xsl:template match="/">
174
158
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
175
159
  <fo:layout-master-set>
@@ -384,7 +368,7 @@
384
368
  <xsl:if test="$debug = 'true'">
385
369
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
386
370
  DEBUG
387
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
371
+ contents=<xsl:copy-of select="$contents"/>
388
372
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
389
373
  </xsl:if>
390
374
 
@@ -394,7 +378,7 @@
394
378
  </xsl:call-template>
395
379
  </xsl:variable>
396
380
 
397
- <xsl:for-each select="xalan:nodeset($contents)/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
381
+ <xsl:for-each select="$contents/doc[@id=$docid]//item[@display = 'true']"> <!-- and not (@type = 'annex') and not (@type = 'references') -->
398
382
  <xsl:if test="@type = 'annex' and not(preceding-sibling::item[@display = 'true' and @type = 'annex'])">
399
383
  <fo:block font-size="12pt" space-before="16pt" font-weight="bold" role="TOCI">
400
384
  <xsl:value-of select="$annexes_title"/>
@@ -402,6 +386,27 @@
402
386
  </xsl:if>
403
387
  <xsl:call-template name="print_JCGN_toc_item"/>
404
388
  </xsl:for-each>
389
+
390
+ <!-- List of Tables -->
391
+ <xsl:if test="$contents//tables/table">
392
+ <xsl:call-template name="insertListOf_Title">
393
+ <xsl:with-param name="title" select="$title-list-tables"/>
394
+ </xsl:call-template>
395
+ <xsl:for-each select="$contents//tables/table">
396
+ <xsl:call-template name="insertListOf_Item"/>
397
+ </xsl:for-each>
398
+ </xsl:if>
399
+
400
+ <!-- List of Figures -->
401
+ <xsl:if test="$contents//figures/figure">
402
+ <xsl:call-template name="insertListOf_Title">
403
+ <xsl:with-param name="title" select="$title-list-figures"/>
404
+ </xsl:call-template>
405
+ <xsl:for-each select="$contents//figures/figure">
406
+ <xsl:call-template name="insertListOf_Item"/>
407
+ </xsl:for-each>
408
+ </xsl:if>
409
+
405
410
  </fo:block>
406
411
  </fo:block-container>
407
412
 
@@ -548,6 +553,32 @@
548
553
  </fo:root>
549
554
  </xsl:template>
550
555
 
556
+ <xsl:template name="insertListOf_Title">
557
+ <xsl:param name="title"/>
558
+ <fo:block font-weight="bold" margin-top="12pt" keep-with-next="always">
559
+ <xsl:value-of select="$title"/>
560
+ </fo:block>
561
+ </xsl:template>
562
+
563
+ <xsl:template name="insertListOf_Item">
564
+ <fo:block margin-left="5mm" role="TOCI">
565
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
566
+ <fo:basic-link internal-destination="{@id}">
567
+ <xsl:call-template name="setAltText">
568
+ <xsl:with-param name="value" select="@alt-text"/>
569
+ </xsl:call-template>
570
+ <fo:inline>
571
+ <xsl:apply-templates select="." mode="contents"/>
572
+ </fo:inline>
573
+ <xsl:text> </xsl:text>
574
+ <fo:inline keep-together.within-line="always" font-weight="normal">
575
+ <fo:leader font-size="9pt" leader-pattern="dots"/>
576
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
577
+ </fo:inline>
578
+ </fo:basic-link>
579
+ </fo:block>
580
+ </fo:block>
581
+ </xsl:template>
551
582
 
552
583
  <xsl:template match="node()">
553
584
  <xsl:apply-templates/>
@@ -622,43 +653,6 @@
622
653
  </xsl:template>
623
654
 
624
655
 
625
-
626
- <xsl:template name="getListItemFormat">
627
- <xsl:choose>
628
- <xsl:when test="local-name(..) = 'ul'">
629
- <xsl:call-template name="setULLabel"/>
630
- </xsl:when>
631
- <xsl:otherwise> <!-- for ordered lists -->
632
- <xsl:variable name="start_value">
633
- <xsl:choose>
634
- <xsl:when test="normalize-space(../@start) != ''">
635
- <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
636
- </xsl:when>
637
- <xsl:otherwise>0</xsl:otherwise>
638
- </xsl:choose>
639
- </xsl:variable>
640
-
641
- <xsl:variable name="curr_value">
642
- <xsl:number/>
643
- </xsl:variable>
644
-
645
- <xsl:variable name="format">
646
- <xsl:choose>
647
- <xsl:when test="../@type = 'arabic'">1.</xsl:when>
648
- <xsl:when test="../@type = 'alphabet'">a)</xsl:when>
649
- <xsl:when test="../@type = 'alphabet_upper'">A.</xsl:when>
650
- <xsl:when test="../@type = 'roman'">i)</xsl:when>
651
- <xsl:when test="../@type = 'roman_upper'">I.</xsl:when>
652
- <xsl:otherwise>a)</xsl:otherwise>
653
- </xsl:choose>
654
- </xsl:variable>
655
-
656
- <xsl:number value="$start_value + $curr_value" format="{$format}" lang="en"/>
657
-
658
- </xsl:otherwise>
659
- </xsl:choose>
660
- </xsl:template>
661
-
662
656
  <xsl:template name="setListItemLabel">
663
657
  <xsl:attribute name="label">
664
658
  <xsl:call-template name="getListItemFormat"/>
@@ -730,32 +724,6 @@
730
724
  </xsl:template>
731
725
 
732
726
 
733
- <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="ul_ol">
734
- <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
735
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
736
- </fo:list-block>
737
- <xsl:for-each select="./*[local-name()='note']">
738
- <xsl:call-template name="note"/>
739
- </xsl:for-each>
740
- </xsl:template>
741
-
742
-
743
- <xsl:template match="*[local-name()='li']">
744
- <fo:list-item id="{@id}">
745
- <fo:list-item-label end-indent="label-end()">
746
- <fo:block>
747
- <xsl:call-template name="getListItemFormat"/>
748
- </fo:block>
749
- </fo:list-item-label>
750
- <fo:list-item-body start-indent="body-start()">
751
- <fo:block>
752
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
753
- <xsl:apply-templates select=".//*[local-name()='note']"/>
754
- </fo:block>
755
- </fo:list-item-body>
756
- </fo:list-item>
757
- </xsl:template>
758
-
759
727
 
760
728
  <!-- for two-columns layout -->
761
729
 
@@ -781,30 +749,15 @@
781
749
  </xsl:template>
782
750
 
783
751
 
784
- <xsl:template match="*[local-name()='preferred']">
785
- <xsl:variable name="level">
786
- <xsl:call-template name="getLevel"/>
787
- </xsl:variable>
788
- <fo:block line-height="1.1" role="H{$level}">
789
- <fo:block font-weight="bold" keep-with-next="always">
790
- <xsl:apply-templates select="ancestor::*[local-name()='term'][1]/*[local-name()='name']"/>
791
- </fo:block>
792
- <fo:block font-weight="bold" keep-with-next="always">
793
- <xsl:call-template name="setStyle_preferred"/>
794
- <xsl:apply-templates/>
795
- </fo:block>
796
- </fo:block>
797
- </xsl:template>
798
-
799
- <xsl:template match="*[local-name()='preferred'][not(parent::*[local-name()='term'])]">
752
+ <xsl:template match="*[local-name()='preferred'][not(parent::*[local-name()='term'])]" priority="2">
800
753
  <xsl:variable name="levelTerm">
801
754
  <xsl:call-template name="getLevelTermName"/>
802
755
  </xsl:variable>
803
- <fo:block line-height="1.1" role="H{$levelTerm}">
804
- <fo:block font-weight="bold" keep-with-next="always">
756
+ <fo:block role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
757
+ <fo:block xsl:use-attribute-sets="term-name-style">
805
758
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
806
759
  </fo:block>
807
- <fo:block font-weight="bold" keep-with-next="always">
760
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
808
761
  <xsl:call-template name="setStyle_preferred"/>
809
762
  <xsl:apply-templates/>
810
763
  </fo:block>
@@ -945,29 +898,6 @@
945
898
  </fo:block>
946
899
  </xsl:template>
947
900
 
948
- <xsl:template match="*[local-name()='formula']/*[local-name()='stem']">
949
- <fo:block margin-top="6pt" margin-bottom="12pt">
950
- <fo:table table-layout="fixed" width="100%">
951
- <fo:table-column column-width="95%"/>
952
- <fo:table-column column-width="5%"/>
953
- <fo:table-body>
954
- <fo:table-row>
955
- <fo:table-cell display-align="center">
956
- <fo:block text-align="left" margin-left="25mm">
957
- <xsl:apply-templates/>
958
- </fo:block>
959
- </fo:table-cell>
960
- <fo:table-cell display-align="center">
961
- <fo:block text-align="right">
962
- <xsl:apply-templates select="../*[local-name()='name']" mode="formula_number"/>
963
- </fo:block>
964
- </fo:table-cell>
965
- </fo:table-row>
966
- </fo:table-body>
967
- </fo:table>
968
- </fo:block>
969
- </xsl:template>
970
-
971
901
 
972
902
  <xsl:template name="printEdition">
973
903
  <xsl:variable name="edition" select="normalize-space(//*[local-name()='bibdata']/*[local-name()='edition'])"/>
@@ -1277,28 +1207,6 @@
1277
1207
  </fo:page-sequence>
1278
1208
  </xsl:template>
1279
1209
 
1280
- <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:title" priority="4"> -->
1281
- <xsl:template match="jcgm:indexsect/jcgm:title" priority="4">
1282
- <fo:block font-weight="bold" span="all" role="H1">
1283
- <!-- Index -->
1284
- <xsl:apply-templates/>
1285
- </fo:block>
1286
- </xsl:template>
1287
-
1288
-
1289
- <!-- <xsl:template match="jcgm:clause[@type = 'index']/jcgm:clause/jcgm:title" priority="4"> -->
1290
- <xsl:template match="jcgm:indexsect/jcgm:clause/jcgm:title" priority="4">
1291
- <!-- Letter A, B, C, ... -->
1292
- <fo:block font-weight="bold" margin-left="25mm" keep-with-next="always">
1293
- <xsl:apply-templates/>
1294
- </fo:block>
1295
- </xsl:template>
1296
-
1297
- <!-- <xsl:template match="jcgm:clause[@type = 'index']//jcgm:ul" priority="4"> -->
1298
- <xsl:template match="jcgm:indexsect//jcgm:ul" priority="4">
1299
- <xsl:apply-templates/>
1300
- </xsl:template>
1301
-
1302
1210
 
1303
1211
  <!-- =================== -->
1304
1212
  <!-- End of Index processing -->
@@ -1649,7 +1557,7 @@
1649
1557
  </term>
1650
1558
  To:
1651
1559
  <term/>
1652
- <name>...</name>
1560
+ <term_name>...</term_name>
1653
1561
  <preferred>...</preferred>
1654
1562
  <definition>...</definition>
1655
1563
  <termsource>...</termsource>
@@ -1852,11 +1760,21 @@
1852
1760
  </fo:block-container>
1853
1761
  </xsl:template>
1854
1762
 
1855
- <xsl:variable name="pageWidth_">
1763
+ <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">
1764
+ <xsl:call-template name="getLang"/>
1765
+ </xsl:variable><xsl:variable name="pageWidth_">
1856
1766
  210
1857
1767
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1858
1768
  297
1859
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
1769
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1770
+ 25
1771
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
1772
+ 15
1773
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
1774
+ 29.5
1775
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1776
+ 23.5
1777
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1860
1778
 
1861
1779
  <title-edition lang="en">
1862
1780
 
@@ -1868,6 +1786,10 @@
1868
1786
  <xsl:text>Édition </xsl:text>
1869
1787
  </title-edition>
1870
1788
 
1789
+ <title-edition lang="ru">
1790
+ <xsl:text>Издание </xsl:text>
1791
+ </title-edition>
1792
+
1871
1793
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1872
1794
  <title-toc lang="en">
1873
1795
 
@@ -1882,7 +1804,7 @@
1882
1804
  <xsl:text>Contents</xsl:text>
1883
1805
 
1884
1806
  </title-toc>
1885
-
1807
+
1886
1808
  <title-descriptors lang="en">Descriptors</title-descriptors>
1887
1809
 
1888
1810
  <title-part lang="en">
@@ -1894,7 +1816,11 @@
1894
1816
 
1895
1817
 
1896
1818
 
1897
- </title-part>
1819
+ </title-part>
1820
+ <title-part lang="ru">
1821
+
1822
+
1823
+ </title-part>
1898
1824
  <title-part lang="zh">第 # 部分:</title-part>
1899
1825
 
1900
1826
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1910,13 +1836,38 @@
1910
1836
 
1911
1837
  <title-summary lang="en">Summary</title-summary>
1912
1838
 
1839
+ <title-continued lang="ru">(продолжение)</title-continued>
1913
1840
  <title-continued lang="en">(continued)</title-continued>
1914
1841
  <title-continued lang="fr">(continué)</title-continued>
1915
1842
 
1916
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
1843
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
1844
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1845
+ <xsl:value-of select="$toc_table_title"/>
1846
+ <xsl:if test="normalize-space($toc_table_title) = ''">
1847
+ <xsl:call-template name="getTitle">
1848
+ <xsl:with-param name="name" select="'title-list-tables'"/>
1849
+ </xsl:call-template>
1850
+ </xsl:if>
1851
+ </xsl:variable><xsl:variable name="title-list-figures">
1852
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1853
+ <xsl:value-of select="$toc_figure_title"/>
1854
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
1855
+ <xsl:call-template name="getTitle">
1856
+ <xsl:with-param name="name" select="'title-list-figures'"/>
1857
+ </xsl:call-template>
1858
+ </xsl:if>
1859
+ </xsl:variable><xsl:variable name="title-list-recommendations">
1860
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1861
+ <xsl:value-of select="$toc_requirement_title"/>
1862
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
1863
+ <xsl:call-template name="getTitle">
1864
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
1865
+ </xsl:call-template>
1866
+ </xsl:if>
1867
+ </xsl:variable><xsl:variable name="bibdata">
1917
1868
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1918
1869
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1919
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1870
+ </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">
1920
1871
  <xsl:param name="name"/>
1921
1872
  <xsl:param name="lang"/>
1922
1873
  <xsl:variable name="lang_">
@@ -1939,7 +1890,7 @@
1939
1890
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1940
1891
  </xsl:otherwise>
1941
1892
  </xsl:choose>
1942
- </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">
1893
+ </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">
1943
1894
 
1944
1895
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
1945
1896
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
@@ -2105,11 +2056,11 @@
2105
2056
 
2106
2057
 
2107
2058
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2108
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2109
2059
 
2110
2060
 
2111
2061
 
2112
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
2062
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
2063
+
2113
2064
 
2114
2065
 
2115
2066
 
@@ -2506,13 +2457,12 @@
2506
2457
 
2507
2458
 
2508
2459
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2509
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2460
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
2461
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
2510
2462
 
2511
2463
 
2512
2464
 
2513
2465
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2514
- <xsl:attribute name="margin-left">12mm</xsl:attribute>
2515
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
2516
2466
  <xsl:attribute name="font-style">italic</xsl:attribute>
2517
2467
  <xsl:attribute name="text-align">justify</xsl:attribute>
2518
2468
 
@@ -2521,10 +2471,8 @@
2521
2471
 
2522
2472
 
2523
2473
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2474
+ <xsl:attribute name="text-align">right</xsl:attribute>
2524
2475
 
2525
-
2526
- <xsl:attribute name="text-align">right</xsl:attribute>
2527
-
2528
2476
 
2529
2477
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2530
2478
 
@@ -2548,6 +2496,9 @@
2548
2496
 
2549
2497
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2550
2498
 
2499
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
2500
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2501
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2551
2502
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
2552
2503
 
2553
2504
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -2578,6 +2529,37 @@
2578
2529
 
2579
2530
 
2580
2531
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2532
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2533
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2534
+
2535
+
2536
+
2537
+
2538
+
2539
+
2540
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2541
+ <xsl:attribute name="text-align">center</xsl:attribute>
2542
+
2543
+
2544
+
2545
+
2546
+
2547
+
2548
+
2549
+ <xsl:attribute name="text-align">left</xsl:attribute>
2550
+ <xsl:attribute name="margin-left">25mm</xsl:attribute>
2551
+
2552
+
2553
+
2554
+
2555
+
2556
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2557
+ <xsl:attribute name="text-align">right</xsl:attribute>
2558
+
2559
+
2560
+
2561
+
2562
+
2581
2563
 
2582
2564
  </xsl:attribute-set><xsl:attribute-set name="image-style">
2583
2565
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -2613,6 +2595,20 @@
2613
2595
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2614
2596
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2615
2597
 
2598
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2599
+
2600
+
2601
+
2602
+
2603
+
2604
+ <xsl:attribute name="line-height">1.1</xsl:attribute>
2605
+
2606
+
2607
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2608
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2609
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2610
+
2611
+
2616
2612
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
2617
2613
 
2618
2614
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -2633,13 +2629,19 @@
2633
2629
  </xsl:attribute-set><xsl:variable name="color-added-text">
2634
2630
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2635
2631
  </xsl:variable><xsl:attribute-set name="add-style">
2636
- <xsl:attribute name="color">red</xsl:attribute>
2637
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2638
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2639
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2640
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2641
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2642
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2632
+
2633
+ <xsl:attribute name="color">red</xsl:attribute>
2634
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2635
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2636
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2637
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2638
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2639
+
2640
+ </xsl:attribute-set><xsl:variable name="add-style">
2641
+ <add-style xsl:use-attribute-sets="add-style"/>
2642
+ </xsl:variable><xsl:template name="append_add-style">
2643
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2644
+ </xsl:template><xsl:variable name="color-deleted-text">
2643
2645
  <xsl:text>red</xsl:text>
2644
2646
  </xsl:variable><xsl:attribute-set name="del-style">
2645
2647
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -2650,6 +2652,36 @@
2650
2652
 
2651
2653
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2652
2654
 
2655
+
2656
+
2657
+
2658
+
2659
+
2660
+
2661
+
2662
+ <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
2663
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2664
+
2665
+
2666
+
2667
+
2668
+
2669
+
2670
+
2671
+
2672
+
2673
+
2674
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2675
+
2676
+
2677
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2678
+
2679
+
2680
+
2681
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2682
+
2683
+
2684
+
2653
2685
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2654
2686
  <xsl:attribute name="line-height">135%</xsl:attribute>
2655
2687
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -2922,15 +2954,154 @@
2922
2954
 
2923
2955
 
2924
2956
 
2957
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
2958
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2959
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
2960
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2961
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
2962
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2963
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
2964
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2965
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
2966
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2967
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
2968
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2969
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
2970
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2971
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
2972
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2973
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
2974
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2975
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
2976
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2977
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
2978
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2979
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
2980
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2981
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
2982
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2983
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
2984
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2985
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
2986
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2987
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
2988
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2989
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
2990
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2991
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
2992
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2993
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
2994
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2995
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
2996
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2997
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
2998
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2999
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
3000
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3001
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
3002
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3003
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
3004
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3005
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
3006
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3007
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
3008
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3009
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
3010
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3011
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
3012
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3013
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
3014
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3015
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
3016
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3017
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
3018
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3019
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
3020
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3021
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
3022
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3023
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
3024
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3025
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
3026
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3027
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3028
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
3029
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
3030
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
3031
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3032
+ <xsl:attribute name="font-style">italic</xsl:attribute>
3033
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
3034
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3035
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3036
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
3037
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3038
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
3039
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
3040
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
3041
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
3042
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
3043
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
3044
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
3045
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
3046
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
3047
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
3048
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
3049
+ <xsl:attribute name="role">H1</xsl:attribute>
3050
+
3051
+
3052
+
3053
+
3054
+
3055
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3056
+ <xsl:attribute name="span">all</xsl:attribute>
3057
+
3058
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
3059
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3060
+
3061
+
3062
+
3063
+
3064
+
3065
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3066
+ <xsl:attribute name="margin-left">25mm</xsl:attribute>
3067
+
2925
3068
  </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">
3069
+ <xsl:variable name="nodes_preface_">
3070
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3071
+ <node id="{@id}"/>
3072
+ </xsl:for-each>
3073
+ </xsl:variable>
3074
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3075
+
2926
3076
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2927
3077
  <xsl:sort select="@displayorder" data-type="number"/>
3078
+
3079
+ <!-- process Section's title -->
3080
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3081
+ <xsl:if test="$preceding-sibling_id != ''">
3082
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3083
+ </xsl:if>
3084
+
2928
3085
  <xsl:apply-templates select="." mode="contents"/>
2929
3086
  </xsl:for-each>
2930
3087
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2931
3088
 
3089
+ <xsl:variable name="nodes_sections_">
3090
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
3091
+ <node id="{@id}"/>
3092
+ </xsl:for-each>
3093
+ </xsl:variable>
3094
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
3095
+
2932
3096
  <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']]">
2933
3097
  <xsl:sort select="@displayorder" data-type="number"/>
3098
+
3099
+ <!-- process Section's title -->
3100
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3101
+ <xsl:if test="$preceding-sibling_id != ''">
3102
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3103
+ </xsl:if>
3104
+
2934
3105
  <xsl:apply-templates select="." mode="contents"/>
2935
3106
  </xsl:for-each>
2936
3107
 
@@ -2943,6 +3114,30 @@
2943
3114
  <xsl:sort select="@displayorder" data-type="number"/>
2944
3115
  <xsl:apply-templates select="." mode="contents"/>
2945
3116
  </xsl:for-each>
3117
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
3118
+ <xsl:param name="always"/>
3119
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3120
+ <xsl:call-template name="processTables_Contents"/>
3121
+ </xsl:if>
3122
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3123
+ <xsl:call-template name="processFigures_Contents"/>
3124
+ </xsl:if>
3125
+ </xsl:template><xsl:template name="processTables_Contents">
3126
+ <tables>
3127
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3128
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3129
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3130
+ </table>
3131
+ </xsl:for-each>
3132
+ </tables>
3133
+ </xsl:template><xsl:template name="processFigures_Contents">
3134
+ <figures>
3135
+ <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) != '']">
3136
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3137
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3138
+ </figure>
3139
+ </xsl:for-each>
3140
+ </figures>
2946
3141
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2947
3142
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2948
3143
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -3008,9 +3203,12 @@
3008
3203
 
3009
3204
 
3010
3205
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
3206
+ <xsl:param name="margin"/>
3011
3207
 
3012
3208
  <!-- process in the template 'paragraph' -->
3013
- <xsl:call-template name="paragraph"/>
3209
+ <xsl:call-template name="paragraph">
3210
+ <xsl:with-param name="margin" select="$margin"/>
3211
+ </xsl:call-template>
3014
3212
 
3015
3213
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
3016
3214
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -3022,9 +3220,12 @@
3022
3220
  <xsl:call-template name="title"/>
3023
3221
 
3024
3222
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
3223
+ <xsl:param name="margin"/>
3025
3224
 
3026
3225
  <!-- process in the template 'paragraph' -->
3027
- <xsl:call-template name="paragraph"/>
3226
+ <xsl:call-template name="paragraph">
3227
+ <xsl:with-param name="margin" select="$margin"/>
3228
+ </xsl:call-template>
3028
3229
 
3029
3230
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3030
3231
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -3059,7 +3260,7 @@
3059
3260
  </xsl:call-template>
3060
3261
  </xsl:if>
3061
3262
  </xsl:variable>
3062
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3263
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3063
3264
 
3064
3265
 
3065
3266
  <xsl:variable name="margin-side">
@@ -3325,7 +3526,7 @@
3325
3526
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3326
3527
  <!-- 2009 thinspace -->
3327
3528
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3328
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3529
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3329
3530
  </xsl:call-template>
3330
3531
  </xsl:variable>
3331
3532
  <xsl:variable name="max_length">
@@ -3366,8 +3567,7 @@
3366
3567
  </xsl:call-template>
3367
3568
  </xsl:if>
3368
3569
  </xsl:template><xsl:template match="text()" mode="td_text">
3369
- <xsl:variable name="zero-space">​</xsl:variable>
3370
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3570
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3371
3571
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3372
3572
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3373
3573
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -3788,37 +3988,7 @@
3788
3988
 
3789
3989
  <!-- list of footnotes to calculate actual footnotes number -->
3790
3990
  <xsl:variable name="p_fn_">
3791
- <xsl:choose>
3792
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3793
- <fn gen_id="{generate-id(.)}">
3794
- <xsl:copy-of select="@*"/>
3795
- <xsl:copy-of select="node()"/>
3796
- </fn>
3797
- </xsl:when>
3798
- <xsl:otherwise>
3799
- <!-- itetation for:
3800
- footnotes in bibdata/title
3801
- footnotes in bibliography
3802
- footnotes in document's body (except table's head/body/foot and figure text)
3803
- -->
3804
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3805
- <fn gen_id="{generate-id(.)}">
3806
- <xsl:copy-of select="@*"/>
3807
- <xsl:copy-of select="node()"/>
3808
- </fn>
3809
- </xsl:for-each>
3810
- <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']/*">
3811
- <xsl:sort select="@displayorder" data-type="number"/>
3812
- <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])]">
3813
- <!-- copy unique fn -->
3814
- <fn gen_id="{generate-id(.)}">
3815
- <xsl:copy-of select="@*"/>
3816
- <xsl:copy-of select="node()"/>
3817
- </fn>
3818
- </xsl:for-each>
3819
- </xsl:for-each>
3820
- </xsl:otherwise>
3821
- </xsl:choose>
3991
+ <xsl:call-template name="get_fn_list"/>
3822
3992
  </xsl:variable>
3823
3993
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3824
3994
 
@@ -3879,6 +4049,38 @@
3879
4049
  <xsl:copy-of select="$footnote_inline"/>
3880
4050
  </xsl:otherwise>
3881
4051
  </xsl:choose>
4052
+ </xsl:template><xsl:template name="get_fn_list">
4053
+ <xsl:choose>
4054
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4055
+ <fn gen_id="{generate-id(.)}">
4056
+ <xsl:copy-of select="@*"/>
4057
+ <xsl:copy-of select="node()"/>
4058
+ </fn>
4059
+ </xsl:when>
4060
+ <xsl:otherwise>
4061
+ <!-- itetation for:
4062
+ footnotes in bibdata/title
4063
+ footnotes in bibliography
4064
+ footnotes in document's body (except table's head/body/foot and figure text)
4065
+ -->
4066
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4067
+ <fn gen_id="{generate-id(.)}">
4068
+ <xsl:copy-of select="@*"/>
4069
+ <xsl:copy-of select="node()"/>
4070
+ </fn>
4071
+ </xsl:for-each>
4072
+ <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']/*">
4073
+ <xsl:sort select="@displayorder" data-type="number"/>
4074
+ <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])]">
4075
+ <!-- copy unique fn -->
4076
+ <fn gen_id="{generate-id(.)}">
4077
+ <xsl:copy-of select="@*"/>
4078
+ <xsl:copy-of select="node()"/>
4079
+ </fn>
4080
+ </xsl:for-each>
4081
+ </xsl:for-each>
4082
+ </xsl:otherwise>
4083
+ </xsl:choose>
3882
4084
  </xsl:template><xsl:template name="table_fn_display">
3883
4085
  <xsl:variable name="references">
3884
4086
 
@@ -4055,7 +4257,7 @@
4055
4257
  </fo:inline>
4056
4258
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4057
4259
  <fo:inline><xsl:value-of select="."/></fo:inline>
4058
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4260
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4059
4261
  <fo:inline>
4060
4262
  <xsl:apply-templates/>
4061
4263
  </fo:inline>
@@ -4432,20 +4634,44 @@
4432
4634
  <fo:inline text-decoration="underline">
4433
4635
  <xsl:apply-templates/>
4434
4636
  </fo:inline>
4435
- </xsl:template><xsl:template match="*[local-name()='add']">
4637
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
4436
4638
  <xsl:param name="skip">true</xsl:param>
4639
+ <xsl:param name="block">false</xsl:param>
4640
+ <xsl:param name="type"/>
4641
+ <xsl:param name="text-align"/>
4437
4642
  <xsl:choose>
4438
4643
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4439
4644
  <xsl:choose>
4440
- <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>
4645
+ <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>
4441
4646
  <xsl:otherwise>
4442
- <fo:inline>
4647
+ <xsl:variable name="tag">
4443
4648
  <xsl:call-template name="insertTag">
4444
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4649
+ <xsl:with-param name="type">
4650
+ <xsl:choose>
4651
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4652
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4653
+ </xsl:choose>
4654
+ </xsl:with-param>
4445
4655
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4446
4656
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4447
4657
  </xsl:call-template>
4448
- </fo:inline>
4658
+ </xsl:variable>
4659
+ <xsl:choose>
4660
+ <xsl:when test="$block = 'false'">
4661
+ <fo:inline>
4662
+ <xsl:copy-of select="$tag"/>
4663
+ </fo:inline>
4664
+ </xsl:when>
4665
+ <xsl:otherwise>
4666
+ <fo:block> <!-- for around figures -->
4667
+ <xsl:if test="$text-align != ''">
4668
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4669
+ </xsl:if>
4670
+ <xsl:copy-of select="$tag"/>
4671
+ </fo:block>
4672
+ </xsl:otherwise>
4673
+ </xsl:choose>
4674
+
4449
4675
  </xsl:otherwise>
4450
4676
  </xsl:choose>
4451
4677
  </xsl:when>
@@ -4804,17 +5030,21 @@
4804
5030
  </xsl:apply-templates>
4805
5031
  </xsl:template><xsl:template name="getLang">
4806
5032
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4807
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4808
5033
  <xsl:variable name="language">
4809
5034
  <xsl:choose>
4810
5035
  <xsl:when test="$language_current != ''">
4811
5036
  <xsl:value-of select="$language_current"/>
4812
5037
  </xsl:when>
4813
- <xsl:when test="$language_current_2 != ''">
4814
- <xsl:value-of select="$language_current_2"/>
4815
- </xsl:when>
4816
5038
  <xsl:otherwise>
4817
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5039
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5040
+ <xsl:choose>
5041
+ <xsl:when test="$language_current_2 != ''">
5042
+ <xsl:value-of select="$language_current_2"/>
5043
+ </xsl:when>
5044
+ <xsl:otherwise>
5045
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5046
+ </xsl:otherwise>
5047
+ </xsl:choose>
4818
5048
  </xsl:otherwise>
4819
5049
  </xsl:choose>
4820
5050
  </xsl:variable>
@@ -5017,6 +5247,9 @@
5017
5247
  </fo:inline>
5018
5248
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5019
5249
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5250
+ <xsl:if test="parent::*[local-name() = 'add']">
5251
+ <xsl:call-template name="append_add-style"/>
5252
+ </xsl:if>
5020
5253
  <xsl:apply-templates/>
5021
5254
  </fo:basic-link>
5022
5255
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -5031,8 +5264,8 @@
5031
5264
 
5032
5265
  </xsl:if>
5033
5266
  <fo:block-container margin-left="0mm">
5034
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
5035
- <xsl:apply-templates/>
5267
+ <fo:block id="{@id}">
5268
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
5036
5269
  </fo:block>
5037
5270
  </fo:block-container>
5038
5271
  </fo:block-container>
@@ -5044,10 +5277,43 @@
5044
5277
  <fo:inline>
5045
5278
  <xsl:apply-templates/>
5046
5279
  </fo:inline>
5047
- </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 -->
5280
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
5048
5281
  <xsl:if test="normalize-space() != ''">
5049
5282
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
5050
5283
  </xsl:if>
5284
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
5285
+ <fo:block xsl:use-attribute-sets="formula-style">
5286
+
5287
+
5288
+
5289
+ <fo:table table-layout="fixed" width="100%">
5290
+ <fo:table-column column-width="95%"/>
5291
+ <fo:table-column column-width="5%"/>
5292
+ <fo:table-body>
5293
+ <fo:table-row>
5294
+ <fo:table-cell display-align="center">
5295
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5296
+
5297
+
5298
+
5299
+ <xsl:apply-templates/>
5300
+ </fo:block>
5301
+ </fo:table-cell>
5302
+ <fo:table-cell display-align="center">
5303
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
5304
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
5305
+ </fo:block>
5306
+ </fo:table-cell>
5307
+ </fo:table-row>
5308
+ </fo:table-body>
5309
+ </fo:table>
5310
+ </fo:block>
5311
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
5312
+ <fo:block xsl:use-attribute-sets="formula-style">
5313
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5314
+ <xsl:apply-templates/>
5315
+ </fo:block>
5316
+ </fo:block>
5051
5317
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
5052
5318
 
5053
5319
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -5081,6 +5347,13 @@
5081
5347
 
5082
5348
 
5083
5349
 
5350
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5351
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5352
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5353
+ <xsl:call-template name="append_add-style"/>
5354
+ </xsl:if>
5355
+
5356
+
5084
5357
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
5085
5358
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
5086
5359
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -5119,6 +5392,12 @@
5119
5392
 
5120
5393
 
5121
5394
 
5395
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5396
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5397
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5398
+ <xsl:call-template name="append_add-style"/>
5399
+ </xsl:if>
5400
+
5122
5401
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5123
5402
 
5124
5403
  </fo:inline>
@@ -5170,6 +5449,7 @@
5170
5449
  </fo:block>
5171
5450
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5172
5451
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5452
+
5173
5453
 
5174
5454
 
5175
5455
 
@@ -5606,7 +5886,11 @@
5606
5886
  <xsl:value-of select="."/>
5607
5887
  </xsl:template><xsl:template match="node()" mode="contents">
5608
5888
  <xsl:apply-templates mode="contents"/>
5609
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
5889
+ </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">
5890
+ <xsl:call-template name="contents_section-title"/>
5891
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
5892
+ <xsl:call-template name="contents_section-title"/>
5893
+ </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">
5610
5894
  <xsl:variable name="level">
5611
5895
  <xsl:call-template name="getLevel">
5612
5896
  <xsl:with-param name="depth" select="@depth"/>
@@ -5675,13 +5959,14 @@
5675
5959
  <xsl:apply-templates mode="bookmarks"/>
5676
5960
  </xsl:template><xsl:template name="addBookmarks">
5677
5961
  <xsl:param name="contents"/>
5678
- <xsl:if test="xalan:nodeset($contents)//item">
5962
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5963
+ <xsl:if test="$contents_nodes//item">
5679
5964
  <fo:bookmark-tree>
5680
5965
  <xsl:choose>
5681
- <xsl:when test="xalan:nodeset($contents)/doc">
5966
+ <xsl:when test="$contents_nodes/doc">
5682
5967
  <xsl:choose>
5683
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5684
- <xsl:for-each select="xalan:nodeset($contents)/doc">
5968
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
5969
+ <xsl:for-each select="$contents_nodes/doc">
5685
5970
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5686
5971
  <xsl:if test="@bundle = 'true'">
5687
5972
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -5732,7 +6017,7 @@
5732
6017
  </xsl:for-each>
5733
6018
  </xsl:when>
5734
6019
  <xsl:otherwise>
5735
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6020
+ <xsl:for-each select="$contents_nodes/doc">
5736
6021
 
5737
6022
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5738
6023
 
@@ -5750,25 +6035,36 @@
5750
6035
  </xsl:choose>
5751
6036
  </xsl:when>
5752
6037
  <xsl:otherwise>
5753
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
6038
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
6039
+
6040
+ <xsl:call-template name="insertFigureBookmarks">
6041
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6042
+ </xsl:call-template>
6043
+
6044
+ <xsl:call-template name="insertTableBookmarks">
6045
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6046
+ <xsl:with-param name="lang" select="@lang"/>
6047
+ </xsl:call-template>
6048
+
5754
6049
  </xsl:otherwise>
5755
6050
  </xsl:choose>
5756
6051
 
6052
+
5757
6053
 
5758
6054
 
5759
6055
 
5760
6056
 
5761
-
5762
-
6057
+
5763
6058
 
5764
6059
  </fo:bookmark-tree>
5765
6060
  </xsl:if>
5766
6061
  </xsl:template><xsl:template name="insertFigureBookmarks">
5767
6062
  <xsl:param name="contents"/>
5768
- <xsl:if test="xalan:nodeset($contents)/figure">
5769
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
6063
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6064
+ <xsl:if test="$contents_nodes/figure">
6065
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
5770
6066
  <fo:bookmark-title>Figures</fo:bookmark-title>
5771
- <xsl:for-each select="xalan:nodeset($contents)/figure">
6067
+ <xsl:for-each select="$contents_nodes/figure">
5772
6068
  <fo:bookmark internal-destination="{@id}">
5773
6069
  <fo:bookmark-title>
5774
6070
  <xsl:value-of select="normalize-space(title)"/>
@@ -5777,18 +6073,40 @@
5777
6073
  </xsl:for-each>
5778
6074
  </fo:bookmark>
5779
6075
  </xsl:if>
6076
+
6077
+
6078
+ <xsl:if test="$contents_nodes//figures/figure">
6079
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6080
+
6081
+
6082
+
6083
+ <xsl:variable name="bookmark-title">
6084
+
6085
+ <xsl:value-of select="$title-list-figures"/>
6086
+
6087
+ </xsl:variable>
6088
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
6089
+ <xsl:for-each select="$contents_nodes//figures/figure">
6090
+ <fo:bookmark internal-destination="{@id}">
6091
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6092
+ </fo:bookmark>
6093
+ </xsl:for-each>
6094
+ </fo:bookmark>
6095
+ </xsl:if>
6096
+
5780
6097
  </xsl:template><xsl:template name="insertTableBookmarks">
5781
6098
  <xsl:param name="contents"/>
5782
6099
  <xsl:param name="lang"/>
5783
- <xsl:if test="xalan:nodeset($contents)/table">
5784
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
6100
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6101
+ <xsl:if test="$contents_nodes/table">
6102
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
5785
6103
  <fo:bookmark-title>
5786
6104
  <xsl:choose>
5787
6105
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
5788
6106
  <xsl:otherwise>Tables</xsl:otherwise>
5789
6107
  </xsl:choose>
5790
6108
  </fo:bookmark-title>
5791
- <xsl:for-each select="xalan:nodeset($contents)/table">
6109
+ <xsl:for-each select="$contents_nodes/table">
5792
6110
  <fo:bookmark internal-destination="{@id}">
5793
6111
  <fo:bookmark-title>
5794
6112
  <xsl:value-of select="normalize-space(title)"/>
@@ -5797,6 +6115,29 @@
5797
6115
  </xsl:for-each>
5798
6116
  </fo:bookmark>
5799
6117
  </xsl:if>
6118
+
6119
+
6120
+ <xsl:if test="$contents_nodes//tables/table">
6121
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6122
+
6123
+
6124
+
6125
+ <xsl:variable name="bookmark-title">
6126
+
6127
+ <xsl:value-of select="$title-list-tables"/>
6128
+
6129
+ </xsl:variable>
6130
+
6131
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
6132
+
6133
+ <xsl:for-each select="$contents_nodes//tables/table">
6134
+ <fo:bookmark internal-destination="{@id}">
6135
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6136
+ </fo:bookmark>
6137
+ </xsl:for-each>
6138
+ </fo:bookmark>
6139
+ </xsl:if>
6140
+
5800
6141
  </xsl:template><xsl:template name="getLangVersion">
5801
6142
  <xsl:param name="lang"/>
5802
6143
  <xsl:param name="doctype" select="''"/>
@@ -5995,12 +6336,140 @@
5995
6336
  </fo:block-container>
5996
6337
  </fo:block-container>
5997
6338
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5998
- <xsl:variable name="text">
6339
+ <xsl:choose>
6340
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6341
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6342
+ <xsl:choose>
6343
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
6344
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
6345
+ </xsl:when>
6346
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
6347
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6348
+ </xsl:otherwise>
6349
+ </xsl:choose>
6350
+ </xsl:when>
6351
+ <xsl:otherwise>
6352
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6353
+ </xsl:otherwise>
6354
+ </xsl:choose>
6355
+
6356
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
6357
+ <xsl:variable name="text_step1">
5999
6358
  <xsl:call-template name="add-zero-spaces-equal"/>
6000
6359
  </xsl:variable>
6001
- <xsl:call-template name="add-zero-spaces-java">
6002
- <xsl:with-param name="text" select="$text"/>
6003
- </xsl:call-template>
6360
+ <xsl:variable name="text_step2">
6361
+ <xsl:call-template name="add-zero-spaces-java">
6362
+ <xsl:with-param name="text" select="$text_step1"/>
6363
+ </xsl:call-template>
6364
+ </xsl:variable>
6365
+ <xsl:value-of select="$text_step2"/>
6366
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
6367
+ <xsl:apply-templates mode="syntax_highlight"/>
6368
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
6369
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
6370
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
6371
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
6372
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
6373
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
6374
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
6375
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
6376
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
6377
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
6378
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
6379
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
6380
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
6381
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
6382
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
6383
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
6384
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
6385
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
6386
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
6387
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
6388
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
6389
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
6390
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
6391
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
6392
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
6393
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
6394
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
6395
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
6396
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
6397
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
6398
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
6399
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
6400
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
6401
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
6402
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
6403
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
6404
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
6405
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
6406
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
6407
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
6408
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
6409
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
6410
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
6411
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
6412
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
6413
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
6414
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
6415
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
6416
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
6417
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
6418
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
6419
+ <fo:inline>
6420
+ <xsl:variable name="classes_">
6421
+ <xsl:call-template name="split">
6422
+ <xsl:with-param name="pText" select="@class"/>
6423
+ <xsl:with-param name="sep" select="' '"/>
6424
+ </xsl:call-template>
6425
+ <!-- a few classes together (_and_ suffix) -->
6426
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
6427
+ <item>hljs-char_and_escape_</item>
6428
+ </xsl:if>
6429
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
6430
+ <item>hljs-title_and_class_</item>
6431
+ </xsl:if>
6432
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
6433
+ <item>hljs-title_and_class__and_inherited__</item>
6434
+ </xsl:if>
6435
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
6436
+ <item>hljs-title_and_function_</item>
6437
+ </xsl:if>
6438
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
6439
+ <item>hljs-variable_and_language_</item>
6440
+ </xsl:if>
6441
+ <!-- with parent classes (_ suffix) -->
6442
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
6443
+ <item>hljs-meta_hljs-keyword</item>
6444
+ </xsl:if>
6445
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
6446
+ <item>hljs-meta_hljs-string</item>
6447
+ </xsl:if>
6448
+ </xsl:variable>
6449
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
6450
+
6451
+ <xsl:for-each select="$classes/item">
6452
+ <xsl:variable name="class_name" select="."/>
6453
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6454
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6455
+ </xsl:for-each>
6456
+ </xsl:for-each>
6457
+
6458
+ <!-- <xsl:variable name="class_name">
6459
+ <xsl:choose>
6460
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
6461
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
6462
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
6463
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
6464
+ </xsl:choose>
6465
+ </xsl:variable>
6466
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6467
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6468
+ </xsl:for-each> -->
6469
+
6470
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
6471
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
6472
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6004
6473
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
6005
6474
  <xsl:if test="normalize-space() != ''">
6006
6475
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -6330,6 +6799,8 @@
6330
6799
  </xsl:otherwise>
6331
6800
  </xsl:choose> -->
6332
6801
  </fo:block>
6802
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6803
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6333
6804
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6334
6805
  <xsl:if test="normalize-space() != ''">
6335
6806
  <xsl:value-of select="."/>
@@ -6380,8 +6851,7 @@
6380
6851
  </xsl:if>
6381
6852
 
6382
6853
  <fo:block-container margin-left="0mm">
6383
-
6384
- <fo:block xsl:use-attribute-sets="quote-style">
6854
+ <fo:block-container xsl:use-attribute-sets="quote-style">
6385
6855
 
6386
6856
  <xsl:if test="ancestor::*[local-name() = 'boilerplate']">
6387
6857
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
@@ -6389,8 +6859,12 @@
6389
6859
  <xsl:attribute name="font-style">normal</xsl:attribute>
6390
6860
  </xsl:if>
6391
6861
 
6392
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6393
- </fo:block>
6862
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6863
+ <fo:block role="BlockQuote">
6864
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6865
+ </fo:block>
6866
+ </fo:block-container>
6867
+ </fo:block-container>
6394
6868
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
6395
6869
  <fo:block xsl:use-attribute-sets="quote-source-style">
6396
6870
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -6411,26 +6885,11 @@
6411
6885
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6412
6886
  <xsl:text>— </xsl:text>
6413
6887
  <xsl:apply-templates/>
6414
- </xsl:template><xsl:variable name="bibitem_hidden_">
6415
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6416
- <xsl:copy-of select="."/>
6417
- </xsl:for-each>
6418
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6419
- <xsl:copy-of select="."/>
6420
- </xsl:for-each>
6421
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6422
-
6423
- <xsl:variable name="bibitemid">
6424
- <xsl:choose>
6425
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6426
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6427
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6428
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6429
- </xsl:choose>
6430
- </xsl:variable>
6431
-
6888
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
6889
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
6890
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6432
6891
  <xsl:choose>
6433
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
6892
+ <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) -->
6434
6893
  <fo:inline xsl:use-attribute-sets="eref-style">
6435
6894
  <xsl:if test="@type = 'footnote'">
6436
6895
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6444,8 +6903,8 @@
6444
6903
  <xsl:variable name="text" select="normalize-space()"/>
6445
6904
 
6446
6905
 
6447
-
6448
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6906
+
6907
+ <fo:basic-link fox:alt-text="{@citeas}">
6449
6908
  <xsl:if test="normalize-space(@citeas) = ''">
6450
6909
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6451
6910
  </xsl:if>
@@ -6455,14 +6914,21 @@
6455
6914
 
6456
6915
  </xsl:if>
6457
6916
 
6458
-
6917
+ <xsl:choose>
6918
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
6919
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
6920
+ </xsl:when>
6921
+ <xsl:otherwise>
6922
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6923
+ </xsl:otherwise>
6924
+ </xsl:choose>
6459
6925
 
6460
6926
  <xsl:apply-templates/>
6461
6927
  </fo:basic-link>
6462
-
6928
+
6463
6929
  </fo:inline>
6464
6930
  </xsl:when>
6465
- <xsl:otherwise>
6931
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6466
6932
  <fo:inline><xsl:apply-templates/></fo:inline>
6467
6933
  </xsl:otherwise>
6468
6934
  </xsl:choose>
@@ -6535,6 +7001,31 @@
6535
7001
  <xsl:with-param name="count" select="$count - 1"/>
6536
7002
  </xsl:call-template>
6537
7003
  </xsl:if>
7004
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
7005
+ <xsl:variable name="level">
7006
+ <xsl:call-template name="getLevel"/>
7007
+ </xsl:variable>
7008
+ <xsl:variable name="font-size">
7009
+ inherit
7010
+ </xsl:variable>
7011
+ <xsl:variable name="levelTerm">
7012
+ <xsl:call-template name="getLevelTermName"/>
7013
+ </xsl:variable>
7014
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
7015
+
7016
+
7017
+
7018
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
7019
+ <fo:block xsl:use-attribute-sets="term-name-style">
7020
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
7021
+ </fo:block>
7022
+ </xsl:if>
7023
+
7024
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
7025
+ <xsl:call-template name="setStyle_preferred"/>
7026
+ <xsl:apply-templates/>
7027
+ </fo:block>
7028
+ </fo:block>
6538
7029
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
6539
7030
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
6540
7031
  <xsl:text> </xsl:text>
@@ -6627,26 +7118,10 @@
6627
7118
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6628
7119
  </xsl:template><xsl:variable name="ul_labels_">
6629
7120
 
6630
-
6631
-
6632
-
6633
-
6634
-
6635
-
6636
-
6637
- <label level="1">—</label> <!-- em dash -->
6638
- <label level="2">−</label><!-- minus sign -->
6639
- <label level="3" font-size="75%">o</label> <!-- white circle -->
6640
-
6641
-
6642
-
6643
-
6644
-
6645
-
6646
-
6647
-
6648
-
6649
-
7121
+ <label level="1">—</label> <!-- em dash -->
7122
+ <label level="2">−</label><!-- minus sign -->
7123
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
7124
+
6650
7125
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6651
7126
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6652
7127
  <xsl:variable name="list_level">
@@ -6672,6 +7147,91 @@
6672
7147
  </xsl:template><xsl:template match="label" mode="ul_labels">
6673
7148
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6674
7149
  <xsl:value-of select="."/>
7150
+ </xsl:template><xsl:template name="getListItemFormat">
7151
+ <!-- Example: for BSI <?list-type loweralpha?> -->
7152
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
7153
+ <xsl:choose>
7154
+ <xsl:when test="local-name(..) = 'ul'">
7155
+ <xsl:choose>
7156
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
7157
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
7158
+ </xsl:choose>
7159
+ </xsl:when>
7160
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
7161
+
7162
+ <!-- Example: for BSI <?list-start 2?> -->
7163
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
7164
+
7165
+ <xsl:variable name="start_value">
7166
+ <xsl:choose>
7167
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
7168
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7169
+ </xsl:when>
7170
+ <xsl:when test="normalize-space(../@start) != ''">
7171
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7172
+ </xsl:when>
7173
+ <xsl:otherwise>0</xsl:otherwise>
7174
+ </xsl:choose>
7175
+ </xsl:variable>
7176
+
7177
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
7178
+
7179
+ <xsl:variable name="type">
7180
+ <xsl:choose>
7181
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
7182
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
7183
+
7184
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
7185
+
7186
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
7187
+ <xsl:variable name="list_level">
7188
+ <xsl:choose>
7189
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
7190
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
7191
+ </xsl:choose>
7192
+ </xsl:variable>
7193
+
7194
+ <xsl:choose>
7195
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
7196
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
7197
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
7198
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
7199
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
7200
+ <xsl:otherwise> <!-- level 1 -->
7201
+ <xsl:choose>
7202
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
7203
+ <xsl:otherwise>alphabet</xsl:otherwise>
7204
+ </xsl:choose>
7205
+ </xsl:otherwise>
7206
+ </xsl:choose>
7207
+
7208
+ </xsl:otherwise>
7209
+ </xsl:choose>
7210
+ </xsl:variable>
7211
+
7212
+ <xsl:variable name="format">
7213
+ <xsl:choose>
7214
+ <xsl:when test="$type = 'arabic'">
7215
+ 1.
7216
+ </xsl:when>
7217
+ <xsl:when test="$type = 'alphabet'">
7218
+ a)
7219
+ </xsl:when>
7220
+ <xsl:when test="$type = 'alphabet_upper'">
7221
+ A.
7222
+ </xsl:when>
7223
+ <xsl:when test="$type = 'roman'">
7224
+ i)
7225
+ </xsl:when>
7226
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
7227
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
7228
+ </xsl:choose>
7229
+ </xsl:variable>
7230
+
7231
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
7232
+
7233
+ </xsl:otherwise>
7234
+ </xsl:choose>
6675
7235
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6676
7236
  <xsl:choose>
6677
7237
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6687,18 +7247,71 @@
6687
7247
 
6688
7248
  <fo:block-container margin-left="0mm">
6689
7249
  <fo:block>
6690
- <xsl:apply-templates select="." mode="ul_ol"/>
7250
+ <xsl:apply-templates select="." mode="list"/>
6691
7251
  </fo:block>
6692
7252
  </fo:block-container>
6693
7253
  </fo:block-container>
6694
7254
  </xsl:when>
6695
7255
  <xsl:otherwise>
6696
7256
  <fo:block>
6697
- <xsl:apply-templates select="." mode="ul_ol"/>
7257
+ <xsl:apply-templates select="." mode="list"/>
6698
7258
  </fo:block>
6699
7259
  </xsl:otherwise>
6700
7260
  </xsl:choose>
6701
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7261
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7262
+ <fo:list-block xsl:use-attribute-sets="list-style">
7263
+
7264
+
7265
+
7266
+
7267
+
7268
+
7269
+
7270
+
7271
+
7272
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7273
+ </fo:list-block>
7274
+ <!-- <xsl:for-each select="./iho:note">
7275
+ <xsl:call-template name="note"/>
7276
+ </xsl:for-each> -->
7277
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
7278
+ </xsl:template><xsl:template match="*[local-name()='li']">
7279
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
7280
+ <xsl:copy-of select="@id"/>
7281
+
7282
+
7283
+
7284
+ <fo:list-item-label end-indent="label-end()">
7285
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
7286
+
7287
+
7288
+
7289
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7290
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7291
+ <xsl:call-template name="append_add-style"/>
7292
+ </xsl:if>
7293
+
7294
+ <xsl:call-template name="getListItemFormat"/>
7295
+ </fo:block>
7296
+ </fo:list-item-label>
7297
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
7298
+ <fo:block>
7299
+
7300
+
7301
+
7302
+
7303
+
7304
+ <xsl:apply-templates/>
7305
+
7306
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
7307
+
7308
+ <xsl:for-each select="./bsi:note">
7309
+ <xsl:call-template name="note"/>
7310
+ </xsl:for-each> -->
7311
+ </fo:block>
7312
+ </fo:list-item-body>
7313
+ </fo:list-item>
7314
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
6702
7315
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6703
7316
  <bookmark><xsl:value-of select="@id"/></bookmark>
6704
7317
  </xsl:for-each>
@@ -6720,7 +7333,7 @@
6720
7333
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6721
7334
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6722
7335
  <xsl:if test="@to">
6723
- <xsl:value-of select="$dash"/>
7336
+ <xsl:value-of select="$en_dash"/>
6724
7337
  <xsl:copy>
6725
7338
  <xsl:copy-of select="@*"/>
6726
7339
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -6745,7 +7358,7 @@
6745
7358
  <xsl:param name="target"/>
6746
7359
  <!-- <node></node> -->
6747
7360
  <xsl:choose>
6748
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7361
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
6749
7362
  <!-- skip text (i.e. remove it) and process next element -->
6750
7363
  <!-- [removed_<xsl:value-of select="."/>] -->
6751
7364
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -6829,12 +7442,22 @@
6829
7442
  </xsl:variable>
6830
7443
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6831
7444
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7445
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
7446
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
7447
+ <!-- Index -->
7448
+ <xsl:apply-templates/>
7449
+ </fo:block>
7450
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
7451
+ <!-- Letter A, B, C, ... -->
7452
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
7453
+ <xsl:apply-templates/>
7454
+ </fo:block>
6832
7455
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6833
7456
  <xsl:apply-templates/>
6834
7457
  <fo:block>
6835
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
6836
- <fo:block> </fo:block>
6837
- </xsl:if>
7458
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7459
+ <fo:block> </fo:block>
7460
+ </xsl:if>
6838
7461
  </fo:block>
6839
7462
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6840
7463
  <xsl:apply-templates/>
@@ -6844,6 +7467,9 @@
6844
7467
 
6845
7468
  <xsl:apply-templates/>
6846
7469
  </fo:block>
7470
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
7471
+ <!-- to split by '_' and other chars -->
7472
+ <xsl:call-template name="add-zero-spaces-java"/>
6847
7473
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6848
7474
  <fo:inline id="{@id}" font-size="1pt"/>
6849
7475
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -7039,27 +7665,47 @@
7039
7665
  <xsl:apply-templates/>
7040
7666
  </fo:inline>
7041
7667
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7668
+
7669
+ <!-- list of footnotes to calculate actual footnotes number -->
7670
+ <xsl:variable name="p_fn_">
7671
+ <xsl:call-template name="get_fn_list"/>
7672
+ </xsl:variable>
7673
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7674
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7675
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7676
+ <!-- fn sequence number in document -->
7677
+ <xsl:variable name="current_fn_number">
7678
+ <xsl:choose>
7679
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7680
+ <xsl:otherwise>
7681
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7682
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7683
+ </xsl:otherwise>
7684
+ </xsl:choose>
7685
+ </xsl:variable>
7042
7686
  <fo:footnote>
7043
7687
  <xsl:variable name="number">
7044
7688
 
7045
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7689
+ <xsl:value-of select="$current_fn_number"/>
7046
7690
 
7047
7691
  </xsl:variable>
7048
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7049
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7050
- <xsl:value-of select="$number"/>
7051
-
7692
+
7693
+ <xsl:variable name="current_fn_number_text">
7694
+ <xsl:value-of select="$number"/>
7695
+
7052
7696
  <xsl:text>)</xsl:text>
7053
7697
 
7698
+ </xsl:variable>
7699
+
7700
+ <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7701
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7702
+ <xsl:value-of select="$current_fn_number_text"/>
7054
7703
  </fo:basic-link>
7055
7704
  </fo:inline>
7056
7705
  <fo:footnote-body>
7057
7706
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7058
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7059
- <xsl:value-of select="$number"/>
7060
-
7061
- <xsl:text>)</xsl:text>
7062
-
7707
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7708
+ <xsl:value-of select="$current_fn_number_text"/>
7063
7709
  </fo:inline>
7064
7710
  <xsl:apply-templates/>
7065
7711
  </fo:block>
@@ -7185,7 +7831,7 @@
7185
7831
  </fo:table-body>
7186
7832
  </fo:table>
7187
7833
  </fo:block>
7188
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7834
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
7189
7835
  <fo:table-row min-height="5mm">
7190
7836
  <xsl:apply-templates/>
7191
7837
  </fo:table-row>
@@ -7299,6 +7945,78 @@
7299
7945
  <xsl:apply-templates/>
7300
7946
  </fo:block>
7301
7947
 
7948
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
7949
+ <xsl:copy>
7950
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
7951
+ </xsl:copy>
7952
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
7953
+ <xsl:copy>
7954
+ <xsl:copy-of select="@*"/>
7955
+
7956
+ <xsl:variable name="nodes_preface_">
7957
+ <xsl:for-each select="*">
7958
+ <node id="{@id}"/>
7959
+ </xsl:for-each>
7960
+ </xsl:variable>
7961
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
7962
+
7963
+ <xsl:for-each select="*">
7964
+ <xsl:sort select="@displayorder" data-type="number"/>
7965
+
7966
+ <!-- process Section's title -->
7967
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7968
+ <xsl:if test="$preceding-sibling_id != ''">
7969
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7970
+ </xsl:if>
7971
+
7972
+ <xsl:choose>
7973
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7974
+ <xsl:otherwise>
7975
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7976
+ </xsl:otherwise>
7977
+ </xsl:choose>
7978
+
7979
+ </xsl:for-each>
7980
+ </xsl:copy>
7981
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
7982
+ <xsl:copy>
7983
+ <xsl:copy-of select="@*"/>
7984
+
7985
+ <xsl:variable name="nodes_sections_">
7986
+ <xsl:for-each select="*">
7987
+ <node id="{@id}"/>
7988
+ </xsl:for-each>
7989
+ </xsl:variable>
7990
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
7991
+
7992
+ <!-- move section 'Normative references' inside 'sections' -->
7993
+ <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']]">
7994
+ <xsl:sort select="@displayorder" data-type="number"/>
7995
+
7996
+ <!-- process Section's title -->
7997
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7998
+ <xsl:if test="$preceding-sibling_id != ''">
7999
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8000
+ </xsl:if>
8001
+
8002
+ <xsl:choose>
8003
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8004
+ <xsl:otherwise>
8005
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8006
+ </xsl:otherwise>
8007
+ </xsl:choose>
8008
+
8009
+ </xsl:for-each>
8010
+ </xsl:copy>
8011
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8012
+ <xsl:copy>
8013
+ <xsl:copy-of select="@*"/>
8014
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8015
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8016
+ <xsl:sort select="@displayorder" data-type="number"/>
8017
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8018
+ </xsl:for-each>
8019
+ </xsl:copy>
7302
8020
  </xsl:template><xsl:template name="convertDate">
7303
8021
  <xsl:param name="date"/>
7304
8022
  <xsl:param name="format" select="'short'"/>
@@ -7412,9 +8130,6 @@
7412
8130
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7413
8131
  </xsl:choose>
7414
8132
  </xsl:template><xsl:template name="addPDFUAmeta">
7415
- <xsl:variable name="lang">
7416
- <xsl:call-template name="getLang"/>
7417
- </xsl:variable>
7418
8133
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7419
8134
  <pdf:dictionary type="normal" key="ViewerPreferences">
7420
8135
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -7639,10 +8354,12 @@
7639
8354
  <xsl:param name="key"/>
7640
8355
  <xsl:param name="formatted">false</xsl:param>
7641
8356
  <xsl:param name="lang"/>
8357
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
7642
8358
 
7643
8359
  <xsl:variable name="curr_lang">
7644
8360
  <xsl:choose>
7645
8361
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8362
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7646
8363
  <xsl:otherwise>
7647
8364
  <xsl:call-template name="getLang"/>
7648
8365
  </xsl:otherwise>
@@ -7677,6 +8394,7 @@
7677
8394
  </xsl:otherwise>
7678
8395
  </xsl:choose>
7679
8396
  </xsl:when>
8397
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7680
8398
  <xsl:otherwise>
7681
8399
  <xsl:variable name="key_">
7682
8400
  <xsl:call-template name="capitalize">
@@ -7746,53 +8464,153 @@
7746
8464
  <xsl:param name="first"/>
7747
8465
  <xsl:if test="$number != ''">
7748
8466
  <xsl:variable name="words">
7749
- <words>
7750
- <word cardinal="1">One-</word>
7751
- <word ordinal="1">First </word>
7752
- <word cardinal="2">Two-</word>
7753
- <word ordinal="2">Second </word>
7754
- <word cardinal="3">Three-</word>
7755
- <word ordinal="3">Third </word>
7756
- <word cardinal="4">Four-</word>
7757
- <word ordinal="4">Fourth </word>
7758
- <word cardinal="5">Five-</word>
7759
- <word ordinal="5">Fifth </word>
7760
- <word cardinal="6">Six-</word>
7761
- <word ordinal="6">Sixth </word>
7762
- <word cardinal="7">Seven-</word>
7763
- <word ordinal="7">Seventh </word>
7764
- <word cardinal="8">Eight-</word>
7765
- <word ordinal="8">Eighth </word>
7766
- <word cardinal="9">Nine-</word>
7767
- <word ordinal="9">Ninth </word>
7768
- <word ordinal="10">Tenth </word>
7769
- <word ordinal="11">Eleventh </word>
7770
- <word ordinal="12">Twelfth </word>
7771
- <word ordinal="13">Thirteenth </word>
7772
- <word ordinal="14">Fourteenth </word>
7773
- <word ordinal="15">Fifteenth </word>
7774
- <word ordinal="16">Sixteenth </word>
7775
- <word ordinal="17">Seventeenth </word>
7776
- <word ordinal="18">Eighteenth </word>
7777
- <word ordinal="19">Nineteenth </word>
7778
- <word cardinal="20">Twenty-</word>
7779
- <word ordinal="20">Twentieth </word>
7780
- <word cardinal="30">Thirty-</word>
7781
- <word ordinal="30">Thirtieth </word>
7782
- <word cardinal="40">Forty-</word>
7783
- <word ordinal="40">Fortieth </word>
7784
- <word cardinal="50">Fifty-</word>
7785
- <word ordinal="50">Fiftieth </word>
7786
- <word cardinal="60">Sixty-</word>
7787
- <word ordinal="60">Sixtieth </word>
7788
- <word cardinal="70">Seventy-</word>
7789
- <word ordinal="70">Seventieth </word>
7790
- <word cardinal="80">Eighty-</word>
7791
- <word ordinal="80">Eightieth </word>
7792
- <word cardinal="90">Ninety-</word>
7793
- <word ordinal="90">Ninetieth </word>
7794
- <word cardinal="100">Hundred-</word>
7795
- <word ordinal="100">Hundredth </word>
8467
+ <words>
8468
+ <xsl:choose>
8469
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8470
+ <word cardinal="1">Une-</word>
8471
+ <word ordinal="1">Première </word>
8472
+ <word cardinal="2">Deux-</word>
8473
+ <word ordinal="2">Seconde </word>
8474
+ <word cardinal="3">Trois-</word>
8475
+ <word ordinal="3">Tierce </word>
8476
+ <word cardinal="4">Quatre-</word>
8477
+ <word ordinal="4">Quatrième </word>
8478
+ <word cardinal="5">Cinq-</word>
8479
+ <word ordinal="5">Cinquième </word>
8480
+ <word cardinal="6">Six-</word>
8481
+ <word ordinal="6">Sixième </word>
8482
+ <word cardinal="7">Sept-</word>
8483
+ <word ordinal="7">Septième </word>
8484
+ <word cardinal="8">Huit-</word>
8485
+ <word ordinal="8">Huitième </word>
8486
+ <word cardinal="9">Neuf-</word>
8487
+ <word ordinal="9">Neuvième </word>
8488
+ <word ordinal="10">Dixième </word>
8489
+ <word ordinal="11">Onzième </word>
8490
+ <word ordinal="12">Douzième </word>
8491
+ <word ordinal="13">Treizième </word>
8492
+ <word ordinal="14">Quatorzième </word>
8493
+ <word ordinal="15">Quinzième </word>
8494
+ <word ordinal="16">Seizième </word>
8495
+ <word ordinal="17">Dix-septième </word>
8496
+ <word ordinal="18">Dix-huitième </word>
8497
+ <word ordinal="19">Dix-neuvième </word>
8498
+ <word cardinal="20">Vingt-</word>
8499
+ <word ordinal="20">Vingtième </word>
8500
+ <word cardinal="30">Trente-</word>
8501
+ <word ordinal="30">Trentième </word>
8502
+ <word cardinal="40">Quarante-</word>
8503
+ <word ordinal="40">Quarantième </word>
8504
+ <word cardinal="50">Cinquante-</word>
8505
+ <word ordinal="50">Cinquantième </word>
8506
+ <word cardinal="60">Soixante-</word>
8507
+ <word ordinal="60">Soixantième </word>
8508
+ <word cardinal="70">Septante-</word>
8509
+ <word ordinal="70">Septantième </word>
8510
+ <word cardinal="80">Huitante-</word>
8511
+ <word ordinal="80">Huitantième </word>
8512
+ <word cardinal="90">Nonante-</word>
8513
+ <word ordinal="90">Nonantième </word>
8514
+ <word cardinal="100">Cent-</word>
8515
+ <word ordinal="100">Centième </word>
8516
+ </xsl:when>
8517
+ <xsl:when test="$lang = 'ru'">
8518
+ <word cardinal="1">Одна-</word>
8519
+ <word ordinal="1">Первое </word>
8520
+ <word cardinal="2">Две-</word>
8521
+ <word ordinal="2">Второе </word>
8522
+ <word cardinal="3">Три-</word>
8523
+ <word ordinal="3">Третье </word>
8524
+ <word cardinal="4">Четыре-</word>
8525
+ <word ordinal="4">Четвертое </word>
8526
+ <word cardinal="5">Пять-</word>
8527
+ <word ordinal="5">Пятое </word>
8528
+ <word cardinal="6">Шесть-</word>
8529
+ <word ordinal="6">Шестое </word>
8530
+ <word cardinal="7">Семь-</word>
8531
+ <word ordinal="7">Седьмое </word>
8532
+ <word cardinal="8">Восемь-</word>
8533
+ <word ordinal="8">Восьмое </word>
8534
+ <word cardinal="9">Девять-</word>
8535
+ <word ordinal="9">Девятое </word>
8536
+ <word ordinal="10">Десятое </word>
8537
+ <word ordinal="11">Одиннадцатое </word>
8538
+ <word ordinal="12">Двенадцатое </word>
8539
+ <word ordinal="13">Тринадцатое </word>
8540
+ <word ordinal="14">Четырнадцатое </word>
8541
+ <word ordinal="15">Пятнадцатое </word>
8542
+ <word ordinal="16">Шестнадцатое </word>
8543
+ <word ordinal="17">Семнадцатое </word>
8544
+ <word ordinal="18">Восемнадцатое </word>
8545
+ <word ordinal="19">Девятнадцатое </word>
8546
+ <word cardinal="20">Двадцать-</word>
8547
+ <word ordinal="20">Двадцатое </word>
8548
+ <word cardinal="30">Тридцать-</word>
8549
+ <word ordinal="30">Тридцатое </word>
8550
+ <word cardinal="40">Сорок-</word>
8551
+ <word ordinal="40">Сороковое </word>
8552
+ <word cardinal="50">Пятьдесят-</word>
8553
+ <word ordinal="50">Пятидесятое </word>
8554
+ <word cardinal="60">Шестьдесят-</word>
8555
+ <word ordinal="60">Шестидесятое </word>
8556
+ <word cardinal="70">Семьдесят-</word>
8557
+ <word ordinal="70">Семидесятое </word>
8558
+ <word cardinal="80">Восемьдесят-</word>
8559
+ <word ordinal="80">Восьмидесятое </word>
8560
+ <word cardinal="90">Девяносто-</word>
8561
+ <word ordinal="90">Девяностое </word>
8562
+ <word cardinal="100">Сто-</word>
8563
+ <word ordinal="100">Сотое </word>
8564
+ </xsl:when>
8565
+ <xsl:otherwise> <!-- default english -->
8566
+ <word cardinal="1">One-</word>
8567
+ <word ordinal="1">First </word>
8568
+ <word cardinal="2">Two-</word>
8569
+ <word ordinal="2">Second </word>
8570
+ <word cardinal="3">Three-</word>
8571
+ <word ordinal="3">Third </word>
8572
+ <word cardinal="4">Four-</word>
8573
+ <word ordinal="4">Fourth </word>
8574
+ <word cardinal="5">Five-</word>
8575
+ <word ordinal="5">Fifth </word>
8576
+ <word cardinal="6">Six-</word>
8577
+ <word ordinal="6">Sixth </word>
8578
+ <word cardinal="7">Seven-</word>
8579
+ <word ordinal="7">Seventh </word>
8580
+ <word cardinal="8">Eight-</word>
8581
+ <word ordinal="8">Eighth </word>
8582
+ <word cardinal="9">Nine-</word>
8583
+ <word ordinal="9">Ninth </word>
8584
+ <word ordinal="10">Tenth </word>
8585
+ <word ordinal="11">Eleventh </word>
8586
+ <word ordinal="12">Twelfth </word>
8587
+ <word ordinal="13">Thirteenth </word>
8588
+ <word ordinal="14">Fourteenth </word>
8589
+ <word ordinal="15">Fifteenth </word>
8590
+ <word ordinal="16">Sixteenth </word>
8591
+ <word ordinal="17">Seventeenth </word>
8592
+ <word ordinal="18">Eighteenth </word>
8593
+ <word ordinal="19">Nineteenth </word>
8594
+ <word cardinal="20">Twenty-</word>
8595
+ <word ordinal="20">Twentieth </word>
8596
+ <word cardinal="30">Thirty-</word>
8597
+ <word ordinal="30">Thirtieth </word>
8598
+ <word cardinal="40">Forty-</word>
8599
+ <word ordinal="40">Fortieth </word>
8600
+ <word cardinal="50">Fifty-</word>
8601
+ <word ordinal="50">Fiftieth </word>
8602
+ <word cardinal="60">Sixty-</word>
8603
+ <word ordinal="60">Sixtieth </word>
8604
+ <word cardinal="70">Seventy-</word>
8605
+ <word ordinal="70">Seventieth </word>
8606
+ <word cardinal="80">Eighty-</word>
8607
+ <word ordinal="80">Eightieth </word>
8608
+ <word cardinal="90">Ninety-</word>
8609
+ <word ordinal="90">Ninetieth </word>
8610
+ <word cardinal="100">Hundred-</word>
8611
+ <word ordinal="100">Hundredth </word>
8612
+ </xsl:otherwise>
8613
+ </xsl:choose>
7796
8614
  </words>
7797
8615
  </xsl:variable>
7798
8616
 
@@ -7866,4 +8684,18 @@
7866
8684
  <xsl:otherwise>_</xsl:otherwise>
7867
8685
  </xsl:choose>
7868
8686
  </xsl:attribute>
8687
+ </xsl:template><xsl:template name="substring-after-last">
8688
+ <xsl:param name="value"/>
8689
+ <xsl:param name="delimiter"/>
8690
+ <xsl:choose>
8691
+ <xsl:when test="contains($value, $delimiter)">
8692
+ <xsl:call-template name="substring-after-last">
8693
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8694
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8695
+ </xsl:call-template>
8696
+ </xsl:when>
8697
+ <xsl:otherwise>
8698
+ <xsl:value-of select="$value"/>
8699
+ </xsl:otherwise>
8700
+ </xsl:choose>
7869
8701
  </xsl:template></xsl:stylesheet>