metanorma-iec 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +10 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/iec/biblio.rng +36 -6
  6. data/lib/asciidoctor/iec/converter.rb +8 -0
  7. data/lib/asciidoctor/iec/front.rb +3 -3
  8. data/lib/asciidoctor/iec/isodoc.rng +450 -4
  9. data/lib/asciidoctor/iec/isostandard.rng +12 -1
  10. data/lib/asciidoctor/iec/reqt.rng +23 -0
  11. data/lib/isodoc/iec/base_convert.rb +21 -37
  12. data/lib/isodoc/iec/html/htmlstyle.scss +6 -6
  13. data/lib/isodoc/iec/html/isodoc.scss +15 -9
  14. data/lib/isodoc/iec/html/scripts.html +18 -0
  15. data/lib/isodoc/iec/html/wordstyle.scss +0 -3
  16. data/lib/isodoc/iec/html_convert.rb +8 -0
  17. data/lib/isodoc/iec/iec.international-standard.xsl +1534 -728
  18. data/lib/isodoc/iec/pdf_convert.rb +2 -12
  19. data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
  20. data/lib/isodoc/iec/word_convert.rb +17 -6
  21. data/lib/isodoc/iec/xref.rb +45 -0
  22. data/lib/metanorma-iec.rb +2 -0
  23. data/lib/metanorma/iec/processor.rb +12 -6
  24. data/lib/metanorma/iec/version.rb +1 -1
  25. data/metanorma-iec.gemspec +2 -2
  26. data/spec/asciidoctor-iec/base_spec.rb +9 -23
  27. data/spec/asciidoctor-iec/blocks_spec.rb +4 -4
  28. data/spec/asciidoctor-iec/cleanup_spec.rb +7 -7
  29. data/spec/asciidoctor-iec/iev_spec.rb +4 -4
  30. data/spec/asciidoctor-iec/inline_spec.rb +1 -1
  31. data/spec/asciidoctor-iec/section_spec.rb +8 -8
  32. data/spec/examples/rice.html +5 -5
  33. data/spec/isodoc/blocks_spec.rb +154 -0
  34. data/spec/isodoc/i18n_spec.rb +12 -12
  35. data/spec/isodoc/iev_spec.rb +13 -12
  36. data/spec/isodoc/inline_spec.rb +11 -11
  37. data/spec/isodoc/iso_spec.rb +6 -23
  38. data/spec/isodoc/metadata_spec.rb +90 -7
  39. data/spec/isodoc/postproc_spec.rb +3 -3
  40. data/spec/isodoc/ref_spec.rb +249 -0
  41. data/spec/isodoc/section_spec.rb +50 -13
  42. data/spec/isodoc/terms_spec.rb +10 -12
  43. data/spec/metanorma/processor_spec.rb +2 -5
  44. data/spec/spec_helper.rb +7 -0
  45. metadata +14 -11
@@ -91,6 +91,12 @@
91
91
  </define>
92
92
  <define name="sections">
93
93
  <element name="sections">
94
+ <zeroOrMore>
95
+ <choice>
96
+ <ref name="note"/>
97
+ <ref name="admonition"/>
98
+ </choice>
99
+ </zeroOrMore>
94
100
  <ref name="clause"/>
95
101
  <optional>
96
102
  <choice>
@@ -263,6 +269,8 @@
263
269
  <value>publicly-available-specification</value>
264
270
  <value>international-workshop-agreement</value>
265
271
  <value>guide</value>
272
+ <value>amendment</value>
273
+ <value>technical-corrigendum</value>
266
274
  </choice>
267
275
  </define>
268
276
  <define name="structuredidentifier">
@@ -354,6 +362,9 @@
354
362
  <data type="boolean"/>
355
363
  </attribute>
356
364
  </optional>
365
+ <optional>
366
+ <attribute name="number"/>
367
+ </optional>
357
368
  <optional>
358
369
  <attribute name="subsequence"/>
359
370
  </optional>
@@ -510,7 +521,7 @@
510
521
  </attribute>
511
522
  </optional>
512
523
  <oneOrMore>
513
- <ref name="paragraph-with-footnote"/>
524
+ <ref name="BasicBlock"/>
514
525
  </oneOrMore>
515
526
  </element>
516
527
  </define>
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -141,6 +154,16 @@
141
154
  <data type="boolean"/>
142
155
  </attribute>
143
156
  </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
144
167
  <oneOrMore>
145
168
  <ref name="BasicBlock"/>
146
169
  </oneOrMore>
@@ -8,6 +8,10 @@ module IsoDoc
8
8
  @meta = Metadata.new(lang, script, labels)
9
9
  end
10
10
 
11
+ def xref_init(lang, script, klass, labels, options)
12
+ @xrefs = Xref.new(lang, script, klass, labels, options)
13
+ end
14
+
11
15
  def boilerplate(node, out)
12
16
  # processed in foreword instead
13
17
  end
@@ -16,6 +20,7 @@ module IsoDoc
16
20
  f = isoxml.at(ns("//foreword"))
17
21
  b = isoxml.at(ns("//boilerplate/legal-statement"))
18
22
  page_break(out)
23
+ iec_orgname(out)
19
24
  middle_title(out)
20
25
  out.div **attr_code(id: f ? f["id"] : "") do |s|
21
26
  s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl }
@@ -27,10 +32,13 @@ module IsoDoc
27
32
  end
28
33
  end
29
34
 
30
- def middle_title(out)
35
+ def iec_orgname(out)
31
36
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << @labels["IEC"] }
32
37
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "____________" }
33
38
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
39
+ end
40
+
41
+ def middle_title(out)
34
42
  title1 = @meta.get[:doctitlemain]&.sub(/\s+$/, "")
35
43
  @meta.get[:doctitleintro] and
36
44
  title1 = "#{@meta.get[:doctitleintro]} &mdash; #{title1}"
@@ -67,17 +75,9 @@ module IsoDoc
67
75
  super.merge(y)
68
76
  end
69
77
 
70
- def annex_name_lbl(clause, num)
71
- obl = l10n("(#{@inform_annex_lbl})")
72
- obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
73
- l10n("<b>#{@annex_lbl} #{num}</b><br/><br/>#{obl}")
74
- end
75
-
76
78
  def convert1(docxml, filename, dir)
77
79
  id = docxml&.at(ns("//bibdata/docnumber"))&.text
78
80
  @is_iev = id == "60050"
79
- id = docxml&.at(ns("//bibdata/docidentifier[@type = 'iso']"))&.text
80
- m = /60050-(\d+)/.match(id) and @iev_part = m[1]
81
81
  super
82
82
  end
83
83
 
@@ -94,10 +94,6 @@ module IsoDoc
94
94
  end
95
95
  end
96
96
 
97
- def introduction_names(clause)
98
- return super unless @is_iev
99
- end
100
-
101
97
  def bibliography(isoxml, out)
102
98
  return super unless @is_iev
103
99
  end
@@ -116,7 +112,7 @@ module IsoDoc
116
112
  out.div **attr_code(id: node["id"]) do |div|
117
113
  out.p(**{ class: "zzSTDTitle2" }) do |p|
118
114
  p.b do |b|
119
- b << "#{anchor(node['id'], :label)} "
115
+ b << "#{@xrefs.anchor(node['id'], :label)} "
120
116
  node&.at(ns("./title"))&.children&.each { |c2| parse(c2, b) }
121
117
  end
122
118
  end
@@ -126,31 +122,10 @@ module IsoDoc
126
122
  end
127
123
  end
128
124
 
129
- def initial_anchor_names(d)
130
- super
131
- return unless @is_iev
132
- terms_iev_names(d)
133
- middle_section_asset_names(d)
134
- termnote_anchor_names(d)
135
- termexample_anchor_names(d)
136
- end
137
-
138
- def terms_iev_names(d)
139
- d.xpath(ns("//sections/clause/terms")).each_with_index do |t, i|
140
- num = "#{@iev_part}-%02d" % [i+1]
141
- @anchors[t["id"]] =
142
- { label: num, xref: l10n("#{@labels["section_iev"]}-#{num}"), level: 2,
143
- type: "clause" }
144
- t.xpath(ns("./term")).each_with_index do |c, i|
145
- num2 = "%02d" % [i+1]
146
- section_names1(c, "#{num}-#{num2}", 3)
147
- end
148
- end
149
- end
150
-
151
- def textcleanup(docxml)
125
+ def termref_cleanup(docxml)
152
126
  return super unless @is_iev
153
127
  docxml.
128
+ gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ").
154
129
  gsub(/\[TERMREF\]\s*/, l10n("#{@source_lbl}: ")).
155
130
  gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@modified_lbl} [/TERMREF]")).
156
131
  gsub(/\s*\[\/TERMREF\]\s*/, l10n("")).
@@ -190,6 +165,15 @@ module IsoDoc
190
165
  term_suffix(node, p)
191
166
  end
192
167
  end
168
+
169
+ def clause_parse_title(node, div, c1, out)
170
+ IsoDoc::Common.instance_method(:clause_parse_title).bind(self).call(node, div, c1, out)
171
+ end
172
+
173
+ def biblio_list(f, div, biblio)
174
+ biblio = false
175
+ super
176
+ end
193
177
  end
194
178
  end
195
179
  end
@@ -195,11 +195,11 @@ p.Terms {
195
195
  /* Navigation*/
196
196
 
197
197
  nav {
198
- @include sidebarNav(#f7f7f7, 278px, 20px);
198
+ @include sidebarNav(#f5faff, 278px, 20px);
199
199
  }
200
200
 
201
201
  #toggle {
202
- @include sidebarNavToggle(black, #f7f7f7)
202
+ @include sidebarNavToggle(black, #f5faff)
203
203
  }
204
204
 
205
205
  #toc {
@@ -516,7 +516,7 @@ p.NormRef {
516
516
  .figure,
517
517
  pre,
518
518
  .pseudocode {
519
- @include pseudocodeBlock(#f7f7f7);
519
+ @include pseudocodeBlock(#f5faff);
520
520
  font-size: 1em;
521
521
  }
522
522
 
@@ -667,7 +667,7 @@ ol > li > p:before {
667
667
  */
668
668
 
669
669
  .Quote {
670
- @include blockquoteBlock(#f7f7f7);
670
+ @include blockquoteBlock(#f5faff);
671
671
  }
672
672
 
673
673
  /*
@@ -675,11 +675,11 @@ ol > li > p:before {
675
675
  */
676
676
 
677
677
  .formula {
678
- @include formulaBlock(#f7f7f7)
678
+ @include formulaBlock(#f5faff)
679
679
  }
680
680
 
681
681
  dl.formula_dl {
682
- background-color: #f7f7f7;
682
+ background-color: #f5faff;
683
683
  }
684
684
 
685
685
  /*
@@ -182,7 +182,6 @@ p.TableTitle
182
182
  /* IEC: NOTE */
183
183
  p.Note, div.Note, li.Note
184
184
  {mso-style-unhide:no;
185
- mso-style-unhide:no;
186
185
  mso-style-qformat:yes;
187
186
  mso-style-next:Normal;
188
187
  margin-top:5.0pt;
@@ -325,10 +324,11 @@ p.AltTerms, li.AltTerms, div.AltTerms
325
324
  margin-top:0cm;
326
325
  margin-right:0cm;
327
326
  margin-bottom:0cm;
328
- margin-left:17.0pt;
327
+ /* https://github.com/metanorma/metanorma-iec/issues/62 */
328
+ /* margin-left:17.0pt; */ /* suppress to line up math terms */
329
329
  margin-bottom:.0001pt;
330
330
  text-align:justify;
331
- text-indent:-17.0pt;
331
+ /* text-indent:-17.0pt; */ /* suppress to line up math terms */
332
332
  mso-pagination:widow-orphan;
333
333
  page-break-after:avoid;
334
334
  layout-grid-mode:char;
@@ -529,8 +529,6 @@ p.QuoteAttribution
529
529
  p.Admonition, li.Admonition, div.Admonition
530
530
  {mso-style-priority:99;
531
531
  mso-pagination:widow-orphan;
532
- border:none;
533
- padding:0cm;
534
532
  font-size:10.0pt;
535
533
  font-family:$bodyfont;
536
534
  mso-ascii-font-family:$bodyfont;
@@ -541,10 +539,14 @@ p.Admonition, li.Admonition, div.Admonition
541
539
  mso-hansi-theme-font:minor-latin;
542
540
  mso-bidi-font-family:$bodyfont;
543
541
  mso-bidi-theme-font:minor-bidi;
542
+ mso-element:para-border-div;
543
+ border:solid windowtext 1.0pt;
544
+ mso-border-alt:solid windowtext .5pt;
545
+ padding:1.0pt 4.0pt 1.0pt 4.0pt;
544
546
  font-weight:bold;
545
547
  mso-ansi-language:EN-AU;}
546
548
  /* IEC:PARAEQUATION */
547
- p.Formula, li.Formula, div.Formula
549
+ p.formula, li.formula, div.formula
548
550
  {mso-style-name:Formula;
549
551
  mso-style-unhide:no;
550
552
  mso-style-qformat:yes;
@@ -652,8 +654,6 @@ table.MsoTableGrid
652
654
  mso-pagination:widow-orphan;
653
655
  font-size:10.0pt;
654
656
  font-family:$bodyfont;}
655
- div.formula
656
- {tab-stops:right 487.45pt;}
657
657
  body
658
658
  {tab-interval:36.0pt;}
659
659
  .coverpage_docnumber
@@ -823,9 +823,15 @@ div.example, td.example {
823
823
  margin-bottom:12.0pt;
824
824
  }
825
825
 
826
- span.note_label, span.example_label, td.example_label, td.note_label
826
+ span.example_label, td.example_label
827
827
  {
828
828
  font-size: 10.0pt;
829
829
  font-family:$bodyfont;
830
830
  }
831
831
 
832
+ span.note_label, td.note_label
833
+ {
834
+ font-size: 8.0pt;
835
+ font-family:$bodyfont;
836
+ }
837
+
@@ -158,3 +158,21 @@ $('#toggle').on('click', function(){
158
158
  $("[rel=footnote]").inlineFootnote();
159
159
  });
160
160
  </script>
161
+ <script>
162
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
163
+ //
164
+ // AnchorJS - v4.2.2 - 2020-04-20
165
+ // https://www.bryanbraun.com/anchorjs/
166
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
167
+ //
168
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
169
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
170
+ // @license-end
171
+ </script>
172
+ <script>
173
+ anchors.options = {
174
+ placement: 'left'
175
+ };
176
+ anchors.add('h1, h2, h3, h4');
177
+ </script>
178
+
@@ -1323,7 +1323,6 @@ div.WordSection1
1323
1323
  margin:3.0cm 2.5cm 1.5cm 2.5cm;
1324
1324
  mso-header-margin:35.45pt;
1325
1325
  mso-footer-margin:14.2pt;
1326
- mso-page-numbers:roman-lower;
1327
1326
  mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1328
1327
  mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
1329
1328
  mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef2;
@@ -1362,7 +1361,6 @@ div.WordSection2
1362
1361
  margin:3.0cm 2.5cm 1.5cm 2.5cm;
1363
1362
  mso-header-margin:35.45pt;
1364
1363
  mso-footer-margin:14.2pt;
1365
- mso-page-numbers:1;
1366
1364
  mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1367
1365
  mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
1368
1366
  mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ef3;
@@ -1401,7 +1399,6 @@ div.WordSection3
1401
1399
  margin:3.0cm 2.5cm 1.5cm 2.5cm;
1402
1400
  mso-header-margin:35.45pt;
1403
1401
  mso-footer-margin:14.2pt;
1404
- mso-page-numbers:1;
1405
1402
  mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") eh2;
1406
1403
  mso-header:url("file:///C:/Doc/FILENAME_files/header.html") h2;
1407
1404
  mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") f4;
@@ -10,6 +10,14 @@ module IsoDoc
10
10
  @libdir = File.dirname(__FILE__)
11
11
  end
12
12
 
13
+ def default_fonts(options)
14
+ {
15
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
16
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
17
+ monospacefont: ('"Courier New",monospace'),
18
+ }
19
+ end
20
+
13
21
  def default_file_locations(options)
14
22
  @libdir = File.dirname(__FILE__)
15
23
  {
@@ -1,11 +1,20 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
 
6
6
 
7
+ <xsl:param name="additionalXMLs" select="''"/> <!-- iec-rice.fr.xml -->
8
+
9
+ <xsl:variable name="additionalXMLsArray">
10
+ <xsl:call-template name="split">
11
+ <xsl:with-param name="pText" select="normalize-space($additionalXMLs)"/>
12
+ </xsl:call-template>
13
+ </xsl:variable>
14
+
7
15
 
8
16
 
17
+ <xsl:variable name="debug">false</xsl:variable>
9
18
  <xsl:variable name="pageWidth" select="'210mm'"/>
10
19
  <xsl:variable name="pageHeight" select="'297mm'"/>
11
20
 
@@ -14,40 +23,32 @@
14
23
  <xsl:variable name="lang-1st-letter" select="''"/>
15
24
  <xsl:variable name="ISOname" select="/iec:iec-standard/iec:bibdata/iec:docidentifier[@type='iso']"/>
16
25
 
17
- <!-- Information and documentation — Codes for transcription systems -->
18
- <xsl:variable name="title-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'main']"/>
19
- <xsl:variable name="title-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'main']"/>
20
-
21
26
  <xsl:variable name="title-intro" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-intro']"/>
22
27
  <xsl:variable name="title-intro-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-intro']"/>
23
28
  <xsl:variable name="title-main" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-main']"/>
24
29
  <xsl:variable name="title-main-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-main']"/>
25
30
  <xsl:variable name="part" select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:project-number/@part"/>
26
- <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-part']"/>
27
- <xsl:variable name="title-part-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-part']"/>
28
-
29
- <xsl:variable name="doctype" select="/iec:iec-standard/iec:bibdata/iec:ext/iec:doctype"/>
30
- <xsl:variable name="doctype_uppercased" select="translate(translate($doctype,'-',' '), $lower,$upper)"/>
31
31
 
32
- <xsl:variable name="organization" select="translate(/iec:iec-standard/iec:bibdata/iec:contributor/iec:organization/iec:name, $lower, $upper)"/>
33
-
34
- <xsl:variable name="publisher" select="translate(/iec:iec-standard/iec:bibdata/iec:contributor[iec:role/@type = 'publisher']/iec:organization/iec:name, $lower, $upper)"/>
32
+ <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate(/iec:iec-standard/iec:bibdata/iec:ext/iec:doctype,'-',' ')))"/>
33
+
35
34
 
35
+
36
+ <xsl:variable name="publisher" select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor[iec:role/@type = 'publisher']/iec:organization/iec:name))"/>
37
+
36
38
  <xsl:variable name="stage" select="number(/iec:iec-standard/iec:bibdata/iec:status/iec:stage)"/>
37
- <xsl:variable name="stage-abbrev" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:status/iec:stage/@abbreviation)"/>
38
- <xsl:variable name="stage-fullname" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename)"/>
39
39
  <xsl:variable name="substage" select="number(/iec:iec-standard/iec:bibdata/iec:status/iec:substage)"/>
40
- <xsl:variable name="stage-name">
40
+ <xsl:variable name="stagename" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename)"/>
41
+ <xsl:variable name="abbreviation" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:status/iec:stage/@abbreviation)"/>
42
+
43
+ <xsl:variable name="stage-abbreviation">
41
44
  <xsl:choose>
42
- <xsl:when test="$stage-abbrev != ''">
43
- <xsl:value-of select="$stage-abbrev"/>
45
+ <xsl:when test="$abbreviation != ''">
46
+ <xsl:value-of select="$abbreviation"/>
44
47
  </xsl:when>
45
48
  <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP, PWI) -->
46
49
  <xsl:when test="$stage = 10">AWI</xsl:when>
47
50
  <xsl:when test="$stage = 20">WD</xsl:when>
48
- <!-- <xsl:when test="$stage = 30 and $substage = 20">CDV</xsl:when> -->
49
51
  <xsl:when test="$stage = 30">CD</xsl:when>
50
- <!-- <xsl:when test="$stage = 40">DIS</xsl:when> -->
51
52
  <xsl:when test="$stage = 40">CDV</xsl:when>
52
53
  <xsl:when test="$stage = 50">FDIS</xsl:when>
53
54
  <xsl:when test="$stage = 60 and $substage = 0">IS</xsl:when>
@@ -56,87 +57,88 @@
56
57
  </xsl:choose>
57
58
  </xsl:variable>
58
59
 
59
- <!-- UPPERCASED stage name -->
60
- <xsl:variable name="stage-name-uppercased">
61
- <xsl:if test="$stage-fullname != '' and $stage-abbrev != ''">
62
- <item name="{$stage-abbrev}">
63
- <xsl:if test="$stage-abbrev = 'NWIP' or 'AWI' or 'WD' or 'CD' or 'DIS' or 'FDIS'">
64
- <xsl:attribute name="show">true</xsl:attribute>
65
- <xsl:attribute name="shortname">DRAFT</xsl:attribute>
66
- </xsl:if>
67
- <xsl:if test="$stage-abbrev = 'FDIS'">
68
- <xsl:attribute name="shortname">PRE-RELEASE VERSION (FDIS)</xsl:attribute>
69
- </xsl:if>
70
- <xsl:value-of select="translate($stage-fullname, $lower, $upper)"/>
71
- </item>
72
- </xsl:if>
73
- <item name="NWIP" show="true" shortname="DRAFT">NEW WORK ITEM PROPOSAL DRAFT</item>
74
- <item name="AWI" show="true" shortname="DRAFT">APPROVED WORK ITEM</item>
75
- <item name="WD" show="true" shortname="DRAFT">WORKING DRAFT</item>
76
- <item name="CD" show="true" shortname="DRAFT">COMMITTEE DRAFT</item>
77
- <item name="CDV" show="true" shortname="DRAFT">COMMITTEE DRAFT FOR VOTE (CDV)</item>
78
- <item name="DIS" show="true" shortname="DRAFT">DRAFT</item>
79
- <item name="FDIS" show="true" shortname="FINAL DRAFT">PRE-RELEASE VERSION (FDIS)</item>
80
- <item name="IS">PROOF</item>
81
- </xsl:variable>
82
- <xsl:variable name="isPublished">
83
- <xsl:choose>
84
- <xsl:when test="string($stage) = 'NaN'">false</xsl:when>
85
- <xsl:when test="$stage &gt;=60">true</xsl:when>
86
- <xsl:when test="normalize-space($stage-name) != ''">true</xsl:when>
87
- <xsl:otherwise>false</xsl:otherwise>
88
- </xsl:choose>
89
- </xsl:variable>
90
-
91
- <xsl:variable name="doctype_name">
60
+ <xsl:variable name="stage-fullname-uppercased">
92
61
  <xsl:choose>
93
- <xsl:when test="normalize-space(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename) != ''">
94
- <xsl:value-of select="translate(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename, $lower, $upper)"/>
95
- </xsl:when>
96
- <xsl:when test="normalize-space(xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()) != ''">
97
- <xsl:value-of select="xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()"/>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
98
64
  </xsl:when>
99
- <xsl:otherwise>
100
- <xsl:value-of select="$doctype_uppercased"/>
101
- </xsl:otherwise>
65
+ <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
66
+ <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
67
+ <xsl:when test="$stage-abbreviation = 'AWI'">APPROVED WORK ITEM</xsl:when>
68
+ <xsl:when test="$stage-abbreviation = 'WD'">WORKING DRAFT</xsl:when>
69
+ <xsl:when test="$stage-abbreviation = 'CD'">COMMITTEE DRAFT</xsl:when>
70
+ <xsl:when test="$stage-abbreviation = 'CDV'">COMMITTEE DRAFT FOR VOTE</xsl:when>
71
+ <xsl:when test="$stage-abbreviation = 'DIS'">DRAFT INTERNATIONAL STANDARD</xsl:when>
72
+ <xsl:when test="$stage-abbreviation = 'FDIS'">FINAL DRAFT INTERNATIONAL STANDARD</xsl:when>
73
+ <xsl:otherwise><xsl:value-of select="$doctype_uppercased"/></xsl:otherwise>
102
74
  </xsl:choose>
103
75
  </xsl:variable>
76
+
104
77
 
105
78
  <!-- Example:
106
79
  <item level="1" id="Foreword" display="true">Foreword</item>
107
80
  <item id="term-script" display="false">3.2</item>
108
81
  -->
109
82
  <xsl:variable name="contents">
83
+ <xsl:variable name="docid">
84
+ <xsl:call-template name="getDocumentId"/>
85
+ </xsl:variable>
86
+ <doc id="{$docid}">
87
+ <xsl:call-template name="generateContents"/>
88
+ </doc>
89
+
90
+ <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
91
+ <xsl:for-each select="document(.)">
92
+ <xsl:variable name="lang">
93
+ <xsl:call-template name="getLang"/>
94
+ </xsl:variable>
95
+ <xsl:variable name="document">
96
+ <xsl:apply-templates mode="change_id">
97
+ <xsl:with-param name="lang" select="$lang"/>
98
+ </xsl:apply-templates>
99
+ </xsl:variable>
100
+ <xsl:for-each select="xalan:nodeset($document)">
101
+ <xsl:variable name="docid">
102
+ <xsl:call-template name="getDocumentId"/>
103
+ </xsl:variable>
104
+ <doc id="{$docid}">
105
+ <xsl:call-template name="generateContents"/>
106
+ </doc>
107
+ </xsl:for-each>
108
+ </xsl:for-each>
109
+ </xsl:for-each>
110
+
111
+
112
+ </xsl:variable>
113
+
114
+ <xsl:template name="generateContents">
110
115
  <contents>
111
116
 
112
117
  <xsl:apply-templates select="/iec:iec-standard/iec:preface/node()" mode="contents"/>
113
118
  <!-- <xsl:with-param name="sectionNum" select="'0'"/>
114
119
  </xsl:apply-templates> -->
115
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[@id='_scope']" mode="contents"> <!-- [@id = '_scope'] -->
120
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]" mode="contents"> <!-- [@id = '_scope'] -->
116
121
  <xsl:with-param name="sectionNum" select="'1'"/>
117
122
  </xsl:apply-templates>
118
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']" mode="contents"> <!-- [@id = '_normative_references'] -->
119
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + 1"/>
123
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]" mode="contents"> <!-- [@id = '_normative_references'] -->
124
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + 1"/>
120
125
  </xsl:apply-templates>
121
126
 
122
127
  <!-- Terms and definitions -->
123
128
  <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms" mode="contents">
124
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + 1"/>
129
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + 1"/>
125
130
  </xsl:apply-templates>
126
- <!-- @id != '_scope' -->
127
- <!-- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[position() &gt; 1]" mode="contents">
128
- <xsl:with-param name="sectionNumSkew" select="'1'"/>
129
- </xsl:apply-templates> -->
130
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]" mode="contents">
131
- <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
131
+
132
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]" mode="contents">
133
+ <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
132
134
  </xsl:apply-templates>
133
135
 
134
136
  <xsl:apply-templates select="/iec:iec-standard/iec:annex" mode="contents"/>
135
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(@id = '_normative_references' or @id = '_references')]" mode="contents"/> <!-- @id = '_bibliography' -->
137
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]" mode="contents"/> <!-- @id = '_bibliography' -->
136
138
 
137
139
  </contents>
138
- </xsl:variable>
139
-
140
+ </xsl:template>
141
+
140
142
  <xsl:variable name="color_blue">rgb(0, 90, 162)</xsl:variable>
141
143
  <xsl:variable name="color_gray">rgb(157, 158, 160)</xsl:variable>
142
144
 
@@ -200,45 +202,9 @@
200
202
  </fo:simple-page-master>
201
203
  </fo:layout-master-set>
202
204
 
205
+ <xsl:call-template name="addPDFUAmeta"/>
203
206
 
204
-
205
- <fo:declarations>
206
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
207
- <pdf:dictionary type="normal" key="ViewerPreferences">
208
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
209
- </pdf:dictionary>
210
- </pdf:catalog>
211
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
212
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
213
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
214
- <!-- Dublin Core properties go here -->
215
- <dc:title>
216
- <xsl:choose>
217
- <xsl:when test="$title-en != ''">
218
- <xsl:value-of select="$title-en"/>
219
- </xsl:when>
220
- <xsl:otherwise>
221
- <xsl:text> </xsl:text>
222
- </xsl:otherwise>
223
- </xsl:choose>
224
- </dc:title>
225
- <dc:creator/>
226
- <dc:description>
227
- <xsl:variable name="abstract">
228
- <xsl:copy-of select="/iec:iec-standard/iec:bibliography/iec:references/iec:bibitem/iec:abstract[@language = 'en']//text()"/>
229
- </xsl:variable>
230
- <xsl:value-of select="normalize-space($abstract)"/>
231
- </dc:description>
232
- <pdf:Keywords/>
233
- </rdf:Description>
234
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
235
- <!-- XMP properties go here -->
236
- <xmp:CreatorTool/>
237
- </rdf:Description>
238
- </rdf:RDF>
239
- </x:xmpmeta>
240
- </fo:declarations>
241
-
207
+ <!-- For 'Published' documents insert two cover pages -->
242
208
  <xsl:if test="$stage &gt;= 60">
243
209
 
244
210
  <!-- 1st Cover Page -->
@@ -481,8 +447,9 @@
481
447
  </fo:page-sequence>
482
448
  </xsl:if>
483
449
 
484
- <xsl:if test="$stage &gt;= 60 or $stage-name = 'FDIS'">
485
- <!-- 3rd Cover Page -->
450
+ <!-- For 'Published' documents insert 3rd Cover Page
451
+ OR insert first Covert Page for FDIS -->
452
+ <xsl:if test="$stage &gt;= 60 or $stage-abbreviation = 'FDIS'">
486
453
  <fo:page-sequence master-reference="cover" force-page-count="no-force">
487
454
  <fo:flow flow-name="xsl-region-body">
488
455
  <xsl:call-template name="insertCoverPart1"/>
@@ -557,7 +524,8 @@
557
524
  </fo:page-sequence>
558
525
  </xsl:if>
559
526
 
560
- <xsl:if test="$stage-name = 'FDIS' or $stage-name = 'CDV'">
527
+ <!-- for non-published documents insert cover page (2nd for FDIS) ) -->
528
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'CDV' or $stage-abbreviation = 'FDIS'">
561
529
  <!-- circulation cover page -->
562
530
  <fo:page-sequence master-reference="cover-FDIS" force-page-count="no-force">
563
531
  <fo:static-content flow-name="footer-FDIS">
@@ -584,7 +552,7 @@
584
552
 
585
553
  <fo:block text-align-last="justify" margin-left="-0.5mm">
586
554
  <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Logo-IEC))}" width="18mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Logo IEC"/>
587
- <xsl:if test="$stage-name != 'CDV'">
555
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
588
556
  <fo:inline font-size="8pt" padding-left="0.5mm" color="{$color_blue}">®</fo:inline>
589
557
  </xsl:if>
590
558
  <fo:inline keep-together.within-line="always" font-size="18pt" font-weight="bold" baseline-shift="10mm"><fo:leader leader-pattern="space"/>
@@ -592,17 +560,20 @@
592
560
  <xsl:text> </xsl:text>
593
561
  </fo:inline>
594
562
  </fo:block>
595
- <fo:block font-size="10pt" text-align="right" margin-top="-2mm" margin-bottom="8pt">
596
- <xsl:if test="$stage-name = 'FDIS'">
563
+ <fo:block font-size="10pt" text-align="right" margin-top="-2mm" margin-bottom="8pt">
564
+ <xsl:call-template name="addLetterSpacing">
565
+ <xsl:with-param name="text" select="concat($stage-fullname-uppercased, ' (', $stage-abbreviation ,')')"/>
566
+ </xsl:call-template>
567
+ <!-- <xsl:if test="$stage-abbreviation = 'FDIS'">
597
568
  <xsl:call-template name="addLetterSpacing">
598
569
  <xsl:with-param name="text" select="'FINAL DRAFT INTERNATIONAL STANDARD (FDIS)'"/>
599
570
  </xsl:call-template>
600
571
  </xsl:if>
601
- <xsl:if test="$stage-name = 'CDV'">
572
+ <xsl:if test="$stage-abbreviation = 'CDV'">
602
573
  <xsl:call-template name="addLetterSpacing">
603
574
  <xsl:with-param name="text" select="'COMMITTEE DRAFT FOR VOTE (CDV)'"/>
604
575
  </xsl:call-template>
605
- </xsl:if>
576
+ </xsl:if> -->
606
577
  <xsl:text> </xsl:text>
607
578
  </fo:block>
608
579
  <fo:block-container margin-left="57mm">
@@ -741,12 +712,12 @@
741
712
  </fo:table-cell>
742
713
  <fo:table-cell border="1.5pt solid {$border-color}" padding="1.5mm" padding-bottom="0mm">
743
714
  <fo:block font-size="6.5pt" margin-bottom="6pt">
744
- <xsl:if test="$stage-name = 'FDIS'">
715
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
745
716
  <xsl:call-template name="addLetterSpacingSmallCaps">
746
717
  <xsl:with-param name="text" select="'horizontal standard:'"/>
747
718
  </xsl:call-template>
748
719
  </xsl:if>
749
- <xsl:if test="$stage-name = 'CDV'">
720
+ <xsl:if test="$stage-abbreviation = 'CDV'">
750
721
  <xsl:call-template name="addLetterSpacingSmallCaps">
751
722
  <xsl:with-param name="text" select="'Proposed horizontal standard:'"/>
752
723
  </xsl:call-template>
@@ -755,7 +726,7 @@
755
726
  <fo:block>
756
727
  <xsl:call-template name="insertCheckBoxOff"/>
757
728
  </fo:block>
758
- <xsl:if test="$stage-name = 'CDV'">
729
+ <xsl:if test="$stage-abbreviation = 'CDV'">
759
730
  <fo:block-container background-color="rgb(236, 232, 232)" margin-left="-2mm" margin-right="-2mm">
760
731
  <fo:block-container margin-left="1mm" margin-right="1mm">
761
732
  <fo:block font-size="8pt" padding="2mm">
@@ -818,12 +789,12 @@
818
789
 
819
790
 
820
791
  <fo:block font-size="8pt" margin-bottom="10pt" text-align="justify">
821
- <xsl:if test="$stage-name = 'FDIS'">
792
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
822
793
  <xsl:call-template name="addLetterSpacing">
823
794
  <xsl:with-param name="text" select="'The attention of IEC National Committees, members of CENELEC, is drawn to the fact that this Final Draft International Standard (FDIS) is submitted for parallel voting.'"/>
824
795
  </xsl:call-template>
825
796
  </xsl:if>
826
- <xsl:if test="$stage-name = 'CDV'">
797
+ <xsl:if test="$stage-abbreviation = 'CDV'">
827
798
  <xsl:call-template name="addLetterSpacing">
828
799
  <xsl:with-param name="text" select="'The attention of IEC National Committees, members of CENELEC, is drawn to the fact that this Committee Draft for Vote (CDV) is submitted for parallel voting.'"/>
829
800
  </xsl:call-template>
@@ -850,7 +821,7 @@
850
821
  </fo:block-container>
851
822
 
852
823
  <fo:block-container font-size="8pt" background-color="rgb(236, 232, 232)" margin-top="5mm" padding="2mm" text-align="justify" border="1.5pt solid white">
853
- <xsl:if test="$stage-name = 'FDIS'">
824
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
854
825
  <fo:block margin-bottom="6pt">
855
826
  <xsl:call-template name="addLetterSpacing">
856
827
  <xsl:with-param name="text">This document is a draft distributed for approval. It may not be referred to as an International Standard until published as such.</xsl:with-param>
@@ -866,8 +837,8 @@
866
837
  <xsl:with-param name="text"> Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</xsl:with-param>
867
838
  </xsl:call-template>
868
839
  </fo:block>
869
- </xsl:if>
870
- <xsl:if test="$stage-name = 'CDV'">
840
+ </xsl:if>
841
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'CDV'">
871
842
  <fo:block margin-bottom="6pt">
872
843
  <xsl:call-template name="addLetterSpacing">
873
844
  <xsl:with-param name="text">This document is still under study and subject to change. It should not be used for reference purposes.</xsl:with-param>
@@ -894,7 +865,7 @@
894
865
  </fo:block>
895
866
  </fo:block-container>
896
867
 
897
- <xsl:if test="$stage-name = 'FDIS'">
868
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
898
869
  <fo:block-container border="1.5 solid" border-color="rgb(221, 213, 213)" height="6.5mm" padding="1mm" margin-top="3mm" display-align="center">
899
870
  <fo:block font-size="6.5pt">
900
871
  <xsl:call-template name="addLetterSpacing">
@@ -918,7 +889,7 @@
918
889
 
919
890
 
920
891
 
921
- <xsl:if test="$stage-name = 'FDIS'">
892
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
922
893
  <fo:block-container font-size="9pt" border="1.5 solid" border-color="rgb(221, 213, 213)" height="13mm" padding="1mm" margin-top="3mm">
923
894
  <fo:block margin-bottom="6pt">
924
895
  <xsl:call-template name="addLetterSpacing">
@@ -946,225 +917,77 @@
946
917
  <xsl:call-template name="insertHeaderFooter"/>
947
918
  <fo:flow flow-name="xsl-region-body">
948
919
 
949
- <fo:block-container>
950
- <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
951
- <xsl:call-template name="addLetterSpacing">
952
- <xsl:with-param name="text" select="'CONTENTS'"/>
953
- </xsl:call-template>
954
- </fo:block>
955
-
920
+ <xsl:variable name="docid">
921
+ <xsl:call-template name="getDocumentId"/>
922
+ </xsl:variable>
923
+
924
+ <xsl:if test="$debug = 'true'">
956
925
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
957
926
  DEBUG
958
927
  contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
959
928
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
960
-
961
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'] [@level &lt;= 3] [not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
962
- <fo:block text-align-last="justify">
963
- <xsl:if test="@level = 1">
964
- <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
965
- </xsl:if>
966
- <xsl:if test="@level = 2">
967
- <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
968
- </xsl:if>
969
- <xsl:if test="@level = 3">
970
- <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
971
- </xsl:if>
972
- <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
973
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
974
- </xsl:if> -->
975
-
976
- <!-- <xsl:choose>
977
- <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
978
- <fo:list-block>
979
- <xsl:attribute name="margin-left">
980
- <xsl:choose>
981
- <xsl:when test="@level = 2">8mm</xsl:when>
982
- <xsl:when test="@level = 3">23mm</xsl:when>
983
- <xsl:otherwise>0mm</xsl:otherwise>
984
- </xsl:choose>
985
- </xsl:attribute>
986
- <xsl:attribute name="provisional-distance-between-starts">
987
- <xsl:choose>
988
- <xsl:when test="@display-section = 'false' or @section = ''">0mm</xsl:when>
989
- <xsl:when test="@level = 1">8mm</xsl:when>
990
- <xsl:when test="@level = 2">15mm</xsl:when>
991
- <xsl:when test="@level = 3">19mm</xsl:when>
992
- <xsl:otherwise>0mm</xsl:otherwise>
993
- </xsl:choose>
994
- </xsl:attribute>
995
- <fo:list-item>
996
- <fo:list-item-label end-indent="label-end()">
997
- <fo:block>
998
- <xsl:if test="not(@display-section = 'false')">
999
- <xsl:value-of select="@section"/>
1000
- </xsl:if>
1001
- </fo:block>
1002
- </fo:list-item-label>
1003
- <fo:list-item-body start-indent="body-start()">
1004
- <fo:block text-align-last="justify">
1005
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1006
- <xsl:if test="@type = 'annex'">
1007
- <fo:inline><xsl:value-of select="@section"/></fo:inline>
1008
- <xsl:if test="@addon != ''">
1009
- <fo:inline> (<xsl:value-of select="@addon"/>) </fo:inline>
1010
- </xsl:if>
1011
- </xsl:if>
1012
- <xsl:call-template name="addLetterSpacing">
1013
- <xsl:with-param name="text" select="text()"/>
1014
- </xsl:call-template>
1015
- <xsl:text> </xsl:text>
1016
- <fo:inline keep-together.within-line="always">
1017
- <fo:leader leader-pattern="dots"/>
1018
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1019
- </fo:inline>
1020
- </fo:basic-link>
1021
- </fo:block>
1022
- </fo:list-item-body>
1023
- </fo:list-item>
1024
- </fo:list-block>
1025
- </fo:block>
1026
- </xsl:for-each>
1027
-
1028
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
1029
- <fo:block margin-bottom="5pt"> </fo:block>
1030
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1031
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
1032
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1033
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1034
- <xsl:value-of select="@section"/>
1035
- <xsl:if test="text() != ''">
1036
- <xsl:text> – </xsl:text>
1037
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1038
- </xsl:if>
1039
- <fo:inline keep-together.within-line="always">
1040
- <fo:leader leader-pattern="dots"/>
1041
- <fo:page-number-citation ref-id="{@id}"/>
1042
- </fo:inline>
1043
- </fo:basic-link>
1044
- </fo:block>
1045
- </xsl:for-each>
1046
- </xsl:if>
1047
-
1048
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1049
- <fo:block margin-bottom="5pt"> </fo:block>
1050
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1051
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table' and @display = 'true']">
1052
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1053
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1054
- <xsl:value-of select="@section"/>
1055
- <xsl:if test="text() != ''">
1056
- <xsl:text> – </xsl:text>
1057
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1058
- </xsl:if>
1059
- <fo:inline keep-together.within-line="always">
1060
- <fo:leader leader-pattern="dots"/>
1061
- <fo:page-number-citation ref-id="{@id}"/>
1062
- </fo:inline>
1063
- </fo:basic-link>
1064
- </fo:block>
1065
- </xsl:for-each>
1066
- </xsl:if>
1067
-
1068
- </fo:block-container>
929
+ </xsl:if>
1069
930
 
1070
- <fo:block break-after="page"/>
931
+ <xsl:call-template name="insertTOCpages">
932
+ <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
933
+ </xsl:call-template>
1071
934
 
1072
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1073
- <fo:block><xsl:value-of select="$organization"/></fo:block>
1074
- <fo:block>___________</fo:block>
1075
- <fo:block> </fo:block>
1076
- <fo:block font-weight="bold">
1077
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1078
- <xsl:text> — </xsl:text>
1079
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1080
- <xsl:if test="$title-part != ''">
1081
- <xsl:text> — </xsl:text>
1082
- <fo:block> </fo:block>
1083
- <fo:block>
1084
- <xsl:if test="$part != ''">
1085
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1086
- <xsl:text>: </xsl:text>
1087
- </xsl:if>
1088
- <xsl:value-of select="$title-part"/>
1089
- </fo:block>
1090
- </xsl:if>
1091
- </fo:block>
1092
- </fo:block-container>
935
+ <xsl:call-template name="insertPrefacepages"/>
1093
936
 
1094
- <!-- Foreword, Introduction -->
1095
- <xsl:apply-templates select="/iec:iec-standard/iec:preface/*"/>
1096
-
1097
937
  </fo:flow>
1098
938
  </fo:page-sequence>
1099
939
 
1100
- <!-- BODY -->
1101
- <fo:page-sequence master-reference="document" force-page-count="no-force">
1102
- <fo:static-content flow-name="xsl-footnote-separator">
1103
- <fo:block>
1104
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1105
- </fo:block>
1106
- </fo:static-content>
1107
- <xsl:call-template name="insertHeaderFooter"/>
1108
- <fo:flow flow-name="xsl-region-body">
1109
-
1110
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1111
- <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1112
- <fo:block>____________</fo:block>
1113
- <fo:block>&#xa0;</fo:block> -->
1114
- <fo:block font-weight="bold">
1115
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1116
- <xsl:text> — </xsl:text>
1117
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1118
- <xsl:if test="$title-part != ''">
1119
- <xsl:text> — </xsl:text>
1120
- <fo:block> </fo:block>
1121
- <fo:block>
1122
- <xsl:if test="$part != ''">
1123
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1124
- <xsl:text>: </xsl:text>
1125
- </xsl:if>
1126
- <xsl:value-of select="$title-part"/>
1127
- </fo:block>
1128
- </xsl:if>
1129
- <fo:block> </fo:block>
1130
- </fo:block>
1131
- </fo:block-container>
1132
-
1133
- <!-- Clause(s) -->
1134
- <fo:block>
1135
-
1136
-
1137
- <!-- Scope -->
1138
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[@id='_scope']">
1139
- <xsl:with-param name="sectionNum" select="'1'"/>
1140
- </xsl:apply-templates>
940
+
941
+ <xsl:call-template name="insertBodypages"/>
942
+
943
+
944
+
945
+ <!-- Test=<xsl:copy-of select="$additionalDocs"/> Test -->
946
+ <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
1141
947
 
1142
- <!-- Normative references -->
1143
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']">
1144
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + 1"/>
1145
- </xsl:apply-templates>
1146
-
1147
- <!-- Terms and definitions -->
1148
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms">
1149
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + 1"/>
1150
- </xsl:apply-templates>
1151
-
1152
- <!-- main sections -->
1153
- <!-- *[position() &gt; 1] -->
1154
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]">
1155
- <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
948
+ <xsl:for-each select="document(.)">
949
+ <xsl:variable name="lang">
950
+ <xsl:call-template name="getLang"/>
951
+ </xsl:variable>
952
+ <xsl:variable name="document">
953
+ <xsl:apply-templates mode="change_id">
954
+ <xsl:with-param name="lang" select="$lang"/>
1156
955
  </xsl:apply-templates>
956
+ </xsl:variable>
957
+
958
+
959
+ <xsl:for-each select="xalan:nodeset($document)">
960
+
961
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
962
+ <xsl:call-template name="insertHeaderFooter"/>
963
+ <fo:flow flow-name="xsl-region-body">
964
+
965
+ <xsl:variable name="docid">
966
+ <xsl:call-template name="getDocumentId"/>
967
+ </xsl:variable>
1157
968
 
1158
- <!-- Annex(s) -->
1159
- <xsl:apply-templates select="/iec:iec-standard/iec:annex"/>
1160
-
1161
- <!-- Bibliography -->
1162
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(@id = '_normative_references' or @id = '_references')]"/>
1163
-
1164
- </fo:block>
969
+ <xsl:call-template name="insertTOCpages">
970
+ <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
971
+ </xsl:call-template>
972
+
973
+ <xsl:call-template name="insertPrefacepages">
974
+ <xsl:with-param name="lang" select="$lang"/>
975
+ </xsl:call-template>
976
+
977
+ </fo:flow>
978
+ </fo:page-sequence>
1165
979
 
1166
- </fo:flow>
1167
- </fo:page-sequence>
980
+ <xsl:call-template name="insertBodypages">
981
+ <xsl:with-param name="lang" select="$lang"/>
982
+ </xsl:call-template>
983
+
984
+
985
+ </xsl:for-each>
986
+ </xsl:for-each>
987
+ </xsl:for-each>
988
+
989
+
990
+
1168
991
 
1169
992
  <xsl:if test="$stage &gt;= 60">
1170
993
  <fo:page-sequence master-reference="blank-page">
@@ -1220,8 +1043,13 @@
1220
1043
  <fo:inline font-size="8pt" padding-left="0.5mm" color="rgb(88, 88, 90)">®</fo:inline>
1221
1044
  <fo:inline keep-together.within-line="always" font-size="25pt" font-weight="bold" color="{$color_gray}" border-bottom="0.5pt solid {$color_gray}" padding-bottom="3.5mm" baseline-shift="5.5mm"><fo:leader leader-pattern="space"/><xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:docidentifier[@type = 'iso']"/></fo:inline>
1222
1045
  </fo:block>
1223
- <fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
1224
- <xsl:text>Edition </xsl:text>
1046
+ <fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
1047
+ <xsl:variable name="title-edition">
1048
+ <xsl:call-template name="getTitle">
1049
+ <xsl:with-param name="name" select="'title-edition'"/>
1050
+ </xsl:call-template>
1051
+ </xsl:variable>
1052
+ <xsl:value-of select="$title-edition"/>
1225
1053
  <fo:inline>
1226
1054
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:edition"/>
1227
1055
  <xsl:if test="not(contains(/iec:iec-standard/iec:bibdata/iec:edition, '.'))">.0</xsl:if>
@@ -1239,7 +1067,19 @@
1239
1067
  <xsl:attribute name="width">100mm</xsl:attribute>
1240
1068
  </xsl:if>
1241
1069
  <fo:block color="{$color_blue}">
1242
- <xsl:value-of select="$doctype_name"/>
1070
+ <xsl:choose>
1071
+ <xsl:when test="$stage-abbreviation = 'FDIS'">
1072
+ <xsl:text>PRE-RELEASE VERSION (FDIS)</xsl:text>
1073
+ </xsl:when>
1074
+ <xsl:when test="$stage &gt;= 60">
1075
+ <xsl:value-of select="$doctype_uppercased"/>
1076
+ </xsl:when>
1077
+ <xsl:otherwise>
1078
+ <xsl:value-of select="$stage-fullname-uppercased"/>
1079
+ <xsl:text> (</xsl:text><xsl:value-of select="$stage-abbreviation"/><xsl:text>)</xsl:text>
1080
+ </xsl:otherwise>
1081
+ </xsl:choose>
1082
+
1243
1083
  </fo:block>
1244
1084
  </fo:block-container>
1245
1085
  <xsl:if test="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr']">
@@ -1293,14 +1133,16 @@
1293
1133
  <xsl:text> — </xsl:text>
1294
1134
  <xsl:value-of select="$title-main"/>
1295
1135
  </xsl:if>
1296
- <xsl:if test="$title-part != ''">
1136
+ <xsl:variable name="part-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-part']"/>
1137
+ <xsl:if test="$part-en != ''">
1297
1138
  <xsl:text> — </xsl:text>
1298
1139
  <xsl:value-of select="$linebreak"/>
1299
1140
  <xsl:if test="$part != ''">
1300
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1301
- <xsl:text>: </xsl:text>
1141
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1142
+ <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1143
+ <xsl:text>: </xsl:text> -->
1302
1144
  </xsl:if>
1303
- <xsl:value-of select="$title-part"/>
1145
+ <xsl:value-of select="$part-en"/>
1304
1146
  </xsl:if>
1305
1147
  </fo:block>
1306
1148
  <fo:block font-size="12pt" font-weight="bold">
@@ -1312,20 +1154,251 @@
1312
1154
  <xsl:text> — </xsl:text>
1313
1155
  <xsl:value-of select="$title-main-fr"/>
1314
1156
  </xsl:if>
1315
- <xsl:if test="$title-part-fr != ''">
1157
+ <xsl:variable name="part-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-part']"/>
1158
+ <xsl:if test="$part-fr != ''">
1316
1159
  <xsl:text> — </xsl:text>
1317
1160
  <xsl:value-of select="$linebreak"/>
1318
1161
  <xsl:if test="$part != ''">
1319
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1320
- <xsl:text>: </xsl:text>
1162
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1163
+ <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1164
+ <xsl:text>: </xsl:text> -->
1321
1165
  </xsl:if>
1322
- <xsl:value-of select="$title-part-fr"/>
1166
+ <xsl:value-of select="$part-fr"/>
1323
1167
  </xsl:if>
1324
1168
  </fo:block>
1325
1169
  </fo:block-container>
1326
1170
  </fo:block-container>
1327
1171
  </xsl:template>
1328
1172
 
1173
+ <xsl:template name="insertTOCpages">
1174
+ <xsl:param name="contents"/>
1175
+ <fo:block-container>
1176
+ <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
1177
+ <xsl:variable name="title-toc">
1178
+ <xsl:call-template name="getTitle">
1179
+ <xsl:with-param name="name" select="'title-toc'"/>
1180
+ </xsl:call-template>
1181
+ </xsl:variable>
1182
+ <xsl:call-template name="addLetterSpacing">
1183
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($title-toc))"/>
1184
+ </xsl:call-template>
1185
+ </fo:block>
1186
+
1187
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'] [@level &lt;= 3] [not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
1188
+ <fo:block text-align-last="justify">
1189
+ <xsl:if test="@level = 1">
1190
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1191
+ </xsl:if>
1192
+ <xsl:if test="@level = 2">
1193
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1194
+ </xsl:if>
1195
+ <xsl:if test="@level = 3">
1196
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1197
+ </xsl:if>
1198
+ <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
1199
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
1200
+ </xsl:if> -->
1201
+
1202
+ <!-- <xsl:choose>
1203
+ <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
1204
+ <fo:list-block>
1205
+ <xsl:attribute name="margin-left">
1206
+ <xsl:choose>
1207
+ <xsl:when test="@level = 2">8mm</xsl:when>
1208
+ <xsl:when test="@level = 3">23mm</xsl:when>
1209
+ <xsl:otherwise>0mm</xsl:otherwise>
1210
+ </xsl:choose>
1211
+ </xsl:attribute>
1212
+ <xsl:attribute name="provisional-distance-between-starts">
1213
+ <xsl:choose>
1214
+ <xsl:when test="@display-section = 'false' or @section = ''">0mm</xsl:when>
1215
+ <xsl:when test="@level = 1">8mm</xsl:when>
1216
+ <xsl:when test="@level = 2">15mm</xsl:when>
1217
+ <xsl:when test="@level = 3">19mm</xsl:when>
1218
+ <xsl:otherwise>0mm</xsl:otherwise>
1219
+ </xsl:choose>
1220
+ </xsl:attribute>
1221
+ <fo:list-item>
1222
+ <fo:list-item-label end-indent="label-end()">
1223
+ <fo:block>
1224
+ <xsl:if test="not(@display-section = 'false')">
1225
+ <xsl:value-of select="@section"/>
1226
+ </xsl:if>
1227
+ </fo:block>
1228
+ </fo:list-item-label>
1229
+ <fo:list-item-body start-indent="body-start()">
1230
+ <fo:block text-align-last="justify">
1231
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1232
+ <xsl:if test="@type = 'annex'">
1233
+ <fo:inline><xsl:value-of select="@section"/></fo:inline>
1234
+ <xsl:if test="@addon != ''">
1235
+ <fo:inline> (<xsl:value-of select="@addon"/>) </fo:inline>
1236
+ </xsl:if>
1237
+ </xsl:if>
1238
+ <xsl:call-template name="addLetterSpacing">
1239
+ <xsl:with-param name="text" select="text()"/>
1240
+ </xsl:call-template>
1241
+ <xsl:text> </xsl:text>
1242
+ <fo:inline keep-together.within-line="always">
1243
+ <fo:leader leader-pattern="dots"/>
1244
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1245
+ </fo:inline>
1246
+ </fo:basic-link>
1247
+ </fo:block>
1248
+ </fo:list-item-body>
1249
+ </fo:list-item>
1250
+ </fo:list-block>
1251
+ </fo:block>
1252
+ </xsl:for-each>
1253
+
1254
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
1255
+ <fo:block margin-bottom="5pt"> </fo:block>
1256
+ <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1257
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
1258
+ <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1259
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1260
+ <xsl:value-of select="@section"/>
1261
+ <xsl:if test="text() != ''">
1262
+ <xsl:text> – </xsl:text>
1263
+ <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1264
+ </xsl:if>
1265
+ <fo:inline keep-together.within-line="always">
1266
+ <fo:leader leader-pattern="dots"/>
1267
+ <fo:page-number-citation ref-id="{@id}"/>
1268
+ </fo:inline>
1269
+ </fo:basic-link>
1270
+ </fo:block>
1271
+ </xsl:for-each>
1272
+ </xsl:if>
1273
+
1274
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1275
+ <fo:block margin-bottom="5pt"> </fo:block>
1276
+ <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1277
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table' and @display = 'true']">
1278
+ <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1279
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1280
+ <xsl:value-of select="@section"/>
1281
+ <xsl:if test="text() != ''">
1282
+ <xsl:text> – </xsl:text>
1283
+ <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1284
+ </xsl:if>
1285
+ <fo:inline keep-together.within-line="always">
1286
+ <fo:leader leader-pattern="dots"/>
1287
+ <fo:page-number-citation ref-id="{@id}"/>
1288
+ </fo:inline>
1289
+ </fo:basic-link>
1290
+ </fo:block>
1291
+ </xsl:for-each>
1292
+ </xsl:if>
1293
+
1294
+ </fo:block-container>
1295
+ </xsl:template>
1296
+
1297
+ <xsl:template name="insertPrefacepages">
1298
+ <xsl:param name="lang" select="$lang"/>
1299
+ <fo:block break-after="page"/>
1300
+ <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1301
+ <fo:block><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor/iec:organization/iec:name))"/></fo:block>
1302
+ <fo:block>___________</fo:block>
1303
+ <fo:block> </fo:block>
1304
+ <fo:block font-weight="bold">
1305
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-intro']))"/>
1306
+ <xsl:text> — </xsl:text>
1307
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-main']))"/>
1308
+
1309
+ <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-part']"/>
1310
+ <xsl:if test="$title-part != ''">
1311
+ <xsl:text> — </xsl:text>
1312
+ <fo:block> </fo:block>
1313
+ <fo:block>
1314
+ <xsl:if test="$part != ''">
1315
+ <!-- Example: Part 1: Riz -->
1316
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/>
1317
+ </xsl:if>
1318
+ <xsl:value-of select="$title-part"/>
1319
+ </fo:block>
1320
+ </xsl:if>
1321
+ </fo:block>
1322
+ </fo:block-container>
1323
+
1324
+ <!-- Foreword, Introduction -->
1325
+ <xsl:apply-templates select="/iec:iec-standard/iec:preface/*"/>
1326
+ </xsl:template>
1327
+
1328
+
1329
+ <xsl:template name="insertBodypages">
1330
+ <xsl:param name="lang" select="'en'"/>
1331
+ <!-- BODY -->
1332
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
1333
+ <fo:static-content flow-name="xsl-footnote-separator">
1334
+ <fo:block>
1335
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
1336
+ </fo:block>
1337
+ </fo:static-content>
1338
+ <xsl:call-template name="insertHeaderFooter"/>
1339
+ <fo:flow flow-name="xsl-region-body">
1340
+
1341
+ <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1342
+ <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1343
+ <fo:block>____________</fo:block>
1344
+ <fo:block>&#xa0;</fo:block> -->
1345
+ <fo:block font-weight="bold">
1346
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-intro']))"/>
1347
+ <xsl:text> — </xsl:text>
1348
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-main']))"/>
1349
+ <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-part']"/>
1350
+ <xsl:if test="$title-part != ''">
1351
+ <xsl:text> — </xsl:text>
1352
+ <fo:block> </fo:block>
1353
+ <fo:block>
1354
+ <xsl:if test="$part != ''">
1355
+ <!-- Example: Part 1: Rice -->
1356
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/>
1357
+ </xsl:if>
1358
+ <xsl:value-of select="$title-part"/>
1359
+ </fo:block>
1360
+ </xsl:if>
1361
+ <fo:block> </fo:block>
1362
+ </fo:block>
1363
+ </fo:block-container>
1364
+
1365
+ <!-- Clause(s) -->
1366
+ <fo:block>
1367
+
1368
+
1369
+ <!-- Scope -->
1370
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]">
1371
+ <xsl:with-param name="sectionNum" select="'1'"/>
1372
+ </xsl:apply-templates>
1373
+
1374
+ <!-- Normative references -->
1375
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]">
1376
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + 1"/>
1377
+ </xsl:apply-templates>
1378
+
1379
+ <!-- Terms and definitions -->
1380
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms">
1381
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + 1"/>
1382
+ </xsl:apply-templates>
1383
+
1384
+ <!-- main sections -->
1385
+ <!-- *[position() &gt; 1] -->
1386
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]">
1387
+ <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
1388
+ </xsl:apply-templates>
1389
+
1390
+ <!-- Annex(s) -->
1391
+ <xsl:apply-templates select="/iec:iec-standard/iec:annex"/>
1392
+
1393
+ <!-- Bibliography -->
1394
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]"/>
1395
+
1396
+ </fo:block>
1397
+
1398
+ </fo:flow>
1399
+ </fo:page-sequence>
1400
+ </xsl:template>
1401
+
1329
1402
  <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
1330
1403
  <xsl:template match="node()">
1331
1404
  <xsl:param name="sectionNum"/>
@@ -1357,8 +1430,8 @@
1357
1430
  <xsl:variable name="sectionNum_">
1358
1431
  <xsl:choose>
1359
1432
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1360
- <xsl:when test="$sectionNumSkew != 0">
1361
- <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- iec:sections/iec:clause | iec:sections/iec:terms -->
1433
+ <xsl:when test="$sectionNumSkew != 0">
1434
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable><!-- <xsl:number count="*"/> -->
1362
1435
  <xsl:value-of select="$number + $sectionNumSkew"/>
1363
1436
  </xsl:when>
1364
1437
  <xsl:otherwise>
@@ -1422,8 +1495,8 @@
1422
1495
  <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
1423
1496
  </xsl:attribute>
1424
1497
  <xsl:choose>
1425
- <xsl:when test="ancestor::iec:preface">
1426
- <xsl:value-of select="translate(., $lower, $upper)"/>
1498
+ <xsl:when test="ancestor::iec:preface">
1499
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
1427
1500
  </xsl:when>
1428
1501
  <xsl:otherwise>
1429
1502
  <xsl:value-of select="."/>
@@ -1445,7 +1518,12 @@
1445
1518
  </xsl:apply-templates>
1446
1519
  <item level="" id="{@id}" display="false" type="figure">
1447
1520
  <xsl:attribute name="section">
1448
- <xsl:text>Figure </xsl:text>
1521
+ <xsl:variable name="title-figure">
1522
+ <xsl:call-template name="getTitle">
1523
+ <xsl:with-param name="name" select="'title-figure'"/>
1524
+ </xsl:call-template>
1525
+ </xsl:variable>
1526
+ <xsl:value-of select="$title-figure"/>
1449
1527
  <xsl:choose>
1450
1528
  <xsl:when test="ancestor::iec:annex">
1451
1529
  <xsl:choose>
@@ -1481,7 +1559,12 @@
1481
1559
  <xsl:attribute name="display">false</xsl:attribute>
1482
1560
  </xsl:if>
1483
1561
  <xsl:attribute name="section">
1484
- <xsl:text>Table </xsl:text>
1562
+ <xsl:variable name="title-table">
1563
+ <xsl:call-template name="getTitle">
1564
+ <xsl:with-param name="name" select="'title-table'"/>
1565
+ </xsl:call-template>
1566
+ </xsl:variable>
1567
+ <xsl:value-of select="$title-table"/>
1485
1568
  <xsl:choose>
1486
1569
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1487
1570
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -1510,7 +1593,12 @@
1510
1593
  <item level="" id="{@id}" display="false" type="formula">
1511
1594
  <xsl:attribute name="section">
1512
1595
  <!-- Formula -->
1513
- <xsl:text>Equation (</xsl:text><xsl:number format="A.1" level="multiple" count="iec:annex | iec:formula"/><xsl:text>)</xsl:text>
1596
+ <xsl:variable name="title-equation">
1597
+ <xsl:call-template name="getTitle">
1598
+ <xsl:with-param name="name" select="'title-equation'"/>
1599
+ </xsl:call-template>
1600
+ </xsl:variable>
1601
+ <xsl:value-of select="$title-equation"/><xsl:number format="(A.1)" level="multiple" count="iec:annex | iec:formula"/>
1514
1602
  </xsl:attribute>
1515
1603
  <xsl:attribute name="parentsection">
1516
1604
  <xsl:for-each select="parent::*[1]/iec:title">
@@ -1580,7 +1668,7 @@
1580
1668
  <xsl:template match="iec:iec-standard/iec:preface/iec:foreword" priority="2">
1581
1669
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1582
1670
  <xsl:call-template name="addLetterSpacing">
1583
- <xsl:with-param name="text" select="translate(iec:title, $lower, $upper)"/>
1671
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/>
1584
1672
  </xsl:call-template>
1585
1673
  </fo:block>
1586
1674
  <fo:block font-size="8.2pt" text-align="justify"> <!-- margin-left="6.3mm" -->
@@ -1595,7 +1683,7 @@
1595
1683
  <fo:block break-after="page"/>
1596
1684
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1597
1685
  <xsl:call-template name="addLetterSpacing">
1598
- <xsl:with-param name="text" select="translate(iec:title, $lower, $upper)"/>
1686
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/>
1599
1687
  </xsl:call-template>
1600
1688
  </fo:block>
1601
1689
  <fo:block>
@@ -1626,7 +1714,8 @@
1626
1714
  <xsl:choose>
1627
1715
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1628
1716
  <xsl:when test="$sectionNumSkew != 0">
1629
- <xsl:variable name="number"><xsl:number count="iec:sections/iec:clause | iec:sections/iec:terms"/></xsl:variable>
1717
+ <!-- <xsl:variable name="number"><xsl:number count="iec:sections/iec:clause | iec:sections/iec:terms"/></xsl:variable> -->
1718
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable>
1630
1719
  <xsl:value-of select="$number + $sectionNumSkew"/>
1631
1720
  </xsl:when>
1632
1721
  </xsl:choose>
@@ -1740,7 +1829,7 @@
1740
1829
  <xsl:apply-templates/>
1741
1830
  </fo:block>
1742
1831
  </xsl:when>
1743
- <xsl:when test="$parent-name = 'references' and not(../@id = '_normative_references' or ../@id = '_references')"> <!-- Bibliography -->
1832
+ <xsl:when test="$parent-name = 'references' and not(starts-with(../@id, '_normative_references') or starts-with(../@id, '_references'))"> <!-- Bibliography -->
1744
1833
  <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="12pt" keep-with-next="always">
1745
1834
  <xsl:call-template name="addLetterSpacing">
1746
1835
  <xsl:with-param name="text" select="."/>
@@ -1749,8 +1838,8 @@
1749
1838
  </fo:block>
1750
1839
  </xsl:when>
1751
1840
  <xsl:when test="$parent-name = 'introduction'">
1752
- <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="10pt">
1753
- <xsl:value-of select="translate(text(), $lower, $upper)"/>
1841
+ <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="10pt">
1842
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(text()))"/>
1754
1843
  </fo:block>
1755
1844
  </xsl:when>
1756
1845
  <xsl:otherwise>
@@ -1908,15 +1997,18 @@
1908
1997
  <xsl:variable name="number">
1909
1998
  <xsl:number level="any" count="iec:p/iec:fn"/>
1910
1999
  </xsl:variable>
2000
+ <xsl:variable name="lang">
2001
+ <xsl:call-template name="getLang"/>
2002
+ </xsl:variable>
1911
2003
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!-- font-size="80%" vertical-align="super"-->
1912
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
2004
+ <fo:basic-link internal-destination="{$lang}_footnote_{@reference}" fox:alt-text="footnote {@reference}">
1913
2005
  <!-- <xsl:value-of select="@reference"/> -->
1914
2006
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1915
2007
  </fo:basic-link>
1916
2008
  </fo:inline>
1917
2009
  <fo:footnote-body>
1918
2010
  <fo:block font-size="8pt" margin-bottom="5pt">
1919
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"> <!-- padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
2011
+ <fo:inline id="{$lang}_footnote_{@reference}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"> <!-- padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
1920
2012
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1921
2013
  </fo:inline>
1922
2014
  <xsl:for-each select="iec:p">
@@ -1956,16 +2048,17 @@
1956
2048
  <fo:block>
1957
2049
  <fo:external-graphic src="{@src}" fox:alt-text="Image"/>
1958
2050
  </fo:block>
1959
- <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">Figure <xsl:number format="1" level="any"/></fo:block>
2051
+ <xsl:variable name="title-figure">
2052
+ <xsl:call-template name="getTitle">
2053
+ <xsl:with-param name="name" select="'title-figure'"/>
2054
+ </xsl:call-template>
2055
+ </xsl:variable>
2056
+ <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt"><xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/></fo:block>
1960
2057
  </fo:block-container>
1961
2058
 
1962
2059
  </xsl:template>
1963
2060
 
1964
- <xsl:template match="iec:figure">
1965
- <xsl:variable name="title">
1966
- <xsl:text>Figure </xsl:text>
1967
- </xsl:variable>
1968
-
2061
+ <xsl:template match="iec:figure">
1969
2062
  <fo:block-container id="{@id}">
1970
2063
  <fo:block>
1971
2064
  <xsl:apply-templates/>
@@ -1975,6 +2068,11 @@
1975
2068
  <xsl:call-template name="note"/>
1976
2069
  </xsl:for-each>
1977
2070
  <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
2071
+ <xsl:variable name="title-figure">
2072
+ <xsl:call-template name="getTitle">
2073
+ <xsl:with-param name="name" select="'title-figure'"/>
2074
+ </xsl:call-template>
2075
+ </xsl:variable>
1978
2076
  <xsl:choose>
1979
2077
  <xsl:when test="ancestor::iec:annex">
1980
2078
 
@@ -1984,13 +2082,14 @@
1984
2082
  <xsl:number format="a) "/>
1985
2083
  </xsl:when>
1986
2084
  <xsl:otherwise> -->
1987
- <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="iec:annex | iec:figure"/>
2085
+
2086
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="iec:annex | iec:figure"/>
1988
2087
  <!-- </xsl:otherwise>
1989
2088
  </xsl:choose> -->
1990
2089
 
1991
2090
  </xsl:when>
1992
2091
  <xsl:otherwise>
1993
- <xsl:value-of select="$title"/><xsl:number format="1" level="any"/>
2092
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
1994
2093
  </xsl:otherwise>
1995
2094
  </xsl:choose>
1996
2095
  <xsl:if test="iec:name">
@@ -2048,13 +2147,13 @@
2048
2147
  <xsl:number level="any" count="iec:bibitem/iec:note"/>
2049
2148
  </xsl:variable>
2050
2149
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!--font-size="85%" vertical-align="super"60% -->
2051
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
2150
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
2052
2151
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2053
2152
  </fo:basic-link>
2054
2153
  </fo:inline>
2055
2154
  <fo:footnote-body>
2056
2155
  <fo:block font-size="8pt" margin-bottom="5pt">
2057
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"><!-- padding-right="9mm" alignment-baseline="hanging" font-size="60%" -->
2156
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"><!-- padding-right="9mm" alignment-baseline="hanging" font-size="60%" -->
2058
2157
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2059
2158
  </fo:inline>
2060
2159
  <xsl:apply-templates/>
@@ -2123,26 +2222,20 @@
2123
2222
  </fo:block>
2124
2223
  </xsl:template>
2125
2224
 
2126
- <xsl:template match="iec:link">
2127
- <fo:inline>
2128
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
2129
- <xsl:choose>
2130
- <xsl:when test="normalize-space(.) = ''">
2131
- <xsl:value-of select="@target"/>
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
- <xsl:apply-templates/>
2135
- </xsl:otherwise>
2136
- </xsl:choose>
2137
- </fo:basic-link>
2138
- </fo:inline>
2225
+ <xsl:template match="iec:term">
2226
+ <xsl:param name="sectionNum"/>
2227
+ <fo:block id="{@id}">
2228
+ <xsl:apply-templates>
2229
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
2230
+ </xsl:apply-templates>
2231
+ </fo:block>
2139
2232
  </xsl:template>
2140
2233
 
2141
2234
  <xsl:template match="iec:preferred">
2142
2235
  <xsl:param name="sectionNum"/>
2143
2236
  <fo:block line-height="1.1" space-before="14pt">
2144
2237
  <fo:block font-weight="bold" keep-with-next="always">
2145
- <fo:inline id="{../@id}">
2238
+ <fo:inline>
2146
2239
  <xsl:value-of select="$sectionNum"/>.<xsl:number count="iec:term"/>
2147
2240
  </fo:inline>
2148
2241
  </fo:block>
@@ -2159,7 +2252,12 @@
2159
2252
  </xsl:template>
2160
2253
 
2161
2254
  <xsl:template match="iec:deprecates">
2162
- <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">DEPRECATED: <xsl:apply-templates/></fo:block>
2255
+ <xsl:variable name="title-deprecated">
2256
+ <xsl:call-template name="getTitle">
2257
+ <xsl:with-param name="name" select="'title-deprecated'"/>
2258
+ </xsl:call-template>
2259
+ </xsl:variable>
2260
+ <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt"><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
2163
2261
  </xsl:template>
2164
2262
 
2165
2263
  <xsl:template match="iec:definition[preceding-sibling::iec:domain]">
@@ -2180,30 +2278,36 @@
2180
2278
  <fo:block margin-bottom="8pt" keep-with-previous="always">
2181
2279
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
2182
2280
  <fo:basic-link internal-destination="{iec:origin/@bibitemid}" fox:alt-text="{iec:origin/@citeas}">
2183
- <xsl:text>[SOURCE: </xsl:text>
2281
+ <xsl:text>[</xsl:text>
2282
+ <xsl:variable name="title-source">
2283
+ <xsl:call-template name="getTitle">
2284
+ <xsl:with-param name="name" select="'title-source'"/>
2285
+ </xsl:call-template>
2286
+ </xsl:variable>
2287
+ <xsl:value-of select="$title-source"/>
2288
+ <xsl:text>: </xsl:text>
2184
2289
  <xsl:value-of select="iec:origin/@citeas"/>
2185
- <xsl:if test="iec:origin/iec:locality/iec:referenceFrom">
2186
- <xsl:text>, </xsl:text><xsl:value-of select="iec:origin/iec:locality/iec:referenceFrom"/>
2187
- </xsl:if>
2290
+ <xsl:apply-templates select="iec:origin/iec:localityStack"/>
2188
2291
  </fo:basic-link>
2189
2292
  <xsl:apply-templates select="iec:modification"/>
2190
2293
  <xsl:text>]</xsl:text>
2191
2294
  </fo:block>
2192
2295
  </xsl:template>
2193
2296
 
2194
- <xsl:template match="iec:modification">
2195
- <xsl:text>, modified — </xsl:text>
2196
- <xsl:apply-templates/>
2197
- </xsl:template>
2297
+
2198
2298
  <xsl:template match="iec:modification/iec:p">
2199
2299
  <fo:inline><xsl:apply-templates/></fo:inline>
2200
2300
  </xsl:template>
2201
2301
 
2202
2302
  <xsl:template match="iec:termnote">
2203
- <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">
2204
- <xsl:text>Note </xsl:text>
2205
- <xsl:number/>
2206
- <xsl:text> to entry: </xsl:text>
2303
+ <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">
2304
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
2305
+ <xsl:variable name="title-note-to-entry">
2306
+ <xsl:call-template name="getTitle">
2307
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
2308
+ </xsl:call-template>
2309
+ </xsl:variable>
2310
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
2207
2311
  <xsl:apply-templates/>
2208
2312
  </fo:block>
2209
2313
  </xsl:template>
@@ -2219,7 +2323,12 @@
2219
2323
 
2220
2324
  <xsl:template match="iec:termexample">
2221
2325
  <fo:block margin-top="14pt" margin-bottom="10pt">
2222
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
2326
+ <xsl:variable name="title-example">
2327
+ <xsl:call-template name="getTitle">
2328
+ <xsl:with-param name="name" select="'title-example'"/>
2329
+ </xsl:call-template>
2330
+ </xsl:variable>
2331
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
2223
2332
  <xsl:apply-templates/>
2224
2333
  </fo:block>
2225
2334
  </xsl:template>
@@ -2236,7 +2345,7 @@
2236
2345
 
2237
2346
 
2238
2347
  <!-- <xsl:template match="iec:references[@id = '_bibliography']"> -->
2239
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]">
2348
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]">
2240
2349
  <fo:block break-after="page"/>
2241
2350
  <xsl:apply-templates/>
2242
2351
  <fo:block-container text-align="center" margin-top="10mm">
@@ -2247,7 +2356,7 @@
2247
2356
 
2248
2357
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
2249
2358
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem"> -->
2250
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem">
2359
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem">
2251
2360
  <fo:list-block margin-top="5pt" margin-bottom="14pt" provisional-distance-between-starts="0mm"> <!-- provisional-distance-between-starts="12mm" -->
2252
2361
  <fo:list-item>
2253
2362
  <fo:list-item-label end-indent="label-end()">
@@ -2280,10 +2389,10 @@
2280
2389
  </xsl:template>
2281
2390
 
2282
2391
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem" mode="contents"/> -->
2283
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem" mode="contents"/>
2392
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem" mode="contents"/>
2284
2393
 
2285
2394
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem/iec:title"> -->
2286
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem/iec:title">
2395
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem/iec:title">
2287
2396
  <fo:inline font-style="italic">
2288
2397
  <xsl:apply-templates/>
2289
2398
  </fo:inline>
@@ -2305,79 +2414,34 @@
2305
2414
 
2306
2415
  <xsl:template match="iec:source">
2307
2416
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2308
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2309
- <xsl:if test="iec:locality">
2310
- <xsl:text>, </xsl:text>
2311
- <xsl:apply-templates select="iec:locality"/>
2312
- </xsl:if>
2417
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2418
+ <xsl:apply-templates select="iec:localityStack"/>
2313
2419
  </fo:basic-link>
2314
2420
  </xsl:template>
2315
2421
 
2316
- <xsl:template match="iec:appendix">
2317
- <fo:block id="{@id}" font-weight="bold" margin-top="5pt" margin-bottom="5pt">
2318
- <xsl:if test="not(iec:title)">
2319
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
2320
- </xsl:if>
2321
- <xsl:apply-templates select="iec:title" mode="process"/>
2322
- </fo:block>
2323
- <xsl:apply-templates/>
2324
- </xsl:template>
2325
-
2326
- <xsl:template match="iec:appendix//iec:example">
2327
- <fo:block margin-top="14pt" margin-bottom="14pt">
2328
- <xsl:text>EXAMPLE</xsl:text>
2329
- <xsl:if test="iec:name">
2330
- <xsl:text> — </xsl:text><xsl:apply-templates select="iec:name" mode="process"/>
2331
- </xsl:if>
2332
- </fo:block>
2333
- <xsl:apply-templates/>
2334
- </xsl:template>
2335
-
2336
- <xsl:template match="iec:appendix//iec:example/iec:name"/>
2337
- <xsl:template match="iec:appendix//iec:example/iec:name" mode="process">
2338
- <fo:inline><xsl:apply-templates/></fo:inline>
2339
- </xsl:template>
2340
-
2341
- <!-- <xsl:template match="iec:callout/text()">
2342
- <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
2343
- </xsl:template> -->
2344
- <xsl:template match="iec:callout">
2345
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
2346
- </xsl:template>
2347
-
2348
- <xsl:template match="iec:annotation">
2349
- <fo:block>
2350
-
2351
- </fo:block>
2352
- <xsl:apply-templates/>
2353
- </xsl:template>
2354
-
2355
- <xsl:template match="iec:annotation/text()"/>
2356
-
2357
- <xsl:template match="iec:annotation/iec:p">
2358
- <xsl:variable name="annotation-id" select="../@id"/>
2359
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
2360
- <fo:block id="{$annotation-id}">
2361
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
2362
- <xsl:apply-templates/>
2363
- </fo:block>
2364
- </xsl:template>
2365
-
2366
-
2367
- <xsl:template match="iec:appendix/iec:title"/>
2368
- <xsl:template match="iec:appendix/iec:title" mode="process">
2369
- <fo:inline><xsl:apply-templates/></fo:inline>
2370
- </xsl:template>
2371
-
2372
2422
 
2373
2423
  <xsl:template match="iec:xref">
2424
+
2425
+ <xsl:variable name="docid">
2426
+ <xsl:call-template name="getDocumentId"/>
2427
+ </xsl:variable>
2428
+ <xsl:variable name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
2429
+ <!-- <xsl:call-template name="generateContents"/>
2430
+ </xsl:variable>
2431
+ -->
2432
+
2374
2433
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
2375
2434
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{$section}">
2376
2435
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
2377
2436
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
2378
2437
  <xsl:variable name="parentsection" select="xalan:nodeset($contents)//item[@id = current()/@target]/@parentsection"/>
2438
+ <xsl:variable name="title-clause">
2439
+ <xsl:call-template name="getTitle">
2440
+ <xsl:with-param name="name" select="'title-clause'"/>
2441
+ </xsl:call-template>
2442
+ </xsl:variable>
2379
2443
  <xsl:choose>
2380
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
2444
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
2381
2445
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
2382
2446
  </xsl:choose>
2383
2447
  <xsl:variable name="currentsection">
@@ -2392,21 +2456,14 @@
2392
2456
  </fo:basic-link>
2393
2457
  </xsl:template>
2394
2458
 
2395
- <xsl:template match="iec:sourcecode">
2396
- <fo:block font-family="Courier" font-size="9pt" margin-top="5pt" margin-bottom="5pt">
2397
- <xsl:choose>
2398
- <xsl:when test="@lang = 'en'"/>
2399
- <xsl:otherwise>
2400
- <xsl:attribute name="white-space">pre</xsl:attribute>
2401
- </xsl:otherwise>
2402
- </xsl:choose>
2403
- <xsl:apply-templates/>
2404
- </fo:block>
2405
- </xsl:template>
2406
-
2407
2459
  <xsl:template match="iec:example/iec:p">
2408
2460
  <fo:block>
2409
- <fo:inline padding-right="9mm">EXAMPLE</fo:inline>
2461
+ <xsl:variable name="title-example">
2462
+ <xsl:call-template name="getTitle">
2463
+ <xsl:with-param name="name" select="'title-example'"/>
2464
+ </xsl:call-template>
2465
+ </xsl:variable>
2466
+ <fo:inline padding-right="9mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
2410
2467
  <xsl:apply-templates/>
2411
2468
  </fo:block>
2412
2469
  </xsl:template>
@@ -2417,7 +2474,12 @@
2417
2474
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
2418
2475
  </xsl:if>
2419
2476
  <fo:inline padding-right="6mm">
2420
- <xsl:text>NOTE </xsl:text>
2477
+ <xsl:variable name="title-note">
2478
+ <xsl:call-template name="getTitle">
2479
+ <xsl:with-param name="name" select="'title-note'"/>
2480
+ </xsl:call-template>
2481
+ </xsl:variable>
2482
+ <xsl:value-of select="$title-note"/>
2421
2483
  <xsl:if test="ancestor::iec:figure">
2422
2484
  <xsl:variable name="id" select="ancestor::iec:figure[1]/@id"/>
2423
2485
  <xsl:if test="count(//iec:note[ancestor::*[@id = $id]]) &gt; 1">
@@ -2438,25 +2500,31 @@
2438
2500
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2439
2501
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2440
2502
  </xsl:if>
2441
-
2442
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2443
- <xsl:if test="iec:locality">
2444
- <xsl:text>, </xsl:text>
2445
- <!-- <xsl:choose>
2446
- <xsl:when test="iec:locality/@type = 'section'">Section </xsl:when>
2447
- <xsl:when test="iec:locality/@type = 'clause'">Clause </xsl:when>
2448
- <xsl:otherwise></xsl:otherwise>
2449
- </xsl:choose> -->
2450
- <xsl:apply-templates select="iec:locality"/>
2451
- </xsl:if>
2503
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2504
+ <xsl:apply-templates select="iec:localityStack"/>
2452
2505
  </fo:basic-link>
2453
2506
  </xsl:template>
2454
2507
 
2455
2508
  <xsl:template match="iec:locality">
2509
+ <xsl:variable name="title-clause">
2510
+ <xsl:call-template name="getTitle">
2511
+ <xsl:with-param name="name" select="'title-clause'"/>
2512
+ </xsl:call-template>
2513
+ </xsl:variable>
2514
+ <xsl:variable name="title-annex">
2515
+ <xsl:call-template name="getTitle">
2516
+ <xsl:with-param name="name" select="'title-annex'"/>
2517
+ </xsl:call-template>
2518
+ </xsl:variable>
2519
+ <xsl:variable name="title-table">
2520
+ <xsl:call-template name="getTitle">
2521
+ <xsl:with-param name="name" select="'title-table'"/>
2522
+ </xsl:call-template>
2523
+ </xsl:variable>
2456
2524
  <xsl:choose>
2457
- <xsl:when test="@type ='clause'">Clause </xsl:when>
2458
- <xsl:when test="@type ='annex'">Annex </xsl:when>
2459
- <xsl:when test="@type ='table'">Table </xsl:when>
2525
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
2526
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
2527
+ <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
2460
2528
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2461
2529
  </xsl:choose>
2462
2530
  <xsl:text> </xsl:text><xsl:value-of select="iec:referenceFrom"/>
@@ -2466,7 +2534,7 @@
2466
2534
  <fo:block-container border="0.5pt solid black" margin-left="-2mm" margin-right="-2mm" space-before="18pt" space-after="12pt">
2467
2535
  <fo:block-container margin-left="0mm" margin-right="0mm" font-weight="bold" padding="1mm" padding-top="2mm">
2468
2536
  <fo:block text-align="justify">
2469
- <fo:inline><xsl:value-of select="translate(@type, $lower, $upper)"/> – </fo:inline>
2537
+ <fo:inline><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/> – </fo:inline>
2470
2538
  <xsl:apply-templates/>
2471
2539
  </fo:block>
2472
2540
  </fo:block-container>
@@ -2485,6 +2553,12 @@
2485
2553
  </xsl:call-template>
2486
2554
  </xsl:template>
2487
2555
 
2556
+ <xsl:template match="iec:formula">
2557
+ <fo:block id="{@id}">
2558
+ <xsl:apply-templates/>
2559
+ </fo:block>
2560
+ </xsl:template>
2561
+
2488
2562
  <xsl:template match="iec:formula/iec:dt/iec:stem">
2489
2563
  <fo:inline>
2490
2564
  <xsl:apply-templates/>
@@ -2498,7 +2572,7 @@
2498
2572
  </xsl:template>
2499
2573
 
2500
2574
  <xsl:template match="iec:formula/iec:stem">
2501
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2575
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2502
2576
  <fo:table table-layout="fixed" width="100%">
2503
2577
  <fo:table-column column-width="95%"/>
2504
2578
  <fo:table-column column-width="5%"/>
@@ -2513,7 +2587,7 @@
2513
2587
  <fo:block text-align="right" margin-right="-10mm">
2514
2588
  <xsl:choose>
2515
2589
  <xsl:when test="ancestor::iec:annex">
2516
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="iec:annex | iec:formula"/><xsl:text>)</xsl:text>
2590
+ <xsl:number format="(A.1)" level="multiple" count="iec:annex | iec:formula"/>
2517
2591
  </xsl:when>
2518
2592
  <xsl:otherwise> <!-- not(ancestor::iec:annex) -->
2519
2593
  <xsl:text>(</xsl:text><xsl:number level="any" count="iec:formula"/><xsl:text>)</xsl:text>
@@ -2587,38 +2661,6 @@
2587
2661
  </fo:static-content>
2588
2662
  </xsl:template>
2589
2663
 
2590
- <xsl:template name="getId">
2591
- <xsl:choose>
2592
- <xsl:when test="../@id">
2593
- <xsl:value-of select="../@id"/>
2594
- </xsl:when>
2595
- <xsl:otherwise>
2596
- <xsl:value-of select="text()"/>
2597
- </xsl:otherwise>
2598
- </xsl:choose>
2599
- </xsl:template>
2600
-
2601
- <xsl:template name="getLevel">
2602
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2603
- <xsl:variable name="level">
2604
- <xsl:choose>
2605
- <xsl:when test="ancestor::iec:preface">
2606
- <xsl:value-of select="$level_total - 2"/>
2607
- </xsl:when>
2608
- <xsl:when test="ancestor::iec:sections">
2609
- <xsl:value-of select="$level_total - 2"/>
2610
- </xsl:when>
2611
- <xsl:when test="ancestor::iec:bibliography">
2612
- <xsl:value-of select="$level_total - 2"/>
2613
- </xsl:when>
2614
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2615
- <xsl:otherwise>
2616
- <xsl:value-of select="$level_total - 1"/>
2617
- </xsl:otherwise>
2618
- </xsl:choose>
2619
- </xsl:variable>
2620
- <xsl:value-of select="$level"/>
2621
- </xsl:template>
2622
2664
 
2623
2665
  <xsl:template name="getSection">
2624
2666
  <xsl:param name="sectionNum"/>
@@ -2638,7 +2680,7 @@
2638
2680
  </xsl:when>
2639
2681
  <xsl:when test="$level &gt;= 2">
2640
2682
  <xsl:variable name="num">
2641
- <xsl:number format=".1" level="multiple" count="iec:clause/iec:clause | iec:clause/iec:terms | iec:terms/iec:term | iec:clause/iec:term"/>
2683
+ <xsl:call-template name="getSubSection"/>
2642
2684
  </xsl:variable>
2643
2685
  <xsl:value-of select="concat($sectionNum, $num)"/>
2644
2686
  </xsl:when>
@@ -2661,7 +2703,12 @@
2661
2703
  <xsl:when test="ancestor::iec:annex">
2662
2704
  <xsl:choose>
2663
2705
  <xsl:when test="$level = 1">
2664
- <xsl:text>Annex </xsl:text>
2706
+ <xsl:variable name="title-annex">
2707
+ <xsl:call-template name="getTitle">
2708
+ <xsl:with-param name="name" select="'title-annex'"/>
2709
+ </xsl:call-template>
2710
+ </xsl:variable>
2711
+ <xsl:value-of select="$title-annex"/>
2665
2712
  <xsl:choose>
2666
2713
  <xsl:when test="count(//iec:annex) = 1">
2667
2714
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:annexid"/>
@@ -2746,7 +2793,7 @@
2746
2793
  <xsl:param name="letter-spacing" select="'0.15'"/>
2747
2794
  <xsl:if test="string-length($text) &gt; 0">
2748
2795
  <xsl:variable name="char" select="substring($text,1,1)"/>
2749
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2796
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2750
2797
  <xsl:choose>
2751
2798
  <xsl:when test="$char=$upperCase">
2752
2799
  <fo:inline font-size="{100 div 0.75}%">
@@ -2778,13 +2825,263 @@
2778
2825
  </fo:inline>
2779
2826
  </xsl:template>
2780
2827
 
2781
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2828
+ <xsl:template match="node()" mode="change_id">
2829
+ <xsl:param name="lang"/>
2830
+ <xsl:copy>
2831
+ <xsl:apply-templates select="@*|node()" mode="change_id">
2832
+ <xsl:with-param name="lang" select="$lang"/>
2833
+ </xsl:apply-templates>
2834
+ </xsl:copy>
2835
+ </xsl:template>
2836
+
2837
+ <xsl:template match="@*" mode="change_id">
2838
+ <xsl:param name="lang"/>
2839
+ <xsl:choose>
2840
+ <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
2841
+ <xsl:attribute name="{local-name()}">
2842
+ <xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
2843
+ </xsl:attribute>
2844
+ </xsl:when>
2845
+ <xsl:otherwise>
2846
+ <xsl:copy>
2847
+ <xsl:apply-templates select="@*" mode="change_id">
2848
+ <xsl:with-param name="lang" select="$lang"/>
2849
+ </xsl:apply-templates>
2850
+ </xsl:copy>
2851
+ </xsl:otherwise>
2852
+ </xsl:choose>
2853
+ </xsl:template>
2854
+ <!-- DEBUG ONLY -->
2855
+ <!-- <xsl:template match="iec:title" mode="change_id">
2856
+ <xsl:copy>
2857
+ <xsl:apply-templates select="@*" mode="change_id">
2858
+ <xsl:with-param name="lang" select="$lang"/>
2859
+ </xsl:apply-templates>FR <xsl:apply-templates mode="change_id"/>
2860
+ </xsl:copy>
2861
+ </xsl:template> -->
2862
+
2863
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2864
+
2865
+ <title-table lang="en">Table </title-table>
2866
+ <title-table lang="fr">Tableau </title-table>
2867
+
2868
+ <title-table lang="zh">Table </title-table>
2869
+
2870
+
2871
+
2872
+ <title-note lang="en">NOTE </title-note>
2873
+ <title-note lang="fr">NOTE </title-note>
2874
+
2875
+ <title-note lang="zh">NOTE </title-note>
2876
+
2877
+
2878
+
2879
+ <title-figure lang="en">Figure </title-figure>
2880
+ <title-figure lang="fr">Figure </title-figure>
2881
+
2882
+ <title-figure lang="zh">Figure </title-figure>
2883
+
2884
+
2885
+
2886
+ <title-example lang="en">EXAMPLE </title-example>
2887
+ <title-example lang="fr">EXEMPLE </title-example>
2888
+
2889
+ <title-example lang="zh">EXAMPLE </title-example>
2890
+
2891
+
2892
+
2893
+ <title-example-xref lang="en">Example </title-example-xref>
2894
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2895
+
2896
+ <title-section lang="en">Section </title-section>
2897
+ <title-section lang="fr">Section </title-section>
2898
+
2899
+ <title-inequality lang="en">Inequality </title-inequality>
2900
+ <title-inequality lang="fr">Inequality </title-inequality>
2901
+
2902
+ <title-equation lang="en">Equation </title-equation>
2903
+ <title-equation lang="fr">Equation </title-equation>
2904
+
2905
+ <title-annex lang="en">Annex </title-annex>
2906
+ <title-annex lang="fr">Annexe </title-annex>
2907
+
2908
+ <title-annex lang="zh">Annex </title-annex>
2909
+
2910
+
2911
+
2912
+ <title-appendix lang="en">Appendix </title-appendix>
2913
+ <title-appendix lang="fr">Appendix </title-appendix>
2914
+
2915
+ <title-clause lang="en">Clause </title-clause>
2916
+ <title-clause lang="fr">Article </title-clause>
2917
+
2918
+ <title-clause lang="zh">Clause </title-clause>
2919
+
2920
+
2921
+
2922
+ <title-edition lang="en">
2923
+
2924
+ <xsl:text>Edition </xsl:text>
2925
+
2926
+
2927
+ </title-edition>
2928
+
2929
+ <title-formula lang="en">Formula </title-formula>
2930
+ <title-formula lang="fr">Formula </title-formula>
2931
+
2932
+ <title-toc lang="en">
2933
+
2934
+ <xsl:text>Contents</xsl:text>
2935
+
2936
+
2937
+
2938
+ </title-toc>
2939
+ <title-toc lang="fr">Sommaire</title-toc>
2940
+
2941
+ <title-toc lang="zh">Contents</title-toc>
2942
+
2943
+
2944
+
2945
+ <title-page lang="en">Page</title-page>
2946
+ <title-page lang="fr">Page</title-page>
2947
+
2948
+ <title-key lang="en">Key</title-key>
2949
+ <title-key lang="fr">Légende</title-key>
2950
+
2951
+ <title-where lang="en">where</title-where>
2952
+ <title-where lang="fr">où</title-where>
2953
+
2954
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2955
+
2956
+ <title-part lang="en">
2957
+
2958
+
2959
+ <xsl:text>Part #: </xsl:text>
2960
+
2961
+ </title-part>
2962
+ <title-part lang="fr">
2963
+
2964
+
2965
+ <xsl:text>Partie #: </xsl:text>
2966
+
2967
+ </title-part>
2968
+ <title-part lang="zh">第 # 部分:</title-part>
2969
+
2970
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2971
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2972
+
2973
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2974
+
2975
+
2976
+
2977
+ <title-modified lang="en">modified</title-modified>
2978
+ <title-modified lang="fr">modifiée</title-modified>
2979
+
2980
+ <title-modified lang="zh">modified</title-modified>
2981
+
2982
+
2983
+
2984
+ <title-source lang="en">SOURCE</title-source>
2985
+
2986
+ <title-keywords lang="en">Keywords</title-keywords>
2987
+
2988
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2989
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2990
+
2991
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2992
+
2993
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2994
+
2995
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2996
+
2997
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2998
+
2999
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3000
+
3001
+ <title-abstract lang="en">Abstract</title-abstract>
3002
+
3003
+ <title-summary lang="en">Summary</title-summary>
3004
+
3005
+ <title-in lang="en">in </title-in>
3006
+
3007
+ <title-box lang="en">Box </title-box>
3008
+
3009
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3010
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3011
+
3012
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3013
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3014
+
3015
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3016
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3017
+
3018
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3019
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3020
+
3021
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3022
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3023
+
3024
+ <title-caution lang="en">CAUTION</title-caution>
3025
+ <title-caution lang="zh">注意</title-caution>
3026
+
3027
+ <title-warning lang="en">WARNING</title-warning>
3028
+ <title-warning lang="zh">警告</title-warning>
3029
+
3030
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3031
+ </xsl:variable><xsl:template name="getTitle">
3032
+ <xsl:param name="name"/>
3033
+ <xsl:variable name="lang">
3034
+ <xsl:call-template name="getLang"/>
3035
+ </xsl:variable>
3036
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3037
+ <xsl:choose>
3038
+ <xsl:when test="normalize-space($title_) != ''">
3039
+ <xsl:value-of select="$title_"/>
3040
+ </xsl:when>
3041
+ <xsl:otherwise>
3042
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3043
+ </xsl:otherwise>
3044
+ </xsl:choose>
3045
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
3046
+
3047
+
3048
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
3049
+
3050
+
3051
+
3052
+
3053
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
3054
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
3055
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
3056
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
3057
+
3058
+
3059
+
3060
+
3061
+
3062
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
3063
+
3064
+
3065
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3066
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
3067
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
3068
+
3069
+
3070
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
3071
+
3072
+
3073
+ <xsl:attribute name="margin-top">14pt</xsl:attribute>
3074
+ <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
3075
+
3076
+
3077
+ </xsl:attribute-set><xsl:template match="text()">
2782
3078
  <xsl:value-of select="."/>
2783
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
3079
+ </xsl:template><xsl:template match="*[local-name()='br']">
2784
3080
  <xsl:value-of select="$linebreak"/>
2785
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1">
2786
- <xsl:call-template name="add-zero-spaces"/>
2787
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
3081
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3082
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3083
+ <xsl:call-template name="add-zero-spaces-java"/>
3084
+ </xsl:template><xsl:template match="*[local-name()='table']">
2788
3085
 
2789
3086
  <xsl:variable name="simple-table">
2790
3087
  <!-- <xsl:copy> -->
@@ -2798,7 +3095,9 @@
2798
3095
 
2799
3096
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2800
3097
 
2801
-
3098
+ <!-- <xsl:if test="$namespace = 'iso'">
3099
+ <fo:block space-before="6pt">&#xA0;</fo:block>
3100
+ </xsl:if> -->
2802
3101
 
2803
3102
  <xsl:if test="not(ancestor::*[local-name() = 'preface'])">
2804
3103
  <!-- <fo:block space-before="2pt">&#xA0;</fo:block> -->
@@ -2812,6 +3111,7 @@
2812
3111
 
2813
3112
  <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2814
3113
 
3114
+
2815
3115
  <xsl:if test="ancestor::*[local-name() = 'preface']">
2816
3116
  <xsl:attribute name="visibility">hidden</xsl:attribute>
2817
3117
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -2825,28 +3125,18 @@
2825
3125
 
2826
3126
 
2827
3127
 
2828
- <xsl:text>Table </xsl:text>
2829
- <xsl:choose>
2830
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2831
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2832
- </xsl:when>
2833
- <xsl:when test="ancestor::*[local-name()='annex']">
2834
-
2835
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2836
-
2837
-
2838
-
2839
-
2840
-
2841
-
2842
- </xsl:when>
2843
- <xsl:otherwise>
2844
-
2845
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata']) and not(ancestor::*[local-name()='preface'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2846
-
2847
-
2848
- </xsl:otherwise>
2849
- </xsl:choose>
3128
+
3129
+
3130
+ <xsl:variable name="title-table">
3131
+ <xsl:call-template name="getTitle">
3132
+ <xsl:with-param name="name" select="'title-table'"/>
3133
+ </xsl:call-template>
3134
+ </xsl:variable>
3135
+ <xsl:value-of select="$title-table"/>
3136
+
3137
+ <xsl:call-template name="getTableNumber"/>
3138
+
3139
+
2850
3140
  <xsl:if test="*[local-name()='name']">
2851
3141
 
2852
3142
 
@@ -2891,11 +3181,11 @@
2891
3181
  </xsl:call-template>
2892
3182
  </xsl:variable>
2893
3183
 
2894
- <xsl:variable name="colwidths2">
3184
+ <!-- <xsl:variable name="colwidths2">
2895
3185
  <xsl:call-template name="calculate-column-widths">
2896
3186
  <xsl:with-param name="cols-count" select="$cols-count"/>
2897
3187
  </xsl:call-template>
2898
- </xsl:variable>
3188
+ </xsl:variable> -->
2899
3189
 
2900
3190
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2901
3191
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -2920,7 +3210,9 @@
2920
3210
 
2921
3211
 
2922
3212
 
2923
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
3213
+
3214
+
3215
+ <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2924
3216
 
2925
3217
 
2926
3218
  <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
@@ -2932,12 +3224,14 @@
2932
3224
 
2933
3225
 
2934
3226
 
3227
+
2935
3228
  <!-- <xsl:if test="ancestor::*[local-name()='preface']"> -->
2936
3229
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2937
3230
 
3231
+
2938
3232
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2939
3233
  <xsl:choose>
2940
- <xsl:when test=". = 1">
3234
+ <xsl:when test=". = 1 or . = 0">
2941
3235
  <fo:table-column column-width="proportional-column-width(2)"/>
2942
3236
  </xsl:when>
2943
3237
  <xsl:otherwise>
@@ -2945,18 +3239,54 @@
2945
3239
  </xsl:otherwise>
2946
3240
  </xsl:choose>
2947
3241
  </xsl:for-each>
2948
- <xsl:apply-templates/>
3242
+
3243
+ <xsl:choose>
3244
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3245
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3246
+ </xsl:when>
3247
+ <xsl:otherwise>
3248
+ <xsl:apply-templates/>
3249
+ </xsl:otherwise>
3250
+ </xsl:choose>
3251
+
2949
3252
  </fo:table>
3253
+
3254
+
3255
+
2950
3256
  </fo:block-container>
2951
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
3257
+ </xsl:template><xsl:template name="getTableNumber">
3258
+ <xsl:choose>
3259
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3260
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3261
+ </xsl:when>
3262
+ <xsl:when test="ancestor::*[local-name()='annex']">
3263
+
3264
+
3265
+
3266
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
3267
+
3268
+
3269
+
3270
+
3271
+
3272
+
3273
+ </xsl:when>
3274
+ <xsl:otherwise>
3275
+
3276
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata']) and not(ancestor::*[local-name()='preface'])] [not(@unnumbered) or @unnumbered != 'true']"/>
3277
+
3278
+
3279
+ </xsl:otherwise>
3280
+ </xsl:choose>
3281
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2952
3282
  <xsl:apply-templates/>
2953
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
3283
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2954
3284
  <xsl:param name="table-row"/>
2955
3285
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2956
3286
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2957
3287
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2958
3288
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2959
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
3289
+ </xsl:template><xsl:template name="calculate-column-widths">
2960
3290
  <xsl:param name="table"/>
2961
3291
  <xsl:param name="cols-count"/>
2962
3292
  <xsl:param name="curr-col" select="1"/>
@@ -2965,7 +3295,7 @@
2965
3295
  <xsl:if test="$curr-col &lt;= $cols-count">
2966
3296
  <xsl:variable name="widths">
2967
3297
  <xsl:choose>
2968
- <xsl:when test="not($table)">
3298
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2969
3299
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2970
3300
  <xsl:variable name="words">
2971
3301
  <xsl:call-template name="tokenize">
@@ -3000,9 +3330,20 @@
3000
3330
  </xsl:when>
3001
3331
  <xsl:otherwise>
3002
3332
  <xsl:for-each select="xalan:nodeset($table)//tr">
3333
+ <xsl:variable name="td_text">
3334
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3335
+ </xsl:variable>
3003
3336
  <xsl:variable name="words">
3337
+ <xsl:variable name="string_with_added_zerospaces">
3338
+ <xsl:call-template name="add-zero-spaces-java">
3339
+ <xsl:with-param name="text" select="$td_text"/>
3340
+ </xsl:call-template>
3341
+ </xsl:variable>
3004
3342
  <xsl:call-template name="tokenize">
3005
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
3343
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3344
+ <!-- 2009 thinspace -->
3345
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3346
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
3006
3347
  </xsl:call-template>
3007
3348
  </xsl:variable>
3008
3349
  <xsl:variable name="max_length">
@@ -3043,71 +3384,110 @@
3043
3384
  <xsl:with-param name="table" select="$table"/>
3044
3385
  </xsl:call-template>
3045
3386
  </xsl:if>
3046
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
3047
- <!-- <fo:table-header font-weight="bold">
3048
- <xsl:apply-templates />
3049
- </fo:table-header> -->
3050
- <xsl:apply-templates/>
3051
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
3052
- <xsl:apply-templates/>
3053
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3387
+ </xsl:template><xsl:template match="text()" mode="td_text">
3388
+ <xsl:variable name="zero-space">​</xsl:variable>
3389
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3390
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3391
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3392
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3393
+ <xsl:value-of select="@target"/>
3394
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3395
+ <xsl:param name="cols-count"/>
3396
+ <!-- font-weight="bold" -->
3397
+ <fo:table-header>
3398
+
3399
+ <xsl:apply-templates/>
3400
+ </fo:table-header>
3401
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3402
+ <fo:table-body>
3403
+ <xsl:apply-templates/>
3404
+ </fo:table-body>
3405
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3406
+ <xsl:apply-templates/>
3407
+ </xsl:template><xsl:template name="insertTableFooter">
3408
+ <xsl:param name="cols-count"/>
3409
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3410
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3411
+
3412
+ <fo:table-footer>
3413
+
3414
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3415
+
3416
+ <!-- if there are note(s) or fn(s) then create footer row -->
3417
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3418
+
3419
+
3420
+
3421
+ <fo:table-row>
3422
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3423
+
3424
+
3425
+ <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
3426
+
3427
+
3428
+ <!-- fn will be processed inside 'note' processing -->
3429
+
3430
+ <xsl:if test="../*[local-name()='note']">
3431
+ <fo:block margin-bottom="6pt"> </fo:block>
3432
+ </xsl:if>
3433
+
3434
+
3435
+ <!-- except gb -->
3436
+
3437
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3438
+
3439
+
3440
+ <!-- horizontal row separator -->
3441
+
3442
+ <xsl:if test="../*[local-name()='note']">
3443
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3444
+ <fo:block font-size="1pt"> </fo:block>
3445
+ </fo:block-container>
3446
+ </xsl:if>
3447
+
3448
+
3449
+ <!-- fn processing -->
3450
+ <xsl:call-template name="fn_display"/>
3451
+
3452
+ </fo:table-cell>
3453
+ </fo:table-row>
3454
+
3455
+ </xsl:if>
3456
+ </fo:table-footer>
3457
+
3458
+ </xsl:if>
3459
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3460
+
3054
3461
  <xsl:variable name="cols-count">
3055
3462
  <xsl:choose>
3056
- <xsl:when test="../*[local-name()='thead']">
3057
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3463
+ <xsl:when test="../*[local-name()='thead']">
3058
3464
  <xsl:call-template name="calculate-columns-numbers">
3059
3465
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3060
3466
  </xsl:call-template>
3061
3467
  </xsl:when>
3062
- <xsl:otherwise>
3063
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3468
+ <xsl:otherwise>
3064
3469
  <xsl:call-template name="calculate-columns-numbers">
3065
3470
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3066
3471
  </xsl:call-template>
3067
3472
  </xsl:otherwise>
3068
3473
  </xsl:choose>
3069
3474
  </xsl:variable>
3070
-
3475
+
3476
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3477
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3478
+ </xsl:apply-templates>
3479
+
3480
+ <xsl:call-template name="insertTableFooter">
3481
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3482
+ </xsl:call-template>
3483
+
3071
3484
  <fo:table-body>
3072
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3073
3485
  <xsl:apply-templates/>
3074
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3075
- <!-- if there are note(s) or fn(s) then create footer row -->
3076
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
3077
- <fo:table-row>
3078
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3079
-
3080
-
3081
- <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
3082
-
3083
-
3084
- <!-- fn will be processed inside 'note' processing -->
3085
-
3086
- <xsl:if test="../*[local-name()='note']">
3087
- <fo:block margin-bottom="6pt"> </fo:block>
3088
- </xsl:if>
3089
-
3090
-
3091
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3092
-
3093
- <!-- horizontal row separator -->
3094
-
3095
- <xsl:if test="../*[local-name()='note']">
3096
- <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3097
- <fo:block font-size="1pt"> </fo:block>
3098
- </fo:block-container>
3099
- </xsl:if>
3100
-
3101
-
3102
- <!-- fn processing -->
3103
- <xsl:call-template name="fn_display"/>
3104
-
3105
- </fo:table-cell>
3106
- </fo:table-row>
3107
-
3108
- </xsl:if>
3486
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
3487
+
3109
3488
  </fo:table-body>
3110
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3489
+
3490
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3111
3491
  <xsl:variable name="parent-name" select="local-name(..)"/>
3112
3492
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3113
3493
  <fo:table-row min-height="4mm">
@@ -3130,9 +3510,10 @@
3130
3510
 
3131
3511
  </xsl:if>
3132
3512
 
3513
+
3133
3514
  <xsl:apply-templates/>
3134
3515
  </fo:table-row>
3135
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3516
+ </xsl:template><xsl:template match="*[local-name()='th']">
3136
3517
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3137
3518
 
3138
3519
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3163,7 +3544,7 @@
3163
3544
  <xsl:apply-templates/>
3164
3545
  </fo:block>
3165
3546
  </fo:table-cell>
3166
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3547
+ </xsl:template><xsl:template match="*[local-name()='td']">
3167
3548
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3168
3549
  <!-- and ancestor::*[local-name() = 'thead'] -->
3169
3550
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3175,6 +3556,8 @@
3175
3556
  </xsl:if>
3176
3557
 
3177
3558
 
3559
+
3560
+
3178
3561
  <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
3179
3562
  <xsl:if test="ancestor::*[local-name()='preface']">
3180
3563
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -3194,6 +3577,7 @@
3194
3577
  </xsl:attribute>
3195
3578
  </xsl:if>
3196
3579
  <fo:block>
3580
+
3197
3581
  <xsl:apply-templates/>
3198
3582
  </fo:block>
3199
3583
  <!-- <xsl:choose>
@@ -3209,31 +3593,42 @@
3209
3593
 
3210
3594
 
3211
3595
  </fo:table-cell>
3212
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3596
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3213
3597
 
3214
3598
 
3215
3599
  <fo:block font-size="10pt" margin-bottom="12pt">
3216
3600
 
3217
3601
 
3602
+
3218
3603
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3219
3604
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3220
3605
 
3606
+
3221
3607
  <fo:inline padding-right="2mm">
3222
- <xsl:text>NOTE </xsl:text>
3608
+
3609
+
3610
+ <xsl:variable name="title-note">
3611
+ <xsl:call-template name="getTitle">
3612
+ <xsl:with-param name="name" select="'title-note'"/>
3613
+ </xsl:call-template>
3614
+ </xsl:variable>
3615
+ <xsl:value-of select="$title-note"/>
3223
3616
 
3224
3617
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3225
3618
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
3226
3619
  <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
3227
3620
  </xsl:if>
3621
+
3622
+
3228
3623
 
3229
3624
 
3230
3625
  </fo:inline>
3231
3626
  <xsl:apply-templates mode="process"/>
3232
3627
  </fo:block>
3233
3628
 
3234
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3629
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3235
3630
  <xsl:apply-templates/>
3236
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3631
+ </xsl:template><xsl:template name="fn_display">
3237
3632
  <xsl:variable name="references">
3238
3633
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3239
3634
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3249,11 +3644,13 @@
3249
3644
  <fo:block margin-bottom="12pt">
3250
3645
 
3251
3646
 
3647
+
3252
3648
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3253
3649
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3254
3650
  <xsl:attribute name="text-indent">-6mm</xsl:attribute>
3255
3651
  <xsl:attribute name="margin-left">6mm</xsl:attribute>
3256
3652
 
3653
+
3257
3654
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3258
3655
 
3259
3656
 
@@ -3263,6 +3660,7 @@
3263
3660
 
3264
3661
 
3265
3662
 
3663
+
3266
3664
  <xsl:value-of select="@reference"/>
3267
3665
 
3268
3666
  </fo:inline>
@@ -3273,7 +3671,7 @@
3273
3671
  </fo:block>
3274
3672
  </xsl:if>
3275
3673
  </xsl:for-each>
3276
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3674
+ </xsl:template><xsl:template name="fn_name_display">
3277
3675
  <!-- <xsl:variable name="references">
3278
3676
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3279
3677
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3289,7 +3687,7 @@
3289
3687
  <xsl:apply-templates/>
3290
3688
  </fo:block>
3291
3689
  </xsl:for-each>
3292
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3690
+ </xsl:template><xsl:template name="fn_display_figure">
3293
3691
  <xsl:variable name="key_iso">
3294
3692
  true <!-- and (not(@class) or @class !='pseudocode') -->
3295
3693
  </xsl:variable>
@@ -3300,6 +3698,36 @@
3300
3698
  </fn>
3301
3699
  </xsl:for-each>
3302
3700
  </xsl:variable>
3701
+
3702
+ <!-- current hierarchy is 'figure' element -->
3703
+ <xsl:variable name="following_dl_colwidths">
3704
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3705
+ <xsl:variable name="html-table">
3706
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3707
+ <xsl:element name="{$ns}:table">
3708
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3709
+ <tbody>
3710
+ <xsl:apply-templates mode="dl"/>
3711
+ </tbody>
3712
+ </xsl:for-each>
3713
+ </xsl:element>
3714
+ </xsl:variable>
3715
+
3716
+ <xsl:call-template name="calculate-column-widths">
3717
+ <xsl:with-param name="cols-count" select="2"/>
3718
+ <xsl:with-param name="table" select="$html-table"/>
3719
+ </xsl:call-template>
3720
+
3721
+ </xsl:if>
3722
+ </xsl:variable>
3723
+
3724
+
3725
+ <xsl:variable name="maxlength_dt">
3726
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3727
+ <xsl:call-template name="getMaxLength_dt"/>
3728
+ </xsl:for-each>
3729
+ </xsl:variable>
3730
+
3303
3731
  <xsl:if test="xalan:nodeset($references)//fn">
3304
3732
  <fo:block>
3305
3733
  <fo:table width="95%" table-layout="fixed">
@@ -3309,8 +3737,19 @@
3309
3737
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3310
3738
 
3311
3739
  </xsl:if>
3312
- <fo:table-column column-width="15%"/>
3313
- <fo:table-column column-width="85%"/>
3740
+ <xsl:choose>
3741
+ <!-- if there 'dl', then set same columns width -->
3742
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3743
+ <xsl:call-template name="setColumnWidth_dl">
3744
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3745
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3746
+ </xsl:call-template>
3747
+ </xsl:when>
3748
+ <xsl:otherwise>
3749
+ <fo:table-column column-width="15%"/>
3750
+ <fo:table-column column-width="85%"/>
3751
+ </xsl:otherwise>
3752
+ </xsl:choose>
3314
3753
  <fo:table-body>
3315
3754
  <xsl:for-each select="xalan:nodeset($references)//fn">
3316
3755
  <xsl:variable name="reference" select="@reference"/>
@@ -3349,7 +3788,7 @@
3349
3788
  </fo:block>
3350
3789
  </xsl:if>
3351
3790
 
3352
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3791
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3353
3792
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3354
3793
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3355
3794
 
@@ -3361,16 +3800,17 @@
3361
3800
 
3362
3801
 
3363
3802
 
3803
+
3364
3804
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3365
3805
 
3366
3806
  <xsl:value-of select="@reference"/>
3367
3807
  </fo:basic-link>
3368
3808
  </fo:inline>
3369
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3809
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3370
3810
  <fo:inline>
3371
3811
  <xsl:apply-templates/>
3372
3812
  </fo:inline>
3373
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3813
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3374
3814
  <xsl:variable name="parent" select="local-name(..)"/>
3375
3815
 
3376
3816
  <xsl:variable name="key_iso">
@@ -3382,11 +3822,22 @@
3382
3822
  <xsl:choose>
3383
3823
  <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
3384
3824
 
3385
- <fo:block margin-bottom="15pt" text-align="left">
3386
- <xsl:text>where </xsl:text>
3825
+ <fo:block text-align="left">
3826
+
3827
+ <xsl:attribute name="margin-bottom">15pt</xsl:attribute>
3828
+
3829
+
3830
+ <xsl:variable name="title-where">
3831
+ <xsl:call-template name="getTitle">
3832
+ <xsl:with-param name="name" select="'title-where'"/>
3833
+ </xsl:call-template>
3834
+ </xsl:variable>
3835
+ <xsl:value-of select="$title-where"/>
3387
3836
  </fo:block>
3388
3837
  <fo:block>
3838
+
3389
3839
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3840
+
3390
3841
  <xsl:text> </xsl:text>
3391
3842
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3392
3843
  </fo:block>
@@ -3400,17 +3851,29 @@
3400
3851
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
3401
3852
 
3402
3853
 
3403
- <xsl:text>where</xsl:text>
3854
+
3855
+ <xsl:variable name="title-where">
3856
+ <xsl:call-template name="getTitle">
3857
+ <xsl:with-param name="name" select="'title-where'"/>
3858
+ </xsl:call-template>
3859
+ </xsl:variable>
3860
+ <xsl:value-of select="$title-where"/>
3404
3861
  </fo:block>
3405
3862
  </xsl:when>
3406
3863
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3407
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3864
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3408
3865
 
3409
3866
 
3410
3867
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3411
3868
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3412
3869
 
3413
- <xsl:text>Key</xsl:text>
3870
+
3871
+ <xsl:variable name="title-key">
3872
+ <xsl:call-template name="getTitle">
3873
+ <xsl:with-param name="name" select="'title-key'"/>
3874
+ </xsl:call-template>
3875
+ </xsl:variable>
3876
+ <xsl:value-of select="$title-key"/>
3414
3877
  </fo:block>
3415
3878
  </xsl:when>
3416
3879
  </xsl:choose>
@@ -3424,25 +3887,11 @@
3424
3887
 
3425
3888
  <fo:block>
3426
3889
 
3427
- <!-- create virtual html table for dl/[dt and dd] -->
3428
- <xsl:variable name="html-table">
3429
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3430
- <xsl:element name="{$ns}:table">
3431
- <tbody>
3432
- <xsl:apply-templates mode="dl"/>
3433
- </tbody>
3434
- </xsl:element>
3435
- </xsl:variable>
3436
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3437
- <xsl:variable name="colwidths">
3438
- <xsl:call-template name="calculate-column-widths">
3439
- <xsl:with-param name="cols-count" select="2"/>
3440
- <xsl:with-param name="table" select="$html-table"/>
3441
- </xsl:call-template>
3442
- </xsl:variable>
3443
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3890
+
3891
+
3444
3892
 
3445
3893
  <fo:table width="95%" table-layout="fixed">
3894
+
3446
3895
  <xsl:choose>
3447
3896
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3448
3897
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -3454,42 +3903,30 @@
3454
3903
 
3455
3904
  </xsl:when>
3456
3905
  </xsl:choose>
3457
- <xsl:choose>
3458
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3459
- <fo:table-column column-width="50%"/>
3460
- <fo:table-column column-width="50%"/>
3461
- </xsl:when>
3462
- <xsl:otherwise>
3463
- <xsl:choose>
3464
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3465
- <fo:table-column column-width="60%"/>
3466
- <fo:table-column column-width="40%"/>
3467
- </xsl:when> -->
3468
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3469
- <fo:table-column column-width="50%"/>
3470
- <fo:table-column column-width="50%"/>
3471
- </xsl:when>
3472
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3473
- <fo:table-column column-width="40%"/>
3474
- <fo:table-column column-width="60%"/>
3475
- </xsl:when>
3476
- <xsl:otherwise>
3477
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3478
- <xsl:choose>
3479
- <xsl:when test=". = 1">
3480
- <fo:table-column column-width="proportional-column-width(2)"/>
3481
- </xsl:when>
3482
- <xsl:otherwise>
3483
- <fo:table-column column-width="proportional-column-width({.})"/>
3484
- </xsl:otherwise>
3485
- </xsl:choose>
3486
- </xsl:for-each>
3487
- </xsl:otherwise>
3488
- </xsl:choose>
3489
- <!-- <fo:table-column column-width="15%"/>
3490
- <fo:table-column column-width="85%"/> -->
3491
- </xsl:otherwise>
3492
- </xsl:choose>
3906
+ <!-- create virtual html table for dl/[dt and dd] -->
3907
+ <xsl:variable name="html-table">
3908
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3909
+ <xsl:element name="{$ns}:table">
3910
+ <tbody>
3911
+ <xsl:apply-templates mode="dl"/>
3912
+ </tbody>
3913
+ </xsl:element>
3914
+ </xsl:variable>
3915
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3916
+ <xsl:variable name="colwidths">
3917
+ <xsl:call-template name="calculate-column-widths">
3918
+ <xsl:with-param name="cols-count" select="2"/>
3919
+ <xsl:with-param name="table" select="$html-table"/>
3920
+ </xsl:call-template>
3921
+ </xsl:variable>
3922
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3923
+ <xsl:variable name="maxlength_dt">
3924
+ <xsl:call-template name="getMaxLength_dt"/>
3925
+ </xsl:variable>
3926
+ <xsl:call-template name="setColumnWidth_dl">
3927
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3928
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3929
+ </xsl:call-template>
3493
3930
  <fo:table-body>
3494
3931
  <xsl:apply-templates>
3495
3932
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3499,7 +3936,61 @@
3499
3936
  </fo:block>
3500
3937
  </fo:block>
3501
3938
  </xsl:if>
3502
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
3939
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3940
+ <xsl:param name="colwidths"/>
3941
+ <xsl:param name="maxlength_dt"/>
3942
+ <xsl:choose>
3943
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3944
+ <fo:table-column column-width="50%"/>
3945
+ <fo:table-column column-width="50%"/>
3946
+ </xsl:when>
3947
+ <xsl:otherwise>
3948
+ <xsl:choose>
3949
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3950
+ <fo:table-column column-width="5%"/>
3951
+ <fo:table-column column-width="95%"/>
3952
+ </xsl:when>
3953
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3954
+ <fo:table-column column-width="10%"/>
3955
+ <fo:table-column column-width="90%"/>
3956
+ </xsl:when>
3957
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3958
+ <fo:table-column column-width="60%"/>
3959
+ <fo:table-column column-width="40%"/>
3960
+ </xsl:when> -->
3961
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3962
+ <fo:table-column column-width="50%"/>
3963
+ <fo:table-column column-width="50%"/>
3964
+ </xsl:when>
3965
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3966
+ <fo:table-column column-width="40%"/>
3967
+ <fo:table-column column-width="60%"/>
3968
+ </xsl:when>
3969
+ <xsl:otherwise>
3970
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3971
+ <xsl:choose>
3972
+ <xsl:when test=". = 1 or . = 0">
3973
+ <fo:table-column column-width="proportional-column-width(2)"/>
3974
+ </xsl:when>
3975
+ <xsl:otherwise>
3976
+ <fo:table-column column-width="proportional-column-width({.})"/>
3977
+ </xsl:otherwise>
3978
+ </xsl:choose>
3979
+ </xsl:for-each>
3980
+ </xsl:otherwise>
3981
+ </xsl:choose>
3982
+ <!-- <fo:table-column column-width="15%"/>
3983
+ <fo:table-column column-width="85%"/> -->
3984
+ </xsl:otherwise>
3985
+ </xsl:choose>
3986
+ </xsl:template><xsl:template name="getMaxLength_dt">
3987
+ <xsl:for-each select="*[local-name()='dt']">
3988
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3989
+ <xsl:if test="position() = 1">
3990
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3991
+ </xsl:if>
3992
+ </xsl:for-each>
3993
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3503
3994
  <xsl:param name="key_iso"/>
3504
3995
 
3505
3996
  <!-- <tr>
@@ -3515,7 +4006,12 @@
3515
4006
  <xsl:if test="normalize-space($key_iso) = 'true'">
3516
4007
  <xsl:attribute name="margin-top">0</xsl:attribute>
3517
4008
  </xsl:if>
3518
- NOTE
4009
+ <xsl:variable name="title-note">
4010
+ <xsl:call-template name="getTitle">
4011
+ <xsl:with-param name="name" select="'title-note'"/>
4012
+ </xsl:call-template>
4013
+ </xsl:variable>
4014
+ <xsl:value-of select="$title-note"/>
3519
4015
  </fo:block>
3520
4016
  </fo:table-cell>
3521
4017
  <fo:table-cell>
@@ -3524,7 +4020,7 @@
3524
4020
  </fo:block>
3525
4021
  </fo:table-cell>
3526
4022
  </fo:table-row>
3527
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
4023
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3528
4024
  <tr>
3529
4025
  <td>
3530
4026
  <xsl:apply-templates/>
@@ -3537,13 +4033,15 @@
3537
4033
  </td>
3538
4034
  </tr>
3539
4035
 
3540
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
4036
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3541
4037
  <xsl:param name="key_iso"/>
3542
4038
 
3543
4039
  <fo:table-row>
3544
4040
  <fo:table-cell>
4041
+
3545
4042
  <fo:block margin-top="6pt">
3546
4043
 
4044
+
3547
4045
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
3548
4046
 
3549
4047
  <xsl:if test="normalize-space($key_iso) = 'true'">
@@ -3554,7 +4052,15 @@
3554
4052
  </xsl:if>
3555
4053
 
3556
4054
 
4055
+
4056
+
4057
+
3557
4058
  <xsl:apply-templates/>
4059
+ <!-- <xsl:if test="$namespace = 'gb'">
4060
+ <xsl:if test="ancestor::*[local-name()='formula']">
4061
+ <xsl:text>—</xsl:text>
4062
+ </xsl:if>
4063
+ </xsl:if> -->
3558
4064
  </fo:block>
3559
4065
  </fo:table-cell>
3560
4066
  <fo:table-cell>
@@ -3568,37 +4074,37 @@
3568
4074
  </fo:table-cell>
3569
4075
  </fo:table-row>
3570
4076
 
3571
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
4077
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3572
4078
  <xsl:apply-templates/>
3573
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
4079
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3574
4080
  <xsl:apply-templates/>
3575
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3576
- <fo:inline><xsl:apply-templates/></fo:inline>
3577
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
4081
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4082
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4083
+ </xsl:template><xsl:template match="*[local-name()='em']">
3578
4084
  <fo:inline font-style="italic">
3579
4085
  <xsl:apply-templates/>
3580
4086
  </fo:inline>
3581
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
4087
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3582
4088
  <fo:inline font-weight="bold">
3583
4089
  <xsl:apply-templates/>
3584
4090
  </fo:inline>
3585
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
4091
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3586
4092
  <fo:inline font-size="80%" vertical-align="super">
3587
4093
  <xsl:apply-templates/>
3588
4094
  </fo:inline>
3589
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
4095
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3590
4096
  <fo:inline font-size="80%" vertical-align="sub">
3591
4097
  <xsl:apply-templates/>
3592
4098
  </fo:inline>
3593
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3594
- <fo:inline font-family="Courier" font-size="10pt">
4099
+ </xsl:template><xsl:template match="*[local-name()='tt']">
4100
+ <fo:inline font-family="Courier" font-size="10pt">
3595
4101
  <xsl:apply-templates/>
3596
4102
  </fo:inline>
3597
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
4103
+ </xsl:template><xsl:template match="*[local-name()='del']">
3598
4104
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3599
4105
  <xsl:apply-templates/>
3600
4106
  </fo:inline>
3601
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
4107
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3602
4108
  <xsl:variable name="text" select="normalize-space(.)"/>
3603
4109
  <fo:inline font-size="75%">
3604
4110
  <xsl:if test="string-length($text) &gt; 0">
@@ -3607,10 +4113,11 @@
3607
4113
  </xsl:call-template>
3608
4114
  </xsl:if>
3609
4115
  </fo:inline>
3610
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
4116
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3611
4117
  <xsl:param name="text"/>
3612
4118
  <xsl:variable name="char" select="substring($text,1,1)"/>
3613
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4119
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4120
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3614
4121
  <xsl:choose>
3615
4122
  <xsl:when test="$char=$upperCase">
3616
4123
  <fo:inline font-size="{100 div 0.75}%">
@@ -3626,7 +4133,7 @@
3626
4133
  <xsl:with-param name="text" select="substring($text,2)"/>
3627
4134
  </xsl:call-template>
3628
4135
  </xsl:if>
3629
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
4136
+ </xsl:template><xsl:template name="tokenize">
3630
4137
  <xsl:param name="text"/>
3631
4138
  <xsl:param name="separator" select="' '"/>
3632
4139
  <xsl:choose>
@@ -3674,7 +4181,7 @@
3674
4181
  </xsl:call-template>
3675
4182
  </xsl:otherwise>
3676
4183
  </xsl:choose>
3677
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
4184
+ </xsl:template><xsl:template name="max_length">
3678
4185
  <xsl:param name="words"/>
3679
4186
  <xsl:for-each select="$words//word">
3680
4187
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3682,12 +4189,17 @@
3682
4189
  <xsl:value-of select="."/>
3683
4190
  </xsl:if>
3684
4191
  </xsl:for-each>
3685
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
4192
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4193
+ <xsl:param name="text" select="."/>
4194
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4195
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4196
+ </xsl:template><xsl:template name="add-zero-spaces">
3686
4197
  <xsl:param name="text" select="."/>
3687
4198
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3688
4199
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3689
4200
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3690
4201
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4202
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3691
4203
  <xsl:variable name="zero-space">​</xsl:variable>
3692
4204
  <xsl:choose>
3693
4205
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -3722,11 +4234,19 @@
3722
4234
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3723
4235
  </xsl:call-template>
3724
4236
  </xsl:when>
4237
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
4238
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
4239
+ <xsl:value-of select="$zero-space-after-underscore"/>
4240
+ <xsl:value-of select="$zero-space"/>
4241
+ <xsl:call-template name="add-zero-spaces">
4242
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
4243
+ </xsl:call-template>
4244
+ </xsl:when>
3725
4245
  <xsl:otherwise>
3726
4246
  <xsl:value-of select="$text"/>
3727
4247
  </xsl:otherwise>
3728
4248
  </xsl:choose>
3729
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
4249
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3730
4250
  <xsl:param name="text" select="."/>
3731
4251
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3732
4252
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3752,7 +4272,7 @@
3752
4272
  <xsl:value-of select="$text"/>
3753
4273
  </xsl:otherwise>
3754
4274
  </xsl:choose>
3755
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
4275
+ </xsl:template><xsl:template name="getSimpleTable">
3756
4276
  <xsl:variable name="simple-table">
3757
4277
 
3758
4278
  <!-- Step 1. colspan processing -->
@@ -3779,9 +4299,9 @@
3779
4299
  </xsl:choose> -->
3780
4300
  </xsl:variable>
3781
4301
  <xsl:copy-of select="$simple-table"/>
3782
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4302
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3783
4303
  <xsl:apply-templates mode="simple-table-colspan"/>
3784
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4304
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3785
4305
  <xsl:choose>
3786
4306
  <xsl:when test="@colspan">
3787
4307
  <xsl:variable name="td">
@@ -3803,16 +4323,16 @@
3803
4323
  </xsl:element>
3804
4324
  </xsl:otherwise>
3805
4325
  </xsl:choose>
3806
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
4326
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3807
4327
  <xsl:element name="tr">
3808
4328
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3809
4329
  <xsl:apply-templates mode="simple-table-colspan"/>
3810
4330
  </xsl:element>
3811
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
4331
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3812
4332
  <xsl:copy>
3813
4333
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3814
4334
  </xsl:copy>
3815
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
4335
+ </xsl:template><xsl:template name="repeatNode">
3816
4336
  <xsl:param name="count"/>
3817
4337
  <xsl:param name="node"/>
3818
4338
 
@@ -3823,18 +4343,18 @@
3823
4343
  </xsl:call-template>
3824
4344
  <xsl:copy-of select="$node"/>
3825
4345
  </xsl:if>
3826
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
4346
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3827
4347
  <xsl:copy>
3828
4348
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3829
4349
  </xsl:copy>
3830
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
4350
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3831
4351
  <xsl:copy>
3832
4352
  <xsl:copy-of select="tr[1]"/>
3833
4353
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3834
4354
  <xsl:with-param name="previousRow" select="tr[1]"/>
3835
4355
  </xsl:apply-templates>
3836
4356
  </xsl:copy>
3837
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4357
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3838
4358
  <xsl:param name="previousRow"/>
3839
4359
  <xsl:variable name="currentRow" select="."/>
3840
4360
 
@@ -3868,34 +4388,320 @@
3868
4388
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3869
4389
  <xsl:with-param name="previousRow" select="$newRow"/>
3870
4390
  </xsl:apply-templates>
3871
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4391
+ </xsl:template><xsl:template name="getLang">
3872
4392
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3873
4393
  <xsl:choose>
3874
4394
  <xsl:when test="$language = 'English'">en</xsl:when>
3875
4395
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3876
4396
  </xsl:choose>
3877
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4397
+ </xsl:template><xsl:template name="capitalizeWords">
3878
4398
  <xsl:param name="str"/>
3879
4399
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3880
4400
  <xsl:choose>
3881
4401
  <xsl:when test="contains($str2, ' ')">
3882
4402
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3883
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3884
- <xsl:value-of select="substring($substr, 2)"/>
4403
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4404
+ <xsl:value-of select="substring($substr, 2)"/> -->
4405
+ <xsl:call-template name="capitalize">
4406
+ <xsl:with-param name="str" select="$substr"/>
4407
+ </xsl:call-template>
3885
4408
  <xsl:text> </xsl:text>
3886
4409
  <xsl:call-template name="capitalizeWords">
3887
4410
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3888
4411
  </xsl:call-template>
3889
4412
  </xsl:when>
3890
4413
  <xsl:otherwise>
3891
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3892
- <xsl:value-of select="substring($str2, 2)"/>
4414
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4415
+ <xsl:value-of select="substring($str2, 2)"/> -->
4416
+ <xsl:call-template name="capitalize">
4417
+ <xsl:with-param name="str" select="$str2"/>
4418
+ </xsl:call-template>
3893
4419
  </xsl:otherwise>
3894
4420
  </xsl:choose>
3895
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4421
+ </xsl:template><xsl:template name="capitalize">
4422
+ <xsl:param name="str"/>
4423
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4424
+ <xsl:value-of select="substring($str, 2)"/>
4425
+ </xsl:template><xsl:template match="mathml:math">
3896
4426
  <fo:inline font-family="STIX2Math">
3897
4427
  <fo:instream-foreign-object fox:alt-text="Math">
3898
4428
  <xsl:copy-of select="."/>
3899
4429
  </fo:instream-foreign-object>
3900
4430
  </fo:inline>
4431
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
4432
+ <xsl:for-each select="*[local-name()='locality']">
4433
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4434
+ <xsl:apply-templates select="."/>
4435
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4436
+ </xsl:for-each>
4437
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
4438
+ <xsl:variable name="target">
4439
+ <xsl:choose>
4440
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4441
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
4442
+ </xsl:when>
4443
+ <xsl:otherwise>
4444
+ <xsl:value-of select="normalize-space(@target)"/>
4445
+ </xsl:otherwise>
4446
+ </xsl:choose>
4447
+ </xsl:variable>
4448
+ <fo:inline xsl:use-attribute-sets="link-style">
4449
+ <xsl:choose>
4450
+ <xsl:when test="$target = ''">
4451
+ <xsl:apply-templates/>
4452
+ </xsl:when>
4453
+ <xsl:otherwise>
4454
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4455
+ <xsl:choose>
4456
+ <xsl:when test="normalize-space(.) = ''">
4457
+ <xsl:value-of select="$target"/>
4458
+ </xsl:when>
4459
+ <xsl:otherwise>
4460
+ <xsl:apply-templates/>
4461
+ </xsl:otherwise>
4462
+ </xsl:choose>
4463
+ </fo:basic-link>
4464
+ </xsl:otherwise>
4465
+ </xsl:choose>
4466
+ </fo:inline>
4467
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4468
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4469
+ <!-- <xsl:choose>
4470
+ <xsl:when test="@lang = 'en'"></xsl:when>
4471
+ <xsl:otherwise> -->
4472
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4473
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4474
+ <!-- </xsl:otherwise>
4475
+ </xsl:choose> -->
4476
+ <xsl:apply-templates/>
4477
+ </fo:block>
4478
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4479
+ <fo:inline id="{@id}"/>
4480
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4481
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4482
+ <xsl:variable name="title-appendix">
4483
+ <xsl:call-template name="getTitle">
4484
+ <xsl:with-param name="name" select="'title-appendix'"/>
4485
+ </xsl:call-template>
4486
+ </xsl:variable>
4487
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4488
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4489
+ </fo:block>
4490
+ <xsl:apply-templates/>
4491
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4492
+ <fo:inline><xsl:apply-templates/></fo:inline>
4493
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4494
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4495
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4496
+ <xsl:variable name="title-example">
4497
+ <xsl:call-template name="getTitle">
4498
+ <xsl:with-param name="name" select="'title-example'"/>
4499
+ </xsl:call-template>
4500
+ </xsl:variable>
4501
+ <xsl:value-of select="$title-example"/>
4502
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4503
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4504
+ </xsl:if>
4505
+ <xsl:if test="*[local-name()='name']">
4506
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4507
+ </xsl:if>
4508
+ </fo:block>
4509
+ <xsl:apply-templates/>
4510
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4511
+ <fo:inline><xsl:apply-templates/></fo:inline>
4512
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4513
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4514
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4515
+ <xsl:variable name="annotation-id" select="@id"/>
4516
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4517
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4518
+ <fo:inline>
4519
+ <xsl:apply-templates>
4520
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4521
+ </xsl:apply-templates>
4522
+ </fo:inline>
4523
+ </fo:block>
4524
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4525
+ <xsl:param name="callout"/>
4526
+ <fo:inline id="{@id}">
4527
+ <!-- for first p in annotation, put <x> -->
4528
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4529
+ <xsl:apply-templates/>
4530
+ </fo:inline>
4531
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4532
+ <xsl:variable name="title-modified">
4533
+ <xsl:call-template name="getTitle">
4534
+ <xsl:with-param name="name" select="'title-modified'"/>
4535
+ </xsl:call-template>
4536
+ </xsl:variable>
4537
+ <xsl:choose>
4538
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4539
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4540
+ </xsl:choose>
4541
+ <xsl:apply-templates/>
4542
+ </xsl:template><xsl:template name="convertDate">
4543
+ <xsl:param name="date"/>
4544
+ <xsl:param name="format" select="'short'"/>
4545
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4546
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4547
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4548
+ <xsl:variable name="monthStr">
4549
+ <xsl:choose>
4550
+ <xsl:when test="$month = '01'">January</xsl:when>
4551
+ <xsl:when test="$month = '02'">February</xsl:when>
4552
+ <xsl:when test="$month = '03'">March</xsl:when>
4553
+ <xsl:when test="$month = '04'">April</xsl:when>
4554
+ <xsl:when test="$month = '05'">May</xsl:when>
4555
+ <xsl:when test="$month = '06'">June</xsl:when>
4556
+ <xsl:when test="$month = '07'">July</xsl:when>
4557
+ <xsl:when test="$month = '08'">August</xsl:when>
4558
+ <xsl:when test="$month = '09'">September</xsl:when>
4559
+ <xsl:when test="$month = '10'">October</xsl:when>
4560
+ <xsl:when test="$month = '11'">November</xsl:when>
4561
+ <xsl:when test="$month = '12'">December</xsl:when>
4562
+ </xsl:choose>
4563
+ </xsl:variable>
4564
+ <xsl:variable name="result">
4565
+ <xsl:choose>
4566
+ <xsl:when test="$format = 'short' or $day = ''">
4567
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4568
+ </xsl:when>
4569
+ <xsl:otherwise>
4570
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4571
+ </xsl:otherwise>
4572
+ </xsl:choose>
4573
+ </xsl:variable>
4574
+ <xsl:value-of select="$result"/>
4575
+ </xsl:template><xsl:template name="insertKeywords">
4576
+ <xsl:param name="sorting" select="'true'"/>
4577
+ <xsl:param name="charAtEnd" select="'.'"/>
4578
+ <xsl:param name="charDelim" select="', '"/>
4579
+ <xsl:choose>
4580
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4581
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4582
+ <xsl:sort data-type="text" order="ascending"/>
4583
+ <xsl:call-template name="insertKeyword">
4584
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4585
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4586
+ </xsl:call-template>
4587
+ </xsl:for-each>
4588
+ </xsl:when>
4589
+ <xsl:otherwise>
4590
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4591
+ <xsl:call-template name="insertKeyword">
4592
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4593
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4594
+ </xsl:call-template>
4595
+ </xsl:for-each>
4596
+ </xsl:otherwise>
4597
+ </xsl:choose>
4598
+ </xsl:template><xsl:template name="insertKeyword">
4599
+ <xsl:param name="charAtEnd"/>
4600
+ <xsl:param name="charDelim"/>
4601
+ <xsl:apply-templates/>
4602
+ <xsl:choose>
4603
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4604
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4605
+ </xsl:choose>
4606
+ </xsl:template><xsl:template name="addPDFUAmeta">
4607
+ <fo:declarations>
4608
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4609
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4610
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4611
+ </pdf:dictionary>
4612
+ </pdf:catalog>
4613
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4614
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4615
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4616
+ <!-- Dublin Core properties go here -->
4617
+ <dc:title>
4618
+ <xsl:variable name="title">
4619
+
4620
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4621
+
4622
+
4623
+
4624
+
4625
+ </xsl:variable>
4626
+ <xsl:choose>
4627
+ <xsl:when test="normalize-space($title) != ''">
4628
+ <xsl:value-of select="$title"/>
4629
+ </xsl:when>
4630
+ <xsl:otherwise>
4631
+ <xsl:text> </xsl:text>
4632
+ </xsl:otherwise>
4633
+ </xsl:choose>
4634
+ </dc:title>
4635
+ <dc:creator>
4636
+
4637
+
4638
+ </dc:creator>
4639
+ <dc:description>
4640
+ <xsl:variable name="abstract">
4641
+
4642
+
4643
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract'][@language = 'en']//text()"/>
4644
+
4645
+
4646
+
4647
+ </xsl:variable>
4648
+ <xsl:value-of select="normalize-space($abstract)"/>
4649
+ </dc:description>
4650
+ <pdf:Keywords>
4651
+ <xsl:call-template name="insertKeywords"/>
4652
+ </pdf:Keywords>
4653
+ </rdf:Description>
4654
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4655
+ <!-- XMP properties go here -->
4656
+ <xmp:CreatorTool/>
4657
+ </rdf:Description>
4658
+ </rdf:RDF>
4659
+ </x:xmpmeta>
4660
+ </fo:declarations>
4661
+ </xsl:template><xsl:template name="getId">
4662
+ <xsl:choose>
4663
+ <xsl:when test="../@id">
4664
+ <xsl:value-of select="../@id"/>
4665
+ </xsl:when>
4666
+ <xsl:otherwise>
4667
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4668
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4669
+ </xsl:otherwise>
4670
+ </xsl:choose>
4671
+ </xsl:template><xsl:template name="getLevel">
4672
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4673
+ <xsl:variable name="level">
4674
+ <xsl:choose>
4675
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4676
+ <xsl:value-of select="$level_total - 2"/>
4677
+ </xsl:when>
4678
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4679
+ <xsl:value-of select="$level_total - 2"/>
4680
+ </xsl:when>
4681
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4682
+ <xsl:value-of select="$level_total - 2"/>
4683
+ </xsl:when>
4684
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4685
+ <xsl:otherwise>
4686
+ <xsl:value-of select="$level_total - 1"/>
4687
+ </xsl:otherwise>
4688
+ </xsl:choose>
4689
+ </xsl:variable>
4690
+ <xsl:value-of select="$level"/>
4691
+ </xsl:template><xsl:template name="getSubSection">
4692
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
4693
+ </xsl:template><xsl:template name="split">
4694
+ <xsl:param name="pText" select="."/>
4695
+ <xsl:param name="sep" select="','"/>
4696
+ <xsl:if test="string-length($pText) &gt;0">
4697
+ <item>
4698
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4699
+ </item>
4700
+ <xsl:call-template name="split">
4701
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4702
+ <xsl:with-param name="sep" select="$sep"/>
4703
+ </xsl:call-template>
4704
+ </xsl:if>
4705
+ </xsl:template><xsl:template name="getDocumentId">
4706
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3901
4707
  </xsl:template></xsl:stylesheet>