metanorma-gb 1.3.27 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/.gitignore +0 -2
  6. data/Gemfile +0 -1
  7. data/Rakefile +17 -0
  8. data/lib/asciidoctor/gb/cleanup.rb +130 -0
  9. data/lib/asciidoctor/gb/converter.rb +25 -137
  10. data/lib/asciidoctor/gb/front_id.rb +3 -3
  11. data/lib/asciidoctor/gb/isodoc.rng +12 -6
  12. data/lib/asciidoctor/gb/section_input.rb +11 -0
  13. data/lib/asciidoctor/gb/validate.rb +0 -1
  14. data/lib/isodoc/gb/{gbbaseconvert.rb → base_convert.rb} +27 -79
  15. data/lib/isodoc/gb/{gbcleanup.rb → cleanup.rb} +0 -11
  16. data/lib/isodoc/gb/{gbconvert.rb → common.rb} +1 -1
  17. data/lib/isodoc/gb/gb.recommendation.xsl +752 -351
  18. data/lib/isodoc/gb/html/_coverpage.css +193 -0
  19. data/lib/isodoc/gb/html/gb.css +657 -0
  20. data/lib/isodoc/gb/html/htmlcompliantstyle.css +1303 -0
  21. data/lib/isodoc/gb/html/htmlcompliantstyle.scss +0 -1
  22. data/lib/isodoc/gb/html/htmlstyle.css +844 -0
  23. data/lib/isodoc/gb/html/wordstyle.css +2932 -0
  24. data/lib/isodoc/gb/{gbhtmlconvert.rb → html_convert.rb} +17 -14
  25. data/lib/isodoc/gb/i18n.rb +16 -0
  26. data/lib/isodoc/gb/init.rb +29 -0
  27. data/lib/isodoc/gb/metadata.rb +1 -1
  28. data/lib/isodoc/gb/pdf_convert.rb +2 -11
  29. data/lib/isodoc/gb/presentation_xml_convert.rb +26 -0
  30. data/lib/isodoc/gb/{gbwordconvert.rb → word_convert.rb} +21 -16
  31. data/lib/isodoc/gb/xref.rb +6 -0
  32. data/lib/metanorma-gb.rb +3 -3
  33. data/lib/metanorma/gb/processor.rb +13 -10
  34. data/lib/metanorma/gb/version.rb +1 -1
  35. data/metanorma-gb.gemspec +3 -2
  36. metadata +39 -16
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -8,6 +8,8 @@ module Asciidoctor
8
8
  class Converter < ISO::Converter
9
9
  def sectiontype_streamline(ret)
10
10
  case ret
11
+ when "前言" then "foreword"
12
+ when "致謝" then "acknowledgements"
11
13
  when "引言" then "introduction"
12
14
  when "范围" then "scope"
13
15
  when "规范性引用文件" then "normative references"
@@ -21,6 +23,15 @@ module Asciidoctor
21
23
  end
22
24
  end
23
25
 
26
+ def symbols_attrs(node, a)
27
+ case sectiontype1(node)
28
+ when "符号" then a.merge(type: "symbols")
29
+ when "代号和缩略语" then a.merge(type: "abbreviated_terms")
30
+ else
31
+ super
32
+ end
33
+ end
34
+
24
35
  def appendix_parse(attrs, xml, node)
25
36
  # UNSAFE, there is no unset_option() in asciidoctor
26
37
  node.remove_attr("appendix-option")
@@ -1,7 +1,6 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
3
  class Converter < ISO::Converter
4
-
5
4
  def validate(doc)
6
5
  content_validate(doc)
7
6
  schema_validate(formattedstr_strip(doc.dup),
@@ -1,33 +1,23 @@
1
- require_relative "gbconvert"
1
+ require_relative "common"
2
2
  require "gb_agencies"
3
- require_relative "gbcleanup"
4
- require_relative "metadata"
3
+ require_relative "cleanup"
5
4
  require "fileutils"
6
5
 
7
6
  module IsoDoc
8
7
  module Gb
9
8
  module BaseConvert
10
- def extract_fonts(options)
9
+ def scss_fontheader
11
10
  b = options[:bodyfont] || "Arial"
12
11
  h = options[:headerfont] || "Arial"
13
12
  m = options[:monospacefont] || "Courier"
14
13
  t = options[:titlefont] || "Arial"
15
14
  "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"\
16
15
  "$titlefont: #{t};\n"
17
- end
18
-
19
- def metadata_init(lang, script, labels)
20
- unless ["en", "zh"].include? lang
21
- lang = "zh"
22
- script = "Hans"
23
- end
24
- @meta = Metadata.new(lang, script, labels)
25
- @meta.set(:standardclassimg, @standardclassimg)
26
- @common.meta = @meta
27
16
  end
28
17
 
29
18
  def cleanup(docxml)
30
- @cleanup = Cleanup.new(@script, @deprecated_lbl)
19
+ @i18n ||= i18n_init(@lang, @script)
20
+ @cleanup = Cleanup.new(@script, @i18n.deprecated)
31
21
  super
32
22
  @cleanup.cleanup(docxml)
33
23
  docxml
@@ -38,43 +28,26 @@ module IsoDoc
38
28
  @cleanup.example_cleanup(docxml)
39
29
  end
40
30
 
41
- def i18n_init(lang, script)
42
- super
43
- y = if lang == "en"
44
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
45
- elsif lang == "zh" && script == "Hans"
46
- YAML.load_file(File.join(File.dirname(__FILE__),
47
- "i18n-zh-Hans.yaml"))
48
- else
49
- YAML.load_file(File.join(File.dirname(__FILE__),
50
- "i18n-zh-Hans.yaml"))
51
- end
52
- @labels = @labels.merge(y)
53
- end
54
-
55
31
  def omit_docid_prefix(prefix)
56
32
  super || prefix == "Chinese Standard"
57
33
  end
58
34
 
59
- def formula_parse(node, out)
60
- out.div **formula_attrs(node) do |div1|
61
- div1.div **attr_code(class: "formula") do |div|
35
+ def formula_parse1(node, out)
36
+ out.div **attr_code(class: "formula") do |div|
62
37
  insert_tab(div, 1)
63
38
  parse(node.at(ns("./stem")), div)
64
- lbl = anchor(node['id'], :label, false)
39
+ lbl = node&.at(ns("./name"))&.text
65
40
  unless lbl.nil?
66
41
  insert_tab(div, 1)
67
42
  div << "(#{lbl})"
68
43
  end
69
44
  end
70
- formula_where(node.at(ns("./dl")), div1)
71
- end
72
45
  end
73
46
 
74
47
  def formula_where(dl, out)
75
48
  return unless dl
76
49
  out.p **{ style: "page-break-after:avoid;"} do |p|
77
- p << @where_lbl
50
+ p << @i18n.where
78
51
  end
79
52
  formula_dl_parse(dl, out)
80
53
  end
@@ -99,32 +72,37 @@ module IsoDoc
99
72
  { class: "example_label",
100
73
  style: "padding:2pt 2pt 2pt 2pt;vertical-align:top;" }.freeze
101
74
 
102
- def example_label(node)
103
- l10n(super + ":")
75
+ def note_delim
76
+ l10n(": ")
104
77
  end
105
78
 
106
79
  def note_parse(node, out)
107
- note_parse_table(node, out, note_label(node) + ":")
80
+ note_parse_table(node, out)
108
81
  end
109
82
 
110
- def note_parse_table(node, out, label)
83
+ def note_parse_table(node, out)
111
84
  @note = true
85
+ name = node&.at(ns("./name"))&.remove
86
+ note_parse_table1(node, out, name)
87
+ @note = false
88
+ end
89
+
90
+ def note_parse_table1(node, out, name)
112
91
  out.table **note_attrs(node) do |t|
113
92
  t.tr do |tr|
114
- @libdir = File.dirname(__FILE__)
115
93
  tr.td **EXAMPLE_TBL_ATTR do |td|
116
- td << l10n(label)
94
+ name and name.children.each { |n| parse(n, td) }
95
+ td << note_delim
117
96
  end
118
97
  tr.td **{ style: "vertical-align:top;", class: "Note" } do |td|
119
98
  node.children.each { |n| parse(n, td) }
120
99
  end
121
100
  end
122
101
  end
123
- @note = false
124
102
  end
125
103
 
126
104
  def termnote_parse(node, out)
127
- note_parse_table(node, out, "#{anchor(node['id'], :label)}:")
105
+ note_parse_table(node, out)
128
106
  end
129
107
 
130
108
  def middle(isoxml, out)
@@ -157,19 +135,19 @@ module IsoDoc
157
135
 
158
136
  def deprecated_term_parse(node, out)
159
137
  out.p **{ class: "DeprecatedTerms" } do |p|
160
- p << l10n("#{@deprecated_lbl}: ")
138
+ p << l10n("#{@i18n.deprecated}: ")
161
139
  node.children.each { |c| parse(c, p) }
162
140
  end
163
141
  end
164
142
 
165
143
  def termref_render(x)
166
- x.sub!(%r{\s*\[MODIFICATION\]\s*$}m, l10n(", #{@modified_lbl}"))
144
+ x.sub!(%r{\s*\[MODIFICATION\]\s*$}m, l10n(", #{@i18n.modified}"))
167
145
  parts = x.split(%r{(\s*\[MODIFICATION\]|,)}m)
168
- parts[1] = l10n(", #{@source_lbl}") if parts.size > 1 &&
169
- parts[1] == "," && !/^\s*#{@modified_lbl}/.match(parts[2])
146
+ parts[1] = l10n(", #{@i18n.source}") if parts.size > 1 &&
147
+ parts[1] == "," && !/^\s*#{@i18n.modified}/.match(parts[2])
170
148
  parts.map do |p|
171
149
  /\s*\[MODIFICATION\]/.match(p) ?
172
- l10n(", #{@modified_lbl} &mdash; ") : p
150
+ l10n(", #{@i18n.modified} &mdash; ") : p
173
151
  end.join.sub(/\A\s*/m, l10n("[")).sub(/\s*\z/m, l10n("]"))
174
152
  end
175
153
 
@@ -181,42 +159,12 @@ module IsoDoc
181
159
  end.join
182
160
  end
183
161
 
184
- def foreword(isoxml, out)
185
- f = isoxml.at(ns("//foreword")) || return
186
- page_break(out)
187
- out.div do |s|
188
- s.h1 **{ class: "ForewordTitle" } do |h1|
189
- h1 << "#{@foreword_lbl}&nbsp;"
190
- # insert_tab(h1, 1)
191
- end
192
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
193
- end
194
- end
195
-
196
162
  def clausedelimspace(out)
197
163
  out << "&#x3000;"
198
164
  end
199
165
 
200
- def clause_name(num, title, div, header_class)
201
- header_class = {} if header_class.nil?
202
- div.h1 **attr_code(header_class) do |h1|
203
- if num && !@suppressheadingnumbers
204
- h1 << "#{num}."
205
- h1 << "&#x3000;"
206
- end
207
- title.is_a?(String) ? h1 << title :
208
- title&.children&.each { |c2| parse(c2, h1) }
209
- end
210
- div.parent.at(".//h1")
211
- end
212
-
213
166
  def example_span_label(node, div, name)
214
- n = get_anchors[node["id"]]
215
167
  div.span **{ class: "example_label" } do |p|
216
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
217
- l10n("#{@example_lbl} #{n[:label]}")
218
- p << l10n(lbl + ":")
219
- name and !lbl.nil? and p << "&nbsp;&mdash; "
220
168
  name and name.children.each { |n| parse(n, div) }
221
169
  end
222
170
  end
@@ -74,17 +74,6 @@ module IsoDoc
74
74
  term_merge(docxml, "DeprecatedTerms")
75
75
  docxml
76
76
  end
77
-
78
- =begin
79
- def intro_cleanup(docxml)
80
- # insert tab for purposes of ToC lining up
81
- docxml.xpath("//h1[@class = 'IntroTitle']").each do |h1|
82
- if h1.content == "引言"
83
- h1.add_child('<span style="mso-tab-count:1">&#xA0; </span>')
84
- end
85
- end
86
- end
87
- =end
88
77
  end
89
78
  end
90
79
  end
@@ -1,5 +1,5 @@
1
1
  require "isodoc"
2
- require_relative "./gbcleanup.rb"
2
+ require_relative "./cleanup.rb"
3
3
  require_relative "./metadata.rb"
4
4
  require "fileutils"
5
5
 
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:gb="https://www.metanorma.org/ns/gb" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:gb="https://www.metanorma.org/ns/gb" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -17,12 +17,14 @@
17
17
 
18
18
  <xsl:variable name="part" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:structuredidentifier/gb:project-number/@part)"/>
19
19
 
20
- <xsl:variable name="standard-name">
21
- <xsl:variable name="gbscope" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbscope"/>
22
- <xsl:value-of select="translate(substring($gbscope, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($gbscope, 2)"/>
23
- <xsl:text> standard (</xsl:text>
24
- <xsl:variable name="gbmandate" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbmandate"/>
25
- <xsl:value-of select="translate(substring($gbmandate, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($gbmandate, 2)"/>
20
+ <xsl:variable name="standard-name">
21
+ <xsl:call-template name="capitalize">
22
+ <xsl:with-param name="str" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbscope"/>
23
+ </xsl:call-template>
24
+ <xsl:text> standard (</xsl:text>
25
+ <xsl:call-template name="capitalize">
26
+ <xsl:with-param name="str" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbmandate"/>
27
+ </xsl:call-template>
26
28
  <xsl:text>)</xsl:text>
27
29
  </xsl:variable>
28
30
 
@@ -125,35 +127,7 @@
125
127
  </fo:page-sequence-master>
126
128
  </fo:layout-master-set>
127
129
 
128
- <fo:declarations>
129
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
130
- <pdf:dictionary type="normal" key="ViewerPreferences">
131
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
132
- </pdf:dictionary>
133
- </pdf:catalog>
134
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
135
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
136
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
137
- <!-- Dublin Core properties go here -->
138
- <dc:title><xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:title[@language = 'en' and @type = 'main']"/> </dc:title>
139
- <dc:creator><xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:contributor[gb:role/@type='author']/gb:organization/gb:name"/></dc:creator>
140
- <dc:description>
141
- <xsl:variable name="abstract">
142
- <xsl:copy-of select="/gb:gb-standard/gb:bibliography/gb:references/gb:bibitem/gb:abstract//text()"/>
143
- </xsl:variable>
144
- <xsl:value-of select="normalize-space($abstract)"/>
145
- </dc:description>
146
- <pdf:Keywords>
147
- <xsl:call-template name="insertKeywords"/>
148
- </pdf:Keywords>
149
- </rdf:Description>
150
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
151
- <!-- XMP properties go here -->
152
- <xmp:CreatorTool/>
153
- </rdf:Description>
154
- </rdf:RDF>
155
- </x:xmpmeta>
156
- </fo:declarations>
130
+ <xsl:call-template name="addPDFUAmeta"/>
157
131
 
158
132
  <fo:page-sequence master-reference="cover" force-page-count="no-force">
159
133
  <fo:flow flow-name="xsl-region-body">
@@ -174,7 +148,7 @@
174
148
  <!-- GB Logo -->
175
149
  <fo:block-container position="absolute" top="3mm" left="119mm"> <!-- top="8mm" -->
176
150
  <fo:block>
177
- <xsl:variable name="gbprefix" select="normalize-space(translate(/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbprefix, $upper, $lower))"/>
151
+ <xsl:variable name="gbprefix" select="normalize-space(java:toLowerCase(java:java.lang.String.new(/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbprefix)))"/>
178
152
  <xsl:choose>
179
153
  <xsl:when test="$gbprefix = 'db' or $gbprefix = '81'">
180
154
  <fo:instream-foreign-object fox:alt-text="Logo">
@@ -243,14 +217,12 @@
243
217
  </fo:block>
244
218
  <!-- Partly Supercedes GB/T 88021-2016 -->
245
219
  <fo:block margin-top="2.85pt">
246
- <xsl:choose>
247
- <xsl:when test="$language = 'zh'">
248
- <xsl:text>部分代替 </xsl:text>
249
- </xsl:when>
250
- <xsl:otherwise>
251
- <xsl:text>Partly Supercedes </xsl:text>
252
- </xsl:otherwise>
253
- </xsl:choose>
220
+ <xsl:variable name="title-partly-supercedes">
221
+ <xsl:call-template name="getTitle">
222
+ <xsl:with-param name="name" select="'title-partly-supercedes'"/>
223
+ </xsl:call-template>
224
+ </xsl:variable>
225
+ <xsl:value-of select="$title-partly-supercedes"/>
254
226
  <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:relation[@type='obsoletes']/gb:bibitem/gb:docidentifier"/>
255
227
  </fo:block>
256
228
  </fo:block>
@@ -309,10 +281,12 @@
309
281
  </fo:block>
310
282
  <fo:block margin-top="9.05pt">
311
283
  <xsl:text>(</xsl:text>
312
- <xsl:choose>
313
- <xsl:when test="$language = 'zh'">本稿完成日期</xsl:when>
314
- <xsl:otherwise>Completion date for this manuscript</xsl:otherwise>
315
- </xsl:choose>
284
+ <xsl:variable name="title-completion-date">
285
+ <xsl:call-template name="getTitle">
286
+ <xsl:with-param name="name" select="'title-completion-date'"/>
287
+ </xsl:call-template>
288
+ </xsl:variable>
289
+ <xsl:value-of select="$title-completion-date"/>
316
290
  <xsl:text>: </xsl:text>
317
291
  <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:version/gb:revision-date"/>
318
292
  <xsl:text>)</xsl:text>
@@ -320,24 +294,24 @@
320
294
  </fo:block-container>
321
295
  <fo:block-container position="absolute" left="0mm" top="239mm" width="170mm" border-bottom="1pt solid black">
322
296
  <fo:block font-family="SimHei" font-size="14pt" text-align-last="justify" margin-bottom="2.5mm">
323
- <xsl:if test="$language = 'en'">
324
- <xsl:text>Issuance Date: </xsl:text>
325
- </xsl:if>
326
- <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:date[@type='issued']/gb:on"/>
327
- <xsl:if test="$language = 'zh'">
328
- <xsl:text> 发布</xsl:text>
329
- </xsl:if>
297
+ <xsl:variable name="title-issuance-date">
298
+ <xsl:call-template name="getTitle">
299
+ <xsl:with-param name="name" select="'title-issuance-date'"/>
300
+ </xsl:call-template>
301
+ </xsl:variable>
302
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-issuance-date),'#',/gb:gb-standard/gb:bibdata/gb:date[@type='issued']/gb:on)"/>
330
303
 
331
304
  <fo:inline keep-together.within-line="always">
332
305
  <fo:leader leader-pattern="space"/>
333
306
  </fo:inline>
334
- <xsl:if test="$language = 'en'">
335
- <xsl:text>Implementation Date: </xsl:text>
336
- </xsl:if>
337
- <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:date[@type='implemented']/gb:on"/>
338
- <xsl:if test="$language = 'zh'">
339
- <xsl:text> 实施</xsl:text>
340
- </xsl:if>
307
+
308
+ <xsl:variable name="title-implementation-date">
309
+ <xsl:call-template name="getTitle">
310
+ <xsl:with-param name="name" select="'title-implementation-date'"/>
311
+ </xsl:call-template>
312
+ </xsl:variable>
313
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-implementation-date),'#',/gb:gb-standard/gb:bibdata/gb:date[@type='implemented']/gb:on)"/>
314
+
341
315
  </fo:block>
342
316
  </fo:block-container>
343
317
  <fo:block break-after="page"/>
@@ -353,10 +327,12 @@
353
327
  <fo:block-container>
354
328
 
355
329
  <fo:block font-family="SimHei" font-size="16pt" margin-top="6pt" margin-bottom="32pt" text-align="center">
356
- <xsl:choose>
357
- <xsl:when test="$language = 'zh'"><xsl:text>目次</xsl:text></xsl:when>
358
- <xsl:otherwise><xsl:text>Table of contents</xsl:text></xsl:otherwise>
359
- </xsl:choose>
330
+ <xsl:variable name="title-toc">
331
+ <xsl:call-template name="getTitle">
332
+ <xsl:with-param name="name" select="'title-toc'"/>
333
+ </xsl:call-template>
334
+ </xsl:variable>
335
+ <xsl:value-of select="$title-toc"/>
360
336
  </fo:block>
361
337
 
362
338
  <xsl:if test="$debug = 'true'">
@@ -495,14 +471,10 @@
495
471
  <xsl:if test="$part != ''">
496
472
  <xsl:choose>
497
473
  <xsl:when test="$lang = 'zh'">
498
- <xsl:text>第 </xsl:text>
499
- <xsl:value-of select="$part"/>
500
- <xsl:text> 部分:</xsl:text>
474
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='zh']),'#',$part)"/>
501
475
  </xsl:when>
502
476
  <xsl:otherwise>
503
- <xsl:text>Part </xsl:text>
504
- <xsl:value-of select="$part"/>
505
- <xsl:text>: </xsl:text>
477
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
506
478
  </xsl:otherwise>
507
479
  </xsl:choose>
508
480
  </xsl:if>
@@ -599,17 +571,15 @@
599
571
  <xsl:attribute name="addon">
600
572
  <xsl:if test="local-name(..) = 'annex'">
601
573
  <xsl:variable name="obligation" select="../@obligation"/>
574
+ <xsl:variable name="title-obligation-normative">
575
+ <xsl:call-template name="getTitle">
576
+ <xsl:with-param name="name" select="'title-obligation-normative'"/>
577
+ </xsl:call-template>
578
+ </xsl:variable>
602
579
  <xsl:choose>
603
- <xsl:when test="$language = 'zh'">
604
- <xsl:choose>
605
- <xsl:when test="$obligation = 'normative'">规范性附录</xsl:when>
606
- <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
607
- </xsl:choose>
608
- </xsl:when>
609
- <xsl:otherwise>
610
- <xsl:value-of select="$obligation"/>
611
- </xsl:otherwise>
612
- </xsl:choose>
580
+ <xsl:when test="$obligation = 'normative'"><xsl:value-of select="$title-obligation-normative"/></xsl:when>
581
+ <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
582
+ </xsl:choose>
613
583
  </xsl:if>
614
584
  </xsl:attribute>
615
585
  <xsl:value-of select="."/>
@@ -635,6 +605,11 @@
635
605
  <xsl:variable name="annex-id" select="ancestor::gb:annex/@id"/>
636
606
  <item level="" id="{@id}" display="false" type="table">
637
607
  <xsl:attribute name="section">
608
+ <xsl:variable name="title-table">
609
+ <xsl:call-template name="getTitle">
610
+ <xsl:with-param name="name" select="'title-table'"/>
611
+ </xsl:call-template>
612
+ </xsl:variable>
638
613
  <xsl:value-of select="$title-table"/>
639
614
  <xsl:choose>
640
615
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
@@ -657,7 +632,12 @@
657
632
  <xsl:template match="gb:formula" mode="contents">
658
633
  <item level="" id="{@id}" display="false">
659
634
  <xsl:attribute name="section">
660
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="gb:annex | gb:formula"/><xsl:text>)</xsl:text>
635
+ <xsl:variable name="title-formula">
636
+ <xsl:call-template name="getTitle">
637
+ <xsl:with-param name="name" select="'title-formula'"/>
638
+ </xsl:call-template>
639
+ </xsl:variable>
640
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="gb:annex | gb:formula"/>
661
641
  </xsl:attribute>
662
642
  </item>
663
643
  </xsl:template>
@@ -857,17 +837,15 @@
857
837
  <fo:inline font-weight="normal">
858
838
  <xsl:text>(</xsl:text>
859
839
  <xsl:variable name="obligation" select="../@obligation"/>
840
+ <xsl:variable name="title-obligation-normative">
841
+ <xsl:call-template name="getTitle">
842
+ <xsl:with-param name="name" select="'title-obligation-normative'"/>
843
+ </xsl:call-template>
844
+ </xsl:variable>
860
845
  <xsl:choose>
861
- <xsl:when test="$language = 'zh'">
862
- <xsl:choose>
863
- <xsl:when test="$obligation = 'normative'">规范性附录</xsl:when>
864
- <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
865
- </xsl:choose>
866
- </xsl:when>
867
- <xsl:otherwise>
868
- <xsl:value-of select="$obligation"/>
869
- </xsl:otherwise>
870
- </xsl:choose>
846
+ <xsl:when test="$obligation = 'normative'"><xsl:value-of select="$title-obligation-normative"/></xsl:when>
847
+ <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
848
+ </xsl:choose>
871
849
  <xsl:text>)</xsl:text>
872
850
  </fo:inline>
873
851
  </xsl:if>
@@ -950,9 +928,13 @@
950
928
  <xsl:attribute name="text-indent">
951
929
  <xsl:choose>
952
930
  <xsl:when test="parent::gb:li">0mm</xsl:when>
931
+ <xsl:when test="parent::gb:dd">0mm</xsl:when>
953
932
  <xsl:otherwise>7.4mm</xsl:otherwise>
954
933
  </xsl:choose>
955
934
  </xsl:attribute>
935
+ <xsl:if test="parent::gb:dd and ancestor::*[local-name()='formula']">
936
+ <xsl:text>— </xsl:text>
937
+ </xsl:if>
956
938
  <xsl:apply-templates/>
957
939
  </xsl:element>
958
940
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1057,6 +1039,11 @@
1057
1039
  <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
1058
1040
  </fo:block>
1059
1041
  <fo:block font-family="SimHei" margin-top="12pt" margin-bottom="12pt">
1042
+ <xsl:variable name="title-figure">
1043
+ <xsl:call-template name="getTitle">
1044
+ <xsl:with-param name="name" select="'title-figure'"/>
1045
+ </xsl:call-template>
1046
+ </xsl:variable>
1060
1047
  <xsl:value-of select="$title-figure"/>
1061
1048
  <xsl:call-template name="getFigureNumber"/>
1062
1049
  </fo:block>
@@ -1085,6 +1072,11 @@
1085
1072
  </xsl:template>
1086
1073
 
1087
1074
  <xsl:template name="getFigureNumber">
1075
+ <xsl:variable name="title-figure">
1076
+ <xsl:call-template name="getTitle">
1077
+ <xsl:with-param name="name" select="'title-figure'"/>
1078
+ </xsl:call-template>
1079
+ </xsl:variable>
1088
1080
  <xsl:choose>
1089
1081
  <xsl:when test="ancestor::gb:annex">
1090
1082
  <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="gb:annex | gb:figure"/>
@@ -1148,13 +1140,13 @@
1148
1140
  <xsl:number level="any" count="gb:bibitem/gb:note"/>
1149
1141
  </xsl:variable>
1150
1142
  <fo:inline font-size="50%" keep-with-previous.within-line="always" baseline-shift="30%">
1151
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1143
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1152
1144
  <xsl:value-of select="$number"/>
1153
1145
  </fo:basic-link>
1154
1146
  </fo:inline>
1155
1147
  <fo:footnote-body>
1156
1148
  <fo:block font-size="9pt" margin-bottom="4pt" start-indent="0pt" text-indent="7.4mm">
1157
- <fo:inline font-size="50%" id="footnote_{../@id}" keep-with-next.within-line="always" baseline-shift="30%"><!-- alignment-baseline="hanging" font-size="60%" -->
1149
+ <fo:inline font-size="50%" id="{generate-id()}" keep-with-next.within-line="always" baseline-shift="30%"><!-- alignment-baseline="hanging" font-size="60%" -->
1158
1150
  <xsl:value-of select="$number"/>
1159
1151
  </fo:inline>
1160
1152
  <xsl:apply-templates/>
@@ -1252,7 +1244,12 @@
1252
1244
  <fo:inline font-size="11pt">
1253
1245
  <xsl:if test="not(preceding-sibling::*[1][local-name() = 'deprecates'])">
1254
1246
  <xsl:attribute name="padding-left">7.4mm</xsl:attribute>
1255
- <fo:inline>DEPRECATED: </fo:inline>
1247
+ <xsl:variable name="title-deprecated">
1248
+ <xsl:call-template name="getTitle">
1249
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1250
+ </xsl:call-template>
1251
+ </xsl:variable>
1252
+ <fo:inline><xsl:value-of select="$title-deprecated"/>: </fo:inline>
1256
1253
  </xsl:if>
1257
1254
  <xsl:apply-templates/>
1258
1255
  </fo:inline>
@@ -1291,14 +1288,7 @@
1291
1288
  </fo:block>
1292
1289
  </xsl:template>
1293
1290
 
1294
- <xsl:template match="gb:modification">
1295
- <xsl:choose>
1296
- <xsl:when test="$language = 'zh'">、改写—</xsl:when>
1297
- <xsl:otherwise><xsl:text>, modified — </xsl:text></xsl:otherwise>
1298
- </xsl:choose>
1299
-
1300
- <xsl:apply-templates/>
1301
- </xsl:template>
1291
+
1302
1292
  <xsl:template match="gb:modification/gb:p">
1303
1293
  <xsl:apply-templates/>
1304
1294
  </xsl:template>
@@ -1316,18 +1306,13 @@
1316
1306
  <fo:table-row>
1317
1307
  <fo:table-cell>
1318
1308
  <fo:block font-family="SimHei">
1319
- <xsl:choose>
1320
- <xsl:when test="$language = 'zh'">
1321
- <xsl:text>注</xsl:text>
1322
- <xsl:number/>
1323
- <xsl:text>: </xsl:text>
1324
- </xsl:when>
1325
- <xsl:otherwise>
1326
- <xsl:text>Note </xsl:text>
1327
- <xsl:number/>
1328
- <xsl:text> to entry: </xsl:text>
1329
- </xsl:otherwise>
1330
- </xsl:choose>
1309
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1310
+ <xsl:variable name="title-note-to-entry">
1311
+ <xsl:call-template name="getTitle">
1312
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1313
+ </xsl:call-template>
1314
+ </xsl:variable>
1315
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1331
1316
  </fo:block>
1332
1317
  </fo:table-cell>
1333
1318
  <fo:table-cell>
@@ -1354,6 +1339,11 @@
1354
1339
  <xsl:template match="gb:termexample">
1355
1340
  <fo:block font-size="9pt" margin-top="14pt" margin-bottom="14pt" text-align="justify">
1356
1341
  <fo:inline padding-right="1mm" font-family="SimHei">
1342
+ <xsl:variable name="title-example">
1343
+ <xsl:call-template name="getTitle">
1344
+ <xsl:with-param name="name" select="'title-example'"/>
1345
+ </xsl:call-template>
1346
+ </xsl:variable>
1357
1347
  <xsl:value-of select="$title-example"/>
1358
1348
  <xsl:if test="count(ancestor::gb:term[1]//gb:termexample) &gt; 1">
1359
1349
  <xsl:number/>
@@ -1453,7 +1443,7 @@
1453
1443
 
1454
1444
  <xsl:template match="gb:source">
1455
1445
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1456
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1446
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1457
1447
  <xsl:apply-templates select="gb:localityStack"/>
1458
1448
  </fo:basic-link>
1459
1449
  </xsl:template>
@@ -1480,6 +1470,18 @@
1480
1470
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
1481
1471
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
1482
1472
  <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
1473
+
1474
+ <xsl:variable name="title-clause">
1475
+ <xsl:call-template name="getTitle">
1476
+ <xsl:with-param name="name" select="'title-clause'"/>
1477
+ </xsl:call-template>
1478
+ </xsl:variable>
1479
+ <xsl:variable name="title-annex">
1480
+ <xsl:call-template name="getTitle">
1481
+ <xsl:with-param name="name" select="'title-annex'"/>
1482
+ </xsl:call-template>
1483
+ </xsl:variable>
1484
+
1483
1485
  <xsl:choose>
1484
1486
  <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1485
1487
  <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
@@ -1514,6 +1516,11 @@
1514
1516
  </xsl:if> -->
1515
1517
  <xsl:variable name="claims_id" select="ancestor::gb:clause[1]/@id"/>
1516
1518
  <fo:inline padding-right="5mm">
1519
+ <xsl:variable name="title-example">
1520
+ <xsl:call-template name="getTitle">
1521
+ <xsl:with-param name="name" select="'title-example'"/>
1522
+ </xsl:call-template>
1523
+ </xsl:variable>
1517
1524
  <xsl:value-of select="$title-example"/>
1518
1525
  <xsl:if test="count(ancestor::gb:clause[1]//gb:example) &gt; 1">
1519
1526
  <xsl:number count="gb:example[ancestor::gb:clause[@id = $claims_id]]" level="any"/>
@@ -1534,14 +1541,12 @@
1534
1541
  <fo:table-row>
1535
1542
  <fo:table-cell>
1536
1543
  <fo:block font-family="SimHei">
1537
- <xsl:choose>
1538
- <xsl:when test="$language = 'zh'">
1539
- <xsl:text>注</xsl:text>
1540
- </xsl:when>
1541
- <xsl:otherwise>
1542
- <xsl:text>NOTE</xsl:text>
1543
- </xsl:otherwise>
1544
- </xsl:choose>
1544
+ <xsl:variable name="title-note">
1545
+ <xsl:call-template name="getTitle">
1546
+ <xsl:with-param name="name" select="'title-note'"/>
1547
+ </xsl:call-template>
1548
+ </xsl:variable>
1549
+ <xsl:value-of select="normalize-space($title-note)"/>
1545
1550
  <xsl:if test="count(ancestor::gb:clause[1]//gb:note) &gt; 1">
1546
1551
  <xsl:text> </xsl:text><xsl:number count="gb:note[ancestor::gb:clause[@id = $claims_id]]" level="any"/>
1547
1552
  </xsl:if>
@@ -1576,7 +1581,7 @@
1576
1581
 
1577
1582
  <xsl:choose>
1578
1583
  <xsl:when test="@citeas and normalize-space(text()) = ''">
1579
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1584
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1580
1585
  </xsl:when>
1581
1586
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1582
1587
  <xsl:value-of select="//gb:bibitem[@id = current()/@bibitemid]/gb:docidentifier"/>
@@ -1589,6 +1594,21 @@
1589
1594
  </xsl:template>
1590
1595
 
1591
1596
  <xsl:template match="gb:locality">
1597
+ <xsl:variable name="title-clause">
1598
+ <xsl:call-template name="getTitle">
1599
+ <xsl:with-param name="name" select="'title-clause'"/>
1600
+ </xsl:call-template>
1601
+ </xsl:variable>
1602
+ <xsl:variable name="title-annex">
1603
+ <xsl:call-template name="getTitle">
1604
+ <xsl:with-param name="name" select="'title-annex'"/>
1605
+ </xsl:call-template>
1606
+ </xsl:variable>
1607
+ <xsl:variable name="title-table">
1608
+ <xsl:call-template name="getTitle">
1609
+ <xsl:with-param name="name" select="'title-table'"/>
1610
+ </xsl:call-template>
1611
+ </xsl:variable>
1592
1612
  <xsl:choose>
1593
1613
  <xsl:when test="@type ='section' and ancestor::gb:termsource">SOURCE Section </xsl:when>
1594
1614
  <xsl:when test="ancestor::gb:termsource"/>
@@ -1602,23 +1622,34 @@
1602
1622
  </xsl:template>
1603
1623
 
1604
1624
  <xsl:template match="gb:admonition">
1625
+ <xsl:variable name="title-caution">
1626
+ <xsl:call-template name="getTitle">
1627
+ <xsl:with-param name="name" select="'title-caution'"/>
1628
+ </xsl:call-template>
1629
+ </xsl:variable>
1630
+ <xsl:variable name="title-warning">
1631
+ <xsl:call-template name="getTitle">
1632
+ <xsl:with-param name="name" select="'title-warning'"/>
1633
+ </xsl:call-template>
1634
+ </xsl:variable>
1605
1635
  <fo:block font-family="SimHei" text-align="center" margin-bottom="12pt" font-weight="bold">
1606
1636
  <xsl:choose>
1607
- <xsl:when test="$language = 'zh'">
1608
- <xsl:choose>
1609
- <xsl:when test="@type = 'caution'">注意</xsl:when>
1610
- <xsl:when test="@type = 'warning'">警告</xsl:when>
1611
- <xsl:otherwise><xsl:value-of select="translate(@type, $lower, $upper)"/></xsl:otherwise>
1612
- </xsl:choose>
1613
- </xsl:when>
1614
- <xsl:otherwise><xsl:value-of select="translate(@type, $lower, $upper)"/></xsl:otherwise>
1615
- </xsl:choose>
1637
+ <xsl:when test="@type = 'caution'"><xsl:value-of select="$title-caution"/></xsl:when>
1638
+ <xsl:when test="@type = 'warning'"><xsl:value-of select="$title-warning"/></xsl:when>
1639
+ <xsl:otherwise><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/></xsl:otherwise>
1640
+ </xsl:choose>
1616
1641
  </fo:block>
1617
1642
  <fo:block font-weight="bold">
1618
1643
  <xsl:apply-templates/>
1619
1644
  </fo:block>
1620
1645
  </xsl:template>
1621
1646
 
1647
+ <xsl:template match="gb:formula">
1648
+ <fo:block id="{@id}">
1649
+ <xsl:apply-templates/>
1650
+ </fo:block>
1651
+ </xsl:template>
1652
+
1622
1653
  <xsl:template match="gb:formula/gb:dt/gb:stem">
1623
1654
  <fo:inline>
1624
1655
  <xsl:apply-templates/>
@@ -1626,7 +1657,7 @@
1626
1657
  </xsl:template>
1627
1658
 
1628
1659
  <xsl:template match="gb:formula/gb:stem">
1629
- <fo:block id="{../@id}" font-size="11pt" margin-top="14pt" margin-bottom="14pt">
1660
+ <fo:block font-size="11pt" margin-top="14pt" margin-bottom="14pt">
1630
1661
  <fo:table table-layout="fixed" width="170mm">
1631
1662
  <fo:table-column column-width="165mm"/>
1632
1663
  <fo:table-column column-width="5mm"/>
@@ -1641,10 +1672,10 @@
1641
1672
  <fo:block text-align="left">
1642
1673
  <xsl:choose>
1643
1674
  <xsl:when test="ancestor::gb:annex">
1644
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="gb:annex | gb:formula"/><xsl:text>)</xsl:text>
1675
+ <xsl:number format="(A.1)" level="multiple" count="gb:annex | gb:formula"/>
1645
1676
  </xsl:when>
1646
1677
  <xsl:otherwise> <!-- not(ancestor::gb:annex) -->
1647
- <xsl:text>(</xsl:text><xsl:number level="any" count="gb:formula"/><xsl:text>)</xsl:text>
1678
+ <xsl:number format="(1)" level="any" count="gb:formula"/>
1648
1679
  </xsl:otherwise>
1649
1680
  </xsl:choose>
1650
1681
  </fo:block>
@@ -1692,38 +1723,6 @@
1692
1723
  </fo:static-content>
1693
1724
  </xsl:template>
1694
1725
 
1695
- <xsl:template name="getId">
1696
- <xsl:choose>
1697
- <xsl:when test="../@id">
1698
- <xsl:value-of select="../@id"/>
1699
- </xsl:when>
1700
- <xsl:otherwise>
1701
- <xsl:value-of select="text()"/>
1702
- </xsl:otherwise>
1703
- </xsl:choose>
1704
- </xsl:template>
1705
-
1706
- <xsl:template name="getLevel">
1707
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1708
- <xsl:variable name="level">
1709
- <xsl:choose>
1710
- <xsl:when test="ancestor::gb:preface">
1711
- <xsl:value-of select="$level_total - 2"/>
1712
- </xsl:when>
1713
- <xsl:when test="ancestor::gb:sections">
1714
- <xsl:value-of select="$level_total - 2"/>
1715
- </xsl:when>
1716
- <xsl:when test="ancestor::gb:bibliography">
1717
- <xsl:value-of select="$level_total - 2"/>
1718
- </xsl:when>
1719
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1720
- <xsl:otherwise>
1721
- <xsl:value-of select="$level_total - 1"/>
1722
- </xsl:otherwise>
1723
- </xsl:choose>
1724
- </xsl:variable>
1725
- <xsl:value-of select="$level"/>
1726
- </xsl:template>
1727
1726
 
1728
1727
  <xsl:template name="getSection">
1729
1728
  <xsl:param name="sectionNum"/>
@@ -1743,7 +1742,7 @@
1743
1742
  </xsl:when>
1744
1743
  <xsl:when test="$level &gt;= 2">
1745
1744
  <xsl:variable name="num">
1746
- <xsl:number format=".1" level="multiple" count="gb:clause/gb:clause | gb:clause/gb:terms | gb:terms/gb:term | gb:clause/gb:term | gb:terms/gb:clause | gb:terms/gb:definitions | gb:definitions/gb:clause | gb:clause/gb:definitions"/>
1745
+ <xsl:call-template name="getSubSection"/>
1747
1746
  </xsl:variable>
1748
1747
  <xsl:value-of select="concat($sectionNum, $num)"/>
1749
1748
  </xsl:when>
@@ -1756,10 +1755,12 @@
1756
1755
  <xsl:variable name="annexid" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:structuredidentifier/gb:annexid)"/>
1757
1756
  <xsl:choose>
1758
1757
  <xsl:when test="$level = 1">
1759
- <xsl:choose>
1760
- <xsl:when test="$language = 'zh'"><xsl:text>附 件 </xsl:text></xsl:when>
1761
- <xsl:otherwise><xsl:text>Annex </xsl:text></xsl:otherwise>
1762
- </xsl:choose>
1758
+ <xsl:variable name="title-annex">
1759
+ <xsl:call-template name="getTitle">
1760
+ <xsl:with-param name="name" select="'title-annex'"/>
1761
+ </xsl:call-template>
1762
+ </xsl:variable>
1763
+ <xsl:value-of select="$title-annex"/>
1763
1764
  <xsl:choose>
1764
1765
  <xsl:when test="count(//gb:annex) = 1 and $annexid != ''">
1765
1766
  <xsl:value-of select="$annexid"/>
@@ -1819,65 +1820,190 @@
1819
1820
  </xsl:if>
1820
1821
  </xsl:template>
1821
1822
 
1822
- <xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table">
1823
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1823
1824
 
1825
+ <title-table lang="en">Table </title-table>
1826
+ <title-table lang="fr">Tableau </title-table>
1824
1827
 
1825
- <xsl:choose>
1826
- <xsl:when test="$lang = 'zh'">表 </xsl:when>
1827
- <xsl:otherwise><xsl:text>Table </xsl:text></xsl:otherwise>
1828
- </xsl:choose>
1828
+
1829
+ <title-table lang="zh">表 </title-table>
1829
1830
 
1830
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
1831
+
1832
+ <title-note lang="en">NOTE </title-note>
1833
+ <title-note lang="fr">NOTE </title-note>
1831
1834
 
1832
1835
 
1833
- <xsl:choose>
1834
- <xsl:when test="$lang = 'zh'">注 </xsl:when>
1835
- <xsl:otherwise><xsl:text>NOTE </xsl:text></xsl:otherwise>
1836
- </xsl:choose>
1836
+ <title-note lang="zh">注 </title-note>
1837
1837
 
1838
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
1839
1838
 
1839
+ <title-figure lang="en">Figure </title-figure>
1840
+ <title-figure lang="fr">Figure </title-figure>
1840
1841
 
1841
- <xsl:choose>
1842
- <xsl:when test="$language = 'zh'">图 </xsl:when>
1843
- <xsl:otherwise>Figure </xsl:otherwise>
1844
- </xsl:choose>
1845
1842
 
1846
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
1843
+ <title-figure lang="zh">图 </title-figure>
1847
1844
 
1848
1845
 
1849
- <xsl:choose>
1850
- <xsl:when test="$language = 'zh'"><xsl:text>示例 </xsl:text></xsl:when>
1851
- <xsl:otherwise><xsl:text>EXAMPLE </xsl:text></xsl:otherwise>
1852
- </xsl:choose>
1846
+ <title-example lang="en">EXAMPLE </title-example>
1847
+ <title-example lang="fr">EXEMPLE </title-example>
1853
1848
 
1854
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex">
1855
1849
 
1850
+ <title-example lang="zh">示例 </title-example>
1856
1851
 
1857
- <xsl:choose>
1858
- <xsl:when test="$language = 'zh'"><xsl:text>附件 </xsl:text></xsl:when>
1859
- <xsl:otherwise><xsl:text>Annex </xsl:text></xsl:otherwise>
1860
- </xsl:choose>
1861
1852
 
1862
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
1863
- <xsl:text>Appendix </xsl:text>
1864
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">
1853
+ <title-example-xref lang="en">Example </title-example-xref>
1854
+ <title-example-xref lang="fr">Exemple </title-example-xref>
1855
+
1856
+ <title-section lang="en">Section </title-section>
1857
+ <title-section lang="fr">Section </title-section>
1865
1858
 
1859
+ <title-inequality lang="en">Inequality </title-inequality>
1860
+ <title-inequality lang="fr">Inequality </title-inequality>
1866
1861
 
1867
- <xsl:choose>
1868
- <xsl:when test="$language = 'zh'"><xsl:text>条 </xsl:text></xsl:when>
1869
- <xsl:otherwise><xsl:text>Clause </xsl:text></xsl:otherwise>
1870
- </xsl:choose>
1862
+ <title-equation lang="en">Equation </title-equation>
1863
+ <title-equation lang="fr">Equation </title-equation>
1864
+
1865
+ <title-annex lang="en">Annex </title-annex>
1866
+ <title-annex lang="fr">Annexe </title-annex>
1867
+
1868
+
1869
+ <title-annex lang="zh">附件 </title-annex>
1870
+
1871
+
1872
+ <title-appendix lang="en">Appendix </title-appendix>
1873
+ <title-appendix lang="fr">Appendix </title-appendix>
1874
+
1875
+ <title-clause lang="en">Clause </title-clause>
1876
+ <title-clause lang="fr">Article </title-clause>
1877
+
1878
+
1879
+ <title-clause lang="zh">条 </title-clause>
1880
+
1881
+
1882
+ <title-edition lang="en">
1883
+
1884
+
1885
+ </title-edition>
1886
+
1887
+ <title-formula lang="en">Formula </title-formula>
1888
+ <title-formula lang="fr">Formula </title-formula>
1889
+
1890
+ <title-toc lang="en">
1891
+
1892
+
1893
+
1894
+ <xsl:text>Table of contents</xsl:text>
1895
+
1896
+ </title-toc>
1897
+ <title-toc lang="fr">Sommaire</title-toc>
1898
+
1899
+
1900
+ <title-toc lang="zh">目次</title-toc>
1901
+
1902
+
1903
+ <title-page lang="en">Page</title-page>
1904
+ <title-page lang="fr">Page</title-page>
1905
+
1906
+ <title-key lang="en">Key</title-key>
1907
+ <title-key lang="fr">Légende</title-key>
1908
+
1909
+ <title-where lang="en">where</title-where>
1910
+ <title-where lang="fr">où</title-where>
1911
+
1912
+ <title-descriptors lang="en">Descriptors</title-descriptors>
1913
+
1914
+ <title-part lang="en">
1915
+
1916
+
1917
+ <xsl:text>Part #: </xsl:text>
1918
+
1919
+ </title-part>
1920
+ <title-part lang="fr">
1921
+
1922
+
1923
+ <xsl:text>Partie #: </xsl:text>
1924
+
1925
+ </title-part>
1926
+ <title-part lang="zh">第 # 部分:</title-part>
1927
+
1928
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
1929
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
1930
+
1931
+
1932
+ <title-note-to-entry lang="zh">注#: </title-note-to-entry>
1933
+
1934
+
1935
+ <title-modified lang="en">modified</title-modified>
1936
+ <title-modified lang="fr">modifiée</title-modified>
1937
+
1938
+
1939
+ <title-modified lang="zh">改写</title-modified>
1940
+
1941
+
1942
+ <title-source lang="en">SOURCE</title-source>
1943
+
1944
+ <title-keywords lang="en">Keywords</title-keywords>
1945
+
1946
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
1947
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1948
+
1949
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
1950
+
1951
+ <title-list-tables lang="en">List of Tables</title-list-tables>
1871
1952
 
1872
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
1873
- <xsl:text>Edition </xsl:text>
1874
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">
1953
+ <title-list-figures lang="en">List of Figures</title-list-figures>
1875
1954
 
1955
+ <title-recommendation lang="en">Recommendation </title-recommendation>
1876
1956
 
1877
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style">
1957
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1878
1958
 
1959
+ <title-abstract lang="en">Abstract</title-abstract>
1879
1960
 
1880
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
1961
+ <title-summary lang="en">Summary</title-summary>
1962
+
1963
+ <title-in lang="en">in </title-in>
1964
+
1965
+ <title-box lang="en">Box </title-box>
1966
+
1967
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1968
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1969
+
1970
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1971
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1972
+
1973
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1974
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
1975
+
1976
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1977
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
1978
+
1979
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
1980
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1981
+
1982
+ <title-caution lang="en">CAUTION</title-caution>
1983
+ <title-caution lang="zh">注意</title-caution>
1984
+
1985
+ <title-warning lang="en">WARNING</title-warning>
1986
+ <title-warning lang="zh">警告</title-warning>
1987
+
1988
+ <title-amendment lang="en">AMENDMENT</title-amendment>
1989
+ </xsl:variable><xsl:template name="getTitle">
1990
+ <xsl:param name="name"/>
1991
+ <xsl:variable name="lang">
1992
+ <xsl:call-template name="getLang"/>
1993
+ </xsl:variable>
1994
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
1995
+ <xsl:choose>
1996
+ <xsl:when test="normalize-space($title_) != ''">
1997
+ <xsl:value-of select="$title_"/>
1998
+ </xsl:when>
1999
+ <xsl:otherwise>
2000
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2001
+ </xsl:otherwise>
2002
+ </xsl:choose>
2003
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2004
+
2005
+
2006
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1881
2007
 
1882
2008
  <xsl:attribute name="font-family">Courier</xsl:attribute>
1883
2009
  <xsl:attribute name="font-size">9pt</xsl:attribute>
@@ -1890,7 +2016,7 @@
1890
2016
 
1891
2017
 
1892
2018
 
1893
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">
2019
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1894
2020
 
1895
2021
  <xsl:attribute name="font-size">12pt</xsl:attribute>
1896
2022
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -1899,7 +2025,7 @@
1899
2025
 
1900
2026
 
1901
2027
 
1902
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">
2028
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
1903
2029
 
1904
2030
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1905
2031
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
@@ -1907,14 +2033,14 @@
1907
2033
 
1908
2034
 
1909
2035
 
1910
- </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
2036
+ </xsl:attribute-set><xsl:template match="text()">
1911
2037
  <xsl:value-of select="."/>
1912
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
2038
+ </xsl:template><xsl:template match="*[local-name()='br']">
1913
2039
  <xsl:value-of select="$linebreak"/>
1914
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2040
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1915
2041
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1916
2042
  <xsl:call-template name="add-zero-spaces-java"/>
1917
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">
2043
+ </xsl:template><xsl:template match="*[local-name()='table']">
1918
2044
 
1919
2045
  <xsl:variable name="simple-table">
1920
2046
  <!-- <xsl:copy> -->
@@ -1951,7 +2077,11 @@
1951
2077
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1952
2078
 
1953
2079
 
1954
-
2080
+ <xsl:variable name="title-table">
2081
+ <xsl:call-template name="getTitle">
2082
+ <xsl:with-param name="name" select="'title-table'"/>
2083
+ </xsl:call-template>
2084
+ </xsl:variable>
1955
2085
  <xsl:value-of select="$title-table"/>
1956
2086
 
1957
2087
  <xsl:call-template name="getTableNumber"/>
@@ -2051,7 +2181,16 @@
2051
2181
  </xsl:otherwise>
2052
2182
  </xsl:choose>
2053
2183
  </xsl:for-each>
2054
- <xsl:apply-templates/>
2184
+
2185
+ <xsl:choose>
2186
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2187
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2188
+ </xsl:when>
2189
+ <xsl:otherwise>
2190
+ <xsl:apply-templates/>
2191
+ </xsl:otherwise>
2192
+ </xsl:choose>
2193
+
2055
2194
  </fo:table>
2056
2195
 
2057
2196
 
@@ -2059,7 +2198,7 @@
2059
2198
 
2060
2199
 
2061
2200
  </fo:block-container>
2062
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
2201
+ </xsl:template><xsl:template name="getTableNumber">
2063
2202
  <xsl:choose>
2064
2203
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2065
2204
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -2085,15 +2224,15 @@
2085
2224
 
2086
2225
  </xsl:otherwise>
2087
2226
  </xsl:choose>
2088
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2227
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2089
2228
  <xsl:apply-templates/>
2090
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
2229
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2091
2230
  <xsl:param name="table-row"/>
2092
2231
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2093
2232
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2094
2233
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2095
2234
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2096
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
2235
+ </xsl:template><xsl:template name="calculate-column-widths">
2097
2236
  <xsl:param name="table"/>
2098
2237
  <xsl:param name="cols-count"/>
2099
2238
  <xsl:param name="curr-col" select="1"/>
@@ -2191,23 +2330,27 @@
2191
2330
  <xsl:with-param name="table" select="$table"/>
2192
2331
  </xsl:call-template>
2193
2332
  </xsl:if>
2194
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
2333
+ </xsl:template><xsl:template match="text()" mode="td_text">
2195
2334
  <xsl:variable name="zero-space">​</xsl:variable>
2196
2335
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2197
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
2336
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2198
2337
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2199
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
2338
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2200
2339
  <xsl:value-of select="@target"/>
2201
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process">
2340
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2202
2341
  <xsl:param name="cols-count"/>
2203
2342
  <!-- font-weight="bold" -->
2204
2343
  <fo:table-header>
2205
2344
 
2206
2345
  <xsl:apply-templates/>
2207
2346
  </fo:table-header>
2208
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process">
2347
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2348
+ <fo:table-body>
2349
+ <xsl:apply-templates/>
2350
+ </fo:table-body>
2351
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2209
2352
  <xsl:apply-templates/>
2210
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
2353
+ </xsl:template><xsl:template name="insertTableFooter">
2211
2354
  <xsl:param name="cols-count"/>
2212
2355
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2213
2356
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -2247,7 +2390,7 @@
2247
2390
  </fo:table-footer>
2248
2391
 
2249
2392
  </xsl:if>
2250
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">
2393
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2251
2394
 
2252
2395
  <xsl:variable name="cols-count">
2253
2396
  <xsl:choose>
@@ -2278,7 +2421,7 @@
2278
2421
 
2279
2422
  </fo:table-body>
2280
2423
 
2281
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
2424
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2282
2425
  <xsl:variable name="parent-name" select="local-name(..)"/>
2283
2426
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2284
2427
  <fo:table-row min-height="4mm">
@@ -2301,7 +2444,7 @@
2301
2444
 
2302
2445
  <xsl:apply-templates/>
2303
2446
  </fo:table-row>
2304
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
2447
+ </xsl:template><xsl:template match="*[local-name()='th']">
2305
2448
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2306
2449
 
2307
2450
 
@@ -2324,7 +2467,7 @@
2324
2467
  <xsl:apply-templates/>
2325
2468
  </fo:block>
2326
2469
  </fo:table-cell>
2327
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
2470
+ </xsl:template><xsl:template match="*[local-name()='td']">
2328
2471
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2329
2472
 
2330
2473
 
@@ -2366,7 +2509,7 @@
2366
2509
 
2367
2510
 
2368
2511
  </fo:table-cell>
2369
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process">
2512
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2370
2513
 
2371
2514
 
2372
2515
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -2383,6 +2526,12 @@
2383
2526
  <xsl:attribute name="font-family">SimHei</xsl:attribute>
2384
2527
 
2385
2528
 
2529
+
2530
+ <xsl:variable name="title-note">
2531
+ <xsl:call-template name="getTitle">
2532
+ <xsl:with-param name="name" select="'title-note'"/>
2533
+ </xsl:call-template>
2534
+ </xsl:variable>
2386
2535
  <xsl:value-of select="$title-note"/>
2387
2536
 
2388
2537
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -2397,9 +2546,9 @@
2397
2546
  <xsl:apply-templates mode="process"/>
2398
2547
  </fo:block>
2399
2548
 
2400
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2549
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2401
2550
  <xsl:apply-templates/>
2402
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
2551
+ </xsl:template><xsl:template name="fn_display">
2403
2552
  <xsl:variable name="references">
2404
2553
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2405
2554
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2442,7 +2591,7 @@
2442
2591
  </fo:block>
2443
2592
  </xsl:if>
2444
2593
  </xsl:for-each>
2445
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
2594
+ </xsl:template><xsl:template name="fn_name_display">
2446
2595
  <!-- <xsl:variable name="references">
2447
2596
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2448
2597
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2458,7 +2607,7 @@
2458
2607
  <xsl:apply-templates/>
2459
2608
  </fo:block>
2460
2609
  </xsl:for-each>
2461
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
2610
+ </xsl:template><xsl:template name="fn_display_figure">
2462
2611
  <xsl:variable name="key_iso">
2463
2612
  true <!-- and (not(@class) or @class !='pseudocode') -->
2464
2613
  </xsl:variable>
@@ -2469,6 +2618,36 @@
2469
2618
  </fn>
2470
2619
  </xsl:for-each>
2471
2620
  </xsl:variable>
2621
+
2622
+ <!-- current hierarchy is 'figure' element -->
2623
+ <xsl:variable name="following_dl_colwidths">
2624
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2625
+ <xsl:variable name="html-table">
2626
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2627
+ <xsl:element name="{$ns}:table">
2628
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2629
+ <tbody>
2630
+ <xsl:apply-templates mode="dl"/>
2631
+ </tbody>
2632
+ </xsl:for-each>
2633
+ </xsl:element>
2634
+ </xsl:variable>
2635
+
2636
+ <xsl:call-template name="calculate-column-widths">
2637
+ <xsl:with-param name="cols-count" select="2"/>
2638
+ <xsl:with-param name="table" select="$html-table"/>
2639
+ </xsl:call-template>
2640
+
2641
+ </xsl:if>
2642
+ </xsl:variable>
2643
+
2644
+
2645
+ <xsl:variable name="maxlength_dt">
2646
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2647
+ <xsl:call-template name="getMaxLength_dt"/>
2648
+ </xsl:for-each>
2649
+ </xsl:variable>
2650
+
2472
2651
  <xsl:if test="xalan:nodeset($references)//fn">
2473
2652
  <fo:block>
2474
2653
  <fo:table width="95%" table-layout="fixed">
@@ -2476,8 +2655,19 @@
2476
2655
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2477
2656
 
2478
2657
  </xsl:if>
2479
- <fo:table-column column-width="15%"/>
2480
- <fo:table-column column-width="85%"/>
2658
+ <xsl:choose>
2659
+ <!-- if there 'dl', then set same columns width -->
2660
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2661
+ <xsl:call-template name="setColumnWidth_dl">
2662
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2663
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2664
+ </xsl:call-template>
2665
+ </xsl:when>
2666
+ <xsl:otherwise>
2667
+ <fo:table-column column-width="15%"/>
2668
+ <fo:table-column column-width="85%"/>
2669
+ </xsl:otherwise>
2670
+ </xsl:choose>
2481
2671
  <fo:table-body>
2482
2672
  <xsl:for-each select="xalan:nodeset($references)//fn">
2483
2673
  <xsl:variable name="reference" select="@reference"/>
@@ -2509,7 +2699,7 @@
2509
2699
  </fo:block>
2510
2700
  </xsl:if>
2511
2701
 
2512
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
2702
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2513
2703
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2514
2704
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
2515
2705
 
@@ -2525,11 +2715,11 @@
2525
2715
  <xsl:value-of select="@reference"/>
2526
2716
  </fo:basic-link>
2527
2717
  </fo:inline>
2528
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
2718
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2529
2719
  <fo:inline>
2530
2720
  <xsl:apply-templates/>
2531
2721
  </fo:inline>
2532
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
2722
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2533
2723
  <xsl:variable name="parent" select="local-name(..)"/>
2534
2724
 
2535
2725
  <xsl:variable name="key_iso">
@@ -2546,6 +2736,11 @@
2546
2736
 
2547
2737
  <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
2548
2738
 
2739
+ <xsl:variable name="title-where">
2740
+ <xsl:call-template name="getTitle">
2741
+ <xsl:with-param name="name" select="'title-where'"/>
2742
+ </xsl:call-template>
2743
+ </xsl:variable>
2549
2744
  <xsl:value-of select="$title-where"/>
2550
2745
  </fo:block>
2551
2746
  <fo:block>
@@ -2569,17 +2764,27 @@
2569
2764
  <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
2570
2765
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2571
2766
 
2767
+ <xsl:variable name="title-where">
2768
+ <xsl:call-template name="getTitle">
2769
+ <xsl:with-param name="name" select="'title-where'"/>
2770
+ </xsl:call-template>
2771
+ </xsl:variable>
2572
2772
  <xsl:value-of select="$title-where"/>
2573
2773
  </fo:block>
2574
2774
  </xsl:when>
2575
2775
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2576
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
2776
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2577
2777
 
2578
2778
 
2579
2779
 
2580
2780
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2581
2781
  <xsl:attribute name="text-indent">7.4mm</xsl:attribute>
2582
2782
 
2783
+ <xsl:variable name="title-key">
2784
+ <xsl:call-template name="getTitle">
2785
+ <xsl:with-param name="name" select="'title-key'"/>
2786
+ </xsl:call-template>
2787
+ </xsl:variable>
2583
2788
  <xsl:value-of select="$title-key"/>
2584
2789
  </fo:block>
2585
2790
  </xsl:when>
@@ -2601,23 +2806,6 @@
2601
2806
  </xsl:if>
2602
2807
 
2603
2808
 
2604
- <!-- create virtual html table for dl/[dt and dd] -->
2605
- <xsl:variable name="html-table">
2606
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2607
- <xsl:element name="{$ns}:table">
2608
- <tbody>
2609
- <xsl:apply-templates mode="dl"/>
2610
- </tbody>
2611
- </xsl:element>
2612
- </xsl:variable>
2613
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2614
- <xsl:variable name="colwidths">
2615
- <xsl:call-template name="calculate-column-widths">
2616
- <xsl:with-param name="cols-count" select="2"/>
2617
- <xsl:with-param name="table" select="$html-table"/>
2618
- </xsl:call-template>
2619
- </xsl:variable>
2620
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2621
2809
 
2622
2810
  <fo:table width="95%" table-layout="fixed">
2623
2811
 
@@ -2632,42 +2820,30 @@
2632
2820
 
2633
2821
  </xsl:when>
2634
2822
  </xsl:choose>
2635
- <xsl:choose>
2636
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2637
- <fo:table-column column-width="50%"/>
2638
- <fo:table-column column-width="50%"/>
2639
- </xsl:when>
2640
- <xsl:otherwise>
2641
- <xsl:choose>
2642
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2643
- <fo:table-column column-width="60%"/>
2644
- <fo:table-column column-width="40%"/>
2645
- </xsl:when> -->
2646
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2647
- <fo:table-column column-width="50%"/>
2648
- <fo:table-column column-width="50%"/>
2649
- </xsl:when>
2650
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2651
- <fo:table-column column-width="40%"/>
2652
- <fo:table-column column-width="60%"/>
2653
- </xsl:when>
2654
- <xsl:otherwise>
2655
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2656
- <xsl:choose>
2657
- <xsl:when test=". = 1 or . = 0">
2658
- <fo:table-column column-width="proportional-column-width(2)"/>
2659
- </xsl:when>
2660
- <xsl:otherwise>
2661
- <fo:table-column column-width="proportional-column-width({.})"/>
2662
- </xsl:otherwise>
2663
- </xsl:choose>
2664
- </xsl:for-each>
2665
- </xsl:otherwise>
2666
- </xsl:choose>
2667
- <!-- <fo:table-column column-width="15%"/>
2668
- <fo:table-column column-width="85%"/> -->
2669
- </xsl:otherwise>
2670
- </xsl:choose>
2823
+ <!-- create virtual html table for dl/[dt and dd] -->
2824
+ <xsl:variable name="html-table">
2825
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2826
+ <xsl:element name="{$ns}:table">
2827
+ <tbody>
2828
+ <xsl:apply-templates mode="dl"/>
2829
+ </tbody>
2830
+ </xsl:element>
2831
+ </xsl:variable>
2832
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2833
+ <xsl:variable name="colwidths">
2834
+ <xsl:call-template name="calculate-column-widths">
2835
+ <xsl:with-param name="cols-count" select="2"/>
2836
+ <xsl:with-param name="table" select="$html-table"/>
2837
+ </xsl:call-template>
2838
+ </xsl:variable>
2839
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2840
+ <xsl:variable name="maxlength_dt">
2841
+ <xsl:call-template name="getMaxLength_dt"/>
2842
+ </xsl:variable>
2843
+ <xsl:call-template name="setColumnWidth_dl">
2844
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2845
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2846
+ </xsl:call-template>
2671
2847
  <fo:table-body>
2672
2848
  <xsl:apply-templates>
2673
2849
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -2677,7 +2853,61 @@
2677
2853
  </fo:block>
2678
2854
  </fo:block>
2679
2855
  </xsl:if>
2680
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
2856
+ </xsl:template><xsl:template name="setColumnWidth_dl">
2857
+ <xsl:param name="colwidths"/>
2858
+ <xsl:param name="maxlength_dt"/>
2859
+ <xsl:choose>
2860
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2861
+ <fo:table-column column-width="50%"/>
2862
+ <fo:table-column column-width="50%"/>
2863
+ </xsl:when>
2864
+ <xsl:otherwise>
2865
+ <xsl:choose>
2866
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2867
+ <fo:table-column column-width="5%"/>
2868
+ <fo:table-column column-width="95%"/>
2869
+ </xsl:when>
2870
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2871
+ <fo:table-column column-width="10%"/>
2872
+ <fo:table-column column-width="90%"/>
2873
+ </xsl:when>
2874
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2875
+ <fo:table-column column-width="60%"/>
2876
+ <fo:table-column column-width="40%"/>
2877
+ </xsl:when> -->
2878
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2879
+ <fo:table-column column-width="50%"/>
2880
+ <fo:table-column column-width="50%"/>
2881
+ </xsl:when>
2882
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2883
+ <fo:table-column column-width="40%"/>
2884
+ <fo:table-column column-width="60%"/>
2885
+ </xsl:when>
2886
+ <xsl:otherwise>
2887
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2888
+ <xsl:choose>
2889
+ <xsl:when test=". = 1 or . = 0">
2890
+ <fo:table-column column-width="proportional-column-width(2)"/>
2891
+ </xsl:when>
2892
+ <xsl:otherwise>
2893
+ <fo:table-column column-width="proportional-column-width({.})"/>
2894
+ </xsl:otherwise>
2895
+ </xsl:choose>
2896
+ </xsl:for-each>
2897
+ </xsl:otherwise>
2898
+ </xsl:choose>
2899
+ <!-- <fo:table-column column-width="15%"/>
2900
+ <fo:table-column column-width="85%"/> -->
2901
+ </xsl:otherwise>
2902
+ </xsl:choose>
2903
+ </xsl:template><xsl:template name="getMaxLength_dt">
2904
+ <xsl:for-each select="*[local-name()='dt']">
2905
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2906
+ <xsl:if test="position() = 1">
2907
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2908
+ </xsl:if>
2909
+ </xsl:for-each>
2910
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
2681
2911
  <xsl:param name="key_iso"/>
2682
2912
 
2683
2913
  <!-- <tr>
@@ -2693,6 +2923,11 @@
2693
2923
  <xsl:if test="normalize-space($key_iso) = 'true'">
2694
2924
  <xsl:attribute name="margin-top">0</xsl:attribute>
2695
2925
  </xsl:if>
2926
+ <xsl:variable name="title-note">
2927
+ <xsl:call-template name="getTitle">
2928
+ <xsl:with-param name="name" select="'title-note'"/>
2929
+ </xsl:call-template>
2930
+ </xsl:variable>
2696
2931
  <xsl:value-of select="$title-note"/>
2697
2932
  </fo:block>
2698
2933
  </fo:table-cell>
@@ -2702,7 +2937,7 @@
2702
2937
  </fo:block>
2703
2938
  </fo:table-cell>
2704
2939
  </fo:table-row>
2705
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
2940
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
2706
2941
  <tr>
2707
2942
  <td>
2708
2943
  <xsl:apply-templates/>
@@ -2715,7 +2950,7 @@
2715
2950
  </td>
2716
2951
  </tr>
2717
2952
 
2718
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
2953
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2719
2954
  <xsl:param name="key_iso"/>
2720
2955
 
2721
2956
  <fo:table-row>
@@ -2734,11 +2969,11 @@
2734
2969
 
2735
2970
 
2736
2971
  <xsl:apply-templates/>
2737
-
2972
+ <!-- <xsl:if test="$namespace = 'gb'">
2738
2973
  <xsl:if test="ancestor::*[local-name()='formula']">
2739
2974
  <xsl:text>—</xsl:text>
2740
2975
  </xsl:if>
2741
-
2976
+ </xsl:if> -->
2742
2977
  </fo:block>
2743
2978
  </fo:table-cell>
2744
2979
  <fo:table-cell>
@@ -2752,37 +2987,37 @@
2752
2987
  </fo:table-cell>
2753
2988
  </fo:table-row>
2754
2989
 
2755
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process">
2990
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2756
2991
  <xsl:apply-templates/>
2757
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process">
2992
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2758
2993
  <xsl:apply-templates/>
2759
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2994
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2760
2995
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2761
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
2996
+ </xsl:template><xsl:template match="*[local-name()='em']">
2762
2997
  <fo:inline font-style="italic">
2763
2998
  <xsl:apply-templates/>
2764
2999
  </fo:inline>
2765
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
3000
+ </xsl:template><xsl:template match="*[local-name()='strong']">
2766
3001
  <fo:inline font-weight="bold">
2767
3002
  <xsl:apply-templates/>
2768
3003
  </fo:inline>
2769
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
3004
+ </xsl:template><xsl:template match="*[local-name()='sup']">
2770
3005
  <fo:inline font-size="80%" vertical-align="super">
2771
3006
  <xsl:apply-templates/>
2772
3007
  </fo:inline>
2773
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
3008
+ </xsl:template><xsl:template match="*[local-name()='sub']">
2774
3009
  <fo:inline font-size="80%" vertical-align="sub">
2775
3010
  <xsl:apply-templates/>
2776
3011
  </fo:inline>
2777
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
3012
+ </xsl:template><xsl:template match="*[local-name()='tt']">
2778
3013
  <fo:inline font-family="Courier" font-size="10pt">
2779
3014
  <xsl:apply-templates/>
2780
3015
  </fo:inline>
2781
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
3016
+ </xsl:template><xsl:template match="*[local-name()='del']">
2782
3017
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2783
3018
  <xsl:apply-templates/>
2784
3019
  </fo:inline>
2785
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
3020
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2786
3021
  <xsl:variable name="text" select="normalize-space(.)"/>
2787
3022
  <fo:inline font-size="75%">
2788
3023
  <xsl:if test="string-length($text) &gt; 0">
@@ -2791,10 +3026,11 @@
2791
3026
  </xsl:call-template>
2792
3027
  </xsl:if>
2793
3028
  </fo:inline>
2794
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
3029
+ </xsl:template><xsl:template name="recursiveSmallCaps">
2795
3030
  <xsl:param name="text"/>
2796
3031
  <xsl:variable name="char" select="substring($text,1,1)"/>
2797
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3032
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3033
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2798
3034
  <xsl:choose>
2799
3035
  <xsl:when test="$char=$upperCase">
2800
3036
  <fo:inline font-size="{100 div 0.75}%">
@@ -2810,7 +3046,7 @@
2810
3046
  <xsl:with-param name="text" select="substring($text,2)"/>
2811
3047
  </xsl:call-template>
2812
3048
  </xsl:if>
2813
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
3049
+ </xsl:template><xsl:template name="tokenize">
2814
3050
  <xsl:param name="text"/>
2815
3051
  <xsl:param name="separator" select="' '"/>
2816
3052
  <xsl:choose>
@@ -2858,7 +3094,7 @@
2858
3094
  </xsl:call-template>
2859
3095
  </xsl:otherwise>
2860
3096
  </xsl:choose>
2861
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
3097
+ </xsl:template><xsl:template name="max_length">
2862
3098
  <xsl:param name="words"/>
2863
3099
  <xsl:for-each select="$words//word">
2864
3100
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2866,11 +3102,11 @@
2866
3102
  <xsl:value-of select="."/>
2867
3103
  </xsl:if>
2868
3104
  </xsl:for-each>
2869
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
3105
+ </xsl:template><xsl:template name="add-zero-spaces-java">
2870
3106
  <xsl:param name="text" select="."/>
2871
3107
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2872
3108
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2873
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
3109
+ </xsl:template><xsl:template name="add-zero-spaces">
2874
3110
  <xsl:param name="text" select="."/>
2875
3111
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2876
3112
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -2923,7 +3159,7 @@
2923
3159
  <xsl:value-of select="$text"/>
2924
3160
  </xsl:otherwise>
2925
3161
  </xsl:choose>
2926
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
3162
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
2927
3163
  <xsl:param name="text" select="."/>
2928
3164
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
2929
3165
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -2949,7 +3185,7 @@
2949
3185
  <xsl:value-of select="$text"/>
2950
3186
  </xsl:otherwise>
2951
3187
  </xsl:choose>
2952
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
3188
+ </xsl:template><xsl:template name="getSimpleTable">
2953
3189
  <xsl:variable name="simple-table">
2954
3190
 
2955
3191
  <!-- Step 1. colspan processing -->
@@ -2976,9 +3212,9 @@
2976
3212
  </xsl:choose> -->
2977
3213
  </xsl:variable>
2978
3214
  <xsl:copy-of select="$simple-table"/>
2979
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3215
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
2980
3216
  <xsl:apply-templates mode="simple-table-colspan"/>
2981
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3217
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
2982
3218
  <xsl:choose>
2983
3219
  <xsl:when test="@colspan">
2984
3220
  <xsl:variable name="td">
@@ -3000,16 +3236,16 @@
3000
3236
  </xsl:element>
3001
3237
  </xsl:otherwise>
3002
3238
  </xsl:choose>
3003
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan">
3239
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3004
3240
  <xsl:element name="tr">
3005
3241
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3006
3242
  <xsl:apply-templates mode="simple-table-colspan"/>
3007
3243
  </xsl:element>
3008
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
3244
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3009
3245
  <xsl:copy>
3010
3246
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3011
3247
  </xsl:copy>
3012
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
3248
+ </xsl:template><xsl:template name="repeatNode">
3013
3249
  <xsl:param name="count"/>
3014
3250
  <xsl:param name="node"/>
3015
3251
 
@@ -3020,18 +3256,18 @@
3020
3256
  </xsl:call-template>
3021
3257
  <xsl:copy-of select="$node"/>
3022
3258
  </xsl:if>
3023
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
3259
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3024
3260
  <xsl:copy>
3025
3261
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3026
3262
  </xsl:copy>
3027
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
3263
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3028
3264
  <xsl:copy>
3029
3265
  <xsl:copy-of select="tr[1]"/>
3030
3266
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3031
3267
  <xsl:with-param name="previousRow" select="tr[1]"/>
3032
3268
  </xsl:apply-templates>
3033
3269
  </xsl:copy>
3034
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
3270
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3035
3271
  <xsl:param name="previousRow"/>
3036
3272
  <xsl:variable name="currentRow" select="."/>
3037
3273
 
@@ -3065,43 +3301,53 @@
3065
3301
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3066
3302
  <xsl:with-param name="previousRow" select="$newRow"/>
3067
3303
  </xsl:apply-templates>
3068
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
3304
+ </xsl:template><xsl:template name="getLang">
3069
3305
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3070
3306
  <xsl:choose>
3071
3307
  <xsl:when test="$language = 'English'">en</xsl:when>
3072
3308
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3073
3309
  </xsl:choose>
3074
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
3310
+ </xsl:template><xsl:template name="capitalizeWords">
3075
3311
  <xsl:param name="str"/>
3076
3312
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3077
3313
  <xsl:choose>
3078
3314
  <xsl:when test="contains($str2, ' ')">
3079
3315
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3080
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3081
- <xsl:value-of select="substring($substr, 2)"/>
3316
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3317
+ <xsl:value-of select="substring($substr, 2)"/> -->
3318
+ <xsl:call-template name="capitalize">
3319
+ <xsl:with-param name="str" select="$substr"/>
3320
+ </xsl:call-template>
3082
3321
  <xsl:text> </xsl:text>
3083
3322
  <xsl:call-template name="capitalizeWords">
3084
3323
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3085
3324
  </xsl:call-template>
3086
3325
  </xsl:when>
3087
3326
  <xsl:otherwise>
3088
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3089
- <xsl:value-of select="substring($str2, 2)"/>
3327
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3328
+ <xsl:value-of select="substring($str2, 2)"/> -->
3329
+ <xsl:call-template name="capitalize">
3330
+ <xsl:with-param name="str" select="$str2"/>
3331
+ </xsl:call-template>
3090
3332
  </xsl:otherwise>
3091
3333
  </xsl:choose>
3092
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
3334
+ </xsl:template><xsl:template name="capitalize">
3335
+ <xsl:param name="str"/>
3336
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3337
+ <xsl:value-of select="substring($str, 2)"/>
3338
+ </xsl:template><xsl:template match="mathml:math">
3093
3339
  <fo:inline font-family="STIX2Math">
3094
3340
  <fo:instream-foreign-object fox:alt-text="Math">
3095
3341
  <xsl:copy-of select="."/>
3096
3342
  </fo:instream-foreign-object>
3097
3343
  </fo:inline>
3098
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
3344
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3099
3345
  <xsl:for-each select="*[local-name()='locality']">
3100
3346
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3101
3347
  <xsl:apply-templates select="."/>
3102
3348
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3103
3349
  </xsl:for-each>
3104
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
3350
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3105
3351
  <xsl:variable name="target">
3106
3352
  <xsl:choose>
3107
3353
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3131,7 +3377,7 @@
3131
3377
  </xsl:otherwise>
3132
3378
  </xsl:choose>
3133
3379
  </fo:inline>
3134
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
3380
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3135
3381
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3136
3382
  <!-- <xsl:choose>
3137
3383
  <xsl:when test="@lang = 'en'"></xsl:when>
@@ -3142,19 +3388,29 @@
3142
3388
  </xsl:choose> -->
3143
3389
  <xsl:apply-templates/>
3144
3390
  </fo:block>
3145
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
3391
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3146
3392
  <fo:inline id="{@id}"/>
3147
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
3393
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3148
3394
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3395
+ <xsl:variable name="title-appendix">
3396
+ <xsl:call-template name="getTitle">
3397
+ <xsl:with-param name="name" select="'title-appendix'"/>
3398
+ </xsl:call-template>
3399
+ </xsl:variable>
3149
3400
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3150
3401
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3151
3402
  </fo:block>
3152
3403
  <xsl:apply-templates/>
3153
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3404
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3154
3405
  <fo:inline><xsl:apply-templates/></fo:inline>
3155
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
3406
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3156
3407
  <fo:block xsl:use-attribute-sets="appendix-example-style">
3157
3408
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3409
+ <xsl:variable name="title-example">
3410
+ <xsl:call-template name="getTitle">
3411
+ <xsl:with-param name="name" select="'title-example'"/>
3412
+ </xsl:call-template>
3413
+ </xsl:variable>
3158
3414
  <xsl:value-of select="$title-example"/>
3159
3415
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3160
3416
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -3164,11 +3420,11 @@
3164
3420
  </xsl:if>
3165
3421
  </fo:block>
3166
3422
  <xsl:apply-templates/>
3167
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3423
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3168
3424
  <fo:inline><xsl:apply-templates/></fo:inline>
3169
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
3425
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3170
3426
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3171
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
3427
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3172
3428
  <xsl:variable name="annotation-id" select="@id"/>
3173
3429
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3174
3430
  <fo:block id="{$annotation-id}" white-space="nowrap">
@@ -3178,14 +3434,25 @@
3178
3434
  </xsl:apply-templates>
3179
3435
  </fo:inline>
3180
3436
  </fo:block>
3181
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3437
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3182
3438
  <xsl:param name="callout"/>
3183
3439
  <fo:inline id="{@id}">
3184
3440
  <!-- for first p in annotation, put <x> -->
3185
3441
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3186
3442
  <xsl:apply-templates/>
3187
3443
  </fo:inline>
3188
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
3444
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3445
+ <xsl:variable name="title-modified">
3446
+ <xsl:call-template name="getTitle">
3447
+ <xsl:with-param name="name" select="'title-modified'"/>
3448
+ </xsl:call-template>
3449
+ </xsl:variable>
3450
+ <xsl:choose>
3451
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3452
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3453
+ </xsl:choose>
3454
+ <xsl:apply-templates/>
3455
+ </xsl:template><xsl:template name="convertDate">
3189
3456
  <xsl:param name="date"/>
3190
3457
  <xsl:param name="format" select="'short'"/>
3191
3458
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -3218,7 +3485,7 @@
3218
3485
  </xsl:choose>
3219
3486
  </xsl:variable>
3220
3487
  <xsl:value-of select="$result"/>
3221
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
3488
+ </xsl:template><xsl:template name="insertKeywords">
3222
3489
  <xsl:param name="sorting" select="'true'"/>
3223
3490
  <xsl:param name="charAtEnd" select="'.'"/>
3224
3491
  <xsl:param name="charDelim" select="', '"/>
@@ -3241,7 +3508,7 @@
3241
3508
  </xsl:for-each>
3242
3509
  </xsl:otherwise>
3243
3510
  </xsl:choose>
3244
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
3511
+ </xsl:template><xsl:template name="insertKeyword">
3245
3512
  <xsl:param name="charAtEnd"/>
3246
3513
  <xsl:param name="charDelim"/>
3247
3514
  <xsl:apply-templates/>
@@ -3249,4 +3516,138 @@
3249
3516
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3250
3517
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3251
3518
  </xsl:choose>
3519
+ </xsl:template><xsl:template name="addPDFUAmeta">
3520
+ <fo:declarations>
3521
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3522
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3523
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3524
+ </pdf:dictionary>
3525
+ </pdf:catalog>
3526
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3527
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3528
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3529
+ <!-- Dublin Core properties go here -->
3530
+ <dc:title>
3531
+ <xsl:variable name="title">
3532
+
3533
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
3534
+
3535
+
3536
+
3537
+
3538
+ </xsl:variable>
3539
+ <xsl:choose>
3540
+ <xsl:when test="normalize-space($title) != ''">
3541
+ <xsl:value-of select="$title"/>
3542
+ </xsl:when>
3543
+ <xsl:otherwise>
3544
+ <xsl:text> </xsl:text>
3545
+ </xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </dc:title>
3548
+ <dc:creator>
3549
+
3550
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
3551
+
3552
+
3553
+ </dc:creator>
3554
+ <dc:description>
3555
+ <xsl:variable name="abstract">
3556
+
3557
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
3558
+
3559
+
3560
+
3561
+
3562
+ </xsl:variable>
3563
+ <xsl:value-of select="normalize-space($abstract)"/>
3564
+ </dc:description>
3565
+ <pdf:Keywords>
3566
+ <xsl:call-template name="insertKeywords"/>
3567
+ </pdf:Keywords>
3568
+ </rdf:Description>
3569
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3570
+ <!-- XMP properties go here -->
3571
+ <xmp:CreatorTool/>
3572
+ </rdf:Description>
3573
+ </rdf:RDF>
3574
+ </x:xmpmeta>
3575
+ </fo:declarations>
3576
+ </xsl:template><xsl:template name="getId">
3577
+ <xsl:choose>
3578
+ <xsl:when test="../@id">
3579
+ <xsl:value-of select="../@id"/>
3580
+ </xsl:when>
3581
+ <xsl:otherwise>
3582
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3583
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3584
+ </xsl:otherwise>
3585
+ </xsl:choose>
3586
+ </xsl:template><xsl:template name="getLevel">
3587
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3588
+ <xsl:variable name="level">
3589
+ <xsl:choose>
3590
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3591
+ <xsl:value-of select="$level_total - 2"/>
3592
+ </xsl:when>
3593
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3594
+ <xsl:value-of select="$level_total - 2"/>
3595
+ </xsl:when>
3596
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3597
+ <xsl:value-of select="$level_total - 2"/>
3598
+ </xsl:when>
3599
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3600
+ <xsl:otherwise>
3601
+ <xsl:value-of select="$level_total - 1"/>
3602
+ </xsl:otherwise>
3603
+ </xsl:choose>
3604
+ </xsl:variable>
3605
+ <xsl:value-of select="$level"/>
3606
+ </xsl:template><xsl:template name="getSubSection">
3607
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
3608
+ </xsl:template><xsl:template name="split">
3609
+ <xsl:param name="pText" select="."/>
3610
+ <xsl:param name="sep" select="','"/>
3611
+ <xsl:if test="string-length($pText) &gt;0">
3612
+ <item>
3613
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3614
+ </item>
3615
+ <xsl:call-template name="split">
3616
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3617
+ <xsl:with-param name="sep" select="$sep"/>
3618
+ </xsl:call-template>
3619
+ </xsl:if>
3620
+ </xsl:template><xsl:template name="getDocumentId">
3621
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3622
+ </xsl:template><xsl:template name="namespaceCheck">
3623
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
3624
+ <xsl:variable name="XSLNS">
3625
+
3626
+
3627
+
3628
+
3629
+
3630
+
3631
+
3632
+
3633
+
3634
+
3635
+
3636
+
3637
+ <xsl:value-of select="document('')//*/namespace::gb"/>
3638
+
3639
+ </xsl:variable>
3640
+ <xsl:if test="$documentNS != $XSLNS">
3641
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
3642
+ </xsl:if>
3643
+ </xsl:template><xsl:template name="getLanguage">
3644
+ <xsl:param name="lang"/>
3645
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
3646
+ <xsl:choose>
3647
+ <xsl:when test="$language = 'en'">English</xsl:when>
3648
+ <xsl:when test="$language = 'fr'">French</xsl:when>
3649
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
3650
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
3651
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3652
+ </xsl:choose>
3252
3653
  </xsl:template></xsl:stylesheet>