metanorma-iec 1.3.3 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,8 +18,8 @@ module IsoDoc
18
18
  s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
19
19
  @meta.get[:doctype] == "Amendment" or
20
20
  s.div **attr_code(class: "boilerplate_legal") do |s1|
21
- b&.elements&.each { |e| parse(e, s1) }
22
- end
21
+ b&.elements&.each { |e| parse(e, s1) }
22
+ end
23
23
  f&.elements&.each { |e| parse(e, s) unless e.name == "title" }
24
24
  end
25
25
  end
@@ -40,12 +40,12 @@ module IsoDoc
40
40
  @meta.get[:doctitlepartlabel] and
41
41
  title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}"
42
42
  end
43
- out.p(**{ class: "zzSTDTitle1" }) do |p|
43
+ out.p(**{ class: "zzSTDTitle1" }) do |p|
44
44
  p.b { |b| b << title1 }
45
45
  end
46
46
  if @meta.get[:doctitlepart]
47
47
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
48
- out.p(**{ class: "zzSTDTitle2" }) do |p|
48
+ out.p(**{ class: "zzSTDTitle2" }) do |p|
49
49
  p.b { |b| b << title2 }
50
50
  end
51
51
  end
@@ -58,7 +58,7 @@ module IsoDoc
58
58
 
59
59
  def biblio_list(f, div, biblio)
60
60
  return super unless @is_iev
61
- i = 0
61
+
62
62
  f.children.each do |b|
63
63
  parse(b, div) unless %w(title bibitem).include? b.name
64
64
  end
@@ -66,6 +66,7 @@ module IsoDoc
66
66
 
67
67
  def terms_parse(node, out)
68
68
  return super unless @is_iev
69
+
69
70
  page_break(out)
70
71
  out.div **attr_code(id: node["id"]) do |div|
71
72
  out.p(**{ class: "zzSTDTitle2" }) do |p|
@@ -81,12 +82,14 @@ module IsoDoc
81
82
 
82
83
  def termref_cleanup(docxml)
83
84
  return super unless @is_iev
84
- docxml.
85
- gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ").
86
- gsub(/\[TERMREF\]\s*/, l10n("#{@i18n.source}: ")).
87
- gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@i18n.modified} [/TERMREF]")).
88
- gsub(/\s*\[\/TERMREF\]\s*/, l10n("")).
89
- gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} &mdash; "))
85
+
86
+ docxml
87
+ .gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
88
+ .gsub(/\[TERMREF\]\s*/, l10n("#{@i18n.source}: "))
89
+ .gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
90
+ l10n(", #{@i18n.modified} [/TERMREF]"))
91
+ .gsub(/\s*\[\/TERMREF\]\s*/, l10n(""))
92
+ .gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} &mdash; "))
90
93
  end
91
94
 
92
95
  def set_termdomain(termdomain)
@@ -95,13 +98,15 @@ module IsoDoc
95
98
 
96
99
  def term_suffix(node, out)
97
100
  return unless @is_iev
101
+
98
102
  domain = node&.at(ns("../domain"))&.text
99
103
  return unless domain
104
+
100
105
  out << ", &lt;#{domain}&gt;"
101
106
  end
102
107
 
103
108
  def deprecated_term_parse(node, out)
104
- out.p **{ class: "DeprecatedTerms", style:"text-align:left;" } do |p|
109
+ out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
105
110
  p << l10n("#{@i18n.deprecated}: ")
106
111
  node.children.each { |c| parse(c, p) }
107
112
  term_suffix(node, p)
@@ -109,7 +114,7 @@ module IsoDoc
109
114
  end
110
115
 
111
116
  def admitted_term_parse(node, out)
112
- out.p **{ class: "AltTerms", style:"text-align:left;" } do |p|
117
+ out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
113
118
  node.children.each { |c| parse(c, p) }
114
119
  term_suffix(node, p)
115
120
  end
@@ -117,7 +122,8 @@ module IsoDoc
117
122
 
118
123
  def term_parse(node, out)
119
124
  return super unless @is_iev
120
- out.p **{ class: "Terms", style:"text-align:left;" } do |p|
125
+
126
+ out.p **{ class: "Terms", style: "text-align:left;" } do |p|
121
127
  node.children.each { |c| parse(c, p) }
122
128
  term_suffix(node, p)
123
129
  end
@@ -14,14 +14,14 @@ module IsoDoc
14
14
  def default_fonts(options)
15
15
  {
16
16
  bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : '"Arial",sans-serif'),
17
- headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Arial",sans-serif'),
18
- monospacefont: ('"Courier New",monospace'),
19
- monospacefontsize: "1.0em",
20
- footnotefontsize: "0.9em",
17
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Arial",sans-serif'),
18
+ monospacefont: '"Courier New",monospace',
19
+ monospacefontsize: "1.0em",
20
+ footnotefontsize: "0.9em",
21
21
  }
22
22
  end
23
23
 
24
- def default_file_locations(options)
24
+ def default_file_locations(_options)
25
25
  @libdir = File.dirname(__FILE__)
26
26
  {
27
27
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
@@ -30,7 +30,7 @@ module IsoDoc
30
30
  }
31
31
  end
32
32
 
33
- def htmlstyle(docxml)
33
+ def htmlstyle(_docxml)
34
34
  docxml = super
35
35
  b = docxml.at("div[@class = 'boilerplate_legal']/ol")
36
36
  b and b["type"] = "1"
@@ -20,8 +20,12 @@
20
20
 
21
21
 
22
22
  <xsl:variable name="debug">false</xsl:variable>
23
- <xsl:variable name="pageWidth" select="'210mm'"/>
24
- <xsl:variable name="pageHeight" select="'297mm'"/>
23
+ <xsl:variable name="pageWidth" select="210"/>
24
+ <xsl:variable name="pageHeight" select="297"/>
25
+ <xsl:variable name="marginLeftRight1" select="25"/>
26
+ <xsl:variable name="marginLeftRight2" select="25"/>
27
+ <xsl:variable name="marginTop" select="31"/>
28
+ <xsl:variable name="marginBottom" select="15"/>
25
29
 
26
30
  <xsl:variable name="copyrightText" select="concat('© ', //iec:iec-standard/iec:bibdata/iec:copyright/iec:owner/iec:organization/iec:abbreviation, ':', //iec:iec-standard/iec:bibdata/iec:copyright/iec:from)"/>
27
31
  <!-- <xsl:variable name="lang-1st-letter" select="concat('(', translate(substring(iec:iec-standard/iec:bibdata/iec:language,1,1),$lower, $upper), ')')"/> -->
@@ -160,14 +164,14 @@
160
164
  <fo:root font-family="Arial, Times New Roman, STIX Two Math, Source Han Sans" font-size="10pt" xml:lang="{$lang}">
161
165
  <fo:layout-master-set>
162
166
  <!-- cover pages -->
163
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
167
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
164
168
  <fo:region-body margin-top="17.5mm" margin-bottom="12.5mm" margin-left="18mm" margin-right="20.5mm"/>
165
169
  <fo:region-before region-name="header" extent="17.5mm"/>
166
170
  <fo:region-after region-name="footer" extent="12.5mm" precedence="true"/>
167
171
  <fo:region-start region-name="left-region" extent="18mm"/>
168
172
  <fo:region-end region-name="right-region" extent="20.5mm"/>
169
173
  </fo:simple-page-master>
170
- <fo:simple-page-master master-name="cover_2nd" page-width="{$pageWidth}" page-height="{$pageHeight}">
174
+ <fo:simple-page-master master-name="cover_2nd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
171
175
  <fo:region-body margin-top="17.5mm" margin-bottom="12.5mm" margin-left="25mm" margin-right="25mm" column-count="2" column-gap="5mm"/>
172
176
  <fo:region-before region-name="header" extent="17.5mm"/>
173
177
  <fo:region-after region-name="footer" extent="12.5mm" precedence="true"/>
@@ -175,7 +179,7 @@
175
179
  <fo:region-end region-name="right-region" extent="25mm"/>
176
180
  </fo:simple-page-master>
177
181
 
178
- <fo:simple-page-master master-name="cover-FDIS" page-width="{$pageWidth}" page-height="{$pageHeight}">
182
+ <fo:simple-page-master master-name="cover-FDIS" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
179
183
  <fo:region-body margin-top="17.5mm" margin-bottom="29mm" margin-left="18mm" margin-right="19mm"/>
180
184
  <fo:region-before region-name="header" extent="17.5mm"/>
181
185
  <fo:region-after region-name="footer-FDIS" extent="29mm"/>
@@ -184,20 +188,20 @@
184
188
  </fo:simple-page-master>
185
189
 
186
190
  <!-- odd pages -->
187
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
188
- <fo:region-body margin-top="31mm" margin-bottom="15mm" margin-left="25mm" margin-right="25mm"/>
189
- <fo:region-before region-name="header-odd" extent="31mm"/>
190
- <fo:region-after region-name="footer" extent="15mm"/>
191
- <fo:region-start region-name="left-region" extent="25mm"/>
192
- <fo:region-end region-name="right-region" extent="25mm"/>
191
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
192
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
193
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
194
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
195
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
196
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
193
197
  </fo:simple-page-master>
194
198
  <!-- even pages -->
195
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
196
- <fo:region-body margin-top="31mm" margin-bottom="15mm" margin-left="25mm" margin-right="25mm"/>
197
- <fo:region-before region-name="header-even" extent="31mm"/>
198
- <fo:region-after region-name="footer" extent="15mm"/>
199
- <fo:region-start region-name="left-region" extent="25mm"/>
200
- <fo:region-end region-name="right-region" extent="25mm"/>
199
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
200
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
201
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
202
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
203
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
204
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
201
205
  </fo:simple-page-master>
202
206
  <fo:page-sequence-master master-name="document">
203
207
  <fo:repeatable-page-master-alternatives>
@@ -206,11 +210,11 @@
206
210
  </fo:repeatable-page-master-alternatives>
207
211
  </fo:page-sequence-master>
208
212
 
209
- <fo:simple-page-master master-name="blank-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
213
+ <fo:simple-page-master master-name="blank-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
210
214
  <fo:region-body margin-top="107mm" margin-bottom="0mm" margin-left="18mm" margin-right="0mm"/>
211
215
  </fo:simple-page-master>
212
216
 
213
- <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
217
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
214
218
  <fo:region-body margin-top="107mm" margin-bottom="0mm" margin-left="18mm" margin-right="0mm" background-color="rgb(236, 236, 236)"/>
215
219
  <fo:region-before region-name="header" extent="107mm"/>
216
220
  <fo:region-start region-name="left-region" extent="18mm"/>
@@ -2645,6 +2649,7 @@
2645
2649
 
2646
2650
 
2647
2651
 
2652
+
2648
2653
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2649
2654
  <xsl:attribute name="white-space">pre</xsl:attribute>
2650
2655
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2693,7 +2698,7 @@
2693
2698
 
2694
2699
 
2695
2700
 
2696
-
2701
+
2697
2702
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2698
2703
 
2699
2704
 
@@ -2706,6 +2711,7 @@
2706
2711
 
2707
2712
 
2708
2713
 
2714
+
2709
2715
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2710
2716
 
2711
2717
 
@@ -2724,9 +2730,7 @@
2724
2730
 
2725
2731
 
2726
2732
 
2727
-
2728
-
2729
-
2733
+
2730
2734
 
2731
2735
 
2732
2736
 
@@ -2753,6 +2757,7 @@
2753
2757
 
2754
2758
 
2755
2759
 
2760
+
2756
2761
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2757
2762
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2758
2763
 
@@ -2773,6 +2778,9 @@
2773
2778
 
2774
2779
 
2775
2780
 
2781
+
2782
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2783
+
2776
2784
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2777
2785
 
2778
2786
 
@@ -2793,11 +2801,14 @@
2793
2801
 
2794
2802
 
2795
2803
 
2804
+
2796
2805
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2797
2806
 
2798
2807
 
2799
2808
 
2800
2809
 
2810
+
2811
+
2801
2812
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2802
2813
 
2803
2814
 
@@ -2818,6 +2829,7 @@
2818
2829
 
2819
2830
 
2820
2831
 
2832
+
2821
2833
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
2822
2834
 
2823
2835
 
@@ -2861,10 +2873,12 @@
2861
2873
 
2862
2874
 
2863
2875
 
2876
+
2864
2877
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2865
2878
 
2866
2879
 
2867
2880
 
2881
+
2868
2882
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2869
2883
 
2870
2884
 
@@ -2897,10 +2911,12 @@
2897
2911
 
2898
2912
 
2899
2913
 
2914
+
2900
2915
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2901
2916
 
2902
2917
 
2903
2918
 
2919
+
2904
2920
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2905
2921
 
2906
2922
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -2925,6 +2941,7 @@
2925
2941
 
2926
2942
 
2927
2943
 
2944
+
2928
2945
 
2929
2946
 
2930
2947
 
@@ -2970,12 +2987,14 @@
2970
2987
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2971
2988
 
2972
2989
 
2990
+
2973
2991
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2974
2992
 
2975
2993
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2976
2994
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2977
2995
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2978
2996
 
2997
+
2979
2998
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2980
2999
 
2981
3000
 
@@ -3000,6 +3019,8 @@
3000
3019
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3001
3020
 
3002
3021
 
3022
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
3023
+
3003
3024
  </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:template name="processPrefaceSectionsDefault_Contents">
3004
3025
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3005
3026
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -3010,14 +3031,15 @@
3010
3031
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
3011
3032
 
3012
3033
  <!-- Normative references -->
3013
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
3034
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
3014
3035
  <!-- Terms and definitions -->
3015
3036
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
3016
3037
  <!-- Another main sections -->
3017
3038
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
3018
3039
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
3019
3040
  <!-- Bibliography -->
3020
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
3041
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
3042
+
3021
3043
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3022
3044
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
3023
3045
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -3053,11 +3075,11 @@
3053
3075
  <xsl:variable name="table">
3054
3076
 
3055
3077
  <xsl:variable name="simple-table">
3056
- <xsl:call-template name="getSimpleTable"/>
3078
+ <xsl:call-template name="getSimpleTable"/>
3057
3079
  </xsl:variable>
3058
3080
 
3059
3081
  <!-- <xsl:if test="$namespace = 'bipm'">
3060
- <fo:block>&#xA0;</fo:block>
3082
+ <fo:block>&#xA0;</fo:block>
3061
3083
  </xsl:if> -->
3062
3084
 
3063
3085
  <!-- $namespace = 'iso' or -->
@@ -3167,6 +3189,7 @@
3167
3189
 
3168
3190
 
3169
3191
 
3192
+
3170
3193
  </xsl:variable>
3171
3194
 
3172
3195
 
@@ -3308,6 +3331,9 @@
3308
3331
  <fo:block xsl:use-attribute-sets="table-name-style">
3309
3332
 
3310
3333
 
3334
+
3335
+
3336
+
3311
3337
  <xsl:choose>
3312
3338
  <xsl:when test="$continued = 'true'">
3313
3339
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -3455,6 +3481,7 @@
3455
3481
  <!-- font-weight="bold" -->
3456
3482
  <fo:table-header>
3457
3483
 
3484
+
3458
3485
  <xsl:apply-templates/>
3459
3486
  </fo:table-header>
3460
3487
  </xsl:template><xsl:template name="table-header-title">
@@ -3616,6 +3643,7 @@
3616
3643
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3617
3644
 
3618
3645
 
3646
+
3619
3647
  <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
3620
3648
 
3621
3649
 
@@ -3631,6 +3659,10 @@
3631
3659
 
3632
3660
 
3633
3661
 
3662
+
3663
+ <!-- for BSI (not PAS) display Notes before footnotes -->
3664
+
3665
+
3634
3666
  <!-- except gb -->
3635
3667
 
3636
3668
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -3662,6 +3694,10 @@
3662
3694
  <!-- fn processing -->
3663
3695
  <xsl:call-template name="fn_display"/>
3664
3696
 
3697
+
3698
+ <!-- for PAS display Notes after footnotes -->
3699
+
3700
+
3665
3701
  </fo:table-cell>
3666
3702
  </fo:table-row>
3667
3703
  </fo:table-body>
@@ -3722,6 +3758,7 @@
3722
3758
  <xsl:if test="$parent-name = 'tfoot'">
3723
3759
 
3724
3760
 
3761
+
3725
3762
  <xsl:attribute name="border-left">solid black 0.5pt</xsl:attribute>
3726
3763
  <xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>
3727
3764
 
@@ -3730,6 +3767,10 @@
3730
3767
 
3731
3768
 
3732
3769
 
3770
+
3771
+
3772
+
3773
+
3733
3774
  <!-- <xsl:if test="$namespace = 'bipm'">
3734
3775
  <xsl:attribute name="height">8mm</xsl:attribute>
3735
3776
  </xsl:if> -->
@@ -3767,6 +3808,7 @@
3767
3808
 
3768
3809
 
3769
3810
 
3811
+
3770
3812
  <xsl:if test="$lang = 'ar'">
3771
3813
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3772
3814
  </xsl:if>
@@ -3816,6 +3858,7 @@
3816
3858
 
3817
3859
 
3818
3860
 
3861
+
3819
3862
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3820
3863
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3821
3864
  </xsl:if>
@@ -3833,6 +3876,9 @@
3833
3876
 
3834
3877
 
3835
3878
 
3879
+
3880
+
3881
+
3836
3882
  <xsl:if test=".//*[local-name() = 'table']">
3837
3883
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3838
3884
  </xsl:if>
@@ -3859,14 +3905,20 @@
3859
3905
 
3860
3906
 
3861
3907
 
3908
+
3862
3909
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3863
3910
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3864
3911
 
3865
3912
 
3866
3913
 
3867
3914
 
3915
+
3916
+ <!-- Table's note name (NOTE, for example) -->
3917
+
3868
3918
  <fo:inline padding-right="2mm">
3869
3919
 
3920
+
3921
+
3870
3922
 
3871
3923
 
3872
3924
 
@@ -3874,6 +3926,8 @@
3874
3926
 
3875
3927
  </fo:inline>
3876
3928
 
3929
+
3930
+
3877
3931
  <xsl:apply-templates mode="process"/>
3878
3932
  </fo:block>
3879
3933
 
@@ -3893,6 +3947,8 @@
3893
3947
  <xsl:variable name="reference" select="@reference"/>
3894
3948
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3895
3949
  <fo:block margin-bottom="12pt">
3950
+
3951
+
3896
3952
 
3897
3953
 
3898
3954
 
@@ -3907,6 +3963,7 @@
3907
3963
 
3908
3964
 
3909
3965
 
3966
+
3910
3967
  <xsl:attribute name="baseline-shift">30%</xsl:attribute>
3911
3968
  <xsl:attribute name="font-size">70%</xsl:attribute>
3912
3969
 
@@ -3917,6 +3974,7 @@
3917
3974
  <xsl:value-of select="@reference"/>
3918
3975
 
3919
3976
 
3977
+
3920
3978
  </fo:inline>
3921
3979
  <fo:inline>
3922
3980
 
@@ -4061,6 +4119,8 @@
4061
4119
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4062
4120
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4063
4121
 
4122
+
4123
+
4064
4124
  <xsl:if test="ancestor::*[local-name()='td']">
4065
4125
  <xsl:attribute name="font-weight">normal</xsl:attribute>
4066
4126
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
@@ -4072,11 +4132,14 @@
4072
4132
 
4073
4133
 
4074
4134
 
4135
+
4136
+
4075
4137
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4076
4138
 
4077
4139
 
4078
4140
  <xsl:value-of select="@reference"/>
4079
4141
 
4142
+
4080
4143
  </fo:basic-link>
4081
4144
  </fo:inline>
4082
4145
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -4177,6 +4240,7 @@
4177
4240
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
4178
4241
 
4179
4242
 
4243
+
4180
4244
  <xsl:variable name="title-key">
4181
4245
 
4182
4246
 
@@ -4389,6 +4453,7 @@
4389
4453
 
4390
4454
  <fo:table-row>
4391
4455
 
4456
+
4392
4457
  <fo:table-cell>
4393
4458
 
4394
4459
  <fo:block margin-top="6pt">
@@ -4408,6 +4473,7 @@
4408
4473
 
4409
4474
 
4410
4475
 
4476
+
4411
4477
  <xsl:apply-templates/>
4412
4478
  <!-- <xsl:if test="$namespace = 'gb'">
4413
4479
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4464,6 +4530,8 @@
4464
4530
 
4465
4531
  <xsl:apply-templates/>
4466
4532
  </fo:inline>
4533
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4534
+ <fo:inline padding-right="{@value}"> </fo:inline>
4467
4535
  </xsl:template><xsl:template match="*[local-name()='sup']">
4468
4536
  <fo:inline font-size="80%" vertical-align="super">
4469
4537
  <xsl:apply-templates/>
@@ -4953,9 +5021,27 @@
4953
5021
  <xsl:copy>
4954
5022
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4955
5023
  </xsl:copy>
4956
- <mathml:mspace width="0.5ex"/>
5024
+ <xsl:choose>
5025
+ <!-- if in msub, then don't add space -->
5026
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
5027
+ <!-- if next char in digit, don't add space -->
5028
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
5029
+ <xsl:otherwise>
5030
+ <mathml:mspace width="0.5ex"/>
5031
+ </xsl:otherwise>
5032
+ </xsl:choose>
4957
5033
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4958
5034
  <xsl:variable name="target">
5035
+ <xsl:choose>
5036
+ <xsl:when test="@updatetype = 'true'">
5037
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
5038
+ </xsl:when>
5039
+ <xsl:otherwise>
5040
+ <xsl:value-of select="normalize-space(@target)"/>
5041
+ </xsl:otherwise>
5042
+ </xsl:choose>
5043
+ </xsl:variable>
5044
+ <xsl:variable name="target_text">
4959
5045
  <xsl:choose>
4960
5046
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4961
5047
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4971,20 +5057,22 @@
4971
5057
  <xsl:attribute name="color">blue</xsl:attribute>
4972
5058
  </xsl:if>
4973
5059
 
5060
+
5061
+
4974
5062
  <xsl:choose>
4975
- <xsl:when test="$target = ''">
5063
+ <xsl:when test="$target_text = ''">
4976
5064
  <xsl:apply-templates/>
4977
5065
  </xsl:when>
4978
5066
  <xsl:otherwise>
4979
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5067
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4980
5068
  <xsl:choose>
4981
5069
  <xsl:when test="normalize-space(.) = ''">
4982
- <!-- <xsl:value-of select="$target"/> -->
4983
5070
  <xsl:call-template name="add-zero-spaces-link-java">
4984
- <xsl:with-param name="text" select="$target"/>
5071
+ <xsl:with-param name="text" select="$target_text"/>
4985
5072
  </xsl:call-template>
4986
5073
  </xsl:when>
4987
5074
  <xsl:otherwise>
5075
+ <!-- output text from <link>text</link> -->
4988
5076
  <xsl:apply-templates/>
4989
5077
  </xsl:otherwise>
4990
5078
  </xsl:choose>
@@ -5079,6 +5167,7 @@
5079
5167
 
5080
5168
 
5081
5169
 
5170
+
5082
5171
  <fo:block-container margin-left="0mm">
5083
5172
 
5084
5173
 
@@ -5122,6 +5211,7 @@
5122
5211
  </xsl:choose>
5123
5212
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
5124
5213
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5214
+
5125
5215
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5126
5216
 
5127
5217
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -5197,6 +5287,7 @@
5197
5287
  </xsl:call-template>
5198
5288
 
5199
5289
  <fo:block>
5290
+
5200
5291
  <xsl:apply-templates/>
5201
5292
  </fo:block>
5202
5293
  <xsl:call-template name="fn_display_figure"/>
@@ -5319,6 +5410,234 @@
5319
5410
  <xsl:param name="height"/>
5320
5411
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5321
5412
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5413
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
5414
+ <xsl:param name="name"/>
5415
+
5416
+ <xsl:variable name="svg_content">
5417
+ <xsl:apply-templates select="." mode="svg_update"/>
5418
+ </xsl:variable>
5419
+
5420
+ <xsl:variable name="alt-text">
5421
+ <xsl:choose>
5422
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
5423
+ <xsl:value-of select="../*[local-name() = 'name']"/>
5424
+ </xsl:when>
5425
+ <xsl:when test="normalize-space($name) != ''">
5426
+ <xsl:value-of select="$name"/>
5427
+ </xsl:when>
5428
+ <xsl:otherwise>Figure</xsl:otherwise>
5429
+ </xsl:choose>
5430
+ </xsl:variable>
5431
+
5432
+ <xsl:choose>
5433
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
5434
+ <fo:block>
5435
+ <xsl:variable name="width" select="@width"/>
5436
+ <xsl:variable name="height" select="@height"/>
5437
+
5438
+ <xsl:variable name="scale_x">
5439
+ <xsl:choose>
5440
+ <xsl:when test="$width &gt; $width_effective_px">
5441
+ <xsl:value-of select="$width_effective_px div $width"/>
5442
+ </xsl:when>
5443
+ <xsl:otherwise>1</xsl:otherwise>
5444
+ </xsl:choose>
5445
+ </xsl:variable>
5446
+
5447
+ <xsl:variable name="scale_y">
5448
+ <xsl:choose>
5449
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
5450
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
5451
+ </xsl:when>
5452
+ <xsl:otherwise>1</xsl:otherwise>
5453
+ </xsl:choose>
5454
+ </xsl:variable>
5455
+
5456
+ <xsl:variable name="scale">
5457
+ <xsl:choose>
5458
+ <xsl:when test="$scale_y != 1">
5459
+ <xsl:value-of select="$scale_x * $scale_y"/>
5460
+ </xsl:when>
5461
+ <xsl:otherwise>
5462
+ <xsl:value-of select="$scale_x"/>
5463
+ </xsl:otherwise>
5464
+ </xsl:choose>
5465
+ </xsl:variable>
5466
+
5467
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
5468
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
5469
+
5470
+ <fo:table table-layout="fixed" width="100%">
5471
+ <fo:table-column column-width="proportional-column-width(1)"/>
5472
+ <fo:table-column column-width="{$width_scale}px"/>
5473
+ <fo:table-column column-width="proportional-column-width(1)"/>
5474
+ <fo:table-body>
5475
+ <fo:table-row>
5476
+ <fo:table-cell column-number="2">
5477
+ <fo:block>
5478
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
5479
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5480
+ <fo:block line-height="0" font-size="0">
5481
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5482
+ <xsl:call-template name="bookmark"/>
5483
+ </xsl:for-each>
5484
+ </fo:block>
5485
+ </xsl:if>
5486
+ <fo:block text-depth="0" line-height="0" font-size="0">
5487
+
5488
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5489
+ <xsl:attribute name="width">100%</xsl:attribute>
5490
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5491
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5492
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5493
+
5494
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
5495
+ </fo:instream-foreign-object>
5496
+ </fo:block>
5497
+
5498
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
5499
+ <xsl:with-param name="scale" select="$scale"/>
5500
+ </xsl:apply-templates>
5501
+ </fo:block-container>
5502
+ </fo:block>
5503
+ </fo:table-cell>
5504
+ </fo:table-row>
5505
+ </fo:table-body>
5506
+ </fo:table>
5507
+ </fo:block>
5508
+
5509
+ </xsl:when>
5510
+ <xsl:otherwise>
5511
+ <fo:block xsl:use-attribute-sets="image-style">
5512
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5513
+ <xsl:attribute name="width">100%</xsl:attribute>
5514
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5515
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5516
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5517
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5518
+ <!-- effective height / width = 1.48, 1.4 - with title -->
5519
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5520
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5521
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5522
+ </xsl:if>
5523
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5524
+ <xsl:copy-of select="$svg_content"/>
5525
+ </fo:instream-foreign-object>
5526
+ </fo:block>
5527
+ </xsl:otherwise>
5528
+ </xsl:choose>
5529
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
5530
+ <xsl:copy>
5531
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
5532
+ </xsl:copy>
5533
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
5534
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5535
+ <xsl:value-of select="."/>
5536
+ </xsl:attribute>
5537
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5538
+ <xsl:variable name="svg_content" select="document(@src)"/>
5539
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5540
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
5541
+ <xsl:call-template name="image_svg">
5542
+ <xsl:with-param name="name" select="$name"/>
5543
+ </xsl:call-template>
5544
+ </xsl:for-each>
5545
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
5546
+ <xsl:copy>
5547
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
5548
+ </xsl:copy>
5549
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
5550
+ <xsl:apply-templates mode="svg_remove_a"/>
5551
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
5552
+ <xsl:param name="scale"/>
5553
+ <xsl:variable name="dest">
5554
+ <xsl:choose>
5555
+ <xsl:when test="starts-with(@href, '#')">
5556
+ <xsl:value-of select="substring-after(@href, '#')"/>
5557
+ </xsl:when>
5558
+ <xsl:otherwise>
5559
+ <xsl:value-of select="@href"/>
5560
+ </xsl:otherwise>
5561
+ </xsl:choose>
5562
+ </xsl:variable>
5563
+ <xsl:for-each select="./*[local-name() = 'rect']">
5564
+ <xsl:call-template name="insertSVGMapLink">
5565
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
5566
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
5567
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
5568
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
5569
+ <xsl:with-param name="dest" select="$dest"/>
5570
+ </xsl:call-template>
5571
+ </xsl:for-each>
5572
+
5573
+ <xsl:for-each select="./*[local-name() = 'polygon']">
5574
+ <xsl:variable name="points">
5575
+ <xsl:call-template name="split">
5576
+ <xsl:with-param name="pText" select="@points"/>
5577
+ </xsl:call-template>
5578
+ </xsl:variable>
5579
+ <xsl:variable name="x_coords">
5580
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
5581
+ <xsl:sort select="." data-type="number"/>
5582
+ <x><xsl:value-of select="."/></x>
5583
+ </xsl:for-each>
5584
+ </xsl:variable>
5585
+ <xsl:variable name="y_coords">
5586
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
5587
+ <xsl:sort select="." data-type="number"/>
5588
+ <y><xsl:value-of select="."/></y>
5589
+ </xsl:for-each>
5590
+ </xsl:variable>
5591
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
5592
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
5593
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
5594
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
5595
+ <xsl:call-template name="insertSVGMapLink">
5596
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
5597
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
5598
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
5599
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
5600
+ <xsl:with-param name="dest" select="$dest"/>
5601
+ </xsl:call-template>
5602
+ </xsl:for-each>
5603
+
5604
+ <xsl:for-each select="./*[local-name() = 'circle']">
5605
+ <xsl:call-template name="insertSVGMapLink">
5606
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
5607
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
5608
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
5609
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5610
+ <xsl:with-param name="dest" select="$dest"/>
5611
+ </xsl:call-template>
5612
+ </xsl:for-each>
5613
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5614
+ <xsl:call-template name="insertSVGMapLink">
5615
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5616
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5617
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5618
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5619
+ <xsl:with-param name="dest" select="$dest"/>
5620
+ </xsl:call-template>
5621
+ </xsl:for-each>
5622
+ </xsl:template><xsl:template name="insertSVGMapLink">
5623
+ <xsl:param name="left"/>
5624
+ <xsl:param name="top"/>
5625
+ <xsl:param name="width"/>
5626
+ <xsl:param name="height"/>
5627
+ <xsl:param name="dest"/>
5628
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5629
+ <fo:block font-size="1pt">
5630
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5631
+ <fo:inline-container inline-progression-dimension="100%">
5632
+ <fo:block-container height="{$height - 1}px" width="100%">
5633
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5634
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5635
+ </xsl:if> -->
5636
+ <fo:block> </fo:block></fo:block-container>
5637
+ </fo:inline-container>
5638
+ </fo:basic-link>
5639
+ </fo:block>
5640
+ </fo:block-container>
5322
5641
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5323
5642
  <xsl:apply-templates mode="contents"/>
5324
5643
  <xsl:text> </xsl:text>
@@ -5347,28 +5666,39 @@
5347
5666
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5348
5667
  <xsl:for-each select="xalan:nodeset($contents)/doc">
5349
5668
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5669
+ <xsl:if test="@bundle = 'true'">
5670
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5671
+ </xsl:if>
5350
5672
  <fo:bookmark-title>
5351
- <xsl:variable name="bookmark-title_">
5352
- <xsl:call-template name="getLangVersion">
5353
- <xsl:with-param name="lang" select="@lang"/>
5354
- <xsl:with-param name="doctype" select="@doctype"/>
5355
- <xsl:with-param name="title" select="@title-part"/>
5356
- </xsl:call-template>
5357
- </xsl:variable>
5358
5673
  <xsl:choose>
5359
- <xsl:when test="normalize-space($bookmark-title_) != ''">
5360
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
5361
- </xsl:when>
5362
- <xsl:otherwise>
5674
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5675
+ <xsl:variable name="bookmark-title_">
5676
+ <xsl:call-template name="getLangVersion">
5677
+ <xsl:with-param name="lang" select="@lang"/>
5678
+ <xsl:with-param name="doctype" select="@doctype"/>
5679
+ <xsl:with-param name="title" select="@title-part"/>
5680
+ </xsl:call-template>
5681
+ </xsl:variable>
5363
5682
  <xsl:choose>
5364
- <xsl:when test="@lang = 'en'">English</xsl:when>
5365
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
5366
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5367
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5683
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5684
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5685
+ </xsl:when>
5686
+ <xsl:otherwise>
5687
+ <xsl:choose>
5688
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5689
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5690
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5691
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5692
+ </xsl:choose>
5693
+ </xsl:otherwise>
5368
5694
  </xsl:choose>
5695
+ </xsl:when>
5696
+ <xsl:otherwise>
5697
+ <xsl:value-of select="@title-part"/>
5369
5698
  </xsl:otherwise>
5370
5699
  </xsl:choose>
5371
5700
  </fo:bookmark-title>
5701
+
5372
5702
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5373
5703
 
5374
5704
  <xsl:call-template name="insertFigureBookmarks">
@@ -5467,20 +5797,28 @@
5467
5797
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
5468
5798
  </xsl:choose>
5469
5799
  </xsl:template><xsl:template match="item" mode="bookmark">
5470
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
5471
- <fo:bookmark-title>
5472
- <xsl:if test="@section != ''">
5473
- <xsl:value-of select="@section"/>
5474
- <xsl:text> </xsl:text>
5475
- </xsl:if>
5476
- <xsl:value-of select="normalize-space(title)"/>
5477
- </fo:bookmark-title>
5478
- <xsl:apply-templates mode="bookmark"/>
5479
- </fo:bookmark>
5800
+ <xsl:choose>
5801
+ <xsl:when test="@id != ''">
5802
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5803
+ <fo:bookmark-title>
5804
+ <xsl:if test="@section != ''">
5805
+ <xsl:value-of select="@section"/>
5806
+ <xsl:text> </xsl:text>
5807
+ </xsl:if>
5808
+ <xsl:value-of select="normalize-space(title)"/>
5809
+ </fo:bookmark-title>
5810
+ <xsl:apply-templates mode="bookmark"/>
5811
+ </fo:bookmark>
5812
+ </xsl:when>
5813
+ <xsl:otherwise>
5814
+ <xsl:apply-templates mode="bookmark"/>
5815
+ </xsl:otherwise>
5816
+ </xsl:choose>
5480
5817
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
5481
5818
  <xsl:if test="normalize-space() != ''">
5482
5819
  <fo:block xsl:use-attribute-sets="figure-name-style">
5483
5820
 
5821
+
5484
5822
  <xsl:apply-templates/>
5485
5823
  </fo:block>
5486
5824
  </xsl:if>
@@ -5560,6 +5898,8 @@
5560
5898
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5561
5899
 
5562
5900
  <fo:block-container margin-left="0mm">
5901
+ <xsl:copy-of select="@id"/>
5902
+
5563
5903
  <xsl:if test="parent::*[local-name() = 'note']">
5564
5904
  <xsl:attribute name="margin-left">
5565
5905
  <xsl:choose>
@@ -5570,7 +5910,9 @@
5570
5910
 
5571
5911
  </xsl:if>
5572
5912
  <fo:block-container margin-left="0mm">
5573
-
5913
+
5914
+
5915
+
5574
5916
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5575
5917
  <xsl:variable name="_font-size">
5576
5918
 
@@ -5599,10 +5941,14 @@
5599
5941
  </xsl:choose>
5600
5942
  </xsl:attribute>
5601
5943
  </xsl:if>
5602
- <xsl:apply-templates/>
5603
- </fo:block>
5944
+
5945
+ <xsl:apply-templates/>
5946
+ </fo:block>
5947
+
5948
+
5604
5949
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5605
5950
 
5951
+
5606
5952
  </fo:block-container>
5607
5953
  </fo:block-container>
5608
5954
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5837,6 +6183,7 @@
5837
6183
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5838
6184
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5839
6185
 
6186
+
5840
6187
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5841
6188
 
5842
6189
  <xsl:variable name="element">
@@ -5946,12 +6293,15 @@
5946
6293
 
5947
6294
 
5948
6295
 
6296
+
6297
+
6298
+
5949
6299
  <xsl:call-template name="getTitle">
5950
6300
  <xsl:with-param name="name" select="'title-source'"/>
5951
6301
  </xsl:call-template>
6302
+ <xsl:text>: </xsl:text>
5952
6303
 
5953
6304
 
5954
- <xsl:text>: </xsl:text>
5955
6305
  </fo:inline>
5956
6306
 
5957
6307
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -6022,7 +6372,9 @@
6022
6372
 
6023
6373
 
6024
6374
  </xsl:if>
6025
-
6375
+
6376
+
6377
+
6026
6378
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6027
6379
  <xsl:if test="normalize-space(@citeas) = ''">
6028
6380
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -6031,6 +6383,7 @@
6031
6383
 
6032
6384
 
6033
6385
 
6386
+
6034
6387
  </xsl:if>
6035
6388
 
6036
6389
  <xsl:apply-templates/>
@@ -6076,6 +6429,7 @@
6076
6429
 
6077
6430
 
6078
6431
 
6432
+
6079
6433
  </xsl:variable>
6080
6434
 
6081
6435
  <xsl:variable name="padding-right">
@@ -6172,6 +6526,7 @@
6172
6526
  <xsl:call-template name="setId"/>
6173
6527
 
6174
6528
 
6529
+
6175
6530
  <xsl:apply-templates/>
6176
6531
  </fo:block>
6177
6532
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -6418,17 +6773,17 @@
6418
6773
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
6419
6774
  <xsl:choose>
6420
6775
  <xsl:when test="normalize-space($_doc_ident) != ''">
6421
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6776
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6422
6777
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6423
6778
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6424
- </xsl:if>
6779
+ </xsl:if> -->
6425
6780
  <xsl:value-of select="$_doc_ident"/>
6426
6781
  </xsl:when>
6427
6782
  <xsl:otherwise>
6428
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6783
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6429
6784
  <xsl:if test="$type != ''">
6430
6785
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6431
- </xsl:if>
6786
+ </xsl:if> -->
6432
6787
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6433
6788
  </xsl:otherwise>
6434
6789
  </xsl:choose>
@@ -6741,6 +7096,9 @@
6741
7096
  <xsl:when test="parent::*[local-name() = 'preface']">
6742
7097
  <xsl:value-of select="$level_total - 1"/>
6743
7098
  </xsl:when>
7099
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
7100
+ <xsl:value-of select="$level_total - 1"/>
7101
+ </xsl:when>
6744
7102
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6745
7103
  <xsl:value-of select="$level_total - 2"/>
6746
7104
  </xsl:when>
@@ -6881,7 +7239,14 @@
6881
7239
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6882
7240
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6883
7241
  </xsl:when>
6884
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
7242
+ <xsl:otherwise>
7243
+ <xsl:variable name="key_">
7244
+ <xsl:call-template name="capitalize">
7245
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
7246
+ </xsl:call-template>
7247
+ </xsl:variable>
7248
+ <xsl:value-of select="$key_"/>
7249
+ </xsl:otherwise>
6885
7250
  </xsl:choose>
6886
7251
 
6887
7252
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -6924,4 +7289,110 @@
6924
7289
  <xsl:value-of select="$align"/>
6925
7290
  </xsl:when>
6926
7291
  </xsl:choose>
7292
+ </xsl:template><xsl:template name="setTextAlignment">
7293
+ <xsl:param name="default">left</xsl:param>
7294
+ <xsl:attribute name="text-align">
7295
+ <xsl:choose>
7296
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7297
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7298
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7299
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7300
+ </xsl:choose>
7301
+ </xsl:attribute>
7302
+ </xsl:template><xsl:template name="number-to-words">
7303
+ <xsl:param name="number"/>
7304
+ <xsl:param name="first"/>
7305
+ <xsl:if test="$number != ''">
7306
+ <xsl:variable name="words">
7307
+ <words>
7308
+ <word cardinal="1">One-</word>
7309
+ <word ordinal="1">First </word>
7310
+ <word cardinal="2">Two-</word>
7311
+ <word ordinal="2">Second </word>
7312
+ <word cardinal="3">Three-</word>
7313
+ <word ordinal="3">Third </word>
7314
+ <word cardinal="4">Four-</word>
7315
+ <word ordinal="4">Fourth </word>
7316
+ <word cardinal="5">Five-</word>
7317
+ <word ordinal="5">Fifth </word>
7318
+ <word cardinal="6">Six-</word>
7319
+ <word ordinal="6">Sixth </word>
7320
+ <word cardinal="7">Seven-</word>
7321
+ <word ordinal="7">Seventh </word>
7322
+ <word cardinal="8">Eight-</word>
7323
+ <word ordinal="8">Eighth </word>
7324
+ <word cardinal="9">Nine-</word>
7325
+ <word ordinal="9">Ninth </word>
7326
+ <word ordinal="10">Tenth </word>
7327
+ <word ordinal="11">Eleventh </word>
7328
+ <word ordinal="12">Twelfth </word>
7329
+ <word ordinal="13">Thirteenth </word>
7330
+ <word ordinal="14">Fourteenth </word>
7331
+ <word ordinal="15">Fifteenth </word>
7332
+ <word ordinal="16">Sixteenth </word>
7333
+ <word ordinal="17">Seventeenth </word>
7334
+ <word ordinal="18">Eighteenth </word>
7335
+ <word ordinal="19">Nineteenth </word>
7336
+ <word cardinal="20">Twenty-</word>
7337
+ <word ordinal="20">Twentieth </word>
7338
+ <word cardinal="30">Thirty-</word>
7339
+ <word ordinal="30">Thirtieth </word>
7340
+ <word cardinal="40">Forty-</word>
7341
+ <word ordinal="40">Fortieth </word>
7342
+ <word cardinal="50">Fifty-</word>
7343
+ <word ordinal="50">Fiftieth </word>
7344
+ <word cardinal="60">Sixty-</word>
7345
+ <word ordinal="60">Sixtieth </word>
7346
+ <word cardinal="70">Seventy-</word>
7347
+ <word ordinal="70">Seventieth </word>
7348
+ <word cardinal="80">Eighty-</word>
7349
+ <word ordinal="80">Eightieth </word>
7350
+ <word cardinal="90">Ninety-</word>
7351
+ <word ordinal="90">Ninetieth </word>
7352
+ <word cardinal="100">Hundred-</word>
7353
+ <word ordinal="100">Hundredth </word>
7354
+ </words>
7355
+ </xsl:variable>
7356
+
7357
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
7358
+
7359
+ <xsl:variable name="value">
7360
+ <xsl:choose>
7361
+ <xsl:when test="$ordinal != ''">
7362
+ <xsl:value-of select="$ordinal"/>
7363
+ </xsl:when>
7364
+ <xsl:otherwise>
7365
+ <xsl:choose>
7366
+ <xsl:when test="$number &lt; 100">
7367
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
7368
+ <xsl:variable name="digit" select="substring($number,2)"/>
7369
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
7370
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
7371
+ </xsl:when>
7372
+ <xsl:otherwise>
7373
+ <!-- more 100 -->
7374
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
7375
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
7376
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
7377
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
7378
+ <xsl:call-template name="number-to-words">
7379
+ <xsl:with-param name="number" select="$digits"/>
7380
+ </xsl:call-template>
7381
+ </xsl:otherwise>
7382
+ </xsl:choose>
7383
+ </xsl:otherwise>
7384
+ </xsl:choose>
7385
+ </xsl:variable>
7386
+ <xsl:choose>
7387
+ <xsl:when test="$first = 'true'">
7388
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
7389
+ <xsl:call-template name="capitalize">
7390
+ <xsl:with-param name="str" select="$value_lc"/>
7391
+ </xsl:call-template>
7392
+ </xsl:when>
7393
+ <xsl:otherwise>
7394
+ <xsl:value-of select="$value"/>
7395
+ </xsl:otherwise>
7396
+ </xsl:choose>
7397
+ </xsl:if>
6927
7398
  </xsl:template></xsl:stylesheet>