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
@@ -2,17 +2,7 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:param name="svg_images"/>
6
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
- <xsl:variable name="images" select="document($svg_images)"/>
8
- <xsl:param name="basepath"/>
9
-
10
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
-
12
- <xsl:variable name="marginLeftRight1" select="25.4"/>
13
- <xsl:variable name="marginLeftRight2" select="25.4"/>
14
- <xsl:variable name="marginTop" select="25.4"/>
15
- <xsl:variable name="marginBottom" select="25.4"/>
16
6
 
17
7
 
18
8
 
@@ -82,45 +72,19 @@
82
72
  <xsl:attribute-set name="empty-style">
83
73
  </xsl:attribute-set>
84
74
 
85
- <xsl:variable name="contents">
75
+ <xsl:variable name="contents_">
86
76
  <contents>
87
-
88
- <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
89
- <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="contents"/> -->
90
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/>
91
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']" mode="contents"/>
92
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keyword']" mode="contents"/>
93
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents"/>
94
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
95
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']" mode="contents"/>
96
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents"/>
97
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'submitting_orgs') and not(@type = 'keyword')]" mode="contents"/>
98
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements" mode="contents"/>
99
-
100
-
101
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="contents"/>
102
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="contents"/>
103
- <!-- Normative references -->
104
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="contents"/>
105
- <!-- Terms and definitions -->
106
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents"/>
107
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="contents"/>
108
-
109
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="contents"/>
110
-
111
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="contents"/>
112
-
113
- <!-- Bibliography -->
114
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="contents"/>
77
+ <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
78
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
115
79
 
80
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
81
+ <xsl:apply-templates select="//ogc:indexsect" mode="contents"/>
116
82
 
83
+ <xsl:call-template name="processTablesFigures_Contents"/>
117
84
  </contents>
118
85
  </xsl:variable>
119
-
120
- <xsl:variable name="lang">
121
- <xsl:call-template name="getLang"/>
122
- </xsl:variable>
123
-
86
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
87
+
124
88
  <xsl:template match="/">
125
89
  <xsl:call-template name="namespaceCheck"/>
126
90
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
@@ -244,7 +208,7 @@
244
208
  </xsl:call-template>
245
209
  </fo:block>
246
210
  <xsl:variable name="margin-left">3.9</xsl:variable>
247
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
211
+ <xsl:for-each select="$contents//item[@display = 'true']">
248
212
  <fo:block margin-top="8pt" margin-bottom="5pt" margin-left="{(@level - 1) * $margin-left}mm" text-align-last="justify" role="TOCI">
249
213
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
250
214
  <xsl:if test="@section != ''">
@@ -285,27 +249,16 @@
285
249
 
286
250
 
287
251
  <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
288
- <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="preface"/> -->
289
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:abstract">
290
- <fo:block break-after="page"/>
291
- </xsl:if>
292
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract"/>
293
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']"/>
294
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keyword']"/>
295
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:foreword">
296
- <fo:block break-after="page"/>
297
- </xsl:if>
298
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword"/>
299
- <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:introduction">
300
- <fo:block break-after="page"/>
301
- </xsl:if>
302
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction"/>
303
-
304
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"/>
305
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters"/>
306
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'submitting_orgs') and not(@type = 'keyword')]"/>
307
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements"/>
252
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
253
+ <xsl:sort select="@displayorder" data-type="number"/>
254
+
255
+ <xsl:if test="local-name() = 'abstract' or local-name() = 'foreword' or local-name() = 'introduction'">
256
+ <fo:block break-after="page"/>
257
+ </xsl:if>
308
258
 
259
+ <xsl:apply-templates select="."/>
260
+ </xsl:for-each>
261
+
309
262
  </fo:flow>
310
263
  </fo:page-sequence>
311
264
 
@@ -319,23 +272,7 @@
319
272
 
320
273
  <fo:block line-height="125%">
321
274
 
322
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']"/>
323
-
324
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']"/>
325
-
326
- <!-- Normative references -->
327
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']"/>
328
-
329
- <!-- Terms and definitions -->
330
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms"/>
331
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions"/>
332
-
333
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]"/>
334
-
335
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex"/>
336
-
337
- <!-- Bibliography -->
338
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]"/>
275
+ <xsl:call-template name="processMainSectionsDefault"/>
339
276
 
340
277
  </fo:block>
341
278
  </fo:flow>
@@ -347,22 +284,20 @@
347
284
  </xsl:template>
348
285
 
349
286
 
350
- <xsl:variable name="thinspace" select="' '"/>
351
-
352
287
  <!-- Lato font doesn't contain 'thin space' glyph -->
353
288
  <xsl:template match="text()" priority="1">
354
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
289
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
355
290
  </xsl:template>
356
291
 
357
292
  <xsl:template match="text()" priority="3" mode="contents">
358
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
293
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
359
294
  </xsl:template>
360
295
 
361
296
  <xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="2">
362
297
  <xsl:variable name="content">
363
298
  <xsl:call-template name="add-zero-spaces"/>
364
299
  </xsl:variable>
365
- <xsl:value-of select="translate($content, $thinspace, ' ')"/>
300
+ <xsl:value-of select="translate($content, $thin_space, ' ')"/>
366
301
  </xsl:template>
367
302
 
368
303
  <xsl:template match="node()">
@@ -464,14 +399,6 @@
464
399
  </fo:block>
465
400
  </xsl:template>
466
401
 
467
- <xsl:template match="ogc:ogc-standard/ogc:preface/*" mode="preface">
468
- <xsl:if test="local-name() = 'introduction' or local-name() = 'abstract' or local-name() = 'foreword'">
469
- <fo:block break-after="page"/>
470
- </xsl:if>
471
- <xsl:apply-templates select="current()"/>
472
- </xsl:template>
473
-
474
-
475
402
 
476
403
  <!-- ====== -->
477
404
  <!-- title -->
@@ -606,8 +533,8 @@
606
533
  </xsl:template>
607
534
 
608
535
 
609
- <xsl:template match="ogc:ul | ogc:ol" mode="ul_ol">
610
- <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
536
+ <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
537
+ <fo:list-block xsl:use-attribute-sets="list-style">
611
538
  <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
612
539
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
613
540
  </xsl:if>
@@ -618,111 +545,20 @@
618
545
  </fo:list-block>
619
546
  </xsl:template>
620
547
 
621
- <xsl:template match="ogc:li">
622
- <fo:list-item id="{@id}">
623
- <fo:list-item-label end-indent="label-end()">
624
- <fo:block>
625
- <xsl:choose>
626
- <xsl:when test="local-name(..) = 'ul'">
627
- <xsl:call-template name="setULLabel"/>
628
- </xsl:when>
629
- <xsl:otherwise> <!-- for ordered lists -->
630
- <xsl:choose>
631
- <xsl:when test="../@class = 'steps'">
632
- <xsl:number format="1)"/>
633
- </xsl:when>
634
- <xsl:when test="../@type = 'arabic'">
635
- <xsl:number format="a)" lang="en"/>
636
- </xsl:when>
637
- <xsl:when test="../@type = 'alphabet'">
638
- <xsl:number format="1)"/>
639
- </xsl:when>
640
- <xsl:when test="../@type = 'alphabet_upper'">
641
- <xsl:number format="A)" lang="en"/>
642
- </xsl:when>
643
-
644
- <xsl:when test="../@type = 'roman'">
645
- <xsl:number format="i)"/>
646
- </xsl:when>
647
- <xsl:otherwise>
648
- <xsl:number format="1)"/>
649
- </xsl:otherwise>
650
- </xsl:choose>
651
- </xsl:otherwise>
652
- </xsl:choose>
653
- </fo:block>
654
- </fo:list-item-label>
655
- <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
656
- <fo:block>
657
- <xsl:apply-templates/>
658
- </fo:block>
659
- </fo:list-item-body>
660
- </fo:list-item>
661
- </xsl:template>
662
548
 
663
549
  <xsl:template match="ogc:ul/ogc:note | ogc:ol/ogc:note" priority="2">
664
550
  <fo:list-item font-size="10pt">
665
551
  <fo:list-item-label><fo:block/></fo:list-item-label>
666
552
  <fo:list-item-body>
667
553
  <fo:block>
668
- <xsl:apply-templates select="ogc:name"/>
669
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
554
+ <xsl:apply-templates/>
670
555
  </fo:block>
671
556
  </fo:list-item-body>
672
557
  </fo:list-item>
673
558
  </xsl:template>
674
559
 
675
560
 
676
-
677
- <xsl:template match="ogc:preferred">
678
- <xsl:variable name="level">
679
- <xsl:call-template name="getLevel"/>
680
- </xsl:variable>
681
- <xsl:variable name="font-size">
682
- <xsl:choose>
683
- <xsl:when test="$level &gt;= 2">11pt</xsl:when>
684
- <xsl:otherwise>12pt</xsl:otherwise>
685
- </xsl:choose>
686
- </xsl:variable>
687
- <xsl:variable name="levelTerm">
688
- <xsl:call-template name="getLevelTermName"/>
689
- </xsl:variable>
690
- <fo:block font-size="{$font-size}" role="H{$levelTerm}">
691
- <fo:block font-weight="bold" keep-with-next="always">
692
- <xsl:apply-templates select="ancestor::ogc:term[1]/ogc:name"/>
693
- </fo:block>
694
- <fo:block font-weight="bold" keep-with-next="always" line-height="1">
695
- <xsl:call-template name="setStyle_preferred"/>
696
- <xsl:apply-templates/>
697
- </fo:block>
698
- </fo:block>
699
- </xsl:template>
700
-
701
-
702
- <xsl:template match="ogc:formula/ogc:stem">
703
- <fo:block margin-top="6pt" margin-bottom="12pt">
704
- <fo:table table-layout="fixed" width="100%">
705
- <fo:table-column column-width="95%"/>
706
- <fo:table-column column-width="5%"/>
707
- <fo:table-body>
708
- <fo:table-row>
709
- <fo:table-cell display-align="center">
710
- <fo:block text-align="left" margin-left="5mm">
711
- <xsl:apply-templates/>
712
- </fo:block>
713
- </fo:table-cell>
714
- <fo:table-cell display-align="center">
715
- <fo:block text-align="right">
716
- <xsl:apply-templates select="../ogc:name" mode="formula_number"/>
717
- </fo:block>
718
- </fo:table-cell>
719
- </fo:table-row>
720
- </fo:table-body>
721
- </fo:table>
722
- </fo:block>
723
- </xsl:template>
724
-
725
-
561
+
726
562
 
727
563
  <xsl:template name="insertHeaderFooter">
728
564
 
@@ -796,11 +632,21 @@
796
632
  </xsl:choose>
797
633
  </xsl:template>
798
634
 
799
- <xsl:variable name="pageWidth_">
635
+ <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">
636
+ <xsl:call-template name="getLang"/>
637
+ </xsl:variable><xsl:variable name="pageWidth_">
800
638
  215.9
801
639
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
802
640
  279.4
803
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
641
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
642
+ 25.4
643
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
644
+ 25.4
645
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
646
+ 25.4
647
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
648
+ 25.4
649
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
804
650
 
805
651
  <title-edition lang="en">
806
652
 
@@ -812,6 +658,10 @@
812
658
  <xsl:text>Édition </xsl:text>
813
659
  </title-edition>
814
660
 
661
+ <title-edition lang="ru">
662
+ <xsl:text>Издание </xsl:text>
663
+ </title-edition>
664
+
815
665
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
816
666
  <title-toc lang="en">
817
667
 
@@ -828,7 +678,7 @@
828
678
  <xsl:text>Contents</xsl:text>
829
679
 
830
680
  </title-toc>
831
-
681
+
832
682
  <title-descriptors lang="en">Descriptors</title-descriptors>
833
683
 
834
684
  <title-part lang="en">
@@ -840,7 +690,11 @@
840
690
 
841
691
 
842
692
 
843
- </title-part>
693
+ </title-part>
694
+ <title-part lang="ru">
695
+
696
+
697
+ </title-part>
844
698
  <title-part lang="zh">第 # 部分:</title-part>
845
699
 
846
700
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -856,13 +710,38 @@
856
710
 
857
711
  <title-summary lang="en">Summary</title-summary>
858
712
 
713
+ <title-continued lang="ru">(продолжение)</title-continued>
859
714
  <title-continued lang="en">(continued)</title-continued>
860
715
  <title-continued lang="fr">(continué)</title-continued>
861
716
 
862
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
717
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
718
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
719
+ <xsl:value-of select="$toc_table_title"/>
720
+ <xsl:if test="normalize-space($toc_table_title) = ''">
721
+ <xsl:call-template name="getTitle">
722
+ <xsl:with-param name="name" select="'title-list-tables'"/>
723
+ </xsl:call-template>
724
+ </xsl:if>
725
+ </xsl:variable><xsl:variable name="title-list-figures">
726
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
727
+ <xsl:value-of select="$toc_figure_title"/>
728
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
729
+ <xsl:call-template name="getTitle">
730
+ <xsl:with-param name="name" select="'title-list-figures'"/>
731
+ </xsl:call-template>
732
+ </xsl:if>
733
+ </xsl:variable><xsl:variable name="title-list-recommendations">
734
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
735
+ <xsl:value-of select="$toc_requirement_title"/>
736
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
737
+ <xsl:call-template name="getTitle">
738
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
739
+ </xsl:call-template>
740
+ </xsl:if>
741
+ </xsl:variable><xsl:variable name="bibdata">
863
742
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
864
743
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
865
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
744
+ </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">
866
745
  <xsl:param name="name"/>
867
746
  <xsl:param name="lang"/>
868
747
  <xsl:variable name="lang_">
@@ -885,7 +764,7 @@
885
764
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
886
765
  </xsl:otherwise>
887
766
  </xsl:choose>
888
- </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">
767
+ </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">
889
768
 
890
769
 
891
770
 
@@ -1112,7 +991,7 @@
1112
991
 
1113
992
 
1114
993
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1115
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
994
+
1116
995
 
1117
996
 
1118
997
 
@@ -1511,11 +1390,11 @@
1511
1390
 
1512
1391
 
1513
1392
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1514
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
1393
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
1394
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
1515
1395
 
1516
1396
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1517
1397
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
1518
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
1519
1398
 
1520
1399
 
1521
1400
 
@@ -1524,12 +1403,11 @@
1524
1403
 
1525
1404
 
1526
1405
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1406
+ <xsl:attribute name="text-align">right</xsl:attribute>
1527
1407
 
1528
- <xsl:attribute name="text-align">right</xsl:attribute>
1529
1408
  <xsl:attribute name="margin-right">25mm</xsl:attribute>
1530
1409
 
1531
1410
 
1532
-
1533
1411
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1534
1412
 
1535
1413
 
@@ -1554,6 +1432,9 @@
1554
1432
 
1555
1433
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1556
1434
 
1435
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
1436
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1437
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1557
1438
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
1558
1439
 
1559
1440
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1587,6 +1468,36 @@
1587
1468
 
1588
1469
 
1589
1470
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1471
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1472
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+
1479
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
1480
+ <xsl:attribute name="text-align">center</xsl:attribute>
1481
+
1482
+
1483
+
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+ <xsl:attribute name="text-align">left</xsl:attribute>
1492
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
1493
+
1494
+
1495
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1496
+ <xsl:attribute name="text-align">right</xsl:attribute>
1497
+
1498
+
1499
+
1500
+
1590
1501
 
1591
1502
  </xsl:attribute-set><xsl:attribute-set name="image-style">
1592
1503
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1625,6 +1536,21 @@
1625
1536
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1626
1537
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1627
1538
 
1539
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
1540
+
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+
1547
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
1548
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1549
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1550
+
1551
+
1552
+ <xsl:attribute name="line-height">1</xsl:attribute>
1553
+
1628
1554
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1629
1555
 
1630
1556
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1645,13 +1571,19 @@
1645
1571
  </xsl:attribute-set><xsl:variable name="color-added-text">
1646
1572
  <xsl:text>rgb(0, 255, 0)</xsl:text>
1647
1573
  </xsl:variable><xsl:attribute-set name="add-style">
1648
- <xsl:attribute name="color">red</xsl:attribute>
1649
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1650
- <!-- <xsl:attribute name="color">black</xsl:attribute>
1651
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1652
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
1653
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1654
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
1574
+
1575
+ <xsl:attribute name="color">red</xsl:attribute>
1576
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1577
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1578
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1579
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1580
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1581
+
1582
+ </xsl:attribute-set><xsl:variable name="add-style">
1583
+ <add-style xsl:use-attribute-sets="add-style"/>
1584
+ </xsl:variable><xsl:template name="append_add-style">
1585
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
1586
+ </xsl:template><xsl:variable name="color-deleted-text">
1655
1587
  <xsl:text>red</xsl:text>
1656
1588
  </xsl:variable><xsl:attribute-set name="del-style">
1657
1589
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -1662,6 +1594,39 @@
1662
1594
 
1663
1595
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1664
1596
 
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+
1605
+
1606
+
1607
+
1608
+
1609
+
1610
+ <xsl:attribute name="provisional-distance-between-starts">6.5mm</xsl:attribute>
1611
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1612
+ <xsl:attribute name="line-height">115%</xsl:attribute>
1613
+
1614
+
1615
+
1616
+
1617
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1618
+
1619
+
1620
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
1621
+
1622
+
1623
+
1624
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
1625
+
1626
+
1627
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
1628
+
1629
+
1665
1630
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1666
1631
  <xsl:attribute name="line-height">135%</xsl:attribute>
1667
1632
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -1955,15 +1920,148 @@
1955
1920
 
1956
1921
  <xsl:attribute name="line-height">120%</xsl:attribute>
1957
1922
 
1923
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
1924
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1925
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
1926
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1927
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
1928
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1929
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
1930
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1931
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
1932
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1933
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
1934
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1935
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
1936
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1937
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
1938
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1939
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
1940
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1941
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
1942
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1943
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
1944
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1945
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
1946
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1947
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
1948
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1949
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
1950
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1951
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
1952
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1953
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
1954
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1955
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
1956
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1957
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
1958
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1959
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
1960
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1961
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
1962
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1963
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
1964
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1965
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
1966
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1967
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
1968
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1969
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
1970
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1971
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
1972
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1973
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
1974
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1975
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
1976
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1977
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
1978
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1979
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
1980
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1981
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
1982
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1983
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
1984
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1985
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
1986
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1987
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
1988
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1989
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
1990
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1991
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
1992
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1993
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1994
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
1995
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
1996
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
1997
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1998
+ <xsl:attribute name="font-style">italic</xsl:attribute>
1999
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
2000
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2001
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2002
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
2003
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2004
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
2005
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
2006
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
2007
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
2008
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
2009
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
2010
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
2011
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
2012
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
2013
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
2014
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
2015
+ <xsl:attribute name="role">H1</xsl:attribute>
2016
+
2017
+
2018
+
2019
+
2020
+
2021
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
2022
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2023
+
2024
+
2025
+
2026
+
2027
+
1958
2028
  </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">
2029
+ <xsl:variable name="nodes_preface_">
2030
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2031
+ <node id="{@id}"/>
2032
+ </xsl:for-each>
2033
+ </xsl:variable>
2034
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
2035
+
1959
2036
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1960
2037
  <xsl:sort select="@displayorder" data-type="number"/>
2038
+
2039
+ <!-- process Section's title -->
2040
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2041
+ <xsl:if test="$preceding-sibling_id != ''">
2042
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2043
+ </xsl:if>
2044
+
1961
2045
  <xsl:apply-templates select="." mode="contents"/>
1962
2046
  </xsl:for-each>
1963
2047
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1964
2048
 
2049
+ <xsl:variable name="nodes_sections_">
2050
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
2051
+ <node id="{@id}"/>
2052
+ </xsl:for-each>
2053
+ </xsl:variable>
2054
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
2055
+
1965
2056
  <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']]">
1966
2057
  <xsl:sort select="@displayorder" data-type="number"/>
2058
+
2059
+ <!-- process Section's title -->
2060
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
2061
+ <xsl:if test="$preceding-sibling_id != ''">
2062
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
2063
+ </xsl:if>
2064
+
1967
2065
  <xsl:apply-templates select="." mode="contents"/>
1968
2066
  </xsl:for-each>
1969
2067
 
@@ -1976,6 +2074,30 @@
1976
2074
  <xsl:sort select="@displayorder" data-type="number"/>
1977
2075
  <xsl:apply-templates select="." mode="contents"/>
1978
2076
  </xsl:for-each>
2077
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
2078
+ <xsl:param name="always"/>
2079
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2080
+ <xsl:call-template name="processTables_Contents"/>
2081
+ </xsl:if>
2082
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2083
+ <xsl:call-template name="processFigures_Contents"/>
2084
+ </xsl:if>
2085
+ </xsl:template><xsl:template name="processTables_Contents">
2086
+ <tables>
2087
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2088
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2089
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2090
+ </table>
2091
+ </xsl:for-each>
2092
+ </tables>
2093
+ </xsl:template><xsl:template name="processFigures_Contents">
2094
+ <figures>
2095
+ <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) != '']">
2096
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
2097
+ <xsl:copy-of select="*[local-name() = 'name']"/>
2098
+ </figure>
2099
+ </xsl:for-each>
2100
+ </figures>
1979
2101
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1980
2102
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1981
2103
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2077,6 +2199,7 @@
2077
2199
 
2078
2200
 
2079
2201
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
2202
+ <xsl:param name="margin"/>
2080
2203
 
2081
2204
  <!-- csa -->
2082
2205
  <fo:block xsl:use-attribute-sets="legal-statement-p-style">
@@ -2100,9 +2223,12 @@
2100
2223
  <xsl:call-template name="title"/>
2101
2224
 
2102
2225
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
2226
+ <xsl:param name="margin"/>
2103
2227
 
2104
2228
  <!-- process in the template 'paragraph' -->
2105
- <xsl:call-template name="paragraph"/>
2229
+ <xsl:call-template name="paragraph">
2230
+ <xsl:with-param name="margin" select="$margin"/>
2231
+ </xsl:call-template>
2106
2232
 
2107
2233
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2108
2234
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -2139,7 +2265,7 @@
2139
2265
  </xsl:call-template>
2140
2266
  </xsl:if>
2141
2267
  </xsl:variable>
2142
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2268
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
2143
2269
 
2144
2270
 
2145
2271
  <xsl:variable name="margin-side">
@@ -2403,7 +2529,7 @@
2403
2529
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2404
2530
  <!-- 2009 thinspace -->
2405
2531
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2406
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
2532
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2407
2533
  </xsl:call-template>
2408
2534
  </xsl:variable>
2409
2535
  <xsl:variable name="max_length">
@@ -2444,8 +2570,7 @@
2444
2570
  </xsl:call-template>
2445
2571
  </xsl:if>
2446
2572
  </xsl:template><xsl:template match="text()" mode="td_text">
2447
- <xsl:variable name="zero-space">​</xsl:variable>
2448
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2573
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2449
2574
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2450
2575
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2451
2576
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -2790,37 +2915,7 @@
2790
2915
 
2791
2916
  <!-- list of footnotes to calculate actual footnotes number -->
2792
2917
  <xsl:variable name="p_fn_">
2793
- <xsl:choose>
2794
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2795
- <fn gen_id="{generate-id(.)}">
2796
- <xsl:copy-of select="@*"/>
2797
- <xsl:copy-of select="node()"/>
2798
- </fn>
2799
- </xsl:when>
2800
- <xsl:otherwise>
2801
- <!-- itetation for:
2802
- footnotes in bibdata/title
2803
- footnotes in bibliography
2804
- footnotes in document's body (except table's head/body/foot and figure text)
2805
- -->
2806
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2807
- <fn gen_id="{generate-id(.)}">
2808
- <xsl:copy-of select="@*"/>
2809
- <xsl:copy-of select="node()"/>
2810
- </fn>
2811
- </xsl:for-each>
2812
- <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']/*">
2813
- <xsl:sort select="@displayorder" data-type="number"/>
2814
- <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])]">
2815
- <!-- copy unique fn -->
2816
- <fn gen_id="{generate-id(.)}">
2817
- <xsl:copy-of select="@*"/>
2818
- <xsl:copy-of select="node()"/>
2819
- </fn>
2820
- </xsl:for-each>
2821
- </xsl:for-each>
2822
- </xsl:otherwise>
2823
- </xsl:choose>
2918
+ <xsl:call-template name="get_fn_list"/>
2824
2919
  </xsl:variable>
2825
2920
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2826
2921
 
@@ -2881,6 +2976,38 @@
2881
2976
  <xsl:copy-of select="$footnote_inline"/>
2882
2977
  </xsl:otherwise>
2883
2978
  </xsl:choose>
2979
+ </xsl:template><xsl:template name="get_fn_list">
2980
+ <xsl:choose>
2981
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2982
+ <fn gen_id="{generate-id(.)}">
2983
+ <xsl:copy-of select="@*"/>
2984
+ <xsl:copy-of select="node()"/>
2985
+ </fn>
2986
+ </xsl:when>
2987
+ <xsl:otherwise>
2988
+ <!-- itetation for:
2989
+ footnotes in bibdata/title
2990
+ footnotes in bibliography
2991
+ footnotes in document's body (except table's head/body/foot and figure text)
2992
+ -->
2993
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2994
+ <fn gen_id="{generate-id(.)}">
2995
+ <xsl:copy-of select="@*"/>
2996
+ <xsl:copy-of select="node()"/>
2997
+ </fn>
2998
+ </xsl:for-each>
2999
+ <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']/*">
3000
+ <xsl:sort select="@displayorder" data-type="number"/>
3001
+ <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])]">
3002
+ <!-- copy unique fn -->
3003
+ <fn gen_id="{generate-id(.)}">
3004
+ <xsl:copy-of select="@*"/>
3005
+ <xsl:copy-of select="node()"/>
3006
+ </fn>
3007
+ </xsl:for-each>
3008
+ </xsl:for-each>
3009
+ </xsl:otherwise>
3010
+ </xsl:choose>
2884
3011
  </xsl:template><xsl:template name="table_fn_display">
2885
3012
  <xsl:variable name="references">
2886
3013
 
@@ -3063,7 +3190,7 @@
3063
3190
  </fo:inline>
3064
3191
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3065
3192
  <fo:inline><xsl:value-of select="."/></fo:inline>
3066
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3193
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
3067
3194
  <fo:inline>
3068
3195
  <xsl:apply-templates/>
3069
3196
  </fo:inline>
@@ -3426,24 +3553,48 @@
3426
3553
  <fo:inline text-decoration="underline">
3427
3554
  <xsl:apply-templates/>
3428
3555
  </fo:inline>
3429
- </xsl:template><xsl:template match="*[local-name()='add']">
3556
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
3430
3557
  <xsl:param name="skip">true</xsl:param>
3558
+ <xsl:param name="block">false</xsl:param>
3559
+ <xsl:param name="type"/>
3560
+ <xsl:param name="text-align"/>
3431
3561
  <xsl:choose>
3432
3562
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3433
3563
  <xsl:choose>
3434
- <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>
3564
+ <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>
3435
3565
  <xsl:otherwise>
3436
- <fo:inline>
3566
+ <xsl:variable name="tag">
3437
3567
  <xsl:call-template name="insertTag">
3438
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3568
+ <xsl:with-param name="type">
3569
+ <xsl:choose>
3570
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
3571
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
3572
+ </xsl:choose>
3573
+ </xsl:with-param>
3439
3574
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3440
3575
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3441
3576
  </xsl:call-template>
3442
- </fo:inline>
3443
- </xsl:otherwise>
3444
- </xsl:choose>
3445
- </xsl:when>
3446
- <xsl:when test="@amendment">
3577
+ </xsl:variable>
3578
+ <xsl:choose>
3579
+ <xsl:when test="$block = 'false'">
3580
+ <fo:inline>
3581
+ <xsl:copy-of select="$tag"/>
3582
+ </fo:inline>
3583
+ </xsl:when>
3584
+ <xsl:otherwise>
3585
+ <fo:block> <!-- for around figures -->
3586
+ <xsl:if test="$text-align != ''">
3587
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
3588
+ </xsl:if>
3589
+ <xsl:copy-of select="$tag"/>
3590
+ </fo:block>
3591
+ </xsl:otherwise>
3592
+ </xsl:choose>
3593
+
3594
+ </xsl:otherwise>
3595
+ </xsl:choose>
3596
+ </xsl:when>
3597
+ <xsl:when test="@amendment">
3447
3598
  <fo:inline>
3448
3599
  <xsl:call-template name="insertTag">
3449
3600
  <xsl:with-param name="kind">A</xsl:with-param>
@@ -3798,17 +3949,21 @@
3798
3949
  </xsl:apply-templates>
3799
3950
  </xsl:template><xsl:template name="getLang">
3800
3951
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3801
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3802
3952
  <xsl:variable name="language">
3803
3953
  <xsl:choose>
3804
3954
  <xsl:when test="$language_current != ''">
3805
3955
  <xsl:value-of select="$language_current"/>
3806
3956
  </xsl:when>
3807
- <xsl:when test="$language_current_2 != ''">
3808
- <xsl:value-of select="$language_current_2"/>
3809
- </xsl:when>
3810
3957
  <xsl:otherwise>
3811
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3958
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3959
+ <xsl:choose>
3960
+ <xsl:when test="$language_current_2 != ''">
3961
+ <xsl:value-of select="$language_current_2"/>
3962
+ </xsl:when>
3963
+ <xsl:otherwise>
3964
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3965
+ </xsl:otherwise>
3966
+ </xsl:choose>
3812
3967
  </xsl:otherwise>
3813
3968
  </xsl:choose>
3814
3969
  </xsl:variable>
@@ -4011,6 +4166,9 @@
4011
4166
  </fo:inline>
4012
4167
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4013
4168
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4169
+ <xsl:if test="parent::*[local-name() = 'add']">
4170
+ <xsl:call-template name="append_add-style"/>
4171
+ </xsl:if>
4014
4172
  <xsl:apply-templates/>
4015
4173
  </fo:basic-link>
4016
4174
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -4025,8 +4183,8 @@
4025
4183
 
4026
4184
  </xsl:if>
4027
4185
  <fo:block-container margin-left="0mm">
4028
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
4029
- <xsl:apply-templates/>
4186
+ <fo:block id="{@id}">
4187
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
4030
4188
  </fo:block>
4031
4189
  </fo:block-container>
4032
4190
  </fo:block-container>
@@ -4038,10 +4196,43 @@
4038
4196
  <fo:inline>
4039
4197
  <xsl:apply-templates/>
4040
4198
  </fo:inline>
4041
- </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 -->
4199
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
4042
4200
  <xsl:if test="normalize-space() != ''">
4043
4201
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
4044
4202
  </xsl:if>
4203
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
4204
+ <fo:block xsl:use-attribute-sets="formula-style">
4205
+
4206
+
4207
+
4208
+ <fo:table table-layout="fixed" width="100%">
4209
+ <fo:table-column column-width="95%"/>
4210
+ <fo:table-column column-width="5%"/>
4211
+ <fo:table-body>
4212
+ <fo:table-row>
4213
+ <fo:table-cell display-align="center">
4214
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4215
+
4216
+
4217
+
4218
+ <xsl:apply-templates/>
4219
+ </fo:block>
4220
+ </fo:table-cell>
4221
+ <fo:table-cell display-align="center">
4222
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
4223
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
4224
+ </fo:block>
4225
+ </fo:table-cell>
4226
+ </fo:table-row>
4227
+ </fo:table-body>
4228
+ </fo:table>
4229
+ </fo:block>
4230
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
4231
+ <fo:block xsl:use-attribute-sets="formula-style">
4232
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4233
+ <xsl:apply-templates/>
4234
+ </fo:block>
4235
+ </fo:block>
4045
4236
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4046
4237
 
4047
4238
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -4079,6 +4270,13 @@
4079
4270
 
4080
4271
 
4081
4272
 
4273
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4274
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4275
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4276
+ <xsl:call-template name="append_add-style"/>
4277
+ </xsl:if>
4278
+
4279
+
4082
4280
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
4083
4281
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
4084
4282
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -4117,6 +4315,12 @@
4117
4315
 
4118
4316
 
4119
4317
 
4318
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4319
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4320
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4321
+ <xsl:call-template name="append_add-style"/>
4322
+ </xsl:if>
4323
+
4120
4324
  <xsl:apply-templates select="*[local-name() = 'name']"/>
4121
4325
 
4122
4326
  </fo:inline>
@@ -4168,6 +4372,7 @@
4168
4372
  </fo:block>
4169
4373
  </xsl:template><xsl:template match="*[local-name() = 'term']">
4170
4374
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
4375
+
4171
4376
 
4172
4377
 
4173
4378
 
@@ -4604,7 +4809,11 @@
4604
4809
  <xsl:value-of select="."/>
4605
4810
  </xsl:template><xsl:template match="node()" mode="contents">
4606
4811
  <xsl:apply-templates mode="contents"/>
4607
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
4812
+ </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">
4813
+ <xsl:call-template name="contents_section-title"/>
4814
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
4815
+ <xsl:call-template name="contents_section-title"/>
4816
+ </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">
4608
4817
  <xsl:variable name="level">
4609
4818
  <xsl:call-template name="getLevel">
4610
4819
  <xsl:with-param name="depth" select="@depth"/>
@@ -4673,13 +4882,14 @@
4673
4882
  <xsl:apply-templates mode="bookmarks"/>
4674
4883
  </xsl:template><xsl:template name="addBookmarks">
4675
4884
  <xsl:param name="contents"/>
4676
- <xsl:if test="xalan:nodeset($contents)//item">
4885
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4886
+ <xsl:if test="$contents_nodes//item">
4677
4887
  <fo:bookmark-tree>
4678
4888
  <xsl:choose>
4679
- <xsl:when test="xalan:nodeset($contents)/doc">
4889
+ <xsl:when test="$contents_nodes/doc">
4680
4890
  <xsl:choose>
4681
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4682
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4891
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
4892
+ <xsl:for-each select="$contents_nodes/doc">
4683
4893
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4684
4894
  <xsl:if test="@bundle = 'true'">
4685
4895
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -4730,7 +4940,7 @@
4730
4940
  </xsl:for-each>
4731
4941
  </xsl:when>
4732
4942
  <xsl:otherwise>
4733
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4943
+ <xsl:for-each select="$contents_nodes/doc">
4734
4944
 
4735
4945
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4736
4946
 
@@ -4748,11 +4958,21 @@
4748
4958
  </xsl:choose>
4749
4959
  </xsl:when>
4750
4960
  <xsl:otherwise>
4751
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
4961
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
4962
+
4963
+ <xsl:call-template name="insertFigureBookmarks">
4964
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4965
+ </xsl:call-template>
4966
+
4967
+ <xsl:call-template name="insertTableBookmarks">
4968
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4969
+ <xsl:with-param name="lang" select="@lang"/>
4970
+ </xsl:call-template>
4971
+
4752
4972
  </xsl:otherwise>
4753
4973
  </xsl:choose>
4754
4974
 
4755
-
4975
+
4756
4976
 
4757
4977
 
4758
4978
 
@@ -4765,7 +4985,6 @@
4765
4985
  </xsl:variable>
4766
4986
  <xsl:variable name="list_of_tables_figures" select="xalan:nodeset($list_of_tables_figures_)"/>
4767
4987
 
4768
-
4769
4988
  <xsl:if test="$list_of_tables_figures/table_figure">
4770
4989
  <fo:bookmark internal-destination="empty_bookmark">
4771
4990
  <fo:bookmark-title>—————</fo:bookmark-title>
@@ -4773,7 +4992,7 @@
4773
4992
  </xsl:if>
4774
4993
 
4775
4994
  <xsl:if test="$list_of_tables_figures//table_figure">
4776
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide"> <!-- {$list_of_figures//figure[1]/@id} -->
4995
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
4777
4996
  <fo:bookmark-title>
4778
4997
  <xsl:call-template name="getTitle">
4779
4998
  <xsl:with-param name="name" select="'title-table-figures'"/>
@@ -4786,17 +5005,18 @@
4786
5005
  </xsl:for-each>
4787
5006
  </fo:bookmark>
4788
5007
  </xsl:if>
4789
-
4790
-
5008
+ <!-- $namespace = 'ogc-white-paper' -->
5009
+
4791
5010
 
4792
5011
  </fo:bookmark-tree>
4793
5012
  </xsl:if>
4794
5013
  </xsl:template><xsl:template name="insertFigureBookmarks">
4795
5014
  <xsl:param name="contents"/>
4796
- <xsl:if test="xalan:nodeset($contents)/figure">
4797
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
5015
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5016
+ <xsl:if test="$contents_nodes/figure">
5017
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
4798
5018
  <fo:bookmark-title>Figures</fo:bookmark-title>
4799
- <xsl:for-each select="xalan:nodeset($contents)/figure">
5019
+ <xsl:for-each select="$contents_nodes/figure">
4800
5020
  <fo:bookmark internal-destination="{@id}">
4801
5021
  <fo:bookmark-title>
4802
5022
  <xsl:value-of select="normalize-space(title)"/>
@@ -4805,18 +5025,21 @@
4805
5025
  </xsl:for-each>
4806
5026
  </fo:bookmark>
4807
5027
  </xsl:if>
5028
+
5029
+ <!-- see template addBookmarks -->
4808
5030
  </xsl:template><xsl:template name="insertTableBookmarks">
4809
5031
  <xsl:param name="contents"/>
4810
5032
  <xsl:param name="lang"/>
4811
- <xsl:if test="xalan:nodeset($contents)/table">
4812
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
5033
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
5034
+ <xsl:if test="$contents_nodes/table">
5035
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
4813
5036
  <fo:bookmark-title>
4814
5037
  <xsl:choose>
4815
5038
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4816
5039
  <xsl:otherwise>Tables</xsl:otherwise>
4817
5040
  </xsl:choose>
4818
5041
  </fo:bookmark-title>
4819
- <xsl:for-each select="xalan:nodeset($contents)/table">
5042
+ <xsl:for-each select="$contents_nodes/table">
4820
5043
  <fo:bookmark internal-destination="{@id}">
4821
5044
  <fo:bookmark-title>
4822
5045
  <xsl:value-of select="normalize-space(title)"/>
@@ -4825,6 +5048,8 @@
4825
5048
  </xsl:for-each>
4826
5049
  </fo:bookmark>
4827
5050
  </xsl:if>
5051
+
5052
+ <!-- see template addBookmarks -->
4828
5053
  </xsl:template><xsl:template name="getLangVersion">
4829
5054
  <xsl:param name="lang"/>
4830
5055
  <xsl:param name="doctype" select="''"/>
@@ -5023,12 +5248,140 @@
5023
5248
  </fo:block-container>
5024
5249
  </fo:block-container>
5025
5250
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5026
- <xsl:variable name="text">
5251
+ <xsl:choose>
5252
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
5253
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
5254
+ <xsl:choose>
5255
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
5256
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
5257
+ </xsl:when>
5258
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
5259
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5260
+ </xsl:otherwise>
5261
+ </xsl:choose>
5262
+ </xsl:when>
5263
+ <xsl:otherwise>
5264
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5265
+ </xsl:otherwise>
5266
+ </xsl:choose>
5267
+
5268
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
5269
+ <xsl:variable name="text_step1">
5027
5270
  <xsl:call-template name="add-zero-spaces-equal"/>
5028
5271
  </xsl:variable>
5029
- <xsl:call-template name="add-zero-spaces-java">
5030
- <xsl:with-param name="text" select="$text"/>
5031
- </xsl:call-template>
5272
+ <xsl:variable name="text_step2">
5273
+ <xsl:call-template name="add-zero-spaces-java">
5274
+ <xsl:with-param name="text" select="$text_step1"/>
5275
+ </xsl:call-template>
5276
+ </xsl:variable>
5277
+ <xsl:value-of select="$text_step2"/>
5278
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
5279
+ <xsl:apply-templates mode="syntax_highlight"/>
5280
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
5281
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
5282
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
5283
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
5284
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
5285
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
5286
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
5287
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
5288
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
5289
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
5290
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
5291
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
5292
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
5293
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
5294
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
5295
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
5296
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
5297
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
5298
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
5299
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
5300
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
5301
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
5302
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
5303
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
5304
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
5305
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
5306
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
5307
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
5308
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
5309
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
5310
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
5311
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
5312
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
5313
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
5314
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
5315
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
5316
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
5317
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
5318
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
5319
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
5320
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
5321
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
5322
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
5323
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
5324
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
5325
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
5326
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
5327
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
5328
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
5329
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
5330
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
5331
+ <fo:inline>
5332
+ <xsl:variable name="classes_">
5333
+ <xsl:call-template name="split">
5334
+ <xsl:with-param name="pText" select="@class"/>
5335
+ <xsl:with-param name="sep" select="' '"/>
5336
+ </xsl:call-template>
5337
+ <!-- a few classes together (_and_ suffix) -->
5338
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
5339
+ <item>hljs-char_and_escape_</item>
5340
+ </xsl:if>
5341
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
5342
+ <item>hljs-title_and_class_</item>
5343
+ </xsl:if>
5344
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
5345
+ <item>hljs-title_and_class__and_inherited__</item>
5346
+ </xsl:if>
5347
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
5348
+ <item>hljs-title_and_function_</item>
5349
+ </xsl:if>
5350
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
5351
+ <item>hljs-variable_and_language_</item>
5352
+ </xsl:if>
5353
+ <!-- with parent classes (_ suffix) -->
5354
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
5355
+ <item>hljs-meta_hljs-keyword</item>
5356
+ </xsl:if>
5357
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
5358
+ <item>hljs-meta_hljs-string</item>
5359
+ </xsl:if>
5360
+ </xsl:variable>
5361
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
5362
+
5363
+ <xsl:for-each select="$classes/item">
5364
+ <xsl:variable name="class_name" select="."/>
5365
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5366
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5367
+ </xsl:for-each>
5368
+ </xsl:for-each>
5369
+
5370
+ <!-- <xsl:variable name="class_name">
5371
+ <xsl:choose>
5372
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
5373
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
5374
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
5375
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
5376
+ </xsl:choose>
5377
+ </xsl:variable>
5378
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5379
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5380
+ </xsl:for-each> -->
5381
+
5382
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
5383
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
5384
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5032
5385
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
5033
5386
  <xsl:if test="normalize-space() != ''">
5034
5387
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -5363,6 +5716,8 @@
5363
5716
  </xsl:otherwise>
5364
5717
  </xsl:choose> -->
5365
5718
  </fo:block>
5719
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5720
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5366
5721
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5367
5722
  <xsl:if test="normalize-space() != ''">
5368
5723
  <xsl:value-of select="."/>
@@ -5409,11 +5764,14 @@
5409
5764
 
5410
5765
 
5411
5766
  <fo:block-container margin-left="0mm">
5412
-
5413
- <fo:block xsl:use-attribute-sets="quote-style">
5767
+ <fo:block-container xsl:use-attribute-sets="quote-style">
5414
5768
 
5415
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5416
- </fo:block>
5769
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5770
+ <fo:block role="BlockQuote">
5771
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5772
+ </fo:block>
5773
+ </fo:block-container>
5774
+ </fo:block-container>
5417
5775
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5418
5776
  <fo:block xsl:use-attribute-sets="quote-source-style">
5419
5777
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -5434,26 +5792,11 @@
5434
5792
  </xsl:template><xsl:template match="*[local-name() = 'author']">
5435
5793
  <xsl:text>— </xsl:text>
5436
5794
  <xsl:apply-templates/>
5437
- </xsl:template><xsl:variable name="bibitem_hidden_">
5438
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
5439
- <xsl:copy-of select="."/>
5440
- </xsl:for-each>
5441
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
5442
- <xsl:copy-of select="."/>
5443
- </xsl:for-each>
5444
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
5445
-
5446
- <xsl:variable name="bibitemid">
5447
- <xsl:choose>
5448
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
5449
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
5450
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5451
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5452
- </xsl:choose>
5453
- </xsl:variable>
5454
-
5795
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
5796
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5797
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
5455
5798
  <xsl:choose>
5456
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
5799
+ <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) -->
5457
5800
  <fo:inline xsl:use-attribute-sets="eref-style">
5458
5801
  <xsl:if test="@type = 'footnote'">
5459
5802
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -5467,8 +5810,8 @@
5467
5810
  <xsl:variable name="text" select="normalize-space()"/>
5468
5811
 
5469
5812
 
5470
-
5471
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5813
+
5814
+ <fo:basic-link fox:alt-text="{@citeas}">
5472
5815
  <xsl:if test="normalize-space(@citeas) = ''">
5473
5816
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5474
5817
  </xsl:if>
@@ -5481,14 +5824,21 @@
5481
5824
 
5482
5825
  </xsl:if>
5483
5826
 
5484
-
5827
+ <xsl:choose>
5828
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
5829
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
5830
+ </xsl:when>
5831
+ <xsl:otherwise>
5832
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5833
+ </xsl:otherwise>
5834
+ </xsl:choose>
5485
5835
 
5486
5836
  <xsl:apply-templates/>
5487
5837
  </fo:basic-link>
5488
-
5838
+
5489
5839
  </fo:inline>
5490
5840
  </xsl:when>
5491
- <xsl:otherwise>
5841
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5492
5842
  <fo:inline><xsl:apply-templates/></fo:inline>
5493
5843
  </xsl:otherwise>
5494
5844
  </xsl:choose>
@@ -5565,6 +5915,36 @@
5565
5915
  <xsl:with-param name="count" select="$count - 1"/>
5566
5916
  </xsl:call-template>
5567
5917
  </xsl:if>
5918
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
5919
+ <xsl:variable name="level">
5920
+ <xsl:call-template name="getLevel"/>
5921
+ </xsl:variable>
5922
+ <xsl:variable name="font-size">
5923
+
5924
+ <xsl:choose>
5925
+ <xsl:when test="$level &gt;= 2">11pt</xsl:when>
5926
+ <xsl:otherwise>12pt</xsl:otherwise>
5927
+ </xsl:choose>
5928
+
5929
+ </xsl:variable>
5930
+ <xsl:variable name="levelTerm">
5931
+ <xsl:call-template name="getLevelTermName"/>
5932
+ </xsl:variable>
5933
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
5934
+
5935
+
5936
+
5937
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
5938
+ <fo:block xsl:use-attribute-sets="term-name-style">
5939
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
5940
+ </fo:block>
5941
+ </xsl:if>
5942
+
5943
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
5944
+ <xsl:call-template name="setStyle_preferred"/>
5945
+ <xsl:apply-templates/>
5946
+ </fo:block>
5947
+ </fo:block>
5568
5948
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
5569
5949
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
5570
5950
  <xsl:text> </xsl:text>
@@ -5653,24 +6033,8 @@
5653
6033
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5654
6034
  </xsl:template><xsl:variable name="ul_labels_">
5655
6035
 
5656
-
5657
-
5658
-
5659
-
5660
-
5661
-
5662
-
5663
-
5664
-
5665
-
5666
-
5667
-
5668
-
5669
- <label>—</label> <!-- em dash -->
5670
-
5671
-
5672
-
5673
-
6036
+ <label>—</label> <!-- em dash -->
6037
+
5674
6038
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5675
6039
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5676
6040
  <xsl:variable name="list_level">
@@ -5696,6 +6060,91 @@
5696
6060
  </xsl:template><xsl:template match="label" mode="ul_labels">
5697
6061
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5698
6062
  <xsl:value-of select="."/>
6063
+ </xsl:template><xsl:template name="getListItemFormat">
6064
+ <!-- Example: for BSI <?list-type loweralpha?> -->
6065
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
6066
+ <xsl:choose>
6067
+ <xsl:when test="local-name(..) = 'ul'">
6068
+ <xsl:choose>
6069
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
6070
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
6071
+ </xsl:choose>
6072
+ </xsl:when>
6073
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
6074
+
6075
+ <!-- Example: for BSI <?list-start 2?> -->
6076
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
6077
+
6078
+ <xsl:variable name="start_value">
6079
+ <xsl:choose>
6080
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
6081
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6082
+ </xsl:when>
6083
+ <xsl:when test="normalize-space(../@start) != ''">
6084
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6085
+ </xsl:when>
6086
+ <xsl:otherwise>0</xsl:otherwise>
6087
+ </xsl:choose>
6088
+ </xsl:variable>
6089
+
6090
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
6091
+
6092
+ <xsl:variable name="type">
6093
+ <xsl:choose>
6094
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
6095
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
6096
+
6097
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
6098
+
6099
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6100
+ <xsl:variable name="list_level">
6101
+ <xsl:choose>
6102
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
6103
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
6104
+ </xsl:choose>
6105
+ </xsl:variable>
6106
+
6107
+ <xsl:choose>
6108
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
6109
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
6110
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
6111
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
6112
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
6113
+ <xsl:otherwise> <!-- level 1 -->
6114
+ <xsl:choose>
6115
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
6116
+ <xsl:otherwise>alphabet</xsl:otherwise>
6117
+ </xsl:choose>
6118
+ </xsl:otherwise>
6119
+ </xsl:choose>
6120
+
6121
+ </xsl:otherwise>
6122
+ </xsl:choose>
6123
+ </xsl:variable>
6124
+
6125
+ <xsl:variable name="format">
6126
+ <xsl:choose>
6127
+ <xsl:when test="$type = 'arabic'">
6128
+ 1)
6129
+ </xsl:when>
6130
+ <xsl:when test="$type = 'alphabet'">
6131
+ a)
6132
+ </xsl:when>
6133
+ <xsl:when test="$type = 'alphabet_upper'">
6134
+ A)
6135
+ </xsl:when>
6136
+ <xsl:when test="$type = 'roman'">
6137
+ i)
6138
+ </xsl:when>
6139
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
6140
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
6141
+ </xsl:choose>
6142
+ </xsl:variable>
6143
+
6144
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
6145
+
6146
+ </xsl:otherwise>
6147
+ </xsl:choose>
5699
6148
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5700
6149
  <xsl:choose>
5701
6150
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5711,18 +6160,71 @@
5711
6160
 
5712
6161
  <fo:block-container margin-left="0mm">
5713
6162
  <fo:block>
5714
- <xsl:apply-templates select="." mode="ul_ol"/>
6163
+ <xsl:apply-templates select="." mode="list"/>
5715
6164
  </fo:block>
5716
6165
  </fo:block-container>
5717
6166
  </fo:block-container>
5718
6167
  </xsl:when>
5719
6168
  <xsl:otherwise>
5720
6169
  <fo:block>
5721
- <xsl:apply-templates select="." mode="ul_ol"/>
6170
+ <xsl:apply-templates select="." mode="list"/>
5722
6171
  </fo:block>
5723
6172
  </xsl:otherwise>
5724
6173
  </xsl:choose>
5725
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6174
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
6175
+ <fo:list-block xsl:use-attribute-sets="list-style">
6176
+
6177
+
6178
+
6179
+
6180
+
6181
+
6182
+
6183
+
6184
+
6185
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6186
+ </fo:list-block>
6187
+ <!-- <xsl:for-each select="./iho:note">
6188
+ <xsl:call-template name="note"/>
6189
+ </xsl:for-each> -->
6190
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
6191
+ </xsl:template><xsl:template match="*[local-name()='li']">
6192
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
6193
+ <xsl:copy-of select="@id"/>
6194
+
6195
+
6196
+
6197
+ <fo:list-item-label end-indent="label-end()">
6198
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
6199
+
6200
+
6201
+
6202
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6203
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
6204
+ <xsl:call-template name="append_add-style"/>
6205
+ </xsl:if>
6206
+
6207
+ <xsl:call-template name="getListItemFormat"/>
6208
+ </fo:block>
6209
+ </fo:list-item-label>
6210
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
6211
+ <fo:block>
6212
+
6213
+
6214
+
6215
+
6216
+
6217
+ <xsl:apply-templates/>
6218
+
6219
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
6220
+
6221
+ <xsl:for-each select="./bsi:note">
6222
+ <xsl:call-template name="note"/>
6223
+ </xsl:for-each> -->
6224
+ </fo:block>
6225
+ </fo:list-item-body>
6226
+ </fo:list-item>
6227
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
5726
6228
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5727
6229
  <bookmark><xsl:value-of select="@id"/></bookmark>
5728
6230
  </xsl:for-each>
@@ -5744,7 +6246,7 @@
5744
6246
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5745
6247
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5746
6248
  <xsl:if test="@to">
5747
- <xsl:value-of select="$dash"/>
6249
+ <xsl:value-of select="$en_dash"/>
5748
6250
  <xsl:copy>
5749
6251
  <xsl:copy-of select="@*"/>
5750
6252
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -5769,7 +6271,7 @@
5769
6271
  <xsl:param name="target"/>
5770
6272
  <!-- <node></node> -->
5771
6273
  <xsl:choose>
5772
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6274
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
5773
6275
  <!-- skip text (i.e. remove it) and process next element -->
5774
6276
  <!-- [removed_<xsl:value-of select="."/>] -->
5775
6277
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -5853,12 +6355,22 @@
5853
6355
  </xsl:variable>
5854
6356
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5855
6357
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6358
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
6359
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
6360
+ <!-- Index -->
6361
+ <xsl:apply-templates/>
6362
+ </fo:block>
6363
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
6364
+ <!-- Letter A, B, C, ... -->
6365
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
6366
+ <xsl:apply-templates/>
6367
+ </fo:block>
5856
6368
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5857
6369
  <xsl:apply-templates/>
5858
6370
  <fo:block>
5859
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
5860
- <fo:block> </fo:block>
5861
- </xsl:if>
6371
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6372
+ <fo:block> </fo:block>
6373
+ </xsl:if>
5862
6374
  </fo:block>
5863
6375
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5864
6376
  <xsl:apply-templates/>
@@ -5868,6 +6380,9 @@
5868
6380
 
5869
6381
  <xsl:apply-templates/>
5870
6382
  </fo:block>
6383
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
6384
+ <!-- to split by '_' and other chars -->
6385
+ <xsl:call-template name="add-zero-spaces-java"/>
5871
6386
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5872
6387
  <fo:inline id="{@id}" font-size="1pt"/>
5873
6388
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -6174,6 +6689,24 @@
6174
6689
  <xsl:apply-templates/>
6175
6690
  </fo:inline>
6176
6691
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
6692
+
6693
+ <!-- list of footnotes to calculate actual footnotes number -->
6694
+ <xsl:variable name="p_fn_">
6695
+ <xsl:call-template name="get_fn_list"/>
6696
+ </xsl:variable>
6697
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6698
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
6699
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6700
+ <!-- fn sequence number in document -->
6701
+ <xsl:variable name="current_fn_number">
6702
+ <xsl:choose>
6703
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6704
+ <xsl:otherwise>
6705
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
6706
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
6707
+ </xsl:otherwise>
6708
+ </xsl:choose>
6709
+ </xsl:variable>
6177
6710
  <fo:footnote>
6178
6711
  <xsl:variable name="number">
6179
6712
 
@@ -6182,22 +6715,26 @@
6182
6715
  <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6183
6716
  </xsl:when>
6184
6717
  <xsl:otherwise>
6185
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6718
+ <xsl:value-of select="$current_fn_number"/>
6186
6719
  </xsl:otherwise>
6187
6720
  </xsl:choose>
6188
6721
 
6189
6722
  </xsl:variable>
6723
+
6724
+ <xsl:variable name="current_fn_number_text">
6725
+ <xsl:value-of select="$number"/>
6726
+
6727
+ </xsl:variable>
6728
+
6190
6729
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
6191
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
6192
- <xsl:value-of select="$number"/>
6193
-
6730
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
6731
+ <xsl:value-of select="$current_fn_number_text"/>
6194
6732
  </fo:basic-link>
6195
6733
  </fo:inline>
6196
6734
  <fo:footnote-body>
6197
6735
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
6198
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6199
- <xsl:value-of select="$number"/>
6200
-
6736
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6737
+ <xsl:value-of select="$current_fn_number_text"/>
6201
6738
  </fo:inline>
6202
6739
  <xsl:apply-templates/>
6203
6740
  </fo:block>
@@ -6323,7 +6860,7 @@
6323
6860
  </fo:table-body>
6324
6861
  </fo:table>
6325
6862
  </fo:block>
6326
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6863
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
6327
6864
  <fo:table-row min-height="5mm">
6328
6865
  <xsl:apply-templates/>
6329
6866
  </fo:table-row>
@@ -6443,6 +6980,78 @@
6443
6980
  <xsl:apply-templates/>
6444
6981
  </fo:block>
6445
6982
 
6983
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
6984
+ <xsl:copy>
6985
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
6986
+ </xsl:copy>
6987
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
6988
+ <xsl:copy>
6989
+ <xsl:copy-of select="@*"/>
6990
+
6991
+ <xsl:variable name="nodes_preface_">
6992
+ <xsl:for-each select="*">
6993
+ <node id="{@id}"/>
6994
+ </xsl:for-each>
6995
+ </xsl:variable>
6996
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
6997
+
6998
+ <xsl:for-each select="*">
6999
+ <xsl:sort select="@displayorder" data-type="number"/>
7000
+
7001
+ <!-- process Section's title -->
7002
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7003
+ <xsl:if test="$preceding-sibling_id != ''">
7004
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7005
+ </xsl:if>
7006
+
7007
+ <xsl:choose>
7008
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7009
+ <xsl:otherwise>
7010
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7011
+ </xsl:otherwise>
7012
+ </xsl:choose>
7013
+
7014
+ </xsl:for-each>
7015
+ </xsl:copy>
7016
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
7017
+ <xsl:copy>
7018
+ <xsl:copy-of select="@*"/>
7019
+
7020
+ <xsl:variable name="nodes_sections_">
7021
+ <xsl:for-each select="*">
7022
+ <node id="{@id}"/>
7023
+ </xsl:for-each>
7024
+ </xsl:variable>
7025
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
7026
+
7027
+ <!-- move section 'Normative references' inside 'sections' -->
7028
+ <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']]">
7029
+ <xsl:sort select="@displayorder" data-type="number"/>
7030
+
7031
+ <!-- process Section's title -->
7032
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
7033
+ <xsl:if test="$preceding-sibling_id != ''">
7034
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
7035
+ </xsl:if>
7036
+
7037
+ <xsl:choose>
7038
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
7039
+ <xsl:otherwise>
7040
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7041
+ </xsl:otherwise>
7042
+ </xsl:choose>
7043
+
7044
+ </xsl:for-each>
7045
+ </xsl:copy>
7046
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
7047
+ <xsl:copy>
7048
+ <xsl:copy-of select="@*"/>
7049
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
7050
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
7051
+ <xsl:sort select="@displayorder" data-type="number"/>
7052
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7053
+ </xsl:for-each>
7054
+ </xsl:copy>
6446
7055
  </xsl:template><xsl:template name="convertDate">
6447
7056
  <xsl:param name="date"/>
6448
7057
  <xsl:param name="format" select="'short'"/>
@@ -6556,9 +7165,6 @@
6556
7165
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
6557
7166
  </xsl:choose>
6558
7167
  </xsl:template><xsl:template name="addPDFUAmeta">
6559
- <xsl:variable name="lang">
6560
- <xsl:call-template name="getLang"/>
6561
- </xsl:variable>
6562
7168
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6563
7169
  <pdf:dictionary type="normal" key="ViewerPreferences">
6564
7170
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -6786,10 +7392,12 @@
6786
7392
  <xsl:param name="key"/>
6787
7393
  <xsl:param name="formatted">false</xsl:param>
6788
7394
  <xsl:param name="lang"/>
7395
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
6789
7396
 
6790
7397
  <xsl:variable name="curr_lang">
6791
7398
  <xsl:choose>
6792
7399
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7400
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6793
7401
  <xsl:otherwise>
6794
7402
  <xsl:call-template name="getLang"/>
6795
7403
  </xsl:otherwise>
@@ -6824,6 +7432,7 @@
6824
7432
  </xsl:otherwise>
6825
7433
  </xsl:choose>
6826
7434
  </xsl:when>
7435
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6827
7436
  <xsl:otherwise>
6828
7437
  <xsl:variable name="key_">
6829
7438
  <xsl:call-template name="capitalize">
@@ -6893,53 +7502,153 @@
6893
7502
  <xsl:param name="first"/>
6894
7503
  <xsl:if test="$number != ''">
6895
7504
  <xsl:variable name="words">
6896
- <words>
6897
- <word cardinal="1">One-</word>
6898
- <word ordinal="1">First </word>
6899
- <word cardinal="2">Two-</word>
6900
- <word ordinal="2">Second </word>
6901
- <word cardinal="3">Three-</word>
6902
- <word ordinal="3">Third </word>
6903
- <word cardinal="4">Four-</word>
6904
- <word ordinal="4">Fourth </word>
6905
- <word cardinal="5">Five-</word>
6906
- <word ordinal="5">Fifth </word>
6907
- <word cardinal="6">Six-</word>
6908
- <word ordinal="6">Sixth </word>
6909
- <word cardinal="7">Seven-</word>
6910
- <word ordinal="7">Seventh </word>
6911
- <word cardinal="8">Eight-</word>
6912
- <word ordinal="8">Eighth </word>
6913
- <word cardinal="9">Nine-</word>
6914
- <word ordinal="9">Ninth </word>
6915
- <word ordinal="10">Tenth </word>
6916
- <word ordinal="11">Eleventh </word>
6917
- <word ordinal="12">Twelfth </word>
6918
- <word ordinal="13">Thirteenth </word>
6919
- <word ordinal="14">Fourteenth </word>
6920
- <word ordinal="15">Fifteenth </word>
6921
- <word ordinal="16">Sixteenth </word>
6922
- <word ordinal="17">Seventeenth </word>
6923
- <word ordinal="18">Eighteenth </word>
6924
- <word ordinal="19">Nineteenth </word>
6925
- <word cardinal="20">Twenty-</word>
6926
- <word ordinal="20">Twentieth </word>
6927
- <word cardinal="30">Thirty-</word>
6928
- <word ordinal="30">Thirtieth </word>
6929
- <word cardinal="40">Forty-</word>
6930
- <word ordinal="40">Fortieth </word>
6931
- <word cardinal="50">Fifty-</word>
6932
- <word ordinal="50">Fiftieth </word>
6933
- <word cardinal="60">Sixty-</word>
6934
- <word ordinal="60">Sixtieth </word>
6935
- <word cardinal="70">Seventy-</word>
6936
- <word ordinal="70">Seventieth </word>
6937
- <word cardinal="80">Eighty-</word>
6938
- <word ordinal="80">Eightieth </word>
6939
- <word cardinal="90">Ninety-</word>
6940
- <word ordinal="90">Ninetieth </word>
6941
- <word cardinal="100">Hundred-</word>
6942
- <word ordinal="100">Hundredth </word>
7505
+ <words>
7506
+ <xsl:choose>
7507
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
7508
+ <word cardinal="1">Une-</word>
7509
+ <word ordinal="1">Première </word>
7510
+ <word cardinal="2">Deux-</word>
7511
+ <word ordinal="2">Seconde </word>
7512
+ <word cardinal="3">Trois-</word>
7513
+ <word ordinal="3">Tierce </word>
7514
+ <word cardinal="4">Quatre-</word>
7515
+ <word ordinal="4">Quatrième </word>
7516
+ <word cardinal="5">Cinq-</word>
7517
+ <word ordinal="5">Cinquième </word>
7518
+ <word cardinal="6">Six-</word>
7519
+ <word ordinal="6">Sixième </word>
7520
+ <word cardinal="7">Sept-</word>
7521
+ <word ordinal="7">Septième </word>
7522
+ <word cardinal="8">Huit-</word>
7523
+ <word ordinal="8">Huitième </word>
7524
+ <word cardinal="9">Neuf-</word>
7525
+ <word ordinal="9">Neuvième </word>
7526
+ <word ordinal="10">Dixième </word>
7527
+ <word ordinal="11">Onzième </word>
7528
+ <word ordinal="12">Douzième </word>
7529
+ <word ordinal="13">Treizième </word>
7530
+ <word ordinal="14">Quatorzième </word>
7531
+ <word ordinal="15">Quinzième </word>
7532
+ <word ordinal="16">Seizième </word>
7533
+ <word ordinal="17">Dix-septième </word>
7534
+ <word ordinal="18">Dix-huitième </word>
7535
+ <word ordinal="19">Dix-neuvième </word>
7536
+ <word cardinal="20">Vingt-</word>
7537
+ <word ordinal="20">Vingtième </word>
7538
+ <word cardinal="30">Trente-</word>
7539
+ <word ordinal="30">Trentième </word>
7540
+ <word cardinal="40">Quarante-</word>
7541
+ <word ordinal="40">Quarantième </word>
7542
+ <word cardinal="50">Cinquante-</word>
7543
+ <word ordinal="50">Cinquantième </word>
7544
+ <word cardinal="60">Soixante-</word>
7545
+ <word ordinal="60">Soixantième </word>
7546
+ <word cardinal="70">Septante-</word>
7547
+ <word ordinal="70">Septantième </word>
7548
+ <word cardinal="80">Huitante-</word>
7549
+ <word ordinal="80">Huitantième </word>
7550
+ <word cardinal="90">Nonante-</word>
7551
+ <word ordinal="90">Nonantième </word>
7552
+ <word cardinal="100">Cent-</word>
7553
+ <word ordinal="100">Centième </word>
7554
+ </xsl:when>
7555
+ <xsl:when test="$lang = 'ru'">
7556
+ <word cardinal="1">Одна-</word>
7557
+ <word ordinal="1">Первое </word>
7558
+ <word cardinal="2">Две-</word>
7559
+ <word ordinal="2">Второе </word>
7560
+ <word cardinal="3">Три-</word>
7561
+ <word ordinal="3">Третье </word>
7562
+ <word cardinal="4">Четыре-</word>
7563
+ <word ordinal="4">Четвертое </word>
7564
+ <word cardinal="5">Пять-</word>
7565
+ <word ordinal="5">Пятое </word>
7566
+ <word cardinal="6">Шесть-</word>
7567
+ <word ordinal="6">Шестое </word>
7568
+ <word cardinal="7">Семь-</word>
7569
+ <word ordinal="7">Седьмое </word>
7570
+ <word cardinal="8">Восемь-</word>
7571
+ <word ordinal="8">Восьмое </word>
7572
+ <word cardinal="9">Девять-</word>
7573
+ <word ordinal="9">Девятое </word>
7574
+ <word ordinal="10">Десятое </word>
7575
+ <word ordinal="11">Одиннадцатое </word>
7576
+ <word ordinal="12">Двенадцатое </word>
7577
+ <word ordinal="13">Тринадцатое </word>
7578
+ <word ordinal="14">Четырнадцатое </word>
7579
+ <word ordinal="15">Пятнадцатое </word>
7580
+ <word ordinal="16">Шестнадцатое </word>
7581
+ <word ordinal="17">Семнадцатое </word>
7582
+ <word ordinal="18">Восемнадцатое </word>
7583
+ <word ordinal="19">Девятнадцатое </word>
7584
+ <word cardinal="20">Двадцать-</word>
7585
+ <word ordinal="20">Двадцатое </word>
7586
+ <word cardinal="30">Тридцать-</word>
7587
+ <word ordinal="30">Тридцатое </word>
7588
+ <word cardinal="40">Сорок-</word>
7589
+ <word ordinal="40">Сороковое </word>
7590
+ <word cardinal="50">Пятьдесят-</word>
7591
+ <word ordinal="50">Пятидесятое </word>
7592
+ <word cardinal="60">Шестьдесят-</word>
7593
+ <word ordinal="60">Шестидесятое </word>
7594
+ <word cardinal="70">Семьдесят-</word>
7595
+ <word ordinal="70">Семидесятое </word>
7596
+ <word cardinal="80">Восемьдесят-</word>
7597
+ <word ordinal="80">Восьмидесятое </word>
7598
+ <word cardinal="90">Девяносто-</word>
7599
+ <word ordinal="90">Девяностое </word>
7600
+ <word cardinal="100">Сто-</word>
7601
+ <word ordinal="100">Сотое </word>
7602
+ </xsl:when>
7603
+ <xsl:otherwise> <!-- default english -->
7604
+ <word cardinal="1">One-</word>
7605
+ <word ordinal="1">First </word>
7606
+ <word cardinal="2">Two-</word>
7607
+ <word ordinal="2">Second </word>
7608
+ <word cardinal="3">Three-</word>
7609
+ <word ordinal="3">Third </word>
7610
+ <word cardinal="4">Four-</word>
7611
+ <word ordinal="4">Fourth </word>
7612
+ <word cardinal="5">Five-</word>
7613
+ <word ordinal="5">Fifth </word>
7614
+ <word cardinal="6">Six-</word>
7615
+ <word ordinal="6">Sixth </word>
7616
+ <word cardinal="7">Seven-</word>
7617
+ <word ordinal="7">Seventh </word>
7618
+ <word cardinal="8">Eight-</word>
7619
+ <word ordinal="8">Eighth </word>
7620
+ <word cardinal="9">Nine-</word>
7621
+ <word ordinal="9">Ninth </word>
7622
+ <word ordinal="10">Tenth </word>
7623
+ <word ordinal="11">Eleventh </word>
7624
+ <word ordinal="12">Twelfth </word>
7625
+ <word ordinal="13">Thirteenth </word>
7626
+ <word ordinal="14">Fourteenth </word>
7627
+ <word ordinal="15">Fifteenth </word>
7628
+ <word ordinal="16">Sixteenth </word>
7629
+ <word ordinal="17">Seventeenth </word>
7630
+ <word ordinal="18">Eighteenth </word>
7631
+ <word ordinal="19">Nineteenth </word>
7632
+ <word cardinal="20">Twenty-</word>
7633
+ <word ordinal="20">Twentieth </word>
7634
+ <word cardinal="30">Thirty-</word>
7635
+ <word ordinal="30">Thirtieth </word>
7636
+ <word cardinal="40">Forty-</word>
7637
+ <word ordinal="40">Fortieth </word>
7638
+ <word cardinal="50">Fifty-</word>
7639
+ <word ordinal="50">Fiftieth </word>
7640
+ <word cardinal="60">Sixty-</word>
7641
+ <word ordinal="60">Sixtieth </word>
7642
+ <word cardinal="70">Seventy-</word>
7643
+ <word ordinal="70">Seventieth </word>
7644
+ <word cardinal="80">Eighty-</word>
7645
+ <word ordinal="80">Eightieth </word>
7646
+ <word cardinal="90">Ninety-</word>
7647
+ <word ordinal="90">Ninetieth </word>
7648
+ <word cardinal="100">Hundred-</word>
7649
+ <word ordinal="100">Hundredth </word>
7650
+ </xsl:otherwise>
7651
+ </xsl:choose>
6943
7652
  </words>
6944
7653
  </xsl:variable>
6945
7654
 
@@ -7013,4 +7722,18 @@
7013
7722
  <xsl:otherwise>_</xsl:otherwise>
7014
7723
  </xsl:choose>
7015
7724
  </xsl:attribute>
7725
+ </xsl:template><xsl:template name="substring-after-last">
7726
+ <xsl:param name="value"/>
7727
+ <xsl:param name="delimiter"/>
7728
+ <xsl:choose>
7729
+ <xsl:when test="contains($value, $delimiter)">
7730
+ <xsl:call-template name="substring-after-last">
7731
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
7732
+ <xsl:with-param name="delimiter" select="$delimiter"/>
7733
+ </xsl:call-template>
7734
+ </xsl:when>
7735
+ <xsl:otherwise>
7736
+ <xsl:value-of select="$value"/>
7737
+ </xsl:otherwise>
7738
+ </xsl:choose>
7016
7739
  </xsl:template></xsl:stylesheet>