metanorma-itu 1.0.16 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -141,6 +154,16 @@
141
154
  <data type="boolean"/>
142
155
  </attribute>
143
156
  </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
144
167
  <oneOrMore>
145
168
  <ref name="BasicBlock"/>
146
169
  </oneOrMore>
@@ -3,6 +3,7 @@ require "isodoc/itu/base_convert"
3
3
  require "isodoc/itu/html_convert"
4
4
  require "isodoc/itu/pdf_convert"
5
5
  require "isodoc/itu/word_convert"
6
+ require "isodoc/itu/presentation_xml_convert"
6
7
 
7
8
  module IsoDoc
8
9
  module ITU
@@ -22,6 +22,11 @@ module IsoDoc
22
22
  @meta = Metadata.new(lang, script, labels)
23
23
  end
24
24
 
25
+ def xref_init(lang, script, klass, labels, options)
26
+ @xrefs = Xref.new(lang, script, klass, labels,
27
+ options.merge(hierarchical_assets: @hierarchical_assets))
28
+ end
29
+
25
30
  FRONT_CLAUSE = "//*[parent::preface]"\
26
31
  "[not(local-name() = 'abstract')]".freeze
27
32
 
@@ -37,18 +42,25 @@ module IsoDoc
37
42
  end
38
43
  end
39
44
 
45
+ def bracket_opt(b)
46
+ return b if b.nil?
47
+ return b if /^\[.+\]$/.match(b)
48
+ "[#{b}]"
49
+ end
50
+
40
51
  def clausedelim
41
52
  ""
42
53
  end
43
54
 
44
55
  def note_label(node)
45
- n = get_anchors[node["id"]]
46
- return "#{@note_lbl} &ndash; " if n.nil? || n[:label].nil? || n[:label].empty?
56
+ n = @xrefs.get[node["id"]]
57
+ (n.nil? || n[:label].nil? || n[:label].empty?) and
58
+ return "#{@note_lbl} &ndash; "
47
59
  l10n("#{@note_lbl} #{n[:label]} &ndash; ")
48
60
  end
49
61
 
50
62
  def prefix_container(container, linkend, _target)
51
- l10n("#{linkend} #{@labels["in"]} #{anchor(container, :xref)}")
63
+ l10n("#{linkend} #{@labels["in"]} #{@xrefs.anchor(container, :xref)}")
52
64
  end
53
65
 
54
66
  def ol_depth(node)
@@ -64,8 +76,9 @@ module IsoDoc
64
76
  end
65
77
 
66
78
  def annex_name(annex, name, div)
67
- div.h1 **{ class: "Annex" } do |t|
68
- t << "#{anchor(annex['id'], :label)} "
79
+ r_a = @meta.get[:doctype_original] == "recommendation-annex"
80
+ div.h1 **{ class: r_a ? "RecommendationAnnex" : "Annex" } do |t|
81
+ t << "#{@xrefs.anchor(annex['id'], :label)} "
69
82
  t.br
70
83
  t.br
71
84
  t.b do |b|
@@ -76,14 +89,28 @@ module IsoDoc
76
89
  end
77
90
 
78
91
  def annex_obligation_subtitle(annex, div)
79
- type = annex&.document&.root&.at("//bibdata/ext/doctype")&.text ||
80
- "recommendation"
81
- type = type.split(" ").map {|w| w.capitalize }.join(" ")
82
92
  info = annex["obligation"] == "informative"
83
93
  div.p **{class: "annex_obligation" } do |p|
84
- p << (info ? @inform_annex_lbl : @norm_annex_lbl).sub(/%/, type)
94
+ p << (info ? @inform_annex_lbl : @norm_annex_lbl).
95
+ sub(/%/, @meta.get[:doctype] || "")
96
+ end
97
+ end
98
+
99
+ def annex(isoxml, out)
100
+ isoxml.xpath(ns("//annex")).each do |c|
101
+ @meta.get[:doctype_original] == "recommendation-annex" or
102
+ page_break(out)
103
+ out.div **attr_code(id: c["id"], class: "Section3") do |s|
104
+ annex_name(c, nil, s) unless c.at(ns("./title"))
105
+ c.elements.each do |c1|
106
+ if c1.name == "title" then annex_name(c, c1, s)
107
+ else
108
+ parse(c1, s)
109
+ end
110
+ end
85
111
  end
86
112
  end
113
+ end
87
114
 
88
115
  def i18n_init(lang, script)
89
116
  super
@@ -96,6 +123,16 @@ module IsoDoc
96
123
  def cleanup(docxml)
97
124
  super
98
125
  term_cleanup(docxml)
126
+ refs_cleanup(docxml)
127
+ title_cleanup(docxml)
128
+ end
129
+
130
+ def title_cleanup(docxml)
131
+ docxml.xpath("//h1[@class = 'RecommendationAnnex']").each do |h|
132
+ h.name = "p"
133
+ h["class"] = "h1Annex"
134
+ end
135
+ docxml
99
136
  end
100
137
 
101
138
  def term_cleanup(docxml)
@@ -113,34 +150,49 @@ module IsoDoc
113
150
  docxml
114
151
  end
115
152
 
153
+ def refs_cleanup(docxml)
154
+ docxml.xpath("//tx[following-sibling::tx]").each do |tx|
155
+ tx << tx.next_element.remove.children
156
+ end
157
+ docxml.xpath("//tx").each do |tx|
158
+ tx.name = "td"
159
+ tx["colspan"] = "2"
160
+ tx.wrap("<tr></tr>")
161
+ end
162
+ docxml
163
+ end
164
+
116
165
  def info(isoxml, out)
117
- @meta.keywords isoxml, out
118
166
  @meta.ip_notice_received isoxml, out
119
167
  super
120
168
  end
121
169
 
122
170
  def get_eref_linkend(node)
123
- link = "[#{anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))}]"
124
- link += eref_localities(node.xpath(ns("./locality | ./localityStack")), link)
125
- contents = node.children.select { |c| !%w{locality localityStack}.include? c.name }
126
- return link if contents.nil? || contents.empty?
171
+ l = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
172
+ l && !/^\[.*\]$/.match(l) and l = "[#{l}]"
173
+ l += eref_localities(node.xpath(ns("./locality | ./localityStack")), l)
174
+ contents = node.children.select do |c|
175
+ !%w{locality localityStack}.include? c.name
176
+ end
177
+ return l if contents.nil? || contents.empty?
127
178
  Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
128
179
  end
129
180
 
130
181
  def eref_parse(node, out)
131
182
  linkend = get_eref_linkend(node)
183
+ href = eref_target(node)
132
184
  if node["type"] == "footnote"
133
185
  out.sup do |s|
134
- s.a(**{ "href": "#" + node["bibitemid"] }) { |l| l << linkend }
186
+ s.a(**{ "href": href }) { |l| l << linkend }
135
187
  end
136
188
  else
137
- out.a(**{ "href": "#" + node["bibitemid"] }) { |l| l << linkend }
189
+ out.a(**{ "href": href }) { |l| l << linkend }
138
190
  end
139
191
  end
140
192
 
141
193
  def middle_title(out)
142
194
  out.p(**{ class: "zzSTDTitle1" }) do |p|
143
- id = @meta.get[:docnumber] and p << "Recommendation #{id}"
195
+ id = @meta.get[:docnumber] and p << "#{@meta.get[:doctype]} #{id}"
144
196
  end
145
197
  out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
146
198
  s = @meta.get[:docsubtitle] and
@@ -1,3 +1,5 @@
1
+ @import 'base_style/all';
2
+
1
3
  .icon-svg {
2
4
  width: 100%;
3
5
  color: #5ecf86;
@@ -62,14 +64,18 @@
62
64
  @include coverpageStageBlock();
63
65
  }
64
66
 
65
- span.doc-title {
67
+ span.doc-title, span.doc-annextitle {
66
68
  font-size: 26px;
67
69
  font-weight: 800;
68
70
  margin-top: 20px;
69
- border-top: 2px solid #DA1D52;
70
71
  margin-right: 42px;
71
72
  }
72
73
 
74
+ span.doc-title {
75
+ border-top: 2px solid #DA1D52;
76
+ }
77
+
78
+
73
79
  .doc-footer {
74
80
  margin-top: 100px;
75
81
 
@@ -30,9 +30,6 @@
30
30
  {% if edition %} <div> Revision {{ edition }}</div> {% endif %}
31
31
  <div> {{ draftinfo }}</div>
32
32
  </div>
33
- {% if annexid %}
34
- <div class="doc-identifier">{{annexid}}</div>
35
- {% endif %}
36
33
  <div class="publication-month">
37
34
  ({{ pubdate_monthyear }})
38
35
  </div>
@@ -55,7 +52,7 @@
55
52
  <br/><span class="doc-subtitle">{{ docsubtitle }}</span>
56
53
  {% endif %}
57
54
  {% if annextitle %}
58
- <br/><span class="doctitle">{{ annextitle }}</span>
55
+ <br/><span class="doc-annextitle">{{ annexid }}{% if annexid and annextitle %}: {% endif %}{{ annextitle }}</span>
59
56
  {% endif %}
60
57
  </div>
61
58
 
@@ -209,20 +209,20 @@ svg {
209
209
 
210
210
  /* Headings */
211
211
 
212
- h1, h2, h3, h4, h5, h6 {
212
+ h1, h2, h3, h4, h5, h6, .h1Annex {
213
213
  font-weight: 400;
214
214
  margin-top: 1.6em;
215
215
  margin-bottom: 0.3em;
216
216
  }
217
217
 
218
- h1, h2, h3, h4 {
218
+ h1, h2, h3, h4, .h1Annex {
219
219
  @media print {
220
220
  page-break-after: avoid;
221
221
  margin-top: 1.2em;
222
222
  }
223
223
  }
224
224
 
225
- h1 {
225
+ h1, .h1Annex {
226
226
  font-size: 1.4em;
227
227
  text-transform: uppercase;
228
228
  margin-top: 2em;
@@ -419,7 +419,11 @@ p.Biblio, p.NormRef {
419
419
 
420
420
  /* Tables */
421
421
 
422
- table {
422
+ table.biblio td {
423
+ padding-right: 0.5em;
424
+ }
425
+
426
+ table:not(.biblio) {
423
427
  @include table($border: none);
424
428
 
425
429
  &, th, td {
@@ -1092,3 +1092,6 @@ table.dl
1092
1092
  margin-bottom:11.0pt;
1093
1093
  margin-left:0cm;}
1094
1094
 
1095
+ table.biblio td {
1096
+ margin-bottom: 6pt;
1097
+ }
@@ -4,9 +4,17 @@
4
4
  <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes'>
5
5
  <td width=663 valign=top style='width:497.25pt;padding:0cm 5.4pt 0cm 5.4pt'>
6
6
  <p class=RecNo><span style='mso-bookmark:_Hlk526346232'><a name=irecnoe></a><span
7
- lang=FR-CH style='mso-ansi-language:FR-CH;font-size:14pt;font-weight:bold;'>Recommendation ITU-{{ bureau }} {{ docnumber }}<o:p></o:p></span></span></p>
7
+ lang=FR-CH style='mso-ansi-language:FR-CH;font-size:14pt;font-weight:bold;'>{{ doctype}} {{ docnumber }}<o:p></o:p></span></span></p>
8
8
  <p class=Rectitle align="center"><span style='mso-bookmark:_Hlk526346232'><span lang=FR-CH
9
9
  style='mso-ansi-language:FR-CH;font-size:14pt;font-weight:bold;'>{{ doctitle }}<o:p></o:p></span></span></p>
10
+ {% if annexid %}
11
+ <p class=Rectitle align="center"><span style='mso-bookmark:_Hlk526346232'><span lang=FR-CH
12
+ style='mso-ansi-language:FR-CH;font-size:14pt;font-weight:bold;'>{{ annexid }}<o:p></o:p></span></span></p>
13
+ {% endif %}
14
+ {% if annextitle %}
15
+ <p class=Rectitle align="center"><span style='mso-bookmark:_Hlk526346232'><span lang=FR-CH
16
+ style='mso-ansi-language:FR-CH;font-size:14pt;font-weight:bold;'>{{ annextitle }}<o:p></o:p></span></span></p>
17
+ {% endif %}
10
18
  <span style='mso-bookmark:_Hlk526346232'></span>
11
19
  <p class=MsoNormal><span style='mso-bookmark:_Hlk526346232'><span lang=FR-CH
12
20
  style='mso-ansi-language:FR-CH'><o:p>&nbsp;</o:p></span></span></p>
@@ -143,9 +143,6 @@
143
143
  <td width="265" valign="top" style='width:198.55pt;padding:0cm 4.25pt 0cm 4.25pt;
144
144
  height:48.7pt'>
145
145
  <p class="MsoNormal" align="right" style='margin-top:0cm;text-align:right'>
146
- {% if annexid %}
147
- <span style='font-size:18.0pt;font-family:"Arial",sans-serif'><b>{{annexid}}</b></span><br/>
148
- {% endif %}
149
146
  <span
150
147
  style='mso-bookmark:_Hlk526346232'><a name="ddatee"><span lang="EN-US"
151
148
  style='font-size:14.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
@@ -198,7 +195,7 @@
198
195
  style='mso-bookmark:_Hlk526346232'><a name="c1tite">
199
196
  <span lang="EN-GB"
200
197
  style='font-size:18.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
201
- mso-bidi-font-family:"Times New Roman"'>{% if annextitle %}{{ doctitle }}<br/><b>{{ annextitle }}</b>{% else %}<b>{{ doctitle }}</b>{% endif %}</span>
198
+ mso-bidi-font-family:"Times New Roman"'>{% if annextitle %}{{ doctitle }}<br/><b>{{ annexid }}{% if annexid and annextitle %}: {% endif %}{{ annextitle }}</b>{% else %}<b>{{ doctitle }}</b>{% endif %}</span>
202
199
  </a></span><span
203
200
  style='mso-bookmark:_Hlk526346232'><span style='mso-bookmark:c1tite'><b><span
204
201
  lang="EN-US" style='font-size:18.0pt;mso-bidi-font-size:10.0pt;font-family:
@@ -512,7 +512,7 @@ p.h1Preface
512
512
  mso-ansi-language:EN-GB;
513
513
  mso-fareast-language:JA;
514
514
  mso-bidi-font-weight:normal;}
515
- h1.Annex
515
+ h1.Annex, .h1Annex
516
516
  {mso-style-priority:1;
517
517
  mso-style-unhide:no;
518
518
  mso-style-qformat:yes;
@@ -527,15 +527,12 @@ h1.Annex
527
527
  text-align:center;
528
528
  mso-pagination:widow-orphan lines-together;
529
529
  page-break-after:avoid;
530
- mso-outline-level:1;
531
530
  tab-stops:39.7pt 59.55pt 79.4pt 99.25pt;
532
531
  mso-layout-grid-align:none;
533
532
  punctuation-wrap:simple;
534
533
  text-autospace:none;
535
534
  font-size:14.0pt;
536
535
  mso-bidi-font-size:10.0pt;
537
- mso-outline-level:1;
538
- mso-list:l1 level1 lfo6;
539
536
  mso-hyphenate:none;
540
537
  mso-bidi-font-size:11.0pt;
541
538
  font-family:$headerfont;
@@ -545,6 +542,10 @@ h1.Annex
545
542
  mso-ansi-language:EN-GB;
546
543
  mso-fareast-language:JA;
547
544
  mso-bidi-font-weight:normal;}
545
+ h1.Annex {
546
+ mso-outline-level:1;
547
+ mso-list:l1 level1 lfo6;
548
+ }
548
549
  .h2Annex
549
550
  {mso-style-priority:2;
550
551
  mso-style-unhide:no;
@@ -1676,4 +1677,3 @@ ol
1676
1677
  ul
1677
1678
  {margin-bottom:0cm;
1678
1679
  margin-left:18pt;}
1679
-
@@ -9,7 +9,8 @@ norm_annex: (This annex forms an integral part of this %.)
9
9
  inform_annex: (This appendix does not form an integral part of this %.)
10
10
  formula: Equation
11
11
  inequality: Inequality
12
- annex_subclause: Clause
12
+ clause: clause
13
+ annex_subclause: clause
13
14
  in: in
14
15
  where: "where:"
15
16
  blankclause: This clause is intentionally left blank.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -26,8 +26,9 @@
26
26
  </xsl:call-template>
27
27
  </xsl:variable>
28
28
  <xsl:variable name="doctype">
29
- <xsl:value-of select="translate(substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,1,1),$lower,$upper)"/>
30
- <xsl:value-of select="substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,2)"/>
29
+ <xsl:call-template name="capitalize">
30
+ <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype"/>
31
+ </xsl:call-template>
31
32
  </xsl:variable>
32
33
 
33
34
 
@@ -51,8 +52,6 @@
51
52
  <xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/>
52
53
  <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[position() != 1]" mode="contents"/> <!-- @id = 'bibliography' -->
53
54
 
54
- <xsl:apply-templates select="//itu3" mode="contents"/>
55
-
56
55
  <xsl:apply-templates select="//itu:table" mode="contents"/>
57
56
 
58
57
  </contents>
@@ -121,42 +120,7 @@
121
120
  </fo:page-sequence-master>
122
121
  </fo:layout-master-set>
123
122
 
124
- <fo:declarations>
125
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
126
- <pdf:dictionary type="normal" key="ViewerPreferences">
127
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
128
- </pdf:dictionary>
129
- </pdf:catalog>
130
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
131
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
132
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
133
- <!-- Dublin Core properties go here -->
134
- <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/></dc:title>
135
- <dc:creator><xsl:value-of select="/itu:iso-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/></dc:creator>
136
- <dc:description>
137
- <xsl:variable name="abstract">
138
- <xsl:copy-of select="/itu:itu-standard/itu:bibdata/itu:abstract//text()"/>
139
- </xsl:variable>
140
- <xsl:value-of select="normalize-space($abstract)"/>
141
- </dc:description>
142
- <pdf:Keywords>
143
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
144
- <xsl:sort data-type="text" order="ascending"/>
145
- <xsl:apply-templates/>
146
- <xsl:choose>
147
- <xsl:when test="position() != last()">, </xsl:when>
148
- <xsl:otherwise>.</xsl:otherwise>
149
- </xsl:choose>
150
- </xsl:for-each>
151
- </pdf:Keywords>
152
- </rdf:Description>
153
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
154
- <!-- XMP properties go here -->
155
- <xmp:CreatorTool/>
156
- </rdf:Description>
157
- </rdf:RDF>
158
- </x:xmpmeta>
159
- </fo:declarations>
123
+ <xsl:call-template name="addPDFUAmeta"/>
160
124
 
161
125
  <!-- cover page -->
162
126
  <fo:page-sequence master-reference="cover-page">
@@ -180,12 +144,12 @@
180
144
  <fo:table-column column-width="35.8mm"/>
181
145
  <fo:table-column column-width="67mm"/>
182
146
  <fo:table-body>
183
- <fo:table-row height="42.5mm">
147
+ <fo:table-row height="37.5mm"> <!-- 42.5mm -->
184
148
  <fo:table-cell>
185
149
  <fo:block> </fo:block>
186
150
  </fo:table-cell>
187
151
  <fo:table-cell number-columns-spanned="3">
188
- <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray" margin-top="16pt"> <!-- letter-spacing="4pt", Helvetica for letter-spacing working -->
152
+ <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
189
153
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
190
154
  <xsl:call-template name="addLetterSpacing">
191
155
  <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
@@ -226,7 +190,12 @@
226
190
  <fo:table-cell text-align="right">
227
191
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
228
192
  <fo:block font-size="18pt" font-weight="bold">
229
- <xsl:text>Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
193
+ <xsl:variable name="title-annex">
194
+ <xsl:call-template name="getTitle">
195
+ <xsl:with-param name="name" select="'title-annex'"/>
196
+ </xsl:call-template>
197
+ </xsl:variable>
198
+ <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
230
199
  </fo:block>
231
200
  </xsl:if>
232
201
  <fo:block font-size="14pt">
@@ -236,29 +205,31 @@
236
205
  </fo:block>
237
206
  </fo:table-cell>
238
207
  </fo:table-row>
239
- <fo:table-row height="59mm">
208
+ <fo:table-row height="64mm"> <!-- 59mm -->
240
209
  <fo:table-cell>
241
210
  <fo:block> </fo:block>
242
211
  </fo:table-cell>
243
- <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm">
244
- <fo:block>
245
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
246
- <xsl:variable name="title">
247
- <xsl:text>Series </xsl:text>
248
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
249
- </xsl:variable>
250
- <xsl:value-of select="translate($title, $lower, $upper)"/>
251
- </xsl:if>
252
- </fo:block>
253
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
254
- <fo:block margin-top="6pt">
255
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
256
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
257
- <xsl:text> — </xsl:text>
258
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
212
+ <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after">
213
+ <fo:block padding-bottom="7mm">
214
+ <fo:block text-transform="uppercase">
215
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
216
+ <xsl:variable name="title">
217
+ <xsl:text>Series </xsl:text>
218
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
219
+ </xsl:variable>
220
+ <xsl:value-of select="$title"/>
259
221
  </xsl:if>
260
222
  </fo:block>
261
- </xsl:if>
223
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
224
+ <fo:block margin-top="6pt">
225
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
226
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
227
+ <xsl:text> — </xsl:text>
228
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
229
+ </xsl:if>
230
+ </fo:block>
231
+ </xsl:if>
232
+ </fo:block>
262
233
  </fo:table-cell>
263
234
  </fo:table-row>
264
235
  <fo:table-row height="40mm">
@@ -311,7 +282,12 @@
311
282
  <xsl:text>  </xsl:text>
312
283
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
313
284
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
314
- <xsl:text> — Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
285
+ <xsl:variable name="title-annex">
286
+ <xsl:call-template name="getTitle">
287
+ <xsl:with-param name="name" select="'title-annex'"/>
288
+ </xsl:call-template>
289
+ </xsl:variable>
290
+ <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
315
291
  </xsl:if>
316
292
  </fo:block>
317
293
  </fo:table-cell>
@@ -346,17 +322,15 @@
346
322
  <xsl:value-of select="$linebreak"/>
347
323
  </fo:block>
348
324
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
349
- <xsl:text>Keywords</xsl:text>
325
+ <xsl:variable name="title-keywords">
326
+ <xsl:call-template name="getTitle">
327
+ <xsl:with-param name="name" select="'title-keywords'"/>
328
+ </xsl:call-template>
329
+ </xsl:variable>
330
+ <xsl:value-of select="$title-keywords"/>
350
331
  </fo:block>
351
332
  <fo:block>
352
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
353
- <xsl:sort data-type="text" order="ascending"/>
354
- <xsl:apply-templates/>
355
- <xsl:choose>
356
- <xsl:when test="position() != last()">, </xsl:when>
357
- <xsl:otherwise>.</xsl:otherwise>
358
- </xsl:choose>
359
- </xsl:for-each>
333
+ <xsl:call-template name="insertKeywords"/>
360
334
  </fo:block>
361
335
  </xsl:if>
362
336
 
@@ -379,8 +353,18 @@
379
353
  <xsl:if test="xalan:nodeset($contents)//item">
380
354
  <fo:block break-after="page"/>
381
355
  <fo:block-container>
382
- <fo:block margin-top="6pt" text-align="center" font-weight="bold">Table of Contents</fo:block>
383
- <fo:block margin-top="6pt" text-align="right" font-weight="bold">Page</fo:block>
356
+ <xsl:variable name="title-toc">
357
+ <xsl:call-template name="getTitle">
358
+ <xsl:with-param name="name" select="'title-toc'"/>
359
+ </xsl:call-template>
360
+ </xsl:variable>
361
+ <xsl:variable name="title-page">
362
+ <xsl:call-template name="getTitle">
363
+ <xsl:with-param name="name" select="'title-page'"/>
364
+ </xsl:call-template>
365
+ </xsl:variable>
366
+ <fo:block margin-top="6pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
367
+ <fo:block margin-top="6pt" text-align="right" font-weight="bold"><xsl:value-of select="$title-page"/></fo:block>
384
368
 
385
369
  <xsl:for-each select="xalan:nodeset($contents)//item">
386
370
  <xsl:if test="@display = 'true'">
@@ -625,15 +609,21 @@
625
609
  <xsl:template match="itu:figure" mode="contents">
626
610
  <xsl:param name="sectionNum"/>
627
611
  <item level="" id="{@id}" display="false" type="figure">
628
- <xsl:variable name="title">Figure </xsl:variable>
612
+ <xsl:variable name="title-figure">
613
+ <xsl:call-template name="getTitle">
614
+ <xsl:with-param name="name" select="'title-figure'"/>
615
+ </xsl:call-template>
616
+ </xsl:variable>
617
+ <xsl:variable name="title" select="$title-figure"/>
629
618
  <xsl:attribute name="section">
630
619
  <xsl:call-template name="getSection">
631
620
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
621
+ </xsl:call-template>
622
+ </xsl:attribute>
623
+ <xsl:attribute name="topsection">
624
+ <xsl:call-template name="getTopSection">
625
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
632
626
  </xsl:call-template>
633
- <!-- <xsl:text>Figure </xsl:text>
634
- <xsl:call-template name="getItemNumber">
635
- <xsl:with-param name="brackets" select="'false'"/>
636
- </xsl:call-template> -->
637
627
  </xsl:attribute>
638
628
  <xsl:value-of select="$title"/>
639
629
  <xsl:call-template name="getItemNumber">
@@ -648,13 +638,21 @@
648
638
  <xsl:template match="itu:table" mode="contents">
649
639
  <xsl:param name="sectionNum"/>
650
640
  <item level="" id="{@id}" display="false" type="table">
651
- <xsl:variable name="title">Table </xsl:variable>
641
+ <xsl:variable name="title-table">
642
+ <xsl:call-template name="getTitle">
643
+ <xsl:with-param name="name" select="'title-table'"/>
644
+ </xsl:call-template>
645
+ </xsl:variable>
646
+ <xsl:variable name="title" select="$title-table"/>
652
647
  <xsl:attribute name="section">
653
648
  <xsl:call-template name="getSection">
654
649
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
650
+ </xsl:call-template>
651
+ </xsl:attribute>
652
+ <xsl:attribute name="topsection">
653
+ <xsl:call-template name="getTopSection">
654
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
655
655
  </xsl:call-template>
656
- <!-- <xsl:text>Table </xsl:text>
657
- <xsl:call-template name="getItemNumber"/> -->
658
656
  </xsl:attribute>
659
657
  <xsl:value-of select="$title"/>
660
658
  <xsl:call-template name="getItemNumber">
@@ -670,23 +668,39 @@
670
668
  <xsl:template match="itu:formula" mode="contents">
671
669
  <xsl:param name="sectionNum"/>
672
670
  <item level="" id="{@id}" display="false" type="formula">
671
+ <xsl:variable name="title-inequality">
672
+ <xsl:call-template name="getTitle">
673
+ <xsl:with-param name="name" select="'title-inequality'"/>
674
+ </xsl:call-template>
675
+ </xsl:variable>
676
+ <xsl:variable name="title-equation">
677
+ <xsl:call-template name="getTitle">
678
+ <xsl:with-param name="name" select="'title-equation'"/>
679
+ </xsl:call-template>
680
+ </xsl:variable>
673
681
  <xsl:variable name="title">
674
682
  <xsl:choose>
675
- <xsl:when test="@inequality = 'true'">Inequality </xsl:when>
676
- <xsl:otherwise>Equation </xsl:otherwise>
683
+ <xsl:when test="@inequality = 'true'"><xsl:value-of select="$title-inequality"/></xsl:when>
684
+ <xsl:otherwise><xsl:value-of select="$title-equation"/></xsl:otherwise>
677
685
  </xsl:choose>
678
686
  </xsl:variable>
679
- <xsl:attribute name="section">
687
+ <xsl:variable name="section">
680
688
  <xsl:call-template name="getSection">
681
689
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
682
690
  </xsl:call-template>
683
- <!-- <xsl:value-of select="$title"/>
684
- <xsl:call-template name="getItemNumber"/> -->
685
- </xsl:attribute>
691
+ </xsl:variable>
692
+ <xsl:attribute name="section">
693
+ <xsl:value-of select="$section"/>
694
+ </xsl:attribute>
686
695
  <xsl:variable name="parent-element" select="local-name(..)"/>
687
696
  <xsl:attribute name="parent">
697
+ <xsl:variable name="title-clause">
698
+ <xsl:call-template name="getTitle">
699
+ <xsl:with-param name="name" select="'title-clause'"/>
700
+ </xsl:call-template>
701
+ </xsl:variable>
688
702
  <xsl:choose>
689
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
703
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
690
704
  <xsl:otherwise/>
691
705
  </xsl:choose>
692
706
  </xsl:attribute>
@@ -698,6 +712,11 @@
698
712
  <xsl:attribute name="number">
699
713
  <xsl:value-of select="$itemNumber"/>
700
714
  </xsl:attribute>
715
+ <xsl:attribute name="topsection">
716
+ <xsl:call-template name="getTopSection">
717
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
718
+ </xsl:call-template>
719
+ </xsl:attribute>
701
720
  <xsl:value-of select="$title"/>
702
721
  <xsl:value-of select="$itemNumber"/>
703
722
  </item>
@@ -793,11 +812,21 @@
793
812
  <xsl:variable name="parent-element" select="local-name(..)"/>
794
813
  <item level="" id="{@id}" display="false" type="example" section="{$section}">
795
814
  <xsl:attribute name="parent">
815
+ <xsl:variable name="title-clause">
816
+ <xsl:call-template name="getTitle">
817
+ <xsl:with-param name="name" select="'title-clause'"/>
818
+ </xsl:call-template>
819
+ </xsl:variable>
796
820
  <xsl:choose>
797
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
821
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
798
822
  <xsl:otherwise/>
799
823
  </xsl:choose>
800
824
  </xsl:attribute>
825
+ <xsl:attribute name="topsection">
826
+ <xsl:call-template name="getTopSection">
827
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
828
+ </xsl:call-template>
829
+ </xsl:attribute>
801
830
  </item>
802
831
  <xsl:apply-templates mode="contents">
803
832
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -816,6 +845,11 @@
816
845
  </xsl:call-template>
817
846
  </xsl:variable>
818
847
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
848
+ <xsl:attribute name="topsection">
849
+ <xsl:call-template name="getTopSection">
850
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
851
+ </xsl:call-template>
852
+ </xsl:attribute>
819
853
  <xsl:number/>
820
854
  </item>
821
855
  <xsl:apply-templates mode="contents">
@@ -823,23 +857,6 @@
823
857
  </xsl:apply-templates>
824
858
  </xsl:template>
825
859
 
826
- <xsl:template match="itu:termnote" mode="contents">
827
- <xsl:param name="sectionNum"/>
828
- <xsl:variable name="level">
829
- <xsl:call-template name="getLevel"/>
830
- </xsl:variable>
831
- <xsl:variable name="section">
832
- <xsl:call-template name="getSection">
833
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
834
- </xsl:call-template>
835
- </xsl:variable>
836
- <item level="" id="{@id}" display="false" type="note" section="{$section}">
837
- <xsl:number/>
838
- </item>
839
- <xsl:apply-templates mode="contents">
840
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
841
- </xsl:apply-templates>
842
- </xsl:template>
843
860
 
844
861
  <xsl:template match="itu:note" mode="contents">
845
862
  <xsl:param name="sectionNum"/>
@@ -854,6 +871,11 @@
854
871
  </xsl:for-each>
855
872
  </xsl:variable>
856
873
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
874
+ <xsl:attribute name="topsection">
875
+ <xsl:call-template name="getTopSection">
876
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
877
+ </xsl:call-template>
878
+ </xsl:attribute>
857
879
  <xsl:number/>
858
880
  </item>
859
881
  <xsl:apply-templates mode="contents">
@@ -910,6 +932,18 @@
910
932
  </xsl:otherwise>
911
933
  </xsl:choose>
912
934
  </xsl:template>
935
+
936
+ <xsl:template match="itu:xref" mode="contents">
937
+ <xsl:param name="sectionNum"/>
938
+ <item level="" id="{generate-id()}" display="false" type="xref">
939
+
940
+ <xsl:attribute name="topsection">
941
+ <xsl:call-template name="getTopSection">
942
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
943
+ </xsl:call-template>
944
+ </xsl:attribute>
945
+ </item>
946
+ </xsl:template>
913
947
 
914
948
  <!-- ============================= -->
915
949
  <!-- ============================= -->
@@ -925,8 +959,13 @@
925
959
  <xsl:value-of select="$linebreak"/>
926
960
  <xsl:value-of select="$linebreak"/>
927
961
  </fo:block>
928
- <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
929
- <xsl:text>Summary</xsl:text>
962
+ <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
963
+ <xsl:variable name="title-summary">
964
+ <xsl:call-template name="getTitle">
965
+ <xsl:with-param name="name" select="'title-summary'"/>
966
+ </xsl:call-template>
967
+ </xsl:variable>
968
+ <xsl:value-of select="$title-summary"/>
930
969
  </fo:block>
931
970
  <xsl:apply-templates/>
932
971
  </xsl:template>
@@ -952,14 +991,23 @@
952
991
  <!-- PARAGRAPHS -->
953
992
  <!-- ============================= -->
954
993
  <xsl:template match="itu:p | itu:sections/itu:p">
994
+ <xsl:param name="sectionNum"/>
955
995
  <fo:block margin-top="6pt">
956
996
  <xsl:attribute name="text-align">
957
997
  <xsl:choose>
958
998
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
999
+ <xsl:when test="ancestor::*[1][local-name() = 'td']/@align">
1000
+ <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/>
1001
+ </xsl:when>
1002
+ <xsl:when test="ancestor::*[1][local-name() = 'th']/@align">
1003
+ <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/>
1004
+ </xsl:when>
959
1005
  <xsl:otherwise>justify</xsl:otherwise>
960
1006
  </xsl:choose>
961
1007
  </xsl:attribute>
962
- <xsl:apply-templates/>
1008
+ <xsl:apply-templates>
1009
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1010
+ </xsl:apply-templates>
963
1011
  </fo:block>
964
1012
  </xsl:template>
965
1013
 
@@ -975,7 +1023,12 @@
975
1023
  <xsl:if test="ancestor::itu:figure">
976
1024
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
977
1025
  </xsl:if>
978
- <xsl:text>NOTE </xsl:text>
1026
+ <xsl:variable name="title-note">
1027
+ <xsl:call-template name="getTitle">
1028
+ <xsl:with-param name="name" select="'title-note'"/>
1029
+ </xsl:call-template>
1030
+ </xsl:variable>
1031
+ <xsl:value-of select="$title-note"/>
979
1032
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
980
1033
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
981
1034
  <xsl:number count="itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1210,12 +1263,20 @@
1210
1263
  </fo:block>
1211
1264
  </xsl:template>
1212
1265
 
1266
+ <xsl:template match="itu:term">
1267
+ <xsl:param name="sectionNum"/>
1268
+ <fo:block id="{@id}">
1269
+ <xsl:apply-templates>
1270
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1271
+ </xsl:apply-templates>
1272
+ </fo:block>
1273
+ </xsl:template>
1213
1274
 
1214
1275
  <xsl:template match="itu:preferred">
1215
1276
  <xsl:param name="sectionNum"/>
1216
1277
  <!-- DEBUG need -->
1217
1278
  <fo:block space-before="6pt" text-align="justify">
1218
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
1279
+ <fo:inline padding-right="5mm" font-weight="bold">
1219
1280
  <!-- <xsl:value-of select="$sectionNum"/><xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term"/> -->
1220
1281
  <xsl:variable name="level">
1221
1282
  <xsl:call-template name="getLevel"/>
@@ -1239,7 +1300,15 @@
1239
1300
  <xsl:apply-templates/>
1240
1301
  </fo:inline>
1241
1302
  <xsl:if test="../itu:termsource/itu:origin">
1242
- <xsl:text> [</xsl:text><xsl:value-of select="../itu:termsource/itu:origin/@citeas"/><xsl:text>]</xsl:text>
1303
+ <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
1304
+ <xsl:choose>
1305
+ <xsl:when test="contains($citeas, '[')">
1306
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1307
+ </xsl:when>
1308
+ <xsl:otherwise>
1309
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1310
+ </xsl:otherwise>
1311
+ </xsl:choose>
1243
1312
  </xsl:if>
1244
1313
  <xsl:text>: </xsl:text>
1245
1314
  <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> <!-- -->
@@ -1354,10 +1423,18 @@
1354
1423
  <xsl:with-param name="brackets" select="'false'"/>
1355
1424
  </xsl:call-template>
1356
1425
  </xsl:variable>
1357
- <xsl:if test="$itemnumber != ''">
1358
- <xsl:text>Figure </xsl:text>
1359
- <xsl:value-of select="$itemnumber"/>
1360
- </xsl:if>
1426
+ <xsl:choose>
1427
+ <xsl:when test="local-name(*) = 'figure' and normalize-space(itu:name) = ''"/><!-- don't show 'Figure' for outer figure without name -->
1428
+ <xsl:when test="$itemnumber != ''">
1429
+ <xsl:variable name="title-figure">
1430
+ <xsl:call-template name="getTitle">
1431
+ <xsl:with-param name="name" select="'title-figure'"/>
1432
+ </xsl:call-template>
1433
+ </xsl:variable>
1434
+ <xsl:value-of select="$title-figure"/>
1435
+ <xsl:value-of select="$itemnumber"/>
1436
+ </xsl:when>
1437
+ </xsl:choose>
1361
1438
  <xsl:if test="itu:name">
1362
1439
  <xsl:text> — </xsl:text>
1363
1440
  <xsl:apply-templates select="itu:name" mode="process"/>
@@ -1416,18 +1493,6 @@
1416
1493
  <xsl:template match="itu:docidentifier"/>
1417
1494
 
1418
1495
 
1419
-
1420
- <xsl:template match="itu:annex2//itu:note/itu:p">
1421
- <fo:block font-size="11pt" margin-top="4pt">
1422
- <xsl:text>NOTE </xsl:text>
1423
- <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1424
- <xsl:number count="itu:note"/><xsl:text> </xsl:text>
1425
- <!-- </xsl:if> -->
1426
- <xsl:text>– </xsl:text>
1427
- <xsl:apply-templates/>
1428
- </fo:block>
1429
- </xsl:template>
1430
-
1431
1496
  <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol">
1432
1497
  <xsl:if test="preceding-sibling::*[1][local-name() = 'title']">
1433
1498
  <fo:block padding-top="-8pt" font-size="1pt"> </fo:block>
@@ -1439,10 +1504,20 @@
1439
1504
  </xsl:template>
1440
1505
 
1441
1506
  <xsl:template match="itu:ul//itu:note | itu:ol//itu:note"/>
1507
+ <xsl:template match="itu:ul//itu:note | itu:ol//itu:note" mode="process">
1508
+ <fo:block id="{@id}">
1509
+ <xsl:apply-templates mode="process"/>
1510
+ </fo:block>
1511
+ </xsl:template>
1442
1512
  <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process">
1443
1513
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
1444
- <fo:block font-size="11pt" margin-top="4pt">
1445
- <xsl:text>NOTE </xsl:text>
1514
+ <fo:block font-size="11pt" margin-top="4pt">
1515
+ <xsl:variable name="title-note">
1516
+ <xsl:call-template name="getTitle">
1517
+ <xsl:with-param name="name" select="'title-note'"/>
1518
+ </xsl:call-template>
1519
+ </xsl:variable>
1520
+ <xsl:value-of select="$title-note"/>
1446
1521
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1447
1522
  <xsl:if test="count(//itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]) &gt; 1">
1448
1523
  <xsl:number count="itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1467,10 +1542,13 @@
1467
1542
  <xsl:attribute name="margin-left">18mm</xsl:attribute>
1468
1543
  </xsl:if>
1469
1544
  <xsl:if test="local-name(..) = 'ul'">
1470
- <xsl:attribute name="margin-left">15mm</xsl:attribute>
1471
- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1472
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
1545
+ <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm -->
1546
+ <xsl:if test="ancestor::itu:table">
1547
+ <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
1473
1548
  </xsl:if>
1549
+ <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1550
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1551
+ </xsl:if> -->
1474
1552
  </xsl:if>
1475
1553
  <fo:block-container margin-left="0mm">
1476
1554
  <xsl:apply-templates/>
@@ -1481,7 +1559,7 @@
1481
1559
  </fo:list-item>
1482
1560
  </xsl:template>
1483
1561
 
1484
- <xsl:template match="itu:li//itu:p">
1562
+ <xsl:template match="itu:li//itu:p[not(parent::itu:dd)]">
1485
1563
  <fo:block margin-bottom="0pt"> <!-- margin-bottom="6pt" -->
1486
1564
  <!-- <xsl:if test="local-name(ancestor::itu:li[1]/..) = 'ul'">
1487
1565
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -1493,11 +1571,9 @@
1493
1571
  <xsl:template match="itu:link" priority="2">
1494
1572
  <fo:inline color="blue">
1495
1573
  <xsl:if test="local-name(..) = 'formattedref' or ancestor::itu:preface">
1496
- <xsl:attribute name="font-family">Arial</xsl:attribute>
1497
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1498
- <xsl:if test="local-name(..) = 'formattedref'">
1499
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1500
- </xsl:if>
1574
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1575
+ <!-- <xsl:attribute name="font-family">Arial</xsl:attribute>
1576
+ <xsl:attribute name="font-size">8pt</xsl:attribute> -->
1501
1577
  </xsl:if>
1502
1578
  <xsl:call-template name="link"/>
1503
1579
  </fo:inline>
@@ -1505,8 +1581,13 @@
1505
1581
 
1506
1582
 
1507
1583
  <xsl:template match="itu:termnote">
1508
- <fo:block id="{@id}" margin-top="4pt">
1509
- <xsl:text>NOTE </xsl:text>
1584
+ <fo:block id="{@id}" margin-top="4pt">
1585
+ <xsl:variable name="title-note">
1586
+ <xsl:call-template name="getTitle">
1587
+ <xsl:with-param name="name" select="'title-note'"/>
1588
+ </xsl:call-template>
1589
+ </xsl:variable>
1590
+ <xsl:value-of select="$title-note"/>
1510
1591
  <xsl:if test="following-sibling::itu:termnote or preceding-sibling::itu:termnote">
1511
1592
  <xsl:number/><xsl:text> </xsl:text>
1512
1593
  </xsl:if>
@@ -1549,7 +1630,7 @@
1549
1630
 
1550
1631
  <xsl:template match="itu:formula" name="formula">
1551
1632
  <xsl:param name="sectionNum"/>
1552
- <fo:block id="{@id}" margin-top="6pt"> <!-- text-align="center" -->
1633
+ <fo:block id="{@id}" margin-top="6pt" margin-bottom="6pt"> <!-- text-align="center" -->
1553
1634
  <xsl:apply-templates/>
1554
1635
  <fo:inline keep-together.within-line="always">
1555
1636
  </fo:inline>
@@ -1599,32 +1680,57 @@
1599
1680
  <xsl:param name="sectionNum"/>
1600
1681
 
1601
1682
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1683
+ <xsl:variable name="topsection" select="xalan:nodeset($contents)//item[@id = current()/@target]/@topsection"/>
1684
+ <xsl:variable name="xref_id" select="generate-id()"/>
1685
+ <xsl:variable name="xreftopsection" select="xalan:nodeset($contents)//item[@id = $xref_id]/@topsection"/>
1602
1686
 
1603
1687
  <xsl:variable name="text" select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/>
1604
1688
 
1605
1689
  <fo:basic-link internal-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1606
1690
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1691
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =current()/@target]/@level"/>
1692
+
1693
+ <xsl:variable name="title-clause">
1694
+ <xsl:call-template name="getTitle">
1695
+ <xsl:with-param name="name" select="'title-clause'"/>
1696
+ </xsl:call-template>
1697
+ </xsl:variable>
1698
+ <xsl:variable name="title-example-xref">
1699
+ <xsl:call-template name="getTitle">
1700
+ <xsl:with-param name="name" select="'title-example-xref'"/>
1701
+ </xsl:call-template>
1702
+ </xsl:variable>
1703
+
1607
1704
  <xsl:choose>
1608
- <xsl:when test="$type = 'clause'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1609
- <xsl:when test="$type = 'example'">Example </xsl:when>
1705
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1706
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1707
+ <xsl:when test="$type = 'example'"><xsl:value-of select="$title-example-xref"/></xsl:when>
1610
1708
  <xsl:when test="$type = 'figure'"/>
1611
1709
  <xsl:when test="$type = 'formula'"/>
1612
1710
  <xsl:when test="$type = 'table'"/>
1613
- <xsl:when test="$type = 'term'">Clause </xsl:when>
1614
1711
  <xsl:when test="$type = 'note'"><xsl:text>Note </xsl:text><xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/></xsl:when>
1615
1712
 
1616
1713
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1617
1714
  </xsl:choose>
1618
1715
 
1716
+ <xsl:variable name="title-in">
1717
+ <xsl:call-template name="getTitle">
1718
+ <xsl:with-param name="name" select="'title-in'"/>
1719
+ </xsl:call-template>
1720
+ </xsl:variable>
1721
+
1619
1722
  <xsl:choose>
1620
1723
  <xsl:when test="$type = 'example'">
1621
1724
  <xsl:variable name="currentSection">
1622
1725
  <xsl:call-template name="getSection"/>
1623
1726
  </xsl:variable>
1624
- <xsl:if test="not(contains($section, $currentSection))">
1625
- <xsl:text>in </xsl:text>
1626
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1627
- <xsl:text> </xsl:text>
1727
+ <xsl:if test="not(contains($section, $currentSection))">
1728
+
1729
+ <xsl:value-of select="$title-in"/>
1730
+ <xsl:if test="$level = 1">
1731
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1732
+ <xsl:text> </xsl:text>
1733
+ </xsl:if>
1628
1734
  <xsl:value-of select="$section"/>
1629
1735
  </xsl:if>
1630
1736
  </xsl:when>
@@ -1635,13 +1741,18 @@
1635
1741
 
1636
1742
  <xsl:when test="$type = 'formula'">
1637
1743
  <xsl:value-of select="$text"/>
1638
- <xsl:variable name="currentSection">
1744
+ <!-- <xsl:variable name="currentSection">
1639
1745
  <xsl:call-template name="getSection"/>
1640
- </xsl:variable>
1641
- <xsl:if test="not(contains($section, $currentSection))">
1642
- <xsl:text> in </xsl:text>
1643
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1644
- <xsl:text> </xsl:text>
1746
+ </xsl:variable>
1747
+
1748
+ <xsl:if test="not(contains($section, $currentSection))"> -->
1749
+ <xsl:if test="$topsection != $xreftopsection">
1750
+ <xsl:text> </xsl:text>
1751
+ <xsl:value-of select="$title-in"/>
1752
+ <xsl:if test="$level = 1">
1753
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1754
+ <xsl:text> </xsl:text>
1755
+ </xsl:if>
1645
1756
  <xsl:value-of select="$section"/>
1646
1757
  </xsl:if>
1647
1758
  </xsl:when>
@@ -1655,7 +1766,12 @@
1655
1766
  <xsl:call-template name="getSection"/>
1656
1767
  </xsl:variable>
1657
1768
  <xsl:if test="not(contains($section, $currentSection))">
1658
- <xsl:text> in Clause </xsl:text>
1769
+ <xsl:text> </xsl:text>
1770
+ <xsl:value-of select="$title-in"/>
1771
+ <xsl:choose>
1772
+ <xsl:when test="$level = 1"><xsl:value-of select="$title-clause"/></xsl:when>
1773
+ <xsl:when test="$level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1774
+ </xsl:choose>
1659
1775
  <xsl:value-of select="$section"/>
1660
1776
  </xsl:if>
1661
1777
  </xsl:when>
@@ -1696,8 +1812,13 @@
1696
1812
  </xsl:template>
1697
1813
 
1698
1814
  <xsl:template match="itu:example/itu:name">
1699
- <fo:block font-weight="bold">
1700
- <xsl:text>EXAMPLE</xsl:text>
1815
+ <fo:block font-weight="bold">
1816
+ <xsl:variable name="title-example">
1817
+ <xsl:call-template name="getTitle">
1818
+ <xsl:with-param name="name" select="'title-example'"/>
1819
+ </xsl:call-template>
1820
+ </xsl:variable>
1821
+ <xsl:value-of select="normalize-space($title-example)"/>
1701
1822
  <xsl:if test="count(ancestor::itu:clause[1]/itu:example) &gt; 1">
1702
1823
  <xsl:text> </xsl:text><xsl:number count="itu:example"/>
1703
1824
  </xsl:if>
@@ -1724,10 +1845,10 @@
1724
1845
  <fo:basic-link internal-destination="{@bibitemid}" color="blue" text-decoration="underline" fox:alt-text="{@citeas}">
1725
1846
  <xsl:choose>
1726
1847
  <xsl:when test="contains(@citeas, '[')">
1727
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1848
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1728
1849
  </xsl:when>
1729
1850
  <xsl:otherwise>
1730
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1851
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1731
1852
  </xsl:otherwise>
1732
1853
  </xsl:choose>
1733
1854
 
@@ -1738,8 +1859,13 @@
1738
1859
  </xsl:template>
1739
1860
 
1740
1861
  <xsl:template match="itu:locality">
1862
+ <xsl:variable name="title-section">
1863
+ <xsl:call-template name="getTitle">
1864
+ <xsl:with-param name="name" select="'title-section'"/>
1865
+ </xsl:call-template>
1866
+ </xsl:variable>
1741
1867
  <xsl:choose>
1742
- <xsl:when test="@type ='section'">Section</xsl:when>
1868
+ <xsl:when test="@type ='section'"><xsl:value-of select="normalize-space($title-section)"/></xsl:when>
1743
1869
  <xsl:otherwise/>
1744
1870
  </xsl:choose>
1745
1871
  <xsl:value-of select="itu:referenceFrom"/>
@@ -1750,18 +1876,30 @@
1750
1876
  <xsl:apply-templates/>
1751
1877
  </xsl:template>
1752
1878
 
1753
- <xsl:template match="itu:sourcecode">
1754
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1755
- <xsl:choose>
1756
- <xsl:when test="@lang = 'en'"/>
1757
- <xsl:otherwise>
1758
- <xsl:attribute name="white-space">pre</xsl:attribute>
1759
- </xsl:otherwise>
1760
- </xsl:choose>
1761
- <xsl:apply-templates/>
1879
+ <xsl:template match="itu:quote">
1880
+ <fo:block margin-top="6pt" margin-left="12mm" margin-right="12mm">
1881
+ <xsl:apply-templates select=".//itu:p"/>
1762
1882
  </fo:block>
1883
+ <xsl:if test="itu:author or itu:source">
1884
+ <fo:block text-align="right">
1885
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1886
+ <xsl:text>— </xsl:text>
1887
+ <xsl:value-of select="itu:author"/>
1888
+ <xsl:if test="itu:author and itu:source">
1889
+ <xsl:text>, </xsl:text>
1890
+ </xsl:if>
1891
+ <xsl:apply-templates select="itu:source"/>
1892
+ </fo:block>
1893
+ </xsl:if>
1763
1894
  </xsl:template>
1764
1895
 
1896
+ <xsl:template match="itu:source">
1897
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1898
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1899
+ <xsl:apply-templates select="itu:localityStack"/>
1900
+ </fo:basic-link>
1901
+ </xsl:template>
1902
+
1765
1903
  <xsl:template name="insertHeaderFooter">
1766
1904
  <fo:static-content flow-name="footer-even" font-family="Times New Roman" font-size="11pt">
1767
1905
  <fo:block-container height="19mm" display-align="after">
@@ -2283,24 +2421,6 @@
2283
2421
  </xsl:if>
2284
2422
  </xsl:template>
2285
2423
 
2286
- <xsl:template name="getLevel">
2287
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2288
- <xsl:variable name="level">
2289
- <xsl:choose>
2290
- <xsl:when test="ancestor::itu:sections">
2291
- <xsl:value-of select="$level_total - 2"/>
2292
- </xsl:when>
2293
- <xsl:when test="ancestor::itu:bibliography">
2294
- <xsl:value-of select="$level_total - 2"/>
2295
- </xsl:when>
2296
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2297
- <xsl:otherwise>
2298
- <xsl:value-of select="$level_total - 1"/>
2299
- </xsl:otherwise>
2300
- </xsl:choose>
2301
- </xsl:variable>
2302
- <xsl:value-of select="$level"/>
2303
- </xsl:template>
2304
2424
 
2305
2425
  <xsl:template name="getSection">
2306
2426
  <xsl:param name="sectionNum"/>
@@ -2320,8 +2440,16 @@
2320
2440
  </xsl:when>
2321
2441
  <xsl:when test="$level &gt;= 2">
2322
2442
  <xsl:variable name="num">
2323
- <xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term | itu:clause/itu:term | itu:clause/itu:definitions"/>
2443
+ <xsl:call-template name="getSubSection"/>
2324
2444
  </xsl:variable>
2445
+ <!-- <xsl:variable name="sectionNum_">
2446
+ <xsl:choose>
2447
+ <xsl:when test="normalize-space($sectionNum) = ''"><xsl:number format="1" count="itu:sections/*"/></xsl:when>
2448
+ <xsl:otherwise>
2449
+ <xsl:value-of select="$sectionNum"/>
2450
+ </xsl:otherwise>
2451
+ </xsl:choose>
2452
+ </xsl:variable> -->
2325
2453
  <xsl:value-of select="concat($sectionNum, $num)"/>
2326
2454
  </xsl:when>
2327
2455
  <xsl:otherwise>
@@ -2331,8 +2459,13 @@
2331
2459
  </xsl:when>
2332
2460
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2333
2461
  <xsl:choose>
2334
- <xsl:when test="$level = 1">
2335
- <xsl:text>Appendix </xsl:text>
2462
+ <xsl:when test="$level = 1">
2463
+ <xsl:variable name="title-appendix">
2464
+ <xsl:call-template name="getTitle">
2465
+ <xsl:with-param name="name" select="'title-appendix'"/>
2466
+ </xsl:call-template>
2467
+ </xsl:variable>
2468
+ <xsl:value-of select="$title-appendix"/><xsl:text> </xsl:text>
2336
2469
  <xsl:number format="I" level="any" count="itu:annex[@obligation = 'informative']"/>
2337
2470
  </xsl:when>
2338
2471
  <xsl:otherwise>
@@ -2342,8 +2475,13 @@
2342
2475
  </xsl:when>
2343
2476
  <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2344
2477
  <xsl:choose>
2345
- <xsl:when test="$level = 1">
2346
- <xsl:text>Annex </xsl:text>
2478
+ <xsl:when test="$level = 1">
2479
+ <xsl:variable name="title-annex">
2480
+ <xsl:call-template name="getTitle">
2481
+ <xsl:with-param name="name" select="'title-annex'"/>
2482
+ </xsl:call-template>
2483
+ </xsl:variable>
2484
+ <xsl:value-of select="$title-annex"/>
2347
2485
  <xsl:choose>
2348
2486
  <xsl:when test="count(//itu:annex) = 1">
2349
2487
  <xsl:choose>
@@ -2390,98 +2528,279 @@
2390
2528
  </xsl:if>
2391
2529
  </xsl:template>
2392
2530
 
2393
- <xsl:template name="getId">
2531
+ <xsl:template name="getTopSection">
2532
+ <xsl:param name="sectionNum"/>
2533
+ <xsl:variable name="section">
2534
+ <xsl:call-template name="getSection">
2535
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
2536
+ </xsl:call-template>
2537
+ </xsl:variable>
2538
+ <xsl:variable name="topsection_" select="normalize-space(translate($section, '().-',' '))"/>
2394
2539
  <xsl:choose>
2395
- <xsl:when test="../@id">
2396
- <xsl:value-of select="../@id"/>
2540
+ <xsl:when test="contains($topsection_, ' ')">
2541
+ <xsl:value-of select="substring-before($topsection_, ' ')"/>
2397
2542
  </xsl:when>
2398
2543
  <xsl:otherwise>
2399
- <xsl:value-of select="concat(local-name(..), '_', text())"/>
2544
+ <xsl:value-of select="$topsection_"/>
2400
2545
  </xsl:otherwise>
2401
2546
  </xsl:choose>
2402
2547
  </xsl:template>
2403
2548
 
2404
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
2549
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2550
+
2551
+ <title-table lang="en">Table </title-table>
2552
+ <title-table lang="fr">Tableau </title-table>
2553
+
2554
+ <title-table lang="zh">Table </title-table>
2405
2555
 
2406
2556
 
2407
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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()">
2408
- <xsl:value-of select="."/>
2409
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
2410
- <xsl:value-of select="$linebreak"/>
2411
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
2412
- <xsl:call-template name="add-zero-spaces"/>
2413
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
2414
-
2415
- <xsl:variable name="simple-table">
2416
- <!-- <xsl:copy> -->
2417
- <xsl:call-template name="getSimpleTable"/>
2418
- <!-- </xsl:copy> -->
2419
- </xsl:variable>
2420
-
2421
- <!-- DEBUG -->
2422
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2423
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2424
2557
 
2425
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2558
+ <title-note lang="en">NOTE </title-note>
2559
+ <title-note lang="fr">NOTE </title-note>
2426
2560
 
2427
- <fo:block space-before="18pt"> </fo:block>
2561
+ <title-note lang="zh">NOTE </title-note>
2428
2562
 
2429
- <!-- <xsl:if test="$namespace = 'iso'">
2430
- <fo:block space-before="6pt">&#xA0;</fo:block>
2431
- </xsl:if> -->
2432
2563
 
2433
- <xsl:choose>
2434
- <xsl:when test="@unnumbered = 'true'"/>
2435
- <xsl:otherwise>
2436
-
2437
-
2564
+
2565
+ <title-figure lang="en">Figure </title-figure>
2566
+ <title-figure lang="fr">Figure </title-figure>
2567
+
2568
+ <title-figure lang="zh">Figure </title-figure>
2569
+
2570
+
2571
+
2572
+ <title-example lang="en">EXAMPLE </title-example>
2573
+ <title-example lang="fr">EXEMPLE </title-example>
2574
+
2575
+ <title-example lang="zh">EXAMPLE </title-example>
2576
+
2577
+
2578
+
2579
+ <title-example-xref lang="en">Example </title-example-xref>
2580
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2581
+
2582
+ <title-section lang="en">Section </title-section>
2583
+ <title-section lang="fr">Section </title-section>
2584
+
2585
+ <title-inequality lang="en">Inequality </title-inequality>
2586
+ <title-inequality lang="fr">Inequality </title-inequality>
2587
+
2588
+ <title-equation lang="en">Equation </title-equation>
2589
+ <title-equation lang="fr">Equation </title-equation>
2438
2590
 
2439
- <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2440
-
2441
-
2442
-
2443
-
2444
-
2445
-
2446
-
2447
- <xsl:text>Table </xsl:text>
2448
- <xsl:choose>
2449
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2450
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2451
- </xsl:when>
2452
- <xsl:when test="ancestor::*[local-name()='annex']">
2453
-
2454
-
2455
-
2456
-
2457
- <xsl:choose>
2458
- <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2459
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2460
- <!-- Table in Appendix -->
2461
- <xsl:number format="I-" count="itu:annex[@obligation = 'informative']"/>
2462
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2463
- </xsl:when>
2464
- <!-- Table in Annex -->
2465
- <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2466
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2467
- <xsl:number format="A-" count="itu:annex[not(@obligation) or @obligation != 'informative']"/>
2468
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2469
- </xsl:when>
2470
- </xsl:choose>
2471
-
2472
-
2473
-
2474
-
2475
-
2476
- </xsl:when>
2477
- <xsl:otherwise>
2478
-
2479
-
2480
- <xsl:number format="A." count="*[local-name()='annex']"/>
2481
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2482
-
2483
- </xsl:otherwise>
2484
- </xsl:choose>
2591
+ <title-annex lang="en">Annex </title-annex>
2592
+ <title-annex lang="fr">Annexe </title-annex>
2593
+
2594
+ <title-annex lang="zh">Annex </title-annex>
2595
+
2596
+
2597
+
2598
+ <title-appendix lang="en">Appendix </title-appendix>
2599
+ <title-appendix lang="fr">Appendix </title-appendix>
2600
+
2601
+ <title-clause lang="en">Clause </title-clause>
2602
+ <title-clause lang="fr">Article </title-clause>
2603
+
2604
+ <title-clause lang="zh">Clause </title-clause>
2605
+
2606
+
2607
+
2608
+ <title-edition lang="en">
2609
+
2610
+ <xsl:text>Edition </xsl:text>
2611
+
2612
+
2613
+ </title-edition>
2614
+
2615
+ <title-formula lang="en">Formula </title-formula>
2616
+ <title-formula lang="fr">Formula </title-formula>
2617
+
2618
+ <title-toc lang="en">
2619
+
2620
+
2621
+ <xsl:text>Table of Contents</xsl:text>
2622
+
2623
+
2624
+ </title-toc>
2625
+ <title-toc lang="fr">Sommaire</title-toc>
2626
+
2627
+ <title-toc lang="zh">Contents</title-toc>
2628
+
2629
+
2630
+
2631
+ <title-page lang="en">Page</title-page>
2632
+ <title-page lang="fr">Page</title-page>
2633
+
2634
+ <title-key lang="en">Key</title-key>
2635
+ <title-key lang="fr">Légende</title-key>
2636
+
2637
+ <title-where lang="en">where</title-where>
2638
+ <title-where lang="fr">où</title-where>
2639
+
2640
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2641
+
2642
+ <title-part lang="en">
2643
+
2644
+
2645
+ </title-part>
2646
+ <title-part lang="fr">
2647
+
2648
+
2649
+ </title-part>
2650
+ <title-part lang="zh">第 # 部分:</title-part>
2651
+
2652
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2653
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2654
+
2655
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2656
+
2657
+
2658
+
2659
+ <title-modified lang="en">modified</title-modified>
2660
+ <title-modified lang="fr">modifiée</title-modified>
2661
+
2662
+ <title-modified lang="zh">modified</title-modified>
2663
+
2664
+
2665
+
2666
+ <title-source lang="en">SOURCE</title-source>
2667
+
2668
+ <title-keywords lang="en">Keywords</title-keywords>
2669
+
2670
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2671
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2672
+
2673
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2674
+
2675
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2676
+
2677
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2678
+
2679
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2680
+
2681
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2682
+
2683
+ <title-abstract lang="en">Abstract</title-abstract>
2684
+
2685
+ <title-summary lang="en">Summary</title-summary>
2686
+
2687
+ <title-in lang="en">in </title-in>
2688
+
2689
+ <title-box lang="en">Box </title-box>
2690
+
2691
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2692
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2693
+
2694
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2695
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2696
+
2697
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2698
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2699
+
2700
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2701
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2702
+
2703
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2704
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2705
+
2706
+ <title-caution lang="en">CAUTION</title-caution>
2707
+ <title-caution lang="zh">注意</title-caution>
2708
+
2709
+ <title-warning lang="en">WARNING</title-warning>
2710
+ <title-warning lang="zh">警告</title-warning>
2711
+
2712
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2713
+ </xsl:variable><xsl:template name="getTitle">
2714
+ <xsl:param name="name"/>
2715
+ <xsl:variable name="lang">
2716
+ <xsl:call-template name="getLang"/>
2717
+ </xsl:variable>
2718
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2719
+ <xsl:choose>
2720
+ <xsl:when test="normalize-space($title_) != ''">
2721
+ <xsl:value-of select="$title_"/>
2722
+ </xsl:when>
2723
+ <xsl:otherwise>
2724
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2725
+ </xsl:otherwise>
2726
+ </xsl:choose>
2727
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2728
+
2729
+
2730
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2737
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2738
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2739
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2740
+
2741
+
2742
+
2743
+
2744
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2745
+
2746
+
2747
+
2748
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2749
+
2750
+
2751
+
2752
+ </xsl:attribute-set><xsl:template match="text()">
2753
+ <xsl:value-of select="."/>
2754
+ </xsl:template><xsl:template match="*[local-name()='br']">
2755
+ <xsl:value-of select="$linebreak"/>
2756
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2757
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2758
+ <xsl:call-template name="add-zero-spaces-java"/>
2759
+ </xsl:template><xsl:template match="*[local-name()='table']">
2760
+
2761
+ <xsl:variable name="simple-table">
2762
+ <!-- <xsl:copy> -->
2763
+ <xsl:call-template name="getSimpleTable"/>
2764
+ <!-- </xsl:copy> -->
2765
+ </xsl:variable>
2766
+
2767
+ <!-- DEBUG -->
2768
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2769
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2770
+
2771
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2772
+
2773
+ <fo:block space-before="18pt"> </fo:block>
2774
+
2775
+ <!-- <xsl:if test="$namespace = 'iso'">
2776
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2777
+ </xsl:if> -->
2778
+
2779
+ <xsl:choose>
2780
+ <xsl:when test="@unnumbered = 'true'"/>
2781
+ <xsl:otherwise>
2782
+
2783
+
2784
+
2785
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2786
+
2787
+
2788
+
2789
+
2790
+
2791
+
2792
+
2793
+
2794
+ <xsl:variable name="title-table">
2795
+ <xsl:call-template name="getTitle">
2796
+ <xsl:with-param name="name" select="'title-table'"/>
2797
+ </xsl:call-template>
2798
+ </xsl:variable>
2799
+ <xsl:value-of select="$title-table"/>
2800
+
2801
+ <xsl:call-template name="getTableNumber"/>
2802
+
2803
+
2485
2804
  <xsl:if test="*[local-name()='name']">
2486
2805
 
2487
2806
 
@@ -2557,6 +2876,7 @@
2557
2876
 
2558
2877
 
2559
2878
 
2879
+
2560
2880
  <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">
2561
2881
 
2562
2882
 
@@ -2573,9 +2893,10 @@
2573
2893
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2574
2894
 
2575
2895
 
2896
+
2576
2897
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2577
2898
  <xsl:choose>
2578
- <xsl:when test=". = 1">
2899
+ <xsl:when test=". = 1 or . = 0">
2579
2900
  <fo:table-column column-width="proportional-column-width(2)"/>
2580
2901
  </xsl:when>
2581
2902
  <xsl:otherwise>
@@ -2583,21 +2904,68 @@
2583
2904
  </xsl:otherwise>
2584
2905
  </xsl:choose>
2585
2906
  </xsl:for-each>
2586
- <xsl:apply-templates/>
2907
+
2908
+ <xsl:choose>
2909
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2910
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2911
+ </xsl:when>
2912
+ <xsl:otherwise>
2913
+ <xsl:apply-templates/>
2914
+ </xsl:otherwise>
2915
+ </xsl:choose>
2916
+
2587
2917
  </fo:table>
2588
2918
 
2589
2919
 
2590
2920
 
2591
2921
  </fo:block-container>
2592
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
2922
+ </xsl:template><xsl:template name="getTableNumber">
2923
+ <xsl:choose>
2924
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2925
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2926
+ </xsl:when>
2927
+ <xsl:when test="ancestor::*[local-name()='annex']">
2928
+
2929
+
2930
+
2931
+
2932
+ <xsl:choose>
2933
+ <xsl:when test="ancestor::*[local-name()='annex'][@obligation = 'informative']">
2934
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2935
+ <!-- Table in Appendix -->
2936
+ <xsl:number format="I-" count="*[local-name()='annex'][@obligation = 'informative']"/>
2937
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2938
+ </xsl:when>
2939
+ <!-- Table in Annex -->
2940
+ <xsl:when test="ancestor::*[local-name()='annex'][not(@obligation) or @obligation != 'informative']">
2941
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2942
+ <xsl:number format="A-" count="*[local-name()='annex'][not(@obligation) or @obligation != 'informative']"/>
2943
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2944
+ </xsl:when>
2945
+ </xsl:choose>
2946
+
2947
+
2948
+
2949
+
2950
+
2951
+ </xsl:when>
2952
+ <xsl:otherwise>
2953
+
2954
+
2955
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2956
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2957
+
2958
+ </xsl:otherwise>
2959
+ </xsl:choose>
2960
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2593
2961
  <xsl:apply-templates/>
2594
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
2962
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2595
2963
  <xsl:param name="table-row"/>
2596
2964
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2597
2965
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2598
2966
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2599
2967
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2600
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
2968
+ </xsl:template><xsl:template name="calculate-column-widths">
2601
2969
  <xsl:param name="table"/>
2602
2970
  <xsl:param name="cols-count"/>
2603
2971
  <xsl:param name="curr-col" select="1"/>
@@ -2606,7 +2974,7 @@
2606
2974
  <xsl:if test="$curr-col &lt;= $cols-count">
2607
2975
  <xsl:variable name="widths">
2608
2976
  <xsl:choose>
2609
- <xsl:when test="not($table)">
2977
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2610
2978
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2611
2979
  <xsl:variable name="words">
2612
2980
  <xsl:call-template name="tokenize">
@@ -2645,9 +3013,16 @@
2645
3013
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2646
3014
  </xsl:variable>
2647
3015
  <xsl:variable name="words">
3016
+ <xsl:variable name="string_with_added_zerospaces">
3017
+ <xsl:call-template name="add-zero-spaces-java">
3018
+ <xsl:with-param name="text" select="$td_text"/>
3019
+ </xsl:call-template>
3020
+ </xsl:variable>
2648
3021
  <xsl:call-template name="tokenize">
2649
3022
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2650
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
3023
+ <!-- 2009 thinspace -->
3024
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3025
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2651
3026
  </xsl:call-template>
2652
3027
  </xsl:variable>
2653
3028
  <xsl:variable name="max_length">
@@ -2688,17 +3063,28 @@
2688
3063
  <xsl:with-param name="table" select="$table"/>
2689
3064
  </xsl:call-template>
2690
3065
  </xsl:if>
2691
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3066
+ </xsl:template><xsl:template match="text()" mode="td_text">
2692
3067
  <xsl:variable name="zero-space">​</xsl:variable>
2693
3068
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2694
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3069
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3070
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3071
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3072
+ <xsl:value-of select="@target"/>
3073
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3074
+ <xsl:param name="cols-count"/>
2695
3075
  <!-- font-weight="bold" -->
2696
- <fo:table-header>
3076
+ <fo:table-header>
3077
+
2697
3078
  <xsl:apply-templates/>
2698
3079
  </fo:table-header>
2699
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3080
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3081
+ <fo:table-body>
3082
+ <xsl:apply-templates/>
3083
+ </fo:table-body>
3084
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2700
3085
  <xsl:apply-templates/>
2701
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3086
+ </xsl:template><xsl:template name="insertTableFooter">
3087
+ <xsl:param name="cols-count"/>
2702
3088
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2703
3089
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2704
3090
 
@@ -2709,22 +3095,7 @@
2709
3095
  <!-- if there are note(s) or fn(s) then create footer row -->
2710
3096
  <xsl:if test="$isNoteOrFnExist = 'true'">
2711
3097
 
2712
- <xsl:variable name="cols-count">
2713
- <xsl:choose>
2714
- <xsl:when test="../*[local-name()='thead']">
2715
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2716
- <xsl:call-template name="calculate-columns-numbers">
2717
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2718
- </xsl:call-template>
2719
- </xsl:when>
2720
- <xsl:otherwise>
2721
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2722
- <xsl:call-template name="calculate-columns-numbers">
2723
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2724
- </xsl:call-template>
2725
- </xsl:otherwise>
2726
- </xsl:choose>
2727
- </xsl:variable>
3098
+
2728
3099
 
2729
3100
  <fo:table-row>
2730
3101
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2756,11 +3127,30 @@
2756
3127
  </fo:table-footer>
2757
3128
 
2758
3129
  </xsl:if>
2759
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3130
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2760
3131
 
2761
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3132
+ <xsl:variable name="cols-count">
3133
+ <xsl:choose>
3134
+ <xsl:when test="../*[local-name()='thead']">
3135
+ <xsl:call-template name="calculate-columns-numbers">
3136
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3137
+ </xsl:call-template>
3138
+ </xsl:when>
3139
+ <xsl:otherwise>
3140
+ <xsl:call-template name="calculate-columns-numbers">
3141
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3142
+ </xsl:call-template>
3143
+ </xsl:otherwise>
3144
+ </xsl:choose>
3145
+ </xsl:variable>
2762
3146
 
2763
- <xsl:call-template name="insertTableFooter"/>
3147
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3148
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3149
+ </xsl:apply-templates>
3150
+
3151
+ <xsl:call-template name="insertTableFooter">
3152
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3153
+ </xsl:call-template>
2764
3154
 
2765
3155
  <fo:table-body>
2766
3156
  <xsl:apply-templates/>
@@ -2768,7 +3158,7 @@
2768
3158
 
2769
3159
  </fo:table-body>
2770
3160
 
2771
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3161
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2772
3162
  <xsl:variable name="parent-name" select="local-name(..)"/>
2773
3163
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2774
3164
  <fo:table-row min-height="4mm">
@@ -2788,7 +3178,7 @@
2788
3178
 
2789
3179
  <xsl:apply-templates/>
2790
3180
  </fo:table-row>
2791
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3181
+ </xsl:template><xsl:template match="*[local-name()='th']">
2792
3182
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2793
3183
 
2794
3184
 
@@ -2815,7 +3205,7 @@
2815
3205
  <xsl:apply-templates/>
2816
3206
  </fo:block>
2817
3207
  </fo:table-cell>
2818
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3208
+ </xsl:template><xsl:template match="*[local-name()='td']">
2819
3209
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2820
3210
 
2821
3211
 
@@ -2842,6 +3232,7 @@
2842
3232
  </xsl:attribute>
2843
3233
  </xsl:if>
2844
3234
  <fo:block>
3235
+
2845
3236
  <xsl:apply-templates/>
2846
3237
  </fo:block>
2847
3238
  <!-- <xsl:choose>
@@ -2857,16 +3248,24 @@
2857
3248
 
2858
3249
 
2859
3250
  </fo:table-cell>
2860
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3251
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2861
3252
 
2862
3253
 
2863
3254
  <fo:block font-size="10pt" margin-bottom="12pt">
2864
3255
 
2865
3256
 
2866
3257
 
3258
+
2867
3259
  <fo:inline padding-right="2mm">
2868
3260
 
2869
- <xsl:text>NOTE </xsl:text>
3261
+
3262
+
3263
+ <xsl:variable name="title-note">
3264
+ <xsl:call-template name="getTitle">
3265
+ <xsl:with-param name="name" select="'title-note'"/>
3266
+ </xsl:call-template>
3267
+ </xsl:variable>
3268
+ <xsl:value-of select="$title-note"/>
2870
3269
 
2871
3270
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2872
3271
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -2880,9 +3279,9 @@
2880
3279
  <xsl:apply-templates mode="process"/>
2881
3280
  </fo:block>
2882
3281
 
2883
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3282
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2884
3283
  <xsl:apply-templates/>
2885
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3284
+ </xsl:template><xsl:template name="fn_display">
2886
3285
  <xsl:variable name="references">
2887
3286
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2888
3287
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2903,6 +3302,12 @@
2903
3302
 
2904
3303
 
2905
3304
 
3305
+
3306
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
3307
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
3308
+ <xsl:attribute name="text-indent">-5mm</xsl:attribute>
3309
+ <xsl:attribute name="start-indent">5mm</xsl:attribute>
3310
+
2906
3311
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2907
3312
 
2908
3313
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2912,6 +3317,7 @@
2912
3317
 
2913
3318
 
2914
3319
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
3320
+ <xsl:attribute name="font-size">70%</xsl:attribute>
2915
3321
 
2916
3322
 
2917
3323
  <xsl:value-of select="@reference"/>
@@ -2928,7 +3334,7 @@
2928
3334
  </fo:block>
2929
3335
  </xsl:if>
2930
3336
  </xsl:for-each>
2931
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3337
+ </xsl:template><xsl:template name="fn_name_display">
2932
3338
  <!-- <xsl:variable name="references">
2933
3339
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2934
3340
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2944,7 +3350,7 @@
2944
3350
  <xsl:apply-templates/>
2945
3351
  </fo:block>
2946
3352
  </xsl:for-each>
2947
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3353
+ </xsl:template><xsl:template name="fn_display_figure">
2948
3354
  <xsl:variable name="key_iso">
2949
3355
  <!-- and (not(@class) or @class !='pseudocode') -->
2950
3356
  </xsl:variable>
@@ -2955,6 +3361,36 @@
2955
3361
  </fn>
2956
3362
  </xsl:for-each>
2957
3363
  </xsl:variable>
3364
+
3365
+ <!-- current hierarchy is 'figure' element -->
3366
+ <xsl:variable name="following_dl_colwidths">
3367
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3368
+ <xsl:variable name="html-table">
3369
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3370
+ <xsl:element name="{$ns}:table">
3371
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3372
+ <tbody>
3373
+ <xsl:apply-templates mode="dl"/>
3374
+ </tbody>
3375
+ </xsl:for-each>
3376
+ </xsl:element>
3377
+ </xsl:variable>
3378
+
3379
+ <xsl:call-template name="calculate-column-widths">
3380
+ <xsl:with-param name="cols-count" select="2"/>
3381
+ <xsl:with-param name="table" select="$html-table"/>
3382
+ </xsl:call-template>
3383
+
3384
+ </xsl:if>
3385
+ </xsl:variable>
3386
+
3387
+
3388
+ <xsl:variable name="maxlength_dt">
3389
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3390
+ <xsl:call-template name="getMaxLength_dt"/>
3391
+ </xsl:for-each>
3392
+ </xsl:variable>
3393
+
2958
3394
  <xsl:if test="xalan:nodeset($references)//fn">
2959
3395
  <fo:block>
2960
3396
  <fo:table width="95%" table-layout="fixed">
@@ -2962,8 +3398,19 @@
2962
3398
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2963
3399
 
2964
3400
  </xsl:if>
2965
- <fo:table-column column-width="15%"/>
2966
- <fo:table-column column-width="85%"/>
3401
+ <xsl:choose>
3402
+ <!-- if there 'dl', then set same columns width -->
3403
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3404
+ <xsl:call-template name="setColumnWidth_dl">
3405
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3406
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3407
+ </xsl:call-template>
3408
+ </xsl:when>
3409
+ <xsl:otherwise>
3410
+ <fo:table-column column-width="15%"/>
3411
+ <fo:table-column column-width="85%"/>
3412
+ </xsl:otherwise>
3413
+ </xsl:choose>
2967
3414
  <fo:table-body>
2968
3415
  <xsl:for-each select="xalan:nodeset($references)//fn">
2969
3416
  <xsl:variable name="reference" select="@reference"/>
@@ -2995,7 +3442,7 @@
2995
3442
  </fo:block>
2996
3443
  </xsl:if>
2997
3444
 
2998
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3445
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2999
3446
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3000
3447
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3001
3448
 
@@ -3010,11 +3457,11 @@
3010
3457
  <xsl:value-of select="@reference"/>
3011
3458
  </fo:basic-link>
3012
3459
  </fo:inline>
3013
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3460
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3014
3461
  <fo:inline>
3015
3462
  <xsl:apply-templates/>
3016
3463
  </fo:inline>
3017
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3464
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3018
3465
  <xsl:variable name="parent" select="local-name(..)"/>
3019
3466
 
3020
3467
  <xsl:variable name="key_iso">
@@ -3026,8 +3473,13 @@
3026
3473
 
3027
3474
 
3028
3475
  <fo:block margin-bottom="12pt" text-align="left">
3029
-
3030
- <xsl:text>where </xsl:text>
3476
+
3477
+ <xsl:variable name="title-where">
3478
+ <xsl:call-template name="getTitle">
3479
+ <xsl:with-param name="name" select="'title-where'"/>
3480
+ </xsl:call-template>
3481
+ </xsl:variable>
3482
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3031
3483
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3032
3484
  <xsl:text/>
3033
3485
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3042,15 +3494,25 @@
3042
3494
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3043
3495
 
3044
3496
 
3045
- <xsl:text>where</xsl:text>
3497
+ <xsl:variable name="title-where">
3498
+ <xsl:call-template name="getTitle">
3499
+ <xsl:with-param name="name" select="'title-where'"/>
3500
+ </xsl:call-template>
3501
+ </xsl:variable>
3502
+ <xsl:value-of select="$title-where"/>:
3046
3503
  </fo:block>
3047
3504
  </xsl:when>
3048
3505
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3049
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3506
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3050
3507
 
3051
3508
 
3052
3509
 
3053
- <xsl:text>Key</xsl:text>
3510
+ <xsl:variable name="title-key">
3511
+ <xsl:call-template name="getTitle">
3512
+ <xsl:with-param name="name" select="'title-key'"/>
3513
+ </xsl:call-template>
3514
+ </xsl:variable>
3515
+ <xsl:value-of select="$title-key"/>
3054
3516
  </fo:block>
3055
3517
  </xsl:when>
3056
3518
  </xsl:choose>
@@ -3060,31 +3522,19 @@
3060
3522
  <fo:block>
3061
3523
 
3062
3524
 
3063
- <xsl:if test="local-name(..) = 'li'">
3064
- <xsl:attribute name="margin-left">-4mm</xsl:attribute>
3525
+ <xsl:if test="$parent = 'figure' or $parent = 'formula'">
3526
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
3065
3527
  </xsl:if>
3528
+ <xsl:if test="$parent = 'li'">
3529
+ <!-- <xsl:attribute name="margin-left">-4mm</xsl:attribute> -->
3530
+ </xsl:if>
3531
+
3066
3532
 
3067
3533
 
3068
3534
  <fo:block>
3069
3535
 
3070
3536
 
3071
- <!-- create virtual html table for dl/[dt and dd] -->
3072
- <xsl:variable name="html-table">
3073
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3074
- <xsl:element name="{$ns}:table">
3075
- <tbody>
3076
- <xsl:apply-templates mode="dl"/>
3077
- </tbody>
3078
- </xsl:element>
3079
- </xsl:variable>
3080
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3081
- <xsl:variable name="colwidths">
3082
- <xsl:call-template name="calculate-column-widths">
3083
- <xsl:with-param name="cols-count" select="2"/>
3084
- <xsl:with-param name="table" select="$html-table"/>
3085
- </xsl:call-template>
3086
- </xsl:variable>
3087
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3537
+
3088
3538
 
3089
3539
  <fo:table width="95%" table-layout="fixed">
3090
3540
 
@@ -3097,42 +3547,30 @@
3097
3547
 
3098
3548
  </xsl:when>
3099
3549
  </xsl:choose>
3100
- <xsl:choose>
3101
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3102
- <fo:table-column column-width="50%"/>
3103
- <fo:table-column column-width="50%"/>
3104
- </xsl:when>
3105
- <xsl:otherwise>
3106
- <xsl:choose>
3107
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3108
- <fo:table-column column-width="60%"/>
3109
- <fo:table-column column-width="40%"/>
3110
- </xsl:when> -->
3111
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3112
- <fo:table-column column-width="50%"/>
3113
- <fo:table-column column-width="50%"/>
3114
- </xsl:when>
3115
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3116
- <fo:table-column column-width="40%"/>
3117
- <fo:table-column column-width="60%"/>
3118
- </xsl:when>
3119
- <xsl:otherwise>
3120
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3121
- <xsl:choose>
3122
- <xsl:when test=". = 1">
3123
- <fo:table-column column-width="proportional-column-width(2)"/>
3124
- </xsl:when>
3125
- <xsl:otherwise>
3126
- <fo:table-column column-width="proportional-column-width({.})"/>
3127
- </xsl:otherwise>
3128
- </xsl:choose>
3129
- </xsl:for-each>
3130
- </xsl:otherwise>
3131
- </xsl:choose>
3132
- <!-- <fo:table-column column-width="15%"/>
3133
- <fo:table-column column-width="85%"/> -->
3134
- </xsl:otherwise>
3135
- </xsl:choose>
3550
+ <!-- create virtual html table for dl/[dt and dd] -->
3551
+ <xsl:variable name="html-table">
3552
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3553
+ <xsl:element name="{$ns}:table">
3554
+ <tbody>
3555
+ <xsl:apply-templates mode="dl"/>
3556
+ </tbody>
3557
+ </xsl:element>
3558
+ </xsl:variable>
3559
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3560
+ <xsl:variable name="colwidths">
3561
+ <xsl:call-template name="calculate-column-widths">
3562
+ <xsl:with-param name="cols-count" select="2"/>
3563
+ <xsl:with-param name="table" select="$html-table"/>
3564
+ </xsl:call-template>
3565
+ </xsl:variable>
3566
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3567
+ <xsl:variable name="maxlength_dt">
3568
+ <xsl:call-template name="getMaxLength_dt"/>
3569
+ </xsl:variable>
3570
+ <xsl:call-template name="setColumnWidth_dl">
3571
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3572
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3573
+ </xsl:call-template>
3136
3574
  <fo:table-body>
3137
3575
  <xsl:apply-templates>
3138
3576
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3142,7 +3580,61 @@
3142
3580
  </fo:block>
3143
3581
  </fo:block>
3144
3582
  </xsl:if>
3145
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
3583
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3584
+ <xsl:param name="colwidths"/>
3585
+ <xsl:param name="maxlength_dt"/>
3586
+ <xsl:choose>
3587
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3588
+ <fo:table-column column-width="50%"/>
3589
+ <fo:table-column column-width="50%"/>
3590
+ </xsl:when>
3591
+ <xsl:otherwise>
3592
+ <xsl:choose>
3593
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3594
+ <fo:table-column column-width="5%"/>
3595
+ <fo:table-column column-width="95%"/>
3596
+ </xsl:when>
3597
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3598
+ <fo:table-column column-width="10%"/>
3599
+ <fo:table-column column-width="90%"/>
3600
+ </xsl:when>
3601
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3602
+ <fo:table-column column-width="60%"/>
3603
+ <fo:table-column column-width="40%"/>
3604
+ </xsl:when> -->
3605
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3606
+ <fo:table-column column-width="50%"/>
3607
+ <fo:table-column column-width="50%"/>
3608
+ </xsl:when>
3609
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3610
+ <fo:table-column column-width="40%"/>
3611
+ <fo:table-column column-width="60%"/>
3612
+ </xsl:when>
3613
+ <xsl:otherwise>
3614
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3615
+ <xsl:choose>
3616
+ <xsl:when test=". = 1 or . = 0">
3617
+ <fo:table-column column-width="proportional-column-width(2)"/>
3618
+ </xsl:when>
3619
+ <xsl:otherwise>
3620
+ <fo:table-column column-width="proportional-column-width({.})"/>
3621
+ </xsl:otherwise>
3622
+ </xsl:choose>
3623
+ </xsl:for-each>
3624
+ </xsl:otherwise>
3625
+ </xsl:choose>
3626
+ <!-- <fo:table-column column-width="15%"/>
3627
+ <fo:table-column column-width="85%"/> -->
3628
+ </xsl:otherwise>
3629
+ </xsl:choose>
3630
+ </xsl:template><xsl:template name="getMaxLength_dt">
3631
+ <xsl:for-each select="*[local-name()='dt']">
3632
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3633
+ <xsl:if test="position() = 1">
3634
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3635
+ </xsl:if>
3636
+ </xsl:for-each>
3637
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3146
3638
  <xsl:param name="key_iso"/>
3147
3639
 
3148
3640
  <!-- <tr>
@@ -3158,7 +3650,12 @@
3158
3650
  <xsl:if test="normalize-space($key_iso) = 'true'">
3159
3651
  <xsl:attribute name="margin-top">0</xsl:attribute>
3160
3652
  </xsl:if>
3161
- NOTE
3653
+ <xsl:variable name="title-note">
3654
+ <xsl:call-template name="getTitle">
3655
+ <xsl:with-param name="name" select="'title-note'"/>
3656
+ </xsl:call-template>
3657
+ </xsl:variable>
3658
+ <xsl:value-of select="$title-note"/>
3162
3659
  </fo:block>
3163
3660
  </fo:table-cell>
3164
3661
  <fo:table-cell>
@@ -3167,7 +3664,7 @@
3167
3664
  </fo:block>
3168
3665
  </fo:table-cell>
3169
3666
  </fo:table-row>
3170
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
3667
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3171
3668
  <tr>
3172
3669
  <td>
3173
3670
  <xsl:apply-templates/>
@@ -3180,11 +3677,16 @@
3180
3677
  </td>
3181
3678
  </tr>
3182
3679
 
3183
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
3680
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3184
3681
  <xsl:param name="key_iso"/>
3185
3682
 
3186
3683
  <fo:table-row>
3187
3684
  <fo:table-cell>
3685
+
3686
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3687
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
3688
+ </xsl:if>
3689
+
3188
3690
  <fo:block margin-top="6pt">
3189
3691
 
3190
3692
 
@@ -3194,8 +3696,19 @@
3194
3696
  </xsl:if>
3195
3697
 
3196
3698
 
3197
- <xsl:apply-templates/>
3198
3699
 
3700
+
3701
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3702
+ <xsl:attribute name="text-align">right</xsl:attribute>
3703
+ </xsl:if>
3704
+
3705
+
3706
+ <xsl:apply-templates/>
3707
+ <!-- <xsl:if test="$namespace = 'gb'">
3708
+ <xsl:if test="ancestor::*[local-name()='formula']">
3709
+ <xsl:text>—</xsl:text>
3710
+ </xsl:if>
3711
+ </xsl:if> -->
3199
3712
  </fo:block>
3200
3713
  </fo:table-cell>
3201
3714
  <fo:table-cell>
@@ -3211,37 +3724,37 @@
3211
3724
  </fo:table-cell>
3212
3725
  </fo:table-row>
3213
3726
 
3214
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
3727
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3215
3728
  <xsl:apply-templates/>
3216
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3729
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3217
3730
  <xsl:apply-templates/>
3218
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
3731
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3219
3732
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3220
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
3733
+ </xsl:template><xsl:template match="*[local-name()='em']">
3221
3734
  <fo:inline font-style="italic">
3222
3735
  <xsl:apply-templates/>
3223
3736
  </fo:inline>
3224
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
3737
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3225
3738
  <fo:inline font-weight="bold">
3226
3739
  <xsl:apply-templates/>
3227
3740
  </fo:inline>
3228
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
3741
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3229
3742
  <fo:inline font-size="80%" vertical-align="super">
3230
3743
  <xsl:apply-templates/>
3231
3744
  </fo:inline>
3232
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
3745
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3233
3746
  <fo:inline font-size="80%" vertical-align="sub">
3234
3747
  <xsl:apply-templates/>
3235
3748
  </fo:inline>
3236
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3237
- <fo:inline font-family="Courier" font-size="10pt">
3749
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3750
+ <fo:inline font-family="Courier" font-size="10pt">
3238
3751
  <xsl:apply-templates/>
3239
3752
  </fo:inline>
3240
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
3753
+ </xsl:template><xsl:template match="*[local-name()='del']">
3241
3754
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3242
3755
  <xsl:apply-templates/>
3243
3756
  </fo:inline>
3244
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
3757
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3245
3758
  <xsl:variable name="text" select="normalize-space(.)"/>
3246
3759
  <fo:inline font-size="75%">
3247
3760
  <xsl:if test="string-length($text) &gt; 0">
@@ -3250,10 +3763,11 @@
3250
3763
  </xsl:call-template>
3251
3764
  </xsl:if>
3252
3765
  </fo:inline>
3253
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
3766
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3254
3767
  <xsl:param name="text"/>
3255
3768
  <xsl:variable name="char" select="substring($text,1,1)"/>
3256
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3769
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3770
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3257
3771
  <xsl:choose>
3258
3772
  <xsl:when test="$char=$upperCase">
3259
3773
  <fo:inline font-size="{100 div 0.75}%">
@@ -3269,7 +3783,7 @@
3269
3783
  <xsl:with-param name="text" select="substring($text,2)"/>
3270
3784
  </xsl:call-template>
3271
3785
  </xsl:if>
3272
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
3786
+ </xsl:template><xsl:template name="tokenize">
3273
3787
  <xsl:param name="text"/>
3274
3788
  <xsl:param name="separator" select="' '"/>
3275
3789
  <xsl:choose>
@@ -3317,7 +3831,7 @@
3317
3831
  </xsl:call-template>
3318
3832
  </xsl:otherwise>
3319
3833
  </xsl:choose>
3320
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
3834
+ </xsl:template><xsl:template name="max_length">
3321
3835
  <xsl:param name="words"/>
3322
3836
  <xsl:for-each select="$words//word">
3323
3837
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3325,7 +3839,11 @@
3325
3839
  <xsl:value-of select="."/>
3326
3840
  </xsl:if>
3327
3841
  </xsl:for-each>
3328
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
3842
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3843
+ <xsl:param name="text" select="."/>
3844
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3845
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3846
+ </xsl:template><xsl:template name="add-zero-spaces">
3329
3847
  <xsl:param name="text" select="."/>
3330
3848
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3331
3849
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3378,7 +3896,7 @@
3378
3896
  <xsl:value-of select="$text"/>
3379
3897
  </xsl:otherwise>
3380
3898
  </xsl:choose>
3381
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
3899
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3382
3900
  <xsl:param name="text" select="."/>
3383
3901
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3384
3902
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3404,7 +3922,7 @@
3404
3922
  <xsl:value-of select="$text"/>
3405
3923
  </xsl:otherwise>
3406
3924
  </xsl:choose>
3407
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
3925
+ </xsl:template><xsl:template name="getSimpleTable">
3408
3926
  <xsl:variable name="simple-table">
3409
3927
 
3410
3928
  <!-- Step 1. colspan processing -->
@@ -3431,9 +3949,9 @@
3431
3949
  </xsl:choose> -->
3432
3950
  </xsl:variable>
3433
3951
  <xsl:copy-of select="$simple-table"/>
3434
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3952
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3435
3953
  <xsl:apply-templates mode="simple-table-colspan"/>
3436
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3954
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3437
3955
  <xsl:choose>
3438
3956
  <xsl:when test="@colspan">
3439
3957
  <xsl:variable name="td">
@@ -3455,16 +3973,16 @@
3455
3973
  </xsl:element>
3456
3974
  </xsl:otherwise>
3457
3975
  </xsl:choose>
3458
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
3976
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3459
3977
  <xsl:element name="tr">
3460
3978
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3461
3979
  <xsl:apply-templates mode="simple-table-colspan"/>
3462
3980
  </xsl:element>
3463
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
3981
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3464
3982
  <xsl:copy>
3465
3983
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3466
3984
  </xsl:copy>
3467
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
3985
+ </xsl:template><xsl:template name="repeatNode">
3468
3986
  <xsl:param name="count"/>
3469
3987
  <xsl:param name="node"/>
3470
3988
 
@@ -3475,18 +3993,18 @@
3475
3993
  </xsl:call-template>
3476
3994
  <xsl:copy-of select="$node"/>
3477
3995
  </xsl:if>
3478
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
3996
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3479
3997
  <xsl:copy>
3480
3998
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3481
3999
  </xsl:copy>
3482
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
4000
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3483
4001
  <xsl:copy>
3484
4002
  <xsl:copy-of select="tr[1]"/>
3485
4003
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3486
4004
  <xsl:with-param name="previousRow" select="tr[1]"/>
3487
4005
  </xsl:apply-templates>
3488
4006
  </xsl:copy>
3489
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4007
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3490
4008
  <xsl:param name="previousRow"/>
3491
4009
  <xsl:variable name="currentRow" select="."/>
3492
4010
 
@@ -3520,43 +4038,53 @@
3520
4038
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3521
4039
  <xsl:with-param name="previousRow" select="$newRow"/>
3522
4040
  </xsl:apply-templates>
3523
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4041
+ </xsl:template><xsl:template name="getLang">
3524
4042
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3525
4043
  <xsl:choose>
3526
4044
  <xsl:when test="$language = 'English'">en</xsl:when>
3527
4045
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3528
4046
  </xsl:choose>
3529
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4047
+ </xsl:template><xsl:template name="capitalizeWords">
3530
4048
  <xsl:param name="str"/>
3531
4049
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3532
4050
  <xsl:choose>
3533
4051
  <xsl:when test="contains($str2, ' ')">
3534
4052
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3535
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3536
- <xsl:value-of select="substring($substr, 2)"/>
4053
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4054
+ <xsl:value-of select="substring($substr, 2)"/> -->
4055
+ <xsl:call-template name="capitalize">
4056
+ <xsl:with-param name="str" select="$substr"/>
4057
+ </xsl:call-template>
3537
4058
  <xsl:text> </xsl:text>
3538
4059
  <xsl:call-template name="capitalizeWords">
3539
4060
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3540
4061
  </xsl:call-template>
3541
4062
  </xsl:when>
3542
4063
  <xsl:otherwise>
3543
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3544
- <xsl:value-of select="substring($str2, 2)"/>
4064
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4065
+ <xsl:value-of select="substring($str2, 2)"/> -->
4066
+ <xsl:call-template name="capitalize">
4067
+ <xsl:with-param name="str" select="$str2"/>
4068
+ </xsl:call-template>
3545
4069
  </xsl:otherwise>
3546
4070
  </xsl:choose>
3547
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4071
+ </xsl:template><xsl:template name="capitalize">
4072
+ <xsl:param name="str"/>
4073
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4074
+ <xsl:value-of select="substring($str, 2)"/>
4075
+ </xsl:template><xsl:template match="mathml:math">
3548
4076
  <fo:inline font-family="STIX2Math">
3549
4077
  <fo:instream-foreign-object fox:alt-text="Math">
3550
4078
  <xsl:copy-of select="."/>
3551
4079
  </fo:instream-foreign-object>
3552
4080
  </fo:inline>
3553
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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']">
4081
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3554
4082
  <xsl:for-each select="*[local-name()='locality']">
3555
4083
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3556
4084
  <xsl:apply-templates select="."/>
3557
4085
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3558
4086
  </xsl:for-each>
3559
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" 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">
4087
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3560
4088
  <xsl:variable name="target">
3561
4089
  <xsl:choose>
3562
4090
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3586,4 +4114,277 @@
3586
4114
  </xsl:otherwise>
3587
4115
  </xsl:choose>
3588
4116
  </fo:inline>
4117
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4118
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4119
+ <!-- <xsl:choose>
4120
+ <xsl:when test="@lang = 'en'"></xsl:when>
4121
+ <xsl:otherwise> -->
4122
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4123
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4124
+ <!-- </xsl:otherwise>
4125
+ </xsl:choose> -->
4126
+ <xsl:apply-templates/>
4127
+ </fo:block>
4128
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4129
+ <fo:inline id="{@id}"/>
4130
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4131
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4132
+ <xsl:variable name="title-appendix">
4133
+ <xsl:call-template name="getTitle">
4134
+ <xsl:with-param name="name" select="'title-appendix'"/>
4135
+ </xsl:call-template>
4136
+ </xsl:variable>
4137
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4138
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4139
+ </fo:block>
4140
+ <xsl:apply-templates/>
4141
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4142
+ <fo:inline><xsl:apply-templates/></fo:inline>
4143
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4144
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4145
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4146
+ <xsl:variable name="title-example">
4147
+ <xsl:call-template name="getTitle">
4148
+ <xsl:with-param name="name" select="'title-example'"/>
4149
+ </xsl:call-template>
4150
+ </xsl:variable>
4151
+ <xsl:value-of select="$title-example"/>
4152
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4153
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4154
+ </xsl:if>
4155
+ <xsl:if test="*[local-name()='name']">
4156
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4157
+ </xsl:if>
4158
+ </fo:block>
4159
+ <xsl:apply-templates/>
4160
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4161
+ <fo:inline><xsl:apply-templates/></fo:inline>
4162
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4163
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4164
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4165
+ <xsl:variable name="annotation-id" select="@id"/>
4166
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4167
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4168
+ <fo:inline>
4169
+ <xsl:apply-templates>
4170
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4171
+ </xsl:apply-templates>
4172
+ </fo:inline>
4173
+ </fo:block>
4174
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4175
+ <xsl:param name="callout"/>
4176
+ <fo:inline id="{@id}">
4177
+ <!-- for first p in annotation, put <x> -->
4178
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4179
+ <xsl:apply-templates/>
4180
+ </fo:inline>
4181
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4182
+ <xsl:variable name="title-modified">
4183
+ <xsl:call-template name="getTitle">
4184
+ <xsl:with-param name="name" select="'title-modified'"/>
4185
+ </xsl:call-template>
4186
+ </xsl:variable>
4187
+ <xsl:choose>
4188
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4189
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4190
+ </xsl:choose>
4191
+ <xsl:apply-templates/>
4192
+ </xsl:template><xsl:template name="convertDate">
4193
+ <xsl:param name="date"/>
4194
+ <xsl:param name="format" select="'short'"/>
4195
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4196
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4197
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4198
+ <xsl:variable name="monthStr">
4199
+ <xsl:choose>
4200
+ <xsl:when test="$month = '01'">January</xsl:when>
4201
+ <xsl:when test="$month = '02'">February</xsl:when>
4202
+ <xsl:when test="$month = '03'">March</xsl:when>
4203
+ <xsl:when test="$month = '04'">April</xsl:when>
4204
+ <xsl:when test="$month = '05'">May</xsl:when>
4205
+ <xsl:when test="$month = '06'">June</xsl:when>
4206
+ <xsl:when test="$month = '07'">July</xsl:when>
4207
+ <xsl:when test="$month = '08'">August</xsl:when>
4208
+ <xsl:when test="$month = '09'">September</xsl:when>
4209
+ <xsl:when test="$month = '10'">October</xsl:when>
4210
+ <xsl:when test="$month = '11'">November</xsl:when>
4211
+ <xsl:when test="$month = '12'">December</xsl:when>
4212
+ </xsl:choose>
4213
+ </xsl:variable>
4214
+ <xsl:variable name="result">
4215
+ <xsl:choose>
4216
+ <xsl:when test="$format = 'short' or $day = ''">
4217
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4218
+ </xsl:when>
4219
+ <xsl:otherwise>
4220
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4221
+ </xsl:otherwise>
4222
+ </xsl:choose>
4223
+ </xsl:variable>
4224
+ <xsl:value-of select="$result"/>
4225
+ </xsl:template><xsl:template name="insertKeywords">
4226
+ <xsl:param name="sorting" select="'true'"/>
4227
+ <xsl:param name="charAtEnd" select="'.'"/>
4228
+ <xsl:param name="charDelim" select="', '"/>
4229
+ <xsl:choose>
4230
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4231
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4232
+ <xsl:sort data-type="text" order="ascending"/>
4233
+ <xsl:call-template name="insertKeyword">
4234
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4235
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4236
+ </xsl:call-template>
4237
+ </xsl:for-each>
4238
+ </xsl:when>
4239
+ <xsl:otherwise>
4240
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4241
+ <xsl:call-template name="insertKeyword">
4242
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4243
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4244
+ </xsl:call-template>
4245
+ </xsl:for-each>
4246
+ </xsl:otherwise>
4247
+ </xsl:choose>
4248
+ </xsl:template><xsl:template name="insertKeyword">
4249
+ <xsl:param name="charAtEnd"/>
4250
+ <xsl:param name="charDelim"/>
4251
+ <xsl:apply-templates/>
4252
+ <xsl:choose>
4253
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4254
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4255
+ </xsl:choose>
4256
+ </xsl:template><xsl:template name="addPDFUAmeta">
4257
+ <fo:declarations>
4258
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4259
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4260
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4261
+ </pdf:dictionary>
4262
+ </pdf:catalog>
4263
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4264
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4265
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4266
+ <!-- Dublin Core properties go here -->
4267
+ <dc:title>
4268
+ <xsl:variable name="title">
4269
+
4270
+
4271
+
4272
+
4273
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@type='main']"/>
4274
+
4275
+ </xsl:variable>
4276
+ <xsl:choose>
4277
+ <xsl:when test="normalize-space($title) != ''">
4278
+ <xsl:value-of select="$title"/>
4279
+ </xsl:when>
4280
+ <xsl:otherwise>
4281
+ <xsl:text> </xsl:text>
4282
+ </xsl:otherwise>
4283
+ </xsl:choose>
4284
+ </dc:title>
4285
+ <dc:creator>
4286
+
4287
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4288
+
4289
+
4290
+ </dc:creator>
4291
+ <dc:description>
4292
+ <xsl:variable name="abstract">
4293
+
4294
+
4295
+
4296
+
4297
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4298
+
4299
+ </xsl:variable>
4300
+ <xsl:value-of select="normalize-space($abstract)"/>
4301
+ </dc:description>
4302
+ <pdf:Keywords>
4303
+ <xsl:call-template name="insertKeywords"/>
4304
+ </pdf:Keywords>
4305
+ </rdf:Description>
4306
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4307
+ <!-- XMP properties go here -->
4308
+ <xmp:CreatorTool/>
4309
+ </rdf:Description>
4310
+ </rdf:RDF>
4311
+ </x:xmpmeta>
4312
+ </fo:declarations>
4313
+ </xsl:template><xsl:template name="getId">
4314
+ <xsl:choose>
4315
+ <xsl:when test="../@id">
4316
+ <xsl:value-of select="../@id"/>
4317
+ </xsl:when>
4318
+ <xsl:otherwise>
4319
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4320
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4321
+ </xsl:otherwise>
4322
+ </xsl:choose>
4323
+ </xsl:template><xsl:template name="getLevel">
4324
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4325
+ <xsl:variable name="level">
4326
+ <xsl:choose>
4327
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4328
+ <xsl:value-of select="$level_total - 2"/>
4329
+ </xsl:when>
4330
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4331
+ <xsl:value-of select="$level_total - 2"/>
4332
+ </xsl:when>
4333
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4334
+ <xsl:value-of select="$level_total - 2"/>
4335
+ </xsl:when>
4336
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4337
+ <xsl:otherwise>
4338
+ <xsl:value-of select="$level_total - 1"/>
4339
+ </xsl:otherwise>
4340
+ </xsl:choose>
4341
+ </xsl:variable>
4342
+ <xsl:value-of select="$level"/>
4343
+ </xsl:template><xsl:template name="getSubSection">
4344
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
4345
+ </xsl:template><xsl:template name="split">
4346
+ <xsl:param name="pText" select="."/>
4347
+ <xsl:param name="sep" select="','"/>
4348
+ <xsl:if test="string-length($pText) &gt;0">
4349
+ <item>
4350
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4351
+ </item>
4352
+ <xsl:call-template name="split">
4353
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4354
+ <xsl:with-param name="sep" select="$sep"/>
4355
+ </xsl:call-template>
4356
+ </xsl:if>
4357
+ </xsl:template><xsl:template name="getDocumentId">
4358
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4359
+ </xsl:template><xsl:template name="namespaceCheck">
4360
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4361
+ <xsl:variable name="XSLNS">
4362
+
4363
+
4364
+
4365
+ <xsl:value-of select="document('')//*/namespace::itu"/>
4366
+
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
4373
+
4374
+
4375
+
4376
+ </xsl:variable>
4377
+ <xsl:if test="$documentNS != $XSLNS">
4378
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4379
+ </xsl:if>
4380
+ </xsl:template><xsl:template name="getLanguage">
4381
+ <xsl:param name="lang"/>
4382
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4383
+ <xsl:choose>
4384
+ <xsl:when test="$language = 'en'">English</xsl:when>
4385
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4386
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4387
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4388
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4389
+ </xsl:choose>
3589
4390
  </xsl:template></xsl:stylesheet>