metanorma-iso 2.0.3 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/lib/isodoc/iso/html/header.html +42 -33
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  5. data/lib/isodoc/iso/html/isodoc.css +9 -7
  6. data/lib/isodoc/iso/html/isodoc.scss +7 -5
  7. data/lib/isodoc/iso/html/style-human.css +0 -1
  8. data/lib/isodoc/iso/html/style-human.scss +0 -1
  9. data/lib/isodoc/iso/html/style-iso.css +0 -1
  10. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  11. data/lib/isodoc/iso/html/word_iso_titlepage.html +12 -11
  12. data/lib/isodoc/iso/html/wordstyle.css +46 -19
  13. data/lib/isodoc/iso/html/wordstyle.scss +52 -25
  14. data/lib/isodoc/iso/i18n-en.yaml +29 -2
  15. data/lib/isodoc/iso/i18n-fr.yaml +27 -3
  16. data/lib/isodoc/iso/i18n-ru.yaml +45 -0
  17. data/lib/isodoc/iso/i18n-zh-Hans.yaml +27 -3
  18. data/lib/isodoc/iso/i18n.rb +1 -0
  19. data/lib/isodoc/iso/init.rb +1 -2
  20. data/lib/isodoc/iso/iso.amendment.xsl +1204 -615
  21. data/lib/isodoc/iso/iso.international-standard.xsl +1204 -615
  22. data/lib/isodoc/iso/metadata.rb +12 -2
  23. data/lib/isodoc/iso/presentation_xml_convert.rb +58 -21
  24. data/lib/metanorma/iso/boilerplate-fr.xml +6 -7
  25. data/lib/metanorma/iso/boilerplate-ru.xml +37 -0
  26. data/lib/metanorma/iso/boilerplate.xml +6 -7
  27. data/lib/metanorma/iso/cleanup.rb +48 -11
  28. data/lib/metanorma/iso/front.rb +1 -1
  29. data/lib/metanorma/iso/front_id.rb +2 -0
  30. data/lib/metanorma/iso/isodoc.rng +73 -3
  31. data/lib/metanorma/iso/processor.rb +14 -7
  32. data/lib/metanorma/iso/validate.rb +30 -2
  33. data/lib/metanorma/iso/validate_image.rb +3 -3
  34. data/lib/metanorma/iso/validate_list.rb +122 -0
  35. data/lib/metanorma/iso/validate_section.rb +39 -32
  36. data/lib/metanorma/iso/validate_style.rb +32 -2
  37. data/lib/metanorma/iso/validate_title.rb +13 -1
  38. data/lib/metanorma/iso/version.rb +1 -1
  39. data/metanorma-iso.gemspec +1 -1
  40. data/spec/isodoc/amd_spec.rb +10 -5
  41. data/spec/isodoc/i18n_spec.rb +350 -9
  42. data/spec/isodoc/inline_spec.rb +127 -10
  43. data/spec/isodoc/metadata_spec.rb +153 -3
  44. data/spec/isodoc/postproc_spec.rb +3 -4
  45. data/spec/isodoc/section_spec.rb +1 -0
  46. data/spec/isodoc/terms_spec.rb +4 -4
  47. data/spec/metanorma/base_spec.rb +434 -326
  48. data/spec/metanorma/cleanup_spec.rb +11 -11
  49. data/spec/metanorma/refs_spec.rb +273 -61
  50. data/spec/metanorma/section_spec.rb +18 -26
  51. data/spec/metanorma/validate_spec.rb +448 -17
  52. data/spec/spec_helper.rb +6 -4
  53. data/spec/vcr_cassettes/docrels.yml +393 -0
  54. data/spec/vcr_cassettes/withdrawn_iso.yml +301 -0
  55. metadata +10 -5
@@ -10,6 +10,8 @@
10
10
 
11
11
 
12
12
 
13
+ <xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
14
+
13
15
  <xsl:variable name="debug">false</xsl:variable>
14
16
 
15
17
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
@@ -27,19 +29,26 @@
27
29
  <!-- <xsl:variable name="ISOname" select="concat(/iso:iso-standard/iso:bibdata/iso:docidentifier, ':', /iso:iso-standard/iso:bibdata/iso:copyright/iso:from , $lang-1st-letter)"/> -->
28
30
  <xsl:variable name="ISOname" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-reference']"/>
29
31
 
30
- <!-- Information and documentation — Codes for transcription systems -->
31
- <xsl:variable name="title-intro" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-intro']"/>
32
- <xsl:variable name="title-intro-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-intro']"/>
33
- <xsl:variable name="title-main" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-main']"/>
34
- <xsl:variable name="title-main-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-main']"/>
35
32
  <xsl:variable name="part" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@part"/>
36
33
 
37
34
  <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
38
- <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate($doctype,'-',' ')))"/>
35
+ <xsl:variable name="doctype_localized" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype[@language = $lang]"/>
36
+
37
+ <xsl:variable name="doctype_uppercased">
38
+ <xsl:choose>
39
+ <xsl:when test="$doctype_localized != ''">
40
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(normalize-space($doctype_localized),'-',' ')))"/>
41
+ </xsl:when>
42
+ <xsl:otherwise>
43
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(normalize-space($doctype),'-',' ')))"/>
44
+ </xsl:otherwise>
45
+ </xsl:choose>
46
+ </xsl:variable>
39
47
 
40
48
  <xsl:variable name="stage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:stage)"/>
41
49
  <xsl:variable name="substage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:substage)"/>
42
50
  <xsl:variable name="stagename" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
51
+ <xsl:variable name="stagename_localized" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage[@language = $lang])"/>
43
52
  <xsl:variable name="abbreviation" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
44
53
 
45
54
  <xsl:variable name="stage-abbreviation">
@@ -63,7 +72,10 @@
63
72
 
64
73
  <xsl:variable name="stage-fullname-uppercased">
65
74
  <xsl:choose>
66
- <xsl:when test="$stagename != ''">
75
+ <xsl:when test="$stagename_localized != ''">
76
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename_localized))"/>
77
+ </xsl:when>
78
+ <xsl:when test="$stagename != ''">
67
79
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
68
80
  </xsl:when>
69
81
  <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
@@ -150,13 +162,25 @@
150
162
  <item level="1" id="Foreword" display="true">Foreword</item>
151
163
  <item id="term-script" display="false">3.2</item>
152
164
  -->
153
- <xsl:variable name="contents">
165
+ <xsl:variable name="contents_">
154
166
  <contents>
155
167
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
156
168
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
157
169
  <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
170
+ <xsl:call-template name="processTablesFigures_Contents"/>
158
171
  </contents>
159
172
  </xsl:variable>
173
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
174
+
175
+ <xsl:variable name="lang_other">
176
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:title[@language != $lang]">
177
+ <xsl:if test="not(preceding-sibling::iso:title[@language = current()/@language])">
178
+ <lang><xsl:value-of select="@language"/></lang>
179
+ </xsl:if>
180
+ </xsl:for-each>
181
+ </xsl:variable>
182
+
183
+ <xsl:variable name="XML" select="/"/>
160
184
 
161
185
  <xsl:template match="/">
162
186
  <xsl:call-template name="namespaceCheck"/>
@@ -414,7 +438,7 @@
414
438
  <!-- Reference number -->
415
439
  <fo:block>
416
440
  <xsl:call-template name="getLocalizedString">
417
- <xsl:with-param name="key">reference_number</xsl:with-param>
441
+ <xsl:with-param name="key">reference_number</xsl:with-param>
418
442
  </xsl:call-template>
419
443
  </fo:block>
420
444
  <fo:block>
@@ -462,7 +486,12 @@
462
486
  </fo:block>
463
487
  </fo:table-cell>
464
488
  <fo:table-cell>
465
- <fo:block>Secretariat: <fo:inline font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/></fo:inline></fo:block>
489
+ <fo:block>
490
+ <xsl:call-template name="getLocalizedString">
491
+ <xsl:with-param name="key">secretariat</xsl:with-param>
492
+ </xsl:call-template>
493
+ <xsl:text>: </xsl:text>
494
+ Secretariat: <fo:inline font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/></fo:inline></fo:block>
466
495
  </fo:table-cell>
467
496
  </fo:table-row>
468
497
  <fo:table-row>
@@ -507,47 +536,45 @@
507
536
  <fo:block-container border-top="1mm double black" line-height="1.1" margin-top="3mm">
508
537
  <fo:block margin-right="5mm">
509
538
  <fo:block font-size="18pt" font-weight="bold" margin-top="6pt" role="H1">
510
- <xsl:if test="normalize-space($title-intro) != ''">
511
- <xsl:value-of select="$title-intro"/>
512
- <xsl:text> — </xsl:text>
513
- </xsl:if>
514
-
515
- <xsl:value-of select="$title-main"/>
516
-
517
- <xsl:call-template name="printTitlePartEn"/>
518
-
519
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
520
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
521
- <fo:block margin-top="12pt" role="H1">
522
- <xsl:call-template name="printAmendmentTitle"/>
523
- </fo:block>
524
- </xsl:if>
525
-
526
- </fo:block>
527
-
528
- <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
529
- <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
530
-
531
- <xsl:if test="normalize-space($title-intro-fr) != ''">
532
- <xsl:value-of select="$title-intro-fr"/>
533
- <xsl:text> — </xsl:text>
534
- </xsl:if>
539
+
540
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
541
+
542
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
535
543
 
536
- <xsl:value-of select="$title-main-fr"/>
537
-
538
- <xsl:call-template name="printTitlePartFr"/>
539
-
540
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
541
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
542
- <fo:block margin-top="6pt" role="H1">
543
- <xsl:call-template name="printAmendmentTitle">
544
- <xsl:with-param name="lang" select="'fr'"/>
545
- </xsl:call-template>
546
- </fo:block>
547
- </xsl:if>
544
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
545
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
546
+ </xsl:apply-templates>
548
547
 
548
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
549
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
550
+ </xsl:apply-templates>
551
+
549
552
  </fo:block>
553
+
554
+
555
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
556
+ <xsl:variable name="lang_other" select="."/>
557
+
558
+ <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
559
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
560
+
561
+ <!-- Example: title-intro fr -->
562
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-intro']"/>
563
+
564
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-main']"/>
565
+
566
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-part']">
567
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
568
+ </xsl:apply-templates>
569
+
570
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-amd']">
571
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
572
+ </xsl:apply-templates>
573
+
574
+ </fo:block>
575
+ </xsl:for-each>
550
576
  </fo:block>
577
+
551
578
  <fo:block margin-top="10mm">
552
579
  <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
553
580
  <xsl:if test="position() = 1"><fo:inline>ICS: </fo:inline></xsl:if>
@@ -555,6 +582,7 @@
555
582
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
556
583
  </xsl:for-each>
557
584
  </fo:block>
585
+
558
586
  </fo:block-container>
559
587
 
560
588
 
@@ -588,6 +616,15 @@
588
616
  <xsl:if test="$stage-name = 'final-draft'">FINAL<xsl:value-of select="$linebreak"/>DRAFT</xsl:if> -->
589
617
  </fo:block>
590
618
  </fo:table-cell>
619
+
620
+ <xsl:variable name="lastWord">
621
+ <xsl:call-template name="substring-after-last">
622
+ <xsl:with-param name="value" select="$doctype_uppercased"/>
623
+ <xsl:with-param name="delimiter" select="' '"/>
624
+ </xsl:call-template>
625
+ </xsl:variable>
626
+ <xsl:variable name="font-size"><xsl:if test="string-length($lastWord) &gt;= 12">90%</xsl:if></xsl:variable> <!-- to prevent overlapping 'NORME INTERNATIONALE' to number -->
627
+
591
628
  <fo:table-cell>
592
629
  <fo:block text-align="left">
593
630
  <xsl:choose>
@@ -595,6 +632,9 @@
595
632
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:updates-document-type,'-',' ')))"/>
596
633
  </xsl:when>
597
634
  <xsl:otherwise>
635
+ <xsl:if test="$font-size != ''">
636
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
637
+ </xsl:if>
598
638
  <xsl:value-of select="$doctype_uppercased"/>
599
639
  </xsl:otherwise>
600
640
  </xsl:choose>
@@ -602,6 +642,9 @@
602
642
  </fo:table-cell>
603
643
  <fo:table-cell>
604
644
  <fo:block text-align="right" font-weight="bold" margin-bottom="13mm">
645
+ <xsl:if test="$font-size != ''">
646
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
647
+ </xsl:if>
605
648
  <xsl:value-of select="$docidentifierISO"/>
606
649
  </fo:block>
607
650
  </fo:table-cell>
@@ -699,54 +742,43 @@
699
742
  <fo:block margin-right="5mm">
700
743
  <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
701
744
 
702
- <xsl:if test="normalize-space($title-intro) != ''">
703
- <xsl:value-of select="$title-intro"/>
704
- <xsl:text> — </xsl:text>
705
- </xsl:if>
745
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
706
746
 
707
- <xsl:value-of select="$title-main"/>
747
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
708
748
 
709
- <xsl:call-template name="printTitlePartEn"/>
710
- <!-- <xsl:if test="normalize-space($title-part) != ''">
711
- <xsl:if test="$part != ''">
712
- <xsl:text> — </xsl:text>
713
- <fo:block font-weight="normal" margin-top="6pt">
714
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
715
- <xsl:text>:</xsl:text>
716
- </fo:block>
717
- </xsl:if>
718
- <xsl:value-of select="$title-part"/>
719
- </xsl:if> -->
720
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
721
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
722
- <fo:block margin-right="-5mm" margin-top="12pt" role="H1">
723
- <xsl:call-template name="printAmendmentTitle"/>
724
- </fo:block>
725
- </xsl:if>
726
- </fo:block>
727
-
728
- <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
729
- <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
749
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
750
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
751
+ </xsl:apply-templates>
730
752
 
731
- <xsl:if test="normalize-space($title-intro-fr) != ''">
732
- <xsl:value-of select="$title-intro-fr"/>
733
- <xsl:text> — </xsl:text>
734
- </xsl:if>
735
-
736
- <xsl:value-of select="$title-main-fr"/>
737
-
738
- <xsl:call-template name="printTitlePartFr"/>
739
-
740
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
741
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
742
- <fo:block margin-right="-5mm" margin-top="6pt" role="H1">
743
- <xsl:call-template name="printAmendmentTitle">
744
- <xsl:with-param name="lang" select="'fr'"/>
745
- </xsl:call-template>
746
- </fo:block>
747
- </xsl:if>
753
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
754
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
755
+ </xsl:apply-templates>
748
756
 
749
757
  </fo:block>
758
+
759
+
760
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
761
+ <xsl:variable name="lang_other" select="."/>
762
+
763
+ <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
764
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
765
+
766
+ <!-- Example: title-intro fr -->
767
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-intro']"/>
768
+
769
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-main']"/>
770
+
771
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-part']">
772
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
773
+ </xsl:apply-templates>
774
+
775
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-amd']">
776
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
777
+ </xsl:apply-templates>
778
+
779
+ </fo:block>
780
+ </xsl:for-each>
781
+
750
782
  </fo:block>
751
783
  </fo:block-container>
752
784
  </fo:table-cell>
@@ -830,41 +862,35 @@
830
862
 
831
863
  <fo:block-container border-top="1mm double black" line-height="1.1">
832
864
  <fo:block margin-right="40mm">
833
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
834
-
835
- <xsl:if test="normalize-space($title-intro) != ''">
836
- <xsl:value-of select="$title-intro"/>
837
- <xsl:text> — </xsl:text>
838
- </xsl:if>
839
-
840
- <xsl:value-of select="$title-main"/>
865
+ <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
841
866
 
842
- <xsl:call-template name="printTitlePartEn"/>
843
- <!-- <xsl:if test="normalize-space($title-part) != ''">
844
- <xsl:if test="$part != ''">
845
- <xsl:text> — </xsl:text>
846
- <fo:block font-weight="normal" margin-top="6pt">
847
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
848
- <xsl:text>:</xsl:text>
849
- </fo:block>
850
- </xsl:if>
851
- <xsl:value-of select="$title-part"/>
852
- </xsl:if> -->
853
- </fo:block>
867
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
868
+
869
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
870
+
871
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
872
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
873
+ </xsl:apply-templates>
874
+
875
+ </fo:block>
876
+
877
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
878
+ <xsl:variable name="lang_other" select="."/>
879
+
880
+ <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
881
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
854
882
 
855
- <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
856
- <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
857
-
858
- <xsl:if test="normalize-space($title-intro-fr) != ''">
859
- <xsl:value-of select="$title-intro-fr"/>
860
- <xsl:text> </xsl:text>
861
- </xsl:if>
862
-
863
- <xsl:value-of select="$title-main-fr"/>
864
-
865
- <xsl:call-template name="printTitlePartFr"/>
866
-
867
- </fo:block>
883
+ <!-- Example: title-intro fr -->
884
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-intro']"/>
885
+
886
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-main']"/>
887
+
888
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-part']">
889
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
890
+ </xsl:apply-templates>
891
+
892
+ </fo:block>
893
+ </xsl:for-each>
868
894
  </fo:block>
869
895
  </fo:block-container>
870
896
  </fo:block-container>
@@ -947,48 +973,35 @@
947
973
  <!-- Information and documentation — Codes for transcription systems -->
948
974
  <fo:block font-weight="bold" role="H1">
949
975
 
950
- <xsl:if test="normalize-space($title-intro) != ''">
951
- <xsl:value-of select="$title-intro"/>
952
- <xsl:text> </xsl:text>
953
- </xsl:if>
954
-
955
- <xsl:value-of select="$title-main"/>
976
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
977
+
978
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
956
979
 
957
- <xsl:call-template name="printTitlePartEn"/>
958
- <!-- <xsl:if test="normalize-space($title-part) != ''">
959
- <xsl:if test="$part != ''">
960
- <xsl:text> — </xsl:text>
961
- <fo:block font-weight="normal" margin-top="6pt">
962
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
963
- <xsl:text>:</xsl:text>
964
- </fo:block>
965
- </xsl:if>
966
- <xsl:value-of select="$title-part"/>
967
- </xsl:if> -->
980
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
981
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
982
+ </xsl:apply-templates>
983
+
968
984
  </fo:block>
969
985
 
970
- <fo:block font-size="12pt"><xsl:value-of select="$linebreak"/></fo:block>
971
- <fo:block role="H1">
972
- <xsl:if test="normalize-space($title-intro-fr) != ''">
973
- <xsl:value-of select="$title-intro-fr"/>
974
- <xsl:text> — </xsl:text>
975
- </xsl:if>
986
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
987
+ <xsl:variable name="lang_other" select="."/>
988
+
989
+ <fo:block font-size="12pt"><xsl:value-of select="$linebreak"/></fo:block>
990
+ <fo:block role="H1">
976
991
 
977
- <xsl:value-of select="$title-main-fr"/>
992
+ <!-- Example: title-intro fr -->
993
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-intro']"/>
994
+
995
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-main']"/>
996
+
997
+ <xsl:apply-templates select="$XML/iso:iso-standard/iso:bibdata/iso:title[@language = $lang_other and @type = 'title-part']">
998
+ <xsl:with-param name="curr_lang" select="$lang_other"/>
999
+ </xsl:apply-templates>
1000
+
1001
+ </fo:block>
978
1002
 
979
- <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
980
- <xsl:if test="normalize-space($part-fr) != ''">
981
- <xsl:if test="$part != ''">
982
- <xsl:text> — </xsl:text>
983
- <fo:block margin-top="6pt" font-weight="normal">
984
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
985
- <!-- <xsl:value-of select="$title-part-fr"/><xsl:value-of select="$part"/>
986
- <xsl:text>:</xsl:text> -->
987
- </fo:block>
988
- </xsl:if>
989
- <xsl:value-of select="$part-fr"/>
990
- </xsl:if>
991
- </fo:block>
1003
+ </xsl:for-each>
1004
+
992
1005
  </fo:block-container>
993
1006
  <fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
994
1007
  <fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
@@ -1017,312 +1030,418 @@
1017
1030
  </xsl:otherwise>
1018
1031
  </xsl:choose>
1019
1032
 
1020
- <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
1021
- <xsl:call-template name="insertHeaderFooter">
1022
- <xsl:with-param name="font-weight">normal</xsl:with-param>
1023
- </xsl:call-template>
1024
- <fo:flow flow-name="xsl-region-body" line-height="115%">
1025
- <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1026
-
1027
- <fo:block-container height="252mm" display-align="after">
1028
- <!-- <fo:block margin-bottom="3mm">
1029
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Attention))}" width="14mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1030
- <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold"></fo:inline>
1031
- </fo:block> -->
1032
- <fo:block line-height="90%">
1033
- <fo:block font-size="9pt" text-align="justify">
1034
- <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
1033
+ <xsl:variable name="updated_xml_step1">
1034
+ <xsl:apply-templates mode="update_xml_step1"/>
1035
+ </xsl:variable>
1036
+ <!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
1037
+
1038
+ <xsl:variable name="updated_xml_step2">
1039
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
1040
+ </xsl:variable>
1041
+ <!-- DEBUG: updated_xml_step2=<xsl:copy-of select="$updated_xml_step2"/> -->
1042
+
1043
+ <xsl:for-each select="xalan:nodeset($updated_xml_step2)">
1044
+
1045
+ <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
1046
+ <xsl:call-template name="insertHeaderFooter">
1047
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
1048
+ </xsl:call-template>
1049
+ <fo:flow flow-name="xsl-region-body" line-height="115%">
1050
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1051
+
1052
+ <fo:block-container height="252mm" display-align="after">
1053
+ <!-- <fo:block margin-bottom="3mm">
1054
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Attention))}" width="14mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1055
+ <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold"></fo:inline>
1056
+ </fo:block> -->
1057
+ <fo:block line-height="90%">
1058
+ <fo:block font-size="9pt" text-align="justify">
1059
+ <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
1060
+ </fo:block>
1035
1061
  </fo:block>
1036
- </fo:block>
1037
- </fo:block-container>
1038
- </xsl:if>
1039
-
1040
-
1041
- <xsl:choose>
1042
- <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1062
+ </fo:block-container>
1063
+ </xsl:if>
1043
1064
 
1044
- <xsl:otherwise>
1045
- <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1046
- <fo:block break-after="page"/>
1047
- </xsl:if>
1048
- <fo:block-container font-weight="bold">
1049
- <fo:block role="TOC">
1050
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1051
- <fo:inline font-size="16pt" font-weight="bold" role="H1">
1052
- <!-- Contents -->
1053
- <xsl:call-template name="getLocalizedString">
1054
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1055
- </xsl:call-template>
1056
- </fo:inline>
1057
- <fo:inline keep-together.within-line="always">
1058
- <fo:leader leader-pattern="space"/>
1059
- <fo:inline font-weight="normal" font-size="10pt">
1060
- <!-- Page -->
1065
+
1066
+ <xsl:choose>
1067
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1068
+
1069
+ <xsl:otherwise>
1070
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1071
+ <fo:block break-after="page"/>
1072
+ </xsl:if>
1073
+ <fo:block-container font-weight="bold">
1074
+ <fo:block role="TOC">
1075
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1076
+ <fo:inline font-size="16pt" font-weight="bold" role="H1">
1077
+ <!-- Contents -->
1061
1078
  <xsl:call-template name="getLocalizedString">
1062
- <xsl:with-param name="key">locality.page</xsl:with-param>
1063
- </xsl:call-template>
1079
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1080
+ </xsl:call-template>
1064
1081
  </fo:inline>
1065
- </fo:inline>
1066
- </fo:block>
1067
-
1068
- <xsl:if test="$debug = 'true'">
1069
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1070
- DEBUG
1071
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
1072
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1073
- </xsl:if>
1074
-
1075
- <xsl:variable name="margin-left">12</xsl:variable>
1076
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1082
+ <fo:inline keep-together.within-line="always">
1083
+ <fo:leader leader-pattern="space"/>
1084
+ <fo:inline font-weight="normal" font-size="10pt">
1085
+ <!-- Page -->
1086
+ <xsl:call-template name="getLocalizedString">
1087
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1088
+ </xsl:call-template>
1089
+ </fo:inline>
1090
+ </fo:inline>
1091
+ </fo:block>
1077
1092
 
1078
- <fo:block role="TOCI">
1079
- <xsl:if test="@level = 1">
1080
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1081
- </xsl:if>
1082
- <xsl:if test="@level = 3">
1083
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1084
- </xsl:if>
1085
- <fo:list-block>
1086
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1087
- <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1088
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1093
+ <xsl:if test="$debug = 'true'">
1094
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1095
+ DEBUG
1096
+ contents=<xsl:copy-of select="$contents"/>
1097
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1098
+ </xsl:if>
1099
+
1100
+ <xsl:variable name="margin-left">12</xsl:variable>
1101
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1102
+
1103
+ <fo:block role="TOCI">
1104
+ <xsl:if test="@level = 1">
1105
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
1089
1106
  </xsl:if>
1090
- <xsl:attribute name="provisional-distance-between-starts">
1091
- <xsl:choose>
1092
- <!-- skip 0 section without subsections -->
1093
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1094
- <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1095
- <xsl:otherwise>0mm</xsl:otherwise>
1096
- </xsl:choose>
1097
- </xsl:attribute>
1098
- <fo:list-item>
1099
- <fo:list-item-label end-indent="label-end()">
1100
- <fo:block>
1101
- <xsl:value-of select="@section"/>
1102
- </fo:block>
1103
- </fo:list-item-label>
1104
- <fo:list-item-body start-indent="body-start()">
1105
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1106
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1107
-
1108
- <xsl:apply-templates select="title"/>
1107
+ <xsl:if test="@level = 3">
1108
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1109
+ </xsl:if>
1110
+ <fo:list-block>
1111
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1112
+ <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1113
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1114
+ </xsl:if>
1115
+ <xsl:attribute name="provisional-distance-between-starts">
1116
+ <xsl:choose>
1117
+ <!-- skip 0 section without subsections -->
1118
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1119
+ <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1120
+ <xsl:otherwise>0mm</xsl:otherwise>
1121
+ </xsl:choose>
1122
+ </xsl:attribute>
1123
+ <fo:list-item>
1124
+ <fo:list-item-label end-indent="label-end()">
1125
+ <fo:block>
1126
+ <xsl:value-of select="@section"/>
1127
+ </fo:block>
1128
+ </fo:list-item-label>
1129
+ <fo:list-item-body start-indent="body-start()">
1130
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1131
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1109
1132
 
1110
- <fo:inline keep-together.within-line="always">
1111
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1112
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1113
- </fo:inline>
1114
- </fo:basic-link>
1115
- </fo:block>
1116
- </fo:list-item-body>
1117
- </fo:list-item>
1118
- </fo:list-block>
1119
- </fo:block>
1133
+ <xsl:apply-templates select="title"/>
1134
+
1135
+ <fo:inline keep-together.within-line="always">
1136
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1137
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1138
+ </fo:inline>
1139
+ </fo:basic-link>
1140
+ </fo:block>
1141
+ </fo:list-item-body>
1142
+ </fo:list-item>
1143
+ </fo:list-block>
1144
+ </fo:block>
1145
+
1146
+ </xsl:for-each>
1120
1147
 
1121
- </xsl:for-each>
1122
- </fo:block>
1123
- </fo:block-container>
1124
- </xsl:otherwise>
1125
- </xsl:choose>
1126
-
1127
- <!-- Foreword, Introduction -->
1128
- <xsl:call-template name="processPrefaceSectionsDefault"/>
1148
+ <!-- List of Tables -->
1149
+ <xsl:if test="$contents//tables/table">
1150
+ <xsl:call-template name="insertListOf_Title">
1151
+ <xsl:with-param name="title" select="$title-list-tables"/>
1152
+ </xsl:call-template>
1153
+ <xsl:for-each select="$contents//tables/table">
1154
+ <xsl:call-template name="insertListOf_Item"/>
1155
+ </xsl:for-each>
1156
+ </xsl:if>
1157
+
1158
+ <!-- List of Figures -->
1159
+ <xsl:if test="$contents//figures/figure">
1160
+ <xsl:call-template name="insertListOf_Title">
1161
+ <xsl:with-param name="title" select="$title-list-figures"/>
1162
+ </xsl:call-template>
1163
+ <xsl:for-each select="$contents//figures/figure">
1164
+ <xsl:call-template name="insertListOf_Item"/>
1165
+ </xsl:for-each>
1166
+ </xsl:if>
1167
+
1168
+ </fo:block>
1169
+ </fo:block-container>
1170
+ </xsl:otherwise>
1171
+ </xsl:choose>
1129
1172
 
1130
- </fo:flow>
1131
- </fo:page-sequence>
1132
-
1133
- <!-- BODY -->
1134
- <fo:page-sequence master-reference="document{$document-master-reference}" initial-page-number="1" force-page-count="no-force">
1135
- <fo:static-content flow-name="xsl-footnote-separator">
1136
- <fo:block>
1137
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1138
- </fo:block>
1139
- </fo:static-content>
1140
- <xsl:call-template name="insertHeaderFooter"/>
1141
- <fo:flow flow-name="xsl-region-body">
1173
+ <!-- Foreword, Introduction -->
1174
+ <xsl:call-template name="processPrefaceSectionsDefault"/>
1175
+
1176
+ </fo:flow>
1177
+ </fo:page-sequence>
1142
1178
 
1143
-
1144
- <fo:block-container>
1145
- <!-- Information and documentation — Codes for transcription systems -->
1146
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1147
- <xsl:value-of select="$title-en"/>
1179
+ <!-- BODY -->
1180
+ <fo:page-sequence master-reference="document{$document-master-reference}" initial-page-number="1" force-page-count="no-force">
1181
+ <fo:static-content flow-name="xsl-footnote-separator">
1182
+ <fo:block>
1183
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
1148
1184
  </fo:block>
1149
- -->
1150
- <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1185
+ </fo:static-content>
1186
+ <xsl:call-template name="insertHeaderFooter"/>
1187
+ <fo:flow flow-name="xsl-region-body">
1188
+
1151
1189
 
1152
- <xsl:variable name="title-part-doc-lang" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']"/>
1153
-
1154
- <xsl:variable name="title-intro-doc-lang" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1190
+ <fo:block-container>
1191
+ <!-- Information and documentation — Codes for transcription systems -->
1192
+ <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1193
+ <xsl:value-of select="$title-en"/>
1194
+ </fo:block>
1195
+ -->
1196
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1155
1197
 
1156
- <fo:block role="H1">
1157
- <xsl:if test="normalize-space($title-intro-doc-lang) != ''">
1158
- <xsl:value-of select="$title-intro-doc-lang"/>
1159
- <xsl:text> — </xsl:text>
1160
- </xsl:if>
1198
+ <fo:block role="H1">
1161
1199
 
1162
- <xsl:variable name="title-main-doc-lang" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1200
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1201
+
1202
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1203
+
1204
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1205
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
1206
+ <xsl:with-param name="isMainBody">true</xsl:with-param>
1207
+ </xsl:apply-templates>
1208
+
1209
+ </fo:block>
1210
+ <fo:block role="H1">
1211
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1212
+ </fo:block>
1163
1213
 
1164
- <xsl:value-of select="$title-main-doc-lang"/>
1214
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1215
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
1216
+ <xsl:with-param name="isMainBody">true</xsl:with-param>
1217
+ </xsl:apply-templates>
1165
1218
 
1166
- <xsl:if test="normalize-space($title-part-doc-lang) != ''">
1167
- <xsl:if test="$part != ''">
1168
- <xsl:text> — </xsl:text>
1169
- <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1170
- <xsl:call-template name="getLocalizedString">
1171
- <xsl:with-param name="key">Part.sg</xsl:with-param>
1172
- </xsl:call-template>
1173
- <xsl:text> </xsl:text>
1174
- <xsl:value-of select="$part"/>
1175
- <xsl:text>:</xsl:text>
1176
- <!-- <xsl:value-of select="$title-part-en"/>
1177
- <xsl:value-of select="$part"/>
1178
- <xsl:text>:</xsl:text> -->
1179
- </fo:block>
1180
- </xsl:if>
1181
- </xsl:if>
1182
- </fo:block>
1183
- <fo:block role="H1">
1184
- <xsl:value-of select="$title-part-doc-lang"/>
1185
1219
  </fo:block>
1186
-
1187
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1188
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1189
- <fo:block margin-top="12pt" role="H1">
1190
- <xsl:call-template name="printAmendmentTitle"/>
1191
- </fo:block>
1192
- </xsl:if>
1193
1220
 
1221
+ </fo:block-container>
1222
+ <!-- Clause(s) -->
1223
+ <fo:block>
1224
+
1225
+ <xsl:choose>
1226
+ <xsl:when test="$doctype = 'amendment'">
1227
+ <xsl:apply-templates select="/iso:iso-standard/iso:sections/*"/>
1228
+ </xsl:when>
1229
+ <xsl:otherwise>
1230
+ <xsl:call-template name="processMainSectionsDefault"/>
1231
+ </xsl:otherwise>
1232
+ </xsl:choose>
1233
+
1234
+ <fo:block id="lastBlock" font-size="1pt"> </fo:block>
1194
1235
  </fo:block>
1195
-
1196
- </fo:block-container>
1197
- <!-- Clause(s) -->
1198
- <fo:block>
1199
-
1200
- <xsl:choose>
1201
- <xsl:when test="$doctype = 'amendment'">
1202
- <xsl:apply-templates select="/iso:iso-standard/iso:sections/*"/>
1203
- </xsl:when>
1204
- <xsl:otherwise>
1205
- <xsl:call-template name="processMainSectionsDefault"/>
1206
- </xsl:otherwise>
1207
- </xsl:choose>
1208
1236
 
1209
- <fo:block id="lastBlock" font-size="1pt"> </fo:block>
1210
- </fo:block>
1211
-
1212
- </fo:flow>
1213
- </fo:page-sequence>
1214
-
1215
-
1216
- <!-- Index -->
1217
- <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1218
-
1219
- <xsl:if test="$isPublished = 'true'">
1220
- <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1221
- <xsl:call-template name="insertHeaderEven"/>
1222
- <fo:static-content flow-name="last-page-footer" font-size="10pt">
1223
- <fo:table table-layout="fixed" width="100%">
1224
- <fo:table-column column-width="33%"/>
1225
- <fo:table-column column-width="33%"/>
1226
- <fo:table-column column-width="34%"/>
1227
- <fo:table-body>
1228
- <fo:table-row>
1229
- <fo:table-cell display-align="center">
1230
- <fo:block font-size="9pt"><xsl:value-of select="$copyrightText"/></fo:block>
1231
- </fo:table-cell>
1232
- <fo:table-cell>
1233
- <fo:block font-size="11pt" font-weight="bold" text-align="center">
1234
- <xsl:if test="$stage-abbreviation = 'PRF'">
1235
- <xsl:value-of select="$proof-text"/>
1236
- </xsl:if>
1237
+ </fo:flow>
1238
+ </fo:page-sequence>
1239
+
1240
+
1241
+ <!-- Index -->
1242
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1243
+
1244
+ <xsl:if test="$isPublished = 'true'">
1245
+ <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1246
+ <xsl:call-template name="insertHeaderEven"/>
1247
+ <fo:static-content flow-name="last-page-footer" font-size="10pt">
1248
+ <fo:table table-layout="fixed" width="100%">
1249
+ <fo:table-column column-width="33%"/>
1250
+ <fo:table-column column-width="33%"/>
1251
+ <fo:table-column column-width="34%"/>
1252
+ <fo:table-body>
1253
+ <fo:table-row>
1254
+ <fo:table-cell display-align="center">
1255
+ <fo:block font-size="9pt"><xsl:value-of select="$copyrightText"/></fo:block>
1256
+ </fo:table-cell>
1257
+ <fo:table-cell>
1258
+ <fo:block font-size="11pt" font-weight="bold" text-align="center">
1259
+ <xsl:if test="$stage-abbreviation = 'PRF'">
1260
+ <xsl:value-of select="$proof-text"/>
1261
+ </xsl:if>
1262
+ </fo:block>
1263
+ </fo:table-cell>
1264
+ <fo:table-cell>
1265
+ <fo:block> </fo:block>
1266
+ </fo:table-cell>
1267
+ </fo:table-row>
1268
+ </fo:table-body>
1269
+ </fo:table>
1270
+ </fo:static-content>
1271
+ <fo:flow flow-name="xsl-region-body">
1272
+ <fo:block-container height="252mm" display-align="after">
1273
+ <fo:block-container border-top="1mm double black">
1274
+ <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1275
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1276
+ <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1277
+ <xsl:value-of select="."/>
1278
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1279
+ </xsl:for-each> 
1280
+ <!-- <xsl:choose>
1281
+ <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1282
+ <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1283
+ <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1284
+ <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1285
+ </xsl:choose> -->
1237
1286
  </fo:block>
1238
- </fo:table-cell>
1239
- <fo:table-cell>
1240
- <fo:block> </fo:block>
1241
- </fo:table-cell>
1242
- </fo:table-row>
1243
- </fo:table-body>
1244
- </fo:table>
1245
- </fo:static-content>
1246
- <fo:flow flow-name="xsl-region-body">
1247
- <fo:block-container height="252mm" display-align="after">
1248
- <fo:block-container border-top="1mm double black">
1249
- <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1250
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1251
- <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1252
- <xsl:value-of select="."/>
1253
- <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1254
- </xsl:for-each> 
1255
- <!-- <xsl:choose>
1256
- <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1257
- <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1258
- <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1259
- <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1260
- </xsl:choose> -->
1261
- </fo:block>
1262
- <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1263
- <fo:block font-size="9pt" margin-bottom="6pt">
1264
- <xsl:variable name="title-descriptors">
1265
- <xsl:call-template name="getTitle">
1266
- <xsl:with-param name="name" select="'title-descriptors'"/>
1287
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1288
+ <fo:block font-size="9pt" margin-bottom="6pt">
1289
+ <xsl:variable name="title-descriptors">
1290
+ <xsl:call-template name="getTitle">
1291
+ <xsl:with-param name="name" select="'title-descriptors'"/>
1292
+ </xsl:call-template>
1293
+ </xsl:variable>
1294
+ <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1295
+ <xsl:call-template name="insertKeywords">
1296
+ <xsl:with-param name="sorting">no</xsl:with-param>
1267
1297
  </xsl:call-template>
1268
- </xsl:variable>
1269
- <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1270
- <xsl:call-template name="insertKeywords">
1271
- <xsl:with-param name="sorting">no</xsl:with-param>
1298
+ </fo:block>
1299
+ </xsl:if>
1300
+ <xsl:variable name="countPages"/>
1301
+ <xsl:variable name="price_based_on">
1302
+ <xsl:call-template name="getLocalizedString">
1303
+ <xsl:with-param name="key">price_based_on</xsl:with-param>
1272
1304
  </xsl:call-template>
1305
+ </xsl:variable>
1306
+ <xsl:variable name="price_based_on_items">
1307
+ <xsl:call-template name="split">
1308
+ <xsl:with-param name="pText" select="$price_based_on"/>
1309
+ <xsl:with-param name="sep" select="'%'"/>
1310
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
1311
+ </xsl:call-template>
1312
+ </xsl:variable>
1313
+ <!-- Price based on ... pages -->
1314
+ <fo:block font-size="9pt">
1315
+ <xsl:for-each select="xalan:nodeset($price_based_on_items)/item">
1316
+ <xsl:value-of select="."/>
1317
+ <xsl:if test="position() != last()">
1318
+ <fo:page-number-citation ref-id="lastBlock"/>
1319
+ </xsl:if>
1320
+ </xsl:for-each>
1273
1321
  </fo:block>
1274
- </xsl:if>
1275
- <xsl:variable name="countPages"/>
1276
- <xsl:variable name="price_based_on">
1277
- <xsl:call-template name="getLocalizedString">
1278
- <xsl:with-param name="key">price_based_on</xsl:with-param>
1279
- </xsl:call-template>
1280
- </xsl:variable>
1281
- <xsl:variable name="price_based_on_items">
1282
- <xsl:call-template name="split">
1283
- <xsl:with-param name="pText" select="$price_based_on"/>
1284
- <xsl:with-param name="sep" select="'%'"/>
1285
- <xsl:with-param name="normalize-space">false</xsl:with-param>
1286
- </xsl:call-template>
1287
- </xsl:variable>
1288
- <!-- Price based on ... pages -->
1289
- <fo:block font-size="9pt">
1290
- <xsl:for-each select="xalan:nodeset($price_based_on_items)/item">
1291
- <xsl:value-of select="."/>
1292
- <xsl:if test="position() != last()">
1293
- <fo:page-number-citation ref-id="lastBlock"/>
1294
- </xsl:if>
1295
- </xsl:for-each>
1296
- </fo:block>
1322
+ </fo:block-container>
1297
1323
  </fo:block-container>
1298
- </fo:block-container>
1299
- </fo:flow>
1300
- </fo:page-sequence>
1301
- </xsl:if>
1324
+ </fo:flow>
1325
+ </fo:page-sequence>
1326
+ </xsl:if>
1327
+ </xsl:for-each>
1302
1328
  </fo:root>
1303
1329
  </xsl:template>
1304
1330
 
1331
+
1332
+ <xsl:template name="insertListOf_Title">
1333
+ <xsl:param name="title"/>
1334
+ <fo:block role="TOCI" margin-top="5pt" keep-with-next="always">
1335
+ <xsl:value-of select="$title"/>
1336
+ </fo:block>
1337
+ </xsl:template>
1338
+
1339
+ <xsl:template name="insertListOf_Item">
1340
+ <fo:block role="TOCI" font-weight="normal" text-align-last="justify" margin-left="12mm">
1341
+ <fo:basic-link internal-destination="{@id}">
1342
+ <xsl:call-template name="setAltText">
1343
+ <xsl:with-param name="value" select="@alt-text"/>
1344
+ </xsl:call-template>
1345
+ <xsl:apply-templates select="." mode="contents"/>
1346
+ <fo:inline keep-together.within-line="always">
1347
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1348
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1349
+ </fo:inline>
1350
+ </fo:basic-link>
1351
+ </fo:block>
1352
+ </xsl:template>
1305
1353
 
1306
- <xsl:template match="node()">
1307
- <xsl:apply-templates/>
1354
+ <!-- ==================== -->
1355
+ <!-- display titles -->
1356
+ <!-- ==================== -->
1357
+ <xsl:template match="iso:bibdata/iso:title[@type = 'title-intro']">
1358
+ <xsl:apply-templates/>
1359
+ <xsl:text> — </xsl:text>
1360
+ </xsl:template>
1361
+
1362
+ <xsl:template match="iso:bibdata/iso:title[@type = 'title-main']">
1363
+ <xsl:apply-templates/>
1364
+ </xsl:template>
1365
+
1366
+ <xsl:template match="iso:bibdata/iso:title[@type = 'title-part']">
1367
+ <xsl:param name="curr_lang" select="$lang"/>
1368
+ <xsl:param name="isMainLang">false</xsl:param>
1369
+ <xsl:param name="isMainBody">false</xsl:param>
1370
+ <xsl:if test="$part != ''">
1371
+ <xsl:text> — </xsl:text>
1372
+ <xsl:variable name="part-text">
1373
+ <xsl:choose>
1374
+ <xsl:when test="$isMainLang = 'true'">
1375
+ <xsl:call-template name="getLocalizedString">
1376
+ <xsl:with-param name="key">locality.part</xsl:with-param>
1377
+ </xsl:call-template>
1378
+ <xsl:text> </xsl:text>
1379
+ <xsl:value-of select="$part"/>
1380
+ <xsl:text>:</xsl:text>
1381
+ </xsl:when>
1382
+ <xsl:otherwise>
1383
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part)"/>
1384
+ </xsl:otherwise>
1385
+ </xsl:choose>
1386
+ </xsl:variable>
1387
+ <xsl:choose>
1388
+ <xsl:when test="$isMainBody = 'true'">
1389
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1390
+ <xsl:value-of select="$part-text"/>
1391
+ </fo:block>
1392
+ </xsl:when>
1393
+ <xsl:when test="$isMainLang = 'true'">
1394
+ <fo:block font-weight="normal" margin-top="6pt">
1395
+ <xsl:value-of select="$part-text"/>
1396
+ </fo:block>
1397
+ </xsl:when>
1398
+ <xsl:otherwise>
1399
+ <xsl:value-of select="$part-text"/>
1400
+ <xsl:text> </xsl:text>
1401
+ </xsl:otherwise>
1402
+ </xsl:choose>
1403
+ </xsl:if>
1404
+ <xsl:if test="$isMainBody = 'false'">
1405
+ <xsl:apply-templates/>
1406
+ </xsl:if>
1308
1407
  </xsl:template>
1309
1408
 
1310
- <xsl:template name="printAmendmentTitle">
1311
- <xsl:param name="lang" select="'en'"/>
1312
- <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1313
- <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1314
- <fo:block font-weight="normal" line-height="1.1">
1315
- <xsl:value-of select="$doctype_uppercased"/>
1316
- <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1317
- <xsl:if test="normalize-space($amendment-number) != ''">
1318
- <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1409
+ <xsl:template match="iso:bibdata/iso:title[@type = 'title-amd']">
1410
+ <xsl:param name="isMainLang">false</xsl:param>
1411
+ <xsl:param name="curr_lang" select="$lang"/>
1412
+ <xsl:param name="isMainBody">false</xsl:param>
1413
+ <xsl:if test="$doctype = 'amendment'">
1414
+ <fo:block margin-right="-5mm" margin-top="6pt" role="H1">
1415
+ <xsl:if test="$isMainLang = 'true'">
1416
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
1417
+ </xsl:if>
1418
+ <xsl:if test="$stage-abbreviation = 'DIS' or $isMainBody = 'true'">
1419
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1319
1420
  </xsl:if>
1320
- <xsl:text>: </xsl:text>
1321
- <xsl:value-of select="$title-amd"/>
1421
+
1422
+ <fo:block font-weight="normal" line-height="1.1">
1423
+ <xsl:value-of select="$doctype_uppercased"/>
1424
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1425
+ <xsl:if test="normalize-space($amendment-number) != ''">
1426
+ <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1427
+ </xsl:if>
1428
+ <xsl:text>: </xsl:text>
1429
+ <xsl:apply-templates/>
1430
+ </fo:block>
1431
+
1322
1432
  </fo:block>
1323
1433
  </xsl:if>
1324
1434
  </xsl:template>
1325
1435
 
1436
+
1437
+ <!-- ==================== -->
1438
+ <!-- END display titles -->
1439
+ <!-- ==================== -->
1440
+
1441
+ <xsl:template match="node()">
1442
+ <xsl:apply-templates/>
1443
+ </xsl:template>
1444
+
1326
1445
  <!-- ============================= -->
1327
1446
  <!-- CONTENTS -->
1328
1447
  <!-- ============================= -->
@@ -1812,43 +1931,13 @@
1812
1931
  </xsl:when>
1813
1932
  </xsl:choose>
1814
1933
  <xsl:variable name="title-edition">
1815
- <xsl:call-template name="getTitle">
1816
- <xsl:with-param name="name" select="'title-edition'"/>
1934
+ <xsl:call-template name="getLocalizedString">
1935
+ <xsl:with-param name="key">edition</xsl:with-param>
1817
1936
  </xsl:call-template>
1818
1937
  </xsl:variable>
1819
1938
  <xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
1820
1939
  </xsl:template>
1821
1940
 
1822
- <xsl:template name="printTitlePartFr">
1823
- <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
1824
- <xsl:if test="normalize-space($part-fr) != ''">
1825
- <xsl:if test="$part != ''">
1826
- <xsl:text> — </xsl:text>
1827
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
1828
- <!-- <xsl:value-of select="$title-part-fr"/>
1829
- <xsl:value-of select="$part"/>
1830
- <xsl:text>:</xsl:text> -->
1831
- </xsl:if>
1832
- <xsl:value-of select="$part-fr"/>
1833
- </xsl:if>
1834
- </xsl:template>
1835
-
1836
- <xsl:template name="printTitlePartEn">
1837
- <xsl:variable name="part-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
1838
- <xsl:if test="normalize-space($part-en) != ''">
1839
- <xsl:if test="$part != ''">
1840
- <xsl:text> — </xsl:text>
1841
- <fo:block font-weight="normal" margin-top="6pt">
1842
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1843
- <!-- <xsl:value-of select="$title-part-en"/>
1844
- <xsl:value-of select="$part"/>
1845
- <xsl:text>:</xsl:text> -->
1846
- </fo:block>
1847
- </xsl:if>
1848
- <xsl:value-of select="$part-en"/>
1849
- </xsl:if>
1850
- </xsl:template>
1851
-
1852
1941
 
1853
1942
  <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:variable name="lang">
1854
1943
  <xsl:call-template name="getLang"/>
@@ -1876,6 +1965,10 @@
1876
1965
  <xsl:text>Édition </xsl:text>
1877
1966
  </title-edition>
1878
1967
 
1968
+ <title-edition lang="ru">
1969
+ <xsl:text>Издание </xsl:text>
1970
+ </title-edition>
1971
+
1879
1972
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1880
1973
  <title-toc lang="en">
1881
1974
 
@@ -1890,7 +1983,7 @@
1890
1983
  <xsl:text>Contents</xsl:text>
1891
1984
 
1892
1985
  </title-toc>
1893
-
1986
+
1894
1987
  <title-descriptors lang="en">Descriptors</title-descriptors>
1895
1988
 
1896
1989
  <title-part lang="en">
@@ -1906,7 +1999,13 @@
1906
1999
 
1907
2000
 
1908
2001
 
1909
- </title-part>
2002
+ </title-part>
2003
+ <title-part lang="ru">
2004
+
2005
+ <xsl:text>Часть #:</xsl:text>
2006
+
2007
+
2008
+ </title-part>
1910
2009
  <title-part lang="zh">第 # 部分:</title-part>
1911
2010
 
1912
2011
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -1922,10 +2021,35 @@
1922
2021
 
1923
2022
  <title-summary lang="en">Summary</title-summary>
1924
2023
 
2024
+ <title-continued lang="ru">(продолжение)</title-continued>
1925
2025
  <title-continued lang="en">(continued)</title-continued>
1926
2026
  <title-continued lang="fr">(continué)</title-continued>
1927
2027
 
1928
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
2028
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
2029
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
2030
+ <xsl:value-of select="$toc_table_title"/>
2031
+ <xsl:if test="normalize-space($toc_table_title) = ''">
2032
+ <xsl:call-template name="getTitle">
2033
+ <xsl:with-param name="name" select="'title-list-tables'"/>
2034
+ </xsl:call-template>
2035
+ </xsl:if>
2036
+ </xsl:variable><xsl:variable name="title-list-figures">
2037
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
2038
+ <xsl:value-of select="$toc_figure_title"/>
2039
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
2040
+ <xsl:call-template name="getTitle">
2041
+ <xsl:with-param name="name" select="'title-list-figures'"/>
2042
+ </xsl:call-template>
2043
+ </xsl:if>
2044
+ </xsl:variable><xsl:variable name="title-list-recommendations">
2045
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
2046
+ <xsl:value-of select="$toc_requirement_title"/>
2047
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
2048
+ <xsl:call-template name="getTitle">
2049
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
2050
+ </xsl:call-template>
2051
+ </xsl:if>
2052
+ </xsl:variable><xsl:variable name="bibdata">
1929
2053
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1930
2054
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1931
2055
  </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">
@@ -2693,13 +2817,19 @@
2693
2817
  </xsl:attribute-set><xsl:variable name="color-added-text">
2694
2818
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2695
2819
  </xsl:variable><xsl:attribute-set name="add-style">
2696
- <xsl:attribute name="color">red</xsl:attribute>
2697
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2698
- <!-- <xsl:attribute name="color">black</xsl:attribute>
2699
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2700
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
2701
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2702
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2820
+
2821
+ <xsl:attribute name="color">red</xsl:attribute>
2822
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2823
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2824
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2825
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2826
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2827
+
2828
+ </xsl:attribute-set><xsl:variable name="add-style">
2829
+ <add-style xsl:use-attribute-sets="add-style"/>
2830
+ </xsl:variable><xsl:template name="append_add-style">
2831
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2832
+ </xsl:template><xsl:variable name="color-deleted-text">
2703
2833
  <xsl:text>red</xsl:text>
2704
2834
  </xsl:variable><xsl:attribute-set name="del-style">
2705
2835
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -3124,14 +3254,42 @@
3124
3254
 
3125
3255
 
3126
3256
  </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">
3257
+ <xsl:variable name="nodes_preface_">
3258
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3259
+ <node id="{@id}"/>
3260
+ </xsl:for-each>
3261
+ </xsl:variable>
3262
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3263
+
3127
3264
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3128
3265
  <xsl:sort select="@displayorder" data-type="number"/>
3266
+
3267
+ <!-- process Section's title -->
3268
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3269
+ <xsl:if test="$preceding-sibling_id != ''">
3270
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3271
+ </xsl:if>
3272
+
3129
3273
  <xsl:apply-templates select="." mode="contents"/>
3130
3274
  </xsl:for-each>
3131
3275
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
3132
3276
 
3277
+ <xsl:variable name="nodes_sections_">
3278
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
3279
+ <node id="{@id}"/>
3280
+ </xsl:for-each>
3281
+ </xsl:variable>
3282
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
3283
+
3133
3284
  <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']]">
3134
3285
  <xsl:sort select="@displayorder" data-type="number"/>
3286
+
3287
+ <!-- process Section's title -->
3288
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3289
+ <xsl:if test="$preceding-sibling_id != ''">
3290
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3291
+ </xsl:if>
3292
+
3135
3293
  <xsl:apply-templates select="." mode="contents"/>
3136
3294
  </xsl:for-each>
3137
3295
 
@@ -3144,6 +3302,30 @@
3144
3302
  <xsl:sort select="@displayorder" data-type="number"/>
3145
3303
  <xsl:apply-templates select="." mode="contents"/>
3146
3304
  </xsl:for-each>
3305
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
3306
+ <xsl:param name="always"/>
3307
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3308
+ <xsl:call-template name="processTables_Contents"/>
3309
+ </xsl:if>
3310
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3311
+ <xsl:call-template name="processFigures_Contents"/>
3312
+ </xsl:if>
3313
+ </xsl:template><xsl:template name="processTables_Contents">
3314
+ <tables>
3315
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3316
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3317
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3318
+ </table>
3319
+ </xsl:for-each>
3320
+ </tables>
3321
+ </xsl:template><xsl:template name="processFigures_Contents">
3322
+ <figures>
3323
+ <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) != '']">
3324
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3325
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3326
+ </figure>
3327
+ </xsl:for-each>
3328
+ </figures>
3147
3329
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3148
3330
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3149
3331
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -3281,7 +3463,7 @@
3281
3463
  </xsl:call-template>
3282
3464
  </xsl:if>
3283
3465
  </xsl:variable>
3284
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3466
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3285
3467
 
3286
3468
 
3287
3469
  <xsl:variable name="margin-side">
@@ -3551,7 +3733,7 @@
3551
3733
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3552
3734
  <!-- 2009 thinspace -->
3553
3735
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3554
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3736
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3555
3737
  </xsl:call-template>
3556
3738
  </xsl:variable>
3557
3739
  <xsl:variable name="max_length">
@@ -4010,37 +4192,7 @@
4010
4192
 
4011
4193
  <!-- list of footnotes to calculate actual footnotes number -->
4012
4194
  <xsl:variable name="p_fn_">
4013
- <xsl:choose>
4014
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4015
- <fn gen_id="{generate-id(.)}">
4016
- <xsl:copy-of select="@*"/>
4017
- <xsl:copy-of select="node()"/>
4018
- </fn>
4019
- </xsl:when>
4020
- <xsl:otherwise>
4021
- <!-- itetation for:
4022
- footnotes in bibdata/title
4023
- footnotes in bibliography
4024
- footnotes in document's body (except table's head/body/foot and figure text)
4025
- -->
4026
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4027
- <fn gen_id="{generate-id(.)}">
4028
- <xsl:copy-of select="@*"/>
4029
- <xsl:copy-of select="node()"/>
4030
- </fn>
4031
- </xsl:for-each>
4032
- <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']/*">
4033
- <xsl:sort select="@displayorder" data-type="number"/>
4034
- <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])]">
4035
- <!-- copy unique fn -->
4036
- <fn gen_id="{generate-id(.)}">
4037
- <xsl:copy-of select="@*"/>
4038
- <xsl:copy-of select="node()"/>
4039
- </fn>
4040
- </xsl:for-each>
4041
- </xsl:for-each>
4042
- </xsl:otherwise>
4043
- </xsl:choose>
4195
+ <xsl:call-template name="get_fn_list"/>
4044
4196
  </xsl:variable>
4045
4197
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4046
4198
 
@@ -4103,6 +4255,38 @@
4103
4255
  <xsl:copy-of select="$footnote_inline"/>
4104
4256
  </xsl:otherwise>
4105
4257
  </xsl:choose>
4258
+ </xsl:template><xsl:template name="get_fn_list">
4259
+ <xsl:choose>
4260
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4261
+ <fn gen_id="{generate-id(.)}">
4262
+ <xsl:copy-of select="@*"/>
4263
+ <xsl:copy-of select="node()"/>
4264
+ </fn>
4265
+ </xsl:when>
4266
+ <xsl:otherwise>
4267
+ <!-- itetation for:
4268
+ footnotes in bibdata/title
4269
+ footnotes in bibliography
4270
+ footnotes in document's body (except table's head/body/foot and figure text)
4271
+ -->
4272
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4273
+ <fn gen_id="{generate-id(.)}">
4274
+ <xsl:copy-of select="@*"/>
4275
+ <xsl:copy-of select="node()"/>
4276
+ </fn>
4277
+ </xsl:for-each>
4278
+ <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']/*">
4279
+ <xsl:sort select="@displayorder" data-type="number"/>
4280
+ <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])]">
4281
+ <!-- copy unique fn -->
4282
+ <fn gen_id="{generate-id(.)}">
4283
+ <xsl:copy-of select="@*"/>
4284
+ <xsl:copy-of select="node()"/>
4285
+ </fn>
4286
+ </xsl:for-each>
4287
+ </xsl:for-each>
4288
+ </xsl:otherwise>
4289
+ </xsl:choose>
4106
4290
  </xsl:template><xsl:template name="table_fn_display">
4107
4291
  <xsl:variable name="references">
4108
4292
 
@@ -4279,7 +4463,7 @@
4279
4463
  </fo:inline>
4280
4464
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4281
4465
  <fo:inline><xsl:value-of select="."/></fo:inline>
4282
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4466
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4283
4467
  <fo:inline>
4284
4468
  <xsl:apply-templates/>
4285
4469
  </fo:inline>
@@ -5276,6 +5460,9 @@
5276
5460
  </fo:inline>
5277
5461
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5278
5462
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5463
+ <xsl:if test="parent::*[local-name() = 'add']">
5464
+ <xsl:call-template name="append_add-style"/>
5465
+ </xsl:if>
5279
5466
  <xsl:apply-templates/>
5280
5467
  </fo:basic-link>
5281
5468
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -5373,6 +5560,13 @@
5373
5560
 
5374
5561
 
5375
5562
 
5563
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5564
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5565
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5566
+ <xsl:call-template name="append_add-style"/>
5567
+ </xsl:if>
5568
+
5569
+
5376
5570
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
5377
5571
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
5378
5572
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -5411,6 +5605,12 @@
5411
5605
 
5412
5606
 
5413
5607
 
5608
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5609
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5610
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5611
+ <xsl:call-template name="append_add-style"/>
5612
+ </xsl:if>
5613
+
5414
5614
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5415
5615
 
5416
5616
  </fo:inline>
@@ -5462,6 +5662,7 @@
5462
5662
  </fo:block>
5463
5663
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5464
5664
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5665
+
5465
5666
 
5466
5667
 
5467
5668
 
@@ -5900,7 +6101,11 @@
5900
6101
  <xsl:value-of select="."/>
5901
6102
  </xsl:template><xsl:template match="node()" mode="contents">
5902
6103
  <xsl:apply-templates mode="contents"/>
5903
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
6104
+ </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">
6105
+ <xsl:call-template name="contents_section-title"/>
6106
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
6107
+ <xsl:call-template name="contents_section-title"/>
6108
+ </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">
5904
6109
  <xsl:variable name="level">
5905
6110
  <xsl:call-template name="getLevel">
5906
6111
  <xsl:with-param name="depth" select="@depth"/>
@@ -5969,13 +6174,14 @@
5969
6174
  <xsl:apply-templates mode="bookmarks"/>
5970
6175
  </xsl:template><xsl:template name="addBookmarks">
5971
6176
  <xsl:param name="contents"/>
5972
- <xsl:if test="xalan:nodeset($contents)//item">
6177
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6178
+ <xsl:if test="$contents_nodes//item">
5973
6179
  <fo:bookmark-tree>
5974
6180
  <xsl:choose>
5975
- <xsl:when test="xalan:nodeset($contents)/doc">
6181
+ <xsl:when test="$contents_nodes/doc">
5976
6182
  <xsl:choose>
5977
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5978
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6183
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
6184
+ <xsl:for-each select="$contents_nodes/doc">
5979
6185
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5980
6186
  <xsl:if test="@bundle = 'true'">
5981
6187
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -6026,7 +6232,7 @@
6026
6232
  </xsl:for-each>
6027
6233
  </xsl:when>
6028
6234
  <xsl:otherwise>
6029
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6235
+ <xsl:for-each select="$contents_nodes/doc">
6030
6236
 
6031
6237
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
6032
6238
 
@@ -6044,25 +6250,36 @@
6044
6250
  </xsl:choose>
6045
6251
  </xsl:when>
6046
6252
  <xsl:otherwise>
6047
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
6253
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
6254
+
6255
+ <xsl:call-template name="insertFigureBookmarks">
6256
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6257
+ </xsl:call-template>
6258
+
6259
+ <xsl:call-template name="insertTableBookmarks">
6260
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6261
+ <xsl:with-param name="lang" select="@lang"/>
6262
+ </xsl:call-template>
6263
+
6048
6264
  </xsl:otherwise>
6049
6265
  </xsl:choose>
6050
6266
 
6267
+
6051
6268
 
6052
6269
 
6053
6270
 
6054
6271
 
6055
-
6056
-
6272
+
6057
6273
 
6058
6274
  </fo:bookmark-tree>
6059
6275
  </xsl:if>
6060
6276
  </xsl:template><xsl:template name="insertFigureBookmarks">
6061
6277
  <xsl:param name="contents"/>
6062
- <xsl:if test="xalan:nodeset($contents)/figure">
6063
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
6278
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6279
+ <xsl:if test="$contents_nodes/figure">
6280
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
6064
6281
  <fo:bookmark-title>Figures</fo:bookmark-title>
6065
- <xsl:for-each select="xalan:nodeset($contents)/figure">
6282
+ <xsl:for-each select="$contents_nodes/figure">
6066
6283
  <fo:bookmark internal-destination="{@id}">
6067
6284
  <fo:bookmark-title>
6068
6285
  <xsl:value-of select="normalize-space(title)"/>
@@ -6071,18 +6288,40 @@
6071
6288
  </xsl:for-each>
6072
6289
  </fo:bookmark>
6073
6290
  </xsl:if>
6291
+
6292
+
6293
+ <xsl:if test="$contents_nodes//figures/figure">
6294
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6295
+
6296
+
6297
+
6298
+ <xsl:variable name="bookmark-title">
6299
+
6300
+ <xsl:value-of select="$title-list-figures"/>
6301
+
6302
+ </xsl:variable>
6303
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
6304
+ <xsl:for-each select="$contents_nodes//figures/figure">
6305
+ <fo:bookmark internal-destination="{@id}">
6306
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6307
+ </fo:bookmark>
6308
+ </xsl:for-each>
6309
+ </fo:bookmark>
6310
+ </xsl:if>
6311
+
6074
6312
  </xsl:template><xsl:template name="insertTableBookmarks">
6075
6313
  <xsl:param name="contents"/>
6076
6314
  <xsl:param name="lang"/>
6077
- <xsl:if test="xalan:nodeset($contents)/table">
6078
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
6315
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6316
+ <xsl:if test="$contents_nodes/table">
6317
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
6079
6318
  <fo:bookmark-title>
6080
6319
  <xsl:choose>
6081
6320
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
6082
6321
  <xsl:otherwise>Tables</xsl:otherwise>
6083
6322
  </xsl:choose>
6084
6323
  </fo:bookmark-title>
6085
- <xsl:for-each select="xalan:nodeset($contents)/table">
6324
+ <xsl:for-each select="$contents_nodes/table">
6086
6325
  <fo:bookmark internal-destination="{@id}">
6087
6326
  <fo:bookmark-title>
6088
6327
  <xsl:value-of select="normalize-space(title)"/>
@@ -6091,6 +6330,29 @@
6091
6330
  </xsl:for-each>
6092
6331
  </fo:bookmark>
6093
6332
  </xsl:if>
6333
+
6334
+
6335
+ <xsl:if test="$contents_nodes//tables/table">
6336
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6337
+
6338
+
6339
+
6340
+ <xsl:variable name="bookmark-title">
6341
+
6342
+ <xsl:value-of select="$title-list-tables"/>
6343
+
6344
+ </xsl:variable>
6345
+
6346
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
6347
+
6348
+ <xsl:for-each select="$contents_nodes//tables/table">
6349
+ <fo:bookmark internal-destination="{@id}">
6350
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6351
+ </fo:bookmark>
6352
+ </xsl:for-each>
6353
+ </fo:bookmark>
6354
+ </xsl:if>
6355
+
6094
6356
  </xsl:template><xsl:template name="getLangVersion">
6095
6357
  <xsl:param name="lang"/>
6096
6358
  <xsl:param name="doctype" select="''"/>
@@ -6315,7 +6577,51 @@
6315
6577
  <xsl:with-param name="text" select="$text_step1"/>
6316
6578
  </xsl:call-template>
6317
6579
  </xsl:variable>
6318
- <xsl:value-of select="$text_step2"/>
6580
+
6581
+ <!-- <xsl:value-of select="$text_step2"/> -->
6582
+
6583
+ <!-- add zero-width space after space -->
6584
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6585
+
6586
+ <!-- split text by zero-width space -->
6587
+ <xsl:variable name="text_step4">
6588
+ <xsl:call-template name="split">
6589
+ <xsl:with-param name="pText" select="$text_step3"/>
6590
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6591
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6592
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6593
+ </xsl:call-template>
6594
+ </xsl:variable>
6595
+
6596
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6597
+ <xsl:choose>
6598
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6599
+ <xsl:call-template name="interspers">
6600
+ <xsl:with-param name="str" select="."/>
6601
+ </xsl:call-template>
6602
+ </xsl:when>
6603
+ <xsl:otherwise>
6604
+ <xsl:value-of select="."/>
6605
+ </xsl:otherwise>
6606
+ </xsl:choose>
6607
+ </xsl:for-each>
6608
+
6609
+ </xsl:template><xsl:template name="interspers">
6610
+ <xsl:param name="str"/>
6611
+ <xsl:param name="char" select="$zero_width_space"/>
6612
+ <xsl:if test="$str != ''">
6613
+ <xsl:value-of select="substring($str, 1, 1)"/>
6614
+
6615
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6616
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6617
+ <xsl:value-of select="$char"/>
6618
+ </xsl:if>
6619
+
6620
+ <xsl:call-template name="interspers">
6621
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6622
+ <xsl:with-param name="char" select="$char"/>
6623
+ </xsl:call-template>
6624
+ </xsl:if>
6319
6625
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6320
6626
  <xsl:apply-templates mode="syntax_highlight"/>
6321
6627
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6752,6 +7058,8 @@
6752
7058
  </xsl:otherwise>
6753
7059
  </xsl:choose> -->
6754
7060
  </fo:block>
7061
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7062
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6755
7063
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6756
7064
  <xsl:if test="normalize-space() != ''">
6757
7065
  <xsl:value-of select="."/>
@@ -6826,26 +7134,24 @@
6826
7134
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6827
7135
  <xsl:text>— </xsl:text>
6828
7136
  <xsl:apply-templates/>
6829
- </xsl:template><xsl:variable name="bibitem_hidden_">
7137
+ </xsl:template><xsl:variable name="bibitems_">
7138
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7139
+ <xsl:copy-of select="."/>
7140
+ </xsl:for-each>
7141
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
6830
7142
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6831
7143
  <xsl:copy-of select="."/>
6832
7144
  </xsl:for-each>
6833
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
7145
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
6834
7146
  <xsl:copy-of select="."/>
6835
7147
  </xsl:for-each>
6836
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6837
-
6838
- <xsl:variable name="bibitemid">
6839
- <xsl:choose>
6840
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6841
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6842
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6843
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6844
- </xsl:choose>
6845
- </xsl:variable>
6846
-
7148
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7149
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7150
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7151
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
6847
7152
  <xsl:choose>
6848
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
7153
+ <!-- <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) -->
7154
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
6849
7155
  <fo:inline xsl:use-attribute-sets="eref-style">
6850
7156
  <xsl:if test="@type = 'footnote'">
6851
7157
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6859,8 +7165,8 @@
6859
7165
  <xsl:variable name="text" select="normalize-space()"/>
6860
7166
 
6861
7167
 
6862
-
6863
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7168
+
7169
+ <fo:basic-link fox:alt-text="{@citeas}">
6864
7170
  <xsl:if test="normalize-space(@citeas) = ''">
6865
7171
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6866
7172
  </xsl:if>
@@ -6870,14 +7176,21 @@
6870
7176
 
6871
7177
  </xsl:if>
6872
7178
 
6873
-
7179
+ <xsl:choose>
7180
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
7181
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
7182
+ </xsl:when>
7183
+ <xsl:otherwise>
7184
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7185
+ </xsl:otherwise>
7186
+ </xsl:choose>
6874
7187
 
6875
7188
  <xsl:apply-templates/>
6876
7189
  </fo:basic-link>
6877
-
7190
+
6878
7191
  </fo:inline>
6879
7192
  </xsl:when>
6880
- <xsl:otherwise>
7193
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6881
7194
  <fo:inline><xsl:apply-templates/></fo:inline>
6882
7195
  </xsl:otherwise>
6883
7196
  </xsl:choose>
@@ -7211,7 +7524,7 @@
7211
7524
 
7212
7525
 
7213
7526
 
7214
-
7527
+
7215
7528
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7216
7529
  </fo:list-block>
7217
7530
  <!-- <xsl:for-each select="./iho:note">
@@ -7229,6 +7542,11 @@
7229
7542
 
7230
7543
 
7231
7544
 
7545
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7546
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7547
+ <xsl:call-template name="append_add-style"/>
7548
+ </xsl:if>
7549
+
7232
7550
  <xsl:call-template name="getListItemFormat"/>
7233
7551
  </fo:block>
7234
7552
  </fo:list-item-label>
@@ -7598,27 +7916,47 @@
7598
7916
  <xsl:apply-templates/>
7599
7917
  </fo:inline>
7600
7918
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7919
+
7920
+ <!-- list of footnotes to calculate actual footnotes number -->
7921
+ <xsl:variable name="p_fn_">
7922
+ <xsl:call-template name="get_fn_list"/>
7923
+ </xsl:variable>
7924
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7925
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7926
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7927
+ <!-- fn sequence number in document -->
7928
+ <xsl:variable name="current_fn_number">
7929
+ <xsl:choose>
7930
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7931
+ <xsl:otherwise>
7932
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7933
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7934
+ </xsl:otherwise>
7935
+ </xsl:choose>
7936
+ </xsl:variable>
7601
7937
  <fo:footnote>
7602
7938
  <xsl:variable name="number">
7603
7939
 
7604
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7940
+ <xsl:value-of select="$current_fn_number"/>
7605
7941
 
7606
7942
  </xsl:variable>
7607
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7608
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7609
- <xsl:value-of select="$number"/>
7610
-
7943
+
7944
+ <xsl:variable name="current_fn_number_text">
7945
+ <xsl:value-of select="$number"/>
7946
+
7611
7947
  <xsl:text>)</xsl:text>
7612
7948
 
7949
+ </xsl:variable>
7950
+
7951
+ <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7952
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7953
+ <xsl:value-of select="$current_fn_number_text"/>
7613
7954
  </fo:basic-link>
7614
7955
  </fo:inline>
7615
7956
  <fo:footnote-body>
7616
7957
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7617
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7618
- <xsl:value-of select="$number"/>
7619
-
7620
- <xsl:text>)</xsl:text>
7621
-
7958
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7959
+ <xsl:value-of select="$current_fn_number_text"/>
7622
7960
  </fo:inline>
7623
7961
  <xsl:apply-templates/>
7624
7962
  </fo:block>
@@ -7853,7 +8191,141 @@
7853
8191
  <!-- processing for admonition/p found in the template for 'p' -->
7854
8192
  <xsl:call-template name="paragraph"/>
7855
8193
 
7856
- </xsl:template><xsl:template name="convertDate">
8194
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
8195
+ <xsl:copy>
8196
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
8197
+ </xsl:copy>
8198
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
8199
+ <xsl:copy>
8200
+ <xsl:copy-of select="@*"/>
8201
+
8202
+ <xsl:variable name="nodes_preface_">
8203
+ <xsl:for-each select="*">
8204
+ <node id="{@id}"/>
8205
+ </xsl:for-each>
8206
+ </xsl:variable>
8207
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
8208
+
8209
+ <xsl:for-each select="*">
8210
+ <xsl:sort select="@displayorder" data-type="number"/>
8211
+
8212
+ <!-- process Section's title -->
8213
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8214
+ <xsl:if test="$preceding-sibling_id != ''">
8215
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8216
+ </xsl:if>
8217
+
8218
+ <xsl:choose>
8219
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8220
+ <xsl:otherwise>
8221
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8222
+ </xsl:otherwise>
8223
+ </xsl:choose>
8224
+
8225
+ </xsl:for-each>
8226
+ </xsl:copy>
8227
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
8228
+ <xsl:copy>
8229
+ <xsl:copy-of select="@*"/>
8230
+
8231
+ <xsl:variable name="nodes_sections_">
8232
+ <xsl:for-each select="*">
8233
+ <node id="{@id}"/>
8234
+ </xsl:for-each>
8235
+ </xsl:variable>
8236
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
8237
+
8238
+ <!-- move section 'Normative references' inside 'sections' -->
8239
+ <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']]">
8240
+ <xsl:sort select="@displayorder" data-type="number"/>
8241
+
8242
+ <!-- process Section's title -->
8243
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8244
+ <xsl:if test="$preceding-sibling_id != ''">
8245
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8246
+ </xsl:if>
8247
+
8248
+ <xsl:choose>
8249
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8250
+ <xsl:otherwise>
8251
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8252
+ </xsl:otherwise>
8253
+ </xsl:choose>
8254
+
8255
+ </xsl:for-each>
8256
+ </xsl:copy>
8257
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8258
+ <xsl:copy>
8259
+ <xsl:copy-of select="@*"/>
8260
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8261
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8262
+ <xsl:sort select="@displayorder" data-type="number"/>
8263
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8264
+ </xsl:for-each>
8265
+ </xsl:copy>
8266
+ </xsl:template>
8267
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8268
+ <xsl:template match="@*|node()" mode="update_xml_step2">
8269
+ <xsl:copy>
8270
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step2"/>
8271
+ </xsl:copy>
8272
+ </xsl:template>
8273
+
8274
+ <xsl:variable name="localized_string_withdrawn">
8275
+ <xsl:call-template name="getLocalizedString">
8276
+ <xsl:with-param name="key">withdrawn</xsl:with-param>
8277
+ </xsl:call-template>
8278
+ </xsl:variable>
8279
+ <xsl:variable name="localized_string_cancelled_and_replaced">
8280
+ <xsl:variable name="str">
8281
+ <xsl:call-template name="getLocalizedString">
8282
+ <xsl:with-param name="key">cancelled_and_replaced</xsl:with-param>
8283
+ </xsl:call-template>
8284
+ </xsl:variable>
8285
+ <xsl:choose>
8286
+ <xsl:when test="contains($str, '%')"><xsl:value-of select="substring-before($str, '%')"/></xsl:when>
8287
+ <xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
8288
+ </xsl:choose>
8289
+ </xsl:variable>
8290
+
8291
+ <!-- add 'fn' after eref and origin, to reference bibitem with note = 'Withdrawn.' or 'Cancelled and replaced...' -->
8292
+ <xsl:template match="*[local-name() = 'eref'] | *[local-name() = 'origin']" mode="update_xml_step2">
8293
+ <xsl:copy-of select="."/>
8294
+
8295
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
8296
+ <xsl:variable name="local_name" select="local-name()"/>
8297
+ <xsl:variable name="position"><xsl:number count="*[local-name() = $local_name][@bibitemid = $bibitemid]" level="any"/></xsl:variable>
8298
+ <xsl:if test="normalize-space($position) = '1'">
8299
+ <xsl:variable name="fn_text">
8300
+ <!-- <xsl:copy-of select="key('bibitems', $bibitemid)[1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()" /> -->
8301
+ <xsl:copy-of select="$bibitems/*[local-name() ='bibitem'][@id = $bibitemid][1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()"/>
8302
+ </xsl:variable>
8303
+ <xsl:if test="normalize-space($fn_text) != ''">
8304
+ <xsl:element name="fn" namespace="{$namespace_full}">
8305
+ <xsl:attribute name="reference">bibitem_<xsl:value-of select="$bibitemid"/></xsl:attribute>
8306
+ <xsl:element name="p" namespace="{$namespace_full}">
8307
+ <xsl:copy-of select="$fn_text"/>
8308
+ </xsl:element>
8309
+ </xsl:element>
8310
+ </xsl:if>
8311
+ </xsl:if>
8312
+ </xsl:template>
8313
+
8314
+ <!-- add @reference for bibitem/note, similar to fn/reference -->
8315
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="update_xml_step2">
8316
+ <xsl:copy>
8317
+ <xsl:apply-templates select="@*" mode="update_xml_step2"/>
8318
+
8319
+ <xsl:attribute name="reference">
8320
+ <xsl:value-of select="concat('bibitem_', ../@id, '_', count(preceding-sibling::*[local-name() = 'note']))"/>
8321
+ </xsl:attribute>
8322
+
8323
+ <xsl:apply-templates select="node()" mode="update_xml_step2"/>
8324
+ </xsl:copy>
8325
+ </xsl:template>
8326
+
8327
+ <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8328
+ <xsl:template name="convertDate">
7857
8329
  <xsl:param name="date"/>
7858
8330
  <xsl:param name="format" select="'short'"/>
7859
8331
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -8097,22 +8569,25 @@
8097
8569
  <xsl:param name="pText" select="."/>
8098
8570
  <xsl:param name="sep" select="','"/>
8099
8571
  <xsl:param name="normalize-space" select="'true'"/>
8572
+ <xsl:param name="keep_sep" select="'false'"/>
8100
8573
  <xsl:if test="string-length($pText) &gt;0">
8101
- <item>
8102
- <xsl:choose>
8103
- <xsl:when test="$normalize-space = 'true'">
8104
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8105
- </xsl:when>
8106
- <xsl:otherwise>
8107
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8108
- </xsl:otherwise>
8109
- </xsl:choose>
8110
- </item>
8111
- <xsl:call-template name="split">
8112
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8113
- <xsl:with-param name="sep" select="$sep"/>
8114
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8115
- </xsl:call-template>
8574
+ <item>
8575
+ <xsl:choose>
8576
+ <xsl:when test="$normalize-space = 'true'">
8577
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8578
+ </xsl:when>
8579
+ <xsl:otherwise>
8580
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8581
+ </xsl:otherwise>
8582
+ </xsl:choose>
8583
+ </item>
8584
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8585
+ <xsl:call-template name="split">
8586
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8587
+ <xsl:with-param name="sep" select="$sep"/>
8588
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8589
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8590
+ </xsl:call-template>
8116
8591
  </xsl:if>
8117
8592
  </xsl:template><xsl:template name="getDocumentId">
8118
8593
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
@@ -8303,53 +8778,153 @@
8303
8778
  <xsl:param name="first"/>
8304
8779
  <xsl:if test="$number != ''">
8305
8780
  <xsl:variable name="words">
8306
- <words>
8307
- <word cardinal="1">One-</word>
8308
- <word ordinal="1">First </word>
8309
- <word cardinal="2">Two-</word>
8310
- <word ordinal="2">Second </word>
8311
- <word cardinal="3">Three-</word>
8312
- <word ordinal="3">Third </word>
8313
- <word cardinal="4">Four-</word>
8314
- <word ordinal="4">Fourth </word>
8315
- <word cardinal="5">Five-</word>
8316
- <word ordinal="5">Fifth </word>
8317
- <word cardinal="6">Six-</word>
8318
- <word ordinal="6">Sixth </word>
8319
- <word cardinal="7">Seven-</word>
8320
- <word ordinal="7">Seventh </word>
8321
- <word cardinal="8">Eight-</word>
8322
- <word ordinal="8">Eighth </word>
8323
- <word cardinal="9">Nine-</word>
8324
- <word ordinal="9">Ninth </word>
8325
- <word ordinal="10">Tenth </word>
8326
- <word ordinal="11">Eleventh </word>
8327
- <word ordinal="12">Twelfth </word>
8328
- <word ordinal="13">Thirteenth </word>
8329
- <word ordinal="14">Fourteenth </word>
8330
- <word ordinal="15">Fifteenth </word>
8331
- <word ordinal="16">Sixteenth </word>
8332
- <word ordinal="17">Seventeenth </word>
8333
- <word ordinal="18">Eighteenth </word>
8334
- <word ordinal="19">Nineteenth </word>
8335
- <word cardinal="20">Twenty-</word>
8336
- <word ordinal="20">Twentieth </word>
8337
- <word cardinal="30">Thirty-</word>
8338
- <word ordinal="30">Thirtieth </word>
8339
- <word cardinal="40">Forty-</word>
8340
- <word ordinal="40">Fortieth </word>
8341
- <word cardinal="50">Fifty-</word>
8342
- <word ordinal="50">Fiftieth </word>
8343
- <word cardinal="60">Sixty-</word>
8344
- <word ordinal="60">Sixtieth </word>
8345
- <word cardinal="70">Seventy-</word>
8346
- <word ordinal="70">Seventieth </word>
8347
- <word cardinal="80">Eighty-</word>
8348
- <word ordinal="80">Eightieth </word>
8349
- <word cardinal="90">Ninety-</word>
8350
- <word ordinal="90">Ninetieth </word>
8351
- <word cardinal="100">Hundred-</word>
8352
- <word ordinal="100">Hundredth </word>
8781
+ <words>
8782
+ <xsl:choose>
8783
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8784
+ <word cardinal="1">Une-</word>
8785
+ <word ordinal="1">Première </word>
8786
+ <word cardinal="2">Deux-</word>
8787
+ <word ordinal="2">Seconde </word>
8788
+ <word cardinal="3">Trois-</word>
8789
+ <word ordinal="3">Tierce </word>
8790
+ <word cardinal="4">Quatre-</word>
8791
+ <word ordinal="4">Quatrième </word>
8792
+ <word cardinal="5">Cinq-</word>
8793
+ <word ordinal="5">Cinquième </word>
8794
+ <word cardinal="6">Six-</word>
8795
+ <word ordinal="6">Sixième </word>
8796
+ <word cardinal="7">Sept-</word>
8797
+ <word ordinal="7">Septième </word>
8798
+ <word cardinal="8">Huit-</word>
8799
+ <word ordinal="8">Huitième </word>
8800
+ <word cardinal="9">Neuf-</word>
8801
+ <word ordinal="9">Neuvième </word>
8802
+ <word ordinal="10">Dixième </word>
8803
+ <word ordinal="11">Onzième </word>
8804
+ <word ordinal="12">Douzième </word>
8805
+ <word ordinal="13">Treizième </word>
8806
+ <word ordinal="14">Quatorzième </word>
8807
+ <word ordinal="15">Quinzième </word>
8808
+ <word ordinal="16">Seizième </word>
8809
+ <word ordinal="17">Dix-septième </word>
8810
+ <word ordinal="18">Dix-huitième </word>
8811
+ <word ordinal="19">Dix-neuvième </word>
8812
+ <word cardinal="20">Vingt-</word>
8813
+ <word ordinal="20">Vingtième </word>
8814
+ <word cardinal="30">Trente-</word>
8815
+ <word ordinal="30">Trentième </word>
8816
+ <word cardinal="40">Quarante-</word>
8817
+ <word ordinal="40">Quarantième </word>
8818
+ <word cardinal="50">Cinquante-</word>
8819
+ <word ordinal="50">Cinquantième </word>
8820
+ <word cardinal="60">Soixante-</word>
8821
+ <word ordinal="60">Soixantième </word>
8822
+ <word cardinal="70">Septante-</word>
8823
+ <word ordinal="70">Septantième </word>
8824
+ <word cardinal="80">Huitante-</word>
8825
+ <word ordinal="80">Huitantième </word>
8826
+ <word cardinal="90">Nonante-</word>
8827
+ <word ordinal="90">Nonantième </word>
8828
+ <word cardinal="100">Cent-</word>
8829
+ <word ordinal="100">Centième </word>
8830
+ </xsl:when>
8831
+ <xsl:when test="$lang = 'ru'">
8832
+ <word cardinal="1">Одна-</word>
8833
+ <word ordinal="1">Первое </word>
8834
+ <word cardinal="2">Две-</word>
8835
+ <word ordinal="2">Второе </word>
8836
+ <word cardinal="3">Три-</word>
8837
+ <word ordinal="3">Третье </word>
8838
+ <word cardinal="4">Четыре-</word>
8839
+ <word ordinal="4">Четвертое </word>
8840
+ <word cardinal="5">Пять-</word>
8841
+ <word ordinal="5">Пятое </word>
8842
+ <word cardinal="6">Шесть-</word>
8843
+ <word ordinal="6">Шестое </word>
8844
+ <word cardinal="7">Семь-</word>
8845
+ <word ordinal="7">Седьмое </word>
8846
+ <word cardinal="8">Восемь-</word>
8847
+ <word ordinal="8">Восьмое </word>
8848
+ <word cardinal="9">Девять-</word>
8849
+ <word ordinal="9">Девятое </word>
8850
+ <word ordinal="10">Десятое </word>
8851
+ <word ordinal="11">Одиннадцатое </word>
8852
+ <word ordinal="12">Двенадцатое </word>
8853
+ <word ordinal="13">Тринадцатое </word>
8854
+ <word ordinal="14">Четырнадцатое </word>
8855
+ <word ordinal="15">Пятнадцатое </word>
8856
+ <word ordinal="16">Шестнадцатое </word>
8857
+ <word ordinal="17">Семнадцатое </word>
8858
+ <word ordinal="18">Восемнадцатое </word>
8859
+ <word ordinal="19">Девятнадцатое </word>
8860
+ <word cardinal="20">Двадцать-</word>
8861
+ <word ordinal="20">Двадцатое </word>
8862
+ <word cardinal="30">Тридцать-</word>
8863
+ <word ordinal="30">Тридцатое </word>
8864
+ <word cardinal="40">Сорок-</word>
8865
+ <word ordinal="40">Сороковое </word>
8866
+ <word cardinal="50">Пятьдесят-</word>
8867
+ <word ordinal="50">Пятидесятое </word>
8868
+ <word cardinal="60">Шестьдесят-</word>
8869
+ <word ordinal="60">Шестидесятое </word>
8870
+ <word cardinal="70">Семьдесят-</word>
8871
+ <word ordinal="70">Семидесятое </word>
8872
+ <word cardinal="80">Восемьдесят-</word>
8873
+ <word ordinal="80">Восьмидесятое </word>
8874
+ <word cardinal="90">Девяносто-</word>
8875
+ <word ordinal="90">Девяностое </word>
8876
+ <word cardinal="100">Сто-</word>
8877
+ <word ordinal="100">Сотое </word>
8878
+ </xsl:when>
8879
+ <xsl:otherwise> <!-- default english -->
8880
+ <word cardinal="1">One-</word>
8881
+ <word ordinal="1">First </word>
8882
+ <word cardinal="2">Two-</word>
8883
+ <word ordinal="2">Second </word>
8884
+ <word cardinal="3">Three-</word>
8885
+ <word ordinal="3">Third </word>
8886
+ <word cardinal="4">Four-</word>
8887
+ <word ordinal="4">Fourth </word>
8888
+ <word cardinal="5">Five-</word>
8889
+ <word ordinal="5">Fifth </word>
8890
+ <word cardinal="6">Six-</word>
8891
+ <word ordinal="6">Sixth </word>
8892
+ <word cardinal="7">Seven-</word>
8893
+ <word ordinal="7">Seventh </word>
8894
+ <word cardinal="8">Eight-</word>
8895
+ <word ordinal="8">Eighth </word>
8896
+ <word cardinal="9">Nine-</word>
8897
+ <word ordinal="9">Ninth </word>
8898
+ <word ordinal="10">Tenth </word>
8899
+ <word ordinal="11">Eleventh </word>
8900
+ <word ordinal="12">Twelfth </word>
8901
+ <word ordinal="13">Thirteenth </word>
8902
+ <word ordinal="14">Fourteenth </word>
8903
+ <word ordinal="15">Fifteenth </word>
8904
+ <word ordinal="16">Sixteenth </word>
8905
+ <word ordinal="17">Seventeenth </word>
8906
+ <word ordinal="18">Eighteenth </word>
8907
+ <word ordinal="19">Nineteenth </word>
8908
+ <word cardinal="20">Twenty-</word>
8909
+ <word ordinal="20">Twentieth </word>
8910
+ <word cardinal="30">Thirty-</word>
8911
+ <word ordinal="30">Thirtieth </word>
8912
+ <word cardinal="40">Forty-</word>
8913
+ <word ordinal="40">Fortieth </word>
8914
+ <word cardinal="50">Fifty-</word>
8915
+ <word ordinal="50">Fiftieth </word>
8916
+ <word cardinal="60">Sixty-</word>
8917
+ <word ordinal="60">Sixtieth </word>
8918
+ <word cardinal="70">Seventy-</word>
8919
+ <word ordinal="70">Seventieth </word>
8920
+ <word cardinal="80">Eighty-</word>
8921
+ <word ordinal="80">Eightieth </word>
8922
+ <word cardinal="90">Ninety-</word>
8923
+ <word ordinal="90">Ninetieth </word>
8924
+ <word cardinal="100">Hundred-</word>
8925
+ <word ordinal="100">Hundredth </word>
8926
+ </xsl:otherwise>
8927
+ </xsl:choose>
8353
8928
  </words>
8354
8929
  </xsl:variable>
8355
8930
 
@@ -8423,4 +8998,18 @@
8423
8998
  <xsl:otherwise>_</xsl:otherwise>
8424
8999
  </xsl:choose>
8425
9000
  </xsl:attribute>
9001
+ </xsl:template><xsl:template name="substring-after-last">
9002
+ <xsl:param name="value"/>
9003
+ <xsl:param name="delimiter"/>
9004
+ <xsl:choose>
9005
+ <xsl:when test="contains($value, $delimiter)">
9006
+ <xsl:call-template name="substring-after-last">
9007
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
9008
+ <xsl:with-param name="delimiter" select="$delimiter"/>
9009
+ </xsl:call-template>
9010
+ </xsl:when>
9011
+ <xsl:otherwise>
9012
+ <xsl:value-of select="$value"/>
9013
+ </xsl:otherwise>
9014
+ </xsl:choose>
8426
9015
  </xsl:template></xsl:stylesheet>