metanorma-ribose 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rsd="https://www.metanorma.org/ns/rsd" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
-
5
- <xsl:param name="svg_images"/>
6
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
- <xsl:variable name="images" select="document($svg_images)"/>
8
- <xsl:param name="basepath"/>
9
4
 
10
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
6
 
12
- <xsl:variable name="marginLeftRight1" select="29"/>
13
- <xsl:variable name="marginLeftRight2" select="29"/>
14
- <xsl:variable name="marginTop" select="14"/>
15
- <xsl:variable name="marginBottom" select="22"/>
16
-
17
7
 
18
8
 
19
9
  <xsl:variable name="debug">false</xsl:variable>
@@ -30,7 +20,7 @@
30
20
  </xsl:variable>
31
21
 
32
22
 
33
- <xsl:variable name="contents">
23
+ <xsl:variable name="contents_">
34
24
  <contents>
35
25
 
36
26
  <xsl:apply-templates select="/rsd:rsd-standard/rsd:preface/rsd:abstract" mode="contents"/>
@@ -42,12 +32,10 @@
42
32
 
43
33
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
44
34
 
35
+ <xsl:call-template name="processTablesFigures_Contents"/>
45
36
  </contents>
46
37
  </xsl:variable>
47
-
48
- <xsl:variable name="lang">
49
- <xsl:call-template name="getLang"/>
50
- </xsl:variable>
38
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
51
39
 
52
40
  <xsl:variable name="docnumber_version">
53
41
  <xsl:value-of select="/rsd:rsd-standard/rsd:bibdata/rsd:docidentifier[@type = 'rsd' or @type = 'Ribose']"/>
@@ -412,7 +400,7 @@
412
400
  <fo:page-sequence master-reference="document" force-page-count="no-force"> <!-- master-reference="toc" -->
413
401
  <xsl:call-template name="insertHeaderFooter"/>
414
402
  <fo:flow flow-name="xsl-region-body">
415
- <xsl:if test="xalan:nodeset($contents)//item[@display = 'true']">
403
+ <xsl:if test="$contents//item[@display = 'true']">
416
404
  <fo:block role="TOC">
417
405
  <!-- <fo:block-container absolute-position="fixed" left="13mm" top="15mm"> -->
418
406
  <fo:block font-size="27pt" font-weight="bold" color="black" margin-left="-15mm" margin-bottom="13mm" role="H1">
@@ -424,7 +412,7 @@
424
412
 
425
413
  <fo:block-container margin-left="32mm" margin-right="-17mm">
426
414
  <fo:block-container margin-left="0mm" margin-right="0mm">
427
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
415
+ <xsl:for-each select="$contents//item[@display = 'true']">
428
416
  <fo:block font-size="13pt" role="TOCI">
429
417
  <xsl:if test="@level = 1">
430
418
  <xsl:if test="preceding-sibling::item[@display = 'true' and @level = 1]">
@@ -447,13 +435,34 @@
447
435
  <xsl:apply-templates select="title"/>
448
436
  <xsl:text>  </xsl:text>
449
437
  <fo:inline>
450
- <fo:leader leader-pattern="rule" rule-thickness="0.2mm"/>
451
- <fo:inline padding-left="2mm"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
452
- </fo:inline>
438
+ <fo:leader leader-pattern="rule" rule-thickness="0.2mm"/>
439
+ <fo:inline padding-left="2mm"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
440
+ </fo:inline>
453
441
  </fo:basic-link>
454
442
  </fo:block>
455
443
  </fo:block>
456
444
  </xsl:for-each>
445
+
446
+ <!-- List of Tables -->
447
+ <xsl:if test="$contents//tables/table">
448
+ <xsl:call-template name="insertListOf_Title">
449
+ <xsl:with-param name="title" select="$title-list-tables"/>
450
+ </xsl:call-template>
451
+ <xsl:for-each select="$contents//tables/table">
452
+ <xsl:call-template name="insertListOf_Item"/>
453
+ </xsl:for-each>
454
+ </xsl:if>
455
+
456
+ <!-- List of Figures -->
457
+ <xsl:if test="$contents//figures/figure">
458
+ <xsl:call-template name="insertListOf_Title">
459
+ <xsl:with-param name="title" select="$title-list-figures"/>
460
+ </xsl:call-template>
461
+ <xsl:for-each select="$contents//figures/figure">
462
+ <xsl:call-template name="insertListOf_Item"/>
463
+ </xsl:for-each>
464
+ </xsl:if>
465
+
457
466
  </fo:block-container>
458
467
  </fo:block-container>
459
468
  </fo:block>
@@ -498,6 +507,30 @@
498
507
  </fo:root>
499
508
  </xsl:template>
500
509
 
510
+ <xsl:template name="insertListOf_Title">
511
+ <xsl:param name="title"/>
512
+ <fo:block font-size="13pt" font-weight="bold" color="black" margin-top="12pt" margin-bottom="12pt" keep-with-next="always">
513
+ <xsl:value-of select="$title"/>
514
+ </fo:block>
515
+ </xsl:template>
516
+
517
+ <xsl:template name="insertListOf_Item">
518
+ <fo:block font-size="13pt" role="TOCI" margin-left="16.5mm" space-before="4pt" space-after="5pt">
519
+ <fo:block text-align-last="justify">
520
+ <fo:basic-link internal-destination="{@id}">
521
+ <xsl:call-template name="setAltText">
522
+ <xsl:with-param name="value" select="@alt-text"/>
523
+ </xsl:call-template>
524
+ <xsl:apply-templates select="." mode="contents"/>
525
+ <xsl:text>  </xsl:text>
526
+ <fo:inline>
527
+ <fo:leader leader-pattern="rule" rule-thickness="0.2mm"/>
528
+ <fo:inline padding-left="2mm"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
529
+ </fo:inline>
530
+ </fo:basic-link>
531
+ </fo:block>
532
+ </fo:block>
533
+ </xsl:template>
501
534
 
502
535
  <xsl:template match="rsd:title" mode="cover_page">
503
536
  <xsl:apply-templates/>
@@ -798,21 +831,9 @@
798
831
  </fo:block>
799
832
  </xsl:template>
800
833
 
801
-
802
834
 
803
-
804
-
805
- <xsl:template match="rsd:ul | rsd:ol" mode="ul_ol">
806
- <xsl:variable name="level">
807
- <xsl:call-template name="getLevel">
808
- <xsl:with-param name="depth" select="ancestor::rsd:clause[1]/rsd:title/@depth"/>
809
- </xsl:call-template>
810
- </xsl:variable>
835
+ <xsl:template match="rsd:ul | rsd:ol" mode="list" priority="2">
811
836
  <fo:block-container>
812
- <xsl:if test="$level &gt;= 3">
813
- <!-- <xsl:variable name="list_level" select="count(ancestor-or-self::rsd:ul) + count(ancestor-or-self::rsd:ul)"/> -->
814
- <!-- <xsl:attribute name="margin-left">13mm</xsl:attribute> -->
815
- </xsl:if>
816
837
  <fo:block-container margin-left="0mm">
817
838
  <xsl:choose>
818
839
  <xsl:when test="not(ancestor::rsd:ul) and not(ancestor::rsd:ol)">
@@ -829,57 +850,11 @@
829
850
  </xsl:template>
830
851
 
831
852
  <xsl:template name="listProcessing">
832
- <fo:list-block provisional-distance-between-starts="6mm"> <!-- 12mm -->
833
- <xsl:if test="ancestor::rsd:ul | ancestor::rsd:ol">
834
- <!-- <xsl:attribute name="margin-bottom">0pt</xsl:attribute> -->
835
- </xsl:if>
836
- <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
837
- <!-- <xsl:attribute name="margin-bottom">0pt</xsl:attribute> -->
838
- </xsl:if>
853
+ <fo:list-block xsl:use-attribute-sets="list-style">
839
854
  <xsl:apply-templates/>
840
855
  </fo:list-block>
841
856
  </xsl:template>
842
857
 
843
-
844
- <xsl:template match="rsd:li">
845
- <fo:list-item space-after="4pt">
846
- <fo:list-item-label end-indent="label-end()">
847
- <fo:block color="{$color_blue}" font-weight="bold">
848
- <xsl:choose>
849
- <xsl:when test="local-name(..) = 'ul'">
850
- <xsl:call-template name="setULLabel"/>
851
- </xsl:when>
852
- <!-- <xsl:when test="local-name(..) = 'ul' and (../ancestor::rsd:ul or ../ancestor::rsd:ol)">&#x2014;</xsl:when> --> <!-- - &#x2014; dash -->
853
- <!-- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> -->
854
- <xsl:otherwise> <!-- for ordered lists -->
855
- <xsl:choose>
856
- <xsl:when test="../@type = 'arabic'">
857
- <xsl:number format="1."/>
858
- </xsl:when>
859
- <xsl:when test="../@type = 'alphabet'">
860
- <xsl:number format="a." lang="en"/>
861
- </xsl:when>
862
- <xsl:when test="../@type = 'alphabet_upper'">
863
- <xsl:number format="A." lang="en"/>
864
- </xsl:when>
865
- <xsl:when test="../@type = 'roman'">
866
- <xsl:number format="i."/>
867
- </xsl:when>
868
- <xsl:otherwise>
869
- <xsl:number format="1."/>
870
- </xsl:otherwise>
871
- </xsl:choose>
872
- </xsl:otherwise>
873
- </xsl:choose>
874
- </fo:block>
875
- </fo:list-item-label>
876
- <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
877
- <fo:block>
878
- <xsl:apply-templates/>
879
- </fo:block>
880
- </fo:list-item-body>
881
- </fo:list-item>
882
- </xsl:template>
883
858
 
884
859
  <xsl:template match="rsd:ul/rsd:note | rsd:ol/rsd:note" priority="2">
885
860
  <fo:list-item font-size="10pt">
@@ -985,29 +960,6 @@
985
960
  </xsl:template>
986
961
 
987
962
 
988
- <xsl:template match="rsd:formula/rsd:stem">
989
- <fo:block margin-top="6pt" margin-bottom="12pt">
990
- <fo:table table-layout="fixed" width="100%">
991
- <fo:table-column column-width="95%"/>
992
- <fo:table-column column-width="5%"/>
993
- <fo:table-body>
994
- <fo:table-row>
995
- <fo:table-cell display-align="center">
996
- <fo:block text-align="left" margin-left="5mm">
997
- <xsl:apply-templates/>
998
- </fo:block>
999
- </fo:table-cell>
1000
- <fo:table-cell display-align="center">
1001
- <fo:block text-align="right">
1002
- <xsl:apply-templates select="../rsd:name" mode="formula_number"/>
1003
- </fo:block>
1004
- </fo:table-cell>
1005
- </fo:table-row>
1006
- </fo:table-body>
1007
- </fo:table>
1008
- </fo:block>
1009
- </xsl:template>
1010
-
1011
963
 
1012
964
  <xsl:template match="*[local-name()='table' or local-name()='figure' or local-name()='sourcecode']/*[local-name() = 'name']/node()[1][self::text()]" priority="2">
1013
965
  <xsl:choose>
@@ -1257,11 +1209,21 @@
1257
1209
 
1258
1210
 
1259
1211
 
1260
- <xsl:variable name="pageWidth_">
1212
+ <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">
1213
+ <xsl:call-template name="getLang"/>
1214
+ </xsl:variable><xsl:variable name="pageWidth_">
1261
1215
  215.9
1262
1216
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1263
1217
  279.4
1264
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
1218
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1219
+ 29
1220
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
1221
+ 29
1222
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
1223
+ 14
1224
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1225
+ 22
1226
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1265
1227
 
1266
1228
  <title-edition lang="en">
1267
1229
 
@@ -1273,6 +1235,10 @@
1273
1235
  <xsl:text>Édition </xsl:text>
1274
1236
  </title-edition>
1275
1237
 
1238
+ <title-edition lang="ru">
1239
+ <xsl:text>Издание </xsl:text>
1240
+ </title-edition>
1241
+
1276
1242
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1277
1243
  <title-toc lang="en">
1278
1244
 
@@ -1287,7 +1253,7 @@
1287
1253
  <xsl:text>Contents</xsl:text>
1288
1254
 
1289
1255
  </title-toc>
1290
-
1256
+
1291
1257
  <title-descriptors lang="en">Descriptors</title-descriptors>
1292
1258
 
1293
1259
  <title-part lang="en">
@@ -1299,7 +1265,11 @@
1299
1265
 
1300
1266
 
1301
1267
 
1302
- </title-part>
1268
+ </title-part>
1269
+ <title-part lang="ru">
1270
+
1271
+
1272
+ </title-part>
1303
1273
  <title-part lang="zh">第 # 部分:</title-part>
1304
1274
 
1305
1275
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1315,13 +1285,38 @@
1315
1285
 
1316
1286
  <title-summary lang="en">Summary</title-summary>
1317
1287
 
1288
+ <title-continued lang="ru">(продолжение)</title-continued>
1318
1289
  <title-continued lang="en">(continued)</title-continued>
1319
1290
  <title-continued lang="fr">(continué)</title-continued>
1320
1291
 
1321
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
1292
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
1293
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1294
+ <xsl:value-of select="$toc_table_title"/>
1295
+ <xsl:if test="normalize-space($toc_table_title) = ''">
1296
+ <xsl:call-template name="getTitle">
1297
+ <xsl:with-param name="name" select="'title-list-tables'"/>
1298
+ </xsl:call-template>
1299
+ </xsl:if>
1300
+ </xsl:variable><xsl:variable name="title-list-figures">
1301
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1302
+ <xsl:value-of select="$toc_figure_title"/>
1303
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
1304
+ <xsl:call-template name="getTitle">
1305
+ <xsl:with-param name="name" select="'title-list-figures'"/>
1306
+ </xsl:call-template>
1307
+ </xsl:if>
1308
+ </xsl:variable><xsl:variable name="title-list-recommendations">
1309
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1310
+ <xsl:value-of select="$toc_requirement_title"/>
1311
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
1312
+ <xsl:call-template name="getTitle">
1313
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
1314
+ </xsl:call-template>
1315
+ </xsl:if>
1316
+ </xsl:variable><xsl:variable name="bibdata">
1322
1317
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1323
1318
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1324
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1319
+ </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">
1325
1320
  <xsl:param name="name"/>
1326
1321
  <xsl:param name="lang"/>
1327
1322
  <xsl:variable name="lang_">
@@ -1344,7 +1339,7 @@
1344
1339
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1345
1340
  </xsl:otherwise>
1346
1341
  </xsl:choose>
1347
- </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">
1342
+ </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">
1348
1343
 
1349
1344
 
1350
1345
 
@@ -1517,7 +1512,7 @@
1517
1512
 
1518
1513
 
1519
1514
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1520
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1515
+
1521
1516
 
1522
1517
 
1523
1518
 
@@ -1924,11 +1919,11 @@
1924
1919
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
1925
1920
 
1926
1921
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1927
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
1922
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
1923
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
1928
1924
 
1929
1925
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1930
1926
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
1931
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
1932
1927
 
1933
1928
 
1934
1929
 
@@ -1937,12 +1932,11 @@
1937
1932
 
1938
1933
 
1939
1934
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1935
+ <xsl:attribute name="text-align">right</xsl:attribute>
1940
1936
 
1941
- <xsl:attribute name="text-align">right</xsl:attribute>
1942
1937
  <xsl:attribute name="margin-right">25mm</xsl:attribute>
1943
1938
 
1944
1939
 
1945
-
1946
1940
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1947
1941
 
1948
1942
 
@@ -1966,6 +1960,9 @@
1966
1960
 
1967
1961
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1968
1962
 
1963
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
1964
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1965
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1969
1966
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
1970
1967
  <!-- background for image -->
1971
1968
  <xsl:attribute name="background-color">rgb(236,242,246)</xsl:attribute>
@@ -2007,6 +2004,36 @@
2007
2004
 
2008
2005
 
2009
2006
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2007
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2008
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2009
+
2010
+
2011
+
2012
+
2013
+
2014
+
2015
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2016
+ <xsl:attribute name="text-align">center</xsl:attribute>
2017
+
2018
+
2019
+
2020
+
2021
+
2022
+
2023
+
2024
+
2025
+
2026
+
2027
+
2028
+ <xsl:attribute name="text-align">left</xsl:attribute>
2029
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
2030
+
2031
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2032
+ <xsl:attribute name="text-align">right</xsl:attribute>
2033
+
2034
+
2035
+
2036
+
2010
2037
 
2011
2038
  </xsl:attribute-set><xsl:attribute-set name="image-style">
2012
2039
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -2050,6 +2077,18 @@
2050
2077
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2051
2078
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2052
2079
 
2080
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2081
+
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2088
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2089
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2090
+
2091
+
2053
2092
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
2054
2093
 
2055
2094
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -2076,13 +2115,19 @@
2076
2115
  </xsl:attribute-set><xsl:variable name="color-added-text">
2077
2116
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2078
2117
  </xsl:variable><xsl:attribute-set name="add-style">
2079
- <xsl:attribute name="color">red</xsl:attribute>
2080
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2081
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2082
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2083
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2084
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2085
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2118
+
2119
+ <xsl:attribute name="color">red</xsl:attribute>
2120
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2121
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2122
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2123
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2124
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2125
+
2126
+ </xsl:attribute-set><xsl:variable name="add-style">
2127
+ <add-style xsl:use-attribute-sets="add-style"/>
2128
+ </xsl:variable><xsl:template name="append_add-style">
2129
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2130
+ </xsl:template><xsl:variable name="color-deleted-text">
2086
2131
  <xsl:text>red</xsl:text>
2087
2132
  </xsl:variable><xsl:attribute-set name="del-style">
2088
2133
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -2093,6 +2138,42 @@
2093
2138
 
2094
2139
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2095
2140
 
2141
+
2142
+
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2149
+
2150
+
2151
+
2152
+
2153
+
2154
+
2155
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
2156
+
2157
+
2158
+
2159
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2160
+
2161
+
2162
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
2163
+
2164
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2165
+
2166
+
2167
+
2168
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2169
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2170
+
2171
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2172
+
2173
+
2174
+
2175
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2176
+
2096
2177
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2097
2178
  <xsl:attribute name="line-height">135%</xsl:attribute>
2098
2179
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -2386,15 +2467,148 @@
2386
2467
 
2387
2468
 
2388
2469
 
2470
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
2471
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2472
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
2473
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2474
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
2475
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2476
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
2477
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2478
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
2479
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2480
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
2481
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2482
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
2483
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2484
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
2485
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2486
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
2487
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2488
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
2489
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2490
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
2491
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2492
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
2493
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2494
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
2495
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2496
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
2497
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2498
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
2499
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2500
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
2501
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2502
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
2503
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2504
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
2505
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2506
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
2507
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2508
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
2509
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2510
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
2511
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2512
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
2513
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2514
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
2515
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2516
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
2517
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2518
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
2519
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2520
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
2521
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2522
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
2523
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2524
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
2525
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2526
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
2527
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2528
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
2529
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2530
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
2531
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2532
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
2533
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2534
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
2535
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2536
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
2537
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2538
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
2539
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2540
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2541
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
2542
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
2543
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
2544
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2545
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2546
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
2547
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2548
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2549
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
2550
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2551
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
2552
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
2553
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
2554
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
2555
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
2556
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
2557
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
2558
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
2559
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
2560
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
2561
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
2562
+ <xsl:attribute name="role">H1</xsl:attribute>
2563
+
2564
+
2565
+
2566
+
2567
+
2568
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
2569
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2570
+
2571
+
2572
+
2573
+
2574
+
2389
2575
  </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">
2576
+ <xsl:variable name="nodes_preface_">
2577
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2578
+ <node id="{@id}"/>
2579
+ </xsl:for-each>
2580
+ </xsl:variable>
2581
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2582
+
2390
2583
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2391
2584
  <xsl:sort select="@displayorder" data-type="number"/>
2585
+
2586
+ <!-- process Section's title -->
2587
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2588
+ <xsl:if test="$preceding-sibling_id != ''">
2589
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2590
+ </xsl:if>
2591
+
2392
2592
  <xsl:apply-templates select="." mode="contents"/>
2393
2593
  </xsl:for-each>
2394
2594
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2395
2595
 
2596
+ <xsl:variable name="nodes_sections_">
2597
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
2598
+ <node id="{@id}"/>
2599
+ </xsl:for-each>
2600
+ </xsl:variable>
2601
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
2602
+
2396
2603
  <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']]">
2397
2604
  <xsl:sort select="@displayorder" data-type="number"/>
2605
+
2606
+ <!-- process Section's title -->
2607
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2608
+ <xsl:if test="$preceding-sibling_id != ''">
2609
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2610
+ </xsl:if>
2611
+
2398
2612
  <xsl:apply-templates select="." mode="contents"/>
2399
2613
  </xsl:for-each>
2400
2614
 
@@ -2407,6 +2621,30 @@
2407
2621
  <xsl:sort select="@displayorder" data-type="number"/>
2408
2622
  <xsl:apply-templates select="." mode="contents"/>
2409
2623
  </xsl:for-each>
2624
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
2625
+ <xsl:param name="always"/>
2626
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2627
+ <xsl:call-template name="processTables_Contents"/>
2628
+ </xsl:if>
2629
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2630
+ <xsl:call-template name="processFigures_Contents"/>
2631
+ </xsl:if>
2632
+ </xsl:template><xsl:template name="processTables_Contents">
2633
+ <tables>
2634
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2635
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2636
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2637
+ </table>
2638
+ </xsl:for-each>
2639
+ </tables>
2640
+ </xsl:template><xsl:template name="processFigures_Contents">
2641
+ <figures>
2642
+ <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) != '']">
2643
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
2644
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2645
+ </figure>
2646
+ </xsl:for-each>
2647
+ </figures>
2410
2648
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2411
2649
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2412
2650
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2477,9 +2715,12 @@
2477
2715
 
2478
2716
 
2479
2717
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
2718
+ <xsl:param name="margin"/>
2480
2719
 
2481
2720
  <!-- process in the template 'paragraph' -->
2482
- <xsl:call-template name="paragraph"/>
2721
+ <xsl:call-template name="paragraph">
2722
+ <xsl:with-param name="margin" select="$margin"/>
2723
+ </xsl:call-template>
2483
2724
 
2484
2725
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
2485
2726
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -2491,9 +2732,12 @@
2491
2732
  <xsl:call-template name="title"/>
2492
2733
 
2493
2734
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
2735
+ <xsl:param name="margin"/>
2494
2736
 
2495
2737
  <!-- process in the template 'paragraph' -->
2496
- <xsl:call-template name="paragraph"/>
2738
+ <xsl:call-template name="paragraph">
2739
+ <xsl:with-param name="margin" select="$margin"/>
2740
+ </xsl:call-template>
2497
2741
 
2498
2742
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2499
2743
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -2530,7 +2774,7 @@
2530
2774
  </xsl:call-template>
2531
2775
  </xsl:if>
2532
2776
  </xsl:variable>
2533
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2777
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2534
2778
 
2535
2779
 
2536
2780
  <xsl:variable name="margin-side">
@@ -2790,7 +3034,7 @@
2790
3034
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2791
3035
  <!-- 2009 thinspace -->
2792
3036
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2793
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3037
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2794
3038
  </xsl:call-template>
2795
3039
  </xsl:variable>
2796
3040
  <xsl:variable name="max_length">
@@ -2831,8 +3075,7 @@
2831
3075
  </xsl:call-template>
2832
3076
  </xsl:if>
2833
3077
  </xsl:template><xsl:template match="text()" mode="td_text">
2834
- <xsl:variable name="zero-space">​</xsl:variable>
2835
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3078
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2836
3079
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2837
3080
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2838
3081
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -3182,37 +3425,7 @@
3182
3425
 
3183
3426
  <!-- list of footnotes to calculate actual footnotes number -->
3184
3427
  <xsl:variable name="p_fn_">
3185
- <xsl:choose>
3186
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3187
- <fn gen_id="{generate-id(.)}">
3188
- <xsl:copy-of select="@*"/>
3189
- <xsl:copy-of select="node()"/>
3190
- </fn>
3191
- </xsl:when>
3192
- <xsl:otherwise>
3193
- <!-- itetation for:
3194
- footnotes in bibdata/title
3195
- footnotes in bibliography
3196
- footnotes in document's body (except table's head/body/foot and figure text)
3197
- -->
3198
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3199
- <fn gen_id="{generate-id(.)}">
3200
- <xsl:copy-of select="@*"/>
3201
- <xsl:copy-of select="node()"/>
3202
- </fn>
3203
- </xsl:for-each>
3204
- <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']/*">
3205
- <xsl:sort select="@displayorder" data-type="number"/>
3206
- <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])]">
3207
- <!-- copy unique fn -->
3208
- <fn gen_id="{generate-id(.)}">
3209
- <xsl:copy-of select="@*"/>
3210
- <xsl:copy-of select="node()"/>
3211
- </fn>
3212
- </xsl:for-each>
3213
- </xsl:for-each>
3214
- </xsl:otherwise>
3215
- </xsl:choose>
3428
+ <xsl:call-template name="get_fn_list"/>
3216
3429
  </xsl:variable>
3217
3430
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3218
3431
 
@@ -3273,6 +3486,38 @@
3273
3486
  <xsl:copy-of select="$footnote_inline"/>
3274
3487
  </xsl:otherwise>
3275
3488
  </xsl:choose>
3489
+ </xsl:template><xsl:template name="get_fn_list">
3490
+ <xsl:choose>
3491
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3492
+ <fn gen_id="{generate-id(.)}">
3493
+ <xsl:copy-of select="@*"/>
3494
+ <xsl:copy-of select="node()"/>
3495
+ </fn>
3496
+ </xsl:when>
3497
+ <xsl:otherwise>
3498
+ <!-- itetation for:
3499
+ footnotes in bibdata/title
3500
+ footnotes in bibliography
3501
+ footnotes in document's body (except table's head/body/foot and figure text)
3502
+ -->
3503
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3504
+ <fn gen_id="{generate-id(.)}">
3505
+ <xsl:copy-of select="@*"/>
3506
+ <xsl:copy-of select="node()"/>
3507
+ </fn>
3508
+ </xsl:for-each>
3509
+ <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']/*">
3510
+ <xsl:sort select="@displayorder" data-type="number"/>
3511
+ <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])]">
3512
+ <!-- copy unique fn -->
3513
+ <fn gen_id="{generate-id(.)}">
3514
+ <xsl:copy-of select="@*"/>
3515
+ <xsl:copy-of select="node()"/>
3516
+ </fn>
3517
+ </xsl:for-each>
3518
+ </xsl:for-each>
3519
+ </xsl:otherwise>
3520
+ </xsl:choose>
3276
3521
  </xsl:template><xsl:template name="table_fn_display">
3277
3522
  <xsl:variable name="references">
3278
3523
 
@@ -3444,7 +3689,7 @@
3444
3689
  </fo:inline>
3445
3690
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3446
3691
  <fo:inline><xsl:value-of select="."/></fo:inline>
3447
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3692
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
3448
3693
  <fo:inline>
3449
3694
  <xsl:apply-templates/>
3450
3695
  </fo:inline>
@@ -3820,20 +4065,44 @@
3820
4065
  <fo:inline text-decoration="underline">
3821
4066
  <xsl:apply-templates/>
3822
4067
  </fo:inline>
3823
- </xsl:template><xsl:template match="*[local-name()='add']">
4068
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
3824
4069
  <xsl:param name="skip">true</xsl:param>
4070
+ <xsl:param name="block">false</xsl:param>
4071
+ <xsl:param name="type"/>
4072
+ <xsl:param name="text-align"/>
3825
4073
  <xsl:choose>
3826
4074
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3827
4075
  <xsl:choose>
3828
- <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>
4076
+ <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>
3829
4077
  <xsl:otherwise>
3830
- <fo:inline>
4078
+ <xsl:variable name="tag">
3831
4079
  <xsl:call-template name="insertTag">
3832
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4080
+ <xsl:with-param name="type">
4081
+ <xsl:choose>
4082
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4083
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4084
+ </xsl:choose>
4085
+ </xsl:with-param>
3833
4086
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3834
4087
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3835
4088
  </xsl:call-template>
3836
- </fo:inline>
4089
+ </xsl:variable>
4090
+ <xsl:choose>
4091
+ <xsl:when test="$block = 'false'">
4092
+ <fo:inline>
4093
+ <xsl:copy-of select="$tag"/>
4094
+ </fo:inline>
4095
+ </xsl:when>
4096
+ <xsl:otherwise>
4097
+ <fo:block> <!-- for around figures -->
4098
+ <xsl:if test="$text-align != ''">
4099
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4100
+ </xsl:if>
4101
+ <xsl:copy-of select="$tag"/>
4102
+ </fo:block>
4103
+ </xsl:otherwise>
4104
+ </xsl:choose>
4105
+
3837
4106
  </xsl:otherwise>
3838
4107
  </xsl:choose>
3839
4108
  </xsl:when>
@@ -4192,17 +4461,21 @@
4192
4461
  </xsl:apply-templates>
4193
4462
  </xsl:template><xsl:template name="getLang">
4194
4463
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4195
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4196
4464
  <xsl:variable name="language">
4197
4465
  <xsl:choose>
4198
4466
  <xsl:when test="$language_current != ''">
4199
4467
  <xsl:value-of select="$language_current"/>
4200
4468
  </xsl:when>
4201
- <xsl:when test="$language_current_2 != ''">
4202
- <xsl:value-of select="$language_current_2"/>
4203
- </xsl:when>
4204
4469
  <xsl:otherwise>
4205
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4470
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4471
+ <xsl:choose>
4472
+ <xsl:when test="$language_current_2 != ''">
4473
+ <xsl:value-of select="$language_current_2"/>
4474
+ </xsl:when>
4475
+ <xsl:otherwise>
4476
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4477
+ </xsl:otherwise>
4478
+ </xsl:choose>
4206
4479
  </xsl:otherwise>
4207
4480
  </xsl:choose>
4208
4481
  </xsl:variable>
@@ -4411,6 +4684,9 @@
4411
4684
  </fo:inline>
4412
4685
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4413
4686
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4687
+ <xsl:if test="parent::*[local-name() = 'add']">
4688
+ <xsl:call-template name="append_add-style"/>
4689
+ </xsl:if>
4414
4690
  <xsl:apply-templates/>
4415
4691
  </fo:basic-link>
4416
4692
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -4425,8 +4701,8 @@
4425
4701
 
4426
4702
  </xsl:if>
4427
4703
  <fo:block-container margin-left="0mm">
4428
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
4429
- <xsl:apply-templates/>
4704
+ <fo:block id="{@id}">
4705
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
4430
4706
  </fo:block>
4431
4707
  </fo:block-container>
4432
4708
  </fo:block-container>
@@ -4438,21 +4714,54 @@
4438
4714
  <fo:inline>
4439
4715
  <xsl:apply-templates/>
4440
4716
  </fo:inline>
4441
- </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 -->
4717
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
4442
4718
  <xsl:if test="normalize-space() != ''">
4443
4719
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
4444
4720
  </xsl:if>
4445
- </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4446
-
4447
- <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
4721
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
4722
+ <fo:block xsl:use-attribute-sets="formula-style">
4448
4723
 
4449
4724
 
4725
+
4726
+ <fo:table table-layout="fixed" width="100%">
4727
+ <fo:table-column column-width="95%"/>
4728
+ <fo:table-column column-width="5%"/>
4729
+ <fo:table-body>
4730
+ <fo:table-row>
4731
+ <fo:table-cell display-align="center">
4732
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4733
+
4734
+
4735
+
4736
+ <xsl:apply-templates/>
4737
+ </fo:block>
4738
+ </fo:table-cell>
4739
+ <fo:table-cell display-align="center">
4740
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
4741
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
4742
+ </fo:block>
4743
+ </fo:table-cell>
4744
+ </fo:table-row>
4745
+ </fo:table-body>
4746
+ </fo:table>
4747
+ </fo:block>
4748
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
4749
+ <fo:block xsl:use-attribute-sets="formula-style">
4750
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4751
+ <xsl:apply-templates/>
4752
+ </fo:block>
4753
+ </fo:block>
4754
+ </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4755
+
4756
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
4757
+
4758
+
4759
+
4760
+
4761
+
4762
+
4763
+
4450
4764
 
4451
-
4452
-
4453
-
4454
-
4455
-
4456
4765
  <xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol and not(ancestor::rsd:note[1]/following-sibling::*)">
4457
4766
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
4458
4767
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -4480,6 +4789,13 @@
4480
4789
 
4481
4790
 
4482
4791
 
4792
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4793
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4794
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4795
+ <xsl:call-template name="append_add-style"/>
4796
+ </xsl:if>
4797
+
4798
+
4483
4799
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
4484
4800
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
4485
4801
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -4518,6 +4834,12 @@
4518
4834
 
4519
4835
 
4520
4836
 
4837
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4838
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4839
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4840
+ <xsl:call-template name="append_add-style"/>
4841
+ </xsl:if>
4842
+
4521
4843
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4522
4844
 
4523
4845
  </fo:inline>
@@ -4571,6 +4893,7 @@
4571
4893
  </fo:block>
4572
4894
  </xsl:template><xsl:template match="*[local-name() = 'term']">
4573
4895
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
4896
+
4574
4897
 
4575
4898
 
4576
4899
 
@@ -5007,7 +5330,11 @@
5007
5330
  <xsl:value-of select="."/>
5008
5331
  </xsl:template><xsl:template match="node()" mode="contents">
5009
5332
  <xsl:apply-templates mode="contents"/>
5010
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
5333
+ </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">
5334
+ <xsl:call-template name="contents_section-title"/>
5335
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
5336
+ <xsl:call-template name="contents_section-title"/>
5337
+ </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">
5011
5338
  <xsl:variable name="level">
5012
5339
  <xsl:call-template name="getLevel">
5013
5340
  <xsl:with-param name="depth" select="@depth"/>
@@ -5076,13 +5403,14 @@
5076
5403
  <xsl:apply-templates mode="bookmarks"/>
5077
5404
  </xsl:template><xsl:template name="addBookmarks">
5078
5405
  <xsl:param name="contents"/>
5079
- <xsl:if test="xalan:nodeset($contents)//item">
5406
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5407
+ <xsl:if test="$contents_nodes//item">
5080
5408
  <fo:bookmark-tree>
5081
5409
  <xsl:choose>
5082
- <xsl:when test="xalan:nodeset($contents)/doc">
5410
+ <xsl:when test="$contents_nodes/doc">
5083
5411
  <xsl:choose>
5084
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5085
- <xsl:for-each select="xalan:nodeset($contents)/doc">
5412
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
5413
+ <xsl:for-each select="$contents_nodes/doc">
5086
5414
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5087
5415
  <xsl:if test="@bundle = 'true'">
5088
5416
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -5133,7 +5461,7 @@
5133
5461
  </xsl:for-each>
5134
5462
  </xsl:when>
5135
5463
  <xsl:otherwise>
5136
- <xsl:for-each select="xalan:nodeset($contents)/doc">
5464
+ <xsl:for-each select="$contents_nodes/doc">
5137
5465
 
5138
5466
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5139
5467
 
@@ -5151,25 +5479,36 @@
5151
5479
  </xsl:choose>
5152
5480
  </xsl:when>
5153
5481
  <xsl:otherwise>
5154
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
5482
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
5483
+
5484
+ <xsl:call-template name="insertFigureBookmarks">
5485
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5486
+ </xsl:call-template>
5487
+
5488
+ <xsl:call-template name="insertTableBookmarks">
5489
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5490
+ <xsl:with-param name="lang" select="@lang"/>
5491
+ </xsl:call-template>
5492
+
5155
5493
  </xsl:otherwise>
5156
5494
  </xsl:choose>
5157
5495
 
5496
+
5158
5497
 
5159
5498
 
5160
5499
 
5161
5500
 
5162
-
5163
-
5501
+
5164
5502
 
5165
5503
  </fo:bookmark-tree>
5166
5504
  </xsl:if>
5167
5505
  </xsl:template><xsl:template name="insertFigureBookmarks">
5168
5506
  <xsl:param name="contents"/>
5169
- <xsl:if test="xalan:nodeset($contents)/figure">
5170
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
5507
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5508
+ <xsl:if test="$contents_nodes/figure">
5509
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
5171
5510
  <fo:bookmark-title>Figures</fo:bookmark-title>
5172
- <xsl:for-each select="xalan:nodeset($contents)/figure">
5511
+ <xsl:for-each select="$contents_nodes/figure">
5173
5512
  <fo:bookmark internal-destination="{@id}">
5174
5513
  <fo:bookmark-title>
5175
5514
  <xsl:value-of select="normalize-space(title)"/>
@@ -5178,18 +5517,40 @@
5178
5517
  </xsl:for-each>
5179
5518
  </fo:bookmark>
5180
5519
  </xsl:if>
5520
+
5521
+
5522
+ <xsl:if test="$contents_nodes//figures/figure">
5523
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5524
+
5525
+
5526
+
5527
+ <xsl:variable name="bookmark-title">
5528
+
5529
+ <xsl:value-of select="$title-list-figures"/>
5530
+
5531
+ </xsl:variable>
5532
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
5533
+ <xsl:for-each select="$contents_nodes//figures/figure">
5534
+ <fo:bookmark internal-destination="{@id}">
5535
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
5536
+ </fo:bookmark>
5537
+ </xsl:for-each>
5538
+ </fo:bookmark>
5539
+ </xsl:if>
5540
+
5181
5541
  </xsl:template><xsl:template name="insertTableBookmarks">
5182
5542
  <xsl:param name="contents"/>
5183
5543
  <xsl:param name="lang"/>
5184
- <xsl:if test="xalan:nodeset($contents)/table">
5185
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
5544
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5545
+ <xsl:if test="$contents_nodes/table">
5546
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
5186
5547
  <fo:bookmark-title>
5187
5548
  <xsl:choose>
5188
5549
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
5189
5550
  <xsl:otherwise>Tables</xsl:otherwise>
5190
5551
  </xsl:choose>
5191
5552
  </fo:bookmark-title>
5192
- <xsl:for-each select="xalan:nodeset($contents)/table">
5553
+ <xsl:for-each select="$contents_nodes/table">
5193
5554
  <fo:bookmark internal-destination="{@id}">
5194
5555
  <fo:bookmark-title>
5195
5556
  <xsl:value-of select="normalize-space(title)"/>
@@ -5198,6 +5559,29 @@
5198
5559
  </xsl:for-each>
5199
5560
  </fo:bookmark>
5200
5561
  </xsl:if>
5562
+
5563
+
5564
+ <xsl:if test="$contents_nodes//tables/table">
5565
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5566
+
5567
+
5568
+
5569
+ <xsl:variable name="bookmark-title">
5570
+
5571
+ <xsl:value-of select="$title-list-tables"/>
5572
+
5573
+ </xsl:variable>
5574
+
5575
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
5576
+
5577
+ <xsl:for-each select="$contents_nodes//tables/table">
5578
+ <fo:bookmark internal-destination="{@id}">
5579
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
5580
+ </fo:bookmark>
5581
+ </xsl:for-each>
5582
+ </fo:bookmark>
5583
+ </xsl:if>
5584
+
5201
5585
  </xsl:template><xsl:template name="getLangVersion">
5202
5586
  <xsl:param name="lang"/>
5203
5587
  <xsl:param name="doctype" select="''"/>
@@ -5414,12 +5798,140 @@
5414
5798
  </fo:block-container>
5415
5799
  </fo:block-container>
5416
5800
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5417
- <xsl:variable name="text">
5801
+ <xsl:choose>
5802
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
5803
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
5804
+ <xsl:choose>
5805
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
5806
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
5807
+ </xsl:when>
5808
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
5809
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5810
+ </xsl:otherwise>
5811
+ </xsl:choose>
5812
+ </xsl:when>
5813
+ <xsl:otherwise>
5814
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5815
+ </xsl:otherwise>
5816
+ </xsl:choose>
5817
+
5818
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
5819
+ <xsl:variable name="text_step1">
5418
5820
  <xsl:call-template name="add-zero-spaces-equal"/>
5419
5821
  </xsl:variable>
5420
- <xsl:call-template name="add-zero-spaces-java">
5421
- <xsl:with-param name="text" select="$text"/>
5422
- </xsl:call-template>
5822
+ <xsl:variable name="text_step2">
5823
+ <xsl:call-template name="add-zero-spaces-java">
5824
+ <xsl:with-param name="text" select="$text_step1"/>
5825
+ </xsl:call-template>
5826
+ </xsl:variable>
5827
+ <xsl:value-of select="$text_step2"/>
5828
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
5829
+ <xsl:apply-templates mode="syntax_highlight"/>
5830
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
5831
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
5832
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
5833
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
5834
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
5835
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
5836
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
5837
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
5838
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
5839
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
5840
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
5841
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
5842
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
5843
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
5844
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
5845
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
5846
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
5847
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
5848
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
5849
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
5850
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
5851
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
5852
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
5853
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
5854
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
5855
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
5856
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
5857
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
5858
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
5859
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
5860
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
5861
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
5862
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
5863
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
5864
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
5865
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
5866
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
5867
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
5868
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
5869
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
5870
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
5871
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
5872
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
5873
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
5874
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
5875
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
5876
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
5877
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
5878
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
5879
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
5880
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
5881
+ <fo:inline>
5882
+ <xsl:variable name="classes_">
5883
+ <xsl:call-template name="split">
5884
+ <xsl:with-param name="pText" select="@class"/>
5885
+ <xsl:with-param name="sep" select="' '"/>
5886
+ </xsl:call-template>
5887
+ <!-- a few classes together (_and_ suffix) -->
5888
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
5889
+ <item>hljs-char_and_escape_</item>
5890
+ </xsl:if>
5891
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
5892
+ <item>hljs-title_and_class_</item>
5893
+ </xsl:if>
5894
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
5895
+ <item>hljs-title_and_class__and_inherited__</item>
5896
+ </xsl:if>
5897
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
5898
+ <item>hljs-title_and_function_</item>
5899
+ </xsl:if>
5900
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
5901
+ <item>hljs-variable_and_language_</item>
5902
+ </xsl:if>
5903
+ <!-- with parent classes (_ suffix) -->
5904
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
5905
+ <item>hljs-meta_hljs-keyword</item>
5906
+ </xsl:if>
5907
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
5908
+ <item>hljs-meta_hljs-string</item>
5909
+ </xsl:if>
5910
+ </xsl:variable>
5911
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
5912
+
5913
+ <xsl:for-each select="$classes/item">
5914
+ <xsl:variable name="class_name" select="."/>
5915
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5916
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5917
+ </xsl:for-each>
5918
+ </xsl:for-each>
5919
+
5920
+ <!-- <xsl:variable name="class_name">
5921
+ <xsl:choose>
5922
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
5923
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
5924
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
5925
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
5926
+ </xsl:choose>
5927
+ </xsl:variable>
5928
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5929
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5930
+ </xsl:for-each> -->
5931
+
5932
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
5933
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
5934
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5423
5935
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
5424
5936
  <xsl:if test="normalize-space() != ''">
5425
5937
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -5754,6 +6266,8 @@
5754
6266
  </xsl:otherwise>
5755
6267
  </xsl:choose> -->
5756
6268
  </fo:block>
6269
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6270
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5757
6271
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5758
6272
  <xsl:if test="normalize-space() != ''">
5759
6273
  <xsl:value-of select="."/>
@@ -5800,11 +6314,14 @@
5800
6314
 
5801
6315
 
5802
6316
  <fo:block-container margin-left="0mm">
5803
-
5804
- <fo:block xsl:use-attribute-sets="quote-style">
6317
+ <fo:block-container xsl:use-attribute-sets="quote-style">
5805
6318
 
5806
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5807
- </fo:block>
6319
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6320
+ <fo:block role="BlockQuote">
6321
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6322
+ </fo:block>
6323
+ </fo:block-container>
6324
+ </fo:block-container>
5808
6325
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5809
6326
  <fo:block xsl:use-attribute-sets="quote-source-style">
5810
6327
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -5825,26 +6342,11 @@
5825
6342
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5826
6343
  <xsl:text>— </xsl:text>
5827
6344
  <xsl:apply-templates/>
5828
- </xsl:template><xsl:variable name="bibitem_hidden_">
5829
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5830
- <xsl:copy-of select="."/>
5831
- </xsl:for-each>
5832
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
5833
- <xsl:copy-of select="."/>
5834
- </xsl:for-each>
5835
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5836
-
5837
- <xsl:variable name="bibitemid">
5838
- <xsl:choose>
5839
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
5840
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
5841
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5842
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5843
- </xsl:choose>
5844
- </xsl:variable>
5845
-
6345
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
6346
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
6347
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5846
6348
  <xsl:choose>
5847
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
6349
+ <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) -->
5848
6350
  <fo:inline xsl:use-attribute-sets="eref-style">
5849
6351
  <xsl:if test="@type = 'footnote'">
5850
6352
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -5858,8 +6360,8 @@
5858
6360
  <xsl:variable name="text" select="normalize-space()"/>
5859
6361
 
5860
6362
 
5861
-
5862
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6363
+
6364
+ <fo:basic-link fox:alt-text="{@citeas}">
5863
6365
  <xsl:if test="normalize-space(@citeas) = ''">
5864
6366
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5865
6367
  </xsl:if>
@@ -5869,14 +6371,21 @@
5869
6371
 
5870
6372
  </xsl:if>
5871
6373
 
5872
-
6374
+ <xsl:choose>
6375
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
6376
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
6377
+ </xsl:when>
6378
+ <xsl:otherwise>
6379
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6380
+ </xsl:otherwise>
6381
+ </xsl:choose>
5873
6382
 
5874
6383
  <xsl:apply-templates/>
5875
6384
  </fo:basic-link>
5876
-
6385
+
5877
6386
  </fo:inline>
5878
6387
  </xsl:when>
5879
- <xsl:otherwise>
6388
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5880
6389
  <fo:inline><xsl:apply-templates/></fo:inline>
5881
6390
  </xsl:otherwise>
5882
6391
  </xsl:choose>
@@ -5944,6 +6453,31 @@
5944
6453
  <xsl:with-param name="count" select="$count - 1"/>
5945
6454
  </xsl:call-template>
5946
6455
  </xsl:if>
6456
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
6457
+ <xsl:variable name="level">
6458
+ <xsl:call-template name="getLevel"/>
6459
+ </xsl:variable>
6460
+ <xsl:variable name="font-size">
6461
+ inherit
6462
+ </xsl:variable>
6463
+ <xsl:variable name="levelTerm">
6464
+ <xsl:call-template name="getLevelTermName"/>
6465
+ </xsl:variable>
6466
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
6467
+
6468
+
6469
+
6470
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
6471
+ <fo:block xsl:use-attribute-sets="term-name-style">
6472
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
6473
+ </fo:block>
6474
+ </xsl:if>
6475
+
6476
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
6477
+ <xsl:call-template name="setStyle_preferred"/>
6478
+ <xsl:apply-templates/>
6479
+ </fo:block>
6480
+ </fo:block>
5947
6481
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
5948
6482
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
5949
6483
  <xsl:text> </xsl:text>
@@ -6032,26 +6566,10 @@
6032
6566
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6033
6567
  </xsl:template><xsl:variable name="ul_labels_">
6034
6568
 
6035
-
6036
-
6037
-
6038
-
6039
-
6040
-
6041
-
6042
-
6043
-
6044
-
6045
-
6046
-
6047
-
6048
-
6049
- <label level="1" font-size="75%">o</label> <!-- white circle -->
6050
- <label level="2">—</label> <!-- em dash -->
6051
- <label level="3" font-size="140%">•</label> <!-- bullet -->
6052
-
6053
-
6054
-
6569
+ <label level="1" font-size="75%">o</label> <!-- white circle -->
6570
+ <label level="2">—</label> <!-- em dash -->
6571
+ <label level="3" font-size="140%">•</label> <!-- bullet -->
6572
+
6055
6573
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6056
6574
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6057
6575
  <xsl:variable name="list_level">
@@ -6077,6 +6595,91 @@
6077
6595
  </xsl:template><xsl:template match="label" mode="ul_labels">
6078
6596
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6079
6597
  <xsl:value-of select="."/>
6598
+ </xsl:template><xsl:template name="getListItemFormat">
6599
+ <!-- Example: for BSI <?list-type loweralpha?> -->
6600
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
6601
+ <xsl:choose>
6602
+ <xsl:when test="local-name(..) = 'ul'">
6603
+ <xsl:choose>
6604
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
6605
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
6606
+ </xsl:choose>
6607
+ </xsl:when>
6608
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
6609
+
6610
+ <!-- Example: for BSI <?list-start 2?> -->
6611
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
6612
+
6613
+ <xsl:variable name="start_value">
6614
+ <xsl:choose>
6615
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
6616
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6617
+ </xsl:when>
6618
+ <xsl:when test="normalize-space(../@start) != ''">
6619
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6620
+ </xsl:when>
6621
+ <xsl:otherwise>0</xsl:otherwise>
6622
+ </xsl:choose>
6623
+ </xsl:variable>
6624
+
6625
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
6626
+
6627
+ <xsl:variable name="type">
6628
+ <xsl:choose>
6629
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
6630
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
6631
+
6632
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
6633
+
6634
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6635
+ <xsl:variable name="list_level">
6636
+ <xsl:choose>
6637
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
6638
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
6639
+ </xsl:choose>
6640
+ </xsl:variable>
6641
+
6642
+ <xsl:choose>
6643
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
6644
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
6645
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
6646
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
6647
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
6648
+ <xsl:otherwise> <!-- level 1 -->
6649
+ <xsl:choose>
6650
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
6651
+ <xsl:otherwise>alphabet</xsl:otherwise>
6652
+ </xsl:choose>
6653
+ </xsl:otherwise>
6654
+ </xsl:choose>
6655
+
6656
+ </xsl:otherwise>
6657
+ </xsl:choose>
6658
+ </xsl:variable>
6659
+
6660
+ <xsl:variable name="format">
6661
+ <xsl:choose>
6662
+ <xsl:when test="$type = 'arabic'">
6663
+ 1.
6664
+ </xsl:when>
6665
+ <xsl:when test="$type = 'alphabet'">
6666
+ a.
6667
+ </xsl:when>
6668
+ <xsl:when test="$type = 'alphabet_upper'">
6669
+ A.
6670
+ </xsl:when>
6671
+ <xsl:when test="$type = 'roman'">
6672
+ i.
6673
+ </xsl:when>
6674
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
6675
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
6676
+ </xsl:choose>
6677
+ </xsl:variable>
6678
+
6679
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
6680
+
6681
+ </xsl:otherwise>
6682
+ </xsl:choose>
6080
6683
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6081
6684
  <xsl:choose>
6082
6685
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6092,18 +6695,71 @@
6092
6695
 
6093
6696
  <fo:block-container margin-left="0mm">
6094
6697
  <fo:block>
6095
- <xsl:apply-templates select="." mode="ul_ol"/>
6698
+ <xsl:apply-templates select="." mode="list"/>
6096
6699
  </fo:block>
6097
6700
  </fo:block-container>
6098
6701
  </fo:block-container>
6099
6702
  </xsl:when>
6100
6703
  <xsl:otherwise>
6101
6704
  <fo:block>
6102
- <xsl:apply-templates select="." mode="ul_ol"/>
6705
+ <xsl:apply-templates select="." mode="list"/>
6103
6706
  </fo:block>
6104
6707
  </xsl:otherwise>
6105
6708
  </xsl:choose>
6106
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6709
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
6710
+ <fo:list-block xsl:use-attribute-sets="list-style">
6711
+
6712
+
6713
+
6714
+
6715
+
6716
+
6717
+
6718
+
6719
+
6720
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6721
+ </fo:list-block>
6722
+ <!-- <xsl:for-each select="./iho:note">
6723
+ <xsl:call-template name="note"/>
6724
+ </xsl:for-each> -->
6725
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
6726
+ </xsl:template><xsl:template match="*[local-name()='li']">
6727
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
6728
+ <xsl:copy-of select="@id"/>
6729
+
6730
+
6731
+
6732
+ <fo:list-item-label end-indent="label-end()">
6733
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
6734
+
6735
+
6736
+
6737
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6738
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
6739
+ <xsl:call-template name="append_add-style"/>
6740
+ </xsl:if>
6741
+
6742
+ <xsl:call-template name="getListItemFormat"/>
6743
+ </fo:block>
6744
+ </fo:list-item-label>
6745
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
6746
+ <fo:block>
6747
+
6748
+
6749
+
6750
+
6751
+
6752
+ <xsl:apply-templates/>
6753
+
6754
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
6755
+
6756
+ <xsl:for-each select="./bsi:note">
6757
+ <xsl:call-template name="note"/>
6758
+ </xsl:for-each> -->
6759
+ </fo:block>
6760
+ </fo:list-item-body>
6761
+ </fo:list-item>
6762
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
6107
6763
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6108
6764
  <bookmark><xsl:value-of select="@id"/></bookmark>
6109
6765
  </xsl:for-each>
@@ -6125,7 +6781,7 @@
6125
6781
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6126
6782
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6127
6783
  <xsl:if test="@to">
6128
- <xsl:value-of select="$dash"/>
6784
+ <xsl:value-of select="$en_dash"/>
6129
6785
  <xsl:copy>
6130
6786
  <xsl:copy-of select="@*"/>
6131
6787
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -6150,7 +6806,7 @@
6150
6806
  <xsl:param name="target"/>
6151
6807
  <!-- <node></node> -->
6152
6808
  <xsl:choose>
6153
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6809
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
6154
6810
  <!-- skip text (i.e. remove it) and process next element -->
6155
6811
  <!-- [removed_<xsl:value-of select="."/>] -->
6156
6812
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -6234,12 +6890,22 @@
6234
6890
  </xsl:variable>
6235
6891
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6236
6892
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6893
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
6894
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
6895
+ <!-- Index -->
6896
+ <xsl:apply-templates/>
6897
+ </fo:block>
6898
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
6899
+ <!-- Letter A, B, C, ... -->
6900
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
6901
+ <xsl:apply-templates/>
6902
+ </fo:block>
6237
6903
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6238
6904
  <xsl:apply-templates/>
6239
6905
  <fo:block>
6240
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
6241
- <fo:block> </fo:block>
6242
- </xsl:if>
6906
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6907
+ <fo:block> </fo:block>
6908
+ </xsl:if>
6243
6909
  </fo:block>
6244
6910
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6245
6911
  <xsl:apply-templates/>
@@ -6249,6 +6915,9 @@
6249
6915
 
6250
6916
  <xsl:apply-templates/>
6251
6917
  </fo:block>
6918
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
6919
+ <!-- to split by '_' and other chars -->
6920
+ <xsl:call-template name="add-zero-spaces-java"/>
6252
6921
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6253
6922
  <fo:inline id="{@id}" font-size="1pt"/>
6254
6923
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -6458,6 +7127,24 @@
6458
7127
  <xsl:apply-templates/>
6459
7128
  </fo:inline>
6460
7129
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7130
+
7131
+ <!-- list of footnotes to calculate actual footnotes number -->
7132
+ <xsl:variable name="p_fn_">
7133
+ <xsl:call-template name="get_fn_list"/>
7134
+ </xsl:variable>
7135
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7136
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7137
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7138
+ <!-- fn sequence number in document -->
7139
+ <xsl:variable name="current_fn_number">
7140
+ <xsl:choose>
7141
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7142
+ <xsl:otherwise>
7143
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7144
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7145
+ </xsl:otherwise>
7146
+ </xsl:choose>
7147
+ </xsl:variable>
6461
7148
  <fo:footnote>
6462
7149
  <xsl:variable name="number">
6463
7150
 
@@ -6466,22 +7153,26 @@
6466
7153
  <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6467
7154
  </xsl:when>
6468
7155
  <xsl:otherwise>
6469
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7156
+ <xsl:value-of select="$current_fn_number"/>
6470
7157
  </xsl:otherwise>
6471
7158
  </xsl:choose>
6472
7159
 
6473
7160
  </xsl:variable>
7161
+
7162
+ <xsl:variable name="current_fn_number_text">
7163
+ <xsl:value-of select="$number"/>
7164
+
7165
+ </xsl:variable>
7166
+
6474
7167
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
6475
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
6476
- <xsl:value-of select="$number"/>
6477
-
7168
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7169
+ <xsl:value-of select="$current_fn_number_text"/>
6478
7170
  </fo:basic-link>
6479
7171
  </fo:inline>
6480
7172
  <fo:footnote-body>
6481
7173
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
6482
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6483
- <xsl:value-of select="$number"/>
6484
-
7174
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7175
+ <xsl:value-of select="$current_fn_number_text"/>
6485
7176
  </fo:inline>
6486
7177
  <xsl:apply-templates/>
6487
7178
  </fo:block>
@@ -6607,7 +7298,7 @@
6607
7298
  </fo:table-body>
6608
7299
  </fo:table>
6609
7300
  </fo:block>
6610
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7301
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
6611
7302
  <fo:table-row min-height="5mm">
6612
7303
  <xsl:apply-templates/>
6613
7304
  </fo:table-row>
@@ -6727,6 +7418,78 @@
6727
7418
  <xsl:apply-templates/>
6728
7419
  </fo:block>
6729
7420
 
7421
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
7422
+ <xsl:copy>
7423
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
7424
+ </xsl:copy>
7425
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
7426
+ <xsl:copy>
7427
+ <xsl:copy-of select="@*"/>
7428
+
7429
+ <xsl:variable name="nodes_preface_">
7430
+ <xsl:for-each select="*">
7431
+ <node id="{@id}"/>
7432
+ </xsl:for-each>
7433
+ </xsl:variable>
7434
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
7435
+
7436
+ <xsl:for-each select="*">
7437
+ <xsl:sort select="@displayorder" data-type="number"/>
7438
+
7439
+ <!-- process Section's title -->
7440
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7441
+ <xsl:if test="$preceding-sibling_id != ''">
7442
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7443
+ </xsl:if>
7444
+
7445
+ <xsl:choose>
7446
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7447
+ <xsl:otherwise>
7448
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7449
+ </xsl:otherwise>
7450
+ </xsl:choose>
7451
+
7452
+ </xsl:for-each>
7453
+ </xsl:copy>
7454
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
7455
+ <xsl:copy>
7456
+ <xsl:copy-of select="@*"/>
7457
+
7458
+ <xsl:variable name="nodes_sections_">
7459
+ <xsl:for-each select="*">
7460
+ <node id="{@id}"/>
7461
+ </xsl:for-each>
7462
+ </xsl:variable>
7463
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
7464
+
7465
+ <!-- move section 'Normative references' inside 'sections' -->
7466
+ <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']]">
7467
+ <xsl:sort select="@displayorder" data-type="number"/>
7468
+
7469
+ <!-- process Section's title -->
7470
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7471
+ <xsl:if test="$preceding-sibling_id != ''">
7472
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7473
+ </xsl:if>
7474
+
7475
+ <xsl:choose>
7476
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7477
+ <xsl:otherwise>
7478
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7479
+ </xsl:otherwise>
7480
+ </xsl:choose>
7481
+
7482
+ </xsl:for-each>
7483
+ </xsl:copy>
7484
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
7485
+ <xsl:copy>
7486
+ <xsl:copy-of select="@*"/>
7487
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
7488
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
7489
+ <xsl:sort select="@displayorder" data-type="number"/>
7490
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7491
+ </xsl:for-each>
7492
+ </xsl:copy>
6730
7493
  </xsl:template><xsl:template name="convertDate">
6731
7494
  <xsl:param name="date"/>
6732
7495
  <xsl:param name="format" select="'short'"/>
@@ -6840,9 +7603,6 @@
6840
7603
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
6841
7604
  </xsl:choose>
6842
7605
  </xsl:template><xsl:template name="addPDFUAmeta">
6843
- <xsl:variable name="lang">
6844
- <xsl:call-template name="getLang"/>
6845
- </xsl:variable>
6846
7606
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6847
7607
  <pdf:dictionary type="normal" key="ViewerPreferences">
6848
7608
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -7070,10 +7830,12 @@
7070
7830
  <xsl:param name="key"/>
7071
7831
  <xsl:param name="formatted">false</xsl:param>
7072
7832
  <xsl:param name="lang"/>
7833
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
7073
7834
 
7074
7835
  <xsl:variable name="curr_lang">
7075
7836
  <xsl:choose>
7076
7837
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7838
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7077
7839
  <xsl:otherwise>
7078
7840
  <xsl:call-template name="getLang"/>
7079
7841
  </xsl:otherwise>
@@ -7108,6 +7870,7 @@
7108
7870
  </xsl:otherwise>
7109
7871
  </xsl:choose>
7110
7872
  </xsl:when>
7873
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7111
7874
  <xsl:otherwise>
7112
7875
  <xsl:variable name="key_">
7113
7876
  <xsl:call-template name="capitalize">
@@ -7177,53 +7940,153 @@
7177
7940
  <xsl:param name="first"/>
7178
7941
  <xsl:if test="$number != ''">
7179
7942
  <xsl:variable name="words">
7180
- <words>
7181
- <word cardinal="1">One-</word>
7182
- <word ordinal="1">First </word>
7183
- <word cardinal="2">Two-</word>
7184
- <word ordinal="2">Second </word>
7185
- <word cardinal="3">Three-</word>
7186
- <word ordinal="3">Third </word>
7187
- <word cardinal="4">Four-</word>
7188
- <word ordinal="4">Fourth </word>
7189
- <word cardinal="5">Five-</word>
7190
- <word ordinal="5">Fifth </word>
7191
- <word cardinal="6">Six-</word>
7192
- <word ordinal="6">Sixth </word>
7193
- <word cardinal="7">Seven-</word>
7194
- <word ordinal="7">Seventh </word>
7195
- <word cardinal="8">Eight-</word>
7196
- <word ordinal="8">Eighth </word>
7197
- <word cardinal="9">Nine-</word>
7198
- <word ordinal="9">Ninth </word>
7199
- <word ordinal="10">Tenth </word>
7200
- <word ordinal="11">Eleventh </word>
7201
- <word ordinal="12">Twelfth </word>
7202
- <word ordinal="13">Thirteenth </word>
7203
- <word ordinal="14">Fourteenth </word>
7204
- <word ordinal="15">Fifteenth </word>
7205
- <word ordinal="16">Sixteenth </word>
7206
- <word ordinal="17">Seventeenth </word>
7207
- <word ordinal="18">Eighteenth </word>
7208
- <word ordinal="19">Nineteenth </word>
7209
- <word cardinal="20">Twenty-</word>
7210
- <word ordinal="20">Twentieth </word>
7211
- <word cardinal="30">Thirty-</word>
7212
- <word ordinal="30">Thirtieth </word>
7213
- <word cardinal="40">Forty-</word>
7214
- <word ordinal="40">Fortieth </word>
7215
- <word cardinal="50">Fifty-</word>
7216
- <word ordinal="50">Fiftieth </word>
7217
- <word cardinal="60">Sixty-</word>
7218
- <word ordinal="60">Sixtieth </word>
7219
- <word cardinal="70">Seventy-</word>
7220
- <word ordinal="70">Seventieth </word>
7221
- <word cardinal="80">Eighty-</word>
7222
- <word ordinal="80">Eightieth </word>
7223
- <word cardinal="90">Ninety-</word>
7224
- <word ordinal="90">Ninetieth </word>
7225
- <word cardinal="100">Hundred-</word>
7226
- <word ordinal="100">Hundredth </word>
7943
+ <words>
7944
+ <xsl:choose>
7945
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
7946
+ <word cardinal="1">Une-</word>
7947
+ <word ordinal="1">Première </word>
7948
+ <word cardinal="2">Deux-</word>
7949
+ <word ordinal="2">Seconde </word>
7950
+ <word cardinal="3">Trois-</word>
7951
+ <word ordinal="3">Tierce </word>
7952
+ <word cardinal="4">Quatre-</word>
7953
+ <word ordinal="4">Quatrième </word>
7954
+ <word cardinal="5">Cinq-</word>
7955
+ <word ordinal="5">Cinquième </word>
7956
+ <word cardinal="6">Six-</word>
7957
+ <word ordinal="6">Sixième </word>
7958
+ <word cardinal="7">Sept-</word>
7959
+ <word ordinal="7">Septième </word>
7960
+ <word cardinal="8">Huit-</word>
7961
+ <word ordinal="8">Huitième </word>
7962
+ <word cardinal="9">Neuf-</word>
7963
+ <word ordinal="9">Neuvième </word>
7964
+ <word ordinal="10">Dixième </word>
7965
+ <word ordinal="11">Onzième </word>
7966
+ <word ordinal="12">Douzième </word>
7967
+ <word ordinal="13">Treizième </word>
7968
+ <word ordinal="14">Quatorzième </word>
7969
+ <word ordinal="15">Quinzième </word>
7970
+ <word ordinal="16">Seizième </word>
7971
+ <word ordinal="17">Dix-septième </word>
7972
+ <word ordinal="18">Dix-huitième </word>
7973
+ <word ordinal="19">Dix-neuvième </word>
7974
+ <word cardinal="20">Vingt-</word>
7975
+ <word ordinal="20">Vingtième </word>
7976
+ <word cardinal="30">Trente-</word>
7977
+ <word ordinal="30">Trentième </word>
7978
+ <word cardinal="40">Quarante-</word>
7979
+ <word ordinal="40">Quarantième </word>
7980
+ <word cardinal="50">Cinquante-</word>
7981
+ <word ordinal="50">Cinquantième </word>
7982
+ <word cardinal="60">Soixante-</word>
7983
+ <word ordinal="60">Soixantième </word>
7984
+ <word cardinal="70">Septante-</word>
7985
+ <word ordinal="70">Septantième </word>
7986
+ <word cardinal="80">Huitante-</word>
7987
+ <word ordinal="80">Huitantième </word>
7988
+ <word cardinal="90">Nonante-</word>
7989
+ <word ordinal="90">Nonantième </word>
7990
+ <word cardinal="100">Cent-</word>
7991
+ <word ordinal="100">Centième </word>
7992
+ </xsl:when>
7993
+ <xsl:when test="$lang = 'ru'">
7994
+ <word cardinal="1">Одна-</word>
7995
+ <word ordinal="1">Первое </word>
7996
+ <word cardinal="2">Две-</word>
7997
+ <word ordinal="2">Второе </word>
7998
+ <word cardinal="3">Три-</word>
7999
+ <word ordinal="3">Третье </word>
8000
+ <word cardinal="4">Четыре-</word>
8001
+ <word ordinal="4">Четвертое </word>
8002
+ <word cardinal="5">Пять-</word>
8003
+ <word ordinal="5">Пятое </word>
8004
+ <word cardinal="6">Шесть-</word>
8005
+ <word ordinal="6">Шестое </word>
8006
+ <word cardinal="7">Семь-</word>
8007
+ <word ordinal="7">Седьмое </word>
8008
+ <word cardinal="8">Восемь-</word>
8009
+ <word ordinal="8">Восьмое </word>
8010
+ <word cardinal="9">Девять-</word>
8011
+ <word ordinal="9">Девятое </word>
8012
+ <word ordinal="10">Десятое </word>
8013
+ <word ordinal="11">Одиннадцатое </word>
8014
+ <word ordinal="12">Двенадцатое </word>
8015
+ <word ordinal="13">Тринадцатое </word>
8016
+ <word ordinal="14">Четырнадцатое </word>
8017
+ <word ordinal="15">Пятнадцатое </word>
8018
+ <word ordinal="16">Шестнадцатое </word>
8019
+ <word ordinal="17">Семнадцатое </word>
8020
+ <word ordinal="18">Восемнадцатое </word>
8021
+ <word ordinal="19">Девятнадцатое </word>
8022
+ <word cardinal="20">Двадцать-</word>
8023
+ <word ordinal="20">Двадцатое </word>
8024
+ <word cardinal="30">Тридцать-</word>
8025
+ <word ordinal="30">Тридцатое </word>
8026
+ <word cardinal="40">Сорок-</word>
8027
+ <word ordinal="40">Сороковое </word>
8028
+ <word cardinal="50">Пятьдесят-</word>
8029
+ <word ordinal="50">Пятидесятое </word>
8030
+ <word cardinal="60">Шестьдесят-</word>
8031
+ <word ordinal="60">Шестидесятое </word>
8032
+ <word cardinal="70">Семьдесят-</word>
8033
+ <word ordinal="70">Семидесятое </word>
8034
+ <word cardinal="80">Восемьдесят-</word>
8035
+ <word ordinal="80">Восьмидесятое </word>
8036
+ <word cardinal="90">Девяносто-</word>
8037
+ <word ordinal="90">Девяностое </word>
8038
+ <word cardinal="100">Сто-</word>
8039
+ <word ordinal="100">Сотое </word>
8040
+ </xsl:when>
8041
+ <xsl:otherwise> <!-- default english -->
8042
+ <word cardinal="1">One-</word>
8043
+ <word ordinal="1">First </word>
8044
+ <word cardinal="2">Two-</word>
8045
+ <word ordinal="2">Second </word>
8046
+ <word cardinal="3">Three-</word>
8047
+ <word ordinal="3">Third </word>
8048
+ <word cardinal="4">Four-</word>
8049
+ <word ordinal="4">Fourth </word>
8050
+ <word cardinal="5">Five-</word>
8051
+ <word ordinal="5">Fifth </word>
8052
+ <word cardinal="6">Six-</word>
8053
+ <word ordinal="6">Sixth </word>
8054
+ <word cardinal="7">Seven-</word>
8055
+ <word ordinal="7">Seventh </word>
8056
+ <word cardinal="8">Eight-</word>
8057
+ <word ordinal="8">Eighth </word>
8058
+ <word cardinal="9">Nine-</word>
8059
+ <word ordinal="9">Ninth </word>
8060
+ <word ordinal="10">Tenth </word>
8061
+ <word ordinal="11">Eleventh </word>
8062
+ <word ordinal="12">Twelfth </word>
8063
+ <word ordinal="13">Thirteenth </word>
8064
+ <word ordinal="14">Fourteenth </word>
8065
+ <word ordinal="15">Fifteenth </word>
8066
+ <word ordinal="16">Sixteenth </word>
8067
+ <word ordinal="17">Seventeenth </word>
8068
+ <word ordinal="18">Eighteenth </word>
8069
+ <word ordinal="19">Nineteenth </word>
8070
+ <word cardinal="20">Twenty-</word>
8071
+ <word ordinal="20">Twentieth </word>
8072
+ <word cardinal="30">Thirty-</word>
8073
+ <word ordinal="30">Thirtieth </word>
8074
+ <word cardinal="40">Forty-</word>
8075
+ <word ordinal="40">Fortieth </word>
8076
+ <word cardinal="50">Fifty-</word>
8077
+ <word ordinal="50">Fiftieth </word>
8078
+ <word cardinal="60">Sixty-</word>
8079
+ <word ordinal="60">Sixtieth </word>
8080
+ <word cardinal="70">Seventy-</word>
8081
+ <word ordinal="70">Seventieth </word>
8082
+ <word cardinal="80">Eighty-</word>
8083
+ <word ordinal="80">Eightieth </word>
8084
+ <word cardinal="90">Ninety-</word>
8085
+ <word ordinal="90">Ninetieth </word>
8086
+ <word cardinal="100">Hundred-</word>
8087
+ <word ordinal="100">Hundredth </word>
8088
+ </xsl:otherwise>
8089
+ </xsl:choose>
7227
8090
  </words>
7228
8091
  </xsl:variable>
7229
8092
 
@@ -7297,4 +8160,18 @@
7297
8160
  <xsl:otherwise>_</xsl:otherwise>
7298
8161
  </xsl:choose>
7299
8162
  </xsl:attribute>
8163
+ </xsl:template><xsl:template name="substring-after-last">
8164
+ <xsl:param name="value"/>
8165
+ <xsl:param name="delimiter"/>
8166
+ <xsl:choose>
8167
+ <xsl:when test="contains($value, $delimiter)">
8168
+ <xsl:call-template name="substring-after-last">
8169
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8170
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8171
+ </xsl:call-template>
8172
+ </xsl:when>
8173
+ <xsl:otherwise>
8174
+ <xsl:value-of select="$value"/>
8175
+ </xsl:otherwise>
8176
+ </xsl:choose>
7300
8177
  </xsl:template></xsl:stylesheet>