metanorma-itu 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ed5bdd15fc291b42dd7b7760aea1a16d11e20cbd098baed7d9670cf4377bef6
4
- data.tar.gz: dd1cae93081ac5da55e4b1efee4fd908bf9fde4e01e244ae59ea061cb2d0262e
3
+ metadata.gz: ec972a8e77e6d6289ea5deeab70878100d83a19a1a6a50964641f7c5609a4c9e
4
+ data.tar.gz: 226acd90020445ce770d718c91139664f000d314e1109886e591fcb31852fdfa
5
5
  SHA512:
6
- metadata.gz: 42380cb1f49fed3fc99f51e3455049cdf907b158dad19da9ae2a244a761802924ff1727af053f604bfbfab933dab73bd3b225c03af9318fd15362aebf7d89d7c
7
- data.tar.gz: 1b4ced1d5237dd83b90254a77a47ed71f3ee97e4b9dc468e09789f8a4d9dd5efda9fd418b42a2e618ee6e66c0404ec43bbd9b0bc1d5e57bf0b8457d0ee5507d3
6
+ metadata.gz: 4a2e037212cad45cb12f5f2ced99ddd6b6ef3f552c80c0159a2a3704d8055373033c17fc3146e677b569dd93964b45f1cd7aaf40b7e1bb8c99751c2abdacb36d
7
+ data.tar.gz: 3c922fc248475914a45d560d1d2dfca5557bbdd2789d4a72fccd41601ba5305ac9dfd3f667ad66b890ad3e5448a21940f1548b0557b6182af9c0071ce892fed1
@@ -6,21 +6,24 @@ module Asciidoctor
6
6
  module ITU
7
7
  class Converter < Standoc::Converter
8
8
  def metadata_status(node, xml)
9
+ stage = (node.attr("status") || node.attr("docstage") || "published")
10
+ stage = "draft" if node.attributes.has_key?("draft")
9
11
  xml.status do |s|
10
- s.stage (node.attributes.has_key?("draft") ? "draft" :
11
- (node.attr("status") || node.attr("docstage") || "published" ))
12
+ s.stage stage
12
13
  end
13
14
  end
14
15
 
16
+ def title_attr(type, lang = "en")
17
+ { language: lang, format: "text/plain", type: type }
18
+ end
19
+
15
20
  def title_english(node, xml)
16
- at = { language: "en", format: "text/plain", type: "main" }
17
21
  a = node.attr("title") || node.attr("title-en")
18
- xml.title **attr_code(at) do |t|
22
+ xml.title **attr_code(title_attr("main")) do |t|
19
23
  t << (Metanorma::Utils::asciidoc_sub(a) || node.title)
20
24
  end
21
25
  if a = node.attr("annextitle") || node.attr("annextitle-en")
22
- at[:type] = "annex"
23
- xml.title **attr_code(at) do |t|
26
+ xml.title **attr_code(title_attr("annex")) do |t|
24
27
  t << Metanorma::Utils::asciidoc_sub(a)
25
28
  end
26
29
  end
@@ -30,8 +33,9 @@ module Asciidoctor
30
33
  node.attributes.each do |k, v|
31
34
  next unless /^(annex)?title-(?<lang>.+)$/ =~ k
32
35
  next if lang == "en"
33
- type = /^annex/.match(k) ? "annex" : "main"
34
- xml.title **attr_code(language: lang, format: "text/plain", type: type) do |t|
36
+
37
+ type = /^annex/.match?(k) ? "annex" : "main"
38
+ xml.title **attr_code(title_attr(type, lang)) do |t|
35
39
  t << Metanorma::Utils::asciidoc_sub(v)
36
40
  end
37
41
  end
@@ -40,15 +44,14 @@ module Asciidoctor
40
44
  def title(node, xml)
41
45
  super
42
46
  %w(subtitle amendment-title corrigendum-title).each do |t|
43
- other_title_english(node, xml, t)
44
- other_title_otherlangs(node, xml, t)
47
+ other_title_english(node, xml, t)
48
+ other_title_otherlangs(node, xml, t)
45
49
  end
46
50
  end
47
51
 
48
52
  def other_title_english(node, xml, type)
49
- at = { language: "en", format: "text/plain", type: type.sub(/-title/, "") }
50
53
  a = node.attr(type) || node.attr("#{type}-en")
51
- xml.title **attr_code(at) do |t|
54
+ xml.title **attr_code(title_attr(type.sub(/-title/, ""))) do |t|
52
55
  t << Metanorma::Utils::asciidoc_sub(a)
53
56
  end
54
57
  end
@@ -57,8 +60,9 @@ module Asciidoctor
57
60
  node.attributes.each do |k, v|
58
61
  next unless m = /^#{type}-(?<lang>.+)$/.match(k)
59
62
  next if m[:lang] == "en"
60
- xml.title **attr_code(language: m[:lang], format: "text/plain",
61
- type: type.sub(/-title/, "")) do |t|
63
+
64
+ xml.title **attr_code(title_attr(type.sub(/-title/, ""),
65
+ m[:lang])) do |t|
62
66
  t << Metanorma::Utils::asciidoc_sub(v)
63
67
  end
64
68
  end
@@ -79,7 +83,7 @@ module Asciidoctor
79
83
 
80
84
  def metadata_committee1(node, xml, suffix)
81
85
  xml.editorialgroup do |a|
82
- a.bureau ( node.attr("bureau#{suffix}") || "T" )
86
+ a.bureau ( node.attr("bureau#{suffix}") || "T")
83
87
  if node.attr("group#{suffix}")
84
88
  a.group **attr_code(type: node.attr("grouptype#{suffix}")) do |g|
85
89
  metadata_committee2(node, g, suffix, "")
@@ -119,27 +123,30 @@ module Asciidoctor
119
123
 
120
124
  def provisional_id(node, xml)
121
125
  return unless node.attr("provisional-name")
122
- xml.docidentifier **{type: "ITU-provisional"} do |i|
126
+
127
+ xml.docidentifier **{ type: "ITU-provisional" } do |i|
123
128
  i << node.attr("provisional-name")
124
129
  end
125
130
  end
126
131
 
127
- ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S", "zh" => "C", "ru" => "R" }.freeze
132
+ ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
133
+ "zh" => "C", "ru" => "R" }.freeze
128
134
 
129
135
  def itu_id1(node, lang)
130
136
  bureau = node.attr("bureau") || "T"
131
137
  id = doctype(node) == "service-publication" ?
132
138
  @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber")) :
133
- "ITU-#{bureau} #{node.attr("docnumber")}"
139
+ "ITU-#{bureau} #{node.attr('docnumber')}"
134
140
  id + (lang ? "-#{ITULANG[@lang]}" : "")
135
141
  end
136
142
 
137
143
  def itu_id(node, xml)
138
144
  return unless node.attr("docnumber")
139
- xml.docidentifier **{type: "ITU"} do |i|
145
+
146
+ xml.docidentifier **{ type: "ITU" } do |i|
140
147
  i << itu_id1(node, false)
141
148
  end
142
- xml.docidentifier **{type: "ITU-lang"} do |i|
149
+ xml.docidentifier **{ type: "ITU-lang" } do |i|
143
150
  i << itu_id1(node, true)
144
151
  end
145
152
  xml.docnumber { |i| i << node.attr("docnumber") }
@@ -147,8 +154,9 @@ module Asciidoctor
147
154
 
148
155
  def recommendation_id(node, xml)
149
156
  return unless node.attr("recommendationnumber")
157
+
150
158
  node.attr("recommendationnumber").split("/").each do |s|
151
- xml.docidentifier **{type: "ITU-Recommendation"} do |i|
159
+ xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
152
160
  i << s
153
161
  end
154
162
  end
@@ -171,11 +179,12 @@ module Asciidoctor
171
179
 
172
180
  def metadata_recommendationstatus(node, xml)
173
181
  return unless node.attr("recommendation-from")
182
+
174
183
  xml.recommendationstatus do |s|
175
184
  s.from node.attr("recommendation-from")
176
185
  s.to node.attr("recommendation-to") if node.attr("recommendation-to")
177
186
  if node.attr("approval-process")
178
- s.approvalstage **{process: node.attr("approval-process")} do |a|
187
+ s.approvalstage **{ process: node.attr("approval-process") } do |a|
179
188
  a << node.attr("approval-status")
180
189
  end
181
190
  end
@@ -188,6 +197,7 @@ module Asciidoctor
188
197
 
189
198
  def structured_id(node, xml)
190
199
  return unless node.attr("docnumber")
200
+
191
201
  xml.structuredidentifier do |i|
192
202
  i.bureau node.attr("bureau") || "T"
193
203
  i.docnumber node.attr("docnumber")
@@ -198,7 +208,8 @@ module Asciidoctor
198
208
  end
199
209
 
200
210
  def metadata_techreport(node, xml)
201
- a = node.attr("meeting") and metadata_meeting(a, node.attr("meeting-acronym"), xml)
211
+ a = node.attr("meeting") and
212
+ metadata_meeting(a, node.attr("meeting-acronym"), xml)
202
213
  a = node.attr("meeting-place") and xml.meeting_place a
203
214
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
204
215
  a = node.attr("intended-type") and xml.intended_type a
@@ -233,6 +244,7 @@ module Asciidoctor
233
244
 
234
245
  def metadata_ext(node, xml)
235
246
  metadata_doctype(node, xml)
247
+ metadata_subdoctype(node, xml)
236
248
  metadata_committee(node, xml)
237
249
  metadata_ics(node, xml)
238
250
  metadata_recommendationstatus(node, xml)
@@ -118,10 +118,17 @@
118
118
 
119
119
  <xsl:template match="/">
120
120
  <xsl:call-template name="namespaceCheck"/>
121
- <fo:root font-family="Times New Roman, STIX Two Math" font-size="12pt" xml:lang="{$lang}">
121
+ <fo:root xsl:use-attribute-sets="root-style">
122
+ <xsl:if test="$lang != 'ar'">
123
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
124
+ </xsl:if>
122
125
  <xsl:if test="$doctype = 'resolution'">
123
126
  <xsl:attribute name="font-size">11pt</xsl:attribute>
124
127
  </xsl:if>
128
+ <xsl:call-template name="setWritingMode"/>
129
+ <xsl:if test="$lang = 'ar'">
130
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
+ </xsl:if>
125
132
  <fo:layout-master-set>
126
133
 
127
134
 
@@ -322,7 +329,7 @@
322
329
  </xsl:if>
323
330
 
324
331
  <!-- cover page -->
325
- <fo:page-sequence master-reference="cover-page">
332
+ <fo:page-sequence master-reference="cover-page" writing-mode="lr-tb">
326
333
  <xsl:if test="$doctype = 'resolution'">
327
334
  <xsl:attribute name="force-page-count">no-force</xsl:attribute>
328
335
  </xsl:if>
@@ -343,7 +350,7 @@
343
350
  </fo:block-container>
344
351
 
345
352
  <fo:block-container absolute-position="fixed" left="-7mm" top="0" font-size="0">
346
- <fo:block>
353
+ <fo:block text-align="left">
347
354
  <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Fond-Rec))}" width="43.6mm" content-height="299.2mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Cover Page"/>
348
355
  </fo:block>
349
356
  </fo:block-container>
@@ -359,12 +366,15 @@
359
366
  <fo:block> </fo:block>
360
367
  </fo:table-cell>
361
368
  <fo:table-cell number-columns-spanned="3">
362
- <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
363
- <fo:block><xsl:value-of select="$linebreak"/></fo:block>
364
- <xsl:call-template name="addLetterSpacing">
365
- <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
366
- </xsl:call-template>
367
- </fo:block>
369
+ <fo:block-container>
370
+ <xsl:call-template name="setWritingMode"/>
371
+ <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
372
+ <fo:block><xsl:value-of select="$linebreak"/></fo:block>
373
+ <xsl:call-template name="addLetterSpacing">
374
+ <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
375
+ </xsl:call-template>
376
+ </fo:block>
377
+ </fo:block-container>
368
378
  </fo:table-cell>
369
379
  </fo:table-row>
370
380
  <fo:table-row>
@@ -372,48 +382,56 @@
372
382
  <fo:block> </fo:block>
373
383
  </fo:table-cell>
374
384
  <fo:table-cell padding-top="2mm" padding-bottom="-1mm">
375
- <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working -->
376
- <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
377
- </fo:block>
385
+ <fo:block-container>
386
+ <xsl:call-template name="setWritingMode"/>
387
+ <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working -->
388
+ <fo:block>
389
+ <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
390
+ </fo:block>
391
+ </fo:block>
392
+ </fo:block-container>
378
393
  </fo:table-cell>
379
394
  <fo:table-cell padding-top="1mm" number-columns-spanned="2" padding-bottom="-1mm">
380
- <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm">
381
- <xsl:choose>
382
- <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
383
- <xsl:value-of select="$doctypeTitle"/>
384
- </xsl:when>
385
- <xsl:when test="$doctype = 'implementers-guide'">
386
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/>
387
- <xsl:text> </xsl:text>
388
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
389
- </xsl:when>
390
- <xsl:when test="$doctype = 'resolution'"/>
391
- <xsl:when test="$doctype = 'recommendation-supplement'">
392
- <!-- Series L -->
393
- <xsl:variable name="title-series">
394
- <xsl:call-template name="getLocalizedString">
395
- <xsl:with-param name="key">series</xsl:with-param>
396
- </xsl:call-template>
397
- </xsl:variable>
398
- <xsl:call-template name="capitalize">
399
- <xsl:with-param name="str" select="$title-series"/>
400
- </xsl:call-template>
401
- <xsl:text> </xsl:text>
402
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/>
403
- <!-- Ex. Supplement 37 -->
404
- <fo:block font-size="18pt">
405
- <xsl:call-template name="getLocalizedString">
406
- <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param>
395
+ <fo:block-container>
396
+ <xsl:call-template name="setWritingMode"/>
397
+ <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm">
398
+ <xsl:choose>
399
+ <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
400
+ <xsl:value-of select="$doctypeTitle"/>
401
+ </xsl:when>
402
+ <xsl:when test="$doctype = 'implementers-guide'">
403
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/>
404
+ <xsl:text> </xsl:text>
405
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
406
+ </xsl:when>
407
+ <xsl:when test="$doctype = 'resolution'"/>
408
+ <xsl:when test="$doctype = 'recommendation-supplement'">
409
+ <!-- Series L -->
410
+ <xsl:variable name="title-series">
411
+ <xsl:call-template name="getLocalizedString">
412
+ <xsl:with-param name="key">series</xsl:with-param>
413
+ </xsl:call-template>
414
+ </xsl:variable>
415
+ <xsl:call-template name="capitalize">
416
+ <xsl:with-param name="str" select="$title-series"/>
407
417
  </xsl:call-template>
408
418
  <xsl:text> </xsl:text>
409
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
410
- </fo:block>
411
- </xsl:when>
412
- <xsl:otherwise>
413
- <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
414
- </xsl:otherwise>
415
- </xsl:choose>
416
- </fo:block>
419
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/>
420
+ <!-- Ex. Supplement 37 -->
421
+ <fo:block font-size="18pt">
422
+ <xsl:call-template name="getLocalizedString">
423
+ <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param>
424
+ </xsl:call-template>
425
+ <xsl:text> </xsl:text>
426
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
427
+ </fo:block>
428
+ </xsl:when>
429
+ <xsl:otherwise>
430
+ <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
431
+ </xsl:otherwise>
432
+ </xsl:choose>
433
+ </fo:block>
434
+ </fo:block-container>
417
435
  </fo:table-cell>
418
436
  </fo:table-row>
419
437
  <fo:table-row height="17.2mm">
@@ -421,36 +439,48 @@
421
439
  <fo:block> </fo:block>
422
440
  </fo:table-cell>
423
441
  <fo:table-cell font-size="10pt" number-columns-spanned="2" padding-top="1mm">
424
- <fo:block>
425
- <xsl:text>TELECOMMUNICATION</xsl:text>
426
- </fo:block>
427
- <fo:block>
428
- <xsl:text>STANDARDIZATION SECTOR</xsl:text>
429
- </fo:block>
430
- <fo:block>
431
- <xsl:text>OF ITU</xsl:text>
432
- </fo:block>
442
+ <fo:block-container>
443
+ <xsl:call-template name="setWritingMode"/>
444
+ <fo:block>
445
+ <xsl:text>TELECOMMUNICATION</xsl:text>
446
+ </fo:block>
447
+ <fo:block>
448
+ <xsl:text>STANDARDIZATION SECTOR</xsl:text>
449
+ </fo:block>
450
+ <fo:block>
451
+ <xsl:text>OF ITU</xsl:text>
452
+ </fo:block>
453
+ </fo:block-container>
433
454
  </fo:table-cell>
434
455
  <fo:table-cell text-align="right">
435
456
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
436
- <fo:block font-size="18pt" font-weight="bold">
437
- <xsl:variable name="title-annex">
438
- <xsl:call-template name="getTitle">
439
- <xsl:with-param name="name" select="'title-annex'"/>
440
- </xsl:call-template>
441
- </xsl:variable>
442
- <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
443
- </fo:block>
457
+ <fo:block-container>
458
+ <xsl:call-template name="setWritingMode"/>
459
+ <fo:block font-size="18pt" font-weight="bold">
460
+ <xsl:variable name="title-annex">
461
+ <xsl:call-template name="getTitle">
462
+ <xsl:with-param name="name" select="'title-annex'"/>
463
+ </xsl:call-template>
464
+ </xsl:variable>
465
+ <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
466
+ </fo:block>
467
+ </fo:block-container>
444
468
  </xsl:if>
445
469
  <xsl:if test="$isAmendment != ''">
446
- <fo:block font-size="18pt" font-weight="bold">
447
- <xsl:value-of select="$isAmendment"/>
448
- </fo:block>
470
+ <fo:block-container>
471
+ <xsl:call-template name="setWritingMode"/>
472
+ <fo:block font-size="18pt" font-weight="bold">
473
+ <xsl:value-of select="$isAmendment"/>
474
+ </fo:block>
475
+ </fo:block-container>
449
476
  </xsl:if>
450
477
  <xsl:if test="$isCorrigendum != ''">
451
- <fo:block font-size="18pt" font-weight="bold">
452
- <xsl:value-of select="$isCorrigendum"/>
453
- </fo:block>
478
+ <fo:block-container>
479
+ <xsl:call-template name="setWritingMode"/>
480
+ <fo:block font-size="18pt" font-weight="bold">
481
+ <xsl:value-of select="$isCorrigendum"/>
482
+ </fo:block>
483
+ </fo:block-container>
454
484
  </xsl:if>
455
485
  <fo:block font-size="14pt">
456
486
  <xsl:choose>
@@ -475,79 +505,81 @@
475
505
  <fo:block> </fo:block>
476
506
  </fo:table-cell>
477
507
  <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after">
478
- <fo:block padding-bottom="7mm">
479
- <xsl:if test="$doctype = 'resolution'">
480
- <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block>
481
- <fo:block>
482
- <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/>
483
- <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/>
484
- <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/>
485
- <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/>
486
- <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/>
487
-
488
- <xsl:variable name="date_format">
489
- <xsl:choose>
490
- <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when>
491
- <xsl:otherwise>ddMMyyyy</xsl:otherwise>
492
- </xsl:choose>
493
- </xsl:variable>
494
- <xsl:variable name="meeting-date_from_str">
495
- <xsl:call-template name="convertDateLocalized">
496
- <xsl:with-param name="date" select="$meeting-date_from"/>
497
- <xsl:with-param name="format" select="$date_format"/>
498
- </xsl:call-template>
499
- </xsl:variable>
508
+ <fo:block-container>
509
+ <xsl:call-template name="setWritingMode"/>
510
+ <fo:block padding-bottom="7mm">
511
+ <xsl:if test="$doctype = 'resolution'">
512
+ <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block>
513
+ <fo:block>
514
+ <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/>
515
+ <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/>
516
+ <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/>
517
+ <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/>
518
+ <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/>
519
+
520
+ <xsl:variable name="date_format">
521
+ <xsl:choose>
522
+ <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when>
523
+ <xsl:otherwise>ddMMyyyy</xsl:otherwise>
524
+ </xsl:choose>
525
+ </xsl:variable>
526
+ <xsl:variable name="meeting-date_from_str">
527
+ <xsl:call-template name="convertDateLocalized">
528
+ <xsl:with-param name="date" select="$meeting-date_from"/>
529
+ <xsl:with-param name="format" select="$date_format"/>
530
+ </xsl:call-template>
531
+ </xsl:variable>
500
532
 
501
- <xsl:variable name="meeting-date_to_str">
502
- <xsl:call-template name="convertDateLocalized">
503
- <xsl:with-param name="date" select="$meeting-date_to"/>
504
- <xsl:with-param name="format" select="'ddMMyyyy'"/>
505
- </xsl:call-template>
506
- </xsl:variable>
507
-
508
- <xsl:value-of select="$meeting-place"/>
509
- <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))">
510
- <xsl:text>, </xsl:text>
511
- <xsl:value-of select="$meeting-date_from_str"/>
512
- <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''">
513
- <xsl:text> – </xsl:text>
514
- </xsl:if>
515
- <xsl:value-of select="$meeting-date_to_str"/>
516
- </xsl:if>
517
- </fo:block>
518
- </xsl:if>
519
- <fo:block text-transform="uppercase">
520
- <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/>
521
- <xsl:if test="$series_title != ''">
522
- <xsl:variable name="title">
523
- <xsl:if test="$doctype != 'resolution'">
524
- <!-- <xsl:text>Series </xsl:text> -->
525
- <xsl:call-template name="getLocalizedString">
526
- <xsl:with-param name="key">series</xsl:with-param>
533
+ <xsl:variable name="meeting-date_to_str">
534
+ <xsl:call-template name="convertDateLocalized">
535
+ <xsl:with-param name="date" select="$meeting-date_to"/>
536
+ <xsl:with-param name="format" select="'ddMMyyyy'"/>
527
537
  </xsl:call-template>
528
- <xsl:text> </xsl:text>
538
+ </xsl:variable>
539
+
540
+ <xsl:value-of select="$meeting-place"/>
541
+ <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))">
542
+ <xsl:text>, </xsl:text>
543
+ <xsl:value-of select="$meeting-date_from_str"/>
544
+ <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''">
545
+ <xsl:text> – </xsl:text>
546
+ </xsl:if>
547
+ <xsl:value-of select="$meeting-date_to_str"/>
529
548
  </xsl:if>
530
- <xsl:value-of select="$series_title"/>
531
- </xsl:variable>
532
- <xsl:value-of select="$title"/>
549
+ </fo:block>
533
550
  </xsl:if>
534
- </fo:block>
535
- <xsl:choose>
536
- <xsl:when test="$doctype = 'recommendation-supplement'"/>
537
- <xsl:otherwise>
538
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
539
- <fo:block margin-top="6pt">
540
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
541
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
542
- <xsl:text> — </xsl:text>
543
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
551
+ <fo:block text-transform="uppercase">
552
+ <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/>
553
+ <xsl:if test="$series_title != ''">
554
+ <xsl:variable name="title">
555
+ <xsl:if test="$doctype != 'resolution'">
556
+ <!-- <xsl:text>Series </xsl:text> -->
557
+ <xsl:call-template name="getLocalizedString">
558
+ <xsl:with-param name="key">series</xsl:with-param>
559
+ </xsl:call-template>
560
+ <xsl:text> </xsl:text>
544
561
  </xsl:if>
545
- </fo:block>
562
+ <xsl:value-of select="$series_title"/>
563
+ </xsl:variable>
564
+ <xsl:value-of select="$title"/>
546
565
  </xsl:if>
547
- </xsl:otherwise>
548
- </xsl:choose>
549
-
550
- </fo:block>
566
+ </fo:block>
567
+ <xsl:choose>
568
+ <xsl:when test="$doctype = 'recommendation-supplement'"/>
569
+ <xsl:otherwise>
570
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
571
+ <fo:block margin-top="6pt">
572
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
573
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
574
+ <xsl:text> — </xsl:text>
575
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
576
+ </xsl:if>
577
+ </fo:block>
578
+ </xsl:if>
579
+ </xsl:otherwise>
580
+ </xsl:choose>
581
+ </fo:block>
582
+ </fo:block-container>
551
583
  </fo:table-cell>
552
584
  </fo:table-row>
553
585
  <fo:table-row height="40mm">
@@ -555,49 +587,52 @@
555
587
  <fo:block> </fo:block>
556
588
  </fo:table-cell>
557
589
  <fo:table-cell font-size="18pt" number-columns-spanned="3">
558
- <fo:block padding-right="2mm" margin-top="6pt">
559
- <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''">
560
- <xsl:attribute name="font-weight">bold</xsl:attribute>
561
- </xsl:if>
562
- <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber">
563
- <fo:block font-weight="bold">
564
- <xsl:value-of select="$xSTR-ACRONYM"/>
565
- </fo:block>
566
- </xsl:if>
567
- <xsl:if test="$doctype = 'implementers-guide'">
568
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
569
- <xsl:text> for </xsl:text>
570
- </xsl:if>
571
- <xsl:if test="$doctype = 'resolution'">
572
- <!-- Resolution 1 -->
573
- <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
574
- <xsl:text> – </xsl:text>
575
- </xsl:if>
576
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/>
577
- </fo:block>
578
- <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']">
579
- <fo:block font-weight="bold">
580
- <xsl:value-of select="."/>
581
- </fo:block>
582
- </xsl:for-each>
583
- <xsl:if test="$isAmendment != ''">
584
- <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
585
- <xsl:value-of select="$isAmendment"/>
586
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']">
587
- <xsl:text>: </xsl:text>
588
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/>
590
+ <fo:block-container>
591
+ <xsl:call-template name="setWritingMode"/>
592
+ <fo:block padding-right="2mm" margin-top="6pt">
593
+ <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''">
594
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
589
595
  </xsl:if>
590
- </fo:block>
591
- </xsl:if>
592
- <xsl:if test="$isCorrigendum != ''">
593
- <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
594
- <xsl:value-of select="$isCorrigendum"/>
595
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']">
596
- <xsl:text>: </xsl:text>
597
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/>
596
+ <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber">
597
+ <fo:block font-weight="bold">
598
+ <xsl:value-of select="$xSTR-ACRONYM"/>
599
+ </fo:block>
600
+ </xsl:if>
601
+ <xsl:if test="$doctype = 'implementers-guide'">
602
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
603
+ <xsl:text> for </xsl:text>
598
604
  </xsl:if>
605
+ <xsl:if test="$doctype = 'resolution'">
606
+ <!-- Resolution 1 -->
607
+ <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
608
+ <xsl:text> – </xsl:text>
609
+ </xsl:if>
610
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/>
599
611
  </fo:block>
600
- </xsl:if>
612
+ <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']">
613
+ <fo:block font-weight="bold">
614
+ <xsl:value-of select="."/>
615
+ </fo:block>
616
+ </xsl:for-each>
617
+ <xsl:if test="$isAmendment != ''">
618
+ <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
619
+ <xsl:value-of select="$isAmendment"/>
620
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']">
621
+ <xsl:text>: </xsl:text>
622
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/>
623
+ </xsl:if>
624
+ </fo:block>
625
+ </xsl:if>
626
+ <xsl:if test="$isCorrigendum != ''">
627
+ <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
628
+ <xsl:value-of select="$isCorrigendum"/>
629
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']">
630
+ <xsl:text>: </xsl:text>
631
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/>
632
+ </xsl:if>
633
+ </fo:block>
634
+ </xsl:if>
635
+ </fo:block-container>
601
636
  </fo:table-cell>
602
637
  </fo:table-row>
603
638
  <fo:table-row height="40mm">
@@ -605,17 +640,20 @@
605
640
  <fo:block> </fo:block>
606
641
  </fo:table-cell>
607
642
  <fo:table-cell number-columns-spanned="3">
608
- <xsl:choose>
609
- <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
610
- <xsl:attribute name="border">0.7mm solid black</xsl:attribute>
611
- <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm">
612
- <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/>
613
- </fo:block>
614
- </xsl:when>
615
- <xsl:otherwise>
616
- <fo:block> </fo:block>
617
- </xsl:otherwise>
618
- </xsl:choose>
643
+ <fo:block-container>
644
+ <xsl:call-template name="setWritingMode"/>
645
+ <xsl:choose>
646
+ <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
647
+ <xsl:attribute name="border">0.7mm solid black</xsl:attribute>
648
+ <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm">
649
+ <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/>
650
+ </fo:block>
651
+ </xsl:when>
652
+ <xsl:otherwise>
653
+ <fo:block> </fo:block>
654
+ </xsl:otherwise>
655
+ </xsl:choose>
656
+ </fo:block-container>
619
657
  </fo:table-cell>
620
658
  </fo:table-row>
621
659
  <fo:table-row height="25mm">
@@ -623,55 +661,58 @@
623
661
  <fo:block> </fo:block>
624
662
  </fo:table-cell>
625
663
  <fo:table-cell number-columns-spanned="3">
626
- <fo:block font-size="16pt" margin-top="3pt">
627
- <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
628
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
629
- <xsl:if test="$doctype = 'recommendation-supplement'">
630
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
631
- </xsl:if>
632
- </xsl:if>
633
-
634
- <xsl:choose>
635
- <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
636
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage">
637
- <xsl:call-template name="capitalizeWords">
638
- <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/>
639
- </xsl:call-template>
640
- <xsl:text> </xsl:text>
641
- </xsl:if>
642
- <xsl:value-of select="$doctypeTitle"/>
643
- <xsl:text>  </xsl:text>
644
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/>
645
- </xsl:when>
646
- <xsl:when test="$doctype = 'implementers-guide'"/>
647
- <xsl:when test="$doctype = 'resolution'"/>
648
- <xsl:when test="$doctype = 'recommendation-supplement'">
649
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if>
650
- <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text>
651
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/>
652
- </xsl:when>
653
- <xsl:otherwise>
654
- <xsl:value-of select="$doctypeTitle"/>
655
- <xsl:text>  </xsl:text>
656
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation">
657
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/>
658
- <xsl:text>-</xsl:text>
664
+ <fo:block-container>
665
+ <xsl:call-template name="setWritingMode"/>
666
+ <fo:block font-size="16pt" margin-top="3pt">
667
+ <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
668
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
669
+ <xsl:if test="$doctype = 'recommendation-supplement'">
670
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
659
671
  </xsl:if>
660
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/>
661
- <xsl:text>  </xsl:text>
662
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
663
- </xsl:otherwise>
664
- </xsl:choose>
665
-
666
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
667
- <xsl:variable name="title-annex">
668
- <xsl:call-template name="getTitle">
669
- <xsl:with-param name="name" select="'title-annex'"/>
670
- </xsl:call-template>
671
- </xsl:variable>
672
- <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"/>
673
- </xsl:if>
674
- </fo:block>
672
+ </xsl:if>
673
+
674
+ <xsl:choose>
675
+ <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
676
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage">
677
+ <xsl:call-template name="capitalizeWords">
678
+ <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/>
679
+ </xsl:call-template>
680
+ <xsl:text> </xsl:text>
681
+ </xsl:if>
682
+ <xsl:value-of select="$doctypeTitle"/>
683
+ <xsl:text>  </xsl:text>
684
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/>
685
+ </xsl:when>
686
+ <xsl:when test="$doctype = 'implementers-guide'"/>
687
+ <xsl:when test="$doctype = 'resolution'"/>
688
+ <xsl:when test="$doctype = 'recommendation-supplement'">
689
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if>
690
+ <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text>
691
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/>
692
+ </xsl:when>
693
+ <xsl:otherwise>
694
+ <xsl:value-of select="$doctypeTitle"/>
695
+ <xsl:text>  </xsl:text>
696
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation">
697
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/>
698
+ <xsl:text>-</xsl:text>
699
+ </xsl:if>
700
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/>
701
+ <xsl:text>  </xsl:text>
702
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
703
+ </xsl:otherwise>
704
+ </xsl:choose>
705
+
706
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
707
+ <xsl:variable name="title-annex">
708
+ <xsl:call-template name="getTitle">
709
+ <xsl:with-param name="name" select="'title-annex'"/>
710
+ </xsl:call-template>
711
+ </xsl:variable>
712
+ <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"/>
713
+ </xsl:if>
714
+ </fo:block>
715
+ </fo:block-container>
675
716
  </fo:table-cell>
676
717
  </fo:table-row>
677
718
  </fo:table-body>
@@ -754,7 +795,7 @@
754
795
  <xsl:with-param name="key">table_of_contents</xsl:with-param>
755
796
  </xsl:call-template>
756
797
  </fo:block>
757
- <fo:block margin-top="6pt" text-align="right" font-weight="bold">
798
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold">
758
799
  <xsl:call-template name="getLocalizedString">
759
800
  <xsl:with-param name="key">Page.sg</xsl:with-param>
760
801
  </xsl:call-template>
@@ -825,7 +866,7 @@
825
866
  <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
826
867
  <xsl:value-of select="$title-list-tables"/>
827
868
  </fo:block>
828
- <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always">
869
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
829
870
  <xsl:call-template name="getLocalizedString">
830
871
  <xsl:with-param name="key">Page.sg</xsl:with-param>
831
872
  </xsl:call-template>
@@ -857,7 +898,7 @@
857
898
  <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
858
899
  <xsl:value-of select="$title-list-figures"/>
859
900
  </fo:block>
860
- <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always">
901
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
861
902
  <xsl:call-template name="getLocalizedString">
862
903
  <xsl:with-param name="key">Page.sg</xsl:with-param>
863
904
  </xsl:call-template>
@@ -1156,12 +1197,19 @@
1156
1197
  <xsl:attribute name="text-align">
1157
1198
  <xsl:choose>
1158
1199
  <xsl:when test="@class='supertitle'">center</xsl:when>
1159
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1200
+ <!-- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> -->
1201
+ <xsl:when test="@align"><xsl:call-template name="setAlignment"/></xsl:when>
1160
1202
  <xsl:when test="ancestor::*[1][local-name() = 'td']/@align">
1161
- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/>
1203
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> -->
1204
+ <xsl:call-template name="setAlignment">
1205
+ <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'td']/@align"/>
1206
+ </xsl:call-template>
1162
1207
  </xsl:when>
1163
1208
  <xsl:when test="ancestor::*[1][local-name() = 'th']/@align">
1164
- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/>
1209
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> -->
1210
+ <xsl:call-template name="setAlignment">
1211
+ <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'th']/@align"/>
1212
+ </xsl:call-template>
1165
1213
  </xsl:when>
1166
1214
  <xsl:otherwise>justify</xsl:otherwise>
1167
1215
  </xsl:choose>
@@ -1375,6 +1423,7 @@
1375
1423
  <xsl:variable name="text-align">
1376
1424
  <xsl:choose>
1377
1425
  <xsl:when test="$level = 1 and $doctype = 'resolution'">center</xsl:when>
1426
+ <xsl:when test="$lang = 'ar'">start</xsl:when>
1378
1427
  <xsl:otherwise>left</xsl:otherwise>
1379
1428
  </xsl:choose>
1380
1429
  </xsl:variable>
@@ -1665,19 +1714,25 @@
1665
1714
  </fo:list-item-label>
1666
1715
  <fo:list-item-body start-indent="body-start()">
1667
1716
  <fo:block-container>
1717
+ <xsl:variable name="attribute-margin">
1718
+ <xsl:choose>
1719
+ <xsl:when test="$lang = 'ar'">margin-right</xsl:when>
1720
+ <xsl:otherwise>margin-left</xsl:otherwise>
1721
+ </xsl:choose>
1722
+ </xsl:variable>
1668
1723
  <xsl:if test="../preceding-sibling::*[1][local-name() = 'title']">
1669
- <xsl:attribute name="margin-left">18mm</xsl:attribute>
1724
+ <xsl:attribute name="{$attribute-margin}">18mm</xsl:attribute>
1670
1725
  </xsl:if>
1671
1726
  <xsl:if test="local-name(..) = 'ul'">
1672
- <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm -->
1727
+ <xsl:attribute name="{$attribute-margin}">7mm</xsl:attribute><!-- 15mm -->
1673
1728
  <xsl:if test="ancestor::itu:table">
1674
- <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
1729
+ <xsl:attribute name="{$attribute-margin}">4.5mm</xsl:attribute>
1675
1730
  </xsl:if>
1676
1731
  <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1677
1732
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
1678
1733
  </xsl:if> -->
1679
1734
  </xsl:if>
1680
- <fo:block-container margin-left="0mm">
1735
+ <fo:block-container margin-left="0mm" margin-right="0mm">
1681
1736
  <fo:block>
1682
1737
  <xsl:apply-templates/>
1683
1738
  <xsl:apply-templates select=".//itu:note" mode="process"/>
@@ -1756,19 +1811,7 @@
1756
1811
  <xsl:template match="itu:formula" mode="process">
1757
1812
  <xsl:call-template name="formula"/>
1758
1813
  </xsl:template>
1759
-
1760
- <xsl:template match="mathml:math" priority="2">
1761
- <fo:inline font-family="STIX Two Math" font-size="11pt">
1762
- <xsl:variable name="mathml">
1763
- <xsl:apply-templates select="." mode="mathml"/>
1764
- </xsl:variable>
1765
- <fo:instream-foreign-object fox:alt-text="Math">
1766
- <!-- <xsl:copy-of select="."/> -->
1767
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1768
- </fo:instream-foreign-object>
1769
- </fo:inline>
1770
- </xsl:template>
1771
-
1814
+
1772
1815
 
1773
1816
  <xsl:template match="itu:references[@normative='true']">
1774
1817
  <fo:block id="{@id}">
@@ -1793,10 +1836,10 @@
1793
1836
  <fo:table-column column-width="90%"/>
1794
1837
  <fo:table-body>
1795
1838
  <fo:table-row>
1796
- <fo:table-cell text-align="left" padding-bottom="8mm">
1839
+ <fo:table-cell text-align="start" padding-bottom="8mm">
1797
1840
  <fo:block><fo:page-number/></fo:block>
1798
1841
  </fo:table-cell>
1799
- <fo:table-cell font-weight="bold" text-align="left" padding-bottom="8mm">
1842
+ <fo:table-cell font-weight="bold" text-align="start" padding-bottom="8mm">
1800
1843
  <fo:block><xsl:value-of select="$footer-text"/></fo:block>
1801
1844
  </fo:table-cell>
1802
1845
  </fo:table-row>
@@ -1811,10 +1854,10 @@
1811
1854
  <fo:table-column column-width="10%"/>
1812
1855
  <fo:table-body>
1813
1856
  <fo:table-row>
1814
- <fo:table-cell font-weight="bold" text-align="right" padding-bottom="8mm">
1857
+ <fo:table-cell font-weight="bold" text-align="end" padding-bottom="8mm">
1815
1858
  <fo:block><xsl:value-of select="$footer-text"/></fo:block>
1816
1859
  </fo:table-cell>
1817
- <fo:table-cell text-align="right" padding-bottom="8mm" padding-right="2mm">
1860
+ <fo:table-cell text-align="end" padding-bottom="8mm" padding-right="2mm">
1818
1861
  <fo:block><fo:page-number/></fo:block>
1819
1862
  </fo:table-cell>
1820
1863
  </fo:table-row>
@@ -1843,7 +1886,7 @@
1843
1886
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
1844
1887
  <xsl:variable name="month" select="substring($date, 6, 2)"/>
1845
1888
  <xsl:if test="$month != '' and $year != ''">
1846
- <xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text>
1889
+ <xsl:value-of select="$LRM"/><xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text><xsl:value-of select="$LRM"/>
1847
1890
  </xsl:if>
1848
1891
  </xsl:template>
1849
1892
 
@@ -2041,6 +2084,10 @@
2041
2084
  </xsl:choose>
2042
2085
  </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="root-style">
2043
2086
 
2087
+
2088
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math</xsl:attribute>
2089
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2090
+
2044
2091
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2045
2092
 
2046
2093
 
@@ -2361,13 +2408,27 @@
2361
2408
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2362
2409
 
2363
2410
 
2364
- </xsl:attribute-set><xsl:attribute-set name="add-style">
2411
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2412
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2413
+ </xsl:variable><xsl:attribute-set name="add-style">
2365
2414
  <xsl:attribute name="color">red</xsl:attribute>
2366
2415
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2367
- </xsl:attribute-set><xsl:attribute-set name="del-style">
2368
- <xsl:attribute name="color">red</xsl:attribute>
2416
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2417
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2418
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2419
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2420
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2421
+ <xsl:text>red</xsl:text>
2422
+ </xsl:variable><xsl:attribute-set name="del-style">
2423
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2369
2424
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2370
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2425
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2426
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2427
+
2428
+
2429
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2430
+
2431
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2371
2432
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2372
2433
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2373
2434
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2412,18 +2473,19 @@
2412
2473
  <xsl:call-template name="add-zero-spaces-java"/>
2413
2474
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2414
2475
 
2476
+ <xsl:variable name="table-preamble">
2477
+
2478
+ <fo:block space-before="18pt"> </fo:block>
2479
+
2480
+
2481
+ </xsl:variable>
2482
+
2415
2483
  <xsl:variable name="table">
2416
2484
 
2417
2485
  <xsl:variable name="simple-table">
2418
2486
  <xsl:call-template name="getSimpleTable"/>
2419
2487
  </xsl:variable>
2420
2488
 
2421
-
2422
- <fo:block space-before="18pt"> </fo:block>
2423
-
2424
-
2425
-
2426
-
2427
2489
  <!-- <xsl:if test="$namespace = 'bipm'">
2428
2490
  <fo:block>&#xA0;</fo:block>
2429
2491
  </xsl:if> -->
@@ -2438,7 +2500,7 @@
2438
2500
 
2439
2501
 
2440
2502
 
2441
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2503
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2442
2504
 
2443
2505
  <!-- <xsl:variable name="cols-count">
2444
2506
  <xsl:choose>
@@ -2457,8 +2519,6 @@
2457
2519
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2458
2520
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2459
2521
 
2460
-
2461
-
2462
2522
  <xsl:variable name="colwidths">
2463
2523
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2464
2524
  <xsl:call-template name="calculate-column-widths">
@@ -2486,6 +2546,7 @@
2486
2546
  </xsl:choose>
2487
2547
  </xsl:variable>
2488
2548
 
2549
+
2489
2550
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2490
2551
 
2491
2552
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2524,6 +2585,7 @@
2524
2585
 
2525
2586
 
2526
2587
 
2588
+
2527
2589
  <attribute name="margin-left">0mm</attribute>
2528
2590
  <attribute name="margin-right">0mm</attribute>
2529
2591
 
@@ -2617,7 +2679,8 @@
2617
2679
  </fo:block-container>
2618
2680
  </xsl:variable>
2619
2681
 
2620
-
2682
+ <xsl:variable name="isAdded" select="@added"/>
2683
+ <xsl:variable name="isDeleted" select="@deleted"/>
2621
2684
 
2622
2685
  <xsl:choose>
2623
2686
  <xsl:when test="@width">
@@ -2631,7 +2694,14 @@
2631
2694
  <fo:table-body>
2632
2695
  <fo:table-row>
2633
2696
  <fo:table-cell column-number="2">
2634
- <fo:block><xsl:copy-of select="$table"/></fo:block>
2697
+ <xsl:copy-of select="$table-preamble"/>
2698
+ <fo:block>
2699
+ <xsl:call-template name="setTrackChangesStyles">
2700
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2701
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2702
+ </xsl:call-template>
2703
+ <xsl:copy-of select="$table"/>
2704
+ </fo:block>
2635
2705
  </fo:table-cell>
2636
2706
  </fo:table-row>
2637
2707
  </fo:table-body>
@@ -2642,7 +2712,22 @@
2642
2712
 
2643
2713
  </xsl:when>
2644
2714
  <xsl:otherwise>
2645
- <xsl:copy-of select="$table"/>
2715
+ <xsl:choose>
2716
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2717
+ <xsl:copy-of select="$table-preamble"/>
2718
+ <fo:block>
2719
+ <xsl:call-template name="setTrackChangesStyles">
2720
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2721
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2722
+ </xsl:call-template>
2723
+ <xsl:copy-of select="$table"/>
2724
+ </fo:block>
2725
+ </xsl:when>
2726
+ <xsl:otherwise>
2727
+ <xsl:copy-of select="$table-preamble"/>
2728
+ <xsl:copy-of select="$table"/>
2729
+ </xsl:otherwise>
2730
+ </xsl:choose>
2646
2731
  </xsl:otherwise>
2647
2732
  </xsl:choose>
2648
2733
 
@@ -2703,7 +2788,7 @@
2703
2788
  </xsl:for-each>
2704
2789
  </xsl:when>
2705
2790
  <xsl:otherwise>
2706
- <xsl:for-each select="xalan:nodeset($table)//tr">
2791
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2707
2792
  <xsl:variable name="td_text">
2708
2793
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2709
2794
 
@@ -3051,7 +3136,8 @@
3051
3136
  <xsl:attribute name="text-align">
3052
3137
  <xsl:choose>
3053
3138
  <xsl:when test="@align">
3054
- <xsl:value-of select="@align"/>
3139
+ <xsl:call-template name="setAlignment"/>
3140
+ <!-- <xsl:value-of select="@align"/> -->
3055
3141
  </xsl:when>
3056
3142
  <xsl:otherwise>center</xsl:otherwise>
3057
3143
  </xsl:choose>
@@ -3071,6 +3157,9 @@
3071
3157
 
3072
3158
 
3073
3159
 
3160
+ <xsl:if test="$lang = 'ar'">
3161
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3162
+ </xsl:if>
3074
3163
  <xsl:if test="@colspan">
3075
3164
  <xsl:attribute name="number-columns-spanned">
3076
3165
  <xsl:value-of select="@colspan"/>
@@ -3102,11 +3191,15 @@
3102
3191
  <xsl:attribute name="text-align">
3103
3192
  <xsl:choose>
3104
3193
  <xsl:when test="@align">
3105
- <xsl:value-of select="@align"/>
3194
+ <xsl:call-template name="setAlignment"/>
3195
+ <!-- <xsl:value-of select="@align"/> -->
3106
3196
  </xsl:when>
3107
3197
  <xsl:otherwise>left</xsl:otherwise>
3108
3198
  </xsl:choose>
3109
3199
  </xsl:attribute>
3200
+ <xsl:if test="$lang = 'ar'">
3201
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3202
+ </xsl:if>
3110
3203
 
3111
3204
 
3112
3205
  <xsl:if test="ancestor::*[local-name()='preface']">
@@ -3123,6 +3216,9 @@
3123
3216
 
3124
3217
 
3125
3218
 
3219
+ <xsl:if test=".//*[local-name() = 'table']">
3220
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3221
+ </xsl:if>
3126
3222
  <xsl:if test="@colspan">
3127
3223
  <xsl:attribute name="number-columns-spanned">
3128
3224
  <xsl:value-of select="@colspan"/>
@@ -3266,13 +3362,13 @@
3266
3362
  </xsl:choose>
3267
3363
  </xsl:variable>
3268
3364
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3269
- <xsl:element name="{$ns}:table">
3365
+ <!-- <xsl:element name="{$ns}:table"> -->
3270
3366
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3271
3367
  <tbody>
3272
3368
  <xsl:apply-templates mode="dl"/>
3273
3369
  </tbody>
3274
3370
  </xsl:for-each>
3275
- </xsl:element>
3371
+ <!-- </xsl:element> -->
3276
3372
  </xsl:variable>
3277
3373
 
3278
3374
  <xsl:call-template name="calculate-column-widths">
@@ -3366,6 +3462,8 @@
3366
3462
  <xsl:apply-templates/>
3367
3463
  </fo:inline>
3368
3464
  </xsl:template><xsl:template match="*[local-name()='dl']">
3465
+ <xsl:variable name="isAdded" select="@added"/>
3466
+ <xsl:variable name="isDeleted" select="@deleted"/>
3369
3467
  <fo:block-container>
3370
3468
 
3371
3469
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3382,6 +3480,12 @@
3382
3480
  </xsl:attribute>
3383
3481
 
3384
3482
  </xsl:if>
3483
+
3484
+ <xsl:call-template name="setTrackChangesStyles">
3485
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3486
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3487
+ </xsl:call-template>
3488
+
3385
3489
  <fo:block-container>
3386
3490
 
3387
3491
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3498,11 +3602,11 @@
3498
3602
  </xsl:choose>
3499
3603
  </xsl:variable>
3500
3604
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3501
- <xsl:element name="{$ns}:table">
3605
+ <!-- <xsl:element name="{$ns}:table"> -->
3502
3606
  <tbody>
3503
3607
  <xsl:apply-templates mode="dl"/>
3504
3608
  </tbody>
3505
- </xsl:element>
3609
+ <!-- </xsl:element> -->
3506
3610
  </xsl:variable>
3507
3611
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3508
3612
  <xsl:variable name="colwidths">
@@ -3780,9 +3884,71 @@
3780
3884
  <xsl:apply-templates/>
3781
3885
  </fo:inline>
3782
3886
  </xsl:template><xsl:template match="*[local-name()='add']">
3783
- <fo:inline xsl:use-attribute-sets="add-style">
3784
- <xsl:apply-templates/>
3785
- </fo:inline>
3887
+ <xsl:choose>
3888
+ <xsl:when test="@amendment">
3889
+ <fo:inline>
3890
+ <xsl:call-template name="insertTag">
3891
+ <xsl:with-param name="kind">A</xsl:with-param>
3892
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3893
+ </xsl:call-template>
3894
+ <xsl:apply-templates/>
3895
+ <xsl:call-template name="insertTag">
3896
+ <xsl:with-param name="type">closing</xsl:with-param>
3897
+ <xsl:with-param name="kind">A</xsl:with-param>
3898
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3899
+ </xsl:call-template>
3900
+ </fo:inline>
3901
+ </xsl:when>
3902
+ <xsl:when test="@corrigenda">
3903
+ <fo:inline>
3904
+ <xsl:call-template name="insertTag">
3905
+ <xsl:with-param name="kind">C</xsl:with-param>
3906
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3907
+ </xsl:call-template>
3908
+ <xsl:apply-templates/>
3909
+ <xsl:call-template name="insertTag">
3910
+ <xsl:with-param name="type">closing</xsl:with-param>
3911
+ <xsl:with-param name="kind">C</xsl:with-param>
3912
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3913
+ </xsl:call-template>
3914
+ </fo:inline>
3915
+ </xsl:when>
3916
+ <xsl:otherwise>
3917
+ <fo:inline xsl:use-attribute-sets="add-style">
3918
+ <xsl:apply-templates/>
3919
+ </fo:inline>
3920
+ </xsl:otherwise>
3921
+ </xsl:choose>
3922
+
3923
+ </xsl:template><xsl:template name="insertTag">
3924
+ <xsl:param name="type"/>
3925
+ <xsl:param name="kind"/>
3926
+ <xsl:param name="value"/>
3927
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3928
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3929
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3930
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3931
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3932
+ <xsl:attribute name="height">5mm</xsl:attribute>
3933
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3934
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3935
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3936
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3937
+ <g>
3938
+ <xsl:if test="$type = 'closing'">
3939
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3940
+ </xsl:if>
3941
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3942
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3943
+ </g>
3944
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3945
+ <xsl:if test="$type = 'closing'">
3946
+ <xsl:attribute name="x">25</xsl:attribute>
3947
+ </xsl:if>
3948
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3949
+ </text>
3950
+ </svg>
3951
+ </fo:instream-foreign-object>
3786
3952
  </xsl:template><xsl:template match="*[local-name()='del']">
3787
3953
  <fo:inline xsl:use-attribute-sets="del-style">
3788
3954
  <xsl:apply-templates/>
@@ -4125,13 +4291,23 @@
4125
4291
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4126
4292
  <xsl:value-of select="substring($str, 2)"/>
4127
4293
  </xsl:template><xsl:template match="mathml:math">
4128
- <fo:inline font-family="STIX Two Math"> <!-- -->
4294
+ <xsl:variable name="isAdded" select="@added"/>
4295
+ <xsl:variable name="isDeleted" select="@deleted"/>
4296
+
4297
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4298
+
4299
+
4300
+ <xsl:call-template name="setTrackChangesStyles">
4301
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4302
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4303
+ </xsl:call-template>
4129
4304
 
4130
4305
  <xsl:variable name="mathml">
4131
4306
  <xsl:apply-templates select="." mode="mathml"/>
4132
4307
  </xsl:variable>
4133
4308
  <fo:instream-foreign-object fox:alt-text="Math">
4134
4309
 
4310
+
4135
4311
  <!-- <xsl:copy-of select="."/> -->
4136
4312
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4137
4313
  </fo:instream-foreign-object>
@@ -4383,8 +4559,15 @@
4383
4559
  </fo:inline>
4384
4560
  </xsl:if>
4385
4561
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4562
+ <xsl:variable name="isAdded" select="@added"/>
4563
+ <xsl:variable name="isDeleted" select="@deleted"/>
4386
4564
  <fo:block-container id="{@id}">
4387
4565
 
4566
+ <xsl:call-template name="setTrackChangesStyles">
4567
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4568
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4569
+ </xsl:call-template>
4570
+
4388
4571
  <fo:block>
4389
4572
  <xsl:apply-templates/>
4390
4573
  </fo:block>
@@ -4404,6 +4587,8 @@
4404
4587
  <xsl:apply-templates/>
4405
4588
  </fo:block>
4406
4589
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4590
+ <xsl:variable name="isAdded" select="../@added"/>
4591
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4407
4592
  <xsl:choose>
4408
4593
  <xsl:when test="ancestor::*[local-name() = 'title']">
4409
4594
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -4419,7 +4604,26 @@
4419
4604
  <xsl:variable name="src">
4420
4605
  <xsl:call-template name="image_src"/>
4421
4606
  </xsl:variable>
4422
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4607
+
4608
+ <xsl:choose>
4609
+ <xsl:when test="$isDeleted = 'true'">
4610
+ <!-- enclose in svg -->
4611
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4612
+ <xsl:attribute name="width">100%</xsl:attribute>
4613
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4614
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4615
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4616
+
4617
+
4618
+ <xsl:apply-templates select="." mode="cross_image"/>
4619
+
4620
+ </fo:instream-foreign-object>
4621
+ </xsl:when>
4622
+ <xsl:otherwise>
4623
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4624
+ </xsl:otherwise>
4625
+ </xsl:choose>
4626
+
4423
4627
  </fo:block>
4424
4628
  </xsl:otherwise>
4425
4629
  </xsl:choose>
@@ -4435,6 +4639,55 @@
4435
4639
  <xsl:value-of select="@src"/>
4436
4640
  </xsl:otherwise>
4437
4641
  </xsl:choose>
4642
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4643
+ <xsl:choose>
4644
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4645
+ <xsl:variable name="src">
4646
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4647
+ </xsl:variable>
4648
+ <xsl:variable name="width" select="document($src)/@width"/>
4649
+ <xsl:variable name="height" select="document($src)/@height"/>
4650
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4651
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4652
+ </svg>
4653
+ </xsl:when>
4654
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4655
+ <xsl:variable name="src">
4656
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4657
+ </xsl:variable>
4658
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4659
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4660
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4661
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4662
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4663
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4664
+ </svg>
4665
+ </xsl:when>
4666
+ <xsl:otherwise>
4667
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4668
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4669
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4670
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4671
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4672
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4673
+ <!-- width=<xsl:value-of select="$width"/> -->
4674
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4675
+ <!-- height=<xsl:value-of select="$height"/> -->
4676
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4677
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4678
+ <xsl:call-template name="svg_cross">
4679
+ <xsl:with-param name="width" select="$width"/>
4680
+ <xsl:with-param name="height" select="$height"/>
4681
+ </xsl:call-template>
4682
+ </svg>
4683
+ </xsl:otherwise>
4684
+ </xsl:choose>
4685
+
4686
+ </xsl:template><xsl:template name="svg_cross">
4687
+ <xsl:param name="width"/>
4688
+ <xsl:param name="height"/>
4689
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4690
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4438
4691
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4439
4692
  <xsl:apply-templates mode="contents"/>
4440
4693
  <xsl:text> </xsl:text>
@@ -4977,6 +5230,7 @@
4977
5230
  <xsl:variable name="element">
4978
5231
  block
4979
5232
 
5233
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4980
5234
  </xsl:variable>
4981
5235
  <xsl:choose>
4982
5236
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4984,7 +5238,7 @@
4984
5238
  <xsl:apply-templates/>
4985
5239
  </fo:inline>
4986
5240
  </xsl:when>
4987
- <xsl:when test="normalize-space($element) = 'block'">
5241
+ <xsl:when test="contains(normalize-space($element), 'block')">
4988
5242
  <fo:block xsl:use-attribute-sets="example-name-style">
4989
5243
  <xsl:apply-templates/>
4990
5244
  </fo:block>
@@ -5193,7 +5447,8 @@
5193
5447
  </fo:inline>
5194
5448
  </xsl:when>
5195
5449
  <xsl:otherwise>
5196
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5450
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5451
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5197
5452
  </xsl:otherwise>
5198
5453
  </xsl:choose>
5199
5454
 
@@ -5912,4 +6167,44 @@
5912
6167
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5913
6168
  </xsl:choose>
5914
6169
 
6170
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6171
+ <xsl:param name="isAdded"/>
6172
+ <xsl:param name="isDeleted"/>
6173
+ <xsl:choose>
6174
+ <xsl:when test="local-name() = 'math'">
6175
+ <xsl:if test="$isAdded = 'true'">
6176
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6177
+ </xsl:if>
6178
+ <xsl:if test="$isDeleted = 'true'">
6179
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6180
+ </xsl:if>
6181
+ </xsl:when>
6182
+ <xsl:otherwise>
6183
+ <xsl:if test="$isAdded = 'true'">
6184
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6185
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6186
+ </xsl:if>
6187
+ <xsl:if test="$isDeleted = 'true'">
6188
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6189
+ <xsl:if test="local-name() = 'table'">
6190
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6191
+ </xsl:if>
6192
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6193
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6194
+ </xsl:if>
6195
+ </xsl:otherwise>
6196
+ </xsl:choose>
6197
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6198
+ <xsl:if test="$lang = 'ar'">
6199
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6200
+ </xsl:if>
6201
+ </xsl:template><xsl:template name="setAlignment">
6202
+ <xsl:param name="align" select="normalize-space(@align)"/>
6203
+ <xsl:choose>
6204
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6205
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6206
+ <xsl:when test="$align != ''">
6207
+ <xsl:value-of select="$align"/>
6208
+ </xsl:when>
6209
+ </xsl:choose>
5915
6210
  </xsl:template></xsl:stylesheet>