metanorma-iso 1.3.23 → 1.3.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e8cbb045e33e2e3403dffc3beac4df18852c29f0bb18edbf579f919ba7923b0
4
- data.tar.gz: e38bf3e9fd8169b4ec39110360497a839690d2aed836f80b5033f0c5fc432cba
3
+ metadata.gz: 0207a8005dcd32df7bd28bcf352786a876ff8301ef7942a678d5bf75ef1bd7a0
4
+ data.tar.gz: f1eb4a83fe424bc740add6d2a82e2ceaf0b11f38b34ae775108e2afa3d6d2f80
5
5
  SHA512:
6
- metadata.gz: 5ab999ee188ea2819dfe7a7c50192a96a7dfb2353d28ba3790033846d120f5b262c137bf5cfe5ed29f0dfd3e2129d4a2dad031d1d9974b6cf5bfb4e198dc40c3
7
- data.tar.gz: c2da9c1dcded9f65252718d00a22c6195f4a403477a91a3dba51572025ee3aaebbcf02e888301b04b461c938498fe5435c62ff0209b3705c57406bdaa903685f
6
+ metadata.gz: 181c074093254bbd29824c8af4f7f295781efe18f7ff201f8795da58c52493e30d5e38daff93b6b194e7dd379ea7186a56ae6c2d4331a18a7b7583e6157ec615
7
+ data.tar.gz: 8b5afd3661cd307878b38e342235f919a9a3960727560fef059b1df4e1ed8023e3cb253b2a506d3b40ba7bf85272777aa7e49d3efe7b9c0ded44fc134e9a46ed
@@ -6,6 +6,7 @@ require "open-uri"
6
6
  require "pp"
7
7
  require "isodoc"
8
8
  require "fileutils"
9
+ require 'asciidoctor/iso/macros'
9
10
 
10
11
  module Asciidoctor
11
12
  module ISO
@@ -13,6 +14,10 @@ module Asciidoctor
13
14
  XML_ROOT_TAG = "iso-standard".freeze
14
15
  XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
15
16
 
17
+ Asciidoctor::Extensions.register do
18
+ inline_macro Asciidoctor::Iso::TermRefInlineMacro
19
+ end
20
+
16
21
  def html_converter(node)
17
22
  IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node))
18
23
  end
@@ -5,6 +5,7 @@ require "json"
5
5
  require "pathname"
6
6
  require "open-uri"
7
7
  require "pp"
8
+ require "asciidoctor/iso/term_lookup_cleanup"
8
9
 
9
10
  module Asciidoctor
10
11
  module ISO
@@ -13,12 +14,12 @@ module Asciidoctor
13
14
  "//clause[title = 'Scope']//fn".freeze
14
15
 
15
16
  NORMREF_FOOTNOTES =
16
- "//references[title = 'Normative References']//fn".freeze
17
+ "//references[@normative = 'true']//fn".freeze
17
18
 
18
19
  POST_NORMREF_FOOTNOTES =
19
20
  "//sections//clause[not(title = 'Scope')]//fn | "\
20
21
  "//annex//fn | "\
21
- "//references[title = 'Bibliography']//fn".freeze
22
+ "//references[@normative = 'false']//fn".freeze
22
23
 
23
24
  def other_footnote_renumber(xmldoc)
24
25
  seen = {}
@@ -57,6 +58,8 @@ module Asciidoctor
57
58
  id.content = id_prefix(prefix, id)
58
59
  id = xmldoc.at("//bibdata/docidentifier[@type = 'iso-with-lang']") and
59
60
  id.content = id_prefix(prefix, id)
61
+ id = xmldoc.at("//bibdata/docidentifier[@type = 'iso-reference']") and
62
+ id.content = id_prefix(prefix, id)
60
63
  end
61
64
 
62
65
  def format_ref(ref, type, isopub)
@@ -86,6 +89,11 @@ module Asciidoctor
86
89
  end
87
90
  end
88
91
 
92
+ def termdef_cleanup(xmldoc)
93
+ Asciidoctor::ISO::TermLookupCleanup.new(xmldoc, @log).call
94
+ super
95
+ end
96
+
89
97
  # TODO sort by authors
90
98
  # sort by: doc class (ISO, IEC, other standard (not DOI &c), other
91
99
  # then standard class (docid class other than DOI &c)
@@ -56,9 +56,11 @@ module Asciidoctor
56
56
  return unless node.attr("docnumber")
57
57
  part, subpart = node&.attr("partnumber")&.split(/-/)
58
58
  dn = add_id_parts(node.attr("docnumber"), part, subpart)
59
- dn = id_stage_prefix(dn, node)
60
- xml.docidentifier dn, **attr_code(type: "iso")
61
- xml.docidentifier id_langsuffix(dn, node), **attr_code(type: "iso-with-lang")
59
+ dn1 = id_stage_prefix(dn, node, false)
60
+ dn2 = id_stage_prefix(dn, node, true)
61
+ xml.docidentifier dn1, **attr_code(type: "iso")
62
+ xml.docidentifier id_langsuffix(dn1, node), **attr_code(type: "iso-with-lang")
63
+ xml.docidentifier id_langsuffix(dn2, node), **attr_code(type: "iso-reference")
62
64
  end
63
65
 
64
66
  def id_langsuffix(dn, node)
@@ -69,7 +71,7 @@ module Asciidoctor
69
71
  else
70
72
  "(X)"
71
73
  end
72
- "#{dn} #{suffix}"
74
+ "#{dn}#{suffix}"
73
75
  end
74
76
 
75
77
  def metadata_ext(node, xml)
@@ -99,13 +101,14 @@ module Asciidoctor
99
101
  node.attr("draft"))
100
102
  end
101
103
 
102
- def id_stage_prefix(dn, node)
104
+ def id_stage_prefix(dn, node, force_year)
103
105
  stage = get_stage(node)
104
106
  substage = get_substage(node)
105
107
  if stage && (stage.to_i < 60)
106
108
  abbr = id_stage_abbr(stage, substage, node)
107
109
  dn = "/#{abbr} #{dn}" unless abbr.nil? || abbr.empty? # prefixes added in cleanup
108
- else
110
+ end
111
+ if force_year || !(stage && (stage.to_i < 60))
109
112
  dn += ":#{node.attr("copyright-year")}" if node.attr("copyright-year")
110
113
  end
111
114
  dn
@@ -129,6 +129,9 @@
129
129
  </choice>
130
130
  </attribute>
131
131
  </optional>
132
+ <attribute name="normative">
133
+ <data type="boolean"/>
134
+ </attribute>
132
135
  <optional>
133
136
  <ref name="section-title"/>
134
137
  </optional>
@@ -303,11 +306,11 @@
303
306
  <ref name="paragraph"/>
304
307
  </element>
305
308
  </define>
306
- <define name="TextElement" combine="choice">
307
- <ref name="concept"/>
308
- </define>
309
309
  </include>
310
310
  <!-- end overrides -->
311
+ <define name="TextElement" combine="choice">
312
+ <ref name="concept"/>
313
+ </define>
311
314
  <define name="concept">
312
315
  <element name="concept">
313
316
  <optional>
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor/extensions'
4
+
5
+ module Asciidoctor
6
+ module Iso
7
+ # Macro to transform `term[X,Y]` into em, termxref xml
8
+ class TermRefInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
9
+ use_dsl
10
+
11
+ named :term
12
+ name_positional_attributes 'name', 'termxref'
13
+ using_format :short
14
+
15
+ def process(_parent, _target, attrs)
16
+ termref = attrs['termxref'] || attrs['name']
17
+ "<em>#{attrs['name']}</em> (<termxref>#{termref}</termxref>)"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -4,38 +4,12 @@ require "uri"
4
4
  module Asciidoctor
5
5
  module ISO
6
6
  class Converter < Standoc::Converter
7
- def section(node)
8
- a = section_attributes(node)
9
- noko do |xml|
10
- case sectiontype(node)
11
- when "foreword" then foreword_parse(a, xml, node)
12
- when "introduction" then introduction_parse(a, xml, node)
13
- when "patent notice" then patent_notice_parse(xml, node)
14
- when "scope" then scope_parse(a, xml, node)
15
- when "normative references" then norm_ref_parse(a, xml, node)
16
- when "terms and definitions"
17
- @term_def = true
18
- term_def_parse(a, xml, node, true)
19
- @term_def = false
20
- when "symbols and abbreviated terms"
21
- symbols_parse(a, xml, node)
22
- when "acknowledgements"
23
- acknowledgements_parse(a, xml, node)
24
- when "bibliography" then bibliography_parse(a, xml, node)
25
- else
26
- if @term_def then term_def_subclause_parse(a, xml, node)
27
- elsif @biblio then bibliography_parse(a, xml, node)
28
- elsif node.attr("style") == "bibliography"
29
- bibliography_parse(a, xml, node)
30
- elsif node.attr("style") == "appendix" && node.level == 1
31
- annex_parse(a, xml, node)
32
- elsif node.option? "appendix"
33
- appendix_parse(a, xml, node)
34
- else
35
- clause_parse(a, xml, node)
36
- end
37
- end
38
- end.join("\n")
7
+ def clause_parse(attrs, xml, node)
8
+ title = node&.attr("heading")&.downcase ||
9
+ node.title.gsub(/<[^>]+>/, "").downcase
10
+ title == "scope" and return scope_parse(attrs, xml, node)
11
+ node.option? "appendix" and return appendix_parse(attrs, xml, node)
12
+ super
39
13
  end
40
14
 
41
15
  def appendix_parse(attrs, xml, node)
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true.
2
+
3
+ module Asciidoctor
4
+ module ISO
5
+ # Intelligent term lookup xml modifier
6
+ # Lookup all `term` and `calause` tags and replace `termxref` tags with
7
+ # `xref`:target tag
8
+ class TermLookupCleanup
9
+ AUTOMATIC_GENERATED_ID_REGEXP = /\A_/
10
+ EXISTING_TERM_REGEXP = /\Aterm-/
11
+
12
+ attr_reader :xmldoc, :termlookup, :log
13
+
14
+ def initialize(xmldoc, log)
15
+ @xmldoc = xmldoc
16
+ @log = log
17
+ @termlookup = {}
18
+ end
19
+
20
+ def call
21
+ @termlookup = replace_automatic_generated_ids_terms
22
+ set_termxref_tags_target
23
+ end
24
+
25
+ private
26
+
27
+ def set_termxref_tags_target
28
+ xmldoc.xpath('//termxref').each do |node|
29
+ target = normalize_ref_id(node.text)
30
+ if termlookup[target].nil?
31
+ remove_missing_ref(node, target)
32
+ next
33
+ end
34
+
35
+ modify_ref_node(node, target)
36
+ end
37
+ end
38
+
39
+ def remove_missing_ref(node, target)
40
+ log.add('AsciiDoc Input',
41
+ node,
42
+ %(Error: Term reference in `term[#{target}]` missing: \
43
+ "#{target}" is not defined in document))
44
+ # Term ref have parentess around it - (ref),
45
+ # if no target remove parentes and render as text
46
+ node.next.remove
47
+ term_name_node = node.previous.previous
48
+ term_name_node.remove
49
+ node.previous.remove
50
+ node.add_previous_sibling(term_name_node.text)
51
+ node.remove
52
+ end
53
+
54
+ def modify_ref_node(node, target)
55
+ node.name = 'xref'
56
+ node['target'] = termlookup[target]
57
+ node.children.remove
58
+ node.remove_attribute('defaultref')
59
+ end
60
+
61
+ def replace_automatic_generated_ids_terms
62
+ xmldoc.xpath('//term').each.with_object({}) do |term_node, res|
63
+ next if AUTOMATIC_GENERATED_ID_REGEXP.match(term_node['id']).nil?
64
+
65
+ normalize_id_and_memorize(term_node, res, './preferred')
66
+ end
67
+ end
68
+
69
+ def normalize_id_and_memorize(term_node, res_table, text_selector)
70
+ term_text = normalize_ref_id(term_node.at(text_selector).text)
71
+ term_node['id'] = unique_text_id(term_text)
72
+ res_table[term_text] = term_node['id']
73
+ end
74
+
75
+ def normalize_ref_id(text)
76
+ text.downcase.gsub(/[[:space:]]/, '-')
77
+ end
78
+
79
+ def unique_text_id(text)
80
+ return "term-#{text}" if xmldoc.at("//*[@id = 'term-#{text}']").nil?
81
+
82
+ (1..Float::INFINITY).lazy.each do |index|
83
+ if xmldoc.at("//*[@id = 'term-#{text}-#{index}']").nil?
84
+ break("term-#{text}-#{index}")
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -56,8 +56,7 @@ module Asciidoctor
56
56
  @log.add("Bibliography", t, "'#{t} is not pointing to a real reference")
57
57
  next
58
58
  end
59
- if target.at("./ancestor::references"\
60
- "[title = 'Normative References']")
59
+ if target.at("./ancestor::references[@normative = 'true']")
61
60
  @log.add("Style", t, "'see #{t}' is pointing to a normative reference")
62
61
  end
63
62
  end
@@ -22,7 +22,7 @@ module Asciidoctor
22
22
 
23
23
  # ISO/IEC DIR 2, 15.4
24
24
  def normref_validate(root)
25
- f = root.at("//references[title = 'Normative References']") || return
25
+ f = root.at("//references[@normative = 'true']") || return
26
26
  f.at("./references | ./clause") &&
27
27
  @log.add("Style", f, "normative references contains subclauses")
28
28
  end
@@ -168,7 +168,7 @@ module Asciidoctor
168
168
  "//li[not(p)] | //dt | //dd[not(p)] | //td[not(p)] | //th[not(p)]".freeze
169
169
 
170
170
  NORM_BIBITEMS =
171
- "//references[title = 'Normative References']/bibitem".freeze
171
+ "//references[@normative = 'true']/bibitem".freeze
172
172
 
173
173
  # ISO/IEC DIR 2, 10.2
174
174
  def norm_bibitem_style(root)
@@ -210,23 +210,10 @@ module IsoDoc
210
210
 
211
211
  def cleanup(docxml)
212
212
  super
213
- remove_internal_hyperlinks(docxml)
214
213
  table_th_center(docxml)
215
214
  docxml
216
215
  end
217
216
 
218
- def remove_internal_hyperlinks(docxml)
219
- docxml.xpath("//a[@href]").each do |a|
220
- next unless /^#/.match(a[:href])
221
- anchor = a[:href].sub(/^#/, "")
222
- next if a["epub:type"] == "footnote"
223
- next unless @anchors[anchor]
224
- next unless @anchors[anchor][:type]
225
- next if @anchors[anchor][:type] == "clause"
226
- a.replace(a.children)
227
- end
228
- end
229
-
230
217
  def table_th_center(docxml)
231
218
  docxml.xpath("//thead//th | //thead//td").each do |th|
232
219
  th["align"] = "center"
@@ -66,7 +66,7 @@ normal'><span lang=EN-GB><span style='mso-special-character:footnote-continuatio
66
66
  <div style='mso-element:header' id=eha>
67
67
 
68
68
  <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;
69
- mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_lang }}{{ draftinfo }}</span></p>
69
+ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draftinfo }}</span></p>
70
70
 
71
71
  </div>
72
72
 
@@ -99,22 +99,22 @@ style='mso-tab-count:1'>                            
99
99
 
100
100
  <div style='mso-element:header' id=eh2>
101
101
  <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;
102
- mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_lang }}{{ draftinfo }}</span></p>
102
+ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draftinfo }}</span></p>
103
103
  </div>
104
104
 
105
105
  <div style='mso-element:header' id=eh2l>
106
106
  <p class=MsoHeaderLandscape align=left style='text-align:left;line-height:12.0pt;
107
- mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_lang }}{{ draftinfo }}</span></p>
107
+ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draftinfo }}</span></p>
108
108
  </div>
109
109
 
110
110
  <div style='mso-element:header' id=h2>
111
111
  <p class=MsoHeader align=right style='text-align:right;line-height:12.0pt;
112
- mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_lang }}{{ draftinfo }}</span></p>
112
+ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draftinfo }}</span></p>
113
113
  </div>
114
114
 
115
115
  <div style='mso-element:header' id=h2l>
116
116
  <p class=MsoHeaderLandscape align=right style='text-align:right;line-height:12.0pt;
117
- mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_lang }}{{ draftinfo }}</span></p>
117
+ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draftinfo }}</span></p>
118
118
  </div>
119
119
 
120
120
  <div style='mso-element:footer' id=ef2>
@@ -10,6 +10,13 @@ module IsoDoc
10
10
  super
11
11
  end
12
12
 
13
+ def googlefonts()
14
+ <<~HEAD.freeze
15
+ <link href="https://fonts.googleapis.com/css?family=Space+Mono:400,400i,700,700i&display=swap" rel="stylesheet">
16
+ <link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,900" rel="stylesheet">
17
+ HEAD
18
+ end
19
+
13
20
  def default_fonts(options)
14
21
  {
15
22
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
@@ -2,8 +2,13 @@
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
+ <xsl:param name="svg_images"/>
6
+ <xsl:variable name="images" select="document($svg_images)"/>
7
+
5
8
 
6
9
 
10
+ <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
+
7
12
 
8
13
 
9
14
  <xsl:variable name="debug">false</xsl:variable>
@@ -15,8 +20,9 @@
15
20
  <xsl:variable name="lang-1st-letter_tmp" select="substring-before(substring-after(/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-with-lang'], '('), ')')"/>
16
21
  <xsl:variable name="lang-1st-letter" select="concat('(', $lang-1st-letter_tmp , ')')"/>
17
22
 
18
- <xsl:variable name="ISOname" select="concat(/iso:iso-standard/iso:bibdata/iso:docidentifier, ':', /iso:iso-standard/iso:bibdata/iso:copyright/iso:from , $lang-1st-letter)"/>
19
-
23
+ <!-- <xsl:variable name="ISOname" select="concat(/iso:iso-standard/iso:bibdata/iso:docidentifier, ':', /iso:iso-standard/iso:bibdata/iso:copyright/iso:from , $lang-1st-letter)"/> -->
24
+ <xsl:variable name="ISOname" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-reference']"/>
25
+
20
26
  <!-- Information and documentation — Codes for transcription systems -->
21
27
  <xsl:variable name="title-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'main']"/>
22
28
  <xsl:variable name="title-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'main']"/>
@@ -28,72 +34,84 @@
28
34
  <xsl:variable name="title-part" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
29
35
  <xsl:variable name="title-part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
30
36
 
31
- <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
32
- <xsl:variable name="doctype_uppercased" select="translate(translate($doctype,'-',' '), $lower,$upper)"/>
37
+ <xsl:variable name="doctype_uppercased" select="translate(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype,'-',' '), $lower,$upper)"/>
33
38
 
34
39
  <xsl:variable name="stage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:stage)"/>
35
- <xsl:variable name="stage-abbrev" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
36
- <xsl:variable name="stage-fullname" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
37
40
  <xsl:variable name="substage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:substage)"/>
38
- <xsl:variable name="iteration" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:iteration)"/>
39
- <xsl:variable name="stage-name">
41
+ <xsl:variable name="stagename" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
42
+ <xsl:variable name="abbreviation" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
43
+
44
+ <xsl:variable name="stage-abbreviation">
40
45
  <xsl:choose>
41
- <xsl:when test="$stage-abbrev != ''">
42
- <xsl:value-of select="$stage-abbrev"/>
46
+ <xsl:when test="$abbreviation != ''">
47
+ <xsl:value-of select="$abbreviation"/>
43
48
  </xsl:when>
44
- <!-- and $substage = 0 -->
45
- <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP, PWI) -->
49
+ <xsl:when test="$stage = 0 and $substage = 0">PWI</xsl:when>
50
+ <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP) -->
46
51
  <xsl:when test="$stage = 10">AWI</xsl:when>
47
52
  <xsl:when test="$stage = 20">WD</xsl:when>
48
53
  <xsl:when test="$stage = 30">CD</xsl:when>
49
54
  <xsl:when test="$stage = 40">DIS</xsl:when>
50
55
  <xsl:when test="$stage = 50">FDIS</xsl:when>
51
- <xsl:when test="$stage = 60 and $substage = 0">IS</xsl:when>
56
+ <xsl:when test="$stage = 60 and $substage = 0">PRF</xsl:when>
57
+ <xsl:when test="$stage = 60 and $substage = 60">IS</xsl:when>
52
58
  <xsl:when test="$stage &gt;=60">published</xsl:when>
53
59
  <xsl:otherwise/>
54
60
  </xsl:choose>
55
61
  </xsl:variable>
62
+
63
+ <xsl:variable name="stage-fullname-uppercased">
64
+ <xsl:choose>
65
+ <xsl:when test="$stagename != ''">
66
+ <xsl:value-of select="translate($stagename, $lower, $upper)"/>
67
+ </xsl:when>
68
+ <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
69
+ <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
70
+ <xsl:when test="$stage-abbreviation = 'AWI'">APPROVED WORK ITEM</xsl:when>
71
+ <xsl:when test="$stage-abbreviation = 'WD'">WORKING DRAFT</xsl:when>
72
+ <xsl:when test="$stage-abbreviation = 'CD'">COMMITTEE DRAFT</xsl:when>
73
+ <xsl:when test="$stage-abbreviation = 'DIS'">DRAFT INTERNATIONAL STANDARD</xsl:when>
74
+ <xsl:when test="$stage-abbreviation = 'FDIS'">FINAL DRAFT INTERNATIONAL STANDARD</xsl:when>
75
+ <xsl:otherwise><xsl:value-of select="$doctype_uppercased"/></xsl:otherwise>
76
+ </xsl:choose>
77
+ </xsl:variable>
56
78
 
57
- <!-- UPPERCASED stage name -->
58
- <xsl:variable name="stage-name-uppercased">
59
- <xsl:if test="$stage-fullname != '' and $stage-abbrev != ''">
60
- <item name="{$stage-abbrev}">
61
- <xsl:if test="$stage-abbrev = 'NWIP'">
62
- <xsl:attribute name="show">true</xsl:attribute>
63
- <xsl:attribute name="header">PRELIMINARY WORK ITEM</xsl:attribute>
64
- </xsl:if>
65
- <xsl:if test="$stage-abbrev = 'AWI'">
66
- <xsl:attribute name="show">true</xsl:attribute>
67
- <xsl:attribute name="header">APPROVED WORK ITEM</xsl:attribute>
68
- </xsl:if>
69
- <xsl:if test="$stage-abbrev = 'WD'">
70
- <xsl:attribute name="show">true</xsl:attribute>
71
- <xsl:attribute name="header">WORKING DRAFT</xsl:attribute>
72
- </xsl:if>
73
- <xsl:if test="$stage-abbrev = 'CD'">
74
- <xsl:attribute name="show">true</xsl:attribute>
75
- <xsl:attribute name="header">COMMITTEE DRAFT</xsl:attribute>
76
- </xsl:if>
77
- <xsl:if test="$stage-abbrev = 'DIS'">
78
- <xsl:attribute name="show">true</xsl:attribute>
79
- <xsl:attribute name="header">DRAFT INTERNATIONAL STANDARD</xsl:attribute>
80
- </xsl:if>
81
- <xsl:if test="$stage-abbrev = 'FDIS'">
82
- <xsl:attribute name="show">true</xsl:attribute>
83
- <xsl:attribute name="header">FINAL DRAFT INTERNATIONAL STANDARD</xsl:attribute>
84
- </xsl:if>
85
- <xsl:value-of select="translate($stage-fullname, $lower, $upper)"/>
86
- </item>
87
- </xsl:if>
88
- <item name="NWIP" show="true" header="PRELIMINARY WORK ITEM">NEW WORK ITEM PROPOSAL DRAFT</item>
89
- <item name="AWI" show="true" header="APPROVED WORK ITEM">APPROVED WORK ITEM</item>
90
- <item name="WD" show="true" header="WORKING DRAFT">WORKING DRAFT</item>
91
- <item name="CD" show="true" header="COMMITTEE DRAFT">COMMITTEE DRAFT</item>
92
- <item name="DIS" show="true" header="DRAFT INTERNATIONAL STANDARD">DRAFT</item>
93
- <item name="FDIS" show="true" header="FINAL DRAFT INTERNATIONAL STANDARD">FINAL DRAFT</item>
94
- <item name="IS">PROOF</item>
79
+ <xsl:variable name="stagename-header-firstpage">
80
+ <xsl:choose>
81
+ <!-- <xsl:when test="$stage-abbreviation = 'PWI' or
82
+ $stage-abbreviation = 'NWIP' or
83
+ $stage-abbreviation = 'NP'">PRELIMINARY WORK ITEM</xsl:when> -->
84
+ <xsl:when test="$stage-abbreviation = 'PRF'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
85
+ <xsl:otherwise>
86
+ <xsl:value-of select="$stage-fullname-uppercased"/>
87
+ </xsl:otherwise>
88
+ </xsl:choose>
95
89
  </xsl:variable>
96
90
 
91
+ <xsl:variable name="stagename-header-coverpage">
92
+ <xsl:choose>
93
+ <xsl:when test="$stage-abbreviation = 'DIS'">DRAFT</xsl:when>
94
+ <xsl:when test="$stage-abbreviation = 'FDIS'">FINAL DRAFT</xsl:when>
95
+ <xsl:when test="$stage-abbreviation = 'PRF'"/>
96
+ <xsl:when test="$stage-abbreviation = 'IS'"/>
97
+ <xsl:otherwise>
98
+ <xsl:value-of select="$stage-fullname-uppercased"/>
99
+ </xsl:otherwise>
100
+ </xsl:choose>
101
+ </xsl:variable>
102
+
103
+ <!-- UPPERCASED stage name -->
104
+ <!-- <item name="NWIP" show="true" header="PRELIMINARY WORK ITEM" shortname="NEW WORK ITEM PROPOSAL">NEW WORK ITEM PROPOSAL</item>
105
+ <item name="PWI" show="true" header="PRELIMINARY WORK ITEM" shortname="PRELIMINARY WORK ITEM">PRELIMINARY WORK ITEM</item>
106
+ <item name="NP" show="true" header="PRELIMINARY WORK ITEM" shortname="NEW WORK ITEM PROPOSAL">NEW WORK ITEM PROPOSAL</item>
107
+ <item name="AWI" show="true" header="APPROVED WORK ITEM" shortname="APPROVED WORK ITEM">APPROVED WORK ITEM</item>
108
+ <item name="WD" show="true" header="WORKING DRAFT" shortname="WORKING DRAFT">WORKING DRAFT</item>
109
+ <item name="CD" show="true" header="COMMITTEE DRAFT" shortname="COMMITTEE DRAFT">COMMITTEE DRAFT</item>
110
+ <item name="DIS" show="true" header="DRAFT INTERNATIONAL STANDARD" shortname="DRAFT">DRAFT INTERNATIONAL STANDARD</item>
111
+ <item name="FDIS" show="true" header="FINAL DRAFT INTERNATIONAL STANDARD" shortname="FINAL DRAFT">FINAL DRAFT INTERNATIONAL STANDARD</item>
112
+ <item name="PRF">PROOF</item> -->
113
+
114
+
97
115
  <!--
98
116
  <status>
99
117
  <stage>30</stage>
@@ -106,17 +124,24 @@
106
124
  <xsl:choose>
107
125
  <xsl:when test="string($stage) = 'NaN'">false</xsl:when>
108
126
  <xsl:when test="$stage &gt;=60">true</xsl:when>
109
- <xsl:when test="normalize-space($stage-name) != ''">true</xsl:when>
127
+ <xsl:when test="normalize-space($stage-abbreviation) != ''">true</xsl:when>
110
128
  <xsl:otherwise>false</xsl:otherwise>
111
129
  </xsl:choose>
112
130
  </xsl:variable>
113
131
 
114
132
  <xsl:variable name="document-master-reference">
115
133
  <xsl:choose>
116
- <xsl:when test="$stage-name != ''">-publishedISO</xsl:when>
134
+ <xsl:when test="$stage-abbreviation != ''">-publishedISO</xsl:when>
117
135
  <xsl:otherwise/>
118
136
  </xsl:choose>
119
137
  </xsl:variable>
138
+
139
+ <xsl:variable name="force-page-count-preface">
140
+ <xsl:choose>
141
+ <xsl:when test="$document-master-reference != ''">end-on-even</xsl:when>
142
+ <xsl:otherwise>no-force</xsl:otherwise>
143
+ </xsl:choose>
144
+ </xsl:variable>
120
145
 
121
146
  <xsl:variable name="proof-text">PROOF/ÉPREUVE</xsl:variable>
122
147
 
@@ -256,12 +281,22 @@
256
281
  <fo:region-start region-name="left-region" extent="12.5mm"/>
257
282
  <fo:region-end region-name="right-region" extent="25mm"/>
258
283
  </fo:simple-page-master>
284
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
285
+ <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
286
+ <fo:region-before region-name="header" extent="27.4mm"/>
287
+ <fo:region-after region-name="footer" extent="13mm"/>
288
+ <fo:region-start region-name="left" extent="12.5mm"/>
289
+ <fo:region-end region-name="right" extent="25mm"/>
290
+ </fo:simple-page-master>
259
291
  <fo:page-sequence-master master-name="preface-publishedISO">
260
292
  <fo:repeatable-page-master-alternatives>
293
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
261
294
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-publishedISO"/>
262
295
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-publishedISO"/>
263
296
  </fo:repeatable-page-master-alternatives>
264
297
  </fo:page-sequence-master>
298
+
299
+
265
300
  <fo:page-sequence-master master-name="document-publishedISO">
266
301
  <fo:repeatable-page-master-alternatives>
267
302
  <fo:conditional-page-master-reference master-reference="first-publishedISO" page-position="first"/>
@@ -310,7 +345,7 @@
310
345
 
311
346
  <!-- cover page -->
312
347
  <xsl:choose>
313
- <xsl:when test="$stage-name != ''">
348
+ <xsl:when test="$stage-abbreviation != ''">
314
349
  <fo:page-sequence master-reference="cover-page-publishedISO" force-page-count="no-force">
315
350
  <fo:static-content flow-name="cover-page-footer" font-size="10pt">
316
351
  <fo:table table-layout="fixed" width="100%">
@@ -322,12 +357,12 @@
322
357
  <fo:table-cell font-size="6.5pt" text-align="justify" display-align="after" padding-bottom="8mm"><!-- before -->
323
358
  <!-- margin-top="-30mm" -->
324
359
  <fo:block margin-top="-100mm">
325
- <xsl:if test="$stage-name = 'DIS' or $stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD'">
360
+ <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
326
361
  <fo:block margin-bottom="1.5mm">
327
362
  <xsl:text>THIS DOCUMENT IS A DRAFT CIRCULATED FOR COMMENT AND APPROVAL. IT IS THEREFORE SUBJECT TO CHANGE AND MAY NOT BE REFERRED TO AS AN INTERNATIONAL STANDARD UNTIL PUBLISHED AS SUCH.</xsl:text>
328
363
  </fo:block>
329
364
  </xsl:if>
330
- <xsl:if test="$stage-name = 'FDIS' or $stage-name = 'DIS' or $stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD'">
365
+ <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
331
366
  <fo:block margin-bottom="1.5mm">
332
367
  <xsl:text>RECIPIENTS OF THIS DRAFT ARE INVITED TO
333
368
  SUBMIT, WITH THEIR COMMENTS, NOTIFICATION
@@ -352,7 +387,7 @@
352
387
  <fo:block> </fo:block>
353
388
  </fo:table-cell>
354
389
  <fo:table-cell>
355
- <xsl:if test="$stage-name = 'DIS'">
390
+ <xsl:if test="$stage-abbreviation = 'DIS'">
356
391
  <fo:block-container margin-top="-15mm" margin-bottom="7mm" margin-left="1mm">
357
392
  <fo:block font-size="9pt" border="0.5pt solid black" fox:border-radius="5pt" padding-left="2mm" padding-top="2mm" padding-bottom="2mm">
358
393
  <xsl:text>This document is circulated as received from the committee secretariat.</xsl:text>
@@ -387,7 +422,9 @@
387
422
  <fo:table-cell display-align="center">
388
423
  <fo:block text-align="right">
389
424
  <fo:block>Reference number</fo:block>
390
- <fo:block><xsl:value-of select="$ISOname"/></fo:block>
425
+ <fo:block>
426
+ <xsl:value-of select="$ISOname"/>
427
+ </fo:block>
391
428
  <fo:block> </fo:block>
392
429
  <fo:block> </fo:block>
393
430
  <fo:block><fo:inline font-size="9pt">©</fo:inline><xsl:value-of select="concat(' ISO ', iso:iso-standard/iso:bibdata/iso:copyright/iso:from)"/></fo:block>
@@ -404,13 +441,12 @@
404
441
  </fo:static-content>
405
442
 
406
443
  <xsl:choose>
407
- <xsl:when test="$stage-name = 'DIS'">
444
+ <!-- COVER PAGE for DIS document only -->
445
+ <xsl:when test="$stage-abbreviation = 'DIS'">
408
446
  <fo:flow flow-name="xsl-region-body">
409
447
  <fo:block-container>
410
448
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
411
- <xsl:value-of select="xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()"/>
412
- <xsl:text> </xsl:text>
413
- <xsl:value-of select="$doctype_uppercased"/>
449
+ <xsl:value-of select="$stage-fullname-uppercased"/>
414
450
  </fo:block>
415
451
  <fo:block font-size="20pt" font-weight="bold" text-align="right">
416
452
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso']"/>
@@ -450,10 +486,24 @@
450
486
  <fo:block> </fo:block>
451
487
  </fo:table-cell>
452
488
  <fo:table-cell>
453
- <fo:block><fo:inline font-weight="bold">2018</fo:inline>-xx-xx</fo:block>
489
+ <fo:block font-weight="bold">
490
+ <xsl:choose>
491
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
492
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on"/>
493
+ </xsl:when>
494
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
495
+ </xsl:choose>
496
+ </fo:block>
454
497
  </fo:table-cell>
455
498
  <fo:table-cell>
456
- <fo:block><fo:inline font-weight="bold">2018</fo:inline>-xx-xx</fo:block>
499
+ <fo:block font-weight="bold">
500
+ <xsl:choose>
501
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
502
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on"/>
503
+ </xsl:when>
504
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
505
+ </xsl:choose>
506
+ </fo:block>
457
507
  </fo:table-cell>
458
508
  </fo:table-row>
459
509
  </fo:table-body>
@@ -502,7 +552,13 @@
502
552
  </xsl:if>
503
553
  </fo:block>
504
554
  </fo:block>
505
- <fo:block margin-top="10mm">ICS: xx.xxx.xx; xx.xxx.xx</fo:block>
555
+ <fo:block margin-top="10mm">
556
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
557
+ <xsl:if test="position() = 1"><fo:inline>ICS: </fo:inline></xsl:if>
558
+ <xsl:value-of select="."/>
559
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
560
+ </xsl:for-each>
561
+ </fo:block>
506
562
  </fo:block-container>
507
563
 
508
564
 
@@ -512,6 +568,7 @@
512
568
  </xsl:when>
513
569
  <xsl:otherwise>
514
570
 
571
+ <!-- COVER PAGE for all documents except DIS -->
515
572
  <fo:flow flow-name="xsl-region-body">
516
573
  <fo:block-container>
517
574
  <fo:table table-layout="fixed" width="100%" font-size="24pt" line-height="1"> <!-- margin-bottom="35mm" -->
@@ -522,9 +579,13 @@
522
579
  <fo:table-row>
523
580
  <fo:table-cell>
524
581
  <fo:block font-size="18pt">
525
- <xsl:variable name="stgname" select="xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()"/>
526
- <xsl:value-of select="translate($stgname, ' ', $linebreak)"/>
527
- <xsl:if test="number($iteration) = $iteration and ($stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD')"> <!-- not NaN -->
582
+
583
+ <xsl:value-of select="translate($stagename-header-coverpage, ' ', $linebreak)"/>
584
+
585
+ <!-- if there is iteration number, then print it -->
586
+ <xsl:variable name="iteration" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:iteration)"/>
587
+
588
+ <xsl:if test="number($iteration) = $iteration and ($stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD')">
528
589
  <xsl:text> </xsl:text><xsl:value-of select="$iteration"/>
529
590
  </xsl:if>
530
591
  <!-- <xsl:if test="$stage-name = 'draft'">DRAFT</xsl:if>
@@ -545,20 +606,19 @@
545
606
  <fo:table-row height="42mm">
546
607
  <fo:table-cell number-columns-spanned="3" font-size="10pt" line-height="1.2">
547
608
  <fo:block text-align="right">
548
- <xsl:variable name="edition" select="/iso:iso-standard/iso:bibdata/iso:edition"/>
549
- <xsl:if test="$stage-name = 'IS' or $stage-name = 'published'">
550
- <xsl:choose>
551
- <xsl:when test="$edition = 1">First</xsl:when>
552
- <xsl:when test="$edition = 2">Second</xsl:when>
553
- <xsl:when test="$edition = 3">Third</xsl:when>
554
- <xsl:otherwise><xsl:value-of select="$edition"/></xsl:otherwise>
555
- </xsl:choose>
556
- <xsl:text> edition</xsl:text>
557
- </xsl:if>
558
- <xsl:if test="$stage-name = 'published'">
559
- <xsl:value-of select="$linebreak"/>
560
- <xsl:value-of select="substring(/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date,1, 7)"/>
609
+ <xsl:if test="$stage-abbreviation = 'PRF' or $stage-abbreviation = 'IS' or $stage-abbreviation = 'published'">
610
+ <xsl:call-template name="printEdition"/>
561
611
  </xsl:if>
612
+ <xsl:choose>
613
+ <xsl:when test="$stage-abbreviation = 'IS'">
614
+ <xsl:value-of select="$linebreak"/>
615
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'published']"/>
616
+ </xsl:when>
617
+ <xsl:when test="$stage-abbreviation = 'published'">
618
+ <xsl:value-of select="$linebreak"/>
619
+ <xsl:value-of select="substring(/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date,1, 7)"/>
620
+ </xsl:when>
621
+ </xsl:choose>
562
622
  <!-- <xsl:value-of select="$linebreak"/>
563
623
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
564
624
  </fo:block>
@@ -576,16 +636,30 @@
576
636
  <fo:table-row> <!-- border="1pt solid black" height="150mm" -->
577
637
  <fo:table-cell font-size="11pt">
578
638
  <fo:block>
579
- <xsl:if test="$stage-name = 'FDIS'">
639
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
580
640
  <fo:block-container border="0.5mm solid black" width="51mm">
581
641
  <fo:block margin="2mm">
582
642
  <fo:block margin-bottom="8pt">ISO/TC <fo:inline font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee/@number"/></fo:inline></fo:block>
583
643
  <fo:block margin-bottom="6pt">Secretariat: <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/></fo:block>
584
644
  <fo:block margin-bottom="6pt">Voting begins on:<xsl:value-of select="$linebreak"/>
585
- <fo:inline font-weight="bold">2018</fo:inline>-xx-xx
645
+ <fo:inline font-weight="bold">
646
+ <xsl:choose>
647
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
648
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on"/>
649
+ </xsl:when>
650
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
651
+ </xsl:choose>
652
+ </fo:inline>
586
653
  </fo:block>
587
654
  <fo:block>Voting terminates on:<xsl:value-of select="$linebreak"/>
588
- <fo:inline font-weight="bold">2018</fo:inline>-xx-xx
655
+ <fo:inline font-weight="bold">
656
+ <xsl:choose>
657
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
658
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on"/>
659
+ </xsl:when>
660
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
661
+ </xsl:choose>
662
+ </fo:inline>
589
663
  </fo:block>
590
664
  </fo:block>
591
665
  </fo:block-container>
@@ -648,7 +722,7 @@
648
722
  </fo:block-container>
649
723
  <fo:block-container position="absolute" left="60mm" top="222mm" height="25mm" display-align="after">
650
724
  <fo:block>
651
- <xsl:if test="$stage-name = 'IS'">
725
+ <xsl:if test="$stage-abbreviation = 'PRF'">
652
726
  <fo:block font-size="39pt" font-weight="bold"><xsl:value-of select="$proof-text"/></fo:block>
653
727
  </xsl:if>
654
728
  </fo:block>
@@ -708,14 +782,7 @@
708
782
  <fo:table-row>
709
783
  <fo:table-cell number-columns-spanned="2" font-size="10pt" line-height="1.2">
710
784
  <fo:block text-align="right">
711
- <xsl:variable name="edition" select="/iso:iso-standard/iso:bibdata/iso:edition"/>
712
- <xsl:choose>
713
- <xsl:when test="$edition = 1">First</xsl:when>
714
- <xsl:when test="$edition = 2">Second</xsl:when>
715
- <xsl:when test="$edition = 3">Third</xsl:when>
716
- <xsl:otherwise><xsl:value-of select="$edition"/></xsl:otherwise>
717
- </xsl:choose>
718
- <xsl:text> edition</xsl:text>
785
+ <xsl:call-template name="printEdition"/>
719
786
  <xsl:value-of select="$linebreak"/>
720
787
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/></fo:block>
721
788
  </fo:table-cell>
@@ -835,12 +902,8 @@
835
902
 
836
903
  <fo:block margin-bottom="100pt">
837
904
  <xsl:text>Secretariat: </xsl:text>
838
- <xsl:choose>
839
- <xsl:when test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat">
840
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/>
841
- </xsl:when>
842
- <xsl:otherwise>XXXX</xsl:otherwise>
843
- </xsl:choose>
905
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/>
906
+ <xsl:text> </xsl:text>
844
907
  </fo:block>
845
908
 
846
909
 
@@ -909,7 +972,7 @@
909
972
  </xsl:otherwise>
910
973
  </xsl:choose>
911
974
 
912
- <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="no-force">
975
+ <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
913
976
  <xsl:call-template name="insertHeaderFooter">
914
977
  <xsl:with-param name="font-weight">normal</xsl:with-param>
915
978
  </xsl:call-template>
@@ -954,6 +1017,9 @@
954
1017
  <xsl:if test="@level = 1">
955
1018
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
956
1019
  </xsl:if>
1020
+ <xsl:if test="@level = 3">
1021
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1022
+ </xsl:if>
957
1023
  <fo:list-block>
958
1024
  <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
959
1025
  <xsl:if test="@level &gt;= 2">
@@ -1021,7 +1087,7 @@
1021
1087
  <xsl:value-of select="$title-en"/>
1022
1088
  </fo:block>
1023
1089
  -->
1024
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" margin-bottom="18pt">
1090
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1025
1091
  <fo:block>
1026
1092
  <xsl:if test="normalize-space($title-intro) != ''">
1027
1093
  <xsl:value-of select="$title-intro"/>
@@ -1033,7 +1099,7 @@
1033
1099
  <xsl:if test="normalize-space($title-part) != ''">
1034
1100
  <xsl:if test="$part != ''">
1035
1101
  <xsl:text> — </xsl:text>
1036
- <fo:block font-weight="normal" margin-top="12pt">
1102
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1037
1103
  <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1038
1104
  <xsl:text>:</xsl:text>
1039
1105
  </fo:block>
@@ -1054,13 +1120,13 @@
1054
1120
  <xsl:with-param name="sectionNum" select="'1'"/>
1055
1121
  </xsl:apply-templates>
1056
1122
 
1057
- <fo:block space-before="27pt"> </fo:block>
1123
+ <!-- <fo:block space-before="27pt">&#xA0;</fo:block> -->
1058
1124
  <!-- Normative references -->
1059
1125
  <xsl:apply-templates select="/iso:iso-standard/iso:bibliography/iso:references[1]">
1060
1126
  <xsl:with-param name="sectionNum" select="'2'"/>
1061
1127
  </xsl:apply-templates>
1062
1128
 
1063
- <fo:block space-before="18pt"> </fo:block>
1129
+ <!-- <fo:block space-before="18pt">&#xA0;</fo:block> -->
1064
1130
  <!-- main sections -->
1065
1131
  <xsl:apply-templates select="/iso:iso-standard/iso:sections/*[position() &gt; 1]">
1066
1132
  <xsl:with-param name="sectionNumSkew" select="'1'"/>
@@ -1093,7 +1159,7 @@
1093
1159
  </fo:table-cell>
1094
1160
  <fo:table-cell>
1095
1161
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
1096
- <xsl:if test="$stage-name = 'IS'">
1162
+ <xsl:if test="$stage-abbreviation = 'PRF'">
1097
1163
  <xsl:value-of select="$proof-text"/>
1098
1164
  </xsl:if>
1099
1165
  </fo:block>
@@ -1109,12 +1175,17 @@
1109
1175
  <fo:block-container height="252mm" display-align="after">
1110
1176
  <fo:block-container border-top="1mm double black">
1111
1177
  <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1112
- <xsl:choose>
1113
- <xsl:when test="$stage-name = 'FDIS'">ICS  01.140.30</xsl:when>
1114
- <xsl:when test="$stage-name = 'IS'">ICS  35.240.63</xsl:when>
1115
- <xsl:when test="$stage-name = 'published'">ICS  35.240.30</xsl:when>
1116
- <xsl:otherwise>ICS  67.060</xsl:otherwise>
1117
- </xsl:choose>
1178
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1179
+ <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1180
+ <xsl:value-of select="."/>
1181
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1182
+ </xsl:for-each> 
1183
+ <!-- <xsl:choose>
1184
+ <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1185
+ <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1186
+ <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1187
+ <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1188
+ </xsl:choose> -->
1118
1189
  </fo:block>
1119
1190
  <fo:block font-size="9pt">Price based on <fo:page-number-citation ref-id="lastBlock"/> pages</fo:block>
1120
1191
  </fo:block-container>
@@ -1263,8 +1334,6 @@
1263
1334
  </item>
1264
1335
  </xsl:template>
1265
1336
 
1266
-
1267
-
1268
1337
  <xsl:template match="iso:formula" mode="contents">
1269
1338
  <item level="" id="{@id}" display="false">
1270
1339
  <xsl:attribute name="section">
@@ -1272,6 +1341,46 @@
1272
1341
  </xsl:attribute>
1273
1342
  </item>
1274
1343
  </xsl:template>
1344
+
1345
+ <xsl:template match="iso:li" mode="contents">
1346
+ <xsl:param name="sectionNum"/>
1347
+ <item level="" id="{@id}" display="false" type="li">
1348
+ <xsl:attribute name="section">
1349
+ <xsl:call-template name="getListItemFormat"/>
1350
+ </xsl:attribute>
1351
+ <xsl:attribute name="parent_section">
1352
+ <xsl:for-each select="ancestor::*[not(local-name() = 'p' or local-name() = 'ol')][1]">
1353
+ <xsl:call-template name="getSection">
1354
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1355
+ </xsl:call-template>
1356
+ </xsl:for-each>
1357
+ </xsl:attribute>
1358
+ </item>
1359
+ <xsl:apply-templates mode="contents">
1360
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1361
+ </xsl:apply-templates>
1362
+ </xsl:template>
1363
+
1364
+ <xsl:template name="getListItemFormat">
1365
+ <xsl:choose>
1366
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1367
+ <xsl:otherwise> <!-- for ordered lists -->
1368
+ <xsl:choose>
1369
+ <xsl:when test="../@type = 'arabic'">
1370
+ <xsl:number format="a)"/>
1371
+ </xsl:when>
1372
+ <xsl:when test="../@type = 'alphabet'">
1373
+ <xsl:number format="a)"/>
1374
+ </xsl:when>
1375
+ <xsl:otherwise>
1376
+ <xsl:number format="1."/>
1377
+ </xsl:otherwise>
1378
+ </xsl:choose>
1379
+ </xsl:otherwise>
1380
+ </xsl:choose>
1381
+ </xsl:template>
1382
+
1383
+
1275
1384
  <!-- ============================= -->
1276
1385
  <!-- ============================= -->
1277
1386
 
@@ -1406,7 +1515,7 @@
1406
1515
  <xsl:variable name="font-size">
1407
1516
  <xsl:choose>
1408
1517
  <xsl:when test="ancestor::iso:annex and $level = 2">13pt</xsl:when>
1409
- <xsl:when test="ancestor::iso:annex and $level = 3">11pt</xsl:when>
1518
+ <xsl:when test="ancestor::iso:annex and $level = 3">12pt</xsl:when>
1410
1519
  <xsl:when test="ancestor::iso:preface">16pt</xsl:when>
1411
1520
  <xsl:when test="$level = 2">12pt</xsl:when>
1412
1521
  <xsl:when test="$level &gt;= 3">11pt</xsl:when>
@@ -1446,15 +1555,17 @@
1446
1555
  <xsl:attribute name="margin-top"> <!-- margin-top -->
1447
1556
  <xsl:choose>
1448
1557
  <xsl:when test="ancestor::iso:preface">8pt</xsl:when>
1449
- <xsl:when test="$level = 2 and ancestor::annex">18pt</xsl:when>
1450
- <xsl:when test="$level = '' or $level = 1">6pt</xsl:when><!-- 13.5pt -->
1558
+ <xsl:when test="$level = 2 and ancestor::iso:annex">18pt</xsl:when>
1559
+ <xsl:when test="$level = 1">18pt</xsl:when>
1560
+ <xsl:when test="$level = ''">6pt</xsl:when><!-- 13.5pt -->
1451
1561
  <xsl:otherwise>12pt</xsl:otherwise>
1452
1562
  </xsl:choose>
1453
1563
  </xsl:attribute>
1454
1564
  <xsl:attribute name="margin-bottom">
1455
1565
  <xsl:choose>
1456
1566
  <xsl:when test="ancestor::iso:preface">18pt</xsl:when>
1457
- <xsl:otherwise>12pt</xsl:otherwise>
1567
+ <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1568
+ <xsl:otherwise>8pt</xsl:otherwise>
1458
1569
  </xsl:choose>
1459
1570
  </xsl:attribute>
1460
1571
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -1506,10 +1617,12 @@
1506
1617
  <xsl:choose>
1507
1618
  <!-- <xsl:when test="ancestor::iso:preface">justify</xsl:when> -->
1508
1619
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1620
+ <xsl:when test="ancestor::iso:td/@align"><xsl:value-of select="ancestor::iso:td/@align"/></xsl:when>
1621
+ <xsl:when test="ancestor::iso:th/@align"><xsl:value-of select="ancestor::iso:th/@align"/></xsl:when>
1509
1622
  <xsl:otherwise>justify</xsl:otherwise><!-- left -->
1510
1623
  </xsl:choose>
1511
1624
  </xsl:attribute>
1512
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1625
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1513
1626
  <xsl:apply-templates/>
1514
1627
  </xsl:element>
1515
1628
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1525,33 +1638,70 @@
1525
1638
  </xsl:if>
1526
1639
  </xsl:template>
1527
1640
 
1641
+ <xsl:template match="iso:li//iso:p//text()">
1642
+ <xsl:choose>
1643
+ <xsl:when test="contains(., '&#9;')">
1644
+ <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1645
+ </xsl:when>
1646
+ <xsl:otherwise>
1647
+ <xsl:value-of select="."/>
1648
+ </xsl:otherwise>
1649
+ </xsl:choose>
1650
+
1651
+ </xsl:template>
1652
+
1528
1653
  <!--
1529
1654
  <fn reference="1">
1530
1655
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1531
1656
  </fn>
1532
1657
  -->
1658
+
1659
+ <xsl:variable name="p_fn">
1660
+ <xsl:for-each select="//iso:p/iso:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1661
+ <!-- copy unique fn -->
1662
+ <fn gen_id="{generate-id(.)}">
1663
+ <xsl:copy-of select="@*"/>
1664
+ <xsl:copy-of select="node()"/>
1665
+ </fn>
1666
+ </xsl:for-each>
1667
+ </xsl:variable>
1668
+
1533
1669
  <xsl:template match="iso:p/iso:fn" priority="2">
1534
- <fo:footnote>
1535
- <xsl:variable name="number">
1536
- <xsl:number level="any" count="iso:p/iso:fn"/>
1537
- </xsl:variable>
1538
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1539
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
1540
- <!-- <xsl:value-of select="@reference"/> -->
1541
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/><xsl:text>)</xsl:text>
1542
- </fo:basic-link>
1543
- </fo:inline>
1544
- <fo:footnote-body>
1545
- <fo:block font-size="10pt" margin-bottom="12pt">
1546
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1547
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/><xsl:text>)</xsl:text>
1670
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
1671
+ <xsl:variable name="reference" select="@reference"/>
1672
+ <xsl:variable name="number">
1673
+ <!-- <xsl:number level="any" count="iso:p/iso:fn"/> -->
1674
+ <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1675
+ </xsl:variable>
1676
+ <xsl:choose>
1677
+ <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1678
+ <fo:footnote>
1679
+ <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1680
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1681
+ <!-- <xsl:value-of select="@reference"/> -->
1682
+ <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@id='_normative_references']]/iso:note)"/><xsl:text>)</xsl:text>
1683
+ </fo:basic-link>
1548
1684
  </fo:inline>
1549
- <xsl:for-each select="iso:p">
1550
- <xsl:apply-templates/>
1551
- </xsl:for-each>
1552
- </fo:block>
1553
- </fo:footnote-body>
1554
- </fo:footnote>
1685
+ <fo:footnote-body>
1686
+ <fo:block font-size="10pt" margin-bottom="12pt">
1687
+ <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1688
+ <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@id='_normative_references']]/iso:note)"/><xsl:text>)</xsl:text>
1689
+ </fo:inline>
1690
+ <xsl:for-each select="iso:p">
1691
+ <xsl:apply-templates/>
1692
+ </xsl:for-each>
1693
+ </fo:block>
1694
+ </fo:footnote-body>
1695
+ </fo:footnote>
1696
+ </xsl:when>
1697
+ <xsl:otherwise>
1698
+ <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1699
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1700
+ <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/>
1701
+ </fo:basic-link>
1702
+ </fo:inline>
1703
+ </xsl:otherwise>
1704
+ </xsl:choose>
1555
1705
  </xsl:template>
1556
1706
 
1557
1707
  <xsl:template match="iso:p/iso:fn/iso:p">
@@ -1626,7 +1776,17 @@
1626
1776
 
1627
1777
  <xsl:template match="iso:figure/iso:image">
1628
1778
  <fo:block text-align="center">
1629
- <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1779
+ <xsl:variable name="src">
1780
+ <xsl:choose>
1781
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
1782
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
1783
+ </xsl:when>
1784
+ <xsl:otherwise>
1785
+ <xsl:value-of select="@src"/>
1786
+ </xsl:otherwise>
1787
+ </xsl:choose>
1788
+ </xsl:variable>
1789
+ <fo:external-graphic src="{$src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- src="{@src}" -->
1630
1790
  </fo:block>
1631
1791
  </xsl:template>
1632
1792
 
@@ -1661,14 +1821,14 @@
1661
1821
  <xsl:variable name="number">
1662
1822
  <xsl:number level="any" count="iso:bibitem/iso:note"/>
1663
1823
  </xsl:variable>
1664
- <fo:inline font-size="85%" keep-with-previous.within-line="always" vertical-align="super"> <!--60% -->
1824
+ <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1665
1825
  <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1666
1826
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1667
1827
  </fo:basic-link>
1668
1828
  </fo:inline>
1669
1829
  <fo:footnote-body>
1670
- <fo:block font-size="10pt" margin-bottom="12pt">
1671
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="9mm"><!-- font-size="60%" -->
1830
+ <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1831
+ <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1672
1832
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1673
1833
  </fo:inline>
1674
1834
  <xsl:apply-templates/>
@@ -1680,7 +1840,7 @@
1680
1840
 
1681
1841
 
1682
1842
  <xsl:template match="iso:ul | iso:ol">
1683
- <fo:list-block provisional-distance-between-starts="7mm">
1843
+ <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
1684
1844
  <xsl:apply-templates/>
1685
1845
  </fo:list-block>
1686
1846
  <xsl:for-each select="./iso:note//iso:p">
@@ -1694,22 +1854,7 @@
1694
1854
  <fo:list-item id="{@id}">
1695
1855
  <fo:list-item-label end-indent="label-end()">
1696
1856
  <fo:block>
1697
- <xsl:choose>
1698
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1699
- <xsl:otherwise> <!-- for ordered lists -->
1700
- <xsl:choose>
1701
- <xsl:when test="../@type = 'arabic'">
1702
- <xsl:number format="a)"/>
1703
- </xsl:when>
1704
- <xsl:when test="../@type = 'alphabet'">
1705
- <xsl:number format="a)"/>
1706
- </xsl:when>
1707
- <xsl:otherwise>
1708
- <xsl:number format="1."/>
1709
- </xsl:otherwise>
1710
- </xsl:choose>
1711
- </xsl:otherwise>
1712
- </xsl:choose>
1857
+ <xsl:call-template name="getListItemFormat"/>
1713
1858
  </fo:block>
1714
1859
  </fo:list-item-label>
1715
1860
  <fo:list-item-body start-indent="body-start()">
@@ -1719,19 +1864,13 @@
1719
1864
  </fo:list-item>
1720
1865
  </xsl:template>
1721
1866
 
1722
- <xsl:template match="iso:link">
1723
- <fo:inline>
1724
- <fo:basic-link external-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1725
- <xsl:choose>
1726
- <xsl:when test="normalize-space(.) = ''">
1727
- <xsl:value-of select="@target"/>
1728
- </xsl:when>
1729
- <xsl:otherwise>
1730
- <xsl:apply-templates/>
1731
- </xsl:otherwise>
1732
- </xsl:choose>
1733
- </fo:basic-link>
1734
- </fo:inline>
1867
+ <xsl:template match="iso:term">
1868
+ <xsl:param name="sectionNum"/>
1869
+ <fo:block margin-bottom="10pt">
1870
+ <xsl:apply-templates>
1871
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1872
+ </xsl:apply-templates>
1873
+ </fo:block>
1735
1874
  </xsl:template>
1736
1875
 
1737
1876
  <xsl:template match="iso:preferred">
@@ -1739,7 +1878,13 @@
1739
1878
  <fo:block line-height="1.1">
1740
1879
  <fo:block font-weight="bold" keep-with-next="always">
1741
1880
  <fo:inline id="{../@id}">
1742
- <xsl:value-of select="$sectionNum"/>.<xsl:number count="iso:term"/>
1881
+ <xsl:variable name="section">
1882
+ <xsl:call-template name="getSection">
1883
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1884
+ </xsl:call-template>
1885
+ </xsl:variable>
1886
+ <xsl:value-of select="$section"/>
1887
+ <!-- <xsl:value-of select="$sectionNum"/>.<xsl:number count="iso:term"/> -->
1743
1888
  </fo:inline>
1744
1889
  </fo:block>
1745
1890
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1773,14 +1918,17 @@
1773
1918
  </xsl:template>
1774
1919
 
1775
1920
  <xsl:template match="iso:termsource">
1776
- <fo:block margin-bottom="8pt" keep-with-previous="always">
1921
+ <fo:block margin-bottom="8pt"> <!-- keep-with-previous="always" -->
1777
1922
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1778
1923
  <fo:basic-link internal-destination="{iso:origin/@bibitemid}" fox:alt-text="{iso:origin/@citeas}">
1779
1924
  <xsl:text>[SOURCE: </xsl:text>
1780
1925
  <xsl:value-of select="iso:origin/@citeas"/>
1781
- <xsl:if test="iso:origin/iso:locality/iso:referenceFrom">
1926
+
1927
+ <xsl:apply-templates select="iso:origin/iso:localityStack"/>
1928
+
1929
+ <!-- <xsl:if test="iso:origin/iso:locality/iso:referenceFrom">
1782
1930
  <xsl:text>, </xsl:text><xsl:value-of select="iso:origin/iso:locality/iso:referenceFrom"/>
1783
- </xsl:if>
1931
+ </xsl:if> -->
1784
1932
  </fo:basic-link>
1785
1933
  <xsl:apply-templates select="iso:modification"/>
1786
1934
  <xsl:text>]</xsl:text>
@@ -1796,7 +1944,7 @@
1796
1944
  </xsl:template>
1797
1945
 
1798
1946
  <xsl:template match="iso:termnote">
1799
- <fo:block font-size="10pt" margin-bottom="12pt">
1947
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1800
1948
  <xsl:text>Note </xsl:text>
1801
1949
  <xsl:number/>
1802
1950
  <xsl:text> to entry: </xsl:text>
@@ -1806,6 +1954,10 @@
1806
1954
 
1807
1955
  <xsl:template match="iso:termnote/iso:p">
1808
1956
  <fo:inline><xsl:apply-templates/></fo:inline>
1957
+ <!-- <xsl:if test="following-sibling::* and not(following-sibling::iso:p)">
1958
+ <xsl:value-of select="$linebreak"/>
1959
+ <xsl:value-of select="$linebreak"/>
1960
+ </xsl:if> -->
1809
1961
  </xsl:template>
1810
1962
 
1811
1963
  <xsl:template match="iso:domain">
@@ -1814,8 +1966,13 @@
1814
1966
 
1815
1967
 
1816
1968
  <xsl:template match="iso:termexample">
1817
- <fo:block font-size="10pt" margin-bottom="12pt">
1818
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1969
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1970
+ <fo:inline padding-right="5mm">
1971
+ <xsl:text>EXAMPLE </xsl:text>
1972
+ <xsl:if test="count(ancestor::iso:term[1]//iso:termexample) &gt; 1">
1973
+ <xsl:number/>
1974
+ </xsl:if>
1975
+ </fo:inline>
1819
1976
  <xsl:apply-templates/>
1820
1977
  </fo:block>
1821
1978
  </xsl:template>
@@ -1855,9 +2012,11 @@
1855
2012
  <xsl:if test="iso:docidentifier">
1856
2013
  <xsl:choose>
1857
2014
  <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1858
- <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/>, </fo:inline></xsl:otherwise>
2015
+ <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/></fo:inline></xsl:otherwise>
1859
2016
  </xsl:choose>
1860
2017
  </xsl:if>
2018
+ <xsl:apply-templates select="iso:note"/>
2019
+ <xsl:if test="iso:docidentifier">, </xsl:if>
1861
2020
  <xsl:choose>
1862
2021
  <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1863
2022
  <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
@@ -1900,10 +2059,7 @@
1900
2059
  <xsl:template match="iso:source">
1901
2060
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1902
2061
  <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1903
- <xsl:if test="iso:locality">
1904
- <xsl:text>, </xsl:text>
1905
- <xsl:apply-templates select="iso:locality"/>
1906
- </xsl:if>
2062
+ <xsl:apply-templates select="iso:localityStack"/>
1907
2063
  </fo:basic-link>
1908
2064
  </xsl:template>
1909
2065
 
@@ -1916,10 +2072,14 @@
1916
2072
  </xsl:template>
1917
2073
 
1918
2074
  <xsl:template match="iso:appendix//iso:example">
1919
- <fo:block font-size="10pt" margin-bottom="12pt">
1920
- <xsl:text>EXAMPLE</xsl:text>
2075
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
2076
+ <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2077
+ <xsl:text>EXAMPLE </xsl:text>
2078
+ <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2079
+ <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
2080
+ </xsl:if>
1921
2081
  <xsl:if test="iso:name">
1922
- <xsl:text> </xsl:text><xsl:apply-templates select="iso:name" mode="process"/>
2082
+ <xsl:text>— </xsl:text><xsl:apply-templates select="iso:name" mode="process"/>
1923
2083
  </xsl:if>
1924
2084
  </fo:block>
1925
2085
  <xsl:apply-templates/>
@@ -1970,17 +2130,35 @@
1970
2130
  </xsl:template>
1971
2131
 
1972
2132
  <xsl:template match="iso:xref">
2133
+ <xsl:param name="sectionNum"/>
2134
+
1973
2135
  <xsl:variable name="target" select="normalize-space(@target)"/>
1974
2136
  <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
1975
2137
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = $target]/@section"/>
1976
- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))">
2138
+ <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
1977
2139
  <xsl:attribute name="color">blue</xsl:attribute>
1978
2140
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1979
- </xsl:if>
2141
+ <!-- </xsl:if> -->
1980
2142
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
1981
2143
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
2144
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
1982
2145
  <xsl:choose>
1983
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
2146
+ <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1">Clause </xsl:when><!-- and not (ancestor::annex) -->
2147
+ <xsl:when test="$type = 'li'">
2148
+ <xsl:attribute name="color">black</xsl:attribute>
2149
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
2150
+ <xsl:variable name="parent_section" select="xalan:nodeset($contents)//item[@id =$target]/@parent_section"/>
2151
+ <xsl:variable name="currentSection">
2152
+ <xsl:call-template name="getSection"/>
2153
+ </xsl:variable>
2154
+ <xsl:if test="not(contains($parent_section, $currentSection))">
2155
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2156
+ <xsl:attribute name="color">blue</xsl:attribute>
2157
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2158
+ <xsl:value-of select="$parent_section"/><xsl:text> </xsl:text>
2159
+ </fo:basic-link>
2160
+ </xsl:if>
2161
+ </xsl:when>
1984
2162
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1985
2163
  </xsl:choose>
1986
2164
  <xsl:value-of select="$section"/>
@@ -2000,20 +2178,35 @@
2000
2178
  </xsl:template>
2001
2179
 
2002
2180
  <xsl:template match="iso:example/iso:p">
2003
- <fo:block font-size="10pt">
2004
- <fo:inline padding-right="9mm">EXAMPLE</fo:inline>
2181
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
2182
+ <!-- <xsl:if test="ancestor::iso:li">
2183
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2184
+ </xsl:if> -->
2185
+ <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2186
+ <fo:inline padding-right="5mm">
2187
+ <xsl:text>EXAMPLE </xsl:text>
2188
+ <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2189
+ <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2190
+ </xsl:if>
2191
+ </fo:inline>
2005
2192
  <xsl:apply-templates/>
2006
2193
  </fo:block>
2007
2194
  </xsl:template>
2008
2195
 
2009
2196
  <xsl:template match="iso:note/iso:p" name="note">
2010
- <fo:block font-size="10pt" margin-bottom="12pt">
2011
- <fo:inline padding-right="6mm">NOTE</fo:inline>
2197
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="12pt" text-align="justify">
2198
+ <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2199
+ <fo:inline padding-right="6mm">
2200
+ <xsl:text>NOTE </xsl:text>
2201
+ <xsl:if test="count(ancestor::iso:clause[1]//iso:note) &gt; 1">
2202
+ <xsl:number count="iso:note[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2203
+ </xsl:if>
2204
+ </fo:inline>
2012
2205
  <xsl:apply-templates/>
2013
2206
  </fo:block>
2014
2207
  </xsl:template>
2015
2208
 
2016
- <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
2209
+ <!-- <eref type="inline" bibitemid="IEC60050-113" citeas="IEC 60050-113:2011"><localityStack><locality type="clause"><referenceFrom>113-01-12</referenceFrom></locality></localityStack></eref> -->
2017
2210
  <xsl:template match="iso:eref">
2018
2211
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
2019
2212
  <xsl:if test="@type = 'footnote'">
@@ -2022,30 +2215,32 @@
2022
2215
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2023
2216
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2024
2217
  </xsl:if>
2025
- <xsl:if test="@type = 'inline'">
2026
- <xsl:attribute name="color">blue</xsl:attribute>
2027
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2028
- </xsl:if>
2029
2218
  <!-- <xsl:if test="@type = 'inline'">
2219
+ <xsl:attribute name="color">blue</xsl:attribute>
2030
2220
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2031
2221
  </xsl:if> -->
2032
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2033
- <xsl:if test="iso:locality">
2034
- <xsl:text>, </xsl:text>
2035
- <!-- <xsl:choose>
2036
- <xsl:when test="iso:locality/@type = 'section'">Section </xsl:when>
2037
- <xsl:when test="iso:locality/@type = 'clause'">Clause </xsl:when>
2038
- <xsl:otherwise></xsl:otherwise>
2039
- </xsl:choose> -->
2040
- <xsl:apply-templates select="iso:locality"/>
2041
- </xsl:if>
2222
+
2223
+ <xsl:choose>
2224
+ <xsl:when test="@citeas and normalize-space(text()) = ''">
2225
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2226
+ </xsl:when>
2227
+ <xsl:when test="@bibitemid and normalize-space(text()) = ''">
2228
+ <xsl:value-of select="//iso:bibitem[@id = current()/@bibitemid]/iso:docidentifier"/>
2229
+ </xsl:when>
2230
+ <xsl:otherwise/>
2231
+ </xsl:choose>
2232
+ <xsl:apply-templates select="iso:localityStack"/>
2233
+ <xsl:apply-templates select="text()"/>
2042
2234
  </fo:basic-link>
2043
2235
  </xsl:template>
2044
2236
 
2045
2237
  <xsl:template match="iso:locality">
2046
2238
  <xsl:choose>
2239
+ <xsl:when test="ancestor::iso:termsource"/>
2240
+ <xsl:when test="@type ='clause' and ancestor::iso:eref"/>
2047
2241
  <xsl:when test="@type ='clause'">Clause </xsl:when>
2048
2242
  <xsl:when test="@type ='annex'">Annex </xsl:when>
2243
+ <xsl:when test="@type ='table'">Table </xsl:when>
2049
2244
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2050
2245
  </xsl:choose>
2051
2246
  <xsl:text> </xsl:text><xsl:value-of select="iso:referenceFrom"/>
@@ -2119,7 +2314,7 @@
2119
2314
  </fo:table-cell>
2120
2315
  <fo:table-cell display-align="center">
2121
2316
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
2122
- <xsl:if test="$stage-name = 'IS'">
2317
+ <xsl:if test="$stage-abbreviation = 'PRF'">
2123
2318
  <xsl:value-of select="$proof-text"/>
2124
2319
  </xsl:if>
2125
2320
  </fo:block>
@@ -2136,16 +2331,8 @@
2136
2331
  <fo:block-container margin-top="13mm" height="9mm" width="172mm" border-top="0.5mm solid black" border-bottom="0.5mm solid black" display-align="center" background-color="white">
2137
2332
  <fo:block text-align-last="justify" font-size="12pt" font-weight="bold">
2138
2333
 
2139
- <xsl:variable name="stgname" select="normalize-space(xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/@header)"/>
2140
- <xsl:if test="$stgname != ''">
2141
- <!-- <xsl:if test="$stage-name = 'final-draft' or $stage-name = 'draft'"> -->
2142
- <!-- <fo:inline><xsl:value-of select="translate(translate($stage-name,'-',' '), $lower,$upper)"/></fo:inline> -->
2143
- <fo:inline><xsl:value-of select="$stgname"/></fo:inline>
2144
- <!-- <xsl:text>&#xA0;</xsl:text> -->
2145
- </xsl:if>
2146
- <xsl:if test="$stgname = ''">
2147
- <fo:inline><xsl:value-of select="$doctype_uppercased"/></fo:inline>
2148
- </xsl:if>
2334
+ <xsl:value-of select="$stagename-header-firstpage"/>
2335
+
2149
2336
  <fo:inline keep-together.within-line="always">
2150
2337
  <fo:leader leader-pattern="space"/>
2151
2338
  <fo:inline><xsl:value-of select="$ISOname"/></fo:inline>
@@ -2171,7 +2358,7 @@
2171
2358
  </fo:table-cell>
2172
2359
  <fo:table-cell display-align="center">
2173
2360
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
2174
- <xsl:if test="$stage-name = 'IS'">
2361
+ <xsl:if test="$stage-abbreviation = 'PRF'">
2175
2362
  <xsl:value-of select="$proof-text"/>
2176
2363
  </xsl:if>
2177
2364
  </fo:block>
@@ -2244,7 +2431,7 @@
2244
2431
  </xsl:when>
2245
2432
  <xsl:when test="$level &gt;= 2">
2246
2433
  <xsl:variable name="num">
2247
- <xsl:number format=".1" level="multiple" count="iso:clause/iso:clause | iso:clause/iso:terms | iso:terms/iso:term | iso:clause/iso:term"/>
2434
+ <xsl:number format=".1" level="multiple" count="iso:clause/iso:clause | iso:clause/iso:terms | iso:terms/iso:term | iso:clause/iso:term | iso:terms/iso:clause | iso:terms/iso:definitions | iso:definitions/iso:clause | iso:clause/iso:definitions"/>
2248
2435
  </xsl:variable>
2249
2436
  <xsl:value-of select="concat($sectionNum, $num)"/>
2250
2437
  </xsl:when>
@@ -2265,12 +2452,13 @@
2265
2452
  </xsl:choose>
2266
2453
  </xsl:when> -->
2267
2454
  <xsl:when test="ancestor::iso:annex">
2455
+ <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2268
2456
  <xsl:choose>
2269
2457
  <xsl:when test="$level = 1">
2270
2458
  <xsl:text>Annex </xsl:text>
2271
2459
  <xsl:choose>
2272
- <xsl:when test="count(//iso:annex) = 1">
2273
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid"/>
2460
+ <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2461
+ <xsl:value-of select="$annexid"/>
2274
2462
  </xsl:when>
2275
2463
  <xsl:otherwise>
2276
2464
  <xsl:number format="A" level="any" count="iso:annex"/>
@@ -2278,9 +2466,10 @@
2278
2466
  </xsl:choose>
2279
2467
  </xsl:when>
2280
2468
  <xsl:otherwise>
2469
+ <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2281
2470
  <xsl:choose>
2282
- <xsl:when test="count(//iso:annex) = 1">
2283
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid"/><xsl:number format=".1" level="multiple" count="iso:clause"/>
2471
+ <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2472
+ <xsl:value-of select="$annexid"/><xsl:number format=".1" level="multiple" count="iso:clause"/>
2284
2473
  </xsl:when>
2285
2474
  <xsl:otherwise>
2286
2475
  <xsl:number format="A.1" level="multiple" count="iso:annex | iso:clause"/>
@@ -2896,11 +3085,116 @@
2896
3085
  ubYJPnswvSFSFVBu3ryZJ5fj+e+//wVuVmgt0lkFPgAAAABJRU5ErkJggg==
2897
3086
  </xsl:text>
2898
3087
  </xsl:variable>
2899
- <xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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()">
3088
+
3089
+ <xsl:template name="number-to-words">
3090
+ <xsl:param name="number"/>
3091
+ <xsl:variable name="words">
3092
+ <words>
3093
+ <word cardinal="1">One-</word>
3094
+ <word ordinal="1">First </word>
3095
+ <word cardinal="2">Two-</word>
3096
+ <word ordinal="2">Second </word>
3097
+ <word cardinal="3">Three-</word>
3098
+ <word ordinal="3">Third </word>
3099
+ <word cardinal="4">Four-</word>
3100
+ <word ordinal="4">Fourth </word>
3101
+ <word cardinal="5">Five-</word>
3102
+ <word ordinal="5">Fifth </word>
3103
+ <word cardinal="6">Six-</word>
3104
+ <word ordinal="6">Sixth </word>
3105
+ <word cardinal="7">Seven-</word>
3106
+ <word ordinal="7">Seventh </word>
3107
+ <word cardinal="8">Eight-</word>
3108
+ <word ordinal="8">Eighth </word>
3109
+ <word cardinal="9">Nine-</word>
3110
+ <word ordinal="9">Ninth </word>
3111
+ <word ordinal="10">Tenth </word>
3112
+ <word ordinal="11">Eleventh </word>
3113
+ <word ordinal="12">Twelfth </word>
3114
+ <word ordinal="13">Thirteenth </word>
3115
+ <word ordinal="14">Fourteenth </word>
3116
+ <word ordinal="15">Fifteenth </word>
3117
+ <word ordinal="16">Sixteenth </word>
3118
+ <word ordinal="17">Seventeenth </word>
3119
+ <word ordinal="18">Eighteenth </word>
3120
+ <word ordinal="19">Nineteenth </word>
3121
+ <word cardinal="20">Twenty-</word>
3122
+ <word ordinal="20">Twentieth </word>
3123
+ <word cardinal="30">Thirty-</word>
3124
+ <word ordinal="30">Thirtieth </word>
3125
+ <word cardinal="40">Forty-</word>
3126
+ <word ordinal="40">Fortieth </word>
3127
+ <word cardinal="50">Fifty-</word>
3128
+ <word ordinal="50">Fiftieth </word>
3129
+ <word cardinal="60">Sixty-</word>
3130
+ <word ordinal="60">Sixtieth </word>
3131
+ <word cardinal="70">Seventy-</word>
3132
+ <word ordinal="70">Seventieth </word>
3133
+ <word cardinal="80">Eighty-</word>
3134
+ <word ordinal="80">Eightieth </word>
3135
+ <word cardinal="90">Ninety-</word>
3136
+ <word ordinal="90">Ninetieth </word>
3137
+ <word cardinal="100">Hundred-</word>
3138
+ <word ordinal="100">Hundredth </word>
3139
+ </words>
3140
+ </xsl:variable>
3141
+
3142
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
3143
+
3144
+ <xsl:choose>
3145
+ <xsl:when test="$ordinal != ''">
3146
+ <xsl:value-of select="$ordinal"/>
3147
+ </xsl:when>
3148
+ <xsl:otherwise>
3149
+ <xsl:choose>
3150
+ <xsl:when test="$number &lt; 100">
3151
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
3152
+ <xsl:variable name="digit" select="substring($number,2)"/>
3153
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
3154
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
3155
+ </xsl:when>
3156
+ <xsl:otherwise>
3157
+ <!-- more 100 -->
3158
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
3159
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
3160
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
3161
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
3162
+ <xsl:call-template name="number-to-words">
3163
+ <xsl:with-param name="number" select="$digits"/>
3164
+ </xsl:call-template>
3165
+ </xsl:otherwise>
3166
+ </xsl:choose>
3167
+ </xsl:otherwise>
3168
+ </xsl:choose>
3169
+ </xsl:template>
3170
+
3171
+ <xsl:template name="printEdition">
3172
+ <xsl:variable name="edition" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:edition)"/>
3173
+ <xsl:text> </xsl:text>
3174
+ <xsl:choose>
3175
+ <xsl:when test="number($edition) = $edition">
3176
+ <xsl:call-template name="number-to-words">
3177
+ <xsl:with-param name="number" select="$edition"/>
3178
+ </xsl:call-template>
3179
+ </xsl:when>
3180
+ <xsl:when test="$edition != ''">
3181
+ <xsl:value-of select="$edition"/>
3182
+ </xsl:when>
3183
+ </xsl:choose>
3184
+ <xsl:if test="$edition != ''"><xsl:text> edition</xsl:text></xsl:if>
3185
+ </xsl:template>
3186
+
3187
+ <xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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">
3188
+
3189
+ <xsl:attribute name="color">blue</xsl:attribute>
3190
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3191
+
3192
+
3193
+ </xsl:attribute-set><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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()">
2900
3194
  <xsl:value-of select="."/>
2901
3195
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
2902
3196
  <xsl:value-of select="$linebreak"/>
2903
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1">
3197
+ </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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">
2904
3198
  <xsl:call-template name="add-zero-spaces"/>
2905
3199
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
2906
3200
 
@@ -2916,9 +3210,9 @@
2916
3210
 
2917
3211
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2918
3212
 
2919
-
2920
- <fo:block space-before="6pt"> </fo:block>
2921
-
3213
+ <!-- <xsl:if test="$namespace = 'iso'">
3214
+ <fo:block space-before="6pt">&#xA0;</fo:block>
3215
+ </xsl:if> -->
2922
3216
 
2923
3217
  <xsl:choose>
2924
3218
  <xsl:when test="@unnumbered = 'true'"/>
@@ -2928,6 +3222,10 @@
2928
3222
 
2929
3223
  <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2930
3224
 
3225
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3226
+
3227
+
3228
+
2931
3229
 
2932
3230
 
2933
3231
 
@@ -2939,7 +3237,10 @@
2939
3237
  </xsl:when>
2940
3238
  <xsl:when test="ancestor::*[local-name()='annex']">
2941
3239
 
2942
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
3240
+ <xsl:variable name="annex-id" select="ancestor::iso:annex/@id"/>
3241
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1" level="any" count="iso:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::iso:annex[@id = $annex-id]]"/>
3242
+
3243
+
2943
3244
 
2944
3245
 
2945
3246
 
@@ -2999,11 +3300,11 @@
2999
3300
  </xsl:call-template>
3000
3301
  </xsl:variable>
3001
3302
 
3002
- <xsl:variable name="colwidths2">
3303
+ <!-- <xsl:variable name="colwidths2">
3003
3304
  <xsl:call-template name="calculate-column-widths">
3004
3305
  <xsl:with-param name="cols-count" select="$cols-count"/>
3005
3306
  </xsl:call-template>
3006
- </xsl:variable>
3307
+ </xsl:variable> -->
3007
3308
 
3008
3309
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3009
3310
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -3023,13 +3324,22 @@
3023
3324
 
3024
3325
 
3025
3326
 
3026
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
3327
+
3328
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3329
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3330
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3331
+
3332
+ <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">
3027
3333
 
3028
3334
  <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
3029
3335
 
3030
3336
 
3031
3337
 
3032
3338
 
3339
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3340
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3341
+
3342
+
3033
3343
 
3034
3344
 
3035
3345
 
@@ -3049,6 +3359,9 @@
3049
3359
  </xsl:for-each>
3050
3360
  <xsl:apply-templates/>
3051
3361
  </fo:table>
3362
+
3363
+
3364
+
3052
3365
  </fo:block-container>
3053
3366
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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">
3054
3367
  <xsl:apply-templates/>
@@ -3102,9 +3415,13 @@
3102
3415
  </xsl:when>
3103
3416
  <xsl:otherwise>
3104
3417
  <xsl:for-each select="xalan:nodeset($table)//tr">
3418
+ <xsl:variable name="td_text">
3419
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3420
+ </xsl:variable>
3105
3421
  <xsl:variable name="words">
3106
3422
  <xsl:call-template name="tokenize">
3107
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
3423
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3424
+ <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
3108
3425
  </xsl:call-template>
3109
3426
  </xsl:variable>
3110
3427
  <xsl:variable name="max_length">
@@ -3145,60 +3462,84 @@
3145
3462
  <xsl:with-param name="table" select="$table"/>
3146
3463
  </xsl:call-template>
3147
3464
  </xsl:if>
3465
+ </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3466
+ <xsl:variable name="zero-space">​</xsl:variable>
3467
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3148
3468
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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">
3149
- <!-- <fo:table-header font-weight="bold">
3150
- <xsl:apply-templates />
3151
- </fo:table-header> -->
3152
- <xsl:apply-templates/>
3469
+ <!-- font-weight="bold" -->
3470
+ <fo:table-header>
3471
+ <xsl:apply-templates/>
3472
+ </fo:table-header>
3153
3473
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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">
3154
3474
  <xsl:apply-templates/>
3475
+ </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3476
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3477
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3478
+
3479
+ <fo:table-footer>
3480
+
3481
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3482
+
3483
+ <!-- if there are note(s) or fn(s) then create footer row -->
3484
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3485
+
3486
+ <xsl:variable name="cols-count">
3487
+ <xsl:choose>
3488
+ <xsl:when test="../*[local-name()='thead']">
3489
+ <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3490
+ <xsl:call-template name="calculate-columns-numbers">
3491
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3492
+ </xsl:call-template>
3493
+ </xsl:when>
3494
+ <xsl:otherwise>
3495
+ <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3496
+ <xsl:call-template name="calculate-columns-numbers">
3497
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3498
+ </xsl:call-template>
3499
+ </xsl:otherwise>
3500
+ </xsl:choose>
3501
+ </xsl:variable>
3502
+
3503
+ <fo:table-row>
3504
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3505
+
3506
+ <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3507
+
3508
+
3509
+
3510
+ <!-- fn will be processed inside 'note' processing -->
3511
+
3512
+
3513
+ <!-- except gb -->
3514
+
3515
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3516
+
3517
+
3518
+ <!-- horizontal row separator -->
3519
+
3520
+
3521
+ <!-- fn processing -->
3522
+ <xsl:call-template name="fn_display"/>
3523
+
3524
+ </fo:table-cell>
3525
+ </fo:table-row>
3526
+
3527
+ </xsl:if>
3528
+ </fo:table-footer>
3529
+
3530
+ </xsl:if>
3155
3531
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3156
- <xsl:variable name="cols-count">
3157
- <xsl:choose>
3158
- <xsl:when test="../*[local-name()='thead']">
3159
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3160
- <xsl:call-template name="calculate-columns-numbers">
3161
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3162
- </xsl:call-template>
3163
- </xsl:when>
3164
- <xsl:otherwise>
3165
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3166
- <xsl:call-template name="calculate-columns-numbers">
3167
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3168
- </xsl:call-template>
3169
- </xsl:otherwise>
3170
- </xsl:choose>
3171
- </xsl:variable>
3172
-
3532
+
3533
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3534
+
3535
+ <xsl:call-template name="insertTableFooter"/>
3536
+
3173
3537
  <fo:table-body>
3174
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3175
3538
  <xsl:apply-templates/>
3176
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3177
- <!-- if there are note(s) or fn(s) then create footer row -->
3178
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
3179
- <fo:table-row>
3180
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3181
-
3182
- <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3183
-
3184
-
3185
-
3186
- <!-- fn will be processed inside 'note' processing -->
3187
-
3188
-
3189
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3190
-
3191
- <!-- horizontal row separator -->
3192
-
3193
-
3194
- <!-- fn processing -->
3195
- <xsl:call-template name="fn_display"/>
3196
-
3197
- </fo:table-cell>
3198
- </fo:table-row>
3199
-
3200
- </xsl:if>
3539
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
3540
+
3201
3541
  </fo:table-body>
3542
+
3202
3543
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3203
3544
  <xsl:variable name="parent-name" select="local-name(..)"/>
3204
3545
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -3235,6 +3576,7 @@
3235
3576
 
3236
3577
  </xsl:if>
3237
3578
 
3579
+
3238
3580
  <xsl:apply-templates/>
3239
3581
  </fo:table-row>
3240
3582
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
@@ -3277,6 +3619,8 @@
3277
3619
 
3278
3620
 
3279
3621
 
3622
+
3623
+
3280
3624
  <xsl:if test="@colspan">
3281
3625
  <xsl:attribute name="number-columns-spanned">
3282
3626
  <xsl:value-of select="@colspan"/>
@@ -3312,11 +3656,18 @@
3312
3656
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3313
3657
 
3314
3658
 
3659
+
3315
3660
  <fo:inline padding-right="2mm">
3661
+
3316
3662
  <xsl:text>NOTE </xsl:text>
3317
3663
 
3664
+ <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3665
+ <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
3666
+ <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
3667
+ </xsl:if>
3668
+
3669
+
3318
3670
 
3319
- <xsl:number format="1 "/>
3320
3671
 
3321
3672
  </fo:inline>
3322
3673
  <xsl:apply-templates mode="process"/>
@@ -3343,6 +3694,7 @@
3343
3694
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3344
3695
 
3345
3696
 
3697
+
3346
3698
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3347
3699
 
3348
3700
 
@@ -3351,6 +3703,7 @@
3351
3703
 
3352
3704
 
3353
3705
 
3706
+
3354
3707
  <xsl:value-of select="@reference"/>
3355
3708
 
3356
3709
  </fo:inline>
@@ -3440,6 +3793,7 @@
3440
3793
 
3441
3794
 
3442
3795
 
3796
+
3443
3797
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3444
3798
 
3445
3799
  <xsl:value-of select="@reference"/>
@@ -3465,7 +3819,7 @@
3465
3819
  <fo:block margin-bottom="12pt" text-align="left">
3466
3820
 
3467
3821
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3468
-
3822
+
3469
3823
  <xsl:text>where </xsl:text>
3470
3824
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3471
3825
  <xsl:text/>
@@ -3480,6 +3834,7 @@
3480
3834
 
3481
3835
 
3482
3836
 
3837
+
3483
3838
  <xsl:text>where</xsl:text>
3484
3839
  </fo:block>
3485
3840
  </xsl:when>
@@ -3490,6 +3845,7 @@
3490
3845
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3491
3846
 
3492
3847
 
3848
+
3493
3849
  <xsl:text>Key</xsl:text>
3494
3850
  </fo:block>
3495
3851
  </xsl:when>
@@ -3502,12 +3858,13 @@
3502
3858
  <xsl:if test="$parent = 'formula'">
3503
3859
  <xsl:attribute name="margin-left">4mm</xsl:attribute>
3504
3860
  </xsl:if>
3505
-
3861
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3506
3862
 
3507
3863
 
3508
3864
 
3509
3865
  <fo:block>
3510
3866
 
3867
+
3511
3868
  <!-- create virtual html table for dl/[dt and dd] -->
3512
3869
  <xsl:variable name="html-table">
3513
3870
  <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
@@ -3527,6 +3884,7 @@
3527
3884
  <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3528
3885
 
3529
3886
  <fo:table width="95%" table-layout="fixed">
3887
+
3530
3888
  <xsl:choose>
3531
3889
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3532
3890
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -3626,6 +3984,9 @@
3626
3984
  <fo:table-cell>
3627
3985
  <fo:block margin-top="6pt">
3628
3986
 
3987
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
3988
+
3989
+
3629
3990
  <xsl:if test="normalize-space($key_iso) = 'true'">
3630
3991
  <xsl:attribute name="margin-top">0</xsl:attribute>
3631
3992
 
@@ -3633,6 +3994,7 @@
3633
3994
 
3634
3995
 
3635
3996
  <xsl:apply-templates/>
3997
+
3636
3998
  </fo:block>
3637
3999
  </fo:table-cell>
3638
4000
  <fo:table-cell>
@@ -3651,7 +4013,7 @@
3651
4013
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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:iec="https://www.metanorma.org/ns/iec" 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">
3652
4014
  <xsl:apply-templates/>
3653
4015
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3654
- <fo:inline><xsl:apply-templates/></fo:inline>
4016
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3655
4017
  </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3656
4018
  <fo:inline font-style="italic">
3657
4019
  <xsl:apply-templates/>
@@ -3766,6 +4128,7 @@
3766
4128
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3767
4129
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3768
4130
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4131
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3769
4132
  <xsl:variable name="zero-space">​</xsl:variable>
3770
4133
  <xsl:choose>
3771
4134
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -3800,6 +4163,14 @@
3800
4163
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3801
4164
  </xsl:call-template>
3802
4165
  </xsl:when>
4166
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
4167
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
4168
+ <xsl:value-of select="$zero-space-after-underscore"/>
4169
+ <xsl:value-of select="$zero-space"/>
4170
+ <xsl:call-template name="add-zero-spaces">
4171
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
4172
+ </xsl:call-template>
4173
+ </xsl:when>
3803
4174
  <xsl:otherwise>
3804
4175
  <xsl:value-of select="$text"/>
3805
4176
  </xsl:otherwise>
@@ -3976,4 +4347,40 @@
3976
4347
  <xsl:copy-of select="."/>
3977
4348
  </fo:instream-foreign-object>
3978
4349
  </fo:inline>
4350
+ </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
4351
+ <xsl:for-each select="*[local-name()='locality']">
4352
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4353
+ <xsl:apply-templates select="."/>
4354
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4355
+ </xsl:for-each>
4356
+ </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" 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">
4357
+ <xsl:variable name="target">
4358
+ <xsl:choose>
4359
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4360
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
4361
+ </xsl:when>
4362
+ <xsl:otherwise>
4363
+ <xsl:value-of select="normalize-space(@target)"/>
4364
+ </xsl:otherwise>
4365
+ </xsl:choose>
4366
+ </xsl:variable>
4367
+ <fo:inline xsl:use-attribute-sets="link-style">
4368
+ <xsl:choose>
4369
+ <xsl:when test="$target = ''">
4370
+ <xsl:apply-templates/>
4371
+ </xsl:when>
4372
+ <xsl:otherwise>
4373
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4374
+ <xsl:choose>
4375
+ <xsl:when test="normalize-space(.) = ''">
4376
+ <xsl:value-of select="$target"/>
4377
+ </xsl:when>
4378
+ <xsl:otherwise>
4379
+ <xsl:apply-templates/>
4380
+ </xsl:otherwise>
4381
+ </xsl:choose>
4382
+ </fo:basic-link>
4383
+ </xsl:otherwise>
4384
+ </xsl:choose>
4385
+ </fo:inline>
3979
4386
  </xsl:template></xsl:stylesheet>