metanorma-iec 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -1
  3. data/.github/workflows/ubuntu.yml +20 -7
  4. data/.github/workflows/windows.yml +8 -1
  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 +2 -2
  8. data/lib/asciidoctor/iec/isodoc.rng +444 -1
  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/isodoc.scss +15 -9
  13. data/lib/isodoc/iec/html/scripts.html +18 -0
  14. data/lib/isodoc/iec/html/wordstyle.scss +0 -3
  15. data/lib/isodoc/iec/iec.international-standard.xsl +1346 -608
  16. data/lib/isodoc/iec/pdf_convert.rb +2 -12
  17. data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
  18. data/lib/isodoc/iec/word_convert.rb +19 -8
  19. data/lib/isodoc/iec/xref.rb +45 -0
  20. data/lib/metanorma-iec.rb +2 -0
  21. data/lib/metanorma/iec/processor.rb +11 -9
  22. data/lib/metanorma/iec/version.rb +1 -1
  23. data/metanorma-iec.gemspec +2 -2
  24. data/spec/asciidoctor-iec/base_spec.rb +7 -6
  25. data/spec/asciidoctor-iec/cleanup_spec.rb +1 -1
  26. data/spec/asciidoctor-iec/iev_spec.rb +2 -2
  27. data/spec/isodoc/blocks_spec.rb +154 -0
  28. data/spec/isodoc/i18n_spec.rb +4 -4
  29. data/spec/isodoc/iev_spec.rb +11 -10
  30. data/spec/isodoc/inline_spec.rb +9 -9
  31. data/spec/isodoc/iso_spec.rb +4 -4
  32. data/spec/isodoc/metadata_spec.rb +90 -7
  33. data/spec/isodoc/postproc_spec.rb +3 -3
  34. data/spec/isodoc/ref_spec.rb +249 -0
  35. data/spec/isodoc/section_spec.rb +46 -9
  36. data/spec/isodoc/terms_spec.rb +10 -12
  37. data/spec/metanorma/processor_spec.rb +2 -5
  38. data/spec/spec_helper.rb +7 -0
  39. 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
@@ -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;
@@ -1,9 +1,17 @@
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
 
9
17
  <xsl:variable name="debug">false</xsl:variable>
@@ -15,24 +23,18 @@
15
23
  <xsl:variable name="lang-1st-letter" select="''"/>
16
24
  <xsl:variable name="ISOname" select="/iec:iec-standard/iec:bibdata/iec:docidentifier[@type='iso']"/>
17
25
 
18
- <!-- Information and documentation — Codes for transcription systems -->
19
- <xsl:variable name="title-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'main']"/>
20
- <xsl:variable name="title-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'main']"/>
21
-
22
26
  <xsl:variable name="title-intro" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-intro']"/>
23
27
  <xsl:variable name="title-intro-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-intro']"/>
24
28
  <xsl:variable name="title-main" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-main']"/>
25
29
  <xsl:variable name="title-main-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-main']"/>
26
30
  <xsl:variable name="part" select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:project-number/@part"/>
27
- <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-part']"/>
28
- <xsl:variable name="title-part-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-part']"/>
29
-
30
- <xsl:variable name="doctype_uppercased" select="translate(translate(/iec:iec-standard/iec:bibdata/iec:ext/iec: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
39
  <xsl:variable name="substage" select="number(/iec:iec-standard/iec:bibdata/iec:status/iec:substage)"/>
38
40
  <xsl:variable name="stagename" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename)"/>
@@ -57,8 +59,8 @@
57
59
 
58
60
  <xsl:variable name="stage-fullname-uppercased">
59
61
  <xsl:choose>
60
- <xsl:when test="$stagename != ''">
61
- <xsl:value-of select="translate($stagename, $lower, $upper)"/>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
62
64
  </xsl:when>
63
65
  <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
64
66
  <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
@@ -78,33 +80,65 @@
78
80
  <item id="term-script" display="false">3.2</item>
79
81
  -->
80
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">
81
115
  <contents>
82
116
 
83
117
  <xsl:apply-templates select="/iec:iec-standard/iec:preface/node()" mode="contents"/>
84
118
  <!-- <xsl:with-param name="sectionNum" select="'0'"/>
85
119
  </xsl:apply-templates> -->
86
- <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'] -->
87
121
  <xsl:with-param name="sectionNum" select="'1'"/>
88
122
  </xsl:apply-templates>
89
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']" mode="contents"> <!-- [@id = '_normative_references'] -->
90
- <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"/>
91
125
  </xsl:apply-templates>
92
126
 
93
127
  <!-- Terms and definitions -->
94
128
  <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms" mode="contents">
95
- <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"/>
96
130
  </xsl:apply-templates>
97
131
 
98
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]" mode="contents">
99
- <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)"/>
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)"/>
100
134
  </xsl:apply-templates>
101
135
 
102
136
  <xsl:apply-templates select="/iec:iec-standard/iec:annex" mode="contents"/>
103
- <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' -->
104
138
 
105
139
  </contents>
106
- </xsl:variable>
107
-
140
+ </xsl:template>
141
+
108
142
  <xsl:variable name="color_blue">rgb(0, 90, 162)</xsl:variable>
109
143
  <xsl:variable name="color_gray">rgb(157, 158, 160)</xsl:variable>
110
144
 
@@ -168,44 +202,7 @@
168
202
  </fo:simple-page-master>
169
203
  </fo:layout-master-set>
170
204
 
171
-
172
-
173
- <fo:declarations>
174
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
175
- <pdf:dictionary type="normal" key="ViewerPreferences">
176
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
177
- </pdf:dictionary>
178
- </pdf:catalog>
179
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
180
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
181
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
182
- <!-- Dublin Core properties go here -->
183
- <dc:title>
184
- <xsl:choose>
185
- <xsl:when test="$title-en != ''">
186
- <xsl:value-of select="$title-en"/>
187
- </xsl:when>
188
- <xsl:otherwise>
189
- <xsl:text> </xsl:text>
190
- </xsl:otherwise>
191
- </xsl:choose>
192
- </dc:title>
193
- <dc:creator/>
194
- <dc:description>
195
- <xsl:variable name="abstract">
196
- <xsl:copy-of select="/iec:iec-standard/iec:bibliography/iec:references/iec:bibitem/iec:abstract[@language = 'en']//text()"/>
197
- </xsl:variable>
198
- <xsl:value-of select="normalize-space($abstract)"/>
199
- </dc:description>
200
- <pdf:Keywords/>
201
- </rdf:Description>
202
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
203
- <!-- XMP properties go here -->
204
- <xmp:CreatorTool/>
205
- </rdf:Description>
206
- </rdf:RDF>
207
- </x:xmpmeta>
208
- </fo:declarations>
205
+ <xsl:call-template name="addPDFUAmeta"/>
209
206
 
210
207
  <!-- For 'Published' documents insert two cover pages -->
211
208
  <xsl:if test="$stage &gt;= 60">
@@ -920,227 +917,77 @@
920
917
  <xsl:call-template name="insertHeaderFooter"/>
921
918
  <fo:flow flow-name="xsl-region-body">
922
919
 
923
- <fo:block-container>
924
- <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
925
- <xsl:call-template name="addLetterSpacing">
926
- <xsl:with-param name="text" select="'CONTENTS'"/>
927
- </xsl:call-template>
928
- </fo:block>
929
-
930
- <xsl:if test="$debug = 'true'">
931
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
932
- DEBUG
933
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
934
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
935
- </xsl:if>
936
-
937
- <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 -->
938
- <fo:block text-align-last="justify">
939
- <xsl:if test="@level = 1">
940
- <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
941
- </xsl:if>
942
- <xsl:if test="@level = 2">
943
- <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
944
- </xsl:if>
945
- <xsl:if test="@level = 3">
946
- <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
947
- </xsl:if>
948
- <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
949
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
950
- </xsl:if> -->
951
-
952
- <!-- <xsl:choose>
953
- <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
954
- <fo:list-block>
955
- <xsl:attribute name="margin-left">
956
- <xsl:choose>
957
- <xsl:when test="@level = 2">8mm</xsl:when>
958
- <xsl:when test="@level = 3">23mm</xsl:when>
959
- <xsl:otherwise>0mm</xsl:otherwise>
960
- </xsl:choose>
961
- </xsl:attribute>
962
- <xsl:attribute name="provisional-distance-between-starts">
963
- <xsl:choose>
964
- <xsl:when test="@display-section = 'false' or @section = ''">0mm</xsl:when>
965
- <xsl:when test="@level = 1">8mm</xsl:when>
966
- <xsl:when test="@level = 2">15mm</xsl:when>
967
- <xsl:when test="@level = 3">19mm</xsl:when>
968
- <xsl:otherwise>0mm</xsl:otherwise>
969
- </xsl:choose>
970
- </xsl:attribute>
971
- <fo:list-item>
972
- <fo:list-item-label end-indent="label-end()">
973
- <fo:block>
974
- <xsl:if test="not(@display-section = 'false')">
975
- <xsl:value-of select="@section"/>
976
- </xsl:if>
977
- </fo:block>
978
- </fo:list-item-label>
979
- <fo:list-item-body start-indent="body-start()">
980
- <fo:block text-align-last="justify">
981
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
982
- <xsl:if test="@type = 'annex'">
983
- <fo:inline><xsl:value-of select="@section"/></fo:inline>
984
- <xsl:if test="@addon != ''">
985
- <fo:inline> (<xsl:value-of select="@addon"/>) </fo:inline>
986
- </xsl:if>
987
- </xsl:if>
988
- <xsl:call-template name="addLetterSpacing">
989
- <xsl:with-param name="text" select="text()"/>
990
- </xsl:call-template>
991
- <xsl:text> </xsl:text>
992
- <fo:inline keep-together.within-line="always">
993
- <fo:leader leader-pattern="dots"/>
994
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
995
- </fo:inline>
996
- </fo:basic-link>
997
- </fo:block>
998
- </fo:list-item-body>
999
- </fo:list-item>
1000
- </fo:list-block>
1001
- </fo:block>
1002
- </xsl:for-each>
1003
-
1004
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
1005
- <fo:block margin-bottom="5pt"> </fo:block>
1006
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1007
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
1008
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1009
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1010
- <xsl:value-of select="@section"/>
1011
- <xsl:if test="text() != ''">
1012
- <xsl:text> – </xsl:text>
1013
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1014
- </xsl:if>
1015
- <fo:inline keep-together.within-line="always">
1016
- <fo:leader leader-pattern="dots"/>
1017
- <fo:page-number-citation ref-id="{@id}"/>
1018
- </fo:inline>
1019
- </fo:basic-link>
1020
- </fo:block>
1021
- </xsl:for-each>
1022
- </xsl:if>
1023
-
1024
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1025
- <fo:block margin-bottom="5pt"> </fo:block>
1026
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1027
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table' and @display = 'true']">
1028
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1029
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1030
- <xsl:value-of select="@section"/>
1031
- <xsl:if test="text() != ''">
1032
- <xsl:text> – </xsl:text>
1033
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1034
- </xsl:if>
1035
- <fo:inline keep-together.within-line="always">
1036
- <fo:leader leader-pattern="dots"/>
1037
- <fo:page-number-citation ref-id="{@id}"/>
1038
- </fo:inline>
1039
- </fo:basic-link>
1040
- </fo:block>
1041
- </xsl:for-each>
1042
- </xsl:if>
1043
-
1044
- </fo:block-container>
920
+ <xsl:variable name="docid">
921
+ <xsl:call-template name="getDocumentId"/>
922
+ </xsl:variable>
1045
923
 
1046
- <fo:block break-after="page"/>
924
+ <xsl:if test="$debug = 'true'">
925
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
926
+ DEBUG
927
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
928
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
929
+ </xsl:if>
1047
930
 
1048
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1049
- <fo:block><xsl:value-of select="$organization"/></fo:block>
1050
- <fo:block>___________</fo:block>
1051
- <fo:block> </fo:block>
1052
- <fo:block font-weight="bold">
1053
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1054
- <xsl:text> — </xsl:text>
1055
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1056
- <xsl:if test="$title-part != ''">
1057
- <xsl:text> — </xsl:text>
1058
- <fo:block> </fo:block>
1059
- <fo:block>
1060
- <xsl:if test="$part != ''">
1061
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1062
- <xsl:text>: </xsl:text>
1063
- </xsl:if>
1064
- <xsl:value-of select="$title-part"/>
1065
- </fo:block>
1066
- </xsl:if>
1067
- </fo:block>
1068
- </fo:block-container>
931
+ <xsl:call-template name="insertTOCpages">
932
+ <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
933
+ </xsl:call-template>
934
+
935
+ <xsl:call-template name="insertPrefacepages"/>
1069
936
 
1070
- <!-- Foreword, Introduction -->
1071
- <xsl:apply-templates select="/iec:iec-standard/iec:preface/*"/>
1072
-
1073
937
  </fo:flow>
1074
938
  </fo:page-sequence>
1075
939
 
1076
- <!-- BODY -->
1077
- <fo:page-sequence master-reference="document" force-page-count="no-force">
1078
- <fo:static-content flow-name="xsl-footnote-separator">
1079
- <fo:block>
1080
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1081
- </fo:block>
1082
- </fo:static-content>
1083
- <xsl:call-template name="insertHeaderFooter"/>
1084
- <fo:flow flow-name="xsl-region-body">
1085
-
1086
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1087
- <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1088
- <fo:block>____________</fo:block>
1089
- <fo:block>&#xa0;</fo:block> -->
1090
- <fo:block font-weight="bold">
1091
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1092
- <xsl:text> — </xsl:text>
1093
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1094
- <xsl:if test="$title-part != ''">
1095
- <xsl:text> — </xsl:text>
1096
- <fo:block> </fo:block>
1097
- <fo:block>
1098
- <xsl:if test="$part != ''">
1099
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1100
- <xsl:text>: </xsl:text>
1101
- </xsl:if>
1102
- <xsl:value-of select="$title-part"/>
1103
- </fo:block>
1104
- </xsl:if>
1105
- <fo:block> </fo:block>
1106
- </fo:block>
1107
- </fo:block-container>
1108
-
1109
- <!-- Clause(s) -->
1110
- <fo:block>
1111
-
1112
-
1113
- <!-- Scope -->
1114
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[@id='_scope']">
1115
- <xsl:with-param name="sectionNum" select="'1'"/>
1116
- </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)/*">
1117
947
 
1118
- <!-- Normative references -->
1119
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']">
1120
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + 1"/>
1121
- </xsl:apply-templates>
1122
-
1123
- <!-- Terms and definitions -->
1124
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms">
1125
- <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"/>
1126
- </xsl:apply-templates>
1127
-
1128
- <!-- main sections -->
1129
- <!-- *[position() &gt; 1] -->
1130
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]">
1131
- <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"/>
1132
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>
1133
968
 
1134
- <!-- Annex(s) -->
1135
- <xsl:apply-templates select="/iec:iec-standard/iec:annex"/>
1136
-
1137
- <!-- Bibliography -->
1138
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(@id = '_normative_references' or @id = '_references')]"/>
1139
-
1140
- </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>
1141
979
 
1142
- </fo:flow>
1143
- </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
+
1144
991
 
1145
992
  <xsl:if test="$stage &gt;= 60">
1146
993
  <fo:page-sequence master-reference="blank-page">
@@ -1196,8 +1043,13 @@
1196
1043
  <fo:inline font-size="8pt" padding-left="0.5mm" color="rgb(88, 88, 90)">®</fo:inline>
1197
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>
1198
1045
  </fo:block>
1199
- <fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
1200
- <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"/>
1201
1053
  <fo:inline>
1202
1054
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:edition"/>
1203
1055
  <xsl:if test="not(contains(/iec:iec-standard/iec:bibdata/iec:edition, '.'))">.0</xsl:if>
@@ -1281,14 +1133,16 @@
1281
1133
  <xsl:text> — </xsl:text>
1282
1134
  <xsl:value-of select="$title-main"/>
1283
1135
  </xsl:if>
1284
- <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 != ''">
1285
1138
  <xsl:text> — </xsl:text>
1286
1139
  <xsl:value-of select="$linebreak"/>
1287
1140
  <xsl:if test="$part != ''">
1288
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1289
- <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> -->
1290
1144
  </xsl:if>
1291
- <xsl:value-of select="$title-part"/>
1145
+ <xsl:value-of select="$part-en"/>
1292
1146
  </xsl:if>
1293
1147
  </fo:block>
1294
1148
  <fo:block font-size="12pt" font-weight="bold">
@@ -1300,20 +1154,251 @@
1300
1154
  <xsl:text> — </xsl:text>
1301
1155
  <xsl:value-of select="$title-main-fr"/>
1302
1156
  </xsl:if>
1303
- <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 != ''">
1304
1159
  <xsl:text> — </xsl:text>
1305
1160
  <xsl:value-of select="$linebreak"/>
1306
1161
  <xsl:if test="$part != ''">
1307
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1308
- <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> -->
1309
1165
  </xsl:if>
1310
- <xsl:value-of select="$title-part-fr"/>
1166
+ <xsl:value-of select="$part-fr"/>
1311
1167
  </xsl:if>
1312
1168
  </fo:block>
1313
1169
  </fo:block-container>
1314
1170
  </fo:block-container>
1315
1171
  </xsl:template>
1316
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
+
1317
1402
  <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
1318
1403
  <xsl:template match="node()">
1319
1404
  <xsl:param name="sectionNum"/>
@@ -1346,7 +1431,7 @@
1346
1431
  <xsl:choose>
1347
1432
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1348
1433
  <xsl:when test="$sectionNumSkew != 0">
1349
- <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(@id='_scope')]"/></xsl:variable><!-- <xsl:number count="*"/> -->
1434
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable><!-- <xsl:number count="*"/> -->
1350
1435
  <xsl:value-of select="$number + $sectionNumSkew"/>
1351
1436
  </xsl:when>
1352
1437
  <xsl:otherwise>
@@ -1410,8 +1495,8 @@
1410
1495
  <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
1411
1496
  </xsl:attribute>
1412
1497
  <xsl:choose>
1413
- <xsl:when test="ancestor::iec:preface">
1414
- <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(.))"/>
1415
1500
  </xsl:when>
1416
1501
  <xsl:otherwise>
1417
1502
  <xsl:value-of select="."/>
@@ -1433,7 +1518,12 @@
1433
1518
  </xsl:apply-templates>
1434
1519
  <item level="" id="{@id}" display="false" type="figure">
1435
1520
  <xsl:attribute name="section">
1436
- <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"/>
1437
1527
  <xsl:choose>
1438
1528
  <xsl:when test="ancestor::iec:annex">
1439
1529
  <xsl:choose>
@@ -1469,7 +1559,12 @@
1469
1559
  <xsl:attribute name="display">false</xsl:attribute>
1470
1560
  </xsl:if>
1471
1561
  <xsl:attribute name="section">
1472
- <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"/>
1473
1568
  <xsl:choose>
1474
1569
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1475
1570
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -1498,7 +1593,12 @@
1498
1593
  <item level="" id="{@id}" display="false" type="formula">
1499
1594
  <xsl:attribute name="section">
1500
1595
  <!-- Formula -->
1501
- <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"/>
1502
1602
  </xsl:attribute>
1503
1603
  <xsl:attribute name="parentsection">
1504
1604
  <xsl:for-each select="parent::*[1]/iec:title">
@@ -1568,7 +1668,7 @@
1568
1668
  <xsl:template match="iec:iec-standard/iec:preface/iec:foreword" priority="2">
1569
1669
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1570
1670
  <xsl:call-template name="addLetterSpacing">
1571
- <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))"/>
1572
1672
  </xsl:call-template>
1573
1673
  </fo:block>
1574
1674
  <fo:block font-size="8.2pt" text-align="justify"> <!-- margin-left="6.3mm" -->
@@ -1583,7 +1683,7 @@
1583
1683
  <fo:block break-after="page"/>
1584
1684
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1585
1685
  <xsl:call-template name="addLetterSpacing">
1586
- <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))"/>
1587
1687
  </xsl:call-template>
1588
1688
  </fo:block>
1589
1689
  <fo:block>
@@ -1615,7 +1715,7 @@
1615
1715
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1616
1716
  <xsl:when test="$sectionNumSkew != 0">
1617
1717
  <!-- <xsl:variable name="number"><xsl:number count="iec:sections/iec:clause | iec:sections/iec:terms"/></xsl:variable> -->
1618
- <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(@id='_scope')]"/></xsl:variable>
1718
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable>
1619
1719
  <xsl:value-of select="$number + $sectionNumSkew"/>
1620
1720
  </xsl:when>
1621
1721
  </xsl:choose>
@@ -1729,7 +1829,7 @@
1729
1829
  <xsl:apply-templates/>
1730
1830
  </fo:block>
1731
1831
  </xsl:when>
1732
- <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 -->
1733
1833
  <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="12pt" keep-with-next="always">
1734
1834
  <xsl:call-template name="addLetterSpacing">
1735
1835
  <xsl:with-param name="text" select="."/>
@@ -1738,8 +1838,8 @@
1738
1838
  </fo:block>
1739
1839
  </xsl:when>
1740
1840
  <xsl:when test="$parent-name = 'introduction'">
1741
- <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="10pt">
1742
- <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()))"/>
1743
1843
  </fo:block>
1744
1844
  </xsl:when>
1745
1845
  <xsl:otherwise>
@@ -1897,15 +1997,18 @@
1897
1997
  <xsl:variable name="number">
1898
1998
  <xsl:number level="any" count="iec:p/iec:fn"/>
1899
1999
  </xsl:variable>
2000
+ <xsl:variable name="lang">
2001
+ <xsl:call-template name="getLang"/>
2002
+ </xsl:variable>
1900
2003
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!-- font-size="80%" vertical-align="super"-->
1901
- <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}">
1902
2005
  <!-- <xsl:value-of select="@reference"/> -->
1903
2006
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1904
2007
  </fo:basic-link>
1905
2008
  </fo:inline>
1906
2009
  <fo:footnote-body>
1907
2010
  <fo:block font-size="8pt" margin-bottom="5pt">
1908
- <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" -->
1909
2012
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1910
2013
  </fo:inline>
1911
2014
  <xsl:for-each select="iec:p">
@@ -1945,16 +2048,17 @@
1945
2048
  <fo:block>
1946
2049
  <fo:external-graphic src="{@src}" fox:alt-text="Image"/>
1947
2050
  </fo:block>
1948
- <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>
1949
2057
  </fo:block-container>
1950
2058
 
1951
2059
  </xsl:template>
1952
2060
 
1953
- <xsl:template match="iec:figure">
1954
- <xsl:variable name="title">
1955
- <xsl:text>Figure </xsl:text>
1956
- </xsl:variable>
1957
-
2061
+ <xsl:template match="iec:figure">
1958
2062
  <fo:block-container id="{@id}">
1959
2063
  <fo:block>
1960
2064
  <xsl:apply-templates/>
@@ -1964,6 +2068,11 @@
1964
2068
  <xsl:call-template name="note"/>
1965
2069
  </xsl:for-each>
1966
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>
1967
2076
  <xsl:choose>
1968
2077
  <xsl:when test="ancestor::iec:annex">
1969
2078
 
@@ -1973,13 +2082,14 @@
1973
2082
  <xsl:number format="a) "/>
1974
2083
  </xsl:when>
1975
2084
  <xsl:otherwise> -->
1976
- <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"/>
1977
2087
  <!-- </xsl:otherwise>
1978
2088
  </xsl:choose> -->
1979
2089
 
1980
2090
  </xsl:when>
1981
2091
  <xsl:otherwise>
1982
- <xsl:value-of select="$title"/><xsl:number format="1" level="any"/>
2092
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
1983
2093
  </xsl:otherwise>
1984
2094
  </xsl:choose>
1985
2095
  <xsl:if test="iec:name">
@@ -2037,13 +2147,13 @@
2037
2147
  <xsl:number level="any" count="iec:bibitem/iec:note"/>
2038
2148
  </xsl:variable>
2039
2149
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!--font-size="85%" vertical-align="super"60% -->
2040
- <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}">
2041
2151
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2042
2152
  </fo:basic-link>
2043
2153
  </fo:inline>
2044
2154
  <fo:footnote-body>
2045
2155
  <fo:block font-size="8pt" margin-bottom="5pt">
2046
- <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%" -->
2047
2157
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2048
2158
  </fo:inline>
2049
2159
  <xsl:apply-templates/>
@@ -2112,11 +2222,20 @@
2112
2222
  </fo:block>
2113
2223
  </xsl:template>
2114
2224
 
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>
2232
+ </xsl:template>
2233
+
2115
2234
  <xsl:template match="iec:preferred">
2116
2235
  <xsl:param name="sectionNum"/>
2117
2236
  <fo:block line-height="1.1" space-before="14pt">
2118
2237
  <fo:block font-weight="bold" keep-with-next="always">
2119
- <fo:inline id="{../@id}">
2238
+ <fo:inline>
2120
2239
  <xsl:value-of select="$sectionNum"/>.<xsl:number count="iec:term"/>
2121
2240
  </fo:inline>
2122
2241
  </fo:block>
@@ -2133,7 +2252,12 @@
2133
2252
  </xsl:template>
2134
2253
 
2135
2254
  <xsl:template match="iec:deprecates">
2136
- <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>
2137
2261
  </xsl:template>
2138
2262
 
2139
2263
  <xsl:template match="iec:definition[preceding-sibling::iec:domain]">
@@ -2154,7 +2278,14 @@
2154
2278
  <fo:block margin-bottom="8pt" keep-with-previous="always">
2155
2279
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
2156
2280
  <fo:basic-link internal-destination="{iec:origin/@bibitemid}" fox:alt-text="{iec:origin/@citeas}">
2157
- <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>
2158
2289
  <xsl:value-of select="iec:origin/@citeas"/>
2159
2290
  <xsl:apply-templates select="iec:origin/iec:localityStack"/>
2160
2291
  </fo:basic-link>
@@ -2163,19 +2294,20 @@
2163
2294
  </fo:block>
2164
2295
  </xsl:template>
2165
2296
 
2166
- <xsl:template match="iec:modification">
2167
- <xsl:text>, modified — </xsl:text>
2168
- <xsl:apply-templates/>
2169
- </xsl:template>
2297
+
2170
2298
  <xsl:template match="iec:modification/iec:p">
2171
2299
  <fo:inline><xsl:apply-templates/></fo:inline>
2172
2300
  </xsl:template>
2173
2301
 
2174
2302
  <xsl:template match="iec:termnote">
2175
- <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">
2176
- <xsl:text>Note </xsl:text>
2177
- <xsl:number/>
2178
- <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)"/>
2179
2311
  <xsl:apply-templates/>
2180
2312
  </fo:block>
2181
2313
  </xsl:template>
@@ -2191,7 +2323,12 @@
2191
2323
 
2192
2324
  <xsl:template match="iec:termexample">
2193
2325
  <fo:block margin-top="14pt" margin-bottom="10pt">
2194
- <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>
2195
2332
  <xsl:apply-templates/>
2196
2333
  </fo:block>
2197
2334
  </xsl:template>
@@ -2208,7 +2345,7 @@
2208
2345
 
2209
2346
 
2210
2347
  <!-- <xsl:template match="iec:references[@id = '_bibliography']"> -->
2211
- <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'))]">
2212
2349
  <fo:block break-after="page"/>
2213
2350
  <xsl:apply-templates/>
2214
2351
  <fo:block-container text-align="center" margin-top="10mm">
@@ -2219,7 +2356,7 @@
2219
2356
 
2220
2357
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
2221
2358
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem"> -->
2222
- <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">
2223
2360
  <fo:list-block margin-top="5pt" margin-bottom="14pt" provisional-distance-between-starts="0mm"> <!-- provisional-distance-between-starts="12mm" -->
2224
2361
  <fo:list-item>
2225
2362
  <fo:list-item-label end-indent="label-end()">
@@ -2252,10 +2389,10 @@
2252
2389
  </xsl:template>
2253
2390
 
2254
2391
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem" mode="contents"/> -->
2255
- <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"/>
2256
2393
 
2257
2394
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem/iec:title"> -->
2258
- <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">
2259
2396
  <fo:inline font-style="italic">
2260
2397
  <xsl:apply-templates/>
2261
2398
  </fo:inline>
@@ -2277,76 +2414,34 @@
2277
2414
 
2278
2415
  <xsl:template match="iec:source">
2279
2416
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2280
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2417
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2281
2418
  <xsl:apply-templates select="iec:localityStack"/>
2282
2419
  </fo:basic-link>
2283
2420
  </xsl:template>
2284
2421
 
2285
- <xsl:template match="iec:appendix">
2286
- <fo:block id="{@id}" font-weight="bold" margin-top="5pt" margin-bottom="5pt">
2287
- <xsl:if test="not(iec:title)">
2288
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
2289
- </xsl:if>
2290
- <xsl:apply-templates select="iec:title" mode="process"/>
2291
- </fo:block>
2292
- <xsl:apply-templates/>
2293
- </xsl:template>
2294
-
2295
- <xsl:template match="iec:appendix//iec:example">
2296
- <fo:block margin-top="14pt" margin-bottom="14pt">
2297
- <xsl:text>EXAMPLE</xsl:text>
2298
- <xsl:if test="iec:name">
2299
- <xsl:text> — </xsl:text><xsl:apply-templates select="iec:name" mode="process"/>
2300
- </xsl:if>
2301
- </fo:block>
2302
- <xsl:apply-templates/>
2303
- </xsl:template>
2304
-
2305
- <xsl:template match="iec:appendix//iec:example/iec:name"/>
2306
- <xsl:template match="iec:appendix//iec:example/iec:name" mode="process">
2307
- <fo:inline><xsl:apply-templates/></fo:inline>
2308
- </xsl:template>
2309
2422
 
2310
- <!-- <xsl:template match="iec:callout/text()">
2311
- <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
2312
- </xsl:template> -->
2313
- <xsl:template match="iec:callout">
2314
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
2315
- </xsl:template>
2423
+ <xsl:template match="iec:xref">
2316
2424
 
2317
- <xsl:template match="iec:annotation">
2318
- <fo:block>
2319
-
2320
- </fo:block>
2321
- <xsl:apply-templates/>
2322
- </xsl:template>
2323
-
2324
- <xsl:template match="iec:annotation/text()"/>
2325
-
2326
- <xsl:template match="iec:annotation/iec:p">
2327
- <xsl:variable name="annotation-id" select="../@id"/>
2328
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
2329
- <fo:block id="{$annotation-id}">
2330
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
2331
- <xsl:apply-templates/>
2332
- </fo:block>
2333
- </xsl:template>
2334
-
2335
-
2336
- <xsl:template match="iec:appendix/iec:title"/>
2337
- <xsl:template match="iec:appendix/iec:title" mode="process">
2338
- <fo:inline><xsl:apply-templates/></fo:inline>
2339
- </xsl:template>
2340
-
2341
-
2342
- <xsl:template match="iec:xref">
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
+
2343
2433
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
2344
2434
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{$section}">
2345
2435
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
2346
2436
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
2347
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>
2348
2443
  <xsl:choose>
2349
- <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) -->
2350
2445
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
2351
2446
  </xsl:choose>
2352
2447
  <xsl:variable name="currentsection">
@@ -2361,21 +2456,14 @@
2361
2456
  </fo:basic-link>
2362
2457
  </xsl:template>
2363
2458
 
2364
- <xsl:template match="iec:sourcecode">
2365
- <fo:block font-family="Courier" font-size="9pt" margin-top="5pt" margin-bottom="5pt">
2366
- <xsl:choose>
2367
- <xsl:when test="@lang = 'en'"/>
2368
- <xsl:otherwise>
2369
- <xsl:attribute name="white-space">pre</xsl:attribute>
2370
- </xsl:otherwise>
2371
- </xsl:choose>
2372
- <xsl:apply-templates/>
2373
- </fo:block>
2374
- </xsl:template>
2375
-
2376
2459
  <xsl:template match="iec:example/iec:p">
2377
2460
  <fo:block>
2378
- <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>
2379
2467
  <xsl:apply-templates/>
2380
2468
  </fo:block>
2381
2469
  </xsl:template>
@@ -2386,7 +2474,12 @@
2386
2474
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
2387
2475
  </xsl:if>
2388
2476
  <fo:inline padding-right="6mm">
2389
- <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"/>
2390
2483
  <xsl:if test="ancestor::iec:figure">
2391
2484
  <xsl:variable name="id" select="ancestor::iec:figure[1]/@id"/>
2392
2485
  <xsl:if test="count(//iec:note[ancestor::*[@id = $id]]) &gt; 1">
@@ -2407,16 +2500,31 @@
2407
2500
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2408
2501
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2409
2502
  </xsl:if>
2410
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2503
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2411
2504
  <xsl:apply-templates select="iec:localityStack"/>
2412
2505
  </fo:basic-link>
2413
2506
  </xsl:template>
2414
2507
 
2415
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>
2416
2524
  <xsl:choose>
2417
- <xsl:when test="@type ='clause'">Clause </xsl:when>
2418
- <xsl:when test="@type ='annex'">Annex </xsl:when>
2419
- <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>
2420
2528
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2421
2529
  </xsl:choose>
2422
2530
  <xsl:text> </xsl:text><xsl:value-of select="iec:referenceFrom"/>
@@ -2426,7 +2534,7 @@
2426
2534
  <fo:block-container border="0.5pt solid black" margin-left="-2mm" margin-right="-2mm" space-before="18pt" space-after="12pt">
2427
2535
  <fo:block-container margin-left="0mm" margin-right="0mm" font-weight="bold" padding="1mm" padding-top="2mm">
2428
2536
  <fo:block text-align="justify">
2429
- <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>
2430
2538
  <xsl:apply-templates/>
2431
2539
  </fo:block>
2432
2540
  </fo:block-container>
@@ -2445,6 +2553,12 @@
2445
2553
  </xsl:call-template>
2446
2554
  </xsl:template>
2447
2555
 
2556
+ <xsl:template match="iec:formula">
2557
+ <fo:block id="{@id}">
2558
+ <xsl:apply-templates/>
2559
+ </fo:block>
2560
+ </xsl:template>
2561
+
2448
2562
  <xsl:template match="iec:formula/iec:dt/iec:stem">
2449
2563
  <fo:inline>
2450
2564
  <xsl:apply-templates/>
@@ -2458,7 +2572,7 @@
2458
2572
  </xsl:template>
2459
2573
 
2460
2574
  <xsl:template match="iec:formula/iec:stem">
2461
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2575
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2462
2576
  <fo:table table-layout="fixed" width="100%">
2463
2577
  <fo:table-column column-width="95%"/>
2464
2578
  <fo:table-column column-width="5%"/>
@@ -2473,7 +2587,7 @@
2473
2587
  <fo:block text-align="right" margin-right="-10mm">
2474
2588
  <xsl:choose>
2475
2589
  <xsl:when test="ancestor::iec:annex">
2476
- <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"/>
2477
2591
  </xsl:when>
2478
2592
  <xsl:otherwise> <!-- not(ancestor::iec:annex) -->
2479
2593
  <xsl:text>(</xsl:text><xsl:number level="any" count="iec:formula"/><xsl:text>)</xsl:text>
@@ -2547,38 +2661,6 @@
2547
2661
  </fo:static-content>
2548
2662
  </xsl:template>
2549
2663
 
2550
- <xsl:template name="getId">
2551
- <xsl:choose>
2552
- <xsl:when test="../@id">
2553
- <xsl:value-of select="../@id"/>
2554
- </xsl:when>
2555
- <xsl:otherwise>
2556
- <xsl:value-of select="text()"/>
2557
- </xsl:otherwise>
2558
- </xsl:choose>
2559
- </xsl:template>
2560
-
2561
- <xsl:template name="getLevel">
2562
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2563
- <xsl:variable name="level">
2564
- <xsl:choose>
2565
- <xsl:when test="ancestor::iec:preface">
2566
- <xsl:value-of select="$level_total - 2"/>
2567
- </xsl:when>
2568
- <xsl:when test="ancestor::iec:sections">
2569
- <xsl:value-of select="$level_total - 2"/>
2570
- </xsl:when>
2571
- <xsl:when test="ancestor::iec:bibliography">
2572
- <xsl:value-of select="$level_total - 2"/>
2573
- </xsl:when>
2574
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2575
- <xsl:otherwise>
2576
- <xsl:value-of select="$level_total - 1"/>
2577
- </xsl:otherwise>
2578
- </xsl:choose>
2579
- </xsl:variable>
2580
- <xsl:value-of select="$level"/>
2581
- </xsl:template>
2582
2664
 
2583
2665
  <xsl:template name="getSection">
2584
2666
  <xsl:param name="sectionNum"/>
@@ -2598,7 +2680,7 @@
2598
2680
  </xsl:when>
2599
2681
  <xsl:when test="$level &gt;= 2">
2600
2682
  <xsl:variable name="num">
2601
- <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"/>
2602
2684
  </xsl:variable>
2603
2685
  <xsl:value-of select="concat($sectionNum, $num)"/>
2604
2686
  </xsl:when>
@@ -2621,7 +2703,12 @@
2621
2703
  <xsl:when test="ancestor::iec:annex">
2622
2704
  <xsl:choose>
2623
2705
  <xsl:when test="$level = 1">
2624
- <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"/>
2625
2712
  <xsl:choose>
2626
2713
  <xsl:when test="count(//iec:annex) = 1">
2627
2714
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:annexid"/>
@@ -2706,7 +2793,7 @@
2706
2793
  <xsl:param name="letter-spacing" select="'0.15'"/>
2707
2794
  <xsl:if test="string-length($text) &gt; 0">
2708
2795
  <xsl:variable name="char" select="substring($text,1,1)"/>
2709
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2796
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2710
2797
  <xsl:choose>
2711
2798
  <xsl:when test="$char=$upperCase">
2712
2799
  <fo:inline font-size="{100 div 0.75}%">
@@ -2738,16 +2825,263 @@
2738
2825
  </fo:inline>
2739
2826
  </xsl:template>
2740
2827
 
2741
- <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:attribute-set 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="link-style">
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>
2742
2917
 
2918
+ <title-clause lang="zh">Clause </title-clause>
2743
2919
 
2744
- </xsl:attribute-set><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()">
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()">
2745
3078
  <xsl:value-of select="."/>
2746
- </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']">
2747
3080
  <xsl:value-of select="$linebreak"/>
2748
- </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() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2749
- <xsl:call-template name="add-zero-spaces"/>
2750
- </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']">
2751
3085
 
2752
3086
  <xsl:variable name="simple-table">
2753
3087
  <!-- <xsl:copy> -->
@@ -2792,30 +3126,17 @@
2792
3126
 
2793
3127
 
2794
3128
 
2795
- <xsl:text>Table </xsl:text>
2796
- <xsl:choose>
2797
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2798
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2799
- </xsl:when>
2800
- <xsl:when test="ancestor::*[local-name()='annex']">
2801
-
2802
-
2803
-
2804
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2805
-
2806
-
2807
-
2808
-
2809
-
2810
-
2811
- </xsl:when>
2812
- <xsl:otherwise>
2813
-
2814
- <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']"/>
2815
-
2816
-
2817
- </xsl:otherwise>
2818
- </xsl:choose>
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
+
2819
3140
  <xsl:if test="*[local-name()='name']">
2820
3141
 
2821
3142
 
@@ -2890,6 +3211,7 @@
2890
3211
 
2891
3212
 
2892
3213
 
3214
+
2893
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">
2894
3216
 
2895
3217
 
@@ -2906,9 +3228,10 @@
2906
3228
  <!-- <xsl:if test="ancestor::*[local-name()='preface']"> -->
2907
3229
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2908
3230
 
3231
+
2909
3232
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2910
3233
  <xsl:choose>
2911
- <xsl:when test=". = 1">
3234
+ <xsl:when test=". = 1 or . = 0">
2912
3235
  <fo:table-column column-width="proportional-column-width(2)"/>
2913
3236
  </xsl:when>
2914
3237
  <xsl:otherwise>
@@ -2916,21 +3239,54 @@
2916
3239
  </xsl:otherwise>
2917
3240
  </xsl:choose>
2918
3241
  </xsl:for-each>
2919
- <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
+
2920
3252
  </fo:table>
2921
3253
 
2922
3254
 
2923
3255
 
2924
3256
  </fo:block-container>
2925
- </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">
2926
3282
  <xsl:apply-templates/>
2927
- </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">
2928
3284
  <xsl:param name="table-row"/>
2929
3285
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2930
3286
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2931
3287
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2932
3288
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2933
- </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">
2934
3290
  <xsl:param name="table"/>
2935
3291
  <xsl:param name="cols-count"/>
2936
3292
  <xsl:param name="curr-col" select="1"/>
@@ -2939,7 +3295,7 @@
2939
3295
  <xsl:if test="$curr-col &lt;= $cols-count">
2940
3296
  <xsl:variable name="widths">
2941
3297
  <xsl:choose>
2942
- <xsl:when test="not($table)">
3298
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2943
3299
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2944
3300
  <xsl:variable name="words">
2945
3301
  <xsl:call-template name="tokenize">
@@ -2978,9 +3334,16 @@
2978
3334
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2979
3335
  </xsl:variable>
2980
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>
2981
3342
  <xsl:call-template name="tokenize">
2982
3343
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2983
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
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, '​', ' '))"/>
2984
3347
  </xsl:call-template>
2985
3348
  </xsl:variable>
2986
3349
  <xsl:variable name="max_length">
@@ -3021,17 +3384,28 @@
3021
3384
  <xsl:with-param name="table" select="$table"/>
3022
3385
  </xsl:call-template>
3023
3386
  </xsl:if>
3024
- </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()" mode="td_text">
3387
+ </xsl:template><xsl:template match="text()" mode="td_text">
3025
3388
  <xsl:variable name="zero-space">​</xsl:variable>
3026
3389
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3027
- </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">
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"/>
3028
3396
  <!-- font-weight="bold" -->
3029
- <fo:table-header>
3397
+ <fo:table-header>
3398
+
3030
3399
  <xsl:apply-templates/>
3031
3400
  </fo:table-header>
3032
- </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">
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">
3033
3406
  <xsl:apply-templates/>
3034
- </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="insertTableFooter">
3407
+ </xsl:template><xsl:template name="insertTableFooter">
3408
+ <xsl:param name="cols-count"/>
3035
3409
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3036
3410
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3037
3411
 
@@ -3042,22 +3416,7 @@
3042
3416
  <!-- if there are note(s) or fn(s) then create footer row -->
3043
3417
  <xsl:if test="$isNoteOrFnExist = 'true'">
3044
3418
 
3045
- <xsl:variable name="cols-count">
3046
- <xsl:choose>
3047
- <xsl:when test="../*[local-name()='thead']">
3048
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3049
- <xsl:call-template name="calculate-columns-numbers">
3050
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3051
- </xsl:call-template>
3052
- </xsl:when>
3053
- <xsl:otherwise>
3054
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3055
- <xsl:call-template name="calculate-columns-numbers">
3056
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3057
- </xsl:call-template>
3058
- </xsl:otherwise>
3059
- </xsl:choose>
3060
- </xsl:variable>
3419
+
3061
3420
 
3062
3421
  <fo:table-row>
3063
3422
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -3097,11 +3456,30 @@
3097
3456
  </fo:table-footer>
3098
3457
 
3099
3458
  </xsl:if>
3100
- </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']">
3459
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3460
+
3461
+ <xsl:variable name="cols-count">
3462
+ <xsl:choose>
3463
+ <xsl:when test="../*[local-name()='thead']">
3464
+ <xsl:call-template name="calculate-columns-numbers">
3465
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3466
+ </xsl:call-template>
3467
+ </xsl:when>
3468
+ <xsl:otherwise>
3469
+ <xsl:call-template name="calculate-columns-numbers">
3470
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3471
+ </xsl:call-template>
3472
+ </xsl:otherwise>
3473
+ </xsl:choose>
3474
+ </xsl:variable>
3101
3475
 
3102
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3476
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3477
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3478
+ </xsl:apply-templates>
3103
3479
 
3104
- <xsl:call-template name="insertTableFooter"/>
3480
+ <xsl:call-template name="insertTableFooter">
3481
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3482
+ </xsl:call-template>
3105
3483
 
3106
3484
  <fo:table-body>
3107
3485
  <xsl:apply-templates/>
@@ -3109,7 +3487,7 @@
3109
3487
 
3110
3488
  </fo:table-body>
3111
3489
 
3112
- </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']">
3490
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3113
3491
  <xsl:variable name="parent-name" select="local-name(..)"/>
3114
3492
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3115
3493
  <fo:table-row min-height="4mm">
@@ -3135,7 +3513,7 @@
3135
3513
 
3136
3514
  <xsl:apply-templates/>
3137
3515
  </fo:table-row>
3138
- </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']">
3139
3517
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3140
3518
 
3141
3519
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3166,7 +3544,7 @@
3166
3544
  <xsl:apply-templates/>
3167
3545
  </fo:block>
3168
3546
  </fo:table-cell>
3169
- </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']">
3170
3548
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3171
3549
  <!-- and ancestor::*[local-name() = 'thead'] -->
3172
3550
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3199,6 +3577,7 @@
3199
3577
  </xsl:attribute>
3200
3578
  </xsl:if>
3201
3579
  <fo:block>
3580
+
3202
3581
  <xsl:apply-templates/>
3203
3582
  </fo:block>
3204
3583
  <!-- <xsl:choose>
@@ -3214,7 +3593,7 @@
3214
3593
 
3215
3594
 
3216
3595
  </fo:table-cell>
3217
- </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">
3218
3597
 
3219
3598
 
3220
3599
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3224,9 +3603,16 @@
3224
3603
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3225
3604
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3226
3605
 
3606
+
3227
3607
  <fo:inline padding-right="2mm">
3228
3608
 
3229
- <xsl:text>NOTE </xsl:text>
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"/>
3230
3616
 
3231
3617
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3232
3618
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -3240,9 +3626,9 @@
3240
3626
  <xsl:apply-templates mode="process"/>
3241
3627
  </fo:block>
3242
3628
 
3243
- </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">
3244
3630
  <xsl:apply-templates/>
3245
- </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">
3246
3632
  <xsl:variable name="references">
3247
3633
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3248
3634
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3264,6 +3650,7 @@
3264
3650
  <xsl:attribute name="text-indent">-6mm</xsl:attribute>
3265
3651
  <xsl:attribute name="margin-left">6mm</xsl:attribute>
3266
3652
 
3653
+
3267
3654
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3268
3655
 
3269
3656
 
@@ -3284,7 +3671,7 @@
3284
3671
  </fo:block>
3285
3672
  </xsl:if>
3286
3673
  </xsl:for-each>
3287
- </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">
3288
3675
  <!-- <xsl:variable name="references">
3289
3676
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3290
3677
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3300,7 +3687,7 @@
3300
3687
  <xsl:apply-templates/>
3301
3688
  </fo:block>
3302
3689
  </xsl:for-each>
3303
- </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">
3304
3691
  <xsl:variable name="key_iso">
3305
3692
  true <!-- and (not(@class) or @class !='pseudocode') -->
3306
3693
  </xsl:variable>
@@ -3311,6 +3698,36 @@
3311
3698
  </fn>
3312
3699
  </xsl:for-each>
3313
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
+
3314
3731
  <xsl:if test="xalan:nodeset($references)//fn">
3315
3732
  <fo:block>
3316
3733
  <fo:table width="95%" table-layout="fixed">
@@ -3320,8 +3737,19 @@
3320
3737
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3321
3738
 
3322
3739
  </xsl:if>
3323
- <fo:table-column column-width="15%"/>
3324
- <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>
3325
3753
  <fo:table-body>
3326
3754
  <xsl:for-each select="xalan:nodeset($references)//fn">
3327
3755
  <xsl:variable name="reference" select="@reference"/>
@@ -3360,7 +3788,7 @@
3360
3788
  </fo:block>
3361
3789
  </xsl:if>
3362
3790
 
3363
- </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']">
3364
3792
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3365
3793
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3366
3794
 
@@ -3378,11 +3806,11 @@
3378
3806
  <xsl:value-of select="@reference"/>
3379
3807
  </fo:basic-link>
3380
3808
  </fo:inline>
3381
- </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']">
3382
3810
  <fo:inline>
3383
3811
  <xsl:apply-templates/>
3384
3812
  </fo:inline>
3385
- </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']">
3386
3814
  <xsl:variable name="parent" select="local-name(..)"/>
3387
3815
 
3388
3816
  <xsl:variable name="key_iso">
@@ -3399,7 +3827,12 @@
3399
3827
  <xsl:attribute name="margin-bottom">15pt</xsl:attribute>
3400
3828
 
3401
3829
 
3402
- <xsl:text>where </xsl:text>
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"/>
3403
3836
  </fo:block>
3404
3837
  <fo:block>
3405
3838
 
@@ -3419,18 +3852,28 @@
3419
3852
 
3420
3853
 
3421
3854
 
3422
- <xsl:text>where</xsl:text>
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"/>
3423
3861
  </fo:block>
3424
3862
  </xsl:when>
3425
3863
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3426
- <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">
3427
3865
 
3428
3866
 
3429
3867
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3430
3868
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3431
3869
 
3432
3870
 
3433
- <xsl:text>Key</xsl:text>
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"/>
3434
3877
  </fo:block>
3435
3878
  </xsl:when>
3436
3879
  </xsl:choose>
@@ -3441,26 +3884,11 @@
3441
3884
 
3442
3885
 
3443
3886
 
3887
+
3444
3888
  <fo:block>
3445
3889
 
3446
3890
 
3447
- <!-- create virtual html table for dl/[dt and dd] -->
3448
- <xsl:variable name="html-table">
3449
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3450
- <xsl:element name="{$ns}:table">
3451
- <tbody>
3452
- <xsl:apply-templates mode="dl"/>
3453
- </tbody>
3454
- </xsl:element>
3455
- </xsl:variable>
3456
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3457
- <xsl:variable name="colwidths">
3458
- <xsl:call-template name="calculate-column-widths">
3459
- <xsl:with-param name="cols-count" select="2"/>
3460
- <xsl:with-param name="table" select="$html-table"/>
3461
- </xsl:call-template>
3462
- </xsl:variable>
3463
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3891
+
3464
3892
 
3465
3893
  <fo:table width="95%" table-layout="fixed">
3466
3894
 
@@ -3475,42 +3903,30 @@
3475
3903
 
3476
3904
  </xsl:when>
3477
3905
  </xsl:choose>
3478
- <xsl:choose>
3479
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3480
- <fo:table-column column-width="50%"/>
3481
- <fo:table-column column-width="50%"/>
3482
- </xsl:when>
3483
- <xsl:otherwise>
3484
- <xsl:choose>
3485
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3486
- <fo:table-column column-width="60%"/>
3487
- <fo:table-column column-width="40%"/>
3488
- </xsl:when> -->
3489
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3490
- <fo:table-column column-width="50%"/>
3491
- <fo:table-column column-width="50%"/>
3492
- </xsl:when>
3493
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3494
- <fo:table-column column-width="40%"/>
3495
- <fo:table-column column-width="60%"/>
3496
- </xsl:when>
3497
- <xsl:otherwise>
3498
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3499
- <xsl:choose>
3500
- <xsl:when test=". = 1">
3501
- <fo:table-column column-width="proportional-column-width(2)"/>
3502
- </xsl:when>
3503
- <xsl:otherwise>
3504
- <fo:table-column column-width="proportional-column-width({.})"/>
3505
- </xsl:otherwise>
3506
- </xsl:choose>
3507
- </xsl:for-each>
3508
- </xsl:otherwise>
3509
- </xsl:choose>
3510
- <!-- <fo:table-column column-width="15%"/>
3511
- <fo:table-column column-width="85%"/> -->
3512
- </xsl:otherwise>
3513
- </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>
3514
3930
  <fo:table-body>
3515
3931
  <xsl:apply-templates>
3516
3932
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3520,7 +3936,61 @@
3520
3936
  </fo:block>
3521
3937
  </fo:block>
3522
3938
  </xsl:if>
3523
- </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']">
3524
3994
  <xsl:param name="key_iso"/>
3525
3995
 
3526
3996
  <!-- <tr>
@@ -3536,7 +4006,12 @@
3536
4006
  <xsl:if test="normalize-space($key_iso) = 'true'">
3537
4007
  <xsl:attribute name="margin-top">0</xsl:attribute>
3538
4008
  </xsl:if>
3539
- 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"/>
3540
4015
  </fo:block>
3541
4016
  </fo:table-cell>
3542
4017
  <fo:table-cell>
@@ -3545,7 +4020,7 @@
3545
4020
  </fo:block>
3546
4021
  </fo:table-cell>
3547
4022
  </fo:table-row>
3548
- </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">
3549
4024
  <tr>
3550
4025
  <td>
3551
4026
  <xsl:apply-templates/>
@@ -3558,11 +4033,12 @@
3558
4033
  </td>
3559
4034
  </tr>
3560
4035
 
3561
- </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']">
3562
4037
  <xsl:param name="key_iso"/>
3563
4038
 
3564
4039
  <fo:table-row>
3565
4040
  <fo:table-cell>
4041
+
3566
4042
  <fo:block margin-top="6pt">
3567
4043
 
3568
4044
 
@@ -3576,8 +4052,15 @@
3576
4052
  </xsl:if>
3577
4053
 
3578
4054
 
3579
- <xsl:apply-templates/>
3580
4055
 
4056
+
4057
+
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> -->
3581
4064
  </fo:block>
3582
4065
  </fo:table-cell>
3583
4066
  <fo:table-cell>
@@ -3591,37 +4074,37 @@
3591
4074
  </fo:table-cell>
3592
4075
  </fo:table-row>
3593
4076
 
3594
- </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">
3595
4078
  <xsl:apply-templates/>
3596
- </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">
3597
4080
  <xsl:apply-templates/>
3598
- </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">
4081
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3599
4082
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3600
- </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']">
4083
+ </xsl:template><xsl:template match="*[local-name()='em']">
3601
4084
  <fo:inline font-style="italic">
3602
4085
  <xsl:apply-templates/>
3603
4086
  </fo:inline>
3604
- </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']">
3605
4088
  <fo:inline font-weight="bold">
3606
4089
  <xsl:apply-templates/>
3607
4090
  </fo:inline>
3608
- </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']">
3609
4092
  <fo:inline font-size="80%" vertical-align="super">
3610
4093
  <xsl:apply-templates/>
3611
4094
  </fo:inline>
3612
- </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']">
3613
4096
  <fo:inline font-size="80%" vertical-align="sub">
3614
4097
  <xsl:apply-templates/>
3615
4098
  </fo:inline>
3616
- </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']">
3617
- <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">
3618
4101
  <xsl:apply-templates/>
3619
4102
  </fo:inline>
3620
- </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']">
3621
4104
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3622
4105
  <xsl:apply-templates/>
3623
4106
  </fo:inline>
3624
- </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']]">
3625
4108
  <xsl:variable name="text" select="normalize-space(.)"/>
3626
4109
  <fo:inline font-size="75%">
3627
4110
  <xsl:if test="string-length($text) &gt; 0">
@@ -3630,10 +4113,11 @@
3630
4113
  </xsl:call-template>
3631
4114
  </xsl:if>
3632
4115
  </fo:inline>
3633
- </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">
3634
4117
  <xsl:param name="text"/>
3635
4118
  <xsl:variable name="char" select="substring($text,1,1)"/>
3636
- <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))"/>
3637
4121
  <xsl:choose>
3638
4122
  <xsl:when test="$char=$upperCase">
3639
4123
  <fo:inline font-size="{100 div 0.75}%">
@@ -3649,7 +4133,7 @@
3649
4133
  <xsl:with-param name="text" select="substring($text,2)"/>
3650
4134
  </xsl:call-template>
3651
4135
  </xsl:if>
3652
- </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">
3653
4137
  <xsl:param name="text"/>
3654
4138
  <xsl:param name="separator" select="' '"/>
3655
4139
  <xsl:choose>
@@ -3697,7 +4181,7 @@
3697
4181
  </xsl:call-template>
3698
4182
  </xsl:otherwise>
3699
4183
  </xsl:choose>
3700
- </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">
3701
4185
  <xsl:param name="words"/>
3702
4186
  <xsl:for-each select="$words//word">
3703
4187
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3705,7 +4189,11 @@
3705
4189
  <xsl:value-of select="."/>
3706
4190
  </xsl:if>
3707
4191
  </xsl:for-each>
3708
- </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">
3709
4197
  <xsl:param name="text" select="."/>
3710
4198
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3711
4199
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3758,7 +4246,7 @@
3758
4246
  <xsl:value-of select="$text"/>
3759
4247
  </xsl:otherwise>
3760
4248
  </xsl:choose>
3761
- </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">
3762
4250
  <xsl:param name="text" select="."/>
3763
4251
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3764
4252
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3784,7 +4272,7 @@
3784
4272
  <xsl:value-of select="$text"/>
3785
4273
  </xsl:otherwise>
3786
4274
  </xsl:choose>
3787
- </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">
3788
4276
  <xsl:variable name="simple-table">
3789
4277
 
3790
4278
  <!-- Step 1. colspan processing -->
@@ -3811,9 +4299,9 @@
3811
4299
  </xsl:choose> -->
3812
4300
  </xsl:variable>
3813
4301
  <xsl:copy-of select="$simple-table"/>
3814
- </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">
3815
4303
  <xsl:apply-templates mode="simple-table-colspan"/>
3816
- </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">
3817
4305
  <xsl:choose>
3818
4306
  <xsl:when test="@colspan">
3819
4307
  <xsl:variable name="td">
@@ -3835,16 +4323,16 @@
3835
4323
  </xsl:element>
3836
4324
  </xsl:otherwise>
3837
4325
  </xsl:choose>
3838
- </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">
3839
4327
  <xsl:element name="tr">
3840
4328
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3841
4329
  <xsl:apply-templates mode="simple-table-colspan"/>
3842
4330
  </xsl:element>
3843
- </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">
3844
4332
  <xsl:copy>
3845
4333
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3846
4334
  </xsl:copy>
3847
- </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">
3848
4336
  <xsl:param name="count"/>
3849
4337
  <xsl:param name="node"/>
3850
4338
 
@@ -3855,18 +4343,18 @@
3855
4343
  </xsl:call-template>
3856
4344
  <xsl:copy-of select="$node"/>
3857
4345
  </xsl:if>
3858
- </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">
3859
4347
  <xsl:copy>
3860
4348
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3861
4349
  </xsl:copy>
3862
- </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">
3863
4351
  <xsl:copy>
3864
4352
  <xsl:copy-of select="tr[1]"/>
3865
4353
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3866
4354
  <xsl:with-param name="previousRow" select="tr[1]"/>
3867
4355
  </xsl:apply-templates>
3868
4356
  </xsl:copy>
3869
- </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">
3870
4358
  <xsl:param name="previousRow"/>
3871
4359
  <xsl:variable name="currentRow" select="."/>
3872
4360
 
@@ -3900,43 +4388,53 @@
3900
4388
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3901
4389
  <xsl:with-param name="previousRow" select="$newRow"/>
3902
4390
  </xsl:apply-templates>
3903
- </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">
3904
4392
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3905
4393
  <xsl:choose>
3906
4394
  <xsl:when test="$language = 'English'">en</xsl:when>
3907
4395
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3908
4396
  </xsl:choose>
3909
- </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">
3910
4398
  <xsl:param name="str"/>
3911
4399
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3912
4400
  <xsl:choose>
3913
4401
  <xsl:when test="contains($str2, ' ')">
3914
4402
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3915
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3916
- <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>
3917
4408
  <xsl:text> </xsl:text>
3918
4409
  <xsl:call-template name="capitalizeWords">
3919
4410
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3920
4411
  </xsl:call-template>
3921
4412
  </xsl:when>
3922
4413
  <xsl:otherwise>
3923
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3924
- <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>
3925
4419
  </xsl:otherwise>
3926
4420
  </xsl:choose>
3927
- </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">
3928
4426
  <fo:inline font-family="STIX2Math">
3929
4427
  <fo:instream-foreign-object fox:alt-text="Math">
3930
4428
  <xsl:copy-of select="."/>
3931
4429
  </fo:instream-foreign-object>
3932
4430
  </fo:inline>
3933
- </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()='localityStack']">
4431
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3934
4432
  <xsl:for-each select="*[local-name()='locality']">
3935
4433
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3936
4434
  <xsl:apply-templates select="."/>
3937
4435
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3938
4436
  </xsl:for-each>
3939
- </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()='link']" name="link">
4437
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3940
4438
  <xsl:variable name="target">
3941
4439
  <xsl:choose>
3942
4440
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3966,4 +4464,244 @@
3966
4464
  </xsl:otherwise>
3967
4465
  </xsl:choose>
3968
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"/>
3969
4707
  </xsl:template></xsl:stylesheet>