metanorma-iso 1.9.2 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b67209d73be23ff04c3933a086c5e9de18463c17472b535305642a81df58820c
4
- data.tar.gz: e13a27804003551fd7da54476f27b61d98f7a23234a3e5eafc6900fe22265a8a
3
+ metadata.gz: ac1798683a3c7ca060a86feb2617005c4e642740a8d65c6221a65c1920799590
4
+ data.tar.gz: 6e3935f47c7d2b9458c0c0768c336477a32ff263e1f6cba0d57cdaad47151e60
5
5
  SHA512:
6
- metadata.gz: 73714b546a1f6a7680400be13c4672e33c38f897688409258085972dc593c0dd45c8327b4340c4d9b535c4f32d0c8b0ea4d58db1855659162b7b9a6eb26d9dca
7
- data.tar.gz: 3289bacc2f84c35c53f98e6950aafa0530189293340be023eff84a81b917c6287a7f9df48295bad57e617e0de610a54f14b5c8aff394680abfdb41d7e5f29a46
6
+ metadata.gz: c9619fe733adeddd4064d3531a6cdca00f1c841234729c24db198c88f24e7cce87ae9b4e847c7df5f52f0414b8392c3c581c88cb19f0a2ad2affc2f1693508f5
7
+ data.tar.gz: c745a76c0834e67c582649c7676d8fa140e1c5a89f20d67fea317e1fb37251a339155a17e980250e96f54d2da0b0e6d05bcd382743bd91b8979571ba030cec6b
@@ -137,10 +137,9 @@ module Asciidoctor
137
137
  xmldoc.xpath("//bibitem/note[@type = 'Unpublished-Status']").each do |n|
138
138
  id = n.parent["id"]
139
139
  e = xmldoc.at("//eref[@bibitemid = '#{id}']") or next
140
- e.next = n.dup
141
- e.next.name = "fn"
142
- e.next.delete("format")
143
- e.next.delete("type")
140
+ fn = n.children.to_xml
141
+ n&.elements&.first&.name == "p" or fn = "<p>#{fn}</p>"
142
+ e.next = "<fn>#{fn}</fn>"
144
143
  end
145
144
  end
146
145
 
@@ -193,12 +193,17 @@ module Asciidoctor
193
193
  end
194
194
 
195
195
  def get_stage(node)
196
- node.attr("status") || node.attr("docstage") || "60"
196
+ a = node.attr("status")
197
+ a = node.attr("docstage") if a.nil? || a.empty?
198
+ a = "60" if a.nil? || a.empty?
199
+ a
197
200
  end
198
201
 
199
202
  def get_substage(node)
200
203
  stage = get_stage(node)
201
- node.attr("docsubstage") || (stage == "60" ? "60" : "00")
204
+ ret = node.attr("docsubstage")
205
+ ret = (stage == "60" ? "60" : "00") if ret.nil? || ret.empty?
206
+ ret
202
207
  end
203
208
 
204
209
  def get_typeabbr(node, amd = false)
@@ -32,6 +32,18 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="section-title">
36
+ <element name="title">
37
+ <zeroOrMore>
38
+ <ref name="TextElement"/>
39
+ </zeroOrMore>
40
+ </element>
41
+ <zeroOrMore>
42
+ <element name="variant-title">
43
+ <ref name="TypedTitleString"/>
44
+ </element>
45
+ </zeroOrMore>
46
+ </define>
35
47
  <define name="hyperlink">
36
48
  <element name="link">
37
49
  <attribute name="target">
@@ -158,15 +170,17 @@
158
170
  <data type="boolean"/>
159
171
  </attribute>
160
172
  </optional>
161
- <attribute name="type">
162
- <choice>
163
- <value>roman</value>
164
- <value>alphabet</value>
165
- <value>arabic</value>
166
- <value>roman_upper</value>
167
- <value>alphabet_upper</value>
168
- </choice>
169
- </attribute>
173
+ <optional>
174
+ <attribute name="type">
175
+ <choice>
176
+ <value>roman</value>
177
+ <value>alphabet</value>
178
+ <value>arabic</value>
179
+ <value>roman_upper</value>
180
+ <value>alphabet_upper</value>
181
+ </choice>
182
+ </attribute>
183
+ </optional>
170
184
  <oneOrMore>
171
185
  <ref name="li"/>
172
186
  </oneOrMore>
@@ -184,6 +184,9 @@
184
184
  <zeroOrMore>
185
185
  <ref name="termsource"/>
186
186
  </zeroOrMore>
187
+ <zeroOrMore>
188
+ <ref name="term"/>
189
+ </zeroOrMore>
187
190
  </element>
188
191
  </define>
189
192
  <define name="annex">
@@ -15,7 +15,7 @@ module Asciidoctor
15
15
  end
16
16
 
17
17
  def appendix_parse(attrs, xml, node)
18
- attrs["inline-header".to_sym] = node.option? "inline-header"
18
+ attrs[:"inline-header"] = node.option? "inline-header"
19
19
  set_obligation(attrs, node)
20
20
  xml.appendix **attr_code(attrs) do |xml_section|
21
21
  xml_section.title { |name| name << node.title }
@@ -38,6 +38,12 @@ module Asciidoctor
38
38
 
39
39
  super
40
40
  end
41
+
42
+ def term_def_subclause_parse(attrs, xml, node)
43
+ node.role == "term" and
44
+ return term_def_subclause_parse1(attrs, xml, node)
45
+ super
46
+ end
41
47
  end
42
48
  end
43
49
  end
@@ -32,10 +32,10 @@ module Asciidoctor
32
32
  end
33
33
 
34
34
  ONE_SYMBOLS_WARNING = "Only one Symbols and Abbreviated "\
35
- "Terms section in the standard".freeze
35
+ "Terms section in the standard".freeze
36
36
 
37
37
  NON_DL_SYMBOLS_WARNING = "Symbols and Abbreviated Terms can "\
38
- "only contain a definition list".freeze
38
+ "only contain a definition list".freeze
39
39
 
40
40
  def symbols_validate(root)
41
41
  f = root.xpath("//definitions")
@@ -87,7 +87,7 @@ module Asciidoctor
87
87
  },
88
88
  {
89
89
  msg: "Normative References must be followed by "\
90
- "Terms and Definitions",
90
+ "Terms and Definitions",
91
91
  val: ["./self::terms | .//terms"],
92
92
  },
93
93
  ].freeze
@@ -127,17 +127,20 @@ module Asciidoctor
127
127
  end
128
128
  elem&.at("./self::clause") ||
129
129
  @log.add("Style", elem, "Document must contain clause after "\
130
- "Terms and Definitions")
130
+ "Terms and Definitions")
131
131
  elem&.at("./self::clause[@type = 'scope']") &&
132
- @log.add("Style", elem, "Scope must occur before Terms and Definitions")
132
+ @log.add("Style", elem,
133
+ "Scope must occur before Terms and Definitions")
133
134
  elem = names.shift
134
135
  while elem&.name == "clause"
135
136
  elem&.at("./self::clause[@type = 'scope']")
136
- @log.add("Style", elem, "Scope must occur before Terms and Definitions")
137
+ @log.add("Style", elem,
138
+ "Scope must occur before Terms and Definitions")
137
139
  elem = names.shift
138
140
  end
139
141
  %w(annex references).include? elem&.name or
140
- @log.add("Style", elem, "Only annexes and references can follow clauses")
142
+ @log.add("Style", elem,
143
+ "Only annexes and references can follow clauses")
141
144
  [names, elem]
142
145
  end
143
146
 
@@ -146,7 +149,8 @@ module Asciidoctor
146
149
  elem = names.shift
147
150
  end
148
151
  %w(annex references).include? elem&.name or
149
- @log.add("Style", elem, "Only annexes and references can follow terms and clauses")
152
+ @log.add("Style", elem,
153
+ "Only annexes and references can follow terms and clauses")
150
154
  [names, elem]
151
155
  end
152
156
 
@@ -155,25 +159,19 @@ module Asciidoctor
155
159
  elem = names.shift
156
160
  if elem.nil?
157
161
  @log.add("Style", nil, "Document must include (references) "\
158
- "Normative References")
162
+ "Normative References")
159
163
  end
160
164
  end
161
165
  elem&.at("./self::references[@normative = 'true']") ||
162
166
  @log.add("Style", nil, "Document must include (references) "\
163
- "Normative References")
167
+ "Normative References")
164
168
  elem = names&.shift
165
169
  elem&.at("./self::references[@normative = 'false']") ||
166
- @log.add("Style", elem, "Final section must be (references) Bibliography")
170
+ @log.add("Style", elem,
171
+ "Final section must be (references) Bibliography")
167
172
  names.empty? ||
168
- @log.add("Style", elem, "There are sections after the final Bibliography")
169
- end
170
-
171
- def style_warning(node, msg, text = nil)
172
- return if @novalid
173
-
174
- w = msg
175
- w += ": #{text}" if text
176
- @log.add("Style", node, w)
173
+ @log.add("Style", elem,
174
+ "There are sections after the final Bibliography")
177
175
  end
178
176
 
179
177
  NORM_ISO_WARN = "non-ISO/IEC reference not expected as normative".freeze
@@ -70,18 +70,18 @@ module Asciidoctor
70
70
  style(node, extract_text(node))
71
71
  end
72
72
 
73
- def style_regex(re, warning, n, text)
74
- (m = re.match(text)) && style_warning(n, warning, m[:num])
73
+ def style_regex(regex, warning, n, text)
74
+ (m = regex.match(text)) && style_warning(n, warning, m[:num])
75
75
  end
76
76
 
77
77
  # style check with a regex on a token
78
78
  # and a negative match on its preceding token
79
- def style_two_regex_not_prev(n, text, re, re_prev, warning)
79
+ def style_two_regex_not_prev(n, text, regex, re_prev, warning)
80
80
  return if text.nil?
81
81
 
82
82
  arr = Tokenizer::WhitespaceTokenizer.new.tokenize(text)
83
83
  arr.each_index do |i|
84
- m = re.match arr[i]
84
+ m = regex.match arr[i]
85
85
  m_prev = i.zero? ? nil : re_prev.match(arr[i - 1])
86
86
  if !m.nil? && m_prev.nil?
87
87
  style_warning(n, warning, m[:num])
@@ -132,22 +132,22 @@ module Asciidoctor
132
132
 
133
133
  # leaving out as problematic: N J K C S T H h d B o E
134
134
  SI_UNIT = "(m|cm|mm|km|μm|nm|g|kg|mgmol|cd|rad|sr|Hz|Hz|MHz|Pa|hPa|kJ|"\
135
- "V|kV|W|MW|kW|F|μF|Ω|Wb|°C|lm|lx|Bq|Gy|Sv|kat|l|t|eV|u|Np|Bd|"\
136
- "bit|kB|MB|Hart|nat|Sh|var)".freeze
135
+ "V|kV|W|MW|kW|F|μF|Ω|Wb|°C|lm|lx|Bq|Gy|Sv|kat|l|t|eV|u|Np|Bd|"\
136
+ "bit|kB|MB|Hart|nat|Sh|var)".freeze
137
137
 
138
138
  # ISO/IEC DIR 2, 9.3
139
139
  def style_units(node, text)
140
140
  style_regex(/\b(?<num>[0-9][0-9,]*\s+[\u00b0\u2032\u2033])/,
141
141
  "space between number and degrees/minutes/seconds",
142
142
  node, text)
143
- style_regex(/\b(?<num>[0-9][0-9,]*#{SI_UNIT})\b/,
143
+ style_regex(/\b(?<num>[0-9][0-9,]*#{SI_UNIT})\b/o,
144
144
  "no space between number and SI unit", node, text)
145
145
  style_non_std_units(node, text)
146
146
  end
147
147
 
148
148
  NONSTD_UNITS = {
149
- "sec": "s", "mins": "min", "hrs": "h", "hr": "h", "cc": "cm^3",
150
- "lit": "l", "amp": "A", "amps": "A", "rpm": "r/min"
149
+ sec: "s", mins: "min", hrs: "h", hr: "h", cc: "cm^3",
150
+ lit: "l", amp: "A", amps: "A", rpm: "r/min"
151
151
  }.freeze
152
152
 
153
153
  # ISO/IEC DIR 2, 9.3
@@ -157,6 +157,14 @@ module Asciidoctor
157
157
  "non-standard unit (should be #{v})", node, text)
158
158
  end
159
159
  end
160
+
161
+ def style_warning(node, msg, text = nil)
162
+ return if @novalid
163
+
164
+ w = msg
165
+ w += ": #{text}" if text
166
+ @log.add("Style", node, w)
167
+ end
160
168
  end
161
169
  end
162
170
  end
@@ -7,12 +7,13 @@ module IsoDoc
7
7
 
8
8
  def index(docxml)
9
9
  unless docxml.at(ns("//index"))
10
- docxml.xpath(ns("//indexsect")).each { |i| i.remove }
10
+ docxml.xpath(ns("//indexsect")).each(&:remove)
11
11
  return
12
12
  end
13
13
  i = docxml.at(ns("//indexsect")) ||
14
14
  docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}</title></indexsect>").first
15
- index = sort_indexterms(docxml.xpath(ns("//index")), docxml.xpath(ns("//index-xref[@also = 'false']")),
15
+ index = sort_indexterms(docxml.xpath(ns("//index")),
16
+ docxml.xpath(ns("//index-xref[@also = 'false']")),
16
17
  docxml.xpath(ns("//index-xref[@also = 'true']")))
17
18
  index1(docxml, i, index)
18
19
  end
@@ -20,10 +21,12 @@ module IsoDoc
20
21
  def index1(docxml, i, index)
21
22
  c = i.add_child("<ul></ul>").first
22
23
  index.keys.sort.each do |k|
23
- #c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
24
- words = index[k].keys.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
24
+ # c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
25
+ words = index[k].keys.each_with_object({}) do |w, v|
26
+ v[sortable(w).downcase] = w
27
+ end
25
28
  words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
26
- #c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
29
+ # c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
27
30
  c.add_child index_entries(words, index[k], w)
28
31
  end
29
32
  end
@@ -31,8 +34,8 @@ module IsoDoc
31
34
  @xrefs.bookmark_anchor_names(docxml)
32
35
  end
33
36
 
34
- def sortable(s)
35
- HTMLEntities.new.decode(Nokogiri::XML.fragment(s).text)
37
+ def sortable(str)
38
+ HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
36
39
  end
37
40
 
38
41
  def index_entries_opt
@@ -40,8 +43,12 @@ module IsoDoc
40
43
  end
41
44
 
42
45
  def index_entries(words, index, primary)
43
- ret = index_entries_head(words[primary], index.dig(words[primary], nil, nil), index_entries_opt)
44
- words2 = index[words[primary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
46
+ ret = index_entries_head(words[primary],
47
+ index.dig(words[primary], nil, nil),
48
+ index_entries_opt)
49
+ words2 = index[words[primary]]&.keys&.reject do |k|
50
+ k.nil?
51
+ end&.each_with_object({}) { |w, v| v[w.downcase] = w }
45
52
  unless words2.empty?
46
53
  ret += "<ul>"
47
54
  words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -53,12 +60,18 @@ module IsoDoc
53
60
  end
54
61
 
55
62
  def index_entries2(words, index, secondary)
56
- ret = index_entries_head(words[secondary], index.dig(words[secondary], nil), index_entries_opt)
57
- words3 = index[words[secondary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
63
+ ret = index_entries_head(words[secondary],
64
+ index.dig(words[secondary], nil),
65
+ index_entries_opt)
66
+ words3 = index[words[secondary]]&.keys&.reject do |k|
67
+ k.nil?
68
+ end&.each_with_object({}) { |w, v| v[w.downcase] = w }
58
69
  unless words3.empty?
59
70
  ret += "<ul>"
60
71
  words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
61
- ret += (index_entries_head(words3[w], index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
72
+ ret += (index_entries_head(words3[w],
73
+ index[words[secondary]][words3[w]],
74
+ index_entries_opt) + "</li>")
62
75
  end
63
76
  ret += "</ul>"
64
77
  end
@@ -68,10 +81,18 @@ module IsoDoc
68
81
  def index_entries_head(head, entries, opt)
69
82
  ret = "<li>#{head}"
70
83
  xref = entries&.dig(:xref)&.join(", ")
71
- see_sort = entries&.dig(:see)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
72
- see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| see_sort[k] }&.join(", ")
73
- also_sort = entries&.dig(:also)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
74
- also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| also_sort[k] }&.join(", ")
84
+ see_sort = entries&.dig(:see)&.each_with_object({}) do |w, v|
85
+ v[sortable(w).downcase] = w
86
+ end
87
+ see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
88
+ see_sort[k]
89
+ end&.join(", ")
90
+ also_sort = entries&.dig(:also)&.each_with_object({}) do |w, v|
91
+ v[sortable(w).downcase] = w
92
+ end
93
+ also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
94
+ also_sort[k]
95
+ end&.join(", ")
75
96
  ret += "#{opt[:xref_lbl]} #{xref}" if xref
76
97
  ret += "#{opt[:see_lbl]} #{see}" if see
77
98
  ret += "#{opt[:also_lbl]} #{also}" if also
@@ -96,8 +117,8 @@ module IsoDoc
96
117
  end
97
118
  end
98
119
 
99
- def extract_indexsee(v, terms, label)
100
- terms.each_with_object(v) do |t, v|
120
+ def extract_indexsee(val, terms, label)
121
+ terms.each_with_object(val) do |t, v|
101
122
  term = t&.at(ns("./primary"))&.children&.to_xml
102
123
  term2 = t&.at(ns("./secondary"))&.children&.to_xml
103
124
  term3 = t&.at(ns("./tertiary"))&.children&.to_xml
@@ -110,8 +131,11 @@ module IsoDoc
110
131
  end
111
132
  end
112
133
 
113
- def xml_encode_attr(s)
114
- HTMLEntities.new.encode(s, :basic, :hexadecimal).gsub(/\&#x([^;]+);/) { |x| "&#x#{$1.upcase};" }
134
+ def xml_encode_attr(str)
135
+ HTMLEntities.new.encode(str, :basic, :hexadecimal)
136
+ .gsub(/&#x([^;]+);/) do |_x|
137
+ "&#x#{$1.upcase};"
138
+ end
115
139
  end
116
140
 
117
141
  # attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
@@ -130,10 +154,10 @@ module IsoDoc
130
154
  end
131
155
  end
132
156
 
133
- def index2bookmark(t)
134
- t.name = "bookmark"
135
- t.children.each { |x| x.remove }
136
- t["id"] = "_#{UUIDTools::UUID.random_create}"
157
+ def index2bookmark(node)
158
+ node.name = "bookmark"
159
+ node.children.each(&:remove)
160
+ node["id"] = "_#{UUIDTools::UUID.random_create}"
137
161
  end
138
162
  end
139
163
  end
@@ -529,7 +529,7 @@
529
529
 
530
530
  <fo:block-container border-top="1mm double black" line-height="1.1" margin-top="3mm">
531
531
  <fo:block margin-right="5mm">
532
- <fo:block font-size="18pt" font-weight="bold" margin-top="6pt">
532
+ <fo:block font-size="18pt" font-weight="bold" margin-top="6pt" role="H1">
533
533
  <xsl:if test="normalize-space($title-intro) != ''">
534
534
  <xsl:value-of select="$title-intro"/>
535
535
  <xsl:text> — </xsl:text>
@@ -541,7 +541,7 @@
541
541
 
542
542
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
543
543
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
544
- <fo:block margin-top="12pt">
544
+ <fo:block margin-top="12pt" role="H1">
545
545
  <xsl:call-template name="printAmendmentTitle"/>
546
546
  </fo:block>
547
547
  </xsl:if>
@@ -549,7 +549,7 @@
549
549
  </fo:block>
550
550
 
551
551
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
552
- <fo:block font-size="11pt" font-style="italic" line-height="1.5">
552
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
553
553
 
554
554
  <xsl:if test="normalize-space($title-intro-fr) != ''">
555
555
  <xsl:value-of select="$title-intro-fr"/>
@@ -562,7 +562,7 @@
562
562
 
563
563
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
564
564
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
565
- <fo:block margin-top="6pt">
565
+ <fo:block margin-top="6pt" role="H1">
566
566
  <xsl:call-template name="printAmendmentTitle">
567
567
  <xsl:with-param name="lang" select="'fr'"/>
568
568
  </xsl:call-template>
@@ -654,7 +654,7 @@
654
654
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
655
655
  <xsl:if test="$doctype = 'amendment'">
656
656
  <fo:block text-align="right" margin-right="0.5mm">
657
- <fo:block font-weight="bold" margin-top="4pt">
657
+ <fo:block font-weight="bold" margin-top="4pt" role="H1">
658
658
  <xsl:variable name="title-amendment">
659
659
  <xsl:call-template name="getTitle">
660
660
  <xsl:with-param name="name" select="'title-amendment'"/>
@@ -724,7 +724,7 @@
724
724
  <fo:table-cell>
725
725
  <fo:block-container border-top="1mm double black" line-height="1.1">
726
726
  <fo:block margin-right="5mm">
727
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt">
727
+ <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
728
728
 
729
729
  <xsl:if test="normalize-space($title-intro) != ''">
730
730
  <xsl:value-of select="$title-intro"/>
@@ -746,14 +746,14 @@
746
746
  </xsl:if> -->
747
747
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
748
748
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
749
- <fo:block margin-right="-5mm" margin-top="12pt">
749
+ <fo:block margin-right="-5mm" margin-top="12pt" role="H1">
750
750
  <xsl:call-template name="printAmendmentTitle"/>
751
751
  </fo:block>
752
752
  </xsl:if>
753
753
  </fo:block>
754
754
 
755
755
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
756
- <fo:block font-size="11pt" font-style="italic" line-height="1.5">
756
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
757
757
 
758
758
  <xsl:if test="normalize-space($title-intro-fr) != ''">
759
759
  <xsl:value-of select="$title-intro-fr"/>
@@ -766,7 +766,7 @@
766
766
 
767
767
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
768
768
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
769
- <fo:block margin-right="-5mm" margin-top="6pt">
769
+ <fo:block margin-right="-5mm" margin-top="6pt" role="H1">
770
770
  <xsl:call-template name="printAmendmentTitle">
771
771
  <xsl:with-param name="lang" select="'fr'"/>
772
772
  </xsl:call-template>
@@ -857,7 +857,7 @@
857
857
 
858
858
  <fo:block-container border-top="1mm double black" line-height="1.1">
859
859
  <fo:block margin-right="40mm">
860
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt">
860
+ <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
861
861
 
862
862
  <xsl:if test="normalize-space($title-intro) != ''">
863
863
  <xsl:value-of select="$title-intro"/>
@@ -880,7 +880,7 @@
880
880
  </fo:block>
881
881
 
882
882
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
883
- <fo:block font-size="11pt" font-style="italic" line-height="1.5">
883
+ <fo:block font-size="11pt" font-style="italic" line-height="1.5" role="H1">
884
884
 
885
885
  <xsl:if test="normalize-space($title-intro-fr) != ''">
886
886
  <xsl:value-of select="$title-intro-fr"/>
@@ -972,7 +972,7 @@
972
972
  </fo:block-container>
973
973
  <fo:block-container font-size="16pt">
974
974
  <!-- Information and documentation — Codes for transcription systems -->
975
- <fo:block font-weight="bold">
975
+ <fo:block font-weight="bold" role="H1">
976
976
 
977
977
  <xsl:if test="normalize-space($title-intro) != ''">
978
978
  <xsl:value-of select="$title-intro"/>
@@ -995,7 +995,7 @@
995
995
  </fo:block>
996
996
 
997
997
  <fo:block font-size="12pt"><xsl:value-of select="$linebreak"/></fo:block>
998
- <fo:block>
998
+ <fo:block role="H1">
999
999
  <xsl:if test="normalize-space($title-intro-fr) != ''">
1000
1000
  <xsl:value-of select="$title-intro-fr"/>
1001
1001
  <xsl:text> — </xsl:text>
@@ -1073,79 +1073,80 @@
1073
1073
  <fo:block break-after="page"/>
1074
1074
  </xsl:if>
1075
1075
  <fo:block-container font-weight="bold">
1076
-
1077
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1078
- <fo:inline font-size="16pt" font-weight="bold">
1079
- <!-- Contents -->
1080
- <xsl:call-template name="getLocalizedString">
1081
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1082
- </xsl:call-template>
1083
- </fo:inline>
1084
- <fo:inline keep-together.within-line="always">
1085
- <fo:leader leader-pattern="space"/>
1086
- <fo:inline font-weight="normal" font-size="10pt">
1087
- <!-- Page -->
1076
+ <fo:block role="TOC">
1077
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1078
+ <fo:inline font-size="16pt" font-weight="bold" role="H1">
1079
+ <!-- Contents -->
1088
1080
  <xsl:call-template name="getLocalizedString">
1089
- <xsl:with-param name="key">locality.page</xsl:with-param>
1090
- </xsl:call-template>
1081
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1082
+ </xsl:call-template>
1091
1083
  </fo:inline>
1092
- </fo:inline>
1093
- </fo:block>
1094
-
1095
- <xsl:if test="$debug = 'true'">
1096
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1097
- DEBUG
1098
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
1099
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1100
- </xsl:if>
1101
-
1102
- <xsl:variable name="margin-left">12</xsl:variable>
1103
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1084
+ <fo:inline keep-together.within-line="always">
1085
+ <fo:leader leader-pattern="space"/>
1086
+ <fo:inline font-weight="normal" font-size="10pt">
1087
+ <!-- Page -->
1088
+ <xsl:call-template name="getLocalizedString">
1089
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1090
+ </xsl:call-template>
1091
+ </fo:inline>
1092
+ </fo:inline>
1093
+ </fo:block>
1104
1094
 
1105
- <fo:block>
1106
- <xsl:if test="@level = 1">
1107
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1108
- </xsl:if>
1109
- <xsl:if test="@level = 3">
1110
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1111
- </xsl:if>
1112
- <fo:list-block>
1113
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1114
- <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1115
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1095
+ <xsl:if test="$debug = 'true'">
1096
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1097
+ DEBUG
1098
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
1099
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1100
+ </xsl:if>
1101
+
1102
+ <xsl:variable name="margin-left">12</xsl:variable>
1103
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1104
+
1105
+ <fo:block role="TOCI">
1106
+ <xsl:if test="@level = 1">
1107
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
1116
1108
  </xsl:if>
1117
- <xsl:attribute name="provisional-distance-between-starts">
1118
- <xsl:choose>
1119
- <!-- skip 0 section without subsections -->
1120
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1121
- <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1122
- <xsl:otherwise>0mm</xsl:otherwise>
1123
- </xsl:choose>
1124
- </xsl:attribute>
1125
- <fo:list-item>
1126
- <fo:list-item-label end-indent="label-end()">
1127
- <fo:block>
1128
- <xsl:value-of select="@section"/>
1129
- </fo:block>
1130
- </fo:list-item-label>
1131
- <fo:list-item-body start-indent="body-start()">
1132
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1133
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1134
-
1135
- <xsl:apply-templates select="title"/>
1109
+ <xsl:if test="@level = 3">
1110
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1111
+ </xsl:if>
1112
+ <fo:list-block>
1113
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1114
+ <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1115
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1116
+ </xsl:if>
1117
+ <xsl:attribute name="provisional-distance-between-starts">
1118
+ <xsl:choose>
1119
+ <!-- skip 0 section without subsections -->
1120
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1121
+ <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1122
+ <xsl:otherwise>0mm</xsl:otherwise>
1123
+ </xsl:choose>
1124
+ </xsl:attribute>
1125
+ <fo:list-item>
1126
+ <fo:list-item-label end-indent="label-end()">
1127
+ <fo:block>
1128
+ <xsl:value-of select="@section"/>
1129
+ </fo:block>
1130
+ </fo:list-item-label>
1131
+ <fo:list-item-body start-indent="body-start()">
1132
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1133
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1136
1134
 
1137
- <fo:inline keep-together.within-line="always">
1138
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1139
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1140
- </fo:inline>
1141
- </fo:basic-link>
1142
- </fo:block>
1143
- </fo:list-item-body>
1144
- </fo:list-item>
1145
- </fo:list-block>
1146
- </fo:block>
1147
-
1148
- </xsl:for-each>
1135
+ <xsl:apply-templates select="title"/>
1136
+
1137
+ <fo:inline keep-together.within-line="always">
1138
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1139
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1140
+ </fo:inline>
1141
+ </fo:basic-link>
1142
+ </fo:block>
1143
+ </fo:list-item-body>
1144
+ </fo:list-item>
1145
+ </fo:list-block>
1146
+ </fo:block>
1147
+
1148
+ </xsl:for-each>
1149
+ </fo:block>
1149
1150
  </fo:block-container>
1150
1151
  </xsl:otherwise>
1151
1152
  </xsl:choose>
@@ -1179,7 +1180,7 @@
1179
1180
 
1180
1181
  <xsl:variable name="title-intro-doc-lang" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1181
1182
 
1182
- <fo:block>
1183
+ <fo:block role="H1">
1183
1184
  <xsl:if test="normalize-space($title-intro-doc-lang) != ''">
1184
1185
  <xsl:value-of select="$title-intro-doc-lang"/>
1185
1186
  <xsl:text> — </xsl:text>
@@ -1201,13 +1202,13 @@
1201
1202
  </xsl:if>
1202
1203
  </xsl:if>
1203
1204
  </fo:block>
1204
- <fo:block>
1205
+ <fo:block role="H1">
1205
1206
  <xsl:value-of select="$title-part-doc-lang"/>
1206
1207
  </fo:block>
1207
1208
 
1208
1209
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1209
1210
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1210
- <fo:block margin-top="12pt">
1211
+ <fo:block margin-top="12pt" role="H1">
1211
1212
  <xsl:call-template name="printAmendmentTitle"/>
1212
1213
  </fo:block>
1213
1214
  </xsl:if>
@@ -1454,7 +1455,10 @@
1454
1455
 
1455
1456
 
1456
1457
  <xsl:template match="iso:license-statement//iso:title">
1457
- <fo:block text-align="center" font-weight="bold">
1458
+ <xsl:variable name="level">
1459
+ <xsl:call-template name="getLevel"/>
1460
+ </xsl:variable>
1461
+ <fo:block text-align="center" font-weight="bold" role="H{$level}">
1458
1462
  <xsl:apply-templates/>
1459
1463
  </fo:block>
1460
1464
  </xsl:template>
@@ -1482,7 +1486,7 @@
1482
1486
  </fo:block> -->
1483
1487
 
1484
1488
  <xsl:template match="iso:copyright-statement/iso:clause[1]/iso:title">
1485
- <fo:block margin-bottom="3mm">
1489
+ <fo:block margin-bottom="3mm" role="H1">
1486
1490
  <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Attention))}" width="14mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1487
1491
  <!-- <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold">COPYRIGHT PROTECTED DOCUMENT</fo:inline> -->
1488
1492
  <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold"><xsl:apply-templates/></fo:inline>
@@ -1519,8 +1523,9 @@
1519
1523
  <xsl:call-template name="titleAmendment"/>
1520
1524
  </xsl:when>
1521
1525
  <xsl:otherwise>
1522
- <fo:block font-size="16pt" text-align="center" margin-bottom="48pt" keep-with-next="always">
1526
+ <fo:block font-size="16pt" text-align="center" margin-bottom="48pt" keep-with-next="always" role="H1">
1523
1527
  <xsl:apply-templates/>
1528
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
1524
1529
  </fo:block>
1525
1530
  </xsl:otherwise>
1526
1531
  </xsl:choose>
@@ -1533,7 +1538,7 @@
1533
1538
  <xsl:call-template name="titleAmendment"/>
1534
1539
  </xsl:when>
1535
1540
  <xsl:otherwise>
1536
- <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always">
1541
+ <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always" role="H1">
1537
1542
  <xsl:apply-templates/>
1538
1543
  </fo:block>
1539
1544
  </xsl:otherwise>
@@ -1566,8 +1571,9 @@
1566
1571
 
1567
1572
  <xsl:choose>
1568
1573
  <xsl:when test="$doctype = 'amendment' and not(ancestor::iso:preface)">
1569
- <fo:block font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
1574
+ <fo:block font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always" role="H{$level}">
1570
1575
  <xsl:apply-templates/>
1576
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
1571
1577
  </fo:block>
1572
1578
  </xsl:when>
1573
1579
 
@@ -1593,6 +1599,7 @@
1593
1599
  </xsl:choose>
1594
1600
  </xsl:attribute>
1595
1601
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1602
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
1596
1603
  <xsl:if test="$element-name = 'fo:inline'">
1597
1604
  <xsl:choose>
1598
1605
  <xsl:when test="$lang = 'zh'">
@@ -1604,6 +1611,7 @@
1604
1611
  </xsl:choose>
1605
1612
  </xsl:if>
1606
1613
  <xsl:apply-templates/>
1614
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
1607
1615
  </xsl:element>
1608
1616
 
1609
1617
  <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::iso:p)">
@@ -1784,8 +1792,11 @@
1784
1792
  <xsl:apply-templates select="."/>
1785
1793
  </xsl:template>
1786
1794
 
1787
- <xsl:template match="iso:preferred">
1788
- <fo:block line-height="1.1">
1795
+ <xsl:template match="iso:preferred">
1796
+ <xsl:variable name="levelTerm">
1797
+ <xsl:call-template name="getLevelTermName"/>
1798
+ </xsl:variable>
1799
+ <fo:block line-height="1.1" role="H{$levelTerm}">
1789
1800
  <fo:block font-weight="bold" keep-with-next="always">
1790
1801
  <xsl:apply-templates select="ancestor::iso:term/iso:name" mode="presentation"/>
1791
1802
  </fo:block>
@@ -1949,7 +1960,7 @@
1949
1960
  <fo:block id="{@id}" span="all">
1950
1961
  <xsl:apply-templates select="iso:title"/>
1951
1962
  </fo:block>
1952
- <fo:block>
1963
+ <fo:block role="Index">
1953
1964
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1954
1965
  </fo:block>
1955
1966
  </fo:flow>
@@ -1958,7 +1969,7 @@
1958
1969
 
1959
1970
  <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
1960
1971
  <xsl:template match="iso:indexsect/iso:title" priority="4">
1961
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
1972
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" role="H1">
1962
1973
  <!-- Index -->
1963
1974
  <xsl:apply-templates/>
1964
1975
  </fo:block>
@@ -2003,7 +2014,7 @@
2003
2014
  <xsl:template name="insertHeaderFooter">
2004
2015
  <xsl:param name="font-weight" select="'bold'"/>
2005
2016
  <xsl:call-template name="insertHeaderEven"/>
2006
- <fo:static-content flow-name="footer-even">
2017
+ <fo:static-content flow-name="footer-even" role="artifact">
2007
2018
  <fo:block-container> <!-- display-align="after" -->
2008
2019
  <fo:table table-layout="fixed" width="100%">
2009
2020
  <fo:table-column column-width="33%"/>
@@ -2042,12 +2053,12 @@
2042
2053
  </fo:block>
2043
2054
  </fo:block-container>
2044
2055
  </fo:static-content>
2045
- <fo:static-content flow-name="header-odd">
2056
+ <fo:static-content flow-name="header-odd" role="artifact">
2046
2057
  <fo:block-container height="24mm" display-align="before">
2047
2058
  <fo:block font-size="12pt" font-weight="bold" text-align="right" padding-top="12.5mm"><xsl:value-of select="$ISOname"/></fo:block>
2048
2059
  </fo:block-container>
2049
2060
  </fo:static-content>
2050
- <fo:static-content flow-name="footer-odd">
2061
+ <fo:static-content flow-name="footer-odd" role="artifact">
2051
2062
  <fo:block-container> <!-- display-align="after" -->
2052
2063
  <fo:table table-layout="fixed" width="100%">
2053
2064
  <fo:table-column column-width="33%"/>
@@ -2075,7 +2086,7 @@
2075
2086
  </fo:static-content>
2076
2087
  </xsl:template>
2077
2088
  <xsl:template name="insertHeaderEven">
2078
- <fo:static-content flow-name="header-even">
2089
+ <fo:static-content flow-name="header-even" role="artifact">
2079
2090
  <fo:block-container height="24mm" display-align="before">
2080
2091
  <fo:block font-size="12pt" font-weight="bold" padding-top="12.5mm"><xsl:value-of select="$ISOname"/></fo:block>
2081
2092
  </fo:block-container>
@@ -2326,6 +2337,7 @@
2326
2337
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2327
2338
  <xsl:attribute name="white-space">pre</xsl:attribute>
2328
2339
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
2340
+ <xsl:attribute name="role">Code</xsl:attribute>
2329
2341
 
2330
2342
  <xsl:attribute name="font-family">Courier New</xsl:attribute>
2331
2343
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2350,8 +2362,13 @@
2350
2362
 
2351
2363
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
2352
2364
 
2353
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
2354
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
2365
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
2366
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
2367
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
2368
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
2369
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
2370
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
2371
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
2355
2372
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
2356
2373
 
2357
2374
 
@@ -2576,7 +2593,8 @@
2576
2593
 
2577
2594
 
2578
2595
 
2579
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
2596
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
2597
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
2580
2598
 
2581
2599
 
2582
2600
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -2778,7 +2796,9 @@
2778
2796
  <!-- Display table's name before table as standalone block -->
2779
2797
  <!-- $namespace = 'iso' or -->
2780
2798
 
2781
-
2799
+
2800
+
2801
+
2782
2802
 
2783
2803
 
2784
2804
 
@@ -4765,12 +4785,43 @@
4765
4785
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4766
4786
  </xsl:call-template>
4767
4787
 
4788
+
4789
+
4768
4790
  <xsl:variable name="mathml">
4769
4791
  <xsl:apply-templates select="." mode="mathml"/>
4770
4792
  </xsl:variable>
4771
4793
  <fo:instream-foreign-object fox:alt-text="Math">
4772
4794
 
4773
4795
 
4796
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4797
+ <xsl:variable name="comment_text_">
4798
+ <xsl:choose>
4799
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4800
+ <xsl:value-of select="$comment_text_following"/>
4801
+ </xsl:when>
4802
+ <xsl:otherwise>
4803
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4804
+ </xsl:otherwise>
4805
+ </xsl:choose>
4806
+ </xsl:variable>
4807
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4808
+
4809
+ <xsl:if test="normalize-space($comment_text) != ''">
4810
+ <!-- put Mathin Alternate Text -->
4811
+ <xsl:attribute name="fox:alt-text">
4812
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4813
+ </xsl:attribute>
4814
+ </xsl:if>
4815
+
4816
+ <xsl:variable name="mathml_content">
4817
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4818
+ </xsl:variable>
4819
+ <!-- put MathML in Actual Text -->
4820
+ <xsl:attribute name="fox:actual-text">
4821
+ <xsl:value-of select="$mathml_content"/>
4822
+ </xsl:attribute>
4823
+
4824
+
4774
4825
  <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
4775
4826
  <xsl:attribute name="width">95%</xsl:attribute>
4776
4827
  <xsl:attribute name="content-height">100%</xsl:attribute>
@@ -4782,6 +4833,27 @@
4782
4833
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4783
4834
  </fo:instream-foreign-object>
4784
4835
  </fo:inline>
4836
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4837
+ <!-- <xsl:text>a+b</xsl:text> -->
4838
+ <xsl:text>&lt;</xsl:text>
4839
+ <xsl:value-of select="local-name()"/>
4840
+ <xsl:if test="local-name() = 'math'">
4841
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
4842
+ </xsl:if>
4843
+ <xsl:for-each select="@*">
4844
+ <xsl:text> </xsl:text>
4845
+ <xsl:value-of select="local-name()"/>
4846
+ <xsl:text>="</xsl:text>
4847
+ <xsl:value-of select="."/>
4848
+ <xsl:text>"</xsl:text>
4849
+ </xsl:for-each>
4850
+ <xsl:text>&gt;</xsl:text>
4851
+ <xsl:apply-templates mode="mathml_actual_text"/>
4852
+ <xsl:text>&lt;/</xsl:text>
4853
+ <xsl:value-of select="local-name()"/>
4854
+ <xsl:text>&gt;</xsl:text>
4855
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
4856
+ <xsl:value-of select="normalize-space()"/>
4785
4857
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
4786
4858
  <xsl:copy>
4787
4859
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -4843,7 +4915,10 @@
4843
4915
  </fo:block>
4844
4916
  <xsl:apply-templates/>
4845
4917
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4846
- <fo:inline><xsl:apply-templates/></fo:inline>
4918
+ <xsl:variable name="level">
4919
+ <xsl:call-template name="getLevel"/>
4920
+ </xsl:variable>
4921
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4847
4922
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4848
4923
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4849
4924
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4878,9 +4953,10 @@
4878
4953
 
4879
4954
  </xsl:variable>
4880
4955
 
4956
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4881
4957
  <xsl:choose>
4882
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4883
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4958
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4959
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4884
4960
  </xsl:choose>
4885
4961
  <xsl:apply-templates/>
4886
4962
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -5026,7 +5102,10 @@
5026
5102
  </fo:block>
5027
5103
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
5028
5104
  <xsl:if test="normalize-space() != ''">
5029
- <fo:inline>
5105
+ <xsl:variable name="level">
5106
+ <xsl:call-template name="getLevelTermName"/>
5107
+ </xsl:variable>
5108
+ <fo:inline role="H{$level}">
5030
5109
  <xsl:apply-templates/>
5031
5110
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
5032
5111
  <xsl:text>.</xsl:text>
@@ -5657,6 +5736,7 @@
5657
5736
  </xsl:when>
5658
5737
  <xsl:otherwise>
5659
5738
  <xsl:apply-templates/>
5739
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
5660
5740
  </xsl:otherwise>
5661
5741
  </xsl:choose>
5662
5742
  </fo:block>
@@ -5797,14 +5877,6 @@
5797
5877
  <fo:block>
5798
5878
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
5799
5879
  </fo:block>
5800
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5801
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
5802
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5803
- </fo:block>
5804
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
5805
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
5806
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5807
- </fo:block>
5808
5880
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
5809
5881
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
5810
5882
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -5821,6 +5893,38 @@
5821
5893
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
5822
5894
  <xsl:apply-templates/>
5823
5895
  </fo:block>
5896
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5897
+ <fo:block xsl:use-attribute-sets="subject-style">
5898
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5899
+ </fo:block>
5900
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
5901
+ <fo:block xsl:use-attribute-sets="subject-style">
5902
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5903
+ </fo:block>
5904
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
5905
+ <fo:block xsl:use-attribute-sets="inherit-style">
5906
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5907
+ </fo:block>
5908
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
5909
+ <fo:block xsl:use-attribute-sets="description-style">
5910
+ <xsl:apply-templates/>
5911
+ </fo:block>
5912
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
5913
+ <fo:block xsl:use-attribute-sets="specification-style">
5914
+ <xsl:apply-templates/>
5915
+ </fo:block>
5916
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
5917
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
5918
+ <xsl:apply-templates/>
5919
+ </fo:block>
5920
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
5921
+ <fo:block xsl:use-attribute-sets="verification-style">
5922
+ <xsl:apply-templates/>
5923
+ </fo:block>
5924
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
5925
+ <fo:block xsl:use-attribute-sets="import-style">
5926
+ <xsl:apply-templates/>
5927
+ </fo:block>
5824
5928
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
5825
5929
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
5826
5930
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -6725,6 +6829,9 @@
6725
6829
  <fo:block-container border="1pt solid black" width="50%">
6726
6830
  <fo:block> </fo:block>
6727
6831
  </fo:block-container>
6832
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6833
+ <fo:inline padding-right="5mm"> </fo:inline>
6834
+ <fo:inline><xsl:apply-templates/></fo:inline>
6728
6835
  </xsl:template><xsl:template name="convertDate">
6729
6836
  <xsl:param name="date"/>
6730
6837
  <xsl:param name="format" select="'short'"/>
@@ -6963,6 +7070,26 @@
6963
7070
  <xsl:value-of select="$level"/>
6964
7071
  </xsl:otherwise>
6965
7072
  </xsl:choose>
7073
+ </xsl:template><xsl:template name="getLevelTermName">
7074
+ <xsl:choose>
7075
+ <xsl:when test="normalize-space(../@depth) != ''">
7076
+ <xsl:value-of select="../@depth"/>
7077
+ </xsl:when>
7078
+ <xsl:otherwise>
7079
+ <xsl:variable name="title_level_">
7080
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
7081
+ <xsl:call-template name="getLevel"/>
7082
+ </xsl:for-each>
7083
+ </xsl:variable>
7084
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
7085
+ <xsl:choose>
7086
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
7087
+ <xsl:otherwise>
7088
+ <xsl:call-template name="getLevel"/>
7089
+ </xsl:otherwise>
7090
+ </xsl:choose>
7091
+ </xsl:otherwise>
7092
+ </xsl:choose>
6966
7093
  </xsl:template><xsl:template name="split">
6967
7094
  <xsl:param name="pText" select="."/>
6968
7095
  <xsl:param name="sep" select="','"/>