metanorma-ogc 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,8 +57,21 @@
57
57
  <xsl:copy-of select="@id"/>
58
58
  <xsl:variable name="title">
59
59
  <xsl:apply-templates select=".//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node()"/>
60
+ <xsl:if test=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()">
61
+ <xsl:text>: </xsl:text>
62
+ <xsl:variable name="recommendationLabel">
63
+ <tt><xsl:copy-of select=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()"/></tt>
64
+ </xsl:variable>
65
+ <xsl:apply-templates select="xalan:nodeset($recommendationLabel)/node()"/>
66
+ </xsl:if>
67
+ </xsl:variable>
68
+ <xsl:variable name="bookmark">
69
+ <xsl:value-of select="normalize-space(.//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node())"/>
70
+ <xsl:if test=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()">
71
+ <xsl:text>: </xsl:text>
72
+ <xsl:value-of select="normalize-space(.//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node())"/>
73
+ </xsl:if>
60
74
  </xsl:variable>
61
- <xsl:variable name="bookmark" select="normalize-space(.//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node())"/>
62
75
  <xsl:variable name="regex_str" select="'^([^0-9]+) (\d+).*'"/>
63
76
  <xsl:variable name="class" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$1')"/>
64
77
  <xsl:variable name="num" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$2')"/>
@@ -102,37 +115,11 @@
102
115
 
103
116
  <xsl:variable name="contents">
104
117
  <contents>
105
-
106
118
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
107
- <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="contents"/> -->
108
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/>
109
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']" mode="contents"/>
110
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']" mode="contents"/>
111
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents"/>
112
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']" mode="contents"/>
113
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']" mode="contents"/>
114
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents"/>
115
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
116
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'security') and not(@type = 'submitting_orgs') and not(@type = 'keywords')]" mode="contents"/>
117
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements" mode="contents"/>
118
-
119
-
120
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="contents"/>
121
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="contents"/>
122
- <!-- Normative references -->
123
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="contents"/>
124
- <!-- Terms and definitions -->
125
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents"/>
126
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="contents"/>
127
-
128
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="contents"/>
129
-
130
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="contents"/>
131
-
132
- <!-- Bibliography -->
133
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="contents"/>
134
-
119
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
135
120
 
121
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
122
+ <xsl:apply-templates select="//ogc:indexsect" mode="contents"/>
136
123
  </contents>
137
124
  </xsl:variable>
138
125
 
@@ -236,9 +223,22 @@
236
223
  </fo:table>
237
224
  </fo:block>
238
225
 
239
- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm">
240
- <fo:block-container width="155mm">
226
+ <!-- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm"> -->
227
+ <fo:block-container absolute-position="fixed" left="16.5mm" top="40mm" height="170mm">
228
+ <fo:block-container width="155mm" height="99%" display-align="center">
241
229
  <fo:block font-size="33pt" role="H1">
230
+ <xsl:variable name="length_title" select="string-length($doctitle)"/>
231
+ <xsl:variable name="fit_font-size">
232
+ <xsl:choose>
233
+ <xsl:when test="$length_title &gt; 230">20</xsl:when>
234
+ <xsl:when test="$length_title &gt; 170">26</xsl:when>
235
+ <xsl:when test="$length_title &gt; 155">28</xsl:when>
236
+ <xsl:when test="$length_title &gt; 130">30</xsl:when>
237
+ </xsl:choose>
238
+ </xsl:variable>
239
+ <xsl:if test="normalize-space($fit_font-size) != ''">
240
+ <xsl:attribute name="font-size"><xsl:value-of select="$fit_font-size"/>pt</xsl:attribute>
241
+ </xsl:if>
242
242
  <xsl:call-template name="addLetterSpacing">
243
243
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctitle))"/>
244
244
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -442,7 +442,7 @@
442
442
  <xsl:if test="@level = 1 or @parent = 'annex'">
443
443
  <xsl:attribute name="font-size">12pt</xsl:attribute>
444
444
  </xsl:if>
445
- <xsl:if test="@level &gt;= 2 and not(@parent = 'annex')">
445
+ <xsl:if test="@level &gt;= 2"> <!-- and not(@parent = 'annex') -->
446
446
  <xsl:attribute name="font-size">10pt</xsl:attribute>
447
447
  </xsl:if>
448
448
 
@@ -629,60 +629,49 @@
629
629
 
630
630
  <fo:block line-height="125%">
631
631
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
632
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract"/>
633
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']"/>
634
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']"/>
635
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:foreword">
636
- <fo:block break-after="page"/>
637
- </xsl:if>
638
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword"/>
639
-
640
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']">
641
- <fo:block break-after="page"/>
642
- </xsl:if>
643
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']"/>
644
-
645
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']">
646
- <fo:block break-after="page"/>
647
- </xsl:if>
648
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"/>
649
-
650
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters"/>
651
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:introduction">
652
- <fo:block break-after="page"/>
653
- </xsl:if>
654
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction"/>
655
-
656
632
 
633
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
634
+ <xsl:sort select="@displayorder" data-type="number"/>
635
+
636
+ <xsl:if test="local-name() = 'foreword' or (local-name() = 'clause' and @type = 'security') or (local-name() = 'clause' and @type = 'submitting_orgs') or local-name() = 'introduction'">
637
+ <fo:block break-after="page"/>
638
+ </xsl:if>
639
+
640
+ <xsl:apply-templates select="."/>
641
+ </xsl:for-each>
657
642
 
658
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'security') and not(@type = 'submitting_orgs') and not(@type = 'keywords')]"/>
659
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements"/>
660
643
  </fo:block>
661
644
  </fo:flow>
662
645
  </fo:page-sequence>
663
646
 
664
647
 
665
648
  <!-- Document Pages -->
649
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
650
+ <xsl:sort select="@displayorder" data-type="number"/>
651
+ <xsl:choose>
652
+ <xsl:when test="local-name() = 'clause' and @type='scope'">
653
+ <xsl:apply-templates select="." mode="sections">
654
+ <xsl:with-param name="initial-page-number" select="1"/>
655
+ </xsl:apply-templates>
656
+ </xsl:when>
657
+ <xsl:otherwise>
658
+ <xsl:apply-templates select="." mode="sections"/>
659
+ </xsl:otherwise>
660
+ </xsl:choose>
661
+ </xsl:for-each>
666
662
 
667
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="sections">
668
- <xsl:with-param name="initial-page-number" select="1"/>
669
- </xsl:apply-templates>
670
-
671
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="sections"/>
672
-
673
- <!-- Normative references -->
674
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="sections"/>
675
-
676
- <!-- Terms and definitions -->
677
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="sections"/>
678
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="sections"/>
679
-
680
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="sections"/>
681
-
682
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="sections"/>
663
+ <xsl:for-each select="/*/*[local-name()='annex']">
664
+ <xsl:sort select="@displayorder" data-type="number"/>
665
+ <xsl:apply-templates select="." mode="sections"/>
666
+ </xsl:for-each>
683
667
 
684
668
  <!-- Bibliography -->
685
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="sections"/>
669
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
670
+ <xsl:sort select="@displayorder" data-type="number"/>
671
+ <xsl:apply-templates select="." mode="sections"/>
672
+ </xsl:for-each>
673
+
674
+ <xsl:apply-templates select="//ogc:indexsect" mode="sections"/>
686
675
 
687
676
  <!-- End Document Pages -->
688
677
 
@@ -1059,7 +1048,14 @@
1059
1048
 
1060
1049
 
1061
1050
  <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
1051
+ <xsl:variable name="ul_indent">6mm</xsl:variable>
1062
1052
  <fo:block-container margin-left="13mm">
1053
+ <xsl:if test="self::ogc:ul and not(ancestor::ogc:ul) and not(ancestor::ogc:ol)"> <!-- if first level -->
1054
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
1055
+ </xsl:if>
1056
+ <xsl:if test="self::ogc:ul and ancestor::*[2][self::ogc:ul]"> <!-- ul/li/ul -->
1057
+ <xsl:attribute name="margin-left"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1058
+ </xsl:if>
1063
1059
  <xsl:if test="ancestor::ogc:table">
1064
1060
  <xsl:attribute name="margin-left">4mm</xsl:attribute>
1065
1061
  </xsl:if>
@@ -1071,6 +1067,9 @@
1071
1067
  </xsl:if>
1072
1068
  <fo:block-container margin-left="0mm">
1073
1069
  <fo:list-block xsl:use-attribute-sets="list-style">
1070
+ <xsl:if test="self::ogc:ul">
1071
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1072
+ </xsl:if>
1074
1073
  <xsl:if test="ancestor::ogc:table">
1075
1074
  <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
1076
1075
  </xsl:if>
@@ -1512,6 +1511,10 @@
1512
1511
  <xsl:text>Édition </xsl:text>
1513
1512
  </title-edition>
1514
1513
 
1514
+ <title-edition lang="ru">
1515
+ <xsl:text>Издание </xsl:text>
1516
+ </title-edition>
1517
+
1515
1518
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1516
1519
  <title-toc lang="en">
1517
1520
 
@@ -1540,7 +1543,11 @@
1540
1543
 
1541
1544
 
1542
1545
 
1543
- </title-part>
1546
+ </title-part>
1547
+ <title-part lang="ru">
1548
+
1549
+
1550
+ </title-part>
1544
1551
  <title-part lang="zh">第 # 部分:</title-part>
1545
1552
 
1546
1553
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1556,6 +1563,7 @@
1556
1563
 
1557
1564
  <title-summary lang="en">Summary</title-summary>
1558
1565
 
1566
+ <title-continued lang="ru">(продолжение)</title-continued>
1559
1567
  <title-continued lang="en">(continued)</title-continued>
1560
1568
  <title-continued lang="fr">(continué)</title-continued>
1561
1569
 
@@ -2383,13 +2391,19 @@
2383
2391
  </xsl:attribute-set><xsl:variable name="color-added-text">
2384
2392
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2385
2393
  </xsl:variable><xsl:attribute-set name="add-style">
2386
- <xsl:attribute name="color">red</xsl:attribute>
2387
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2388
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2389
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2390
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2391
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2392
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2394
+
2395
+ <xsl:attribute name="color">red</xsl:attribute>
2396
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2397
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2398
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2399
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2400
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2401
+
2402
+ </xsl:attribute-set><xsl:variable name="add-style">
2403
+ <add-style xsl:use-attribute-sets="add-style"/>
2404
+ </xsl:variable><xsl:template name="append_add-style">
2405
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2406
+ </xsl:template><xsl:variable name="color-deleted-text">
2393
2407
  <xsl:text>red</xsl:text>
2394
2408
  </xsl:variable><xsl:attribute-set name="del-style">
2395
2409
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -2833,14 +2847,42 @@
2833
2847
 
2834
2848
 
2835
2849
  </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">
2850
+ <xsl:variable name="nodes_preface_">
2851
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2852
+ <node id="{@id}"/>
2853
+ </xsl:for-each>
2854
+ </xsl:variable>
2855
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2856
+
2836
2857
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2837
2858
  <xsl:sort select="@displayorder" data-type="number"/>
2859
+
2860
+ <!-- process Section's title -->
2861
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2862
+ <xsl:if test="$preceding-sibling_id != ''">
2863
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2864
+ </xsl:if>
2865
+
2838
2866
  <xsl:apply-templates select="." mode="contents"/>
2839
2867
  </xsl:for-each>
2840
2868
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2841
2869
 
2870
+ <xsl:variable name="nodes_sections_">
2871
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
2872
+ <node id="{@id}"/>
2873
+ </xsl:for-each>
2874
+ </xsl:variable>
2875
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
2876
+
2842
2877
  <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']]">
2843
2878
  <xsl:sort select="@displayorder" data-type="number"/>
2879
+
2880
+ <!-- process Section's title -->
2881
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2882
+ <xsl:if test="$preceding-sibling_id != ''">
2883
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2884
+ </xsl:if>
2885
+
2844
2886
  <xsl:apply-templates select="." mode="contents"/>
2845
2887
  </xsl:for-each>
2846
2888
 
@@ -3001,7 +3043,7 @@
3001
3043
  </xsl:call-template>
3002
3044
  </xsl:if>
3003
3045
  </xsl:variable>
3004
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3046
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3005
3047
 
3006
3048
 
3007
3049
  <xsl:variable name="margin-side">
@@ -3267,7 +3309,7 @@
3267
3309
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3268
3310
  <!-- 2009 thinspace -->
3269
3311
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3270
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3312
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3271
3313
  </xsl:call-template>
3272
3314
  </xsl:variable>
3273
3315
  <xsl:variable name="max_length">
@@ -4907,6 +4949,9 @@
4907
4949
  </fo:inline>
4908
4950
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4909
4951
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4952
+ <xsl:if test="parent::*[local-name() = 'add']">
4953
+ <xsl:call-template name="append_add-style"/>
4954
+ </xsl:if>
4910
4955
  <xsl:apply-templates/>
4911
4956
  </fo:basic-link>
4912
4957
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -5008,6 +5053,13 @@
5008
5053
 
5009
5054
 
5010
5055
 
5056
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5057
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5058
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5059
+ <xsl:call-template name="append_add-style"/>
5060
+ </xsl:if>
5061
+
5062
+
5011
5063
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
5012
5064
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
5013
5065
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -5046,6 +5098,12 @@
5046
5098
 
5047
5099
 
5048
5100
 
5101
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5102
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5103
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5104
+ <xsl:call-template name="append_add-style"/>
5105
+ </xsl:if>
5106
+
5049
5107
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5050
5108
 
5051
5109
  </fo:inline>
@@ -5099,6 +5157,7 @@
5099
5157
  </fo:block>
5100
5158
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5101
5159
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5160
+
5102
5161
 
5103
5162
 
5104
5163
 
@@ -5537,7 +5596,11 @@
5537
5596
  <xsl:value-of select="."/>
5538
5597
  </xsl:template><xsl:template match="node()" mode="contents">
5539
5598
  <xsl:apply-templates mode="contents"/>
5540
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
5599
+ </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">
5600
+ <xsl:call-template name="contents_section-title"/>
5601
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
5602
+ <xsl:call-template name="contents_section-title"/>
5603
+ </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">
5541
5604
  <xsl:variable name="level">
5542
5605
  <xsl:call-template name="getLevel">
5543
5606
  <xsl:with-param name="depth" select="@depth"/>
@@ -6937,7 +7000,7 @@
6937
7000
 
6938
7001
 
6939
7002
 
6940
-
7003
+
6941
7004
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6942
7005
  </fo:list-block>
6943
7006
  <!-- <xsl:for-each select="./iho:note">
@@ -6955,6 +7018,11 @@
6955
7018
 
6956
7019
 
6957
7020
 
7021
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7022
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7023
+ <xsl:call-template name="append_add-style"/>
7024
+ </xsl:if>
7025
+
6958
7026
  <xsl:call-template name="getListItemFormat"/>
6959
7027
  </fo:block>
6960
7028
  </fo:list-item-label>
@@ -8166,53 +8234,153 @@
8166
8234
  <xsl:param name="first"/>
8167
8235
  <xsl:if test="$number != ''">
8168
8236
  <xsl:variable name="words">
8169
- <words>
8170
- <word cardinal="1">One-</word>
8171
- <word ordinal="1">First </word>
8172
- <word cardinal="2">Two-</word>
8173
- <word ordinal="2">Second </word>
8174
- <word cardinal="3">Three-</word>
8175
- <word ordinal="3">Third </word>
8176
- <word cardinal="4">Four-</word>
8177
- <word ordinal="4">Fourth </word>
8178
- <word cardinal="5">Five-</word>
8179
- <word ordinal="5">Fifth </word>
8180
- <word cardinal="6">Six-</word>
8181
- <word ordinal="6">Sixth </word>
8182
- <word cardinal="7">Seven-</word>
8183
- <word ordinal="7">Seventh </word>
8184
- <word cardinal="8">Eight-</word>
8185
- <word ordinal="8">Eighth </word>
8186
- <word cardinal="9">Nine-</word>
8187
- <word ordinal="9">Ninth </word>
8188
- <word ordinal="10">Tenth </word>
8189
- <word ordinal="11">Eleventh </word>
8190
- <word ordinal="12">Twelfth </word>
8191
- <word ordinal="13">Thirteenth </word>
8192
- <word ordinal="14">Fourteenth </word>
8193
- <word ordinal="15">Fifteenth </word>
8194
- <word ordinal="16">Sixteenth </word>
8195
- <word ordinal="17">Seventeenth </word>
8196
- <word ordinal="18">Eighteenth </word>
8197
- <word ordinal="19">Nineteenth </word>
8198
- <word cardinal="20">Twenty-</word>
8199
- <word ordinal="20">Twentieth </word>
8200
- <word cardinal="30">Thirty-</word>
8201
- <word ordinal="30">Thirtieth </word>
8202
- <word cardinal="40">Forty-</word>
8203
- <word ordinal="40">Fortieth </word>
8204
- <word cardinal="50">Fifty-</word>
8205
- <word ordinal="50">Fiftieth </word>
8206
- <word cardinal="60">Sixty-</word>
8207
- <word ordinal="60">Sixtieth </word>
8208
- <word cardinal="70">Seventy-</word>
8209
- <word ordinal="70">Seventieth </word>
8210
- <word cardinal="80">Eighty-</word>
8211
- <word ordinal="80">Eightieth </word>
8212
- <word cardinal="90">Ninety-</word>
8213
- <word ordinal="90">Ninetieth </word>
8214
- <word cardinal="100">Hundred-</word>
8215
- <word ordinal="100">Hundredth </word>
8237
+ <words>
8238
+ <xsl:choose>
8239
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8240
+ <word cardinal="1">Une-</word>
8241
+ <word ordinal="1">Première </word>
8242
+ <word cardinal="2">Deux-</word>
8243
+ <word ordinal="2">Seconde </word>
8244
+ <word cardinal="3">Trois-</word>
8245
+ <word ordinal="3">Tierce </word>
8246
+ <word cardinal="4">Quatre-</word>
8247
+ <word ordinal="4">Quatrième </word>
8248
+ <word cardinal="5">Cinq-</word>
8249
+ <word ordinal="5">Cinquième </word>
8250
+ <word cardinal="6">Six-</word>
8251
+ <word ordinal="6">Sixième </word>
8252
+ <word cardinal="7">Sept-</word>
8253
+ <word ordinal="7">Septième </word>
8254
+ <word cardinal="8">Huit-</word>
8255
+ <word ordinal="8">Huitième </word>
8256
+ <word cardinal="9">Neuf-</word>
8257
+ <word ordinal="9">Neuvième </word>
8258
+ <word ordinal="10">Dixième </word>
8259
+ <word ordinal="11">Onzième </word>
8260
+ <word ordinal="12">Douzième </word>
8261
+ <word ordinal="13">Treizième </word>
8262
+ <word ordinal="14">Quatorzième </word>
8263
+ <word ordinal="15">Quinzième </word>
8264
+ <word ordinal="16">Seizième </word>
8265
+ <word ordinal="17">Dix-septième </word>
8266
+ <word ordinal="18">Dix-huitième </word>
8267
+ <word ordinal="19">Dix-neuvième </word>
8268
+ <word cardinal="20">Vingt-</word>
8269
+ <word ordinal="20">Vingtième </word>
8270
+ <word cardinal="30">Trente-</word>
8271
+ <word ordinal="30">Trentième </word>
8272
+ <word cardinal="40">Quarante-</word>
8273
+ <word ordinal="40">Quarantième </word>
8274
+ <word cardinal="50">Cinquante-</word>
8275
+ <word ordinal="50">Cinquantième </word>
8276
+ <word cardinal="60">Soixante-</word>
8277
+ <word ordinal="60">Soixantième </word>
8278
+ <word cardinal="70">Septante-</word>
8279
+ <word ordinal="70">Septantième </word>
8280
+ <word cardinal="80">Huitante-</word>
8281
+ <word ordinal="80">Huitantième </word>
8282
+ <word cardinal="90">Nonante-</word>
8283
+ <word ordinal="90">Nonantième </word>
8284
+ <word cardinal="100">Cent-</word>
8285
+ <word ordinal="100">Centième </word>
8286
+ </xsl:when>
8287
+ <xsl:when test="$lang = 'ru'">
8288
+ <word cardinal="1">Одна-</word>
8289
+ <word ordinal="1">Первое </word>
8290
+ <word cardinal="2">Две-</word>
8291
+ <word ordinal="2">Второе </word>
8292
+ <word cardinal="3">Три-</word>
8293
+ <word ordinal="3">Третье </word>
8294
+ <word cardinal="4">Четыре-</word>
8295
+ <word ordinal="4">Четвертое </word>
8296
+ <word cardinal="5">Пять-</word>
8297
+ <word ordinal="5">Пятое </word>
8298
+ <word cardinal="6">Шесть-</word>
8299
+ <word ordinal="6">Шестое </word>
8300
+ <word cardinal="7">Семь-</word>
8301
+ <word ordinal="7">Седьмое </word>
8302
+ <word cardinal="8">Восемь-</word>
8303
+ <word ordinal="8">Восьмое </word>
8304
+ <word cardinal="9">Девять-</word>
8305
+ <word ordinal="9">Девятое </word>
8306
+ <word ordinal="10">Десятое </word>
8307
+ <word ordinal="11">Одиннадцатое </word>
8308
+ <word ordinal="12">Двенадцатое </word>
8309
+ <word ordinal="13">Тринадцатое </word>
8310
+ <word ordinal="14">Четырнадцатое </word>
8311
+ <word ordinal="15">Пятнадцатое </word>
8312
+ <word ordinal="16">Шестнадцатое </word>
8313
+ <word ordinal="17">Семнадцатое </word>
8314
+ <word ordinal="18">Восемнадцатое </word>
8315
+ <word ordinal="19">Девятнадцатое </word>
8316
+ <word cardinal="20">Двадцать-</word>
8317
+ <word ordinal="20">Двадцатое </word>
8318
+ <word cardinal="30">Тридцать-</word>
8319
+ <word ordinal="30">Тридцатое </word>
8320
+ <word cardinal="40">Сорок-</word>
8321
+ <word ordinal="40">Сороковое </word>
8322
+ <word cardinal="50">Пятьдесят-</word>
8323
+ <word ordinal="50">Пятидесятое </word>
8324
+ <word cardinal="60">Шестьдесят-</word>
8325
+ <word ordinal="60">Шестидесятое </word>
8326
+ <word cardinal="70">Семьдесят-</word>
8327
+ <word ordinal="70">Семидесятое </word>
8328
+ <word cardinal="80">Восемьдесят-</word>
8329
+ <word ordinal="80">Восьмидесятое </word>
8330
+ <word cardinal="90">Девяносто-</word>
8331
+ <word ordinal="90">Девяностое </word>
8332
+ <word cardinal="100">Сто-</word>
8333
+ <word ordinal="100">Сотое </word>
8334
+ </xsl:when>
8335
+ <xsl:otherwise> <!-- default english -->
8336
+ <word cardinal="1">One-</word>
8337
+ <word ordinal="1">First </word>
8338
+ <word cardinal="2">Two-</word>
8339
+ <word ordinal="2">Second </word>
8340
+ <word cardinal="3">Three-</word>
8341
+ <word ordinal="3">Third </word>
8342
+ <word cardinal="4">Four-</word>
8343
+ <word ordinal="4">Fourth </word>
8344
+ <word cardinal="5">Five-</word>
8345
+ <word ordinal="5">Fifth </word>
8346
+ <word cardinal="6">Six-</word>
8347
+ <word ordinal="6">Sixth </word>
8348
+ <word cardinal="7">Seven-</word>
8349
+ <word ordinal="7">Seventh </word>
8350
+ <word cardinal="8">Eight-</word>
8351
+ <word ordinal="8">Eighth </word>
8352
+ <word cardinal="9">Nine-</word>
8353
+ <word ordinal="9">Ninth </word>
8354
+ <word ordinal="10">Tenth </word>
8355
+ <word ordinal="11">Eleventh </word>
8356
+ <word ordinal="12">Twelfth </word>
8357
+ <word ordinal="13">Thirteenth </word>
8358
+ <word ordinal="14">Fourteenth </word>
8359
+ <word ordinal="15">Fifteenth </word>
8360
+ <word ordinal="16">Sixteenth </word>
8361
+ <word ordinal="17">Seventeenth </word>
8362
+ <word ordinal="18">Eighteenth </word>
8363
+ <word ordinal="19">Nineteenth </word>
8364
+ <word cardinal="20">Twenty-</word>
8365
+ <word ordinal="20">Twentieth </word>
8366
+ <word cardinal="30">Thirty-</word>
8367
+ <word ordinal="30">Thirtieth </word>
8368
+ <word cardinal="40">Forty-</word>
8369
+ <word ordinal="40">Fortieth </word>
8370
+ <word cardinal="50">Fifty-</word>
8371
+ <word ordinal="50">Fiftieth </word>
8372
+ <word cardinal="60">Sixty-</word>
8373
+ <word ordinal="60">Sixtieth </word>
8374
+ <word cardinal="70">Seventy-</word>
8375
+ <word ordinal="70">Seventieth </word>
8376
+ <word cardinal="80">Eighty-</word>
8377
+ <word ordinal="80">Eightieth </word>
8378
+ <word cardinal="90">Ninety-</word>
8379
+ <word ordinal="90">Ninetieth </word>
8380
+ <word cardinal="100">Hundred-</word>
8381
+ <word ordinal="100">Hundredth </word>
8382
+ </xsl:otherwise>
8383
+ </xsl:choose>
8216
8384
  </words>
8217
8385
  </xsl:variable>
8218
8386
 
@@ -8286,4 +8454,18 @@
8286
8454
  <xsl:otherwise>_</xsl:otherwise>
8287
8455
  </xsl:choose>
8288
8456
  </xsl:attribute>
8457
+ </xsl:template><xsl:template name="substring-after-last">
8458
+ <xsl:param name="value"/>
8459
+ <xsl:param name="delimiter"/>
8460
+ <xsl:choose>
8461
+ <xsl:when test="contains($value, $delimiter)">
8462
+ <xsl:call-template name="substring-after-last">
8463
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8464
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8465
+ </xsl:call-template>
8466
+ </xsl:when>
8467
+ <xsl:otherwise>
8468
+ <xsl:value-of select="$value"/>
8469
+ </xsl:otherwise>
8470
+ </xsl:choose>
8289
8471
  </xsl:template></xsl:stylesheet>