metanorma-ogc 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/base_convert.rb +8 -6
  3. data/lib/isodoc/ogc/html/ogc.css +1 -2
  4. data/lib/isodoc/ogc/html/ogc.scss +0 -1
  5. data/lib/isodoc/ogc/html/ogc_wp.css +1 -2
  6. data/lib/isodoc/ogc/html/ogc_wp.scss +0 -1
  7. data/lib/isodoc/ogc/html_convert.rb +6 -6
  8. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1258 -513
  9. data/lib/isodoc/ogc/ogc.best-practice.xsl +1258 -513
  10. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1258 -513
  11. data/lib/isodoc/ogc/ogc.community-practice.xsl +1258 -513
  12. data/lib/isodoc/ogc/ogc.community-standard.xsl +1258 -513
  13. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1258 -513
  14. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1258 -513
  15. data/lib/isodoc/ogc/ogc.other.xsl +1258 -513
  16. data/lib/isodoc/ogc/ogc.policy.xsl +1258 -513
  17. data/lib/isodoc/ogc/ogc.reference-model.xsl +1258 -513
  18. data/lib/isodoc/ogc/ogc.release-notes.xsl +1258 -513
  19. data/lib/isodoc/ogc/ogc.standard.xsl +1258 -513
  20. data/lib/isodoc/ogc/ogc.test-suite.xsl +1258 -513
  21. data/lib/isodoc/ogc/ogc.user-guide.xsl +1258 -513
  22. data/lib/isodoc/ogc/ogc.white-paper.xsl +1120 -397
  23. data/lib/isodoc/ogc/presentation_xml_convert.rb +25 -34
  24. data/lib/isodoc/ogc/reqt.rb +2 -1
  25. data/lib/isodoc/ogc/word_convert.rb +2 -78
  26. data/lib/isodoc/ogc/xref.rb +13 -6
  27. data/lib/metanorma/ogc/basicdoc.rng +5 -3
  28. data/lib/metanorma/ogc/biblio.rng +5 -3
  29. data/lib/metanorma/ogc/converter.rb +7 -0
  30. data/lib/metanorma/ogc/isodoc.rng +73 -3
  31. data/lib/metanorma/ogc/processor.rb +10 -10
  32. data/lib/metanorma/ogc/version.rb +1 -1
  33. metadata +2 -2
@@ -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:ogc="https://www.metanorma.org/ns/ogc" 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="35"/>
13
- <xsl:variable name="marginLeftRight2" select="17"/>
14
- <xsl:variable name="marginTop" select="16.5"/>
15
- <xsl:variable name="marginBottom" select="22.5"/>
16
-
17
7
 
18
8
 
19
9
  <xsl:variable name="debug">false</xsl:variable>
@@ -67,8 +57,21 @@
67
57
  <xsl:copy-of select="@id"/>
68
58
  <xsl:variable name="title">
69
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>
70
74
  </xsl:variable>
71
- <xsl:variable name="bookmark" select="normalize-space(.//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node())"/>
72
75
  <xsl:variable name="regex_str" select="'^([^0-9]+) (\d+).*'"/>
73
76
  <xsl:variable name="class" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$1')"/>
74
77
  <xsl:variable name="num" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$2')"/>
@@ -110,45 +113,20 @@
110
113
  </xsl:for-each>
111
114
  </xsl:variable>
112
115
 
113
- <xsl:variable name="contents">
116
+ <xsl:variable name="contents_">
114
117
  <contents>
115
-
116
118
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
117
- <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="contents"/> -->
118
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/>
119
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']" mode="contents"/>
120
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']" mode="contents"/>
121
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents"/>
122
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']" mode="contents"/>
123
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']" mode="contents"/>
124
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents"/>
125
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
126
- <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"/>
127
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements" mode="contents"/>
128
-
129
-
130
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="contents"/>
131
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="contents"/>
132
- <!-- Normative references -->
133
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="contents"/>
134
- <!-- Terms and definitions -->
135
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents"/>
136
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="contents"/>
137
-
138
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="contents"/>
139
-
140
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="contents"/>
141
-
142
- <!-- Bibliography -->
143
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="contents"/>
119
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
144
120
 
121
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
122
+ <xsl:apply-templates select="//ogc:indexsect" mode="contents"/>
145
123
 
124
+ <xsl:call-template name="processTablesFigures_Contents">
125
+ <xsl:with-param name="always">true</xsl:with-param>
126
+ </xsl:call-template>
146
127
  </contents>
147
128
  </xsl:variable>
148
-
149
- <xsl:variable name="lang">
150
- <xsl:call-template name="getLang"/>
151
- </xsl:variable>
129
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
152
130
 
153
131
  <xsl:template match="/">
154
132
  <xsl:call-template name="namespaceCheck"/>
@@ -249,9 +227,22 @@
249
227
  </fo:table>
250
228
  </fo:block>
251
229
 
252
- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm">
253
- <fo:block-container width="155mm">
230
+ <!-- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm"> -->
231
+ <fo:block-container absolute-position="fixed" left="16.5mm" top="40mm" height="170mm">
232
+ <fo:block-container width="155mm" height="99%" display-align="center">
254
233
  <fo:block font-size="33pt" role="H1">
234
+ <xsl:variable name="length_title" select="string-length($doctitle)"/>
235
+ <xsl:variable name="fit_font-size">
236
+ <xsl:choose>
237
+ <xsl:when test="$length_title &gt; 230">20</xsl:when>
238
+ <xsl:when test="$length_title &gt; 170">26</xsl:when>
239
+ <xsl:when test="$length_title &gt; 155">28</xsl:when>
240
+ <xsl:when test="$length_title &gt; 130">30</xsl:when>
241
+ </xsl:choose>
242
+ </xsl:variable>
243
+ <xsl:if test="normalize-space($fit_font-size) != ''">
244
+ <xsl:attribute name="font-size"><xsl:value-of select="$fit_font-size"/>pt</xsl:attribute>
245
+ </xsl:if>
255
246
  <xsl:call-template name="addLetterSpacing">
256
247
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctitle))"/>
257
248
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -446,7 +437,7 @@
446
437
 
447
438
  <fo:block-container line-height="130%">
448
439
  <fo:block role="TOC">
449
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and normalize-space(@id) != '']">
440
+ <xsl:for-each select="$contents//item[@display = 'true' and normalize-space(@id) != '']">
450
441
 
451
442
  <fo:block role="TOCI">
452
443
  <xsl:if test="@level = 1">
@@ -455,7 +446,7 @@
455
446
  <xsl:if test="@level = 1 or @parent = 'annex'">
456
447
  <xsl:attribute name="font-size">12pt</xsl:attribute>
457
448
  </xsl:if>
458
- <xsl:if test="@level &gt;= 2 and not(@parent = 'annex')">
449
+ <xsl:if test="@level &gt;= 2"> <!-- and not(@parent = 'annex') -->
459
450
  <xsl:attribute name="font-size">10pt</xsl:attribute>
460
451
  </xsl:if>
461
452
 
@@ -523,100 +514,37 @@
523
514
  </fo:block>
524
515
  </fo:block-container>
525
516
 
526
- <xsl:if test="//ogc:table[@id and ogc:name]"> <!-- contains(ogc:name, '—') -->
527
- <xsl:variable name="title-list-tables">
528
- <xsl:call-template name="getTitle">
529
- <xsl:with-param name="name" select="'title-list-tables'"/>
530
- </xsl:call-template>
531
- </xsl:variable>
532
-
533
- <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt">
534
- <fo:block-container margin-left="0mm">
535
- <xsl:call-template name="insertSectionTitle">
536
- <xsl:with-param name="title" select="$title-list-tables"/>
537
- </xsl:call-template>
538
- </fo:block-container>
539
- </fo:block-container>
517
+
518
+ <!-- List of Tables -->
519
+ <xsl:if test="$contents//tables/table">
520
+ <xsl:call-template name="insertListOf_Title">
521
+ <xsl:with-param name="title" select="$title-list-tables"/>
522
+ </xsl:call-template>
540
523
  <fo:block-container line-height="130%">
541
- <xsl:for-each select="//ogc:table[@id and ogc:name and normalize-space(@id) != '']"> <!-- contains(ogc:name, '—') -->
542
- <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
543
- <fo:basic-link internal-destination="{@id}">
544
- <xsl:call-template name="setAltText">
545
- <xsl:with-param name="value" select="ogc:name"/>
546
- </xsl:call-template>
547
- <xsl:apply-templates select="ogc:name" mode="contents"/>
548
- <fo:inline keep-together.within-line="always">
549
- <fo:leader leader-pattern="dots"/>
550
- <fo:page-number-citation ref-id="{@id}"/>
551
- </fo:inline>
552
- </fo:basic-link>
553
- </fo:block>
524
+ <xsl:for-each select="$contents//tables/table">
525
+ <xsl:call-template name="insertListOf_Item"/>
554
526
  </xsl:for-each>
555
- </fo:block-container>
527
+ </fo:block-container>
556
528
  </xsl:if>
557
529
 
558
- <xsl:variable name="list_of_figures_">
559
- <xsl:for-each select="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(ogc:name, 'Figure ') and normalize-space(@id) != '']">
560
- <figure id="{@id}" alt-text="{ogc:name}">
561
- <xsl:apply-templates select="ogc:name" mode="contents"/>
562
- </figure>
563
- </xsl:for-each>
564
- </xsl:variable>
565
- <xsl:variable name="list_of_figures" select="xalan:nodeset($list_of_figures_)"/>
566
-
567
- <!-- <xsl:if test="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true')] or //*[@id and starts-with(ogc:name, 'Figure ')]"> --> <!-- contains(ogc:name, '—') -->
568
- <xsl:if test="$list_of_figures//figure">
569
- <xsl:variable name="title-list-figures">
570
- <xsl:call-template name="getTitle">
571
- <xsl:with-param name="name" select="'title-list-figures'"/>
572
- </xsl:call-template>
573
- </xsl:variable>
574
- <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt">
575
- <fo:block-container margin-left="0mm">
576
- <xsl:call-template name="insertSectionTitle">
577
- <xsl:with-param name="title" select="$title-list-figures"/>
578
- </xsl:call-template>
579
- </fo:block-container>
580
- </fo:block-container>
581
-
530
+ <!-- List of Figures -->
531
+ <xsl:if test="$contents//figures/figure">
532
+ <xsl:call-template name="insertListOf_Title">
533
+ <xsl:with-param name="title" select="$title-list-figures"/>
534
+ </xsl:call-template>
582
535
  <fo:block-container line-height="130%">
583
- <!-- <xsl:for-each select="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true')] or //*[@id and starts-with(ogc:name, 'Figure ')]"> --> <!-- contains(ogc:name, '—') -->
584
- <xsl:for-each select="$list_of_figures/figure"> <!-- contains(ogc:name, '—') -->
585
- <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
586
- <fo:basic-link internal-destination="{@id}">
587
- <xsl:call-template name="setAltText">
588
- <xsl:with-param name="value" select="@alt-text"/>
589
- </xsl:call-template>
590
- <!-- <xsl:apply-templates select="ogc:name" mode="contents"/> -->
591
- <xsl:copy-of select="node()"/>
592
- <fo:inline keep-together.within-line="always">
593
- <fo:leader leader-pattern="dots"/>
594
- <fo:page-number-citation ref-id="{@id}"/>
595
- </fo:inline>
596
- </fo:basic-link>
597
- </fo:block>
536
+ <xsl:for-each select="$contents//figures/figure">
537
+ <xsl:call-template name="insertListOf_Item"/>
598
538
  </xsl:for-each>
599
- </fo:block-container>
539
+ </fo:block-container>
600
540
  </xsl:if>
601
541
 
602
- <!-- <xsl:if test="//ogc:permission[@id and ogc:name] or //ogc:recommendation[@id and ogc:name] or //ogc:requirement[@id and ogc:name]"> -->
542
+ <!-- List of Recommendations -->
603
543
  <xsl:if test="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]">
604
- <xsl:variable name="title-list-recommendations">
605
- <xsl:call-template name="getTitle">
606
- <xsl:with-param name="name" select="'title-list-recommendations'"/>
607
- </xsl:call-template>
608
- </xsl:variable>
609
-
610
- <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt">
611
- <fo:block-container margin-left="0mm">
612
- <xsl:call-template name="insertSectionTitle">
613
- <xsl:with-param name="title" select="$title-list-recommendations"/>
614
- </xsl:call-template>
615
- </fo:block-container>
616
- </fo:block-container>
617
-
544
+ <xsl:call-template name="insertListOf_Title">
545
+ <xsl:with-param name="title" select="$title-list-recommendations"/>
546
+ </xsl:call-template>
618
547
  <fo:block-container line-height="130%">
619
- <!-- <xsl:for-each select="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]"> -->
620
548
  <xsl:for-each select="xalan:nodeset($toc_recommendations)/*[normalize-space(@id) != '']">
621
549
  <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
622
550
  <fo:basic-link internal-destination="{@id}">
@@ -633,7 +561,6 @@
633
561
  </fo:block>
634
562
  </xsl:for-each>
635
563
  </fo:block-container>
636
-
637
564
  </xsl:if>
638
565
 
639
566
  </fo:block>
@@ -642,75 +569,89 @@
642
569
 
643
570
  <fo:block line-height="125%">
644
571
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
645
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract"/>
646
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']"/>
647
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']"/>
648
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:foreword">
649
- <fo:block break-after="page"/>
650
- </xsl:if>
651
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword"/>
652
-
653
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']">
654
- <fo:block break-after="page"/>
655
- </xsl:if>
656
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']"/>
657
-
658
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']">
659
- <fo:block break-after="page"/>
660
- </xsl:if>
661
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"/>
662
-
663
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters"/>
664
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:introduction">
665
- <fo:block break-after="page"/>
666
- </xsl:if>
667
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction"/>
668
-
669
572
 
573
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
574
+ <xsl:sort select="@displayorder" data-type="number"/>
575
+
576
+ <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'">
577
+ <fo:block break-after="page"/>
578
+ </xsl:if>
579
+
580
+ <xsl:apply-templates select="."/>
581
+ </xsl:for-each>
670
582
 
671
- <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')]"/>
672
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements"/>
673
583
  </fo:block>
674
584
  </fo:flow>
675
585
  </fo:page-sequence>
676
586
 
677
587
 
678
588
  <!-- Document Pages -->
589
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
590
+ <xsl:sort select="@displayorder" data-type="number"/>
591
+ <xsl:choose>
592
+ <xsl:when test="local-name() = 'clause' and @type='scope'">
593
+ <xsl:apply-templates select="." mode="sections">
594
+ <xsl:with-param name="initial-page-number" select="1"/>
595
+ </xsl:apply-templates>
596
+ </xsl:when>
597
+ <xsl:otherwise>
598
+ <xsl:apply-templates select="." mode="sections"/>
599
+ </xsl:otherwise>
600
+ </xsl:choose>
601
+ </xsl:for-each>
679
602
 
680
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="sections">
681
- <xsl:with-param name="initial-page-number" select="1"/>
682
- </xsl:apply-templates>
683
-
684
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="sections"/>
685
-
686
- <!-- Normative references -->
687
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="sections"/>
688
-
689
- <!-- Terms and definitions -->
690
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="sections"/>
691
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="sections"/>
692
-
693
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="sections"/>
694
-
695
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="sections"/>
603
+ <xsl:for-each select="/*/*[local-name()='annex']">
604
+ <xsl:sort select="@displayorder" data-type="number"/>
605
+ <xsl:apply-templates select="." mode="sections"/>
606
+ </xsl:for-each>
696
607
 
697
608
  <!-- Bibliography -->
698
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="sections"/>
609
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
610
+ <xsl:sort select="@displayorder" data-type="number"/>
611
+ <xsl:apply-templates select="." mode="sections"/>
612
+ </xsl:for-each>
613
+
614
+ <xsl:apply-templates select="//ogc:indexsect" mode="sections"/>
699
615
 
700
616
  <!-- End Document Pages -->
701
617
 
702
618
  </fo:root>
703
619
  </xsl:template>
704
620
 
705
- <xsl:variable name="thinspace" select="' '"/>
621
+ <xsl:template name="insertListOf_Title">
622
+ <xsl:param name="title"/>
623
+ <fo:block-container margin-left="-18mm" keep-with-next="always" margin-bottom="10pt" space-before="36pt">
624
+ <fo:block-container margin-left="0mm">
625
+ <xsl:call-template name="insertSectionTitle">
626
+ <xsl:with-param name="title" select="$title"/>
627
+ </xsl:call-template>
628
+ </fo:block-container>
629
+ </fo:block-container>
630
+ </xsl:template>
631
+
632
+ <xsl:template name="insertListOf_Item">
633
+ <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
634
+ <fo:basic-link internal-destination="{@id}">
635
+ <xsl:call-template name="setAltText">
636
+ <xsl:with-param name="value" select="@alt-text"/>
637
+ </xsl:call-template>
638
+ <!-- <xsl:copy-of select="node()"/> -->
639
+ <xsl:apply-templates select="." mode="contents"/>
640
+ <fo:inline keep-together.within-line="always">
641
+ <fo:leader leader-pattern="dots"/>
642
+ <fo:page-number-citation ref-id="{@id}"/>
643
+ </fo:inline>
644
+ </fo:basic-link>
645
+ </fo:block>
646
+ </xsl:template>
706
647
 
707
648
  <!-- Lato font doesn't contain 'thin space' glyph -->
708
649
  <xsl:template match="text()" priority="1">
709
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
650
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
710
651
  </xsl:template>
711
652
 
712
653
  <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
713
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
654
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
714
655
  </xsl:template>
715
656
 
716
657
  <xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="2">
@@ -719,7 +660,7 @@
719
660
  </xsl:variable>
720
661
  <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
721
662
  <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
722
- <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
663
+ <xsl:value-of select="translate($content2, $thin_space, ' ')"/>
723
664
  </xsl:template>
724
665
 
725
666
 
@@ -1028,9 +969,11 @@
1028
969
  </xsl:choose>
1029
970
  </xsl:variable>
1030
971
  <xsl:element name="{$element-name}">
1031
- <xsl:attribute name="id">
1032
- <xsl:value-of select="@id"/>
1033
- </xsl:attribute>
972
+ <xsl:if test="@id">
973
+ <xsl:attribute name="id">
974
+ <xsl:value-of select="@id"/>
975
+ </xsl:attribute>
976
+ </xsl:if>
1034
977
  <xsl:attribute name="text-align">
1035
978
  <xsl:choose>
1036
979
  <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
@@ -1070,8 +1013,15 @@
1070
1013
 
1071
1014
 
1072
1015
 
1073
- <xsl:template match="ogc:ul | ogc:ol" mode="ul_ol">
1016
+ <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
1017
+ <xsl:variable name="ul_indent">6mm</xsl:variable>
1074
1018
  <fo:block-container margin-left="13mm">
1019
+ <xsl:if test="self::ogc:ul and not(ancestor::ogc:ul) and not(ancestor::ogc:ol)"> <!-- if first level -->
1020
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
1021
+ </xsl:if>
1022
+ <xsl:if test="self::ogc:ul and ancestor::*[2][self::ogc:ul]"> <!-- ul/li/ul -->
1023
+ <xsl:attribute name="margin-left"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1024
+ </xsl:if>
1075
1025
  <xsl:if test="ancestor::ogc:table">
1076
1026
  <xsl:attribute name="margin-left">4mm</xsl:attribute>
1077
1027
  </xsl:if>
@@ -1082,7 +1032,10 @@
1082
1032
  </xsl:if>
1083
1033
  </xsl:if>
1084
1034
  <fo:block-container margin-left="0mm">
1085
- <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
1035
+ <fo:list-block xsl:use-attribute-sets="list-style">
1036
+ <xsl:if test="self::ogc:ul">
1037
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1038
+ </xsl:if>
1086
1039
  <xsl:if test="ancestor::ogc:table">
1087
1040
  <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
1088
1041
  </xsl:if>
@@ -1101,58 +1054,6 @@
1101
1054
  </fo:block-container>
1102
1055
  </xsl:template>
1103
1056
 
1104
- <xsl:template match="ogc:li">
1105
- <fo:list-item id="{@id}">
1106
- <fo:list-item-label end-indent="label-end()">
1107
- <fo:block>
1108
- <xsl:choose>
1109
- <xsl:when test="local-name(..) = 'ul'">
1110
- <xsl:call-template name="setULLabel"/>
1111
- </xsl:when>
1112
- <xsl:otherwise> <!-- for ordered lists -->
1113
- <xsl:choose>
1114
- <xsl:when test="../@class = 'steps'">
1115
- <xsl:number format="1."/>
1116
- </xsl:when>
1117
- <xsl:when test="../@type = 'arabic'">
1118
- <xsl:number format="a)" lang="en"/>
1119
- </xsl:when>
1120
- <xsl:when test="../@type = 'alphabet'">
1121
- <xsl:number format="1."/>
1122
- </xsl:when>
1123
- <xsl:when test="../@type = 'alphabet_upper'">
1124
- <xsl:number format="A)" lang="en"/>
1125
- </xsl:when>
1126
- <xsl:when test="../@type = 'roman'">
1127
- <xsl:number format="i)"/>
1128
- </xsl:when>
1129
- <xsl:otherwise>
1130
- <xsl:variable name="level" select="count(ancestor-or-self::ogc:li)"/>
1131
- <xsl:choose>
1132
- <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1133
- <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1134
- <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1135
- <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1136
- </xsl:choose>
1137
- </xsl:otherwise>
1138
- </xsl:choose>
1139
- </xsl:otherwise>
1140
- </xsl:choose>
1141
- </fo:block>
1142
- </fo:list-item-label>
1143
- <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1144
- <fo:block margin-bottom="10pt">
1145
- <xsl:if test="ancestor::ogc:table[not(@class)]">
1146
- <xsl:attribute name="margin-bottom">1mm</xsl:attribute>
1147
- </xsl:if>
1148
- <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1149
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1150
- </xsl:if>
1151
- <xsl:apply-templates/>
1152
- </fo:block>
1153
- </fo:list-item-body>
1154
- </fo:list-item>
1155
- </xsl:template>
1156
1057
 
1157
1058
  <xsl:template match="ogc:ul/ogc:note | ogc:ol/ogc:note" priority="2">
1158
1059
  <fo:list-item font-size="10pt">
@@ -1225,30 +1126,6 @@
1225
1126
  </xsl:template>
1226
1127
 
1227
1128
 
1228
-
1229
- <xsl:template match="ogc:formula/ogc:stem">
1230
- <fo:block margin-top="6pt" margin-bottom="12pt">
1231
- <fo:table table-layout="fixed" width="100%">
1232
- <fo:table-column column-width="95%"/>
1233
- <fo:table-column column-width="5%"/>
1234
- <fo:table-body>
1235
- <fo:table-row>
1236
- <fo:table-cell display-align="center">
1237
- <fo:block text-align="left"> <!-- margin-left="5mm" -->
1238
- <xsl:apply-templates/>
1239
- </fo:block>
1240
- </fo:table-cell>
1241
- <fo:table-cell display-align="center">
1242
- <fo:block text-align="right">
1243
- <xsl:apply-templates select="../ogc:name" mode="formula_number"/>
1244
- </fo:block>
1245
- </fo:table-cell>
1246
- </fo:table-row>
1247
- </fo:table-body>
1248
- </fo:table>
1249
- </fo:block>
1250
- </xsl:template>
1251
-
1252
1129
  <xsl:template match="*[local-name()='th']//text()" priority="2">
1253
1130
  <xsl:variable name="text">
1254
1131
  <xsl:call-template name="add-zero-spaces-java"/>
@@ -1574,11 +1451,21 @@
1574
1451
  </fo:static-content>
1575
1452
  </xsl:template>
1576
1453
 
1577
- <xsl:variable name="pageWidth_">
1454
+ <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">
1455
+ <xsl:call-template name="getLang"/>
1456
+ </xsl:variable><xsl:variable name="pageWidth_">
1578
1457
  215.9
1579
1458
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1580
1459
  279.4
1581
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
1460
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1461
+ 35
1462
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
1463
+ 17
1464
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
1465
+ 16.5
1466
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1467
+ 22.5
1468
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1582
1469
 
1583
1470
  <title-edition lang="en">
1584
1471
 
@@ -1590,6 +1477,10 @@
1590
1477
  <xsl:text>Édition </xsl:text>
1591
1478
  </title-edition>
1592
1479
 
1480
+ <title-edition lang="ru">
1481
+ <xsl:text>Издание </xsl:text>
1482
+ </title-edition>
1483
+
1593
1484
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1594
1485
  <title-toc lang="en">
1595
1486
 
@@ -1606,7 +1497,7 @@
1606
1497
  <xsl:text>Contents</xsl:text>
1607
1498
 
1608
1499
  </title-toc>
1609
-
1500
+
1610
1501
  <title-descriptors lang="en">Descriptors</title-descriptors>
1611
1502
 
1612
1503
  <title-part lang="en">
@@ -1618,7 +1509,11 @@
1618
1509
 
1619
1510
 
1620
1511
 
1621
- </title-part>
1512
+ </title-part>
1513
+ <title-part lang="ru">
1514
+
1515
+
1516
+ </title-part>
1622
1517
  <title-part lang="zh">第 # 部分:</title-part>
1623
1518
 
1624
1519
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1634,13 +1529,38 @@
1634
1529
 
1635
1530
  <title-summary lang="en">Summary</title-summary>
1636
1531
 
1532
+ <title-continued lang="ru">(продолжение)</title-continued>
1637
1533
  <title-continued lang="en">(continued)</title-continued>
1638
1534
  <title-continued lang="fr">(continué)</title-continued>
1639
1535
 
1640
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
1536
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
1537
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1538
+ <xsl:value-of select="$toc_table_title"/>
1539
+ <xsl:if test="normalize-space($toc_table_title) = ''">
1540
+ <xsl:call-template name="getTitle">
1541
+ <xsl:with-param name="name" select="'title-list-tables'"/>
1542
+ </xsl:call-template>
1543
+ </xsl:if>
1544
+ </xsl:variable><xsl:variable name="title-list-figures">
1545
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1546
+ <xsl:value-of select="$toc_figure_title"/>
1547
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
1548
+ <xsl:call-template name="getTitle">
1549
+ <xsl:with-param name="name" select="'title-list-figures'"/>
1550
+ </xsl:call-template>
1551
+ </xsl:if>
1552
+ </xsl:variable><xsl:variable name="title-list-recommendations">
1553
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1554
+ <xsl:value-of select="$toc_requirement_title"/>
1555
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
1556
+ <xsl:call-template name="getTitle">
1557
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
1558
+ </xsl:call-template>
1559
+ </xsl:if>
1560
+ </xsl:variable><xsl:variable name="bibdata">
1641
1561
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1642
1562
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1643
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1563
+ </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">
1644
1564
  <xsl:param name="name"/>
1645
1565
  <xsl:param name="lang"/>
1646
1566
  <xsl:variable name="lang_">
@@ -1663,7 +1583,7 @@
1663
1583
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1664
1584
  </xsl:otherwise>
1665
1585
  </xsl:choose>
1666
- </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">
1586
+ </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">
1667
1587
 
1668
1588
 
1669
1589
 
@@ -1890,7 +1810,7 @@
1890
1810
 
1891
1811
 
1892
1812
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1893
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1813
+
1894
1814
 
1895
1815
 
1896
1816
 
@@ -2284,11 +2204,11 @@
2284
2204
 
2285
2205
 
2286
2206
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2287
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2207
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
2208
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
2288
2209
 
2289
2210
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2290
2211
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
2291
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
2292
2212
 
2293
2213
 
2294
2214
 
@@ -2297,12 +2217,11 @@
2297
2217
 
2298
2218
 
2299
2219
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2220
+ <xsl:attribute name="text-align">right</xsl:attribute>
2300
2221
 
2301
- <xsl:attribute name="text-align">right</xsl:attribute>
2302
2222
  <xsl:attribute name="margin-right">25mm</xsl:attribute>
2303
2223
 
2304
2224
 
2305
-
2306
2225
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2307
2226
 
2308
2227
 
@@ -2327,6 +2246,9 @@
2327
2246
 
2328
2247
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2329
2248
 
2249
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
2250
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2251
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2330
2252
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
2331
2253
 
2332
2254
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -2360,6 +2282,35 @@
2360
2282
 
2361
2283
 
2362
2284
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2285
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2286
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2294
+ <xsl:attribute name="text-align">center</xsl:attribute>
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+ <xsl:attribute name="text-align">left</xsl:attribute>
2305
+
2306
+
2307
+
2308
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2309
+ <xsl:attribute name="text-align">right</xsl:attribute>
2310
+
2311
+
2312
+
2313
+
2363
2314
 
2364
2315
  </xsl:attribute-set><xsl:attribute-set name="image-style">
2365
2316
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -2398,6 +2349,18 @@
2398
2349
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2399
2350
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2400
2351
 
2352
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2353
+
2354
+
2355
+
2356
+
2357
+
2358
+
2359
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2360
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2361
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2362
+
2363
+
2401
2364
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
2402
2365
 
2403
2366
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -2418,13 +2381,19 @@
2418
2381
  </xsl:attribute-set><xsl:variable name="color-added-text">
2419
2382
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2420
2383
  </xsl:variable><xsl:attribute-set name="add-style">
2421
- <xsl:attribute name="color">red</xsl:attribute>
2422
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2423
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2424
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2425
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2426
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2427
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2384
+
2385
+ <xsl:attribute name="color">red</xsl:attribute>
2386
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2387
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2388
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2389
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2390
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2391
+
2392
+ </xsl:attribute-set><xsl:variable name="add-style">
2393
+ <add-style xsl:use-attribute-sets="add-style"/>
2394
+ </xsl:variable><xsl:template name="append_add-style">
2395
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2396
+ </xsl:template><xsl:variable name="color-deleted-text">
2428
2397
  <xsl:text>red</xsl:text>
2429
2398
  </xsl:variable><xsl:attribute-set name="del-style">
2430
2399
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -2435,6 +2404,39 @@
2435
2404
 
2436
2405
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2437
2406
 
2407
+
2408
+
2409
+
2410
+
2411
+
2412
+
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+
2419
+ <xsl:attribute name="provisional-distance-between-starts">12mm</xsl:attribute>
2420
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2421
+ <xsl:attribute name="line-height">115%</xsl:attribute>
2422
+
2423
+
2424
+
2425
+
2426
+
2427
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2428
+
2429
+
2430
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2431
+
2432
+
2433
+
2434
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2435
+
2436
+
2437
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2438
+
2439
+
2438
2440
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2439
2441
  <xsl:attribute name="line-height">135%</xsl:attribute>
2440
2442
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -2729,18 +2731,151 @@
2729
2731
 
2730
2732
  <xsl:attribute name="line-height">120%</xsl:attribute>
2731
2733
 
2732
- </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">
2733
- <xsl:for-each select="/*/*[local-name()='preface']/*">
2734
- <xsl:sort select="@displayorder" data-type="number"/>
2735
- <xsl:apply-templates select="." mode="contents"/>
2736
- </xsl:for-each>
2737
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2738
-
2739
- <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']]">
2740
- <xsl:sort select="@displayorder" data-type="number"/>
2741
- <xsl:apply-templates select="." mode="contents"/>
2742
- </xsl:for-each>
2743
-
2734
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
2735
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2736
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
2737
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2738
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
2739
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2740
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
2741
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2742
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
2743
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2744
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
2745
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2746
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
2747
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2748
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
2749
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2750
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
2751
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2752
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
2753
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2754
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
2755
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2756
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
2757
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2758
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
2759
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2760
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
2761
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2762
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
2763
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2764
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
2765
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2766
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
2767
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2768
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
2769
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2770
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
2771
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2772
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
2773
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2774
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
2775
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2776
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
2777
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2778
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
2779
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2780
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
2781
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2782
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
2783
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2784
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
2785
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2786
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
2787
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2788
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
2789
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2790
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
2791
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2792
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
2793
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2794
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
2795
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2796
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
2797
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2798
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
2799
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2800
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
2801
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2802
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
2803
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2804
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2805
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
2806
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
2807
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
2808
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2809
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2810
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
2811
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2812
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2813
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
2814
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2815
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
2816
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
2817
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
2818
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
2819
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
2820
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
2821
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
2822
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
2823
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
2824
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
2825
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
2826
+ <xsl:attribute name="role">H1</xsl:attribute>
2827
+
2828
+
2829
+
2830
+
2831
+
2832
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
2833
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2834
+
2835
+
2836
+
2837
+
2838
+
2839
+ </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">
2840
+ <xsl:variable name="nodes_preface_">
2841
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2842
+ <node id="{@id}"/>
2843
+ </xsl:for-each>
2844
+ </xsl:variable>
2845
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2846
+
2847
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2848
+ <xsl:sort select="@displayorder" data-type="number"/>
2849
+
2850
+ <!-- process Section's title -->
2851
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2852
+ <xsl:if test="$preceding-sibling_id != ''">
2853
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2854
+ </xsl:if>
2855
+
2856
+ <xsl:apply-templates select="." mode="contents"/>
2857
+ </xsl:for-each>
2858
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2859
+
2860
+ <xsl:variable name="nodes_sections_">
2861
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
2862
+ <node id="{@id}"/>
2863
+ </xsl:for-each>
2864
+ </xsl:variable>
2865
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
2866
+
2867
+ <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']]">
2868
+ <xsl:sort select="@displayorder" data-type="number"/>
2869
+
2870
+ <!-- process Section's title -->
2871
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2872
+ <xsl:if test="$preceding-sibling_id != ''">
2873
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2874
+ </xsl:if>
2875
+
2876
+ <xsl:apply-templates select="." mode="contents"/>
2877
+ </xsl:for-each>
2878
+
2744
2879
  <xsl:for-each select="/*/*[local-name()='annex']">
2745
2880
  <xsl:sort select="@displayorder" data-type="number"/>
2746
2881
  <xsl:apply-templates select="." mode="contents"/>
@@ -2750,6 +2885,30 @@
2750
2885
  <xsl:sort select="@displayorder" data-type="number"/>
2751
2886
  <xsl:apply-templates select="." mode="contents"/>
2752
2887
  </xsl:for-each>
2888
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
2889
+ <xsl:param name="always"/>
2890
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2891
+ <xsl:call-template name="processTables_Contents"/>
2892
+ </xsl:if>
2893
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2894
+ <xsl:call-template name="processFigures_Contents"/>
2895
+ </xsl:if>
2896
+ </xsl:template><xsl:template name="processTables_Contents">
2897
+ <tables>
2898
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2899
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2900
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2901
+ </table>
2902
+ </xsl:for-each>
2903
+ </tables>
2904
+ </xsl:template><xsl:template name="processFigures_Contents">
2905
+ <figures>
2906
+ <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) != '']">
2907
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
2908
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2909
+ </figure>
2910
+ </xsl:for-each>
2911
+ </figures>
2753
2912
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2754
2913
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2755
2914
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2836,9 +2995,12 @@
2836
2995
 
2837
2996
 
2838
2997
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
2998
+ <xsl:param name="margin"/>
2839
2999
 
2840
3000
  <!-- process in the template 'paragraph' -->
2841
- <xsl:call-template name="paragraph"/>
3001
+ <xsl:call-template name="paragraph">
3002
+ <xsl:with-param name="margin" select="$margin"/>
3003
+ </xsl:call-template>
2842
3004
 
2843
3005
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
2844
3006
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -2850,6 +3012,7 @@
2850
3012
  <xsl:call-template name="title"/>
2851
3013
 
2852
3014
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
3015
+ <xsl:param name="margin"/>
2853
3016
 
2854
3017
  <fo:block xsl:use-attribute-sets="feedback-statement-p-style">
2855
3018
  <xsl:apply-templates/>
@@ -2894,7 +3057,7 @@
2894
3057
  </xsl:call-template>
2895
3058
  </xsl:if>
2896
3059
  </xsl:variable>
2897
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3060
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2898
3061
 
2899
3062
 
2900
3063
  <xsl:variable name="margin-side">
@@ -3160,7 +3323,7 @@
3160
3323
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3161
3324
  <!-- 2009 thinspace -->
3162
3325
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3163
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3326
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3164
3327
  </xsl:call-template>
3165
3328
  </xsl:variable>
3166
3329
  <xsl:variable name="max_length">
@@ -3201,8 +3364,7 @@
3201
3364
  </xsl:call-template>
3202
3365
  </xsl:if>
3203
3366
  </xsl:template><xsl:template match="text()" mode="td_text">
3204
- <xsl:variable name="zero-space">​</xsl:variable>
3205
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3367
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3206
3368
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3207
3369
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3208
3370
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -3552,37 +3714,7 @@
3552
3714
 
3553
3715
  <!-- list of footnotes to calculate actual footnotes number -->
3554
3716
  <xsl:variable name="p_fn_">
3555
- <xsl:choose>
3556
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3557
- <fn gen_id="{generate-id(.)}">
3558
- <xsl:copy-of select="@*"/>
3559
- <xsl:copy-of select="node()"/>
3560
- </fn>
3561
- </xsl:when>
3562
- <xsl:otherwise>
3563
- <!-- itetation for:
3564
- footnotes in bibdata/title
3565
- footnotes in bibliography
3566
- footnotes in document's body (except table's head/body/foot and figure text)
3567
- -->
3568
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3569
- <fn gen_id="{generate-id(.)}">
3570
- <xsl:copy-of select="@*"/>
3571
- <xsl:copy-of select="node()"/>
3572
- </fn>
3573
- </xsl:for-each>
3574
- <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']/*">
3575
- <xsl:sort select="@displayorder" data-type="number"/>
3576
- <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])]">
3577
- <!-- copy unique fn -->
3578
- <fn gen_id="{generate-id(.)}">
3579
- <xsl:copy-of select="@*"/>
3580
- <xsl:copy-of select="node()"/>
3581
- </fn>
3582
- </xsl:for-each>
3583
- </xsl:for-each>
3584
- </xsl:otherwise>
3585
- </xsl:choose>
3717
+ <xsl:call-template name="get_fn_list"/>
3586
3718
  </xsl:variable>
3587
3719
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3588
3720
 
@@ -3643,6 +3775,38 @@
3643
3775
  <xsl:copy-of select="$footnote_inline"/>
3644
3776
  </xsl:otherwise>
3645
3777
  </xsl:choose>
3778
+ </xsl:template><xsl:template name="get_fn_list">
3779
+ <xsl:choose>
3780
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3781
+ <fn gen_id="{generate-id(.)}">
3782
+ <xsl:copy-of select="@*"/>
3783
+ <xsl:copy-of select="node()"/>
3784
+ </fn>
3785
+ </xsl:when>
3786
+ <xsl:otherwise>
3787
+ <!-- itetation for:
3788
+ footnotes in bibdata/title
3789
+ footnotes in bibliography
3790
+ footnotes in document's body (except table's head/body/foot and figure text)
3791
+ -->
3792
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3793
+ <fn gen_id="{generate-id(.)}">
3794
+ <xsl:copy-of select="@*"/>
3795
+ <xsl:copy-of select="node()"/>
3796
+ </fn>
3797
+ </xsl:for-each>
3798
+ <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']/*">
3799
+ <xsl:sort select="@displayorder" data-type="number"/>
3800
+ <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])]">
3801
+ <!-- copy unique fn -->
3802
+ <fn gen_id="{generate-id(.)}">
3803
+ <xsl:copy-of select="@*"/>
3804
+ <xsl:copy-of select="node()"/>
3805
+ </fn>
3806
+ </xsl:for-each>
3807
+ </xsl:for-each>
3808
+ </xsl:otherwise>
3809
+ </xsl:choose>
3646
3810
  </xsl:template><xsl:template name="table_fn_display">
3647
3811
  <xsl:variable name="references">
3648
3812
 
@@ -3825,7 +3989,7 @@
3825
3989
  </fo:inline>
3826
3990
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3827
3991
  <fo:inline><xsl:value-of select="."/></fo:inline>
3828
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3992
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
3829
3993
  <fo:inline>
3830
3994
  <xsl:apply-templates/>
3831
3995
  </fo:inline>
@@ -4188,20 +4352,44 @@
4188
4352
  <fo:inline text-decoration="underline">
4189
4353
  <xsl:apply-templates/>
4190
4354
  </fo:inline>
4191
- </xsl:template><xsl:template match="*[local-name()='add']">
4355
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
4192
4356
  <xsl:param name="skip">true</xsl:param>
4357
+ <xsl:param name="block">false</xsl:param>
4358
+ <xsl:param name="type"/>
4359
+ <xsl:param name="text-align"/>
4193
4360
  <xsl:choose>
4194
4361
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4195
4362
  <xsl:choose>
4196
- <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>
4363
+ <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>
4197
4364
  <xsl:otherwise>
4198
- <fo:inline>
4365
+ <xsl:variable name="tag">
4199
4366
  <xsl:call-template name="insertTag">
4200
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4367
+ <xsl:with-param name="type">
4368
+ <xsl:choose>
4369
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4370
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4371
+ </xsl:choose>
4372
+ </xsl:with-param>
4201
4373
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4202
4374
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4203
4375
  </xsl:call-template>
4204
- </fo:inline>
4376
+ </xsl:variable>
4377
+ <xsl:choose>
4378
+ <xsl:when test="$block = 'false'">
4379
+ <fo:inline>
4380
+ <xsl:copy-of select="$tag"/>
4381
+ </fo:inline>
4382
+ </xsl:when>
4383
+ <xsl:otherwise>
4384
+ <fo:block> <!-- for around figures -->
4385
+ <xsl:if test="$text-align != ''">
4386
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4387
+ </xsl:if>
4388
+ <xsl:copy-of select="$tag"/>
4389
+ </fo:block>
4390
+ </xsl:otherwise>
4391
+ </xsl:choose>
4392
+
4205
4393
  </xsl:otherwise>
4206
4394
  </xsl:choose>
4207
4395
  </xsl:when>
@@ -4560,17 +4748,21 @@
4560
4748
  </xsl:apply-templates>
4561
4749
  </xsl:template><xsl:template name="getLang">
4562
4750
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4563
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4564
4751
  <xsl:variable name="language">
4565
4752
  <xsl:choose>
4566
4753
  <xsl:when test="$language_current != ''">
4567
4754
  <xsl:value-of select="$language_current"/>
4568
4755
  </xsl:when>
4569
- <xsl:when test="$language_current_2 != ''">
4570
- <xsl:value-of select="$language_current_2"/>
4571
- </xsl:when>
4572
4756
  <xsl:otherwise>
4573
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4757
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4758
+ <xsl:choose>
4759
+ <xsl:when test="$language_current_2 != ''">
4760
+ <xsl:value-of select="$language_current_2"/>
4761
+ </xsl:when>
4762
+ <xsl:otherwise>
4763
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4764
+ </xsl:otherwise>
4765
+ </xsl:choose>
4574
4766
  </xsl:otherwise>
4575
4767
  </xsl:choose>
4576
4768
  </xsl:variable>
@@ -4773,6 +4965,9 @@
4773
4965
  </fo:inline>
4774
4966
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4775
4967
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4968
+ <xsl:if test="parent::*[local-name() = 'add']">
4969
+ <xsl:call-template name="append_add-style"/>
4970
+ </xsl:if>
4776
4971
  <xsl:apply-templates/>
4777
4972
  </fo:basic-link>
4778
4973
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -4787,8 +4982,8 @@
4787
4982
 
4788
4983
  </xsl:if>
4789
4984
  <fo:block-container margin-left="0mm">
4790
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
4791
- <xsl:apply-templates/>
4985
+ <fo:block id="{@id}">
4986
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
4792
4987
  </fo:block>
4793
4988
  </fo:block-container>
4794
4989
  </fo:block-container>
@@ -4800,10 +4995,43 @@
4800
4995
  <fo:inline>
4801
4996
  <xsl:apply-templates/>
4802
4997
  </fo:inline>
4803
- </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 -->
4998
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
4804
4999
  <xsl:if test="normalize-space() != ''">
4805
5000
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
4806
5001
  </xsl:if>
5002
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
5003
+ <fo:block xsl:use-attribute-sets="formula-style">
5004
+
5005
+
5006
+
5007
+ <fo:table table-layout="fixed" width="100%">
5008
+ <fo:table-column column-width="95%"/>
5009
+ <fo:table-column column-width="5%"/>
5010
+ <fo:table-body>
5011
+ <fo:table-row>
5012
+ <fo:table-cell display-align="center">
5013
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5014
+
5015
+
5016
+
5017
+ <xsl:apply-templates/>
5018
+ </fo:block>
5019
+ </fo:table-cell>
5020
+ <fo:table-cell display-align="center">
5021
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
5022
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
5023
+ </fo:block>
5024
+ </fo:table-cell>
5025
+ </fo:table-row>
5026
+ </fo:table-body>
5027
+ </fo:table>
5028
+ </fo:block>
5029
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
5030
+ <fo:block xsl:use-attribute-sets="formula-style">
5031
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5032
+ <xsl:apply-templates/>
5033
+ </fo:block>
5034
+ </fo:block>
4807
5035
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4808
5036
 
4809
5037
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -4841,6 +5069,13 @@
4841
5069
 
4842
5070
 
4843
5071
 
5072
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5073
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5074
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5075
+ <xsl:call-template name="append_add-style"/>
5076
+ </xsl:if>
5077
+
5078
+
4844
5079
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
4845
5080
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
4846
5081
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -4879,6 +5114,12 @@
4879
5114
 
4880
5115
 
4881
5116
 
5117
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5118
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5119
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5120
+ <xsl:call-template name="append_add-style"/>
5121
+ </xsl:if>
5122
+
4882
5123
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4883
5124
 
4884
5125
  </fo:inline>
@@ -4932,6 +5173,7 @@
4932
5173
  </fo:block>
4933
5174
  </xsl:template><xsl:template match="*[local-name() = 'term']">
4934
5175
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5176
+
4935
5177
 
4936
5178
 
4937
5179
 
@@ -5370,7 +5612,11 @@
5370
5612
  <xsl:value-of select="."/>
5371
5613
  </xsl:template><xsl:template match="node()" mode="contents">
5372
5614
  <xsl:apply-templates mode="contents"/>
5373
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
5615
+ </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">
5616
+ <xsl:call-template name="contents_section-title"/>
5617
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
5618
+ <xsl:call-template name="contents_section-title"/>
5619
+ </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">
5374
5620
  <xsl:variable name="level">
5375
5621
  <xsl:call-template name="getLevel">
5376
5622
  <xsl:with-param name="depth" select="@depth"/>
@@ -5439,13 +5685,14 @@
5439
5685
  <xsl:apply-templates mode="bookmarks"/>
5440
5686
  </xsl:template><xsl:template name="addBookmarks">
5441
5687
  <xsl:param name="contents"/>
5442
- <xsl:if test="xalan:nodeset($contents)//item">
5688
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5689
+ <xsl:if test="$contents_nodes//item">
5443
5690
  <fo:bookmark-tree>
5444
5691
  <xsl:choose>
5445
- <xsl:when test="xalan:nodeset($contents)/doc">
5692
+ <xsl:when test="$contents_nodes/doc">
5446
5693
  <xsl:choose>
5447
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5448
- <xsl:for-each select="xalan:nodeset($contents)/doc">
5694
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
5695
+ <xsl:for-each select="$contents_nodes/doc">
5449
5696
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5450
5697
  <xsl:if test="@bundle = 'true'">
5451
5698
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -5496,7 +5743,7 @@
5496
5743
  </xsl:for-each>
5497
5744
  </xsl:when>
5498
5745
  <xsl:otherwise>
5499
- <xsl:for-each select="xalan:nodeset($contents)/doc">
5746
+ <xsl:for-each select="$contents_nodes/doc">
5500
5747
 
5501
5748
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5502
5749
 
@@ -5514,97 +5761,89 @@
5514
5761
  </xsl:choose>
5515
5762
  </xsl:when>
5516
5763
  <xsl:otherwise>
5517
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
5764
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
5765
+
5766
+ <xsl:call-template name="insertFigureBookmarks">
5767
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5768
+ </xsl:call-template>
5769
+
5770
+ <xsl:call-template name="insertTableBookmarks">
5771
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
5772
+ <xsl:with-param name="lang" select="@lang"/>
5773
+ </xsl:call-template>
5774
+
5518
5775
  </xsl:otherwise>
5519
5776
  </xsl:choose>
5520
5777
 
5778
+
5521
5779
 
5522
5780
 
5523
5781
 
5524
5782
 
5525
-
5526
- <xsl:variable name="list_of_tables_">
5527
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name']]"> <!-- contains(*[local-name() = 'name'], '—') -->
5528
- <table id="{@id}"><xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/></table>
5529
- </xsl:for-each>
5530
- </xsl:variable>
5531
- <xsl:variable name="list_of_tables" select="xalan:nodeset($list_of_tables_)"/>
5532
-
5533
- <xsl:variable name="list_of_figures_">
5534
- <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true')] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ')]"> <!-- contains(*[local-name() = 'name'], '—') -->
5535
- <figure id="{@id}"><xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/></figure>
5536
- </xsl:for-each>
5537
- </xsl:variable>
5538
- <xsl:variable name="list_of_figures" select="xalan:nodeset($list_of_figures_)"/>
5539
-
5540
- <xsl:if test="$list_of_tables//table or $list_of_figures/figure or //*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
5783
+ <xsl:if test="$contents//tables/table or $contents//figures/figure or //*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
5541
5784
  <fo:bookmark internal-destination="empty_bookmark">
5542
5785
  <fo:bookmark-title>—————</fo:bookmark-title>
5543
5786
  </fo:bookmark>
5544
5787
  </xsl:if>
5545
5788
 
5546
- <xsl:if test="$list_of_tables//table">
5547
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide"> <!-- {$list_of_tables//table[1]/@id} -->
5789
+ <xsl:if test="$contents//tables/table">
5790
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5548
5791
  <fo:bookmark-title>
5549
- <xsl:call-template name="getTitle">
5550
- <xsl:with-param name="name" select="'title-list-tables'"/>
5551
- </xsl:call-template>
5792
+ <xsl:value-of select="$title-list-tables"/>
5552
5793
  </fo:bookmark-title>
5553
- <xsl:for-each select="$list_of_tables//table">
5794
+ <xsl:for-each select="$contents//tables/table">
5554
5795
  <fo:bookmark internal-destination="{@id}">
5555
- <fo:bookmark-title><xsl:value-of select="."/></fo:bookmark-title>
5796
+ <xsl:variable name="title">
5797
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
5798
+ </xsl:variable>
5799
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
5556
5800
  </fo:bookmark>
5557
5801
  </xsl:for-each>
5558
5802
  </fo:bookmark>
5559
5803
  </xsl:if>
5560
5804
 
5561
- <xsl:if test="$list_of_figures//figure">
5562
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide"> <!-- {$list_of_figures//figure[1]/@id} -->
5805
+ <xsl:if test="$contents//figures/figure">
5806
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5563
5807
  <fo:bookmark-title>
5564
-
5565
- <xsl:call-template name="getTitle">
5566
- <xsl:with-param name="name" select="'title-list-figures'"/>
5567
- </xsl:call-template>
5568
-
5569
-
5808
+ <xsl:value-of select="$title-list-figures"/>
5570
5809
  </fo:bookmark-title>
5571
- <xsl:for-each select="$list_of_figures//figure">
5810
+ <xsl:for-each select="$contents//figures/figure">
5572
5811
  <fo:bookmark internal-destination="{@id}">
5573
- <fo:bookmark-title><xsl:value-of select="."/></fo:bookmark-title>
5812
+ <xsl:variable name="title">
5813
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
5814
+ </xsl:variable>
5815
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
5574
5816
  </fo:bookmark>
5575
5817
  </xsl:for-each>
5576
5818
  </fo:bookmark>
5577
5819
  </xsl:if>
5578
5820
 
5579
-
5580
5821
  <xsl:if test="//*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
5581
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide"> <!-- {//*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']][1]/@id} -->
5822
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
5582
5823
  <fo:bookmark-title>
5583
- <xsl:call-template name="getTitle">
5584
- <xsl:with-param name="name" select="'title-list-recommendations'"/>
5585
- </xsl:call-template>
5824
+ <xsl:value-of select="$title-list-recommendations"/>
5586
5825
  </fo:bookmark-title>
5587
- <!-- <xsl:for-each select="//*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]"> -->
5588
5826
  <xsl:for-each select="xalan:nodeset($toc_recommendations)/*">
5589
- <xsl:variable name="table_id" select="@id"/>
5590
5827
  <fo:bookmark internal-destination="{@id}">
5591
5828
  <fo:bookmark-title><xsl:value-of select="bookmark"/></fo:bookmark-title>
5592
5829
  </fo:bookmark>
5593
5830
  </xsl:for-each>
5594
5831
  </fo:bookmark>
5595
5832
  </xsl:if>
5833
+ <!-- $namespace = 'ogc' -->
5596
5834
 
5597
5835
 
5598
-
5836
+
5599
5837
 
5600
5838
  </fo:bookmark-tree>
5601
5839
  </xsl:if>
5602
5840
  </xsl:template><xsl:template name="insertFigureBookmarks">
5603
5841
  <xsl:param name="contents"/>
5604
- <xsl:if test="xalan:nodeset($contents)/figure">
5605
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
5842
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5843
+ <xsl:if test="$contents_nodes/figure">
5844
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
5606
5845
  <fo:bookmark-title>Figures</fo:bookmark-title>
5607
- <xsl:for-each select="xalan:nodeset($contents)/figure">
5846
+ <xsl:for-each select="$contents_nodes/figure">
5608
5847
  <fo:bookmark internal-destination="{@id}">
5609
5848
  <fo:bookmark-title>
5610
5849
  <xsl:value-of select="normalize-space(title)"/>
@@ -5613,18 +5852,21 @@
5613
5852
  </xsl:for-each>
5614
5853
  </fo:bookmark>
5615
5854
  </xsl:if>
5855
+
5856
+ <!-- see template addBookmarks -->
5616
5857
  </xsl:template><xsl:template name="insertTableBookmarks">
5617
5858
  <xsl:param name="contents"/>
5618
5859
  <xsl:param name="lang"/>
5619
- <xsl:if test="xalan:nodeset($contents)/table">
5620
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
5860
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5861
+ <xsl:if test="$contents_nodes/table">
5862
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
5621
5863
  <fo:bookmark-title>
5622
5864
  <xsl:choose>
5623
5865
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
5624
5866
  <xsl:otherwise>Tables</xsl:otherwise>
5625
5867
  </xsl:choose>
5626
5868
  </fo:bookmark-title>
5627
- <xsl:for-each select="xalan:nodeset($contents)/table">
5869
+ <xsl:for-each select="$contents_nodes/table">
5628
5870
  <fo:bookmark internal-destination="{@id}">
5629
5871
  <fo:bookmark-title>
5630
5872
  <xsl:value-of select="normalize-space(title)"/>
@@ -5633,6 +5875,8 @@
5633
5875
  </xsl:for-each>
5634
5876
  </fo:bookmark>
5635
5877
  </xsl:if>
5878
+
5879
+ <!-- see template addBookmarks -->
5636
5880
  </xsl:template><xsl:template name="getLangVersion">
5637
5881
  <xsl:param name="lang"/>
5638
5882
  <xsl:param name="doctype" select="''"/>
@@ -5843,12 +6087,140 @@
5843
6087
  </fo:block-container>
5844
6088
  </fo:block-container>
5845
6089
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5846
- <xsl:variable name="text">
6090
+ <xsl:choose>
6091
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6092
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6093
+ <xsl:choose>
6094
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
6095
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
6096
+ </xsl:when>
6097
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
6098
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6099
+ </xsl:otherwise>
6100
+ </xsl:choose>
6101
+ </xsl:when>
6102
+ <xsl:otherwise>
6103
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6104
+ </xsl:otherwise>
6105
+ </xsl:choose>
6106
+
6107
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
6108
+ <xsl:variable name="text_step1">
5847
6109
  <xsl:call-template name="add-zero-spaces-equal"/>
5848
6110
  </xsl:variable>
5849
- <xsl:call-template name="add-zero-spaces-java">
5850
- <xsl:with-param name="text" select="$text"/>
5851
- </xsl:call-template>
6111
+ <xsl:variable name="text_step2">
6112
+ <xsl:call-template name="add-zero-spaces-java">
6113
+ <xsl:with-param name="text" select="$text_step1"/>
6114
+ </xsl:call-template>
6115
+ </xsl:variable>
6116
+ <xsl:value-of select="$text_step2"/>
6117
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
6118
+ <xsl:apply-templates mode="syntax_highlight"/>
6119
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
6120
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
6121
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
6122
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
6123
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
6124
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
6125
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
6126
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
6127
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
6128
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
6129
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
6130
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
6131
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
6132
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
6133
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
6134
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
6135
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
6136
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
6137
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
6138
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
6139
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
6140
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
6141
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
6142
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
6143
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
6144
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
6145
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
6146
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
6147
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
6148
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
6149
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
6150
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
6151
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
6152
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
6153
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
6154
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
6155
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
6156
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
6157
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
6158
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
6159
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
6160
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
6161
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
6162
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
6163
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
6164
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
6165
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
6166
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
6167
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
6168
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
6169
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
6170
+ <fo:inline>
6171
+ <xsl:variable name="classes_">
6172
+ <xsl:call-template name="split">
6173
+ <xsl:with-param name="pText" select="@class"/>
6174
+ <xsl:with-param name="sep" select="' '"/>
6175
+ </xsl:call-template>
6176
+ <!-- a few classes together (_and_ suffix) -->
6177
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
6178
+ <item>hljs-char_and_escape_</item>
6179
+ </xsl:if>
6180
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
6181
+ <item>hljs-title_and_class_</item>
6182
+ </xsl:if>
6183
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
6184
+ <item>hljs-title_and_class__and_inherited__</item>
6185
+ </xsl:if>
6186
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
6187
+ <item>hljs-title_and_function_</item>
6188
+ </xsl:if>
6189
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
6190
+ <item>hljs-variable_and_language_</item>
6191
+ </xsl:if>
6192
+ <!-- with parent classes (_ suffix) -->
6193
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
6194
+ <item>hljs-meta_hljs-keyword</item>
6195
+ </xsl:if>
6196
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
6197
+ <item>hljs-meta_hljs-string</item>
6198
+ </xsl:if>
6199
+ </xsl:variable>
6200
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
6201
+
6202
+ <xsl:for-each select="$classes/item">
6203
+ <xsl:variable name="class_name" select="."/>
6204
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6205
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6206
+ </xsl:for-each>
6207
+ </xsl:for-each>
6208
+
6209
+ <!-- <xsl:variable name="class_name">
6210
+ <xsl:choose>
6211
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
6212
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
6213
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
6214
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
6215
+ </xsl:choose>
6216
+ </xsl:variable>
6217
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6218
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6219
+ </xsl:for-each> -->
6220
+
6221
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
6222
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
6223
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5852
6224
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
5853
6225
  <xsl:if test="normalize-space() != ''">
5854
6226
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -6183,6 +6555,8 @@
6183
6555
  </xsl:otherwise>
6184
6556
  </xsl:choose> -->
6185
6557
  </fo:block>
6558
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6559
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6186
6560
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6187
6561
  <xsl:if test="normalize-space() != ''">
6188
6562
  <xsl:value-of select="."/>
@@ -6229,11 +6603,14 @@
6229
6603
 
6230
6604
 
6231
6605
  <fo:block-container margin-left="0mm">
6232
-
6233
- <fo:block xsl:use-attribute-sets="quote-style">
6606
+ <fo:block-container xsl:use-attribute-sets="quote-style">
6234
6607
 
6235
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6236
- </fo:block>
6608
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6609
+ <fo:block role="BlockQuote">
6610
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6611
+ </fo:block>
6612
+ </fo:block-container>
6613
+ </fo:block-container>
6237
6614
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
6238
6615
  <fo:block xsl:use-attribute-sets="quote-source-style">
6239
6616
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -6254,26 +6631,11 @@
6254
6631
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6255
6632
  <xsl:text>— </xsl:text>
6256
6633
  <xsl:apply-templates/>
6257
- </xsl:template><xsl:variable name="bibitem_hidden_">
6258
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6259
- <xsl:copy-of select="."/>
6260
- </xsl:for-each>
6261
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6262
- <xsl:copy-of select="."/>
6263
- </xsl:for-each>
6264
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6265
-
6266
- <xsl:variable name="bibitemid">
6267
- <xsl:choose>
6268
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6269
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6270
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6271
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6272
- </xsl:choose>
6273
- </xsl:variable>
6274
-
6634
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
6635
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
6636
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6275
6637
  <xsl:choose>
6276
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
6638
+ <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) -->
6277
6639
  <fo:inline xsl:use-attribute-sets="eref-style">
6278
6640
  <xsl:if test="@type = 'footnote'">
6279
6641
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6287,8 +6649,8 @@
6287
6649
  <xsl:variable name="text" select="normalize-space()"/>
6288
6650
 
6289
6651
 
6290
-
6291
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6652
+
6653
+ <fo:basic-link fox:alt-text="{@citeas}">
6292
6654
  <xsl:if test="normalize-space(@citeas) = ''">
6293
6655
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6294
6656
  </xsl:if>
@@ -6298,14 +6660,21 @@
6298
6660
 
6299
6661
  </xsl:if>
6300
6662
 
6301
-
6663
+ <xsl:choose>
6664
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
6665
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
6666
+ </xsl:when>
6667
+ <xsl:otherwise>
6668
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6669
+ </xsl:otherwise>
6670
+ </xsl:choose>
6302
6671
 
6303
6672
  <xsl:apply-templates/>
6304
6673
  </fo:basic-link>
6305
-
6674
+
6306
6675
  </fo:inline>
6307
6676
  </xsl:when>
6308
- <xsl:otherwise>
6677
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6309
6678
  <fo:inline><xsl:apply-templates/></fo:inline>
6310
6679
  </xsl:otherwise>
6311
6680
  </xsl:choose>
@@ -6378,6 +6747,31 @@
6378
6747
  <xsl:with-param name="count" select="$count - 1"/>
6379
6748
  </xsl:call-template>
6380
6749
  </xsl:if>
6750
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
6751
+ <xsl:variable name="level">
6752
+ <xsl:call-template name="getLevel"/>
6753
+ </xsl:variable>
6754
+ <xsl:variable name="font-size">
6755
+ inherit
6756
+ </xsl:variable>
6757
+ <xsl:variable name="levelTerm">
6758
+ <xsl:call-template name="getLevelTermName"/>
6759
+ </xsl:variable>
6760
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
6761
+
6762
+
6763
+
6764
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
6765
+ <fo:block xsl:use-attribute-sets="term-name-style">
6766
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
6767
+ </fo:block>
6768
+ </xsl:if>
6769
+
6770
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
6771
+ <xsl:call-template name="setStyle_preferred"/>
6772
+ <xsl:apply-templates/>
6773
+ </fo:block>
6774
+ </fo:block>
6381
6775
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
6382
6776
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
6383
6777
  <xsl:text> </xsl:text>
@@ -6466,24 +6860,8 @@
6466
6860
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6467
6861
  </xsl:template><xsl:variable name="ul_labels_">
6468
6862
 
6469
-
6470
-
6471
-
6472
-
6473
-
6474
-
6475
-
6476
-
6477
-
6478
-
6479
-
6480
-
6481
- <label color="{$color_design}">•</label>
6482
-
6483
-
6484
-
6485
-
6486
-
6863
+ <label color="{$color_design}">•</label>
6864
+
6487
6865
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6488
6866
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6489
6867
  <xsl:variable name="list_level">
@@ -6509,6 +6887,91 @@
6509
6887
  </xsl:template><xsl:template match="label" mode="ul_labels">
6510
6888
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6511
6889
  <xsl:value-of select="."/>
6890
+ </xsl:template><xsl:template name="getListItemFormat">
6891
+ <!-- Example: for BSI <?list-type loweralpha?> -->
6892
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
6893
+ <xsl:choose>
6894
+ <xsl:when test="local-name(..) = 'ul'">
6895
+ <xsl:choose>
6896
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
6897
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
6898
+ </xsl:choose>
6899
+ </xsl:when>
6900
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
6901
+
6902
+ <!-- Example: for BSI <?list-start 2?> -->
6903
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
6904
+
6905
+ <xsl:variable name="start_value">
6906
+ <xsl:choose>
6907
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
6908
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6909
+ </xsl:when>
6910
+ <xsl:when test="normalize-space(../@start) != ''">
6911
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6912
+ </xsl:when>
6913
+ <xsl:otherwise>0</xsl:otherwise>
6914
+ </xsl:choose>
6915
+ </xsl:variable>
6916
+
6917
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
6918
+
6919
+ <xsl:variable name="type">
6920
+ <xsl:choose>
6921
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
6922
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
6923
+
6924
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
6925
+
6926
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6927
+ <xsl:variable name="list_level">
6928
+ <xsl:choose>
6929
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
6930
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
6931
+ </xsl:choose>
6932
+ </xsl:variable>
6933
+
6934
+ <xsl:choose>
6935
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
6936
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
6937
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
6938
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
6939
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
6940
+ <xsl:otherwise> <!-- level 1 -->
6941
+ <xsl:choose>
6942
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
6943
+ <xsl:otherwise>alphabet</xsl:otherwise>
6944
+ </xsl:choose>
6945
+ </xsl:otherwise>
6946
+ </xsl:choose>
6947
+
6948
+ </xsl:otherwise>
6949
+ </xsl:choose>
6950
+ </xsl:variable>
6951
+
6952
+ <xsl:variable name="format">
6953
+ <xsl:choose>
6954
+ <xsl:when test="$type = 'arabic'">
6955
+ 1.
6956
+ </xsl:when>
6957
+ <xsl:when test="$type = 'alphabet'">
6958
+ a)
6959
+ </xsl:when>
6960
+ <xsl:when test="$type = 'alphabet_upper'">
6961
+ A)
6962
+ </xsl:when>
6963
+ <xsl:when test="$type = 'roman'">
6964
+ i)
6965
+ </xsl:when>
6966
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
6967
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
6968
+ </xsl:choose>
6969
+ </xsl:variable>
6970
+
6971
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
6972
+
6973
+ </xsl:otherwise>
6974
+ </xsl:choose>
6512
6975
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6513
6976
  <xsl:choose>
6514
6977
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6524,18 +6987,79 @@
6524
6987
 
6525
6988
  <fo:block-container margin-left="0mm">
6526
6989
  <fo:block>
6527
- <xsl:apply-templates select="." mode="ul_ol"/>
6990
+ <xsl:apply-templates select="." mode="list"/>
6528
6991
  </fo:block>
6529
6992
  </fo:block-container>
6530
6993
  </fo:block-container>
6531
6994
  </xsl:when>
6532
6995
  <xsl:otherwise>
6533
6996
  <fo:block>
6534
- <xsl:apply-templates select="." mode="ul_ol"/>
6997
+ <xsl:apply-templates select="." mode="list"/>
6535
6998
  </fo:block>
6536
6999
  </xsl:otherwise>
6537
7000
  </xsl:choose>
6538
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7001
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7002
+ <fo:list-block xsl:use-attribute-sets="list-style">
7003
+
7004
+
7005
+
7006
+
7007
+
7008
+
7009
+
7010
+
7011
+
7012
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7013
+ </fo:list-block>
7014
+ <!-- <xsl:for-each select="./iho:note">
7015
+ <xsl:call-template name="note"/>
7016
+ </xsl:for-each> -->
7017
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
7018
+ </xsl:template><xsl:template match="*[local-name()='li']">
7019
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
7020
+ <xsl:copy-of select="@id"/>
7021
+
7022
+
7023
+
7024
+ <fo:list-item-label end-indent="label-end()">
7025
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
7026
+
7027
+
7028
+
7029
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7030
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7031
+ <xsl:call-template name="append_add-style"/>
7032
+ </xsl:if>
7033
+
7034
+ <xsl:call-template name="getListItemFormat"/>
7035
+ </fo:block>
7036
+ </fo:list-item-label>
7037
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
7038
+ <fo:block>
7039
+
7040
+
7041
+
7042
+
7043
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
7044
+ <xsl:if test="ancestor::ogc:table[not(@class)]">
7045
+ <xsl:attribute name="margin-bottom">1mm</xsl:attribute>
7046
+ </xsl:if>
7047
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
7048
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7049
+ </xsl:if>
7050
+
7051
+
7052
+ <xsl:apply-templates/>
7053
+
7054
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
7055
+
7056
+ <xsl:for-each select="./bsi:note">
7057
+ <xsl:call-template name="note"/>
7058
+ </xsl:for-each> -->
7059
+ </fo:block>
7060
+ </fo:list-item-body>
7061
+ </fo:list-item>
7062
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
6539
7063
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6540
7064
  <bookmark><xsl:value-of select="@id"/></bookmark>
6541
7065
  </xsl:for-each>
@@ -6557,7 +7081,7 @@
6557
7081
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6558
7082
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6559
7083
  <xsl:if test="@to">
6560
- <xsl:value-of select="$dash"/>
7084
+ <xsl:value-of select="$en_dash"/>
6561
7085
  <xsl:copy>
6562
7086
  <xsl:copy-of select="@*"/>
6563
7087
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -6582,7 +7106,7 @@
6582
7106
  <xsl:param name="target"/>
6583
7107
  <!-- <node></node> -->
6584
7108
  <xsl:choose>
6585
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7109
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
6586
7110
  <!-- skip text (i.e. remove it) and process next element -->
6587
7111
  <!-- [removed_<xsl:value-of select="."/>] -->
6588
7112
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -6666,12 +7190,22 @@
6666
7190
  </xsl:variable>
6667
7191
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6668
7192
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7193
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
7194
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
7195
+ <!-- Index -->
7196
+ <xsl:apply-templates/>
7197
+ </fo:block>
7198
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
7199
+ <!-- Letter A, B, C, ... -->
7200
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
7201
+ <xsl:apply-templates/>
7202
+ </fo:block>
6669
7203
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6670
7204
  <xsl:apply-templates/>
6671
7205
  <fo:block>
6672
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
6673
- <fo:block> </fo:block>
6674
- </xsl:if>
7206
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7207
+ <fo:block> </fo:block>
7208
+ </xsl:if>
6675
7209
  </fo:block>
6676
7210
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6677
7211
  <xsl:apply-templates/>
@@ -6681,6 +7215,9 @@
6681
7215
 
6682
7216
  <xsl:apply-templates/>
6683
7217
  </fo:block>
7218
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
7219
+ <!-- to split by '_' and other chars -->
7220
+ <xsl:call-template name="add-zero-spaces-java"/>
6684
7221
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6685
7222
  <fo:inline id="{@id}" font-size="1pt"/>
6686
7223
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -6986,6 +7523,24 @@
6986
7523
  <xsl:apply-templates/>
6987
7524
  </fo:inline>
6988
7525
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7526
+
7527
+ <!-- list of footnotes to calculate actual footnotes number -->
7528
+ <xsl:variable name="p_fn_">
7529
+ <xsl:call-template name="get_fn_list"/>
7530
+ </xsl:variable>
7531
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7532
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7533
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7534
+ <!-- fn sequence number in document -->
7535
+ <xsl:variable name="current_fn_number">
7536
+ <xsl:choose>
7537
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7538
+ <xsl:otherwise>
7539
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7540
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7541
+ </xsl:otherwise>
7542
+ </xsl:choose>
7543
+ </xsl:variable>
6989
7544
  <fo:footnote>
6990
7545
  <xsl:variable name="number">
6991
7546
 
@@ -6994,22 +7549,26 @@
6994
7549
  <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6995
7550
  </xsl:when>
6996
7551
  <xsl:otherwise>
6997
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7552
+ <xsl:value-of select="$current_fn_number"/>
6998
7553
  </xsl:otherwise>
6999
7554
  </xsl:choose>
7000
7555
 
7001
7556
  </xsl:variable>
7557
+
7558
+ <xsl:variable name="current_fn_number_text">
7559
+ <xsl:value-of select="$number"/>
7560
+
7561
+ </xsl:variable>
7562
+
7002
7563
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7003
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7004
- <xsl:value-of select="$number"/>
7005
-
7564
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7565
+ <xsl:value-of select="$current_fn_number_text"/>
7006
7566
  </fo:basic-link>
7007
7567
  </fo:inline>
7008
7568
  <fo:footnote-body>
7009
7569
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7010
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7011
- <xsl:value-of select="$number"/>
7012
-
7570
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7571
+ <xsl:value-of select="$current_fn_number_text"/>
7013
7572
  </fo:inline>
7014
7573
  <xsl:apply-templates/>
7015
7574
  </fo:block>
@@ -7135,7 +7694,7 @@
7135
7694
  </fo:table-body>
7136
7695
  </fo:table>
7137
7696
  </fo:block>
7138
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7697
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
7139
7698
  <fo:table-row min-height="5mm">
7140
7699
  <xsl:apply-templates/>
7141
7700
  </fo:table-row>
@@ -7255,6 +7814,78 @@
7255
7814
  <xsl:apply-templates/>
7256
7815
  </fo:block>
7257
7816
 
7817
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
7818
+ <xsl:copy>
7819
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
7820
+ </xsl:copy>
7821
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
7822
+ <xsl:copy>
7823
+ <xsl:copy-of select="@*"/>
7824
+
7825
+ <xsl:variable name="nodes_preface_">
7826
+ <xsl:for-each select="*">
7827
+ <node id="{@id}"/>
7828
+ </xsl:for-each>
7829
+ </xsl:variable>
7830
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
7831
+
7832
+ <xsl:for-each select="*">
7833
+ <xsl:sort select="@displayorder" data-type="number"/>
7834
+
7835
+ <!-- process Section's title -->
7836
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7837
+ <xsl:if test="$preceding-sibling_id != ''">
7838
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7839
+ </xsl:if>
7840
+
7841
+ <xsl:choose>
7842
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7843
+ <xsl:otherwise>
7844
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7845
+ </xsl:otherwise>
7846
+ </xsl:choose>
7847
+
7848
+ </xsl:for-each>
7849
+ </xsl:copy>
7850
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
7851
+ <xsl:copy>
7852
+ <xsl:copy-of select="@*"/>
7853
+
7854
+ <xsl:variable name="nodes_sections_">
7855
+ <xsl:for-each select="*">
7856
+ <node id="{@id}"/>
7857
+ </xsl:for-each>
7858
+ </xsl:variable>
7859
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
7860
+
7861
+ <!-- move section 'Normative references' inside 'sections' -->
7862
+ <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']]">
7863
+ <xsl:sort select="@displayorder" data-type="number"/>
7864
+
7865
+ <!-- process Section's title -->
7866
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7867
+ <xsl:if test="$preceding-sibling_id != ''">
7868
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7869
+ </xsl:if>
7870
+
7871
+ <xsl:choose>
7872
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7873
+ <xsl:otherwise>
7874
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7875
+ </xsl:otherwise>
7876
+ </xsl:choose>
7877
+
7878
+ </xsl:for-each>
7879
+ </xsl:copy>
7880
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
7881
+ <xsl:copy>
7882
+ <xsl:copy-of select="@*"/>
7883
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
7884
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
7885
+ <xsl:sort select="@displayorder" data-type="number"/>
7886
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7887
+ </xsl:for-each>
7888
+ </xsl:copy>
7258
7889
  </xsl:template><xsl:template name="convertDate">
7259
7890
  <xsl:param name="date"/>
7260
7891
  <xsl:param name="format" select="'short'"/>
@@ -7368,9 +7999,6 @@
7368
7999
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7369
8000
  </xsl:choose>
7370
8001
  </xsl:template><xsl:template name="addPDFUAmeta">
7371
- <xsl:variable name="lang">
7372
- <xsl:call-template name="getLang"/>
7373
- </xsl:variable>
7374
8002
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7375
8003
  <pdf:dictionary type="normal" key="ViewerPreferences">
7376
8004
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -7598,10 +8226,12 @@
7598
8226
  <xsl:param name="key"/>
7599
8227
  <xsl:param name="formatted">false</xsl:param>
7600
8228
  <xsl:param name="lang"/>
8229
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
7601
8230
 
7602
8231
  <xsl:variable name="curr_lang">
7603
8232
  <xsl:choose>
7604
8233
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8234
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7605
8235
  <xsl:otherwise>
7606
8236
  <xsl:call-template name="getLang"/>
7607
8237
  </xsl:otherwise>
@@ -7636,6 +8266,7 @@
7636
8266
  </xsl:otherwise>
7637
8267
  </xsl:choose>
7638
8268
  </xsl:when>
8269
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7639
8270
  <xsl:otherwise>
7640
8271
  <xsl:variable name="key_">
7641
8272
  <xsl:call-template name="capitalize">
@@ -7705,53 +8336,153 @@
7705
8336
  <xsl:param name="first"/>
7706
8337
  <xsl:if test="$number != ''">
7707
8338
  <xsl:variable name="words">
7708
- <words>
7709
- <word cardinal="1">One-</word>
7710
- <word ordinal="1">First </word>
7711
- <word cardinal="2">Two-</word>
7712
- <word ordinal="2">Second </word>
7713
- <word cardinal="3">Three-</word>
7714
- <word ordinal="3">Third </word>
7715
- <word cardinal="4">Four-</word>
7716
- <word ordinal="4">Fourth </word>
7717
- <word cardinal="5">Five-</word>
7718
- <word ordinal="5">Fifth </word>
7719
- <word cardinal="6">Six-</word>
7720
- <word ordinal="6">Sixth </word>
7721
- <word cardinal="7">Seven-</word>
7722
- <word ordinal="7">Seventh </word>
7723
- <word cardinal="8">Eight-</word>
7724
- <word ordinal="8">Eighth </word>
7725
- <word cardinal="9">Nine-</word>
7726
- <word ordinal="9">Ninth </word>
7727
- <word ordinal="10">Tenth </word>
7728
- <word ordinal="11">Eleventh </word>
7729
- <word ordinal="12">Twelfth </word>
7730
- <word ordinal="13">Thirteenth </word>
7731
- <word ordinal="14">Fourteenth </word>
7732
- <word ordinal="15">Fifteenth </word>
7733
- <word ordinal="16">Sixteenth </word>
7734
- <word ordinal="17">Seventeenth </word>
7735
- <word ordinal="18">Eighteenth </word>
7736
- <word ordinal="19">Nineteenth </word>
7737
- <word cardinal="20">Twenty-</word>
7738
- <word ordinal="20">Twentieth </word>
7739
- <word cardinal="30">Thirty-</word>
7740
- <word ordinal="30">Thirtieth </word>
7741
- <word cardinal="40">Forty-</word>
7742
- <word ordinal="40">Fortieth </word>
7743
- <word cardinal="50">Fifty-</word>
7744
- <word ordinal="50">Fiftieth </word>
7745
- <word cardinal="60">Sixty-</word>
7746
- <word ordinal="60">Sixtieth </word>
7747
- <word cardinal="70">Seventy-</word>
7748
- <word ordinal="70">Seventieth </word>
7749
- <word cardinal="80">Eighty-</word>
7750
- <word ordinal="80">Eightieth </word>
7751
- <word cardinal="90">Ninety-</word>
7752
- <word ordinal="90">Ninetieth </word>
7753
- <word cardinal="100">Hundred-</word>
7754
- <word ordinal="100">Hundredth </word>
8339
+ <words>
8340
+ <xsl:choose>
8341
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8342
+ <word cardinal="1">Une-</word>
8343
+ <word ordinal="1">Première </word>
8344
+ <word cardinal="2">Deux-</word>
8345
+ <word ordinal="2">Seconde </word>
8346
+ <word cardinal="3">Trois-</word>
8347
+ <word ordinal="3">Tierce </word>
8348
+ <word cardinal="4">Quatre-</word>
8349
+ <word ordinal="4">Quatrième </word>
8350
+ <word cardinal="5">Cinq-</word>
8351
+ <word ordinal="5">Cinquième </word>
8352
+ <word cardinal="6">Six-</word>
8353
+ <word ordinal="6">Sixième </word>
8354
+ <word cardinal="7">Sept-</word>
8355
+ <word ordinal="7">Septième </word>
8356
+ <word cardinal="8">Huit-</word>
8357
+ <word ordinal="8">Huitième </word>
8358
+ <word cardinal="9">Neuf-</word>
8359
+ <word ordinal="9">Neuvième </word>
8360
+ <word ordinal="10">Dixième </word>
8361
+ <word ordinal="11">Onzième </word>
8362
+ <word ordinal="12">Douzième </word>
8363
+ <word ordinal="13">Treizième </word>
8364
+ <word ordinal="14">Quatorzième </word>
8365
+ <word ordinal="15">Quinzième </word>
8366
+ <word ordinal="16">Seizième </word>
8367
+ <word ordinal="17">Dix-septième </word>
8368
+ <word ordinal="18">Dix-huitième </word>
8369
+ <word ordinal="19">Dix-neuvième </word>
8370
+ <word cardinal="20">Vingt-</word>
8371
+ <word ordinal="20">Vingtième </word>
8372
+ <word cardinal="30">Trente-</word>
8373
+ <word ordinal="30">Trentième </word>
8374
+ <word cardinal="40">Quarante-</word>
8375
+ <word ordinal="40">Quarantième </word>
8376
+ <word cardinal="50">Cinquante-</word>
8377
+ <word ordinal="50">Cinquantième </word>
8378
+ <word cardinal="60">Soixante-</word>
8379
+ <word ordinal="60">Soixantième </word>
8380
+ <word cardinal="70">Septante-</word>
8381
+ <word ordinal="70">Septantième </word>
8382
+ <word cardinal="80">Huitante-</word>
8383
+ <word ordinal="80">Huitantième </word>
8384
+ <word cardinal="90">Nonante-</word>
8385
+ <word ordinal="90">Nonantième </word>
8386
+ <word cardinal="100">Cent-</word>
8387
+ <word ordinal="100">Centième </word>
8388
+ </xsl:when>
8389
+ <xsl:when test="$lang = 'ru'">
8390
+ <word cardinal="1">Одна-</word>
8391
+ <word ordinal="1">Первое </word>
8392
+ <word cardinal="2">Две-</word>
8393
+ <word ordinal="2">Второе </word>
8394
+ <word cardinal="3">Три-</word>
8395
+ <word ordinal="3">Третье </word>
8396
+ <word cardinal="4">Четыре-</word>
8397
+ <word ordinal="4">Четвертое </word>
8398
+ <word cardinal="5">Пять-</word>
8399
+ <word ordinal="5">Пятое </word>
8400
+ <word cardinal="6">Шесть-</word>
8401
+ <word ordinal="6">Шестое </word>
8402
+ <word cardinal="7">Семь-</word>
8403
+ <word ordinal="7">Седьмое </word>
8404
+ <word cardinal="8">Восемь-</word>
8405
+ <word ordinal="8">Восьмое </word>
8406
+ <word cardinal="9">Девять-</word>
8407
+ <word ordinal="9">Девятое </word>
8408
+ <word ordinal="10">Десятое </word>
8409
+ <word ordinal="11">Одиннадцатое </word>
8410
+ <word ordinal="12">Двенадцатое </word>
8411
+ <word ordinal="13">Тринадцатое </word>
8412
+ <word ordinal="14">Четырнадцатое </word>
8413
+ <word ordinal="15">Пятнадцатое </word>
8414
+ <word ordinal="16">Шестнадцатое </word>
8415
+ <word ordinal="17">Семнадцатое </word>
8416
+ <word ordinal="18">Восемнадцатое </word>
8417
+ <word ordinal="19">Девятнадцатое </word>
8418
+ <word cardinal="20">Двадцать-</word>
8419
+ <word ordinal="20">Двадцатое </word>
8420
+ <word cardinal="30">Тридцать-</word>
8421
+ <word ordinal="30">Тридцатое </word>
8422
+ <word cardinal="40">Сорок-</word>
8423
+ <word ordinal="40">Сороковое </word>
8424
+ <word cardinal="50">Пятьдесят-</word>
8425
+ <word ordinal="50">Пятидесятое </word>
8426
+ <word cardinal="60">Шестьдесят-</word>
8427
+ <word ordinal="60">Шестидесятое </word>
8428
+ <word cardinal="70">Семьдесят-</word>
8429
+ <word ordinal="70">Семидесятое </word>
8430
+ <word cardinal="80">Восемьдесят-</word>
8431
+ <word ordinal="80">Восьмидесятое </word>
8432
+ <word cardinal="90">Девяносто-</word>
8433
+ <word ordinal="90">Девяностое </word>
8434
+ <word cardinal="100">Сто-</word>
8435
+ <word ordinal="100">Сотое </word>
8436
+ </xsl:when>
8437
+ <xsl:otherwise> <!-- default english -->
8438
+ <word cardinal="1">One-</word>
8439
+ <word ordinal="1">First </word>
8440
+ <word cardinal="2">Two-</word>
8441
+ <word ordinal="2">Second </word>
8442
+ <word cardinal="3">Three-</word>
8443
+ <word ordinal="3">Third </word>
8444
+ <word cardinal="4">Four-</word>
8445
+ <word ordinal="4">Fourth </word>
8446
+ <word cardinal="5">Five-</word>
8447
+ <word ordinal="5">Fifth </word>
8448
+ <word cardinal="6">Six-</word>
8449
+ <word ordinal="6">Sixth </word>
8450
+ <word cardinal="7">Seven-</word>
8451
+ <word ordinal="7">Seventh </word>
8452
+ <word cardinal="8">Eight-</word>
8453
+ <word ordinal="8">Eighth </word>
8454
+ <word cardinal="9">Nine-</word>
8455
+ <word ordinal="9">Ninth </word>
8456
+ <word ordinal="10">Tenth </word>
8457
+ <word ordinal="11">Eleventh </word>
8458
+ <word ordinal="12">Twelfth </word>
8459
+ <word ordinal="13">Thirteenth </word>
8460
+ <word ordinal="14">Fourteenth </word>
8461
+ <word ordinal="15">Fifteenth </word>
8462
+ <word ordinal="16">Sixteenth </word>
8463
+ <word ordinal="17">Seventeenth </word>
8464
+ <word ordinal="18">Eighteenth </word>
8465
+ <word ordinal="19">Nineteenth </word>
8466
+ <word cardinal="20">Twenty-</word>
8467
+ <word ordinal="20">Twentieth </word>
8468
+ <word cardinal="30">Thirty-</word>
8469
+ <word ordinal="30">Thirtieth </word>
8470
+ <word cardinal="40">Forty-</word>
8471
+ <word ordinal="40">Fortieth </word>
8472
+ <word cardinal="50">Fifty-</word>
8473
+ <word ordinal="50">Fiftieth </word>
8474
+ <word cardinal="60">Sixty-</word>
8475
+ <word ordinal="60">Sixtieth </word>
8476
+ <word cardinal="70">Seventy-</word>
8477
+ <word ordinal="70">Seventieth </word>
8478
+ <word cardinal="80">Eighty-</word>
8479
+ <word ordinal="80">Eightieth </word>
8480
+ <word cardinal="90">Ninety-</word>
8481
+ <word ordinal="90">Ninetieth </word>
8482
+ <word cardinal="100">Hundred-</word>
8483
+ <word ordinal="100">Hundredth </word>
8484
+ </xsl:otherwise>
8485
+ </xsl:choose>
7755
8486
  </words>
7756
8487
  </xsl:variable>
7757
8488
 
@@ -7825,4 +8556,18 @@
7825
8556
  <xsl:otherwise>_</xsl:otherwise>
7826
8557
  </xsl:choose>
7827
8558
  </xsl:attribute>
8559
+ </xsl:template><xsl:template name="substring-after-last">
8560
+ <xsl:param name="value"/>
8561
+ <xsl:param name="delimiter"/>
8562
+ <xsl:choose>
8563
+ <xsl:when test="contains($value, $delimiter)">
8564
+ <xsl:call-template name="substring-after-last">
8565
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8566
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8567
+ </xsl:call-template>
8568
+ </xsl:when>
8569
+ <xsl:otherwise>
8570
+ <xsl:value-of select="$value"/>
8571
+ </xsl:otherwise>
8572
+ </xsl:choose>
7828
8573
  </xsl:template></xsl:stylesheet>