metanorma-itu 1.0.18 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f73d7454cb02fbc95efe4d8deb62e8f19f01eba49a9cd73403f3948f5eec053
4
- data.tar.gz: f87b4616dd0b0e48423efc44a5cc7115d1d4841f3aaf4ba1549f5dd0f02fe8fa
3
+ metadata.gz: b6ac25e837c79b80506bd97901541337cec2796e4d152c66713cc566190ae157
4
+ data.tar.gz: 1a304163bea03ddb785255c0a513b505e0f62e7107a65054d67a354e457e52eb
5
5
  SHA512:
6
- metadata.gz: 4483e1f5ba81d0677d38cb74c691104d4900653a896eda40d0d2abe5f60a2a14a764b02c1b3ebc31d0b1b43d2451f50e7df91d975b088cc435c9dac25835581f
7
- data.tar.gz: cc0a4617299d46730aeede48cf50fba13dc0b65a649879af55199ecf37b941419100692c964cfeab8e63ce78f4f4845a8b38ad6c450ecff28fab05a398358207
6
+ metadata.gz: a834bd5d824a3478a832bc8aea5f43391d7c54282a09092a9355503f7fdb3542da68f3ba4d651ea288700ba473d79eaa13fb6e1836172080255d74bc23e80dfe
7
+ data.tar.gz: fa30f3b4d4db6531691b520c1ff75610b8c0198c9db1ea12e4e5507febfdc481c73b4f6dd46f287e732abaa63a3a187002815ccd6fe8401c9df46de1bdada7a1
@@ -71,46 +71,46 @@ module Asciidoctor
71
71
  x.at("//sections/clause[descendant::definitions]")
72
72
  unless x.at("//sections/clause/title[text() = 'Conventions']")
73
73
  ins.next = "<clause id='_#{UUIDTools::UUID.random_create}'>"\
74
- "<title>Conventions</title><p>"\
75
- "#{@labels['clause_empty']}</p></clause>"
76
- end
77
- end
74
+ "<title>Conventions</title><p>"\
75
+ "#{@labels['clause_empty']}</p></clause>"
76
+ end
77
+ end
78
78
 
79
- def cleanup(xmldoc)
80
- symbols_cleanup(xmldoc)
81
- super
82
- obligations_cleanup(xmldoc)
83
- xmldoc
84
- end
79
+ def cleanup(xmldoc)
80
+ symbols_cleanup(xmldoc)
81
+ super
82
+ obligations_cleanup(xmldoc)
83
+ xmldoc
84
+ end
85
85
 
86
- def smartquotes_cleanup(xmldoc)
87
- return super if @smartquotes
88
- xmldoc.traverse do |n|
86
+ def smartquotes_cleanup(xmldoc)
87
+ return super if @smartquotes
88
+ xmldoc.traverse do |n|
89
89
  next unless n.text?
90
90
  n.replace(HTMLEntities.new.encode(
91
91
  n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'").
92
92
  gsub(/\u201c|\u201d|\u201e|\u201f/, '"'), :basic))
93
- end
94
- xmldoc
95
- end
93
+ end
94
+ xmldoc
95
+ end
96
96
 
97
- def termdef_cleanup(xmldoc)
98
- xmldoc.xpath("//term/preferred").each do |p|
97
+ def termdef_cleanup(xmldoc)
98
+ xmldoc.xpath("//term/preferred").each do |p|
99
99
  if ["terms defined elsewhere",
100
- "terms defined in this recommendation"].include? p.text.downcase
101
- p.name = "title"
102
- p.parent.name = "terms"
103
- end
104
- end
105
- super
100
+ "terms defined in this recommendation"].include? p.text.downcase
101
+ p.name = "title"
102
+ p.parent.name = "terms"
106
103
  end
104
+ end
105
+ super
106
+ end
107
107
 
108
- def termdef_boilerplate_cleanup(xmldoc)
109
- end
108
+ def termdef_boilerplate_cleanup(xmldoc)
109
+ end
110
110
 
111
- def symbols_cleanup(xmldoc)
112
- sym = xmldoc.at("//definitions/title")
113
- sym and sym&.next_element&.name == "dl" and
111
+ def symbols_cleanup(xmldoc)
112
+ sym = xmldoc.at("//definitions/title")
113
+ sym and sym&.next_element&.name == "dl" and
114
114
  sym.next = "<p>#{@symbols_boilerplate}</p>"
115
115
  end
116
116
 
@@ -118,55 +118,55 @@ module Asciidoctor
118
118
 
119
119
  def pub_class(bib)
120
120
  return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ITU']")
121
- return 1 if bib.at("#{PUBLISHER}[name = 'International "\
122
- "Telecommunication Union']")
123
- return 2 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
124
- return 2 if bib.at("#{PUBLISHER}[name = 'International Organization "\
125
- "for Standardization']")
126
- return 3 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
127
- return 3 if bib.at("#{PUBLISHER}[name = 'International "\
128
- "Electrotechnical Commission']")
129
- return 4 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
130
- "@type = 'metanorma' or @type = 'ISSN' or @type = "\
131
- "'ISBN')]")
132
- 5
133
- end
121
+ return 1 if bib.at("#{PUBLISHER}[name = 'International "\
122
+ "Telecommunication Union']")
123
+ return 2 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
124
+ return 2 if bib.at("#{PUBLISHER}[name = 'International Organization "\
125
+ "for Standardization']")
126
+ return 3 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
127
+ return 3 if bib.at("#{PUBLISHER}[name = 'International "\
128
+ "Electrotechnical Commission']")
129
+ return 4 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
130
+ "@type = 'metanorma' or @type = 'ISSN' or @type = "\
131
+ "'ISBN')]")
132
+ 5
133
+ end
134
134
 
135
- def sort_biblio(bib)
136
- bib.sort do |a, b|
137
- sort_biblio_key(a) <=> sort_biblio_key(b)
138
- end
135
+ def sort_biblio(bib)
136
+ bib.sort do |a, b|
137
+ sort_biblio_key(a) <=> sort_biblio_key(b)
139
138
  end
139
+ end
140
140
 
141
- # sort by: doc class (ITU, ISO, IEC, other standard (not DOI &c), other
142
- # then standard class (docid class other than DOI &c)
143
- # then alphanumeric doc id (not DOI &c)
144
- # then title
145
- def sort_biblio_key(bib)
146
- pubclass = pub_class(bib)
147
- num = bib&.at("./docnumber")&.text
148
- id = bib&.at("./docidentifier[not(@type = 'DOI' or @type = "\
149
- "'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
150
- metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
151
- abbrid = metaid unless /^\[\d+\]$/.match(metaid)
152
- type = id['type'] if id
153
- title = bib&.at("./title[@type = 'main']")&.text ||
154
- bib&.at("./title")&.text || bib&.at("./formattedref")&.text
155
- "#{pubclass} :: #{type} :: #{id&.text || metaid} :: #{title}"
156
- end
141
+ # sort by: doc class (ITU, ISO, IEC, other standard (not DOI &c), other
142
+ # then standard class (docid class other than DOI &c)
143
+ # then alphanumeric doc id (not DOI &c)
144
+ # then title
145
+ def sort_biblio_key(bib)
146
+ pubclass = pub_class(bib)
147
+ num = bib&.at("./docnumber")&.text
148
+ id = bib&.at("./docidentifier[not(@type = 'DOI' or @type = "\
149
+ "'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
150
+ metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
151
+ abbrid = metaid unless /^\[\d+\]$/.match(metaid)
152
+ type = id['type'] if id
153
+ title = bib&.at("./title[@type = 'main']")&.text ||
154
+ bib&.at("./title")&.text || bib&.at("./formattedref")&.text
155
+ "#{pubclass} :: #{type} :: #{id&.text || metaid} :: #{title}"
156
+ end
157
157
 
158
- def biblio_reorder(xmldoc)
159
- xmldoc.xpath("//references").each do |r|
160
- biblio_reorder1(r)
161
- end
158
+ def biblio_reorder(xmldoc)
159
+ xmldoc.xpath("//references").each do |r|
160
+ biblio_reorder1(r)
162
161
  end
162
+ end
163
163
 
164
- def normref_cleanup(xmldoc)
165
- super
166
- r = xmldoc.at(NORM_REF) || return
167
- title = r.at("./title") and
168
- title.content = "References"
169
- end
164
+ def normref_cleanup(xmldoc)
165
+ super
166
+ r = xmldoc.at(NORM_REF) || return
167
+ title = r.at("./title") and
168
+ title.content = "References"
170
169
  end
171
170
  end
172
171
  end
172
+ end
@@ -53,21 +53,12 @@ module Asciidoctor
53
53
  end.join("\n")
54
54
  end
55
55
 
56
- def document(node)
57
- init(node)
58
- ret1 = makexml(node)
59
- ret = ret1.to_xml(indent: 2)
60
- unless node.attr("nodoc") || !node.attr("docfile")
61
- filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
62
- gsub(%r{^.*/}, "")
63
- File.open(filename, "w") { |f| f.write(ret) }
64
- html_converter(node).convert filename unless node.attr("nodoc")
65
- word_converter(node).convert filename unless node.attr("nodoc")
66
- pdf_converter(node).convert filename unless node.attr("nodoc")
67
- end
68
- @log.write(@localdir + @filename + ".err") unless @novalid
69
- @files_to_delete.each { |f| FileUtils.rm f }
70
- ret
56
+ def outputs(node, ret)
57
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
58
+ presentation_xml_converter(node).convert(@filename + ".xml")
59
+ html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
60
+ doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
61
+ pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
71
62
  end
72
63
 
73
64
  def validate(doc)
@@ -137,7 +128,7 @@ module Asciidoctor
137
128
  super
138
129
  end
139
130
 
140
- def metadata_keywords(node, xml)
131
+ def metadata_keywords(node, xml)
141
132
  return unless node.attr("keywords")
142
133
  node.attr("keywords").split(/,[ ]*/).sort.each_with_index do |kw, i|
143
134
  xml.keyword (i == 0 ? kw.capitalize : kw)
@@ -152,6 +143,10 @@ module Asciidoctor
152
143
  super.merge(hierarchical_assets: node.attr("hierarchical-object-numbering"))
153
144
  end
154
145
 
146
+ def presentation_xml_converter(node)
147
+ IsoDoc::ITU::PresentationXMLConvert.new(html_extract_attributes(node))
148
+ end
149
+
155
150
  def html_converter(node)
156
151
  IsoDoc::ITU::HtmlConvert.new(html_extract_attributes(node))
157
152
  end
@@ -160,7 +155,7 @@ module Asciidoctor
160
155
  IsoDoc::ITU::PdfConvert.new(html_extract_attributes(node))
161
156
  end
162
157
 
163
- def word_converter(node)
158
+ def doc_converter(node)
164
159
  IsoDoc::ITU::WordConvert.new(doc_extract_attributes(node))
165
160
  end
166
161
  end
@@ -3,6 +3,7 @@ require "isodoc/itu/base_convert"
3
3
  require "isodoc/itu/html_convert"
4
4
  require "isodoc/itu/pdf_convert"
5
5
  require "isodoc/itu/word_convert"
6
+ require "isodoc/itu/presentation_xml_convert"
6
7
 
7
8
  module IsoDoc
8
9
  module ITU
@@ -22,6 +22,11 @@ module IsoDoc
22
22
  @meta = Metadata.new(lang, script, labels)
23
23
  end
24
24
 
25
+ def xref_init(lang, script, klass, labels, options)
26
+ @xrefs = Xref.new(lang, script, klass, labels,
27
+ options.merge(hierarchical_assets: @hierarchical_assets))
28
+ end
29
+
25
30
  FRONT_CLAUSE = "//*[parent::preface]"\
26
31
  "[not(local-name() = 'abstract')]".freeze
27
32
 
@@ -48,14 +53,14 @@ module IsoDoc
48
53
  end
49
54
 
50
55
  def note_label(node)
51
- n = get_anchors[node["id"]]
56
+ n = @xrefs.get[node["id"]]
52
57
  (n.nil? || n[:label].nil? || n[:label].empty?) and
53
58
  return "#{@note_lbl} &ndash; "
54
59
  l10n("#{@note_lbl} #{n[:label]} &ndash; ")
55
60
  end
56
61
 
57
62
  def prefix_container(container, linkend, _target)
58
- l10n("#{linkend} #{@labels["in"]} #{anchor(container, :xref)}")
63
+ l10n("#{linkend} #{@labels["in"]} #{@xrefs.anchor(container, :xref)}")
59
64
  end
60
65
 
61
66
  def ol_depth(node)
@@ -73,7 +78,7 @@ module IsoDoc
73
78
  def annex_name(annex, name, div)
74
79
  r_a = @meta.get[:doctype_original] == "recommendation-annex"
75
80
  div.h1 **{ class: r_a ? "RecommendationAnnex" : "Annex" } do |t|
76
- t << "#{anchor(annex['id'], :label)} "
81
+ t << "#{@xrefs.anchor(annex['id'], :label)} "
77
82
  t.br
78
83
  t.br
79
84
  t.b do |b|
@@ -26,8 +26,9 @@
26
26
  </xsl:call-template>
27
27
  </xsl:variable>
28
28
  <xsl:variable name="doctype">
29
- <xsl:value-of select="translate(substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,1,1),$lower,$upper)"/>
30
- <xsl:value-of select="substring(/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype,2)"/>
29
+ <xsl:call-template name="capitalize">
30
+ <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype"/>
31
+ </xsl:call-template>
31
32
  </xsl:variable>
32
33
 
33
34
 
@@ -119,35 +120,7 @@
119
120
  </fo:page-sequence-master>
120
121
  </fo:layout-master-set>
121
122
 
122
- <fo:declarations>
123
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
124
- <pdf:dictionary type="normal" key="ViewerPreferences">
125
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
126
- </pdf:dictionary>
127
- </pdf:catalog>
128
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
129
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
130
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
131
- <!-- Dublin Core properties go here -->
132
- <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/> </dc:title>
133
- <dc:creator><xsl:value-of select="/itu:iso-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/></dc:creator>
134
- <dc:description>
135
- <xsl:variable name="abstract">
136
- <xsl:copy-of select="/itu:itu-standard/itu:bibdata/itu:abstract//text()"/>
137
- </xsl:variable>
138
- <xsl:value-of select="normalize-space($abstract)"/>
139
- </dc:description>
140
- <pdf:Keywords>
141
- <xsl:call-template name="insertKeywords"/>
142
- </pdf:Keywords>
143
- </rdf:Description>
144
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
145
- <!-- XMP properties go here -->
146
- <xmp:CreatorTool/>
147
- </rdf:Description>
148
- </rdf:RDF>
149
- </x:xmpmeta>
150
- </fo:declarations>
123
+ <xsl:call-template name="addPDFUAmeta"/>
151
124
 
152
125
  <!-- cover page -->
153
126
  <fo:page-sequence master-reference="cover-page">
@@ -217,7 +190,12 @@
217
190
  <fo:table-cell text-align="right">
218
191
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
219
192
  <fo:block font-size="18pt" font-weight="bold">
220
- <xsl:text>Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
193
+ <xsl:variable name="title-annex">
194
+ <xsl:call-template name="getTitle">
195
+ <xsl:with-param name="name" select="'title-annex'"/>
196
+ </xsl:call-template>
197
+ </xsl:variable>
198
+ <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
221
199
  </fo:block>
222
200
  </xsl:if>
223
201
  <fo:block font-size="14pt">
@@ -304,7 +282,12 @@
304
282
  <xsl:text>  </xsl:text>
305
283
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
306
284
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
307
- <xsl:text> — Annex </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
285
+ <xsl:variable name="title-annex">
286
+ <xsl:call-template name="getTitle">
287
+ <xsl:with-param name="name" select="'title-annex'"/>
288
+ </xsl:call-template>
289
+ </xsl:variable>
290
+ <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
308
291
  </xsl:if>
309
292
  </fo:block>
310
293
  </fo:table-cell>
@@ -339,6 +322,11 @@
339
322
  <xsl:value-of select="$linebreak"/>
340
323
  </fo:block>
341
324
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
325
+ <xsl:variable name="title-keywords">
326
+ <xsl:call-template name="getTitle">
327
+ <xsl:with-param name="name" select="'title-keywords'"/>
328
+ </xsl:call-template>
329
+ </xsl:variable>
342
330
  <xsl:value-of select="$title-keywords"/>
343
331
  </fo:block>
344
332
  <fo:block>
@@ -365,6 +353,16 @@
365
353
  <xsl:if test="xalan:nodeset($contents)//item">
366
354
  <fo:block break-after="page"/>
367
355
  <fo:block-container>
356
+ <xsl:variable name="title-toc">
357
+ <xsl:call-template name="getTitle">
358
+ <xsl:with-param name="name" select="'title-toc'"/>
359
+ </xsl:call-template>
360
+ </xsl:variable>
361
+ <xsl:variable name="title-page">
362
+ <xsl:call-template name="getTitle">
363
+ <xsl:with-param name="name" select="'title-page'"/>
364
+ </xsl:call-template>
365
+ </xsl:variable>
368
366
  <fo:block margin-top="6pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
369
367
  <fo:block margin-top="6pt" text-align="right" font-weight="bold"><xsl:value-of select="$title-page"/></fo:block>
370
368
 
@@ -611,15 +609,16 @@
611
609
  <xsl:template match="itu:figure" mode="contents">
612
610
  <xsl:param name="sectionNum"/>
613
611
  <item level="" id="{@id}" display="false" type="figure">
612
+ <xsl:variable name="title-figure">
613
+ <xsl:call-template name="getTitle">
614
+ <xsl:with-param name="name" select="'title-figure'"/>
615
+ </xsl:call-template>
616
+ </xsl:variable>
614
617
  <xsl:variable name="title" select="$title-figure"/>
615
618
  <xsl:attribute name="section">
616
619
  <xsl:call-template name="getSection">
617
620
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
618
- </xsl:call-template>
619
- <!-- <xsl:text>Figure </xsl:text>
620
- <xsl:call-template name="getItemNumber">
621
- <xsl:with-param name="brackets" select="'false'"/>
622
- </xsl:call-template> -->
621
+ </xsl:call-template>
623
622
  </xsl:attribute>
624
623
  <xsl:attribute name="topsection">
625
624
  <xsl:call-template name="getTopSection">
@@ -639,13 +638,16 @@
639
638
  <xsl:template match="itu:table" mode="contents">
640
639
  <xsl:param name="sectionNum"/>
641
640
  <item level="" id="{@id}" display="false" type="table">
641
+ <xsl:variable name="title-table">
642
+ <xsl:call-template name="getTitle">
643
+ <xsl:with-param name="name" select="'title-table'"/>
644
+ </xsl:call-template>
645
+ </xsl:variable>
642
646
  <xsl:variable name="title" select="$title-table"/>
643
647
  <xsl:attribute name="section">
644
648
  <xsl:call-template name="getSection">
645
649
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
646
- </xsl:call-template>
647
- <!-- <xsl:text>Table </xsl:text>
648
- <xsl:call-template name="getItemNumber"/> -->
650
+ </xsl:call-template>
649
651
  </xsl:attribute>
650
652
  <xsl:attribute name="topsection">
651
653
  <xsl:call-template name="getTopSection">
@@ -666,6 +668,16 @@
666
668
  <xsl:template match="itu:formula" mode="contents">
667
669
  <xsl:param name="sectionNum"/>
668
670
  <item level="" id="{@id}" display="false" type="formula">
671
+ <xsl:variable name="title-inequality">
672
+ <xsl:call-template name="getTitle">
673
+ <xsl:with-param name="name" select="'title-inequality'"/>
674
+ </xsl:call-template>
675
+ </xsl:variable>
676
+ <xsl:variable name="title-equation">
677
+ <xsl:call-template name="getTitle">
678
+ <xsl:with-param name="name" select="'title-equation'"/>
679
+ </xsl:call-template>
680
+ </xsl:variable>
669
681
  <xsl:variable name="title">
670
682
  <xsl:choose>
671
683
  <xsl:when test="@inequality = 'true'"><xsl:value-of select="$title-inequality"/></xsl:when>
@@ -682,6 +694,11 @@
682
694
  </xsl:attribute>
683
695
  <xsl:variable name="parent-element" select="local-name(..)"/>
684
696
  <xsl:attribute name="parent">
697
+ <xsl:variable name="title-clause">
698
+ <xsl:call-template name="getTitle">
699
+ <xsl:with-param name="name" select="'title-clause'"/>
700
+ </xsl:call-template>
701
+ </xsl:variable>
685
702
  <xsl:choose>
686
703
  <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
687
704
  <xsl:otherwise/>
@@ -795,6 +812,11 @@
795
812
  <xsl:variable name="parent-element" select="local-name(..)"/>
796
813
  <item level="" id="{@id}" display="false" type="example" section="{$section}">
797
814
  <xsl:attribute name="parent">
815
+ <xsl:variable name="title-clause">
816
+ <xsl:call-template name="getTitle">
817
+ <xsl:with-param name="name" select="'title-clause'"/>
818
+ </xsl:call-template>
819
+ </xsl:variable>
798
820
  <xsl:choose>
799
821
  <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
800
822
  <xsl:otherwise/>
@@ -937,8 +959,13 @@
937
959
  <xsl:value-of select="$linebreak"/>
938
960
  <xsl:value-of select="$linebreak"/>
939
961
  </fo:block>
940
- <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
941
- <xsl:text>Summary</xsl:text>
962
+ <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
963
+ <xsl:variable name="title-summary">
964
+ <xsl:call-template name="getTitle">
965
+ <xsl:with-param name="name" select="'title-summary'"/>
966
+ </xsl:call-template>
967
+ </xsl:variable>
968
+ <xsl:value-of select="$title-summary"/>
942
969
  </fo:block>
943
970
  <xsl:apply-templates/>
944
971
  </xsl:template>
@@ -995,7 +1022,12 @@
995
1022
  <fo:block font-size="11pt" space-before="4pt" text-align="justify">
996
1023
  <xsl:if test="ancestor::itu:figure">
997
1024
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
998
- </xsl:if>
1025
+ </xsl:if>
1026
+ <xsl:variable name="title-note">
1027
+ <xsl:call-template name="getTitle">
1028
+ <xsl:with-param name="name" select="'title-note'"/>
1029
+ </xsl:call-template>
1030
+ </xsl:variable>
999
1031
  <xsl:value-of select="$title-note"/>
1000
1032
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1001
1033
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
@@ -1231,12 +1263,20 @@
1231
1263
  </fo:block>
1232
1264
  </xsl:template>
1233
1265
 
1266
+ <xsl:template match="itu:term">
1267
+ <xsl:param name="sectionNum"/>
1268
+ <fo:block id="{@id}">
1269
+ <xsl:apply-templates>
1270
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1271
+ </xsl:apply-templates>
1272
+ </fo:block>
1273
+ </xsl:template>
1234
1274
 
1235
1275
  <xsl:template match="itu:preferred">
1236
1276
  <xsl:param name="sectionNum"/>
1237
1277
  <!-- DEBUG need -->
1238
1278
  <fo:block space-before="6pt" text-align="justify">
1239
- <fo:inline id="{../@id}" padding-right="5mm" font-weight="bold">
1279
+ <fo:inline padding-right="5mm" font-weight="bold">
1240
1280
  <!-- <xsl:value-of select="$sectionNum"/><xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term"/> -->
1241
1281
  <xsl:variable name="level">
1242
1282
  <xsl:call-template name="getLevel"/>
@@ -1263,7 +1303,7 @@
1263
1303
  <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
1264
1304
  <xsl:choose>
1265
1305
  <xsl:when test="contains($citeas, '[')">
1266
- <xsl:text> </xsl:text><xsl:value-of select="$citeas" disable-output-escaping="yes"/>
1306
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1267
1307
  </xsl:when>
1268
1308
  <xsl:otherwise>
1269
1309
  <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
@@ -1386,6 +1426,11 @@
1386
1426
  <xsl:choose>
1387
1427
  <xsl:when test="local-name(*) = 'figure' and normalize-space(itu:name) = ''"/><!-- don't show 'Figure' for outer figure without name -->
1388
1428
  <xsl:when test="$itemnumber != ''">
1429
+ <xsl:variable name="title-figure">
1430
+ <xsl:call-template name="getTitle">
1431
+ <xsl:with-param name="name" select="'title-figure'"/>
1432
+ </xsl:call-template>
1433
+ </xsl:variable>
1389
1434
  <xsl:value-of select="$title-figure"/>
1390
1435
  <xsl:value-of select="$itemnumber"/>
1391
1436
  </xsl:when>
@@ -1467,6 +1512,11 @@
1467
1512
  <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process">
1468
1513
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
1469
1514
  <fo:block font-size="11pt" margin-top="4pt">
1515
+ <xsl:variable name="title-note">
1516
+ <xsl:call-template name="getTitle">
1517
+ <xsl:with-param name="name" select="'title-note'"/>
1518
+ </xsl:call-template>
1519
+ </xsl:variable>
1470
1520
  <xsl:value-of select="$title-note"/>
1471
1521
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1472
1522
  <xsl:if test="count(//itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]) &gt; 1">
@@ -1532,6 +1582,11 @@
1532
1582
 
1533
1583
  <xsl:template match="itu:termnote">
1534
1584
  <fo:block id="{@id}" margin-top="4pt">
1585
+ <xsl:variable name="title-note">
1586
+ <xsl:call-template name="getTitle">
1587
+ <xsl:with-param name="name" select="'title-note'"/>
1588
+ </xsl:call-template>
1589
+ </xsl:variable>
1535
1590
  <xsl:value-of select="$title-note"/>
1536
1591
  <xsl:if test="following-sibling::itu:termnote or preceding-sibling::itu:termnote">
1537
1592
  <xsl:number/><xsl:text> </xsl:text>
@@ -1634,10 +1689,22 @@
1634
1689
  <fo:basic-link internal-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1635
1690
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1636
1691
  <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =current()/@target]/@level"/>
1692
+
1693
+ <xsl:variable name="title-clause">
1694
+ <xsl:call-template name="getTitle">
1695
+ <xsl:with-param name="name" select="'title-clause'"/>
1696
+ </xsl:call-template>
1697
+ </xsl:variable>
1698
+ <xsl:variable name="title-example-xref">
1699
+ <xsl:call-template name="getTitle">
1700
+ <xsl:with-param name="name" select="'title-example-xref'"/>
1701
+ </xsl:call-template>
1702
+ </xsl:variable>
1703
+
1637
1704
  <xsl:choose>
1638
1705
  <xsl:when test="($type = 'clause' or $type = 'term') and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1639
- <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1640
- <xsl:when test="$type = 'example'">Example </xsl:when>
1706
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1707
+ <xsl:when test="$type = 'example'"><xsl:value-of select="$title-example-xref"/></xsl:when>
1641
1708
  <xsl:when test="$type = 'figure'"/>
1642
1709
  <xsl:when test="$type = 'formula'"/>
1643
1710
  <xsl:when test="$type = 'table'"/>
@@ -1646,13 +1713,20 @@
1646
1713
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1647
1714
  </xsl:choose>
1648
1715
 
1716
+ <xsl:variable name="title-in">
1717
+ <xsl:call-template name="getTitle">
1718
+ <xsl:with-param name="name" select="'title-in'"/>
1719
+ </xsl:call-template>
1720
+ </xsl:variable>
1721
+
1649
1722
  <xsl:choose>
1650
1723
  <xsl:when test="$type = 'example'">
1651
1724
  <xsl:variable name="currentSection">
1652
1725
  <xsl:call-template name="getSection"/>
1653
1726
  </xsl:variable>
1654
- <xsl:if test="not(contains($section, $currentSection))">
1655
- <xsl:text>in </xsl:text>
1727
+ <xsl:if test="not(contains($section, $currentSection))">
1728
+
1729
+ <xsl:value-of select="$title-in"/>
1656
1730
  <xsl:if test="$level = 1">
1657
1731
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1658
1732
  <xsl:text> </xsl:text>
@@ -1673,7 +1747,8 @@
1673
1747
 
1674
1748
  <xsl:if test="not(contains($section, $currentSection))"> -->
1675
1749
  <xsl:if test="$topsection != $xreftopsection">
1676
- <xsl:text> in </xsl:text>
1750
+ <xsl:text> </xsl:text>
1751
+ <xsl:value-of select="$title-in"/>
1677
1752
  <xsl:if test="$level = 1">
1678
1753
  <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1679
1754
  <xsl:text> </xsl:text>
@@ -1691,10 +1766,11 @@
1691
1766
  <xsl:call-template name="getSection"/>
1692
1767
  </xsl:variable>
1693
1768
  <xsl:if test="not(contains($section, $currentSection))">
1694
- <xsl:text> in </xsl:text>
1769
+ <xsl:text> </xsl:text>
1770
+ <xsl:value-of select="$title-in"/>
1695
1771
  <xsl:choose>
1696
1772
  <xsl:when test="$level = 1"><xsl:value-of select="$title-clause"/></xsl:when>
1697
- <xsl:when test="$level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1773
+ <xsl:when test="$level &gt; 1"><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-clause))"/></xsl:when>
1698
1774
  </xsl:choose>
1699
1775
  <xsl:value-of select="$section"/>
1700
1776
  </xsl:if>
@@ -1737,6 +1813,11 @@
1737
1813
 
1738
1814
  <xsl:template match="itu:example/itu:name">
1739
1815
  <fo:block font-weight="bold">
1816
+ <xsl:variable name="title-example">
1817
+ <xsl:call-template name="getTitle">
1818
+ <xsl:with-param name="name" select="'title-example'"/>
1819
+ </xsl:call-template>
1820
+ </xsl:variable>
1740
1821
  <xsl:value-of select="normalize-space($title-example)"/>
1741
1822
  <xsl:if test="count(ancestor::itu:clause[1]/itu:example) &gt; 1">
1742
1823
  <xsl:text> </xsl:text><xsl:number count="itu:example"/>
@@ -1764,10 +1845,10 @@
1764
1845
  <fo:basic-link internal-destination="{@bibitemid}" color="blue" text-decoration="underline" fox:alt-text="{@citeas}">
1765
1846
  <xsl:choose>
1766
1847
  <xsl:when test="contains(@citeas, '[')">
1767
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1848
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1768
1849
  </xsl:when>
1769
1850
  <xsl:otherwise>
1770
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1851
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1771
1852
  </xsl:otherwise>
1772
1853
  </xsl:choose>
1773
1854
 
@@ -1778,8 +1859,13 @@
1778
1859
  </xsl:template>
1779
1860
 
1780
1861
  <xsl:template match="itu:locality">
1862
+ <xsl:variable name="title-section">
1863
+ <xsl:call-template name="getTitle">
1864
+ <xsl:with-param name="name" select="'title-section'"/>
1865
+ </xsl:call-template>
1866
+ </xsl:variable>
1781
1867
  <xsl:choose>
1782
- <xsl:when test="@type ='section'">Section</xsl:when>
1868
+ <xsl:when test="@type ='section'"><xsl:value-of select="normalize-space($title-section)"/></xsl:when>
1783
1869
  <xsl:otherwise/>
1784
1870
  </xsl:choose>
1785
1871
  <xsl:value-of select="itu:referenceFrom"/>
@@ -1809,7 +1895,7 @@
1809
1895
 
1810
1896
  <xsl:template match="itu:source">
1811
1897
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1812
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1898
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1813
1899
  <xsl:apply-templates select="itu:localityStack"/>
1814
1900
  </fo:basic-link>
1815
1901
  </xsl:template>
@@ -2335,24 +2421,6 @@
2335
2421
  </xsl:if>
2336
2422
  </xsl:template>
2337
2423
 
2338
- <xsl:template name="getLevel">
2339
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2340
- <xsl:variable name="level">
2341
- <xsl:choose>
2342
- <xsl:when test="ancestor::itu:sections">
2343
- <xsl:value-of select="$level_total - 2"/>
2344
- </xsl:when>
2345
- <xsl:when test="ancestor::itu:bibliography">
2346
- <xsl:value-of select="$level_total - 2"/>
2347
- </xsl:when>
2348
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2349
- <xsl:otherwise>
2350
- <xsl:value-of select="$level_total - 1"/>
2351
- </xsl:otherwise>
2352
- </xsl:choose>
2353
- </xsl:variable>
2354
- <xsl:value-of select="$level"/>
2355
- </xsl:template>
2356
2424
 
2357
2425
  <xsl:template name="getSection">
2358
2426
  <xsl:param name="sectionNum"/>
@@ -2372,7 +2440,7 @@
2372
2440
  </xsl:when>
2373
2441
  <xsl:when test="$level &gt;= 2">
2374
2442
  <xsl:variable name="num">
2375
- <xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term | itu:clause/itu:term | itu:clause/itu:definitions"/>
2443
+ <xsl:call-template name="getSubSection"/>
2376
2444
  </xsl:variable>
2377
2445
  <!-- <xsl:variable name="sectionNum_">
2378
2446
  <xsl:choose>
@@ -2392,6 +2460,11 @@
2392
2460
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2393
2461
  <xsl:choose>
2394
2462
  <xsl:when test="$level = 1">
2463
+ <xsl:variable name="title-appendix">
2464
+ <xsl:call-template name="getTitle">
2465
+ <xsl:with-param name="name" select="'title-appendix'"/>
2466
+ </xsl:call-template>
2467
+ </xsl:variable>
2395
2468
  <xsl:value-of select="$title-appendix"/><xsl:text> </xsl:text>
2396
2469
  <xsl:number format="I" level="any" count="itu:annex[@obligation = 'informative']"/>
2397
2470
  </xsl:when>
@@ -2403,6 +2476,11 @@
2403
2476
  <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2404
2477
  <xsl:choose>
2405
2478
  <xsl:when test="$level = 1">
2479
+ <xsl:variable name="title-annex">
2480
+ <xsl:call-template name="getTitle">
2481
+ <xsl:with-param name="name" select="'title-annex'"/>
2482
+ </xsl:call-template>
2483
+ </xsl:variable>
2406
2484
  <xsl:value-of select="$title-annex"/>
2407
2485
  <xsl:choose>
2408
2486
  <xsl:when test="count(//itu:annex) = 1">
@@ -2450,17 +2528,6 @@
2450
2528
  </xsl:if>
2451
2529
  </xsl:template>
2452
2530
 
2453
- <xsl:template name="getId">
2454
- <xsl:choose>
2455
- <xsl:when test="../@id">
2456
- <xsl:value-of select="../@id"/>
2457
- </xsl:when>
2458
- <xsl:otherwise>
2459
- <xsl:value-of select="concat(local-name(..), '_', text())"/>
2460
- </xsl:otherwise>
2461
- </xsl:choose>
2462
- </xsl:template>
2463
-
2464
2531
  <xsl:template name="getTopSection">
2465
2532
  <xsl:param name="sectionNum"/>
2466
2533
  <xsl:variable name="section">
@@ -2479,44 +2546,185 @@
2479
2546
  </xsl:choose>
2480
2547
  </xsl:template>
2481
2548
 
2482
- <xsl:variable name="title-table">
2549
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2483
2550
 
2484
- <xsl:text>Table </xsl:text>
2551
+ <title-table lang="en">Table </title-table>
2552
+ <title-table lang="fr">Tableau </title-table>
2553
+
2554
+ <title-table lang="zh">Table </title-table>
2485
2555
 
2486
2556
 
2487
- </xsl:variable><xsl:variable name="title-note">
2557
+
2558
+ <title-note lang="en">NOTE </title-note>
2559
+ <title-note lang="fr">NOTE </title-note>
2488
2560
 
2489
- <xsl:text>NOTE </xsl:text>
2561
+ <title-note lang="zh">NOTE </title-note>
2490
2562
 
2491
2563
 
2492
- </xsl:variable><xsl:variable name="title-figure">
2493
2564
 
2494
- <xsl:text>Figure </xsl:text>
2565
+ <title-figure lang="en">Figure </title-figure>
2566
+ <title-figure lang="fr">Figure </title-figure>
2495
2567
 
2568
+ <title-figure lang="zh">Figure </title-figure>
2496
2569
 
2497
- </xsl:variable><xsl:variable name="title-example">
2498
2570
 
2499
- <xsl:text>EXAMPLE </xsl:text>
2500
2571
 
2572
+ <title-example lang="en">EXAMPLE </title-example>
2573
+ <title-example lang="fr">EXEMPLE </title-example>
2501
2574
 
2502
- </xsl:variable><xsl:variable name="title-inequality">Inequality </xsl:variable><xsl:variable name="title-equation">Equation </xsl:variable><xsl:variable name="title-annex">
2575
+ <title-example lang="zh">EXAMPLE </title-example>
2503
2576
 
2504
- <xsl:text>Annex </xsl:text>
2505
2577
 
2506
2578
 
2507
- </xsl:variable><xsl:variable name="title-appendix">
2508
- <xsl:text>Appendix </xsl:text>
2509
- </xsl:variable><xsl:variable name="title-clause">
2579
+ <title-example-xref lang="en">Example </title-example-xref>
2580
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2581
+
2582
+ <title-section lang="en">Section </title-section>
2583
+ <title-section lang="fr">Section </title-section>
2510
2584
 
2511
- <xsl:text>Clause </xsl:text>
2585
+ <title-inequality lang="en">Inequality </title-inequality>
2586
+ <title-inequality lang="fr">Inequality </title-inequality>
2512
2587
 
2588
+ <title-equation lang="en">Equation </title-equation>
2589
+ <title-equation lang="fr">Equation </title-equation>
2590
+
2591
+ <title-annex lang="en">Annex </title-annex>
2592
+ <title-annex lang="fr">Annexe </title-annex>
2593
+
2594
+ <title-annex lang="zh">Annex </title-annex>
2513
2595
 
2514
- </xsl:variable><xsl:variable name="title-edition">
2515
- <xsl:text>Edition </xsl:text>
2516
- </xsl:variable><xsl:variable name="title-toc">
2517
2596
 
2518
- Table of Contents
2519
- </xsl:variable><xsl:variable name="title-page">Page</xsl:variable><xsl:variable name="title-key">Key</xsl:variable><xsl:variable name="title-where">where</xsl:variable><xsl:variable name="title-descriptors">Descriptors</xsl:variable><xsl:variable name="title-part-en">Part </xsl:variable><xsl:variable name="title-part-fr">Partie </xsl:variable><xsl:variable name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable name="title-modified">modified</xsl:variable><xsl:variable name="title-source">SOURCE</xsl:variable><xsl:variable name="title-keywords">Keywords</xsl:variable><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">
2597
+
2598
+ <title-appendix lang="en">Appendix </title-appendix>
2599
+ <title-appendix lang="fr">Appendix </title-appendix>
2600
+
2601
+ <title-clause lang="en">Clause </title-clause>
2602
+ <title-clause lang="fr">Article </title-clause>
2603
+
2604
+ <title-clause lang="zh">Clause </title-clause>
2605
+
2606
+
2607
+
2608
+ <title-edition lang="en">
2609
+
2610
+ <xsl:text>Edition </xsl:text>
2611
+
2612
+
2613
+ </title-edition>
2614
+
2615
+ <title-formula lang="en">Formula </title-formula>
2616
+ <title-formula lang="fr">Formula </title-formula>
2617
+
2618
+ <title-toc lang="en">
2619
+
2620
+
2621
+ <xsl:text>Table of Contents</xsl:text>
2622
+
2623
+
2624
+ </title-toc>
2625
+ <title-toc lang="fr">Sommaire</title-toc>
2626
+
2627
+ <title-toc lang="zh">Contents</title-toc>
2628
+
2629
+
2630
+
2631
+ <title-page lang="en">Page</title-page>
2632
+ <title-page lang="fr">Page</title-page>
2633
+
2634
+ <title-key lang="en">Key</title-key>
2635
+ <title-key lang="fr">Légende</title-key>
2636
+
2637
+ <title-where lang="en">where</title-where>
2638
+ <title-where lang="fr">où</title-where>
2639
+
2640
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2641
+
2642
+ <title-part lang="en">
2643
+
2644
+
2645
+ </title-part>
2646
+ <title-part lang="fr">
2647
+
2648
+
2649
+ </title-part>
2650
+ <title-part lang="zh">第 # 部分:</title-part>
2651
+
2652
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2653
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2654
+
2655
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2656
+
2657
+
2658
+
2659
+ <title-modified lang="en">modified</title-modified>
2660
+ <title-modified lang="fr">modifiée</title-modified>
2661
+
2662
+ <title-modified lang="zh">modified</title-modified>
2663
+
2664
+
2665
+
2666
+ <title-source lang="en">SOURCE</title-source>
2667
+
2668
+ <title-keywords lang="en">Keywords</title-keywords>
2669
+
2670
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2671
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2672
+
2673
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2674
+
2675
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2676
+
2677
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2678
+
2679
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2680
+
2681
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2682
+
2683
+ <title-abstract lang="en">Abstract</title-abstract>
2684
+
2685
+ <title-summary lang="en">Summary</title-summary>
2686
+
2687
+ <title-in lang="en">in </title-in>
2688
+
2689
+ <title-box lang="en">Box </title-box>
2690
+
2691
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2692
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2693
+
2694
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2695
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2696
+
2697
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2698
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2699
+
2700
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2701
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2702
+
2703
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2704
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2705
+
2706
+ <title-caution lang="en">CAUTION</title-caution>
2707
+ <title-caution lang="zh">注意</title-caution>
2708
+
2709
+ <title-warning lang="en">WARNING</title-warning>
2710
+ <title-warning lang="zh">警告</title-warning>
2711
+
2712
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2713
+ </xsl:variable><xsl:template name="getTitle">
2714
+ <xsl:param name="name"/>
2715
+ <xsl:variable name="lang">
2716
+ <xsl:call-template name="getLang"/>
2717
+ </xsl:variable>
2718
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2719
+ <xsl:choose>
2720
+ <xsl:when test="normalize-space($title_) != ''">
2721
+ <xsl:value-of select="$title_"/>
2722
+ </xsl:when>
2723
+ <xsl:otherwise>
2724
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2725
+ </xsl:otherwise>
2726
+ </xsl:choose>
2727
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2520
2728
 
2521
2729
 
2522
2730
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
@@ -2583,7 +2791,11 @@
2583
2791
 
2584
2792
 
2585
2793
 
2586
-
2794
+ <xsl:variable name="title-table">
2795
+ <xsl:call-template name="getTitle">
2796
+ <xsl:with-param name="name" select="'title-table'"/>
2797
+ </xsl:call-template>
2798
+ </xsl:variable>
2587
2799
  <xsl:value-of select="$title-table"/>
2588
2800
 
2589
2801
  <xsl:call-template name="getTableNumber"/>
@@ -2692,7 +2904,16 @@
2692
2904
  </xsl:otherwise>
2693
2905
  </xsl:choose>
2694
2906
  </xsl:for-each>
2695
- <xsl:apply-templates/>
2907
+
2908
+ <xsl:choose>
2909
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2910
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2911
+ </xsl:when>
2912
+ <xsl:otherwise>
2913
+ <xsl:apply-templates/>
2914
+ </xsl:otherwise>
2915
+ </xsl:choose>
2916
+
2696
2917
  </fo:table>
2697
2918
 
2698
2919
 
@@ -2856,6 +3077,10 @@
2856
3077
 
2857
3078
  <xsl:apply-templates/>
2858
3079
  </fo:table-header>
3080
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3081
+ <fo:table-body>
3082
+ <xsl:apply-templates/>
3083
+ </fo:table-body>
2859
3084
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2860
3085
  <xsl:apply-templates/>
2861
3086
  </xsl:template><xsl:template name="insertTableFooter">
@@ -3034,6 +3259,11 @@
3034
3259
  <fo:inline padding-right="2mm">
3035
3260
 
3036
3261
 
3262
+ <xsl:variable name="title-note">
3263
+ <xsl:call-template name="getTitle">
3264
+ <xsl:with-param name="name" select="'title-note'"/>
3265
+ </xsl:call-template>
3266
+ </xsl:variable>
3037
3267
  <xsl:value-of select="$title-note"/>
3038
3268
 
3039
3269
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -3130,6 +3360,36 @@
3130
3360
  </fn>
3131
3361
  </xsl:for-each>
3132
3362
  </xsl:variable>
3363
+
3364
+ <!-- current hierarchy is 'figure' element -->
3365
+ <xsl:variable name="following_dl_colwidths">
3366
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3367
+ <xsl:variable name="html-table">
3368
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3369
+ <xsl:element name="{$ns}:table">
3370
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3371
+ <tbody>
3372
+ <xsl:apply-templates mode="dl"/>
3373
+ </tbody>
3374
+ </xsl:for-each>
3375
+ </xsl:element>
3376
+ </xsl:variable>
3377
+
3378
+ <xsl:call-template name="calculate-column-widths">
3379
+ <xsl:with-param name="cols-count" select="2"/>
3380
+ <xsl:with-param name="table" select="$html-table"/>
3381
+ </xsl:call-template>
3382
+
3383
+ </xsl:if>
3384
+ </xsl:variable>
3385
+
3386
+
3387
+ <xsl:variable name="maxlength_dt">
3388
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3389
+ <xsl:call-template name="getMaxLength_dt"/>
3390
+ </xsl:for-each>
3391
+ </xsl:variable>
3392
+
3133
3393
  <xsl:if test="xalan:nodeset($references)//fn">
3134
3394
  <fo:block>
3135
3395
  <fo:table width="95%" table-layout="fixed">
@@ -3137,8 +3397,19 @@
3137
3397
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3138
3398
 
3139
3399
  </xsl:if>
3140
- <fo:table-column column-width="15%"/>
3141
- <fo:table-column column-width="85%"/>
3400
+ <xsl:choose>
3401
+ <!-- if there 'dl', then set same columns width -->
3402
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3403
+ <xsl:call-template name="setColumnWidth_dl">
3404
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3405
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3406
+ </xsl:call-template>
3407
+ </xsl:when>
3408
+ <xsl:otherwise>
3409
+ <fo:table-column column-width="15%"/>
3410
+ <fo:table-column column-width="85%"/>
3411
+ </xsl:otherwise>
3412
+ </xsl:choose>
3142
3413
  <fo:table-body>
3143
3414
  <xsl:for-each select="xalan:nodeset($references)//fn">
3144
3415
  <xsl:variable name="reference" select="@reference"/>
@@ -3202,6 +3473,11 @@
3202
3473
 
3203
3474
  <fo:block margin-bottom="12pt" text-align="left">
3204
3475
 
3476
+ <xsl:variable name="title-where">
3477
+ <xsl:call-template name="getTitle">
3478
+ <xsl:with-param name="name" select="'title-where'"/>
3479
+ </xsl:call-template>
3480
+ </xsl:variable>
3205
3481
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3206
3482
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3207
3483
  <xsl:text/>
@@ -3217,14 +3493,24 @@
3217
3493
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3218
3494
 
3219
3495
 
3496
+ <xsl:variable name="title-where">
3497
+ <xsl:call-template name="getTitle">
3498
+ <xsl:with-param name="name" select="'title-where'"/>
3499
+ </xsl:call-template>
3500
+ </xsl:variable>
3220
3501
  <xsl:value-of select="$title-where"/>:
3221
3502
  </fo:block>
3222
3503
  </xsl:when>
3223
3504
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3224
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3505
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3225
3506
 
3226
3507
 
3227
3508
 
3509
+ <xsl:variable name="title-key">
3510
+ <xsl:call-template name="getTitle">
3511
+ <xsl:with-param name="name" select="'title-key'"/>
3512
+ </xsl:call-template>
3513
+ </xsl:variable>
3228
3514
  <xsl:value-of select="$title-key"/>
3229
3515
  </fo:block>
3230
3516
  </xsl:when>
@@ -3248,23 +3534,6 @@
3248
3534
 
3249
3535
 
3250
3536
 
3251
- <!-- create virtual html table for dl/[dt and dd] -->
3252
- <xsl:variable name="html-table">
3253
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3254
- <xsl:element name="{$ns}:table">
3255
- <tbody>
3256
- <xsl:apply-templates mode="dl"/>
3257
- </tbody>
3258
- </xsl:element>
3259
- </xsl:variable>
3260
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3261
- <xsl:variable name="colwidths">
3262
- <xsl:call-template name="calculate-column-widths">
3263
- <xsl:with-param name="cols-count" select="2"/>
3264
- <xsl:with-param name="table" select="$html-table"/>
3265
- </xsl:call-template>
3266
- </xsl:variable>
3267
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3268
3537
 
3269
3538
  <fo:table width="95%" table-layout="fixed">
3270
3539
 
@@ -3277,42 +3546,30 @@
3277
3546
 
3278
3547
  </xsl:when>
3279
3548
  </xsl:choose>
3280
- <xsl:choose>
3281
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3282
- <fo:table-column column-width="50%"/>
3283
- <fo:table-column column-width="50%"/>
3284
- </xsl:when>
3285
- <xsl:otherwise>
3286
- <xsl:choose>
3287
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3288
- <fo:table-column column-width="60%"/>
3289
- <fo:table-column column-width="40%"/>
3290
- </xsl:when> -->
3291
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3292
- <fo:table-column column-width="50%"/>
3293
- <fo:table-column column-width="50%"/>
3294
- </xsl:when>
3295
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3296
- <fo:table-column column-width="40%"/>
3297
- <fo:table-column column-width="60%"/>
3298
- </xsl:when>
3299
- <xsl:otherwise>
3300
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3301
- <xsl:choose>
3302
- <xsl:when test=". = 1 or . = 0">
3303
- <fo:table-column column-width="proportional-column-width(2)"/>
3304
- </xsl:when>
3305
- <xsl:otherwise>
3306
- <fo:table-column column-width="proportional-column-width({.})"/>
3307
- </xsl:otherwise>
3308
- </xsl:choose>
3309
- </xsl:for-each>
3310
- </xsl:otherwise>
3311
- </xsl:choose>
3312
- <!-- <fo:table-column column-width="15%"/>
3313
- <fo:table-column column-width="85%"/> -->
3314
- </xsl:otherwise>
3315
- </xsl:choose>
3549
+ <!-- create virtual html table for dl/[dt and dd] -->
3550
+ <xsl:variable name="html-table">
3551
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3552
+ <xsl:element name="{$ns}:table">
3553
+ <tbody>
3554
+ <xsl:apply-templates mode="dl"/>
3555
+ </tbody>
3556
+ </xsl:element>
3557
+ </xsl:variable>
3558
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3559
+ <xsl:variable name="colwidths">
3560
+ <xsl:call-template name="calculate-column-widths">
3561
+ <xsl:with-param name="cols-count" select="2"/>
3562
+ <xsl:with-param name="table" select="$html-table"/>
3563
+ </xsl:call-template>
3564
+ </xsl:variable>
3565
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3566
+ <xsl:variable name="maxlength_dt">
3567
+ <xsl:call-template name="getMaxLength_dt"/>
3568
+ </xsl:variable>
3569
+ <xsl:call-template name="setColumnWidth_dl">
3570
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3571
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3572
+ </xsl:call-template>
3316
3573
  <fo:table-body>
3317
3574
  <xsl:apply-templates>
3318
3575
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3322,6 +3579,60 @@
3322
3579
  </fo:block>
3323
3580
  </fo:block>
3324
3581
  </xsl:if>
3582
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3583
+ <xsl:param name="colwidths"/>
3584
+ <xsl:param name="maxlength_dt"/>
3585
+ <xsl:choose>
3586
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3587
+ <fo:table-column column-width="50%"/>
3588
+ <fo:table-column column-width="50%"/>
3589
+ </xsl:when>
3590
+ <xsl:otherwise>
3591
+ <xsl:choose>
3592
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3593
+ <fo:table-column column-width="5%"/>
3594
+ <fo:table-column column-width="95%"/>
3595
+ </xsl:when>
3596
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3597
+ <fo:table-column column-width="10%"/>
3598
+ <fo:table-column column-width="90%"/>
3599
+ </xsl:when>
3600
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3601
+ <fo:table-column column-width="60%"/>
3602
+ <fo:table-column column-width="40%"/>
3603
+ </xsl:when> -->
3604
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3605
+ <fo:table-column column-width="50%"/>
3606
+ <fo:table-column column-width="50%"/>
3607
+ </xsl:when>
3608
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3609
+ <fo:table-column column-width="40%"/>
3610
+ <fo:table-column column-width="60%"/>
3611
+ </xsl:when>
3612
+ <xsl:otherwise>
3613
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3614
+ <xsl:choose>
3615
+ <xsl:when test=". = 1 or . = 0">
3616
+ <fo:table-column column-width="proportional-column-width(2)"/>
3617
+ </xsl:when>
3618
+ <xsl:otherwise>
3619
+ <fo:table-column column-width="proportional-column-width({.})"/>
3620
+ </xsl:otherwise>
3621
+ </xsl:choose>
3622
+ </xsl:for-each>
3623
+ </xsl:otherwise>
3624
+ </xsl:choose>
3625
+ <!-- <fo:table-column column-width="15%"/>
3626
+ <fo:table-column column-width="85%"/> -->
3627
+ </xsl:otherwise>
3628
+ </xsl:choose>
3629
+ </xsl:template><xsl:template name="getMaxLength_dt">
3630
+ <xsl:for-each select="*[local-name()='dt']">
3631
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3632
+ <xsl:if test="position() = 1">
3633
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3634
+ </xsl:if>
3635
+ </xsl:for-each>
3325
3636
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3326
3637
  <xsl:param name="key_iso"/>
3327
3638
 
@@ -3338,6 +3649,11 @@
3338
3649
  <xsl:if test="normalize-space($key_iso) = 'true'">
3339
3650
  <xsl:attribute name="margin-top">0</xsl:attribute>
3340
3651
  </xsl:if>
3652
+ <xsl:variable name="title-note">
3653
+ <xsl:call-template name="getTitle">
3654
+ <xsl:with-param name="name" select="'title-note'"/>
3655
+ </xsl:call-template>
3656
+ </xsl:variable>
3341
3657
  <xsl:value-of select="$title-note"/>
3342
3658
  </fo:block>
3343
3659
  </fo:table-cell>
@@ -3387,7 +3703,11 @@
3387
3703
 
3388
3704
 
3389
3705
  <xsl:apply-templates/>
3390
-
3706
+ <!-- <xsl:if test="$namespace = 'gb'">
3707
+ <xsl:if test="ancestor::*[local-name()='formula']">
3708
+ <xsl:text>—</xsl:text>
3709
+ </xsl:if>
3710
+ </xsl:if> -->
3391
3711
  </fo:block>
3392
3712
  </fo:table-cell>
3393
3713
  <fo:table-cell>
@@ -3445,7 +3765,8 @@
3445
3765
  </xsl:template><xsl:template name="recursiveSmallCaps">
3446
3766
  <xsl:param name="text"/>
3447
3767
  <xsl:variable name="char" select="substring($text,1,1)"/>
3448
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3768
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3769
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3449
3770
  <xsl:choose>
3450
3771
  <xsl:when test="$char=$upperCase">
3451
3772
  <fo:inline font-size="{100 div 0.75}%">
@@ -3728,18 +4049,28 @@
3728
4049
  <xsl:choose>
3729
4050
  <xsl:when test="contains($str2, ' ')">
3730
4051
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3731
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3732
- <xsl:value-of select="substring($substr, 2)"/>
4052
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4053
+ <xsl:value-of select="substring($substr, 2)"/> -->
4054
+ <xsl:call-template name="capitalize">
4055
+ <xsl:with-param name="str" select="$substr"/>
4056
+ </xsl:call-template>
3733
4057
  <xsl:text> </xsl:text>
3734
4058
  <xsl:call-template name="capitalizeWords">
3735
4059
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3736
4060
  </xsl:call-template>
3737
4061
  </xsl:when>
3738
4062
  <xsl:otherwise>
3739
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3740
- <xsl:value-of select="substring($str2, 2)"/>
4063
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4064
+ <xsl:value-of select="substring($str2, 2)"/> -->
4065
+ <xsl:call-template name="capitalize">
4066
+ <xsl:with-param name="str" select="$str2"/>
4067
+ </xsl:call-template>
3741
4068
  </xsl:otherwise>
3742
4069
  </xsl:choose>
4070
+ </xsl:template><xsl:template name="capitalize">
4071
+ <xsl:param name="str"/>
4072
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4073
+ <xsl:value-of select="substring($str, 2)"/>
3743
4074
  </xsl:template><xsl:template match="mathml:math">
3744
4075
  <fo:inline font-family="STIX2Math">
3745
4076
  <fo:instream-foreign-object fox:alt-text="Math">
@@ -3797,6 +4128,11 @@
3797
4128
  <fo:inline id="{@id}"/>
3798
4129
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3799
4130
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4131
+ <xsl:variable name="title-appendix">
4132
+ <xsl:call-template name="getTitle">
4133
+ <xsl:with-param name="name" select="'title-appendix'"/>
4134
+ </xsl:call-template>
4135
+ </xsl:variable>
3800
4136
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3801
4137
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3802
4138
  </fo:block>
@@ -3806,6 +4142,11 @@
3806
4142
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3807
4143
  <fo:block xsl:use-attribute-sets="appendix-example-style">
3808
4144
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4145
+ <xsl:variable name="title-example">
4146
+ <xsl:call-template name="getTitle">
4147
+ <xsl:with-param name="name" select="'title-example'"/>
4148
+ </xsl:call-template>
4149
+ </xsl:variable>
3809
4150
  <xsl:value-of select="$title-example"/>
3810
4151
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3811
4152
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -3836,6 +4177,17 @@
3836
4177
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3837
4178
  <xsl:apply-templates/>
3838
4179
  </fo:inline>
4180
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4181
+ <xsl:variable name="title-modified">
4182
+ <xsl:call-template name="getTitle">
4183
+ <xsl:with-param name="name" select="'title-modified'"/>
4184
+ </xsl:call-template>
4185
+ </xsl:variable>
4186
+ <xsl:choose>
4187
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4188
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4189
+ </xsl:choose>
4190
+ <xsl:apply-templates/>
3839
4191
  </xsl:template><xsl:template name="convertDate">
3840
4192
  <xsl:param name="date"/>
3841
4193
  <xsl:param name="format" select="'short'"/>
@@ -3900,4 +4252,107 @@
3900
4252
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3901
4253
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3902
4254
  </xsl:choose>
4255
+ </xsl:template><xsl:template name="addPDFUAmeta">
4256
+ <fo:declarations>
4257
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4258
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4259
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4260
+ </pdf:dictionary>
4261
+ </pdf:catalog>
4262
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4263
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4264
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4265
+ <!-- Dublin Core properties go here -->
4266
+ <dc:title>
4267
+ <xsl:variable name="title">
4268
+
4269
+
4270
+
4271
+
4272
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@type='main']"/>
4273
+
4274
+ </xsl:variable>
4275
+ <xsl:choose>
4276
+ <xsl:when test="normalize-space($title) != ''">
4277
+ <xsl:value-of select="$title"/>
4278
+ </xsl:when>
4279
+ <xsl:otherwise>
4280
+ <xsl:text> </xsl:text>
4281
+ </xsl:otherwise>
4282
+ </xsl:choose>
4283
+ </dc:title>
4284
+ <dc:creator>
4285
+
4286
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4287
+
4288
+
4289
+ </dc:creator>
4290
+ <dc:description>
4291
+ <xsl:variable name="abstract">
4292
+
4293
+
4294
+
4295
+
4296
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4297
+
4298
+ </xsl:variable>
4299
+ <xsl:value-of select="normalize-space($abstract)"/>
4300
+ </dc:description>
4301
+ <pdf:Keywords>
4302
+ <xsl:call-template name="insertKeywords"/>
4303
+ </pdf:Keywords>
4304
+ </rdf:Description>
4305
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4306
+ <!-- XMP properties go here -->
4307
+ <xmp:CreatorTool/>
4308
+ </rdf:Description>
4309
+ </rdf:RDF>
4310
+ </x:xmpmeta>
4311
+ </fo:declarations>
4312
+ </xsl:template><xsl:template name="getId">
4313
+ <xsl:choose>
4314
+ <xsl:when test="../@id">
4315
+ <xsl:value-of select="../@id"/>
4316
+ </xsl:when>
4317
+ <xsl:otherwise>
4318
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4319
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4320
+ </xsl:otherwise>
4321
+ </xsl:choose>
4322
+ </xsl:template><xsl:template name="getLevel">
4323
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4324
+ <xsl:variable name="level">
4325
+ <xsl:choose>
4326
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4327
+ <xsl:value-of select="$level_total - 2"/>
4328
+ </xsl:when>
4329
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4330
+ <xsl:value-of select="$level_total - 2"/>
4331
+ </xsl:when>
4332
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4333
+ <xsl:value-of select="$level_total - 2"/>
4334
+ </xsl:when>
4335
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4336
+ <xsl:otherwise>
4337
+ <xsl:value-of select="$level_total - 1"/>
4338
+ </xsl:otherwise>
4339
+ </xsl:choose>
4340
+ </xsl:variable>
4341
+ <xsl:value-of select="$level"/>
4342
+ </xsl:template><xsl:template name="getSubSection">
4343
+ <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']"/>
4344
+ </xsl:template><xsl:template name="split">
4345
+ <xsl:param name="pText" select="."/>
4346
+ <xsl:param name="sep" select="','"/>
4347
+ <xsl:if test="string-length($pText) &gt;0">
4348
+ <item>
4349
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4350
+ </item>
4351
+ <xsl:call-template name="split">
4352
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4353
+ <xsl:with-param name="sep" select="$sep"/>
4354
+ </xsl:call-template>
4355
+ </xsl:if>
4356
+ </xsl:template><xsl:template name="getDocumentId">
4357
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3903
4358
  </xsl:template></xsl:stylesheet>