metanorma-nist 1.2.14 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -108,6 +108,13 @@ a.FootnoteRef + a.FootnoteRef:before {
108
108
  content: ", ";
109
109
  vertical-align: super; }
110
110
 
111
+ .addition {
112
+ color: blue; }
113
+
114
+ .deletion {
115
+ color: red;
116
+ text-decoration: line-through; }
117
+
111
118
  #nist-sp-band {
112
119
  background-color: #d8eca8; }
113
120
 
@@ -35,7 +35,6 @@ module IsoDoc
35
35
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
36
36
  htmlcoverpage: html_doc_path("html_nist_titlepage.html"),
37
37
  htmlintropage: html_doc_path("html_nist_intro.html"),
38
- scripts: html_doc_path("scripts.html"),
39
38
  }
40
39
  end
41
40
 
@@ -1,22 +1,23 @@
1
1
  require "isodoc"
2
2
  require "twitter_cldr"
3
- require_relative "./metadata_id.rb"
3
+ require_relative "./metadata_id"
4
4
 
5
5
  module IsoDoc
6
6
  module NIST
7
7
  class Metadata < IsoDoc::Metadata
8
8
  def initialize(lang, script, labels)
9
9
  super
10
- here = File.dirname(__FILE__)
11
- set(:logo_nist, File.expand_path(File.join(here, "html", "logo.png")))
12
- set(:logo_cswp, File.expand_path(File.join(here, "html", "logo_cswp.png")))
10
+ here = File.join(File.dirname(__FILE__), "html")
11
+ set(:logo_nist, File.expand_path(File.join(here, "logo.png")))
12
+ set(:logo_cswp,
13
+ File.expand_path(File.join(here, "logo_cswp.png")))
13
14
  set(:logo_commerce,
14
- File.expand_path(File.join(here, "html", "commerce-logo-color.png")))
15
+ File.expand_path(File.join(here, "commerce-logo-color.png")))
15
16
  set(:logo_commerce_word,
16
- File.expand_path(File.join(here, "html", "deptofcommerce.png")))
17
+ File.expand_path(File.join(here, "deptofcommerce.png")))
17
18
  end
18
19
 
19
- def title(ixml, out)
20
+ def title(ixml, _out)
20
21
  main = ixml&.at(ns("//bibdata/title[@type = 'main']"))&.text
21
22
  set(:doctitle, main)
22
23
  short = ixml&.at(ns("//bibdata/title[@type = 'short-title']"))&.text
@@ -27,7 +28,7 @@ module IsoDoc
27
28
  main = ixml&.at(ns("//bibdata/title[@type = 'subtitle']"))&.text
28
29
  set(:docsubtitle, main) if main
29
30
  short = ixml&.at(ns("//bibdata/title[@type = 'short-subtitle']"))&.text
30
- set(:docsubtitle_short, short || main) if (short || main)
31
+ set(:docsubtitle_short, short || main) if short || main
31
32
  main = ixml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
32
33
  set(:docclasstitle, main) if main
33
34
  end
@@ -37,7 +38,7 @@ module IsoDoc
37
38
  set(:tc, tc.text.upcase) if tc
38
39
  subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
39
40
  "organization/subdivision")) and
40
- set(:nist_subdiv, subdiv.text)
41
+ set(:nist_subdiv, subdiv.text)
41
42
  super
42
43
  end
43
44
 
@@ -55,6 +56,7 @@ module IsoDoc
55
56
  ixml.xpath(ns("//bibdata/date")).each do |d|
56
57
  val = Common::date_range(d)
57
58
  next if val == "XXX"
59
+
58
60
  set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr))
59
61
  set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy))
60
62
  set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy))
@@ -67,6 +69,7 @@ module IsoDoc
67
69
  date = most_recent_date1(ixml) || return
68
70
  val = Common::date_range(date)
69
71
  return if val == "XXX"
72
+
70
73
  set(:most_recent_date_monthyear, daterange_proc(val, :monthyr))
71
74
  set(:most_recent_date_mmddyyyy, daterange_proc(val, :mmddyyyy))
72
75
  set(:most_recent_date_MMMddyyyy, daterange_proc(val, :MMMddyyyy))
@@ -74,24 +77,27 @@ module IsoDoc
74
77
 
75
78
  def most_recent_date1(ixml)
76
79
  docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
77
- /^draft/.match(docstatus) ?
80
+ if /^draft/.match?(docstatus)
78
81
  (ixml.at(ns("//bibdata/date[@type = 'circulated']")) ||
79
- ixml.at(ns("//version/revision-date"))) :
80
- ( ixml.at(ns("//bibdata/date[@type = 'issued']")))
82
+ ixml.at(ns("//version/revision-date")))
83
+ else
84
+ ixml.at(ns("//bibdata/date[@type = 'issued']"))
85
+ end
81
86
  end
82
87
 
83
88
  def withdrawal_pending(ixml)
84
- d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text&.strip or return
85
- d += "-01" if /^\d\d\d\d-\d\d$/.match(d)
89
+ d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text&.strip or
90
+ return
91
+ d += "-01" if /^\d\d\d\d-\d\d$/.match?(d)
86
92
  date = Date.parse(d) or return
87
93
  set(:withdrawal_pending, true) if date > Date.today
88
94
  end
89
95
 
90
- def daterange_proc(val, fn)
91
- m = /^(?<date1>[^&]+)(?<ndash>\&ndash;)?(?<date2>.*)$/.match val
92
- val_monthyear = self.send(fn, m[:date1])
96
+ def daterange_proc(val, format)
97
+ m = /^(?<date1>[^&]+)(?<ndash>&ndash;)?(?<date2>.*)$/.match val
98
+ val_monthyear = send(format, m[:date1])
93
99
  val_monthyear += "&ndash;" if m[:ndash]
94
- val_monthyear += self.send(fn, m[:date2]) unless m[:date2].empty?
100
+ val_monthyear += send(format, m[:date2]) unless m[:date2].empty?
95
101
  val_monthyear
96
102
  end
97
103
 
@@ -101,7 +107,7 @@ module IsoDoc
101
107
  set(:seriesabbr, seriesabbr) if seriesabbr
102
108
  subs = ixml.at(ns("//bibdata/series[@type = 'secondary']/title"))&.text
103
109
  abbr = ixml.at(ns("//bibdata/series[@type = 'secondary']/abbreviation"))&.text
104
- if (seriesabbr == "NIST CSTS")
110
+ if seriesabbr == "NIST CSTS"
105
111
  subs and set(:series, subs)
106
112
  abbr and set(:seriesabbr, abbr)
107
113
  else
@@ -112,7 +118,8 @@ module IsoDoc
112
118
 
113
119
  def mmddyyyy(isodate)
114
120
  return nil if isodate.nil?
115
- isodate += "-01" if /^\d\d\d\d-\d\d$/.match(isodate)
121
+
122
+ isodate += "-01" if /^\d\d\d\d-\d\d$/.match?(isodate)
116
123
  Date.parse(isodate).strftime("%m-%d-%Y")
117
124
  end
118
125
 
@@ -129,13 +136,16 @@ module IsoDoc
129
136
  super
130
137
  a = xml.at(ns("//bibdata/uri[@type = 'email']")) and set(:email, a.text)
131
138
  a = xml.at(ns("//bibdata/uri[@type = 'doi']")) and set(:doi, a.text)
132
- a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and set(:url, a.text)
139
+ a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and
140
+ set(:url, a.text)
133
141
  end
134
142
 
135
143
  def relations1(ixml, type)
136
144
  ret = []
137
- ixml.xpath(ns("//bibdata/relation[@type = '#{type}'][not(xmlns:description)] | "\
138
- "//bibdata/relation[description = '#{type}']")).each do |x|
145
+ ixml.xpath(ns("//bibdata/relation[@type = '#{type}']"\
146
+ "[not(xmlns:description)] | "\
147
+ "//bibdata/relation[description = '#{type}']"))
148
+ .each do |x|
139
149
  id = x&.at(ns(".//docidentifier"))&.text and ret << id
140
150
  end
141
151
  ret
@@ -156,6 +166,7 @@ module IsoDoc
156
166
  def superseding_doc(ixml)
157
167
  d = ixml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
158
168
  return unless d
169
+
159
170
  set(:superseding_status, status_print(d.at(ns("./status/stage"))&.text || "final"))
160
171
  superseding_iteration(d)
161
172
  docid = d.at(ns("./docidentifier[@type = 'NIST']"))&.text and
@@ -163,27 +174,35 @@ module IsoDoc
163
174
  docid_long = d.at(ns("./docidentifier[@type = 'nist-long']"))&.text and
164
175
  set(:superseding_docidentifier_long, docid_long)
165
176
  superseding_dates(d)
166
- doi = d.at(ns("./uri[@type = 'doi']"))&.text and set(:superseding_doi, doi)
167
- uri = d.at(ns("./uri[@type = 'uri']"))&.text and set(:superseding_uri, uri)
177
+ doi = d.at(ns("./uri[@type = 'doi']"))&.text and
178
+ set(:superseding_doi, doi)
179
+ uri = d.at(ns("./uri[@type = 'uri']"))&.text and
180
+ set(:superseding_uri, uri)
168
181
  superseding_titles(ixml, d)
169
182
  authors = d.xpath(ns("./contributor[role/@type = 'author']/person"))
170
- authors.empty? and authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
183
+ authors.empty? and
184
+ authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
171
185
  set(:superseding_authors, extract_person_names(authors))
172
186
  end
173
187
 
174
- def superseding_titles(ixml, d)
175
- if title = d.at(ns("./title[@type = 'main']"))&.text
176
- set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text)
177
- set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text)
188
+ def superseding_titles(ixml, newdoc)
189
+ if newdoc.at(ns("./title[@type = 'main']"))&.text
190
+ set(:superseding_title,
191
+ newdoc.at(ns("./title[@type = 'main']"))&.text)
192
+ set(:superseding_subtitle,
193
+ newdoc.at(ns("./title[@type = 'subtitle']"))&.text)
178
194
  else
179
- set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
180
- set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
195
+ set(:superseding_title,
196
+ ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
197
+ set(:superseding_subtitle,
198
+ ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
181
199
  end
182
200
  end
183
201
 
184
- def superseding_iteration(d)
185
- return unless d.at(ns("./status/stage"))&.text == "draft-public"
186
- iter = d.at(ns("./status/iteration"))&.text || "1"
202
+ def superseding_iteration(newdoc)
203
+ return unless newdoc.at(ns("./status/stage"))&.text == "draft-public"
204
+
205
+ iter = newdoc.at(ns("./status/iteration"))&.text || "1"
187
206
  case iter.downcase
188
207
  when "1"
189
208
  set(:superseding_iteration_ordinal, "Initial")
@@ -192,21 +211,22 @@ module IsoDoc
192
211
  set(:superseding_iteration_ordinal, "Final")
193
212
  set(:superseding_iteration_code, "FPD")
194
213
  else
195
- set(:superseding_iteration_ordinal, iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
214
+ set(:superseding_iteration_ordinal,
215
+ iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
196
216
  set(:superseding_iteration_code, "#{iter}PD")
197
217
  end
198
218
  end
199
219
 
200
- def superseding_dates(d)
201
- if cdate = d.at(ns("./date[@type = 'circulated']/on"))&.text
220
+ def superseding_dates(newdoc)
221
+ if cdate = newdoc.at(ns("./date[@type = 'circulated']/on"))&.text
202
222
  set(:superseding_circulated_date, cdate)
203
223
  set(:superseding_circulated_date_monthyear, monthyr(cdate))
204
224
  end
205
- if cdate = d.at(ns("./date[@type = 'issued']/on"))&.text
225
+ if cdate = newdoc.at(ns("./date[@type = 'issued']/on"))&.text
206
226
  set(:superseding_issued_date, cdate)
207
227
  set(:superseding_issued_date_monthyear, monthyr(cdate))
208
228
  end
209
- if cdate = d.at(ns("./date[@type = 'updated']/on"))&.text
229
+ if cdate = newdoc.at(ns("./date[@type = 'updated']/on"))&.text
210
230
  set(:superseding_updated_date, cdate)
211
231
  set(:superseding_updated_date_monthyear, monthyr(cdate))
212
232
  set(:superseding_updated_date_MMMddyyyy, MMMddyyyy(cdate))
@@ -214,10 +234,12 @@ module IsoDoc
214
234
  end
215
235
 
216
236
  def note(xml, _out)
217
- note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and set(:additional_note, note)
218
- note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and set(:withdrawal_note, note)
237
+ note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and
238
+ set(:additional_note, note)
239
+ note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and
240
+ set(:withdrawal_note, note)
219
241
  note = xml.at(ns("//bibdata/note[@type = 'withdrawal-announcement-link']"))&.text and
220
- set(:withdrawal_announcement_link, note)
242
+ set(:withdrawal_announcement_link, note)
221
243
  super
222
244
  end
223
245
  end
@@ -5,7 +5,9 @@
5
5
 
6
6
 
7
7
  <xsl:param name="svg_images"/>
8
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
8
9
  <xsl:variable name="images" select="document($svg_images)"/>
10
+ <xsl:param name="basepath"/>
9
11
 
10
12
 
11
13
 
@@ -92,7 +94,9 @@
92
94
 
93
95
  </fo:layout-master-set>
94
96
 
95
- <xsl:call-template name="addPDFUAmeta"/>
97
+ <fo:declarations>
98
+ <xsl:call-template name="addPDFUAmeta"/>
99
+ </fo:declarations>
96
100
 
97
101
  <xsl:call-template name="addBookmarks">
98
102
  <xsl:with-param name="contents" select="$contents"/>
@@ -234,52 +238,28 @@
234
238
  <fo:block margin-top="18pt">
235
239
 
236
240
  <!-- Abstract -->
237
- <xsl:if test="/nist:nist-standard/nist:preface/nist:abstract">
238
- <xsl:variable name="title-abstract">
239
- <xsl:call-template name="getTitle">
240
- <xsl:with-param name="name" select="'title-abstract'"/>
241
- </xsl:call-template>
242
- </xsl:variable>
243
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt"><xsl:value-of select="$title-abstract"/></fo:block>
244
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/>
245
- </xsl:if>
241
+ <!-- Keywords -->
242
+ <!-- Acknowledgements -->
243
+ <xsl:apply-templates select="/nist:nist-standard/nist:preface/*"/>
244
+
245
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/> -->
246
246
 
247
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/> -->
248
+
247
249
  <!-- Keywords -->
248
- <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
250
+ <!-- <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
249
251
  <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">
250
- <xsl:variable name="title-keywords">
251
- <xsl:call-template name="getTitle">
252
- <xsl:with-param name="name" select="'title-keywords'"/>
253
- </xsl:call-template>
254
- </xsl:variable>
255
- <xsl:value-of select="$title-keywords"/>
252
+ <xsl:call-template name="getLocalizedString">
253
+ <xsl:with-param name="key">keywords</xsl:with-param>
254
+ </xsl:call-template>
256
255
  </fo:block>
257
256
  <fo:block margin-bottom="12pt" text-align="justify">
258
257
  <xsl:call-template name="insertKeywords">
259
- <xsl:with-param name="charAtEnd"/>
258
+ <xsl:with-param name="charAtEnd"></xsl:with-param>
260
259
  <xsl:with-param name="charDelim">; </xsl:with-param>
261
260
  </xsl:call-template>
262
- <!-- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
263
- <xsl:sort data-type="text" order="ascending"/>
264
- <xsl:apply-templates/>
265
- <xsl:choose>
266
- <xsl:when test="position() != last()">; </xsl:when>
267
- <xsl:otherwise></xsl:otherwise>
268
- </xsl:choose>
269
- </xsl:for-each> -->
270
261
  </fo:block>
271
- </xsl:if>
272
-
273
- <xsl:if test="/nist:nist-standard/nist:preface/nist:acknowledgements">
274
- <xsl:variable name="title-acknowledgements">
275
- <xsl:call-template name="getTitle">
276
- <xsl:with-param name="name" select="'title-acknowledgements'"/>
277
- </xsl:call-template>
278
- </xsl:variable>
279
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-top="18pt" margin-bottom="12pt"><xsl:value-of select="$title-acknowledgements"/></fo:block>
280
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/>
281
- </xsl:if>
282
-
262
+ </xsl:if> -->
283
263
 
284
264
  <!-- Disclaimer -->
285
265
  <!-- Additional Information -->
@@ -291,8 +271,9 @@
291
271
  <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">Feedback</fo:block>
292
272
  <xsl:text>Feedback on this publication is welcome, and can be sent to: code-signing@nist.gov.</xsl:text>
293
273
 
294
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:clause"/>
295
-
274
+ <!-- Keywords -->
275
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:clause"/> -->
276
+
296
277
  <fo:block break-after="page"/>
297
278
 
298
279
  <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:foreword"/> -->
@@ -422,7 +403,7 @@
422
403
  <xsl:apply-templates select="/nist:nist-standard/nist:annex"/>
423
404
 
424
405
  <!-- Bibliography -->
425
- <xsl:apply-templates select="/nist:nist-standard/nist:bibliography/nist:references"/>
406
+ <xsl:apply-templates select="/nist:nist-standard/nist:bibliography"/>
426
407
 
427
408
  </fo:block>
428
409
 
@@ -621,13 +602,13 @@
621
602
  <!-- ====== -->
622
603
 
623
604
  <xsl:template match="nist:legal-statement//nist:title">
624
- <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" color="{$color}">
605
+ <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" color="{$color}" keep-with-next="always">
625
606
  <xsl:apply-templates/>
626
607
  </fo:block>
627
608
  </xsl:template>
628
609
 
629
610
  <xsl:template match="nist:executivesummary//nist:title">
630
- <fo:block-container color="white" background-color="black" margin-bottom="12pt">
611
+ <fo:block-container color="white" background-color="black" margin-bottom="12pt" keep-with-next="always">
631
612
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="left" margin-left="4mm" padding-top="1mm">
632
613
  <xsl:apply-templates/>
633
614
  </fo:block>
@@ -635,11 +616,19 @@
635
616
  </xsl:template>
636
617
 
637
618
  <xsl:template match="nist:preface//nist:title" priority="3">
638
- <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt" color="{$color}">
619
+ <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt" color="{$color}" keep-with-next="always">
620
+ <xsl:if test="local-name(..) = 'acknowledgements'">
621
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
622
+ </xsl:if>
639
623
  <xsl:apply-templates/>
640
624
  </fo:block>
641
625
  </xsl:template>
642
626
 
627
+ <xsl:template match="/nist:nist-standard/nist:bibliography">
628
+ <fo:block break-after="page"/>
629
+ <xsl:apply-templates/>
630
+ </xsl:template>
631
+
643
632
  <xsl:template match="nist:references">
644
633
  <fo:block id="{@id}">
645
634
  <xsl:apply-templates/>
@@ -1172,6 +1161,9 @@
1172
1161
  <title-continued lang="en">(continued)</title-continued>
1173
1162
  <title-continued lang="fr">(continué)</title-continued>
1174
1163
 
1164
+ </xsl:variable><xsl:variable name="bibdata">
1165
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1166
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1175
1167
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1176
1168
  <xsl:param name="name"/>
1177
1169
  <xsl:param name="lang"/>
@@ -1197,10 +1189,12 @@
1197
1189
  </xsl:choose>
1198
1190
  </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">
1199
1191
 
1192
+
1200
1193
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1201
1194
 
1202
1195
 
1203
1196
 
1197
+
1204
1198
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1205
1199
  <xsl:attribute name="white-space">pre</xsl:attribute>
1206
1200
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1300,6 +1294,7 @@
1300
1294
 
1301
1295
 
1302
1296
 
1297
+
1303
1298
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1304
1299
 
1305
1300
 
@@ -1315,6 +1310,7 @@
1315
1310
 
1316
1311
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1317
1312
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1313
+
1318
1314
 
1319
1315
 
1320
1316
 
@@ -1344,6 +1340,7 @@
1344
1340
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
1345
1341
 
1346
1342
 
1343
+
1347
1344
  <xsl:attribute name="color">blue</xsl:attribute>
1348
1345
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1349
1346
 
@@ -1359,6 +1356,7 @@
1359
1356
 
1360
1357
 
1361
1358
 
1359
+
1362
1360
 
1363
1361
 
1364
1362
 
@@ -1386,6 +1384,7 @@
1386
1384
 
1387
1385
 
1388
1386
 
1387
+
1389
1388
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1390
1389
 
1391
1390
 
@@ -1406,11 +1405,13 @@
1406
1405
 
1407
1406
 
1408
1407
 
1408
+
1409
1409
 
1410
1410
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
1411
1411
 
1412
1412
 
1413
1413
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1414
+
1414
1415
 
1415
1416
 
1416
1417
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -1431,6 +1432,7 @@
1431
1432
 
1432
1433
 
1433
1434
 
1435
+
1434
1436
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1435
1437
 
1436
1438
 
@@ -1439,6 +1441,7 @@
1439
1441
 
1440
1442
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1441
1443
 
1444
+
1442
1445
 
1443
1446
 
1444
1447
 
@@ -1470,6 +1473,7 @@
1470
1473
 
1471
1474
 
1472
1475
 
1476
+
1473
1477
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1474
1478
 
1475
1479
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
@@ -1477,6 +1481,7 @@
1477
1481
 
1478
1482
 
1479
1483
 
1484
+
1480
1485
  <xsl:attribute name="width">75%</xsl:attribute>
1481
1486
  <xsl:attribute name="content-height">100%</xsl:attribute>
1482
1487
  <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
@@ -1498,13 +1503,32 @@
1498
1503
 
1499
1504
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1500
1505
 
1501
-
1506
+
1502
1507
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1503
1508
 
1504
1509
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1505
1510
 
1506
1511
 
1507
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1512
+
1513
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1514
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1515
+ </xsl:variable><xsl:attribute-set name="add-style">
1516
+ <xsl:attribute name="color">red</xsl:attribute>
1517
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1518
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1519
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1520
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1521
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1522
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1523
+ <xsl:text>red</xsl:text>
1524
+ </xsl:variable><xsl:attribute-set name="del-style">
1525
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1526
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1527
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1528
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1529
+
1530
+
1531
+ </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">
1508
1532
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1509
1533
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1510
1534
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1549,16 +1573,17 @@
1549
1573
  <xsl:call-template name="add-zero-spaces-java"/>
1550
1574
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1551
1575
 
1576
+ <xsl:variable name="table-preamble">
1577
+
1578
+
1579
+ </xsl:variable>
1580
+
1552
1581
  <xsl:variable name="table">
1553
1582
 
1554
1583
  <xsl:variable name="simple-table">
1555
1584
  <xsl:call-template name="getSimpleTable"/>
1556
1585
  </xsl:variable>
1557
1586
 
1558
-
1559
-
1560
-
1561
-
1562
1587
  <!-- <xsl:if test="$namespace = 'bipm'">
1563
1588
  <fo:block>&#xA0;</fo:block>
1564
1589
  </xsl:if> -->
@@ -1571,7 +1596,7 @@
1571
1596
 
1572
1597
 
1573
1598
 
1574
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1599
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1575
1600
 
1576
1601
  <!-- <xsl:variable name="cols-count">
1577
1602
  <xsl:choose>
@@ -1590,8 +1615,6 @@
1590
1615
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1591
1616
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1592
1617
 
1593
-
1594
-
1595
1618
  <xsl:variable name="colwidths">
1596
1619
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1597
1620
  <xsl:call-template name="calculate-column-widths">
@@ -1619,9 +1642,11 @@
1619
1642
  </xsl:choose>
1620
1643
  </xsl:variable>
1621
1644
 
1645
+
1622
1646
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1623
1647
 
1624
1648
 
1649
+
1625
1650
  <xsl:attribute name="space-after">6pt</xsl:attribute>
1626
1651
 
1627
1652
 
@@ -1646,6 +1671,8 @@
1646
1671
 
1647
1672
 
1648
1673
 
1674
+
1675
+
1649
1676
  <xsl:variable name="table_width">
1650
1677
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1651
1678
  100%
@@ -1662,6 +1689,8 @@
1662
1689
 
1663
1690
 
1664
1691
 
1692
+
1693
+
1665
1694
 
1666
1695
 
1667
1696
 
@@ -1751,7 +1780,8 @@
1751
1780
  </fo:block-container>
1752
1781
  </xsl:variable>
1753
1782
 
1754
-
1783
+ <xsl:variable name="isAdded" select="@added"/>
1784
+ <xsl:variable name="isDeleted" select="@deleted"/>
1755
1785
 
1756
1786
  <xsl:choose>
1757
1787
  <xsl:when test="@width">
@@ -1765,7 +1795,14 @@
1765
1795
  <fo:table-body>
1766
1796
  <fo:table-row>
1767
1797
  <fo:table-cell column-number="2">
1768
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1798
+ <xsl:copy-of select="$table-preamble"/>
1799
+ <fo:block>
1800
+ <xsl:call-template name="setTrackChangesStyles">
1801
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1802
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1803
+ </xsl:call-template>
1804
+ <xsl:copy-of select="$table"/>
1805
+ </fo:block>
1769
1806
  </fo:table-cell>
1770
1807
  </fo:table-row>
1771
1808
  </fo:table-body>
@@ -1776,16 +1813,42 @@
1776
1813
 
1777
1814
  </xsl:when>
1778
1815
  <xsl:otherwise>
1779
- <xsl:copy-of select="$table"/>
1816
+ <xsl:choose>
1817
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1818
+ <xsl:copy-of select="$table-preamble"/>
1819
+ <fo:block>
1820
+ <xsl:call-template name="setTrackChangesStyles">
1821
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1822
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1823
+ </xsl:call-template>
1824
+ <xsl:copy-of select="$table"/>
1825
+ </fo:block>
1826
+ </xsl:when>
1827
+ <xsl:otherwise>
1828
+ <xsl:copy-of select="$table-preamble"/>
1829
+ <xsl:copy-of select="$table"/>
1830
+ </xsl:otherwise>
1831
+ </xsl:choose>
1780
1832
  </xsl:otherwise>
1781
1833
  </xsl:choose>
1782
1834
 
1783
1835
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1836
+ <xsl:param name="continued"/>
1784
1837
  <xsl:if test="normalize-space() != ''">
1785
1838
  <fo:block xsl:use-attribute-sets="table-name-style">
1786
1839
 
1787
1840
 
1788
- <xsl:apply-templates/>
1841
+ <xsl:choose>
1842
+ <xsl:when test="$continued = 'true'">
1843
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1844
+
1845
+ </xsl:when>
1846
+ <xsl:otherwise>
1847
+ <xsl:apply-templates/>
1848
+ </xsl:otherwise>
1849
+ </xsl:choose>
1850
+
1851
+
1789
1852
  </fo:block>
1790
1853
  </xsl:if>
1791
1854
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1837,7 +1900,7 @@
1837
1900
  </xsl:for-each>
1838
1901
  </xsl:when>
1839
1902
  <xsl:otherwise>
1840
- <xsl:for-each select="xalan:nodeset($table)//tr">
1903
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1841
1904
  <xsl:variable name="td_text">
1842
1905
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1843
1906
 
@@ -1907,7 +1970,15 @@
1907
1970
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1908
1971
  <xsl:value-of select="@target"/>
1909
1972
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1910
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1973
+ <xsl:variable name="mathml">
1974
+ <xsl:for-each select="*">
1975
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1976
+ <xsl:copy-of select="."/>
1977
+ </xsl:if>
1978
+ </xsl:for-each>
1979
+ </xsl:variable>
1980
+
1981
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1911
1982
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1912
1983
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1913
1984
  <xsl:param name="cols-count"/>
@@ -1917,18 +1988,18 @@
1917
1988
  <xsl:apply-templates/>
1918
1989
  </fo:table-header>
1919
1990
  </xsl:template><xsl:template name="table-header-title">
1920
- <xsl:param name="cols-count"/>
1991
+ <xsl:param name="cols-count"/>
1921
1992
  <!-- row for title -->
1922
1993
  <fo:table-row>
1923
1994
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
1924
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1995
+
1996
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1997
+ <xsl:with-param name="continued">true</xsl:with-param>
1998
+ </xsl:apply-templates>
1925
1999
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1926
2000
  <xsl:call-template name="fn_name_display"/>
1927
- </xsl:for-each>
1928
- <fo:block text-align="right" font-style="italic">
1929
- <xsl:text> </xsl:text>
1930
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1931
- </fo:block>
2001
+ </xsl:for-each>
2002
+
1932
2003
  </fo:table-cell>
1933
2004
  </fo:table-row>
1934
2005
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2152,6 +2223,7 @@
2152
2223
 
2153
2224
 
2154
2225
 
2226
+
2155
2227
  </xsl:if>
2156
2228
  <xsl:if test="$parent-name = 'tfoot'">
2157
2229
 
@@ -2172,7 +2244,8 @@
2172
2244
  <xsl:attribute name="text-align">
2173
2245
  <xsl:choose>
2174
2246
  <xsl:when test="@align">
2175
- <xsl:value-of select="@align"/>
2247
+ <xsl:call-template name="setAlignment"/>
2248
+ <!-- <xsl:value-of select="@align"/> -->
2176
2249
  </xsl:when>
2177
2250
  <xsl:otherwise>center</xsl:otherwise>
2178
2251
  </xsl:choose>
@@ -2181,6 +2254,7 @@
2181
2254
 
2182
2255
 
2183
2256
 
2257
+
2184
2258
  <xsl:attribute name="text-align">center</xsl:attribute>
2185
2259
  <xsl:attribute name="background-color">black</xsl:attribute>
2186
2260
  <xsl:attribute name="color">white</xsl:attribute>
@@ -2192,6 +2266,9 @@
2192
2266
 
2193
2267
 
2194
2268
 
2269
+ <xsl:if test="$lang = 'ar'">
2270
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2271
+ </xsl:if>
2195
2272
  <xsl:if test="@colspan">
2196
2273
  <xsl:attribute name="number-columns-spanned">
2197
2274
  <xsl:value-of select="@colspan"/>
@@ -2223,11 +2300,16 @@
2223
2300
  <xsl:attribute name="text-align">
2224
2301
  <xsl:choose>
2225
2302
  <xsl:when test="@align">
2226
- <xsl:value-of select="@align"/>
2303
+ <xsl:call-template name="setAlignment"/>
2304
+ <!-- <xsl:value-of select="@align"/> -->
2227
2305
  </xsl:when>
2228
2306
  <xsl:otherwise>left</xsl:otherwise>
2229
2307
  </xsl:choose>
2230
2308
  </xsl:attribute>
2309
+ <xsl:if test="$lang = 'ar'">
2310
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2311
+ </xsl:if>
2312
+
2231
2313
 
2232
2314
 
2233
2315
 
@@ -2243,6 +2325,9 @@
2243
2325
  </xsl:if>
2244
2326
 
2245
2327
 
2328
+ <xsl:if test=".//*[local-name() = 'table']">
2329
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2330
+ </xsl:if>
2246
2331
  <xsl:if test="@colspan">
2247
2332
  <xsl:attribute name="number-columns-spanned">
2248
2333
  <xsl:value-of select="@colspan"/>
@@ -2374,13 +2459,13 @@
2374
2459
  </xsl:choose>
2375
2460
  </xsl:variable>
2376
2461
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2377
- <xsl:element name="{$ns}:table">
2462
+ <!-- <xsl:element name="{$ns}:table"> -->
2378
2463
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2379
2464
  <tbody>
2380
2465
  <xsl:apply-templates mode="dl"/>
2381
2466
  </tbody>
2382
2467
  </xsl:for-each>
2383
- </xsl:element>
2468
+ <!-- </xsl:element> -->
2384
2469
  </xsl:variable>
2385
2470
 
2386
2471
  <xsl:call-template name="calculate-column-widths">
@@ -2476,6 +2561,8 @@
2476
2561
  <xsl:apply-templates/>
2477
2562
  </fo:inline>
2478
2563
  </xsl:template><xsl:template match="*[local-name()='dl']">
2564
+ <xsl:variable name="isAdded" select="@added"/>
2565
+ <xsl:variable name="isDeleted" select="@deleted"/>
2479
2566
  <fo:block-container>
2480
2567
 
2481
2568
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2492,6 +2579,12 @@
2492
2579
  </xsl:attribute>
2493
2580
 
2494
2581
  </xsl:if>
2582
+
2583
+ <xsl:call-template name="setTrackChangesStyles">
2584
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2585
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2586
+ </xsl:call-template>
2587
+
2495
2588
  <fo:block-container>
2496
2589
 
2497
2590
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2607,11 +2700,11 @@
2607
2700
  </xsl:choose>
2608
2701
  </xsl:variable>
2609
2702
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2610
- <xsl:element name="{$ns}:table">
2703
+ <!-- <xsl:element name="{$ns}:table"> -->
2611
2704
  <tbody>
2612
2705
  <xsl:apply-templates mode="dl"/>
2613
2706
  </tbody>
2614
- </xsl:element>
2707
+ <!-- </xsl:element> -->
2615
2708
  </xsl:variable>
2616
2709
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2617
2710
  <xsl:variable name="colwidths">
@@ -2877,6 +2970,7 @@
2877
2970
 
2878
2971
 
2879
2972
 
2973
+
2880
2974
 
2881
2975
  </xsl:variable>
2882
2976
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2894,8 +2988,78 @@
2894
2988
  <fo:inline text-decoration="underline">
2895
2989
  <xsl:apply-templates/>
2896
2990
  </fo:inline>
2991
+ </xsl:template><xsl:template match="*[local-name()='add']">
2992
+ <xsl:choose>
2993
+ <xsl:when test="@amendment">
2994
+ <fo:inline>
2995
+ <xsl:call-template name="insertTag">
2996
+ <xsl:with-param name="kind">A</xsl:with-param>
2997
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2998
+ </xsl:call-template>
2999
+ <xsl:apply-templates/>
3000
+ <xsl:call-template name="insertTag">
3001
+ <xsl:with-param name="type">closing</xsl:with-param>
3002
+ <xsl:with-param name="kind">A</xsl:with-param>
3003
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3004
+ </xsl:call-template>
3005
+ </fo:inline>
3006
+ </xsl:when>
3007
+ <xsl:when test="@corrigenda">
3008
+ <fo:inline>
3009
+ <xsl:call-template name="insertTag">
3010
+ <xsl:with-param name="kind">C</xsl:with-param>
3011
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3012
+ </xsl:call-template>
3013
+ <xsl:apply-templates/>
3014
+ <xsl:call-template name="insertTag">
3015
+ <xsl:with-param name="type">closing</xsl:with-param>
3016
+ <xsl:with-param name="kind">C</xsl:with-param>
3017
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3018
+ </xsl:call-template>
3019
+ </fo:inline>
3020
+ </xsl:when>
3021
+ <xsl:otherwise>
3022
+ <fo:inline xsl:use-attribute-sets="add-style">
3023
+ <xsl:apply-templates/>
3024
+ </fo:inline>
3025
+ </xsl:otherwise>
3026
+ </xsl:choose>
3027
+
3028
+ </xsl:template><xsl:template name="insertTag">
3029
+ <xsl:param name="type"/>
3030
+ <xsl:param name="kind"/>
3031
+ <xsl:param name="value"/>
3032
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3033
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3034
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3035
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3036
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3037
+ <xsl:attribute name="height">5mm</xsl:attribute>
3038
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3039
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3040
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3041
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3042
+ <g>
3043
+ <xsl:if test="$type = 'closing'">
3044
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3045
+ </xsl:if>
3046
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3047
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3048
+ </g>
3049
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3050
+ <xsl:if test="$type = 'closing'">
3051
+ <xsl:attribute name="x">25</xsl:attribute>
3052
+ </xsl:if>
3053
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3054
+ </text>
3055
+ </svg>
3056
+ </fo:instream-foreign-object>
2897
3057
  </xsl:template><xsl:template match="*[local-name()='del']">
2898
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3058
+ <fo:inline xsl:use-attribute-sets="del-style">
3059
+ <xsl:apply-templates/>
3060
+ </fo:inline>
3061
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3062
+ <fo:inline background-color="yellow">
2899
3063
  <xsl:apply-templates/>
2900
3064
  </fo:inline>
2901
3065
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3188,11 +3352,15 @@
3188
3352
  </xsl:apply-templates>
3189
3353
  </xsl:template><xsl:template name="getLang">
3190
3354
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3355
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3191
3356
  <xsl:variable name="language">
3192
3357
  <xsl:choose>
3193
3358
  <xsl:when test="$language_current != ''">
3194
3359
  <xsl:value-of select="$language_current"/>
3195
3360
  </xsl:when>
3361
+ <xsl:when test="$language_current_2 != ''">
3362
+ <xsl:value-of select="$language_current_2"/>
3363
+ </xsl:when>
3196
3364
  <xsl:otherwise>
3197
3365
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3198
3366
  </xsl:otherwise>
@@ -3232,12 +3400,23 @@
3232
3400
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3233
3401
  <xsl:value-of select="substring($str, 2)"/>
3234
3402
  </xsl:template><xsl:template match="mathml:math">
3235
- <fo:inline font-family="STIX Two Math"> <!-- -->
3403
+ <xsl:variable name="isAdded" select="@added"/>
3404
+ <xsl:variable name="isDeleted" select="@deleted"/>
3405
+
3406
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3407
+
3408
+
3409
+ <xsl:call-template name="setTrackChangesStyles">
3410
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3411
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3412
+ </xsl:call-template>
3236
3413
 
3237
3414
  <xsl:variable name="mathml">
3238
3415
  <xsl:apply-templates select="." mode="mathml"/>
3239
3416
  </xsl:variable>
3240
3417
  <fo:instream-foreign-object fox:alt-text="Math">
3418
+
3419
+
3241
3420
  <!-- <xsl:copy-of select="."/> -->
3242
3421
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3243
3422
  </fo:instream-foreign-object>
@@ -3256,7 +3435,7 @@
3256
3435
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3257
3436
  </xsl:copy>
3258
3437
  <mathml:mspace width="0.5ex"/>
3259
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3438
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3260
3439
  <xsl:variable name="target">
3261
3440
  <xsl:choose>
3262
3441
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3290,8 +3469,6 @@
3290
3469
  </xsl:otherwise>
3291
3470
  </xsl:choose>
3292
3471
  </fo:inline>
3293
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3294
- <fo:inline id="{@id}"/>
3295
3472
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3296
3473
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3297
3474
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3396,6 +3573,7 @@
3396
3573
 
3397
3574
 
3398
3575
  <fo:inline xsl:use-attribute-sets="note-name-style">
3576
+
3399
3577
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3400
3578
  </fo:inline>
3401
3579
  <xsl:apply-templates/>
@@ -3422,6 +3600,7 @@
3422
3600
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3423
3601
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3424
3602
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3603
+
3425
3604
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3426
3605
  </fo:inline>
3427
3606
  <xsl:apply-templates/>
@@ -3487,8 +3666,15 @@
3487
3666
  </fo:inline>
3488
3667
  </xsl:if>
3489
3668
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3669
+ <xsl:variable name="isAdded" select="@added"/>
3670
+ <xsl:variable name="isDeleted" select="@deleted"/>
3490
3671
  <fo:block-container id="{@id}">
3491
3672
 
3673
+ <xsl:call-template name="setTrackChangesStyles">
3674
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3675
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3676
+ </xsl:call-template>
3677
+
3492
3678
  <fo:block>
3493
3679
  <xsl:apply-templates/>
3494
3680
  </fo:block>
@@ -3496,48 +3682,137 @@
3496
3682
  <xsl:for-each select="*[local-name() = 'note']">
3497
3683
  <xsl:call-template name="note"/>
3498
3684
  </xsl:for-each>
3499
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3685
+
3686
+
3687
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3688
+
3500
3689
  </fo:block-container>
3501
3690
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3502
3691
  <fo:block id="{@id}">
3503
3692
  <xsl:apply-templates/>
3504
3693
  </fo:block>
3694
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3505
3695
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3506
3696
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3507
3697
  <xsl:apply-templates/>
3508
3698
  </fo:block>
3509
3699
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3510
- <fo:block xsl:use-attribute-sets="image-style">
3511
-
3512
-
3513
- <xsl:variable name="src">
3514
- <xsl:choose>
3515
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3516
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3517
- </xsl:when>
3518
- <xsl:otherwise>
3519
- <xsl:value-of select="@src"/>
3520
- </xsl:otherwise>
3521
- </xsl:choose>
3522
- </xsl:variable>
3523
-
3524
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3525
- </fo:block>
3700
+ <xsl:variable name="isAdded" select="../@added"/>
3701
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3702
+ <xsl:choose>
3703
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3704
+ <fo:inline padding-left="1mm" padding-right="1mm">
3705
+ <xsl:variable name="src">
3706
+ <xsl:call-template name="image_src"/>
3707
+ </xsl:variable>
3708
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3709
+ </fo:inline>
3710
+ </xsl:when>
3711
+ <xsl:otherwise>
3712
+ <fo:block xsl:use-attribute-sets="image-style">
3713
+
3714
+ <xsl:variable name="src">
3715
+ <xsl:call-template name="image_src"/>
3716
+ </xsl:variable>
3717
+
3718
+ <xsl:choose>
3719
+ <xsl:when test="$isDeleted = 'true'">
3720
+ <!-- enclose in svg -->
3721
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3722
+ <xsl:attribute name="width">100%</xsl:attribute>
3723
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3724
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3725
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3726
+
3727
+
3728
+ <xsl:apply-templates select="." mode="cross_image"/>
3729
+
3730
+ </fo:instream-foreign-object>
3731
+ </xsl:when>
3732
+ <xsl:otherwise>
3733
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3734
+ </xsl:otherwise>
3735
+ </xsl:choose>
3736
+
3737
+ </fo:block>
3738
+ </xsl:otherwise>
3739
+ </xsl:choose>
3740
+ </xsl:template><xsl:template name="image_src">
3741
+ <xsl:choose>
3742
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3743
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3744
+ </xsl:when>
3745
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3746
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3747
+ </xsl:when>
3748
+ <xsl:otherwise>
3749
+ <xsl:value-of select="@src"/>
3750
+ </xsl:otherwise>
3751
+ </xsl:choose>
3752
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3753
+ <xsl:choose>
3754
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3755
+ <xsl:variable name="src">
3756
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3757
+ </xsl:variable>
3758
+ <xsl:variable name="width" select="document($src)/@width"/>
3759
+ <xsl:variable name="height" select="document($src)/@height"/>
3760
+ <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">
3761
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3762
+ </svg>
3763
+ </xsl:when>
3764
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3765
+ <xsl:variable name="src">
3766
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3767
+ </xsl:variable>
3768
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3769
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3770
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3771
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3772
+ <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">
3773
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3774
+ </svg>
3775
+ </xsl:when>
3776
+ <xsl:otherwise>
3777
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3778
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3779
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3780
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3781
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3782
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3783
+ <!-- width=<xsl:value-of select="$width"/> -->
3784
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3785
+ <!-- height=<xsl:value-of select="$height"/> -->
3786
+ <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">
3787
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3788
+ <xsl:call-template name="svg_cross">
3789
+ <xsl:with-param name="width" select="$width"/>
3790
+ <xsl:with-param name="height" select="$height"/>
3791
+ </xsl:call-template>
3792
+ </svg>
3793
+ </xsl:otherwise>
3794
+ </xsl:choose>
3795
+
3796
+ </xsl:template><xsl:template name="svg_cross">
3797
+ <xsl:param name="width"/>
3798
+ <xsl:param name="height"/>
3799
+ <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; "/>
3800
+ <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; "/>
3526
3801
  </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">
3527
3802
  <xsl:apply-templates mode="contents"/>
3528
3803
  <xsl:text> </xsl:text>
3529
3804
  </xsl:template><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="bookmarks">
3530
3805
  <xsl:apply-templates mode="bookmarks"/>
3531
3806
  <xsl:text> </xsl:text>
3532
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3807
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
3533
3808
  <xsl:value-of select="."/>
3534
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3809
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3535
3810
  <xsl:value-of select="."/>
3536
3811
  </xsl:template><xsl:template match="node()" mode="contents">
3537
3812
  <xsl:apply-templates mode="contents"/>
3538
3813
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3539
3814
  <xsl:apply-templates mode="bookmarks"/>
3540
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3815
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3541
3816
  <xsl:apply-templates select="."/>
3542
3817
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3543
3818
  <xsl:apply-templates mode="bookmarks"/>
@@ -3740,6 +4015,8 @@
3740
4015
  </fo:list-item-body>
3741
4016
  </fo:list-item>
3742
4017
  </fo:list-block>
4018
+ </xsl:template><xsl:template name="extractSection">
4019
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3743
4020
  </xsl:template><xsl:template name="extractTitle">
3744
4021
  <xsl:choose>
3745
4022
  <xsl:when test="*[local-name() = 'tab']">
@@ -3787,6 +4064,7 @@
3787
4064
 
3788
4065
 
3789
4066
 
4067
+
3790
4068
 
3791
4069
 
3792
4070
  10
@@ -4069,6 +4347,7 @@
4069
4347
  <xsl:variable name="element">
4070
4348
  block
4071
4349
 
4350
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4072
4351
  </xsl:variable>
4073
4352
  <xsl:choose>
4074
4353
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4076,7 +4355,7 @@
4076
4355
  <xsl:apply-templates/>
4077
4356
  </fo:inline>
4078
4357
  </xsl:when>
4079
- <xsl:when test="normalize-space($element) = 'block'">
4358
+ <xsl:when test="contains(normalize-space($element), 'block')">
4080
4359
  <fo:block xsl:use-attribute-sets="example-name-style">
4081
4360
  <xsl:apply-templates/>
4082
4361
  </fo:block>
@@ -4089,10 +4368,11 @@
4089
4368
  </xsl:choose>
4090
4369
 
4091
4370
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4092
-
4371
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4093
4372
  <xsl:variable name="element">
4094
4373
  block
4095
4374
 
4375
+
4096
4376
  </xsl:variable>
4097
4377
  <xsl:choose>
4098
4378
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4112,7 +4392,7 @@
4112
4392
  </fo:inline>
4113
4393
  </xsl:otherwise>
4114
4394
  </xsl:choose>
4115
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4395
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4116
4396
  <fo:block xsl:use-attribute-sets="termsource-style">
4117
4397
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4118
4398
  <xsl:variable name="termsource_text">
@@ -4121,13 +4401,15 @@
4121
4401
 
4122
4402
  <xsl:choose>
4123
4403
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4124
- <xsl:apply-templates/>
4404
+ <!-- <xsl:apply-templates /> -->
4405
+ <xsl:copy-of select="$termsource_text"/>
4125
4406
  </xsl:when>
4126
4407
  <xsl:otherwise>
4127
4408
 
4128
4409
  <xsl:text>[</xsl:text>
4129
4410
 
4130
- <xsl:apply-templates/>
4411
+ <!-- <xsl:apply-templates /> -->
4412
+ <xsl:copy-of select="$termsource_text"/>
4131
4413
 
4132
4414
  <xsl:text>]</xsl:text>
4133
4415
 
@@ -4138,8 +4420,15 @@
4138
4420
  <xsl:if test="normalize-space() != ''">
4139
4421
  <xsl:value-of select="."/>
4140
4422
  </xsl:if>
4141
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4423
+ </xsl:template><xsl:variable name="localized.source">
4424
+ <xsl:call-template name="getLocalizedString">
4425
+ <xsl:with-param name="key">source</xsl:with-param>
4426
+ </xsl:call-template>
4427
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4142
4428
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4429
+ <xsl:if test="normalize-space(@citeas) = ''">
4430
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4431
+ </xsl:if>
4143
4432
 
4144
4433
  <fo:inline xsl:use-attribute-sets="origin-style">
4145
4434
  <xsl:apply-templates/>
@@ -4188,31 +4477,49 @@
4188
4477
  <xsl:text>— </xsl:text>
4189
4478
  <xsl:apply-templates/>
4190
4479
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4191
- <fo:inline xsl:use-attribute-sets="eref-style">
4192
- <xsl:if test="@type = 'footnote'">
4193
-
4194
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4195
- <xsl:attribute name="font-size">80%</xsl:attribute>
4196
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4197
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4198
-
4199
-
4200
- </xsl:if>
4201
-
4202
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4203
-
4204
- <xsl:if test="@type = 'inline'">
4205
-
4206
-
4207
-
4208
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4209
-
4210
- </xsl:if>
4211
-
4212
-
4213
- <xsl:apply-templates/>
4214
- </fo:basic-link>
4215
- </fo:inline>
4480
+
4481
+ <xsl:variable name="bibitemid">
4482
+ <xsl:choose>
4483
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4484
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4485
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4486
+ </xsl:choose>
4487
+ </xsl:variable>
4488
+
4489
+ <xsl:choose>
4490
+ <xsl:when test="normalize-space($bibitemid) != ''">
4491
+ <fo:inline xsl:use-attribute-sets="eref-style">
4492
+ <xsl:if test="@type = 'footnote'">
4493
+
4494
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4495
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4496
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4497
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4498
+
4499
+
4500
+ </xsl:if>
4501
+
4502
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4503
+ <xsl:if test="normalize-space(@citeas) = ''">
4504
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4505
+ </xsl:if>
4506
+ <xsl:if test="@type = 'inline'">
4507
+
4508
+
4509
+
4510
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4511
+
4512
+ </xsl:if>
4513
+
4514
+ <xsl:apply-templates/>
4515
+ </fo:basic-link>
4516
+
4517
+ </fo:inline>
4518
+ </xsl:when>
4519
+ <xsl:otherwise>
4520
+ <fo:inline><xsl:apply-templates/></fo:inline>
4521
+ </xsl:otherwise>
4522
+ </xsl:choose>
4216
4523
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4217
4524
  <!-- zero-space char -->
4218
4525
  <xsl:variable name="depth">
@@ -4270,7 +4577,8 @@
4270
4577
  </fo:inline>
4271
4578
  </xsl:when>
4272
4579
  <xsl:otherwise>
4273
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4580
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4581
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4274
4582
  </xsl:otherwise>
4275
4583
  </xsl:choose>
4276
4584
 
@@ -4324,7 +4632,6 @@
4324
4632
 
4325
4633
 
4326
4634
 
4327
-
4328
4635
  <xsl:apply-templates/>
4329
4636
  </fo:block>
4330
4637
 
@@ -4373,7 +4680,7 @@
4373
4680
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4374
4681
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4375
4682
  <xsl:choose>
4376
- <xsl:when test="parent::*[local-name() = 'note']">
4683
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4377
4684
  <fo:block-container>
4378
4685
  <xsl:attribute name="margin-left">
4379
4686
  <xsl:choose>
@@ -4383,6 +4690,7 @@
4383
4690
  </xsl:attribute>
4384
4691
 
4385
4692
 
4693
+
4386
4694
  <fo:block-container margin-left="0mm">
4387
4695
  <fo:block>
4388
4696
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4396,6 +4704,153 @@
4396
4704
  </fo:block>
4397
4705
  </xsl:otherwise>
4398
4706
  </xsl:choose>
4707
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4708
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4709
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4710
+ </xsl:for-each>
4711
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4712
+ <xsl:copy>
4713
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4714
+ </xsl:copy>
4715
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4716
+ <xsl:variable name="id">
4717
+ <xsl:call-template name="generateIndexXrefId"/>
4718
+ </xsl:variable>
4719
+ <xsl:copy> <!-- add id to xref -->
4720
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4721
+ <xsl:attribute name="id">
4722
+ <xsl:value-of select="$id"/>
4723
+ </xsl:attribute>
4724
+ <xsl:apply-templates mode="index_add_id"/>
4725
+ </xsl:copy>
4726
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4727
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4728
+ <xsl:if test="@to">
4729
+ <xsl:value-of select="$dash"/>
4730
+ <xsl:copy>
4731
+ <xsl:copy-of select="@*"/>
4732
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4733
+ <xsl:attribute name="id">
4734
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4735
+ </xsl:attribute>
4736
+ <xsl:apply-templates mode="index_add_id"/>
4737
+ </xsl:copy>
4738
+ </xsl:if>
4739
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4740
+ <xsl:copy>
4741
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4742
+ </xsl:copy>
4743
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4744
+ <xsl:copy>
4745
+ <xsl:apply-templates select="@*" mode="index_update"/>
4746
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4747
+ </xsl:copy>
4748
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4749
+ <xsl:param name="element"/>
4750
+ <xsl:param name="remove" select="'false'"/>
4751
+ <xsl:param name="target"/>
4752
+ <!-- <node></node> -->
4753
+ <xsl:choose>
4754
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4755
+ <!-- skip text (i.e. remove it) and process next element -->
4756
+ <!-- [removed_<xsl:value-of select="."/>] -->
4757
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4758
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4759
+ </xsl:apply-templates>
4760
+ </xsl:when>
4761
+ <xsl:when test="self::text()">
4762
+ <xsl:value-of select="."/>
4763
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4764
+ </xsl:when>
4765
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4766
+ <xsl:variable name="id" select="@id"/>
4767
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4768
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4769
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4770
+
4771
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4772
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4773
+
4774
+ <xsl:choose>
4775
+ <!-- 2nd pass -->
4776
+ <!-- if page is equal to page for next and page is not the end of range -->
4777
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4778
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4779
+ <!-- [removed_xref] -->
4780
+
4781
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4782
+ <xsl:with-param name="remove">true</xsl:with-param>
4783
+ <xsl:with-param name="target">
4784
+ <xsl:choose>
4785
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4786
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4787
+ </xsl:choose>
4788
+ </xsl:with-param>
4789
+ </xsl:apply-templates>
4790
+ </xsl:when>
4791
+
4792
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4793
+ <!-- remove xref -->
4794
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4795
+ <xsl:with-param name="remove">true</xsl:with-param>
4796
+ </xsl:apply-templates>
4797
+ </xsl:when>
4798
+
4799
+ <xsl:otherwise>
4800
+ <xsl:apply-templates select="." mode="xref_copy">
4801
+ <xsl:with-param name="target" select="$target"/>
4802
+ </xsl:apply-templates>
4803
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4804
+ </xsl:otherwise>
4805
+ </xsl:choose>
4806
+ </xsl:when>
4807
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4808
+ <!-- ul -->
4809
+ <xsl:apply-templates select="." mode="index_update"/>
4810
+ </xsl:when>
4811
+ <xsl:otherwise>
4812
+ <xsl:apply-templates select="." mode="xref_copy">
4813
+ <xsl:with-param name="target" select="$target"/>
4814
+ </xsl:apply-templates>
4815
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4816
+ </xsl:otherwise>
4817
+ </xsl:choose>
4818
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4819
+ <xsl:param name="target"/>
4820
+ <xsl:copy>
4821
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4822
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4823
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4824
+ </xsl:if>
4825
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4826
+ </xsl:copy>
4827
+ </xsl:template><xsl:template name="generateIndexXrefId">
4828
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4829
+
4830
+ <xsl:variable name="docid">
4831
+ <xsl:call-template name="getDocumentId"/>
4832
+ </xsl:variable>
4833
+ <xsl:variable name="item_number">
4834
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4835
+ </xsl:variable>
4836
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4837
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4838
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4839
+ <xsl:apply-templates/>
4840
+ <fo:block>
4841
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4842
+ <fo:block> </fo:block>
4843
+ </xsl:if>
4844
+ </fo:block>
4845
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4846
+ <xsl:apply-templates/>
4847
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4848
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4849
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4850
+ <xsl:apply-templates/>
4851
+ </fo:block>
4852
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4853
+ <fo:inline id="{@id}" font-size="1pt"/>
4399
4854
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4400
4855
  <!-- <row>
4401
4856
  <date>05-07-2013</date>
@@ -4439,6 +4894,10 @@
4439
4894
 
4440
4895
 
4441
4896
 
4897
+
4898
+
4899
+
4900
+
4442
4901
  </xsl:template><xsl:template name="processBibitemDocId">
4443
4902
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
4444
4903
  <xsl:choose>
@@ -4495,6 +4954,70 @@
4495
4954
  <xsl:value-of select="substring(.,1,1)"/>
4496
4955
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4497
4956
  <fo:inline><xsl:apply-templates/></fo:inline>
4957
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4958
+ <fo:block>
4959
+ <xsl:apply-templates/>
4960
+ </fo:block>
4961
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4962
+ <fo:inline><xsl:apply-templates/></fo:inline>
4963
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4964
+ <fo:inline>
4965
+ <xsl:call-template name="text_input"/>
4966
+ </fo:inline>
4967
+ </xsl:template><xsl:template name="text_input">
4968
+ <xsl:variable name="count">
4969
+ <xsl:choose>
4970
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4971
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4972
+ <xsl:otherwise>10</xsl:otherwise>
4973
+ </xsl:choose>
4974
+ </xsl:variable>
4975
+ <xsl:call-template name="repeat">
4976
+ <xsl:with-param name="char" select="'_'"/>
4977
+ <xsl:with-param name="count" select="$count"/>
4978
+ </xsl:call-template>
4979
+ <xsl:text> </xsl:text>
4980
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4981
+ <xsl:variable name="caption">
4982
+ <xsl:choose>
4983
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4984
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4985
+ </xsl:choose>
4986
+ </xsl:variable>
4987
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4988
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4989
+ <fo:inline padding-right="1mm">
4990
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4991
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4992
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4993
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4994
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4995
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4996
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4997
+ </svg>
4998
+ </fo:instream-foreign-object>
4999
+ </fo:inline>
5000
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5001
+ <fo:inline padding-right="1mm">
5002
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5003
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5004
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5005
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5006
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5007
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5008
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5009
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5010
+ </svg>
5011
+ </fo:instream-foreign-object>
5012
+ </fo:inline>
5013
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5014
+ <fo:inline>
5015
+ <xsl:call-template name="text_input"/>
5016
+ </fo:inline>
5017
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5018
+ <fo:block-container border="1pt solid black" width="50%">
5019
+ <fo:block> </fo:block>
5020
+ </fo:block-container>
4498
5021
  </xsl:template><xsl:template name="convertDate">
4499
5022
  <xsl:param name="date"/>
4500
5023
  <xsl:param name="format" select="'short'"/>
@@ -4614,70 +5137,68 @@
4614
5137
  <xsl:variable name="lang">
4615
5138
  <xsl:call-template name="getLang"/>
4616
5139
  </xsl:variable>
4617
- <fo:declarations>
4618
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4619
- <pdf:dictionary type="normal" key="ViewerPreferences">
4620
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4621
- </pdf:dictionary>
4622
- </pdf:catalog>
4623
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4624
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4625
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4626
- <!-- Dublin Core properties go here -->
4627
- <dc:title>
4628
- <xsl:variable name="title">
4629
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4630
-
4631
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4632
-
4633
-
4634
-
4635
-
4636
-
4637
-
4638
- </xsl:for-each>
4639
- </xsl:variable>
4640
- <xsl:choose>
4641
- <xsl:when test="normalize-space($title) != ''">
4642
- <xsl:value-of select="$title"/>
4643
- </xsl:when>
4644
- <xsl:otherwise>
4645
- <xsl:text> </xsl:text>
4646
- </xsl:otherwise>
4647
- </xsl:choose>
4648
- </dc:title>
4649
- <dc:creator>
5140
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5141
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5142
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5143
+ </pdf:dictionary>
5144
+ </pdf:catalog>
5145
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5146
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5147
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5148
+ <!-- Dublin Core properties go here -->
5149
+ <dc:title>
5150
+ <xsl:variable name="title">
4650
5151
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4651
5152
 
5153
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4652
5154
 
4653
5155
 
4654
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4655
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4656
- <xsl:if test="position() != last()">; </xsl:if>
4657
- </xsl:for-each>
4658
-
4659
- </xsl:for-each>
4660
- </dc:creator>
4661
- <dc:description>
4662
- <xsl:variable name="abstract">
4663
5156
 
4664
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4665
5157
 
4666
5158
 
4667
- </xsl:variable>
4668
- <xsl:value-of select="normalize-space($abstract)"/>
4669
- </dc:description>
4670
- <pdf:Keywords>
4671
- <xsl:call-template name="insertKeywords"/>
4672
- </pdf:Keywords>
4673
- </rdf:Description>
4674
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4675
- <!-- XMP properties go here -->
4676
- <xmp:CreatorTool/>
4677
- </rdf:Description>
4678
- </rdf:RDF>
4679
- </x:xmpmeta>
4680
- </fo:declarations>
5159
+
5160
+ </xsl:for-each>
5161
+ </xsl:variable>
5162
+ <xsl:choose>
5163
+ <xsl:when test="normalize-space($title) != ''">
5164
+ <xsl:value-of select="$title"/>
5165
+ </xsl:when>
5166
+ <xsl:otherwise>
5167
+ <xsl:text> </xsl:text>
5168
+ </xsl:otherwise>
5169
+ </xsl:choose>
5170
+ </dc:title>
5171
+ <dc:creator>
5172
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5173
+
5174
+
5175
+
5176
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5177
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5178
+ <xsl:if test="position() != last()">; </xsl:if>
5179
+ </xsl:for-each>
5180
+
5181
+ </xsl:for-each>
5182
+ </dc:creator>
5183
+ <dc:description>
5184
+ <xsl:variable name="abstract">
5185
+
5186
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5187
+
5188
+
5189
+ </xsl:variable>
5190
+ <xsl:value-of select="normalize-space($abstract)"/>
5191
+ </dc:description>
5192
+ <pdf:Keywords>
5193
+ <xsl:call-template name="insertKeywords"/>
5194
+ </pdf:Keywords>
5195
+ </rdf:Description>
5196
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5197
+ <!-- XMP properties go here -->
5198
+ <xmp:CreatorTool/>
5199
+ </rdf:Description>
5200
+ </rdf:RDF>
5201
+ </x:xmpmeta>
4681
5202
  </xsl:template><xsl:template name="getId">
4682
5203
  <xsl:choose>
4683
5204
  <xsl:when test="../@id">
@@ -4763,6 +5284,7 @@
4763
5284
 
4764
5285
 
4765
5286
 
5287
+
4766
5288
  <xsl:value-of select="document('')//*/namespace::nist"/>
4767
5289
 
4768
5290
 
@@ -4828,17 +5350,62 @@
4828
5350
  </xsl:call-template>
4829
5351
  </xsl:if>
4830
5352
  </xsl:template><xsl:template name="getLocalizedString">
4831
- <xsl:param name="key"/>
5353
+ <xsl:param name="key"/>
4832
5354
 
4833
5355
  <xsl:variable name="curr_lang">
4834
5356
  <xsl:call-template name="getLang"/>
4835
5357
  </xsl:variable>
4836
5358
 
5359
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5360
+
4837
5361
  <xsl:choose>
5362
+ <xsl:when test="$data_value != ''">
5363
+ <xsl:value-of select="$data_value"/>
5364
+ </xsl:when>
4838
5365
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4839
5366
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4840
5367
  </xsl:when>
4841
5368
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4842
5369
  </xsl:choose>
4843
5370
 
5371
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5372
+ <xsl:param name="isAdded"/>
5373
+ <xsl:param name="isDeleted"/>
5374
+ <xsl:choose>
5375
+ <xsl:when test="local-name() = 'math'">
5376
+ <xsl:if test="$isAdded = 'true'">
5377
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5378
+ </xsl:if>
5379
+ <xsl:if test="$isDeleted = 'true'">
5380
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5381
+ </xsl:if>
5382
+ </xsl:when>
5383
+ <xsl:otherwise>
5384
+ <xsl:if test="$isAdded = 'true'">
5385
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5386
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5387
+ </xsl:if>
5388
+ <xsl:if test="$isDeleted = 'true'">
5389
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5390
+ <xsl:if test="local-name() = 'table'">
5391
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5392
+ </xsl:if>
5393
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5394
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5395
+ </xsl:if>
5396
+ </xsl:otherwise>
5397
+ </xsl:choose>
5398
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5399
+ <xsl:if test="$lang = 'ar'">
5400
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5401
+ </xsl:if>
5402
+ </xsl:template><xsl:template name="setAlignment">
5403
+ <xsl:param name="align" select="normalize-space(@align)"/>
5404
+ <xsl:choose>
5405
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5406
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5407
+ <xsl:when test="$align != ''">
5408
+ <xsl:value-of select="$align"/>
5409
+ </xsl:when>
5410
+ </xsl:choose>
4844
5411
  </xsl:template></xsl:stylesheet>