metanorma-iec 1.0.7 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/iec/biblio.rng +14 -4
  7. data/lib/asciidoctor/iec/converter.rb +8 -0
  8. data/lib/asciidoctor/iec/front.rb +2 -2
  9. data/lib/asciidoctor/iec/isodoc.rng +444 -1
  10. data/lib/asciidoctor/iec/isostandard.rng +10 -1
  11. data/lib/asciidoctor/iec/reqt.rng +23 -0
  12. data/lib/isodoc/iec/base_convert.rb +21 -37
  13. data/lib/isodoc/iec/html/htmlstyle.scss +0 -3
  14. data/lib/isodoc/iec/html/isodoc.scss +14 -9
  15. data/lib/isodoc/iec/html/wordstyle.scss +0 -4
  16. data/lib/isodoc/iec/iec.international-standard.xsl +1378 -608
  17. data/lib/isodoc/iec/pdf_convert.rb +2 -12
  18. data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
  19. data/lib/isodoc/iec/word_convert.rb +19 -8
  20. data/lib/isodoc/iec/xref.rb +45 -0
  21. data/lib/metanorma-iec.rb +2 -0
  22. data/lib/metanorma/iec/processor.rb +6 -8
  23. data/lib/metanorma/iec/version.rb +1 -1
  24. data/metanorma-iec.gemspec +3 -2
  25. data/spec/asciidoctor-iec/base_spec.rb +7 -6
  26. data/spec/asciidoctor-iec/cleanup_spec.rb +1 -1
  27. data/spec/asciidoctor-iec/iev_spec.rb +2 -2
  28. data/spec/isodoc/blocks_spec.rb +154 -0
  29. data/spec/isodoc/i18n_spec.rb +4 -4
  30. data/spec/isodoc/iev_spec.rb +11 -10
  31. data/spec/isodoc/inline_spec.rb +9 -9
  32. data/spec/isodoc/iso_spec.rb +4 -4
  33. data/spec/isodoc/metadata_spec.rb +90 -7
  34. data/spec/isodoc/postproc_spec.rb +3 -3
  35. data/spec/isodoc/ref_spec.rb +249 -0
  36. data/spec/isodoc/section_spec.rb +46 -9
  37. data/spec/isodoc/terms_spec.rb +10 -12
  38. data/spec/metanorma/processor_spec.rb +2 -5
  39. data/spec/spec_helper.rb +7 -0
  40. metadata +28 -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>
@@ -356,6 +362,9 @@
356
362
  <data type="boolean"/>
357
363
  </attribute>
358
364
  </optional>
365
+ <optional>
366
+ <attribute name="number"/>
367
+ </optional>
359
368
  <optional>
360
369
  <attribute name="subsequence"/>
361
370
  </optional>
@@ -512,7 +521,7 @@
512
521
  </attribute>
513
522
  </optional>
514
523
  <oneOrMore>
515
- <ref name="paragraph-with-footnote"/>
524
+ <ref name="BasicBlock"/>
516
525
  </oneOrMore>
517
526
  </element>
518
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
@@ -701,6 +701,3 @@ span.keyword {
701
701
  .Admonition p, .admonition p {
702
702
  margin: 0;
703
703
  }
704
-
705
-
706
-
@@ -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,14 @@ 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
+ }
@@ -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;
@@ -1855,4 +1852,3 @@ ol
1855
1852
  ul
1856
1853
  {margin-bottom:0cm;
1857
1854
  margin-left:18pt;}
1858
-
@@ -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>
2742
2869
 
2743
2870
 
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()">
2871
+
2872
+ <title-note lang="en">NOTE </title-note>
2873
+ <title-note lang="fr">NOTE </title-note>
2874
+
2875
+ <title-note lang="zh">NOTE </title-note>
2876
+
2877
+
2878
+
2879
+ <title-figure lang="en">Figure </title-figure>
2880
+ <title-figure lang="fr">Figure </title-figure>
2881
+
2882
+ <title-figure lang="zh">Figure </title-figure>
2883
+
2884
+
2885
+
2886
+ <title-example lang="en">EXAMPLE </title-example>
2887
+ <title-example lang="fr">EXEMPLE </title-example>
2888
+
2889
+ <title-example lang="zh">EXAMPLE </title-example>
2890
+
2891
+
2892
+
2893
+ <title-example-xref lang="en">Example </title-example-xref>
2894
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2895
+
2896
+ <title-section lang="en">Section </title-section>
2897
+ <title-section lang="fr">Section </title-section>
2898
+
2899
+ <title-inequality lang="en">Inequality </title-inequality>
2900
+ <title-inequality lang="fr">Inequality </title-inequality>
2901
+
2902
+ <title-equation lang="en">Equation </title-equation>
2903
+ <title-equation lang="fr">Equation </title-equation>
2904
+
2905
+ <title-annex lang="en">Annex </title-annex>
2906
+ <title-annex lang="fr">Annexe </title-annex>
2907
+
2908
+ <title-annex lang="zh">Annex </title-annex>
2909
+
2910
+
2911
+
2912
+ <title-appendix lang="en">Appendix </title-appendix>
2913
+ <title-appendix lang="fr">Appendix </title-appendix>
2914
+
2915
+ <title-clause lang="en">Clause </title-clause>
2916
+ <title-clause lang="fr">Article </title-clause>
2917
+
2918
+ <title-clause lang="zh">Clause </title-clause>
2919
+
2920
+
2921
+
2922
+ <title-edition lang="en">
2923
+
2924
+ <xsl:text>Edition </xsl:text>
2925
+
2926
+
2927
+ </title-edition>
2928
+
2929
+ <title-formula lang="en">Formula </title-formula>
2930
+ <title-formula lang="fr">Formula </title-formula>
2931
+
2932
+ <title-toc lang="en">
2933
+
2934
+ <xsl:text>Contents</xsl:text>
2935
+
2936
+
2937
+
2938
+ </title-toc>
2939
+ <title-toc lang="fr">Sommaire</title-toc>
2940
+
2941
+ <title-toc lang="zh">Contents</title-toc>
2942
+
2943
+
2944
+
2945
+ <title-page lang="en">Page</title-page>
2946
+ <title-page lang="fr">Page</title-page>
2947
+
2948
+ <title-key lang="en">Key</title-key>
2949
+ <title-key lang="fr">Légende</title-key>
2950
+
2951
+ <title-where lang="en">where</title-where>
2952
+ <title-where lang="fr">où</title-where>
2953
+
2954
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2955
+
2956
+ <title-part lang="en">
2957
+
2958
+
2959
+ <xsl:text>Part #: </xsl:text>
2960
+
2961
+ </title-part>
2962
+ <title-part lang="fr">
2963
+
2964
+
2965
+ <xsl:text>Partie #: </xsl:text>
2966
+
2967
+ </title-part>
2968
+ <title-part lang="zh">第 # 部分:</title-part>
2969
+
2970
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2971
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2972
+
2973
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2974
+
2975
+
2976
+
2977
+ <title-modified lang="en">modified</title-modified>
2978
+ <title-modified lang="fr">modifiée</title-modified>
2979
+
2980
+ <title-modified lang="zh">modified</title-modified>
2981
+
2982
+
2983
+
2984
+ <title-source lang="en">SOURCE</title-source>
2985
+
2986
+ <title-keywords lang="en">Keywords</title-keywords>
2987
+
2988
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2989
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2990
+
2991
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2992
+
2993
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2994
+
2995
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2996
+
2997
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2998
+
2999
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3000
+
3001
+ <title-abstract lang="en">Abstract</title-abstract>
3002
+
3003
+ <title-summary lang="en">Summary</title-summary>
3004
+
3005
+ <title-in lang="en">in </title-in>
3006
+
3007
+ <title-box lang="en">Box </title-box>
3008
+
3009
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3010
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3011
+
3012
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3013
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3014
+
3015
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3016
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3017
+
3018
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3019
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3020
+
3021
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3022
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3023
+
3024
+ <title-caution lang="en">CAUTION</title-caution>
3025
+ <title-caution lang="zh">注意</title-caution>
3026
+
3027
+ <title-warning lang="en">WARNING</title-warning>
3028
+ <title-warning lang="zh">警告</title-warning>
3029
+
3030
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3031
+ </xsl:variable><xsl:template name="getTitle">
3032
+ <xsl:param name="name"/>
3033
+ <xsl:variable name="lang">
3034
+ <xsl:call-template name="getLang"/>
3035
+ </xsl:variable>
3036
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3037
+ <xsl:choose>
3038
+ <xsl:when test="normalize-space($title_) != ''">
3039
+ <xsl:value-of select="$title_"/>
3040
+ </xsl:when>
3041
+ <xsl:otherwise>
3042
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3043
+ </xsl:otherwise>
3044
+ </xsl:choose>
3045
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
3046
+
3047
+
3048
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
3049
+
3050
+
3051
+
3052
+
3053
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
3054
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
3055
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
3056
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
3057
+
3058
+
3059
+
3060
+
3061
+
3062
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
3063
+
3064
+
3065
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3066
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
3067
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
3068
+
3069
+
3070
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
3071
+
3072
+
3073
+ <xsl:attribute name="margin-top">14pt</xsl:attribute>
3074
+ <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
3075
+
3076
+
3077
+ </xsl:attribute-set><xsl:template match="text()">
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']">
3101
3460
 
3102
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
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>
3103
3475
 
3104
- <xsl:call-template name="insertTableFooter"/>
3476
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3477
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3478
+ </xsl:apply-templates>
3479
+
3480
+ <xsl:call-template name="insertTableFooter">
3481
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3482
+ </xsl:call-template>
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,17 @@
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
+
3611
+ <xsl:variable name="title-note">
3612
+ <xsl:call-template name="getTitle">
3613
+ <xsl:with-param name="name" select="'title-note'"/>
3614
+ </xsl:call-template>
3615
+ </xsl:variable>
3616
+ <xsl:value-of select="$title-note"/>
3230
3617
 
3231
3618
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3232
3619
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -3240,9 +3627,9 @@
3240
3627
  <xsl:apply-templates mode="process"/>
3241
3628
  </fo:block>
3242
3629
 
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">
3630
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3244
3631
  <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">
3632
+ </xsl:template><xsl:template name="fn_display">
3246
3633
  <xsl:variable name="references">
3247
3634
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3248
3635
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3264,6 +3651,7 @@
3264
3651
  <xsl:attribute name="text-indent">-6mm</xsl:attribute>
3265
3652
  <xsl:attribute name="margin-left">6mm</xsl:attribute>
3266
3653
 
3654
+
3267
3655
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3268
3656
 
3269
3657
 
@@ -3284,7 +3672,7 @@
3284
3672
  </fo:block>
3285
3673
  </xsl:if>
3286
3674
  </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">
3675
+ </xsl:template><xsl:template name="fn_name_display">
3288
3676
  <!-- <xsl:variable name="references">
3289
3677
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3290
3678
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3300,7 +3688,7 @@
3300
3688
  <xsl:apply-templates/>
3301
3689
  </fo:block>
3302
3690
  </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">
3691
+ </xsl:template><xsl:template name="fn_display_figure">
3304
3692
  <xsl:variable name="key_iso">
3305
3693
  true <!-- and (not(@class) or @class !='pseudocode') -->
3306
3694
  </xsl:variable>
@@ -3311,6 +3699,36 @@
3311
3699
  </fn>
3312
3700
  </xsl:for-each>
3313
3701
  </xsl:variable>
3702
+
3703
+ <!-- current hierarchy is 'figure' element -->
3704
+ <xsl:variable name="following_dl_colwidths">
3705
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3706
+ <xsl:variable name="html-table">
3707
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3708
+ <xsl:element name="{$ns}:table">
3709
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3710
+ <tbody>
3711
+ <xsl:apply-templates mode="dl"/>
3712
+ </tbody>
3713
+ </xsl:for-each>
3714
+ </xsl:element>
3715
+ </xsl:variable>
3716
+
3717
+ <xsl:call-template name="calculate-column-widths">
3718
+ <xsl:with-param name="cols-count" select="2"/>
3719
+ <xsl:with-param name="table" select="$html-table"/>
3720
+ </xsl:call-template>
3721
+
3722
+ </xsl:if>
3723
+ </xsl:variable>
3724
+
3725
+
3726
+ <xsl:variable name="maxlength_dt">
3727
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3728
+ <xsl:call-template name="getMaxLength_dt"/>
3729
+ </xsl:for-each>
3730
+ </xsl:variable>
3731
+
3314
3732
  <xsl:if test="xalan:nodeset($references)//fn">
3315
3733
  <fo:block>
3316
3734
  <fo:table width="95%" table-layout="fixed">
@@ -3320,8 +3738,19 @@
3320
3738
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3321
3739
 
3322
3740
  </xsl:if>
3323
- <fo:table-column column-width="15%"/>
3324
- <fo:table-column column-width="85%"/>
3741
+ <xsl:choose>
3742
+ <!-- if there 'dl', then set same columns width -->
3743
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3744
+ <xsl:call-template name="setColumnWidth_dl">
3745
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3746
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3747
+ </xsl:call-template>
3748
+ </xsl:when>
3749
+ <xsl:otherwise>
3750
+ <fo:table-column column-width="15%"/>
3751
+ <fo:table-column column-width="85%"/>
3752
+ </xsl:otherwise>
3753
+ </xsl:choose>
3325
3754
  <fo:table-body>
3326
3755
  <xsl:for-each select="xalan:nodeset($references)//fn">
3327
3756
  <xsl:variable name="reference" select="@reference"/>
@@ -3360,7 +3789,7 @@
3360
3789
  </fo:block>
3361
3790
  </xsl:if>
3362
3791
 
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']">
3792
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3364
3793
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3365
3794
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3366
3795
 
@@ -3378,11 +3807,11 @@
3378
3807
  <xsl:value-of select="@reference"/>
3379
3808
  </fo:basic-link>
3380
3809
  </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']">
3810
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3382
3811
  <fo:inline>
3383
3812
  <xsl:apply-templates/>
3384
3813
  </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']">
3814
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3386
3815
  <xsl:variable name="parent" select="local-name(..)"/>
3387
3816
 
3388
3817
  <xsl:variable name="key_iso">
@@ -3399,7 +3828,12 @@
3399
3828
  <xsl:attribute name="margin-bottom">15pt</xsl:attribute>
3400
3829
 
3401
3830
 
3402
- <xsl:text>where </xsl:text>
3831
+ <xsl:variable name="title-where">
3832
+ <xsl:call-template name="getTitle">
3833
+ <xsl:with-param name="name" select="'title-where'"/>
3834
+ </xsl:call-template>
3835
+ </xsl:variable>
3836
+ <xsl:value-of select="$title-where"/>
3403
3837
  </fo:block>
3404
3838
  <fo:block>
3405
3839
 
@@ -3419,18 +3853,28 @@
3419
3853
 
3420
3854
 
3421
3855
 
3422
- <xsl:text>where</xsl:text>
3856
+ <xsl:variable name="title-where">
3857
+ <xsl:call-template name="getTitle">
3858
+ <xsl:with-param name="name" select="'title-where'"/>
3859
+ </xsl:call-template>
3860
+ </xsl:variable>
3861
+ <xsl:value-of select="$title-where"/>
3423
3862
  </fo:block>
3424
3863
  </xsl:when>
3425
3864
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3426
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3865
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3427
3866
 
3428
3867
 
3429
3868
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3430
3869
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3431
3870
 
3432
3871
 
3433
- <xsl:text>Key</xsl:text>
3872
+ <xsl:variable name="title-key">
3873
+ <xsl:call-template name="getTitle">
3874
+ <xsl:with-param name="name" select="'title-key'"/>
3875
+ </xsl:call-template>
3876
+ </xsl:variable>
3877
+ <xsl:value-of select="$title-key"/>
3434
3878
  </fo:block>
3435
3879
  </xsl:when>
3436
3880
  </xsl:choose>
@@ -3441,26 +3885,11 @@
3441
3885
 
3442
3886
 
3443
3887
 
3888
+
3444
3889
  <fo:block>
3445
3890
 
3446
3891
 
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"/> -->
3892
+
3464
3893
 
3465
3894
  <fo:table width="95%" table-layout="fixed">
3466
3895
 
@@ -3475,42 +3904,30 @@
3475
3904
 
3476
3905
  </xsl:when>
3477
3906
  </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>
3907
+ <!-- create virtual html table for dl/[dt and dd] -->
3908
+ <xsl:variable name="html-table">
3909
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3910
+ <xsl:element name="{$ns}:table">
3911
+ <tbody>
3912
+ <xsl:apply-templates mode="dl"/>
3913
+ </tbody>
3914
+ </xsl:element>
3915
+ </xsl:variable>
3916
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3917
+ <xsl:variable name="colwidths">
3918
+ <xsl:call-template name="calculate-column-widths">
3919
+ <xsl:with-param name="cols-count" select="2"/>
3920
+ <xsl:with-param name="table" select="$html-table"/>
3921
+ </xsl:call-template>
3922
+ </xsl:variable>
3923
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3924
+ <xsl:variable name="maxlength_dt">
3925
+ <xsl:call-template name="getMaxLength_dt"/>
3926
+ </xsl:variable>
3927
+ <xsl:call-template name="setColumnWidth_dl">
3928
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3929
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3930
+ </xsl:call-template>
3514
3931
  <fo:table-body>
3515
3932
  <xsl:apply-templates>
3516
3933
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3520,7 +3937,61 @@
3520
3937
  </fo:block>
3521
3938
  </fo:block>
3522
3939
  </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']">
3940
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3941
+ <xsl:param name="colwidths"/>
3942
+ <xsl:param name="maxlength_dt"/>
3943
+ <xsl:choose>
3944
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3945
+ <fo:table-column column-width="50%"/>
3946
+ <fo:table-column column-width="50%"/>
3947
+ </xsl:when>
3948
+ <xsl:otherwise>
3949
+ <xsl:choose>
3950
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3951
+ <fo:table-column column-width="5%"/>
3952
+ <fo:table-column column-width="95%"/>
3953
+ </xsl:when>
3954
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3955
+ <fo:table-column column-width="10%"/>
3956
+ <fo:table-column column-width="90%"/>
3957
+ </xsl:when>
3958
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3959
+ <fo:table-column column-width="60%"/>
3960
+ <fo:table-column column-width="40%"/>
3961
+ </xsl:when> -->
3962
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3963
+ <fo:table-column column-width="50%"/>
3964
+ <fo:table-column column-width="50%"/>
3965
+ </xsl:when>
3966
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3967
+ <fo:table-column column-width="40%"/>
3968
+ <fo:table-column column-width="60%"/>
3969
+ </xsl:when>
3970
+ <xsl:otherwise>
3971
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3972
+ <xsl:choose>
3973
+ <xsl:when test=". = 1 or . = 0">
3974
+ <fo:table-column column-width="proportional-column-width(2)"/>
3975
+ </xsl:when>
3976
+ <xsl:otherwise>
3977
+ <fo:table-column column-width="proportional-column-width({.})"/>
3978
+ </xsl:otherwise>
3979
+ </xsl:choose>
3980
+ </xsl:for-each>
3981
+ </xsl:otherwise>
3982
+ </xsl:choose>
3983
+ <!-- <fo:table-column column-width="15%"/>
3984
+ <fo:table-column column-width="85%"/> -->
3985
+ </xsl:otherwise>
3986
+ </xsl:choose>
3987
+ </xsl:template><xsl:template name="getMaxLength_dt">
3988
+ <xsl:for-each select="*[local-name()='dt']">
3989
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3990
+ <xsl:if test="position() = 1">
3991
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3992
+ </xsl:if>
3993
+ </xsl:for-each>
3994
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3524
3995
  <xsl:param name="key_iso"/>
3525
3996
 
3526
3997
  <!-- <tr>
@@ -3536,7 +4007,12 @@
3536
4007
  <xsl:if test="normalize-space($key_iso) = 'true'">
3537
4008
  <xsl:attribute name="margin-top">0</xsl:attribute>
3538
4009
  </xsl:if>
3539
- NOTE
4010
+ <xsl:variable name="title-note">
4011
+ <xsl:call-template name="getTitle">
4012
+ <xsl:with-param name="name" select="'title-note'"/>
4013
+ </xsl:call-template>
4014
+ </xsl:variable>
4015
+ <xsl:value-of select="$title-note"/>
3540
4016
  </fo:block>
3541
4017
  </fo:table-cell>
3542
4018
  <fo:table-cell>
@@ -3545,7 +4021,7 @@
3545
4021
  </fo:block>
3546
4022
  </fo:table-cell>
3547
4023
  </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">
4024
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3549
4025
  <tr>
3550
4026
  <td>
3551
4027
  <xsl:apply-templates/>
@@ -3558,11 +4034,12 @@
3558
4034
  </td>
3559
4035
  </tr>
3560
4036
 
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']">
4037
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3562
4038
  <xsl:param name="key_iso"/>
3563
4039
 
3564
4040
  <fo:table-row>
3565
4041
  <fo:table-cell>
4042
+
3566
4043
  <fo:block margin-top="6pt">
3567
4044
 
3568
4045
 
@@ -3576,8 +4053,15 @@
3576
4053
  </xsl:if>
3577
4054
 
3578
4055
 
3579
- <xsl:apply-templates/>
3580
4056
 
4057
+
4058
+
4059
+ <xsl:apply-templates/>
4060
+ <!-- <xsl:if test="$namespace = 'gb'">
4061
+ <xsl:if test="ancestor::*[local-name()='formula']">
4062
+ <xsl:text>—</xsl:text>
4063
+ </xsl:if>
4064
+ </xsl:if> -->
3581
4065
  </fo:block>
3582
4066
  </fo:table-cell>
3583
4067
  <fo:table-cell>
@@ -3591,37 +4075,37 @@
3591
4075
  </fo:table-cell>
3592
4076
  </fo:table-row>
3593
4077
 
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">
4078
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3595
4079
  <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">
4080
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3597
4081
  <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">
4082
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3599
4083
  <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']">
4084
+ </xsl:template><xsl:template match="*[local-name()='em']">
3601
4085
  <fo:inline font-style="italic">
3602
4086
  <xsl:apply-templates/>
3603
4087
  </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']">
4088
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3605
4089
  <fo:inline font-weight="bold">
3606
4090
  <xsl:apply-templates/>
3607
4091
  </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']">
4092
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3609
4093
  <fo:inline font-size="80%" vertical-align="super">
3610
4094
  <xsl:apply-templates/>
3611
4095
  </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']">
4096
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3613
4097
  <fo:inline font-size="80%" vertical-align="sub">
3614
4098
  <xsl:apply-templates/>
3615
4099
  </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">
4100
+ </xsl:template><xsl:template match="*[local-name()='tt']">
4101
+ <fo:inline font-family="Courier" font-size="10pt">
3618
4102
  <xsl:apply-templates/>
3619
4103
  </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']">
4104
+ </xsl:template><xsl:template match="*[local-name()='del']">
3621
4105
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3622
4106
  <xsl:apply-templates/>
3623
4107
  </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']]">
4108
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3625
4109
  <xsl:variable name="text" select="normalize-space(.)"/>
3626
4110
  <fo:inline font-size="75%">
3627
4111
  <xsl:if test="string-length($text) &gt; 0">
@@ -3630,10 +4114,11 @@
3630
4114
  </xsl:call-template>
3631
4115
  </xsl:if>
3632
4116
  </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">
4117
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3634
4118
  <xsl:param name="text"/>
3635
4119
  <xsl:variable name="char" select="substring($text,1,1)"/>
3636
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4120
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4121
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3637
4122
  <xsl:choose>
3638
4123
  <xsl:when test="$char=$upperCase">
3639
4124
  <fo:inline font-size="{100 div 0.75}%">
@@ -3649,7 +4134,7 @@
3649
4134
  <xsl:with-param name="text" select="substring($text,2)"/>
3650
4135
  </xsl:call-template>
3651
4136
  </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">
4137
+ </xsl:template><xsl:template name="tokenize">
3653
4138
  <xsl:param name="text"/>
3654
4139
  <xsl:param name="separator" select="' '"/>
3655
4140
  <xsl:choose>
@@ -3697,7 +4182,7 @@
3697
4182
  </xsl:call-template>
3698
4183
  </xsl:otherwise>
3699
4184
  </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">
4185
+ </xsl:template><xsl:template name="max_length">
3701
4186
  <xsl:param name="words"/>
3702
4187
  <xsl:for-each select="$words//word">
3703
4188
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3705,7 +4190,11 @@
3705
4190
  <xsl:value-of select="."/>
3706
4191
  </xsl:if>
3707
4192
  </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">
4193
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4194
+ <xsl:param name="text" select="."/>
4195
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4196
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4197
+ </xsl:template><xsl:template name="add-zero-spaces">
3709
4198
  <xsl:param name="text" select="."/>
3710
4199
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3711
4200
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3758,7 +4247,7 @@
3758
4247
  <xsl:value-of select="$text"/>
3759
4248
  </xsl:otherwise>
3760
4249
  </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">
4250
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3762
4251
  <xsl:param name="text" select="."/>
3763
4252
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3764
4253
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3784,7 +4273,7 @@
3784
4273
  <xsl:value-of select="$text"/>
3785
4274
  </xsl:otherwise>
3786
4275
  </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">
4276
+ </xsl:template><xsl:template name="getSimpleTable">
3788
4277
  <xsl:variable name="simple-table">
3789
4278
 
3790
4279
  <!-- Step 1. colspan processing -->
@@ -3811,9 +4300,9 @@
3811
4300
  </xsl:choose> -->
3812
4301
  </xsl:variable>
3813
4302
  <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">
4303
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3815
4304
  <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">
4305
+ </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
4306
  <xsl:choose>
3818
4307
  <xsl:when test="@colspan">
3819
4308
  <xsl:variable name="td">
@@ -3835,16 +4324,16 @@
3835
4324
  </xsl:element>
3836
4325
  </xsl:otherwise>
3837
4326
  </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">
4327
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3839
4328
  <xsl:element name="tr">
3840
4329
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3841
4330
  <xsl:apply-templates mode="simple-table-colspan"/>
3842
4331
  </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">
4332
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3844
4333
  <xsl:copy>
3845
4334
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3846
4335
  </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">
4336
+ </xsl:template><xsl:template name="repeatNode">
3848
4337
  <xsl:param name="count"/>
3849
4338
  <xsl:param name="node"/>
3850
4339
 
@@ -3855,18 +4344,18 @@
3855
4344
  </xsl:call-template>
3856
4345
  <xsl:copy-of select="$node"/>
3857
4346
  </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">
4347
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3859
4348
  <xsl:copy>
3860
4349
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3861
4350
  </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">
4351
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3863
4352
  <xsl:copy>
3864
4353
  <xsl:copy-of select="tr[1]"/>
3865
4354
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3866
4355
  <xsl:with-param name="previousRow" select="tr[1]"/>
3867
4356
  </xsl:apply-templates>
3868
4357
  </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">
4358
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3870
4359
  <xsl:param name="previousRow"/>
3871
4360
  <xsl:variable name="currentRow" select="."/>
3872
4361
 
@@ -3900,43 +4389,53 @@
3900
4389
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3901
4390
  <xsl:with-param name="previousRow" select="$newRow"/>
3902
4391
  </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">
4392
+ </xsl:template><xsl:template name="getLang">
3904
4393
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3905
4394
  <xsl:choose>
3906
4395
  <xsl:when test="$language = 'English'">en</xsl:when>
3907
4396
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3908
4397
  </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">
4398
+ </xsl:template><xsl:template name="capitalizeWords">
3910
4399
  <xsl:param name="str"/>
3911
4400
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3912
4401
  <xsl:choose>
3913
4402
  <xsl:when test="contains($str2, ' ')">
3914
4403
  <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)"/>
4404
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4405
+ <xsl:value-of select="substring($substr, 2)"/> -->
4406
+ <xsl:call-template name="capitalize">
4407
+ <xsl:with-param name="str" select="$substr"/>
4408
+ </xsl:call-template>
3917
4409
  <xsl:text> </xsl:text>
3918
4410
  <xsl:call-template name="capitalizeWords">
3919
4411
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3920
4412
  </xsl:call-template>
3921
4413
  </xsl:when>
3922
4414
  <xsl:otherwise>
3923
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3924
- <xsl:value-of select="substring($str2, 2)"/>
4415
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4416
+ <xsl:value-of select="substring($str2, 2)"/> -->
4417
+ <xsl:call-template name="capitalize">
4418
+ <xsl:with-param name="str" select="$str2"/>
4419
+ </xsl:call-template>
3925
4420
  </xsl:otherwise>
3926
4421
  </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">
4422
+ </xsl:template><xsl:template name="capitalize">
4423
+ <xsl:param name="str"/>
4424
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4425
+ <xsl:value-of select="substring($str, 2)"/>
4426
+ </xsl:template><xsl:template match="mathml:math">
3928
4427
  <fo:inline font-family="STIX2Math">
3929
4428
  <fo:instream-foreign-object fox:alt-text="Math">
3930
4429
  <xsl:copy-of select="."/>
3931
4430
  </fo:instream-foreign-object>
3932
4431
  </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']">
4432
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3934
4433
  <xsl:for-each select="*[local-name()='locality']">
3935
4434
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3936
4435
  <xsl:apply-templates select="."/>
3937
4436
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3938
4437
  </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">
4438
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3940
4439
  <xsl:variable name="target">
3941
4440
  <xsl:choose>
3942
4441
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3966,4 +4465,275 @@
3966
4465
  </xsl:otherwise>
3967
4466
  </xsl:choose>
3968
4467
  </fo:inline>
4468
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4469
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4470
+ <!-- <xsl:choose>
4471
+ <xsl:when test="@lang = 'en'"></xsl:when>
4472
+ <xsl:otherwise> -->
4473
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4474
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4475
+ <!-- </xsl:otherwise>
4476
+ </xsl:choose> -->
4477
+ <xsl:apply-templates/>
4478
+ </fo:block>
4479
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4480
+ <fo:inline id="{@id}"/>
4481
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4482
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4483
+ <xsl:variable name="title-appendix">
4484
+ <xsl:call-template name="getTitle">
4485
+ <xsl:with-param name="name" select="'title-appendix'"/>
4486
+ </xsl:call-template>
4487
+ </xsl:variable>
4488
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4489
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4490
+ </fo:block>
4491
+ <xsl:apply-templates/>
4492
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4493
+ <fo:inline><xsl:apply-templates/></fo:inline>
4494
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4495
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4496
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4497
+ <xsl:variable name="title-example">
4498
+ <xsl:call-template name="getTitle">
4499
+ <xsl:with-param name="name" select="'title-example'"/>
4500
+ </xsl:call-template>
4501
+ </xsl:variable>
4502
+ <xsl:value-of select="$title-example"/>
4503
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4504
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4505
+ </xsl:if>
4506
+ <xsl:if test="*[local-name()='name']">
4507
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4508
+ </xsl:if>
4509
+ </fo:block>
4510
+ <xsl:apply-templates/>
4511
+ </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">
4512
+ <fo:inline><xsl:apply-templates/></fo:inline>
4513
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4514
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4515
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4516
+ <xsl:variable name="annotation-id" select="@id"/>
4517
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4518
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4519
+ <fo:inline>
4520
+ <xsl:apply-templates>
4521
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4522
+ </xsl:apply-templates>
4523
+ </fo:inline>
4524
+ </fo:block>
4525
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4526
+ <xsl:param name="callout"/>
4527
+ <fo:inline id="{@id}">
4528
+ <!-- for first p in annotation, put <x> -->
4529
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4530
+ <xsl:apply-templates/>
4531
+ </fo:inline>
4532
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4533
+ <xsl:variable name="title-modified">
4534
+ <xsl:call-template name="getTitle">
4535
+ <xsl:with-param name="name" select="'title-modified'"/>
4536
+ </xsl:call-template>
4537
+ </xsl:variable>
4538
+ <xsl:choose>
4539
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4540
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4541
+ </xsl:choose>
4542
+ <xsl:apply-templates/>
4543
+ </xsl:template><xsl:template name="convertDate">
4544
+ <xsl:param name="date"/>
4545
+ <xsl:param name="format" select="'short'"/>
4546
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4547
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4548
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4549
+ <xsl:variable name="monthStr">
4550
+ <xsl:choose>
4551
+ <xsl:when test="$month = '01'">January</xsl:when>
4552
+ <xsl:when test="$month = '02'">February</xsl:when>
4553
+ <xsl:when test="$month = '03'">March</xsl:when>
4554
+ <xsl:when test="$month = '04'">April</xsl:when>
4555
+ <xsl:when test="$month = '05'">May</xsl:when>
4556
+ <xsl:when test="$month = '06'">June</xsl:when>
4557
+ <xsl:when test="$month = '07'">July</xsl:when>
4558
+ <xsl:when test="$month = '08'">August</xsl:when>
4559
+ <xsl:when test="$month = '09'">September</xsl:when>
4560
+ <xsl:when test="$month = '10'">October</xsl:when>
4561
+ <xsl:when test="$month = '11'">November</xsl:when>
4562
+ <xsl:when test="$month = '12'">December</xsl:when>
4563
+ </xsl:choose>
4564
+ </xsl:variable>
4565
+ <xsl:variable name="result">
4566
+ <xsl:choose>
4567
+ <xsl:when test="$format = 'short' or $day = ''">
4568
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4569
+ </xsl:when>
4570
+ <xsl:otherwise>
4571
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4572
+ </xsl:otherwise>
4573
+ </xsl:choose>
4574
+ </xsl:variable>
4575
+ <xsl:value-of select="$result"/>
4576
+ </xsl:template><xsl:template name="insertKeywords">
4577
+ <xsl:param name="sorting" select="'true'"/>
4578
+ <xsl:param name="charAtEnd" select="'.'"/>
4579
+ <xsl:param name="charDelim" select="', '"/>
4580
+ <xsl:choose>
4581
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4582
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4583
+ <xsl:sort data-type="text" order="ascending"/>
4584
+ <xsl:call-template name="insertKeyword">
4585
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4586
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4587
+ </xsl:call-template>
4588
+ </xsl:for-each>
4589
+ </xsl:when>
4590
+ <xsl:otherwise>
4591
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4592
+ <xsl:call-template name="insertKeyword">
4593
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4594
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4595
+ </xsl:call-template>
4596
+ </xsl:for-each>
4597
+ </xsl:otherwise>
4598
+ </xsl:choose>
4599
+ </xsl:template><xsl:template name="insertKeyword">
4600
+ <xsl:param name="charAtEnd"/>
4601
+ <xsl:param name="charDelim"/>
4602
+ <xsl:apply-templates/>
4603
+ <xsl:choose>
4604
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4605
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4606
+ </xsl:choose>
4607
+ </xsl:template><xsl:template name="addPDFUAmeta">
4608
+ <fo:declarations>
4609
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4610
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4611
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4612
+ </pdf:dictionary>
4613
+ </pdf:catalog>
4614
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4615
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4616
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4617
+ <!-- Dublin Core properties go here -->
4618
+ <dc:title>
4619
+ <xsl:variable name="title">
4620
+
4621
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4622
+
4623
+
4624
+
4625
+
4626
+ </xsl:variable>
4627
+ <xsl:choose>
4628
+ <xsl:when test="normalize-space($title) != ''">
4629
+ <xsl:value-of select="$title"/>
4630
+ </xsl:when>
4631
+ <xsl:otherwise>
4632
+ <xsl:text> </xsl:text>
4633
+ </xsl:otherwise>
4634
+ </xsl:choose>
4635
+ </dc:title>
4636
+ <dc:creator>
4637
+
4638
+
4639
+ </dc:creator>
4640
+ <dc:description>
4641
+ <xsl:variable name="abstract">
4642
+
4643
+
4644
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract'][@language = 'en']//text()"/>
4645
+
4646
+
4647
+
4648
+ </xsl:variable>
4649
+ <xsl:value-of select="normalize-space($abstract)"/>
4650
+ </dc:description>
4651
+ <pdf:Keywords>
4652
+ <xsl:call-template name="insertKeywords"/>
4653
+ </pdf:Keywords>
4654
+ </rdf:Description>
4655
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4656
+ <!-- XMP properties go here -->
4657
+ <xmp:CreatorTool/>
4658
+ </rdf:Description>
4659
+ </rdf:RDF>
4660
+ </x:xmpmeta>
4661
+ </fo:declarations>
4662
+ </xsl:template><xsl:template name="getId">
4663
+ <xsl:choose>
4664
+ <xsl:when test="../@id">
4665
+ <xsl:value-of select="../@id"/>
4666
+ </xsl:when>
4667
+ <xsl:otherwise>
4668
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4669
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4670
+ </xsl:otherwise>
4671
+ </xsl:choose>
4672
+ </xsl:template><xsl:template name="getLevel">
4673
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4674
+ <xsl:variable name="level">
4675
+ <xsl:choose>
4676
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4677
+ <xsl:value-of select="$level_total - 2"/>
4678
+ </xsl:when>
4679
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4680
+ <xsl:value-of select="$level_total - 2"/>
4681
+ </xsl:when>
4682
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4683
+ <xsl:value-of select="$level_total - 2"/>
4684
+ </xsl:when>
4685
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4686
+ <xsl:otherwise>
4687
+ <xsl:value-of select="$level_total - 1"/>
4688
+ </xsl:otherwise>
4689
+ </xsl:choose>
4690
+ </xsl:variable>
4691
+ <xsl:value-of select="$level"/>
4692
+ </xsl:template><xsl:template name="getSubSection">
4693
+ <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']"/>
4694
+ </xsl:template><xsl:template name="split">
4695
+ <xsl:param name="pText" select="."/>
4696
+ <xsl:param name="sep" select="','"/>
4697
+ <xsl:if test="string-length($pText) &gt;0">
4698
+ <item>
4699
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4700
+ </item>
4701
+ <xsl:call-template name="split">
4702
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4703
+ <xsl:with-param name="sep" select="$sep"/>
4704
+ </xsl:call-template>
4705
+ </xsl:if>
4706
+ </xsl:template><xsl:template name="getDocumentId">
4707
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4708
+ </xsl:template><xsl:template name="namespaceCheck">
4709
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4710
+ <xsl:variable name="XSLNS">
4711
+
4712
+
4713
+ <xsl:value-of select="document('')//*/namespace::iec"/>
4714
+
4715
+
4716
+
4717
+
4718
+
4719
+
4720
+
4721
+
4722
+
4723
+
4724
+
4725
+ </xsl:variable>
4726
+ <xsl:if test="$documentNS != $XSLNS">
4727
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4728
+ </xsl:if>
4729
+ </xsl:template><xsl:template name="getLanguage">
4730
+ <xsl:param name="lang"/>
4731
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4732
+ <xsl:choose>
4733
+ <xsl:when test="$language = 'en'">English</xsl:when>
4734
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4735
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4736
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4737
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4738
+ </xsl:choose>
3969
4739
  </xsl:template></xsl:stylesheet>