metanorma-un 0.3.11 → 0.4.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: d8212fb2e092b377af15f2595c042147b9a2651387267653ec0209363b375cc1
4
- data.tar.gz: 60aa4caefda37af71847cde4b988f2a36550df4eaa938d357759cccd84618740
3
+ metadata.gz: bfa63200d4491d6dffa8238d037348a7de274a2c65a403da624aa2a2f4e5e55f
4
+ data.tar.gz: 21ac008a828a2c5859153ace9c09904811c3a78a048bec427aca1d285aec9f02
5
5
  SHA512:
6
- metadata.gz: cd31c515a2b1a8bf6603f0f4e09b5a72378254fee041e3116a9664e6f1a178c29c024a1d712fdeea86c2bb5b5201469998c1bf2f2b5bb72396b193aded684762
7
- data.tar.gz: dc6bbb16d59a6c39d5f0fa0b58d50aa6dae19b06cbfef6e32a892ee4014b08965bf7d686f69efa4644fb01718053b88b548bdd11a9f21d9ebf869c1be9fc2cd6
6
+ metadata.gz: cfc1c4532015b76d8cb346cedb033775487cf5fd33a13b93707782babdf3669831f0e54fc7e744938a7172604e883dc070e7e79b4ab399dd4e439a0a8a1ab348
7
+ data.tar.gz: a150a444e4c66b727147e82c66fd2abc82e442f7c5327a3fdd8cb33f4d46730074da2a11055d86b2e17b9da4b8561cf18a173e435bf287b642122e8e49e583be
@@ -138,21 +138,12 @@ module Asciidoctor
138
138
  d
139
139
  end
140
140
 
141
- def document(node)
142
- init(node)
143
- ret1 = makexml(node)
144
- ret = ret1.to_xml(indent: 2)
145
- unless node.attr("nodoc") || !node.attr("docfile")
146
- filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
147
- gsub(%r{^.*/}, "")
148
- File.open(filename, "w") { |f| f.write(ret) }
149
- html_converter(node).convert filename unless node.attr("nodoc")
150
- word_converter(node).convert filename unless node.attr("nodoc")
151
- pdf_converter(node)&.convert filename unless node.attr("nodoc")
152
- end
153
- @log.write(@localdir + @filename + ".err") unless @novalid
154
- @files_to_delete.each { |f| FileUtils.rm f }
155
- ret
141
+ def outputs(node, ret)
142
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
143
+ presentation_xml_converter(node).convert(@filename + ".xml")
144
+ html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
145
+ doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
146
+ pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
156
147
  end
157
148
 
158
149
  def validate(doc)
@@ -173,11 +164,15 @@ module Asciidoctor
173
164
  super.merge(toc: node.attributes.has_key?("toc"))
174
165
  end
175
166
 
167
+ def presentation_xml_converter(node)
168
+ IsoDoc::UN::PresentationXMLConvert.new(html_extract_attributes(node))
169
+ end
170
+
176
171
  def html_converter(node)
177
172
  IsoDoc::UN::HtmlConvert.new(html_extract_attributes(node))
178
173
  end
179
174
 
180
- def word_converter(node)
175
+ def doc_converter(node)
181
176
  IsoDoc::UN::WordConvert.new(doc_extract_attributes(node))
182
177
  end
183
178
 
@@ -2,6 +2,7 @@ require "isodoc/un/metadata"
2
2
  require "isodoc/un/html_convert"
3
3
  require "isodoc/un/word_convert"
4
4
  require "isodoc/un/pdf_convert"
5
+ require "isodoc/un/presentation_xml_convert"
5
6
 
6
7
  module IsoDoc
7
8
  module UN
@@ -10,9 +10,13 @@ module IsoDoc
10
10
  @meta.set(:toc, @toc)
11
11
  end
12
12
 
13
+ def xref_init(lang, script, klass, labels, options)
14
+ @xrefs = Xref.new(lang, script, klass, labels, options)
15
+ end
16
+
13
17
  def annex_name(annex, name, div)
14
18
  div.h1 **{ class: "Annex" } do |t|
15
- t << "#{anchor(annex['id'], :label)}"
19
+ t << "#{@xrefs.anchor(annex['id'], :label)}"
16
20
  t.br
17
21
  t.b do |b|
18
22
  name&.children&.each { |c2| parse(c2, b) }
@@ -30,9 +34,13 @@ module IsoDoc
30
34
  File.join(File.dirname(__FILE__), loc)
31
35
  end
32
36
 
37
+ def middle_clause
38
+ "//clause[parent::sections]"
39
+ end
40
+
33
41
  def admonition_name_parse(node, div, name)
34
42
  div.p **{ class: "AdmonitionTitle", style: "text-align:center;" } do |p|
35
- lbl = anchor(node['id'], :label)
43
+ lbl = @xrefs.anchor(node['id'], :label)
36
44
  lbl.nil? or p << l10n("#{@admonition_lbl} #{lbl}")
37
45
  name and !lbl.nil? and p << "&nbsp;&mdash; "
38
46
  name and name.children.each { |n| parse(n, div) }
@@ -51,7 +59,7 @@ module IsoDoc
51
59
 
52
60
  def inline_header_title(out, node, c1)
53
61
  out.span **{ class: "zzMoveToFollowing" } do |s|
54
- if lbl = anchor(node['id'], :label)
62
+ if lbl = @xrefs.anchor(node['id'], :label)
55
63
  s << "#{lbl}. " unless @suppressheadingnumbers
56
64
  insert_tab(s, 1)
57
65
  end
@@ -67,7 +75,7 @@ module IsoDoc
67
75
  end
68
76
 
69
77
  def note_label(node)
70
- n = get_anchors[node["id"]]
78
+ n = @xrefs.get[node["id"]]
71
79
  lbl = case node["type"]
72
80
  when "source" then "Source"
73
81
  when "abbreviation" then "Abbreviations"
@@ -84,8 +84,8 @@ module IsoDoc
84
84
  if node["inline-header"] == "true"
85
85
  inline_header_title(out, node, c1)
86
86
  else
87
- div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h|
88
- lbl = anchor(node['id'], :label, false)
87
+ div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
88
+ lbl = @xrefs.anchor(node['id'], :label, false)
89
89
  h << "#{lbl}. " if lbl && !@suppressheadingnumbers
90
90
  insert_tab(h, 1) if lbl && !@suppressheadingnumbers
91
91
  c1&.children&.each { |c2| parse(c2, h) }
@@ -22,20 +22,6 @@ module IsoDoc
22
22
  "un.plenary-attachment.xsl" : "unece.recommendation.xsl"
23
23
  end
24
24
  end
25
-
26
- def convert(filename, file = nil, debug = false)
27
- file = File.read(filename, encoding: "utf-8") if file.nil?
28
- docxml, outname_html, dir = convert_init(file, filename, debug)
29
- /\.xml$/.match(filename) or
30
- filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
31
- f.write file
32
- f.path
33
- end
34
- FileUtils.rm_rf dir
35
- ::Metanorma::Output::XslfoPdf.new.convert(
36
- filename, outname_html + ".pdf",
37
- File.join(@libdir, pdf_stylesheet(docxml)))
38
- end
39
25
  end
40
26
  end
41
27
  end
@@ -0,0 +1,10 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module UN
6
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ end
8
+ end
9
+ end
10
+
@@ -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:un="https://www.metanorma.org/ns/un" 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:barcode="http://barcode4j.krysalis.org/ns" 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:un="https://www.metanorma.org/ns/un" 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:barcode="http://barcode4j.krysalis.org/ns" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -62,44 +62,7 @@
62
62
  </fo:page-sequence-master>
63
63
  </fo:layout-master-set>
64
64
 
65
- <fo:declarations>
66
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
67
- <pdf:dictionary type="normal" key="ViewerPreferences">
68
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
69
- </pdf:dictionary>
70
- </pdf:catalog>
71
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
72
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
73
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
74
- <!-- Dublin Core properties go here -->
75
- <dc:title>
76
- <xsl:choose>
77
- <xsl:when test="$title != ''">
78
- <xsl:value-of select="$title"/>
79
- </xsl:when>
80
- <xsl:otherwise>
81
- <xsl:text> </xsl:text>
82
- </xsl:otherwise>
83
- </xsl:choose>
84
- </dc:title>
85
- <dc:creator/>
86
- <dc:description>
87
- <xsl:variable name="abstract">
88
- <xsl:copy-of select="/un:un-standard/un:preface/un:abstract//text()"/>
89
- </xsl:variable>
90
- <xsl:value-of select="normalize-space($abstract)"/>
91
- </dc:description>
92
- <pdf:Keywords>
93
- <xsl:call-template name="insertKeywords"/>
94
- </pdf:Keywords>
95
- </rdf:Description>
96
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
97
- <!-- XMP properties go here -->
98
- <xmp:CreatorTool/>
99
- </rdf:Description>
100
- </rdf:RDF>
101
- </x:xmpmeta>
102
- </fo:declarations>
65
+ <xsl:call-template name="addPDFUAmeta"/>
103
66
 
104
67
  <!-- Cover Page -->
105
68
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -170,7 +133,7 @@
170
133
  <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:session/un:date"/>
171
134
  </fo:block>
172
135
  <fo:block font-weight="normal">
173
- <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:title, $upper, $lower)"/>
136
+ <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new(/un:un-standard/un:sections/un:clause[1]/un:title))"/>
174
137
  </fo:block>
175
138
  <fo:block>
176
139
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
@@ -301,14 +264,7 @@
301
264
  <!-- Any node with title element - clause, definition, annex,... -->
302
265
  <xsl:template match="un:title | un:preferred" mode="contents">
303
266
  <xsl:variable name="id">
304
- <xsl:choose>
305
- <xsl:when test="../@id">
306
- <xsl:value-of select="../@id"/>
307
- </xsl:when>
308
- <xsl:otherwise>
309
- <xsl:value-of select="text()"/>
310
- </xsl:otherwise>
311
- </xsl:choose>
267
+ <xsl:call-template name="getId"/>
312
268
  </xsl:variable>
313
269
 
314
270
  <xsl:variable name="level">
@@ -331,7 +287,12 @@
331
287
  <item id="{$id}" level="{$level}" section="{$section}" display="false" type="{$type}">
332
288
  <xsl:if test="$type = 'clause'">
333
289
  <xsl:attribute name="section">
334
- <xsl:text>Clause </xsl:text>
290
+ <xsl:variable name="title-clause">
291
+ <xsl:call-template name="getTitle">
292
+ <xsl:with-param name="name" select="'title-clause'"/>
293
+ </xsl:call-template>
294
+ </xsl:variable>
295
+ <xsl:value-of select="$title-clause"/>
335
296
  <xsl:choose>
336
297
  <xsl:when test="ancestor::un:sections">
337
298
  <!-- 1, 2, 3, 4, ... from main section (not annex ...) -->
@@ -355,7 +316,12 @@
355
316
  <xsl:when test="ancestor::un:annex">
356
317
  <xsl:choose>
357
318
  <xsl:when test="$level = 1">
358
- <xsl:text>Annex </xsl:text>
319
+ <xsl:variable name="title-annex">
320
+ <xsl:call-template name="getTitle">
321
+ <xsl:with-param name="name" select="'title-annex'"/>
322
+ </xsl:call-template>
323
+ </xsl:variable>
324
+ <xsl:value-of select="$title-annex"/>
359
325
  <xsl:number format="A" level="any" count="un:annex"/>
360
326
  </xsl:when>
361
327
  <xsl:otherwise>
@@ -386,7 +352,12 @@
386
352
  <xsl:template match="un:figure" mode="contents">
387
353
  <item level="" id="{@id}" type="figure">
388
354
  <xsl:attribute name="section">
389
- <xsl:text>Figure </xsl:text>
355
+ <xsl:variable name="title-figure">
356
+ <xsl:call-template name="getTitle">
357
+ <xsl:with-param name="name" select="'title-figure'"/>
358
+ </xsl:call-template>
359
+ </xsl:variable>
360
+ <xsl:value-of select="$title-figure"/>
390
361
  <xsl:choose>
391
362
  <xsl:when test="ancestor::un:annex">
392
363
  <xsl:choose>
@@ -418,7 +389,12 @@
418
389
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
419
390
  <item level="" id="{@id}" display="false" type="table">
420
391
  <xsl:attribute name="section">
421
- <xsl:text>Table </xsl:text>
392
+ <xsl:variable name="title-table">
393
+ <xsl:call-template name="getTitle">
394
+ <xsl:with-param name="name" select="'title-table'"/>
395
+ </xsl:call-template>
396
+ </xsl:variable>
397
+ <xsl:value-of select="$title-table"/>
422
398
  <xsl:choose>
423
399
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
424
400
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -441,7 +417,12 @@
441
417
  <xsl:template match="un:formula" mode="contents">
442
418
  <item level="" id="{@id}" display="false">
443
419
  <xsl:attribute name="section">
444
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="un:annex | un:formula"/><xsl:text>)</xsl:text>
420
+ <xsl:variable name="title-formula">
421
+ <xsl:call-template name="getTitle">
422
+ <xsl:with-param name="name" select="'title-formula'"/>
423
+ </xsl:call-template>
424
+ </xsl:variable>
425
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="un:annex | un:formula"/>
445
426
  </xsl:attribute>
446
427
  </item>
447
428
  </xsl:template>
@@ -470,7 +451,12 @@
470
451
  <item level="" id="{@id}" display="false" type="Terms">
471
452
  <xsl:if test="ancestor::un:annex">
472
453
  <xsl:attribute name="section">
473
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
454
+ <xsl:variable name="title-appendix">
455
+ <xsl:call-template name="getTitle">
456
+ <xsl:with-param name="name" select="'title-appendix'"/>
457
+ </xsl:call-template>
458
+ </xsl:variable>
459
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
474
460
  </xsl:attribute>
475
461
  </xsl:if>
476
462
  </item>
@@ -480,7 +466,12 @@
480
466
  <item level="" id="{@id}" display="false" type="References">
481
467
  <xsl:if test="ancestor::un:annex">
482
468
  <xsl:attribute name="section">
483
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
469
+ <xsl:variable name="title-appendix">
470
+ <xsl:call-template name="getTitle">
471
+ <xsl:with-param name="name" select="'title-appendix'"/>
472
+ </xsl:call-template>
473
+ </xsl:variable>
474
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
484
475
  </xsl:attribute>
485
476
  </xsl:if>
486
477
  </item>
@@ -492,7 +483,12 @@
492
483
  <xsl:variable name="num">
493
484
  <xsl:number/>
494
485
  </xsl:variable>
495
- <xsl:text>Box </xsl:text><xsl:value-of select="$num"/>
486
+ <xsl:variable name="title-box">
487
+ <xsl:call-template name="getTitle">
488
+ <xsl:with-param name="name" select="'title-box'"/>
489
+ </xsl:call-template>
490
+ </xsl:variable>
491
+ <xsl:value-of select="$title-box"/><xsl:value-of select="$num"/>
496
492
  </xsl:attribute>
497
493
  </item>
498
494
  </xsl:template>
@@ -514,7 +510,12 @@
514
510
  <fo:table-body>
515
511
  <fo:table-row>
516
512
  <fo:table-cell padding-left="6mm" padding-top="2.5mm">
517
- <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt">Summary</fo:block>
513
+ <xsl:variable name="title-summary">
514
+ <xsl:call-template name="getTitle">
515
+ <xsl:with-param name="name" select="'title-summary'"/>
516
+ </xsl:call-template>
517
+ </xsl:variable>
518
+ <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-summary"/></fo:block>
518
519
  </fo:table-cell>
519
520
  <fo:table-cell>
520
521
  <fo:block> </fo:block>
@@ -661,7 +662,12 @@
661
662
  <xsl:template match="un:ul//un:note | un:ol//un:note"/>
662
663
  <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process">
663
664
  <fo:block font-size="11pt" margin-top="4pt">
664
- <xsl:text>NOTE </xsl:text>
665
+ <xsl:variable name="title-note">
666
+ <xsl:call-template name="getTitle">
667
+ <xsl:with-param name="name" select="'title-note'"/>
668
+ </xsl:call-template>
669
+ </xsl:variable>
670
+ <xsl:value-of select="$title-note"/>
665
671
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
666
672
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
667
673
  </xsl:if>
@@ -743,12 +749,17 @@
743
749
  </xsl:template>
744
750
 
745
751
  <xsl:template match="un:admonition">
752
+ <xsl:variable name="title-box">
753
+ <xsl:call-template name="getTitle">
754
+ <xsl:with-param name="name" select="'title-box'"/>
755
+ </xsl:call-template>
756
+ </xsl:variable>
746
757
  <fo:block text-align="center" font-style="italic" keep-with-next="always" margin-bottom="6pt">
747
- <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
758
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
748
759
  </fo:block>
749
760
  <fo:block-container border="0.25pt solid black" margin-left="-3mm" margin-right="-3mm" padding-top="4mm">
750
761
  <fo:block id="{@id}" font-weight="bold" margin-left="6mm" margin-right="6mm" keep-with-next="always">
751
- <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
762
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
752
763
  </fo:block>
753
764
  <fo:block margin-left="5mm" margin-right="5mm">
754
765
  <xsl:apply-templates/>
@@ -815,14 +826,7 @@
815
826
 
816
827
  <xsl:template match="un:title">
817
828
  <xsl:variable name="id">
818
- <xsl:choose>
819
- <xsl:when test="../@id">
820
- <xsl:value-of select="../@id"/>
821
- </xsl:when>
822
- <xsl:otherwise>
823
- <xsl:value-of select="text()"/>
824
- </xsl:otherwise>
825
- </xsl:choose>
829
+ <xsl:call-template name="getId"/>
826
830
  </xsl:variable>
827
831
 
828
832
  <xsl:variable name="level">
@@ -933,7 +937,12 @@
933
937
  <xsl:template match="un:recommendation">
934
938
  <fo:block margin-left="20mm">
935
939
  <fo:block font-weight="bold">
936
- <xsl:text>Recommendation </xsl:text>
940
+ <xsl:variable name="title-recommendation">
941
+ <xsl:call-template name="getTitle">
942
+ <xsl:with-param name="name" select="'title-recommendation'"/>
943
+ </xsl:call-template>
944
+ </xsl:variable>
945
+ <xsl:value-of select="$title-recommendation"/>
937
946
  <xsl:choose>
938
947
  <xsl:when test="ancestor::un:sections">
939
948
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1003,7 +1012,12 @@
1003
1012
  </fo:block>
1004
1013
  <xsl:if test="un:name">
1005
1014
  <fo:block text-align="center" margin-bottom="6pt" keep-with-previous="always">
1006
- <xsl:text>Figure </xsl:text>
1015
+ <xsl:variable name="title-figure">
1016
+ <xsl:call-template name="getTitle">
1017
+ <xsl:with-param name="name" select="'title-figure'"/>
1018
+ </xsl:call-template>
1019
+ </xsl:variable>
1020
+ <xsl:value-of select="$title-figure"/>
1007
1021
  <xsl:choose>
1008
1022
  <xsl:when test="ancestor::un:annex">
1009
1023
  <xsl:choose>
@@ -1134,7 +1148,12 @@
1134
1148
 
1135
1149
  <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note">
1136
1150
  <fo:block font-size="10pt" space-after="12pt" text-indent="0">
1137
- <fo:inline padding-right="4mm"><xsl:text>NOTE </xsl:text>
1151
+ <xsl:variable name="title-note">
1152
+ <xsl:call-template name="getTitle">
1153
+ <xsl:with-param name="name" select="'title-note'"/>
1154
+ </xsl:call-template>
1155
+ </xsl:variable>
1156
+ <fo:inline padding-right="4mm"><xsl:value-of select="$title-note"/>
1138
1157
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
1139
1158
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
1140
1159
  </xsl:if>
@@ -1145,12 +1164,17 @@
1145
1164
 
1146
1165
  <xsl:template match="un:termnote">
1147
1166
  <fo:block margin-top="4pt">
1148
- <xsl:text>NOTE </xsl:text>
1149
- <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1150
- <xsl:number/><xsl:text> </xsl:text>
1151
- </xsl:if>
1152
- <xsl:text>– </xsl:text>
1153
- <xsl:apply-templates/>
1167
+ <xsl:variable name="title-note">
1168
+ <xsl:call-template name="getTitle">
1169
+ <xsl:with-param name="name" select="'title-note'"/>
1170
+ </xsl:call-template>
1171
+ </xsl:variable>
1172
+ <xsl:value-of select="$title-note"/>
1173
+ <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1174
+ <xsl:number/><xsl:text> </xsl:text>
1175
+ </xsl:if>
1176
+ <xsl:text>– </xsl:text>
1177
+ <xsl:apply-templates/>
1154
1178
  </fo:block>
1155
1179
  </xsl:template>
1156
1180
 
@@ -1178,7 +1202,7 @@
1178
1202
  <fo:table-cell> <!-- display-align="center" -->
1179
1203
  <fo:block text-align="right">
1180
1204
  <xsl:if test="not(ancestor::un:annex)">
1181
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1205
+ <xsl:number format="(1)" level="any"/>
1182
1206
  </xsl:if>
1183
1207
  <xsl:if test="ancestor::un:annex">
1184
1208
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1202,7 +1226,12 @@
1202
1226
  </xsl:template>
1203
1227
 
1204
1228
  <xsl:template match="un:example">
1205
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1229
+ <xsl:variable name="title-example">
1230
+ <xsl:call-template name="getTitle">
1231
+ <xsl:with-param name="name" select="'title-example'"/>
1232
+ </xsl:call-template>
1233
+ </xsl:variable>
1234
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1206
1235
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1207
1236
  <xsl:apply-templates/>
1208
1237
  </fo:block>
@@ -1229,7 +1258,7 @@
1229
1258
  <xsl:if test="@type = 'inline'">
1230
1259
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1231
1260
  </xsl:if>
1232
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1261
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1233
1262
 
1234
1263
  <xsl:apply-templates select="un:localityStack"/>
1235
1264
 
@@ -1238,9 +1267,19 @@
1238
1267
  </xsl:template>
1239
1268
 
1240
1269
  <xsl:template match="un:locality">
1270
+ <xsl:variable name="title-section">
1271
+ <xsl:call-template name="getTitle">
1272
+ <xsl:with-param name="name" select="'title-section'"/>
1273
+ </xsl:call-template>
1274
+ </xsl:variable>
1275
+ <xsl:variable name="title-clause">
1276
+ <xsl:call-template name="getTitle">
1277
+ <xsl:with-param name="name" select="'title-clause'"/>
1278
+ </xsl:call-template>
1279
+ </xsl:variable>
1241
1280
  <xsl:choose>
1242
- <xsl:when test="@type = 'section'">Section </xsl:when>
1243
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
1281
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1282
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1244
1283
  <xsl:otherwise/>
1245
1284
  </xsl:choose>
1246
1285
  <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
@@ -1259,7 +1298,7 @@
1259
1298
  </fo:block>
1260
1299
  </xsl:template>
1261
1300
  <xsl:template match="un:term" mode="table">
1262
- <fo:table-row>
1301
+ <fo:table-row id="{@id}">
1263
1302
  <fo:table-cell padding-right="1mm">
1264
1303
  <fo:block margin-bottom="12pt">
1265
1304
  <xsl:apply-templates select="un:preferred"/>
@@ -1273,7 +1312,7 @@
1273
1312
  </fo:table-row>
1274
1313
  </xsl:template>
1275
1314
  <xsl:template match="un:preferred">
1276
- <fo:inline id="{../@id}">
1315
+ <fo:inline>
1277
1316
  <xsl:apply-templates/>
1278
1317
  </fo:inline>
1279
1318
  </xsl:template>
@@ -1400,29 +1439,6 @@
1400
1439
  </fo:static-content>
1401
1440
  </xsl:template>
1402
1441
 
1403
-
1404
- <xsl:template name="getLevel">
1405
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1406
- <xsl:variable name="level">
1407
- <xsl:choose>
1408
- <xsl:when test="ancestor::un:preface">
1409
- <xsl:value-of select="$level_total - 2"/>
1410
- </xsl:when>
1411
- <xsl:when test="ancestor::un:sections">
1412
- <xsl:value-of select="$level_total - 2"/>
1413
- </xsl:when>
1414
- <xsl:when test="ancestor::un:bibliography">
1415
- <xsl:value-of select="$level_total - 2"/>
1416
- </xsl:when>
1417
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1418
- <xsl:otherwise>
1419
- <xsl:value-of select="$level_total - 1"/>
1420
- </xsl:otherwise>
1421
- </xsl:choose>
1422
- </xsl:variable>
1423
- <xsl:value-of select="$level"/>
1424
- </xsl:template>
1425
-
1426
1442
  <xsl:template name="getSection">
1427
1443
  <xsl:variable name="level">
1428
1444
  <xsl:call-template name="getLevel"/>
@@ -1450,12 +1466,17 @@
1450
1466
  <xsl:when test="ancestor::un:annex">
1451
1467
  <xsl:choose>
1452
1468
  <xsl:when test="$level = 1">
1469
+ <xsl:variable name="title-annex">
1470
+ <xsl:call-template name="getTitle">
1471
+ <xsl:with-param name="name" select="'title-annex'"/>
1472
+ </xsl:call-template>
1473
+ </xsl:variable>
1453
1474
  <xsl:choose>
1454
1475
  <xsl:when test="local-name() = 'title'">
1455
- <xsl:text>ANNEX </xsl:text>
1476
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-annex))"/>
1456
1477
  <xsl:number format="A" level="any" count="un:annex"/>
1457
1478
  </xsl:when>
1458
- <xsl:otherwise>Annex</xsl:otherwise>
1479
+ <xsl:otherwise><xsl:value-of select="normalize-space($title-annex)"/></xsl:otherwise>
1459
1480
  </xsl:choose>
1460
1481
  </xsl:when>
1461
1482
  <xsl:otherwise>
@@ -1556,8 +1577,10 @@
1556
1577
  </xsl:choose>
1557
1578
  </xsl:variable>
1558
1579
  <xsl:choose>
1559
- <xsl:when test="$first = 'true'">
1560
- <xsl:value-of select="translate(substring($value, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($value, 2)"/>
1580
+ <xsl:when test="$first = 'true'">
1581
+ <xsl:call-template name="capitalize">
1582
+ <xsl:with-param name="str" select="$value"/>
1583
+ </xsl:call-template>
1561
1584
  </xsl:when>
1562
1585
  <xsl:otherwise>
1563
1586
  <xsl:value-of select="$value"/>
@@ -1593,8 +1616,8 @@
1593
1616
  </xsl:template>
1594
1617
 
1595
1618
  <xsl:template name="getLanguage">
1596
- <xsl:param name="lang"/>
1597
- <xsl:variable name="language" select="translate($lang, $upper, $lower)"/>
1619
+ <xsl:param name="lang"/>
1620
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
1598
1621
  <xsl:choose>
1599
1622
  <xsl:when test="$language = 'en'">English</xsl:when>
1600
1623
  <xsl:when test="$language = 'de'">Deutsch</xsl:when>
@@ -2461,47 +2484,186 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2461
2484
  </xsl:text>
2462
2485
  </xsl:variable>
2463
2486
 
2464
- <xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table">
2487
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2488
+
2489
+ <title-table lang="en">Table </title-table>
2490
+ <title-table lang="fr">Tableau </title-table>
2491
+
2492
+ <title-table lang="zh">Table </title-table>
2493
+
2494
+
2495
+
2496
+ <title-note lang="en">NOTE </title-note>
2497
+ <title-note lang="fr">NOTE </title-note>
2465
2498
 
2466
- <xsl:text>Table </xsl:text>
2499
+ <title-note lang="zh">NOTE </title-note>
2467
2500
 
2468
2501
 
2469
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
2470
2502
 
2471
- <xsl:text>NOTE </xsl:text>
2503
+ <title-figure lang="en">Figure </title-figure>
2504
+ <title-figure lang="fr">Figure </title-figure>
2472
2505
 
2506
+ <title-figure lang="zh">Figure </title-figure>
2473
2507
 
2474
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
2475
2508
 
2476
- <xsl:text>Figure </xsl:text>
2477
2509
 
2510
+ <title-example lang="en">EXAMPLE </title-example>
2511
+ <title-example lang="fr">EXEMPLE </title-example>
2478
2512
 
2479
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
2513
+ <title-example lang="zh">EXAMPLE </title-example>
2480
2514
 
2481
- <xsl:text>EXAMPLE </xsl:text>
2482
2515
 
2483
2516
 
2484
- </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">
2517
+ <title-example-xref lang="en">Example </title-example-xref>
2518
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2519
+
2520
+ <title-section lang="en">Section </title-section>
2521
+ <title-section lang="fr">Section </title-section>
2485
2522
 
2486
- <xsl:text>Annex </xsl:text>
2523
+ <title-inequality lang="en">Inequality </title-inequality>
2524
+ <title-inequality lang="fr">Inequality </title-inequality>
2487
2525
 
2526
+ <title-equation lang="en">Equation </title-equation>
2527
+ <title-equation lang="fr">Equation </title-equation>
2528
+
2529
+ <title-annex lang="en">Annex </title-annex>
2530
+ <title-annex lang="fr">Annexe </title-annex>
2531
+
2532
+ <title-annex lang="zh">Annex </title-annex>
2488
2533
 
2489
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
2490
- <xsl:text>Appendix </xsl:text>
2491
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">
2492
2534
 
2493
- <xsl:text>Clause </xsl:text>
2494
2535
 
2536
+ <title-appendix lang="en">Appendix </title-appendix>
2537
+ <title-appendix lang="fr">Appendix </title-appendix>
2538
+
2539
+ <title-clause lang="en">Clause </title-clause>
2540
+ <title-clause lang="fr">Article </title-clause>
2541
+
2542
+ <title-clause lang="zh">Clause </title-clause>
2495
2543
 
2496
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
2497
- <xsl:text>Edition </xsl:text>
2498
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">
2499
2544
 
2500
2545
 
2501
- </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">
2546
+ <title-edition lang="en">
2547
+
2548
+ <xsl:text>Edition </xsl:text>
2549
+
2550
+
2551
+ </title-edition>
2552
+
2553
+ <title-formula lang="en">Formula </title-formula>
2554
+ <title-formula lang="fr">Formula </title-formula>
2555
+
2556
+ <title-toc lang="en">
2557
+
2558
+
2559
+
2560
+ </title-toc>
2561
+ <title-toc lang="fr">Sommaire</title-toc>
2562
+
2563
+ <title-toc lang="zh">Contents</title-toc>
2564
+
2565
+
2566
+
2567
+ <title-page lang="en">Page</title-page>
2568
+ <title-page lang="fr">Page</title-page>
2569
+
2570
+ <title-key lang="en">Key</title-key>
2571
+ <title-key lang="fr">Légende</title-key>
2572
+
2573
+ <title-where lang="en">where</title-where>
2574
+ <title-where lang="fr">où</title-where>
2575
+
2576
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2577
+
2578
+ <title-part lang="en">
2579
+
2580
+
2581
+ </title-part>
2582
+ <title-part lang="fr">
2583
+
2584
+
2585
+ </title-part>
2586
+ <title-part lang="zh">第 # 部分:</title-part>
2587
+
2588
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2589
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2590
+
2591
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2592
+
2593
+
2594
+
2595
+ <title-modified lang="en">modified</title-modified>
2596
+ <title-modified lang="fr">modifiée</title-modified>
2597
+
2598
+ <title-modified lang="zh">modified</title-modified>
2599
+
2600
+
2601
+
2602
+ <title-source lang="en">SOURCE</title-source>
2603
+
2604
+ <title-keywords lang="en">Keywords</title-keywords>
2605
+
2606
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2607
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2608
+
2609
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2610
+
2611
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2612
+
2613
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2614
+
2615
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2616
+
2617
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2618
+
2619
+ <title-abstract lang="en">Abstract</title-abstract>
2620
+
2621
+ <title-summary lang="en">Summary</title-summary>
2622
+
2623
+ <title-in lang="en">in </title-in>
2624
+
2625
+ <title-box lang="en">Box </title-box>
2626
+
2627
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2628
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2629
+
2630
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2631
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2632
+
2633
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2634
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2635
+
2636
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2637
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2638
+
2639
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2640
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2641
+
2642
+ <title-caution lang="en">CAUTION</title-caution>
2643
+ <title-caution lang="zh">注意</title-caution>
2644
+
2645
+ <title-warning lang="en">WARNING</title-warning>
2646
+ <title-warning lang="zh">警告</title-warning>
2647
+
2648
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2649
+ </xsl:variable><xsl:template name="getTitle">
2650
+ <xsl:param name="name"/>
2651
+ <xsl:variable name="lang">
2652
+ <xsl:call-template name="getLang"/>
2653
+ </xsl:variable>
2654
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2655
+ <xsl:choose>
2656
+ <xsl:when test="normalize-space($title_) != ''">
2657
+ <xsl:value-of select="$title_"/>
2658
+ </xsl:when>
2659
+ <xsl:otherwise>
2660
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2661
+ </xsl:otherwise>
2662
+ </xsl:choose>
2663
+ </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">
2502
2664
 
2503
2665
 
2504
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
2666
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2505
2667
 
2506
2668
 
2507
2669
 
@@ -2515,22 +2677,22 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2515
2677
 
2516
2678
 
2517
2679
 
2518
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">
2680
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2519
2681
 
2520
2682
 
2521
2683
 
2522
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">
2684
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2523
2685
 
2524
2686
 
2525
2687
 
2526
- </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
2688
+ </xsl:attribute-set><xsl:template match="text()">
2527
2689
  <xsl:value-of select="."/>
2528
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
2690
+ </xsl:template><xsl:template match="*[local-name()='br']">
2529
2691
  <xsl:value-of select="$linebreak"/>
2530
- </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">
2692
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2531
2693
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2532
2694
  <xsl:call-template name="add-zero-spaces-java"/>
2533
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">
2695
+ </xsl:template><xsl:template match="*[local-name()='table']">
2534
2696
 
2535
2697
  <xsl:variable name="simple-table">
2536
2698
  <!-- <xsl:copy> -->
@@ -2568,7 +2730,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2568
2730
 
2569
2731
 
2570
2732
 
2571
-
2733
+ <xsl:variable name="title-table">
2734
+ <xsl:call-template name="getTitle">
2735
+ <xsl:with-param name="name" select="'title-table'"/>
2736
+ </xsl:call-template>
2737
+ </xsl:variable>
2572
2738
  <xsl:value-of select="$title-table"/>
2573
2739
 
2574
2740
  <xsl:call-template name="getTableNumber"/>
@@ -2669,13 +2835,22 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2669
2835
  </xsl:otherwise>
2670
2836
  </xsl:choose>
2671
2837
  </xsl:for-each>
2672
- <xsl:apply-templates/>
2838
+
2839
+ <xsl:choose>
2840
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2841
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2842
+ </xsl:when>
2843
+ <xsl:otherwise>
2844
+ <xsl:apply-templates/>
2845
+ </xsl:otherwise>
2846
+ </xsl:choose>
2847
+
2673
2848
  </fo:table>
2674
2849
 
2675
2850
 
2676
2851
 
2677
2852
  </fo:block-container>
2678
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
2853
+ </xsl:template><xsl:template name="getTableNumber">
2679
2854
  <xsl:choose>
2680
2855
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2681
2856
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -2702,15 +2877,15 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2702
2877
 
2703
2878
  </xsl:otherwise>
2704
2879
  </xsl:choose>
2705
- </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">
2880
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2706
2881
  <xsl:apply-templates/>
2707
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
2882
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2708
2883
  <xsl:param name="table-row"/>
2709
2884
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2710
2885
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2711
2886
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2712
2887
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2713
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
2888
+ </xsl:template><xsl:template name="calculate-column-widths">
2714
2889
  <xsl:param name="table"/>
2715
2890
  <xsl:param name="cols-count"/>
2716
2891
  <xsl:param name="curr-col" select="1"/>
@@ -2808,23 +2983,27 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2808
2983
  <xsl:with-param name="table" select="$table"/>
2809
2984
  </xsl:call-template>
2810
2985
  </xsl:if>
2811
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
2986
+ </xsl:template><xsl:template match="text()" mode="td_text">
2812
2987
  <xsl:variable name="zero-space">​</xsl:variable>
2813
2988
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2814
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
2989
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2815
2990
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2816
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
2991
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2817
2992
  <xsl:value-of select="@target"/>
2818
- </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">
2993
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2819
2994
  <xsl:param name="cols-count"/>
2820
2995
  <!-- font-weight="bold" -->
2821
2996
  <fo:table-header>
2822
2997
 
2823
2998
  <xsl:apply-templates/>
2824
2999
  </fo:table-header>
2825
- </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">
3000
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3001
+ <fo:table-body>
3002
+ <xsl:apply-templates/>
3003
+ </fo:table-body>
3004
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2826
3005
  <xsl:apply-templates/>
2827
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
3006
+ </xsl:template><xsl:template name="insertTableFooter">
2828
3007
  <xsl:param name="cols-count"/>
2829
3008
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2830
3009
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -2864,7 +3043,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2864
3043
  </fo:table-footer>
2865
3044
 
2866
3045
  </xsl:if>
2867
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">
3046
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2868
3047
 
2869
3048
  <xsl:variable name="cols-count">
2870
3049
  <xsl:choose>
@@ -2895,7 +3074,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2895
3074
 
2896
3075
  </fo:table-body>
2897
3076
 
2898
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
3077
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2899
3078
  <xsl:variable name="parent-name" select="local-name(..)"/>
2900
3079
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2901
3080
  <fo:table-row min-height="4mm">
@@ -2919,7 +3098,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2919
3098
 
2920
3099
  <xsl:apply-templates/>
2921
3100
  </fo:table-row>
2922
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
3101
+ </xsl:template><xsl:template match="*[local-name()='th']">
2923
3102
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2924
3103
 
2925
3104
 
@@ -2951,7 +3130,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2951
3130
  <xsl:apply-templates/>
2952
3131
  </fo:block>
2953
3132
  </fo:table-cell>
2954
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
3133
+ </xsl:template><xsl:template match="*[local-name()='td']">
2955
3134
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2956
3135
 
2957
3136
 
@@ -2996,7 +3175,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2996
3175
 
2997
3176
 
2998
3177
  </fo:table-cell>
2999
- </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">
3178
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3000
3179
 
3001
3180
 
3002
3181
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3007,6 +3186,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3007
3186
  <fo:inline padding-right="2mm">
3008
3187
 
3009
3188
 
3189
+ <xsl:variable name="title-note">
3190
+ <xsl:call-template name="getTitle">
3191
+ <xsl:with-param name="name" select="'title-note'"/>
3192
+ </xsl:call-template>
3193
+ </xsl:variable>
3010
3194
  <xsl:value-of select="$title-note"/>
3011
3195
 
3012
3196
 
@@ -3017,9 +3201,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3017
3201
  <xsl:apply-templates mode="process"/>
3018
3202
  </fo:block>
3019
3203
 
3020
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3204
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3021
3205
  <xsl:apply-templates/>
3022
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
3206
+ </xsl:template><xsl:template name="fn_display">
3023
3207
  <xsl:variable name="references">
3024
3208
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3025
3209
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3056,7 +3240,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3056
3240
  </fo:block>
3057
3241
  </xsl:if>
3058
3242
  </xsl:for-each>
3059
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
3243
+ </xsl:template><xsl:template name="fn_name_display">
3060
3244
  <!-- <xsl:variable name="references">
3061
3245
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3062
3246
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3072,7 +3256,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3072
3256
  <xsl:apply-templates/>
3073
3257
  </fo:block>
3074
3258
  </xsl:for-each>
3075
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
3259
+ </xsl:template><xsl:template name="fn_display_figure">
3076
3260
  <xsl:variable name="key_iso">
3077
3261
  <!-- and (not(@class) or @class !='pseudocode') -->
3078
3262
  </xsl:variable>
@@ -3083,6 +3267,36 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3083
3267
  </fn>
3084
3268
  </xsl:for-each>
3085
3269
  </xsl:variable>
3270
+
3271
+ <!-- current hierarchy is 'figure' element -->
3272
+ <xsl:variable name="following_dl_colwidths">
3273
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3274
+ <xsl:variable name="html-table">
3275
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3276
+ <xsl:element name="{$ns}:table">
3277
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3278
+ <tbody>
3279
+ <xsl:apply-templates mode="dl"/>
3280
+ </tbody>
3281
+ </xsl:for-each>
3282
+ </xsl:element>
3283
+ </xsl:variable>
3284
+
3285
+ <xsl:call-template name="calculate-column-widths">
3286
+ <xsl:with-param name="cols-count" select="2"/>
3287
+ <xsl:with-param name="table" select="$html-table"/>
3288
+ </xsl:call-template>
3289
+
3290
+ </xsl:if>
3291
+ </xsl:variable>
3292
+
3293
+
3294
+ <xsl:variable name="maxlength_dt">
3295
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3296
+ <xsl:call-template name="getMaxLength_dt"/>
3297
+ </xsl:for-each>
3298
+ </xsl:variable>
3299
+
3086
3300
  <xsl:if test="xalan:nodeset($references)//fn">
3087
3301
  <fo:block>
3088
3302
  <fo:table width="95%" table-layout="fixed">
@@ -3090,8 +3304,19 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3090
3304
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3091
3305
 
3092
3306
  </xsl:if>
3093
- <fo:table-column column-width="15%"/>
3094
- <fo:table-column column-width="85%"/>
3307
+ <xsl:choose>
3308
+ <!-- if there 'dl', then set same columns width -->
3309
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3310
+ <xsl:call-template name="setColumnWidth_dl">
3311
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3312
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3313
+ </xsl:call-template>
3314
+ </xsl:when>
3315
+ <xsl:otherwise>
3316
+ <fo:table-column column-width="15%"/>
3317
+ <fo:table-column column-width="85%"/>
3318
+ </xsl:otherwise>
3319
+ </xsl:choose>
3095
3320
  <fo:table-body>
3096
3321
  <xsl:for-each select="xalan:nodeset($references)//fn">
3097
3322
  <xsl:variable name="reference" select="@reference"/>
@@ -3123,7 +3348,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3123
3348
  </fo:block>
3124
3349
  </xsl:if>
3125
3350
 
3126
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
3351
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3127
3352
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3128
3353
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3129
3354
 
@@ -3135,11 +3360,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3135
3360
  <xsl:value-of select="@reference"/>
3136
3361
  </fo:basic-link>
3137
3362
  </fo:inline>
3138
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
3363
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3139
3364
  <fo:inline>
3140
3365
  <xsl:apply-templates/>
3141
3366
  </fo:inline>
3142
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
3367
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3143
3368
  <xsl:variable name="parent" select="local-name(..)"/>
3144
3369
 
3145
3370
  <xsl:variable name="key_iso">
@@ -3152,6 +3377,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3152
3377
 
3153
3378
  <fo:block margin-bottom="12pt" text-align="left">
3154
3379
 
3380
+ <xsl:variable name="title-where">
3381
+ <xsl:call-template name="getTitle">
3382
+ <xsl:with-param name="name" select="'title-where'"/>
3383
+ </xsl:call-template>
3384
+ </xsl:variable>
3155
3385
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3156
3386
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3157
3387
  <xsl:text/>
@@ -3165,14 +3395,24 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3165
3395
 
3166
3396
 
3167
3397
 
3398
+ <xsl:variable name="title-where">
3399
+ <xsl:call-template name="getTitle">
3400
+ <xsl:with-param name="name" select="'title-where'"/>
3401
+ </xsl:call-template>
3402
+ </xsl:variable>
3168
3403
  <xsl:value-of select="$title-where"/>
3169
3404
  </fo:block>
3170
3405
  </xsl:when>
3171
3406
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3172
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3407
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3173
3408
 
3174
3409
 
3175
3410
 
3411
+ <xsl:variable name="title-key">
3412
+ <xsl:call-template name="getTitle">
3413
+ <xsl:with-param name="name" select="'title-key'"/>
3414
+ </xsl:call-template>
3415
+ </xsl:variable>
3176
3416
  <xsl:value-of select="$title-key"/>
3177
3417
  </fo:block>
3178
3418
  </xsl:when>
@@ -3189,23 +3429,6 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3189
3429
 
3190
3430
 
3191
3431
 
3192
- <!-- create virtual html table for dl/[dt and dd] -->
3193
- <xsl:variable name="html-table">
3194
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3195
- <xsl:element name="{$ns}:table">
3196
- <tbody>
3197
- <xsl:apply-templates mode="dl"/>
3198
- </tbody>
3199
- </xsl:element>
3200
- </xsl:variable>
3201
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3202
- <xsl:variable name="colwidths">
3203
- <xsl:call-template name="calculate-column-widths">
3204
- <xsl:with-param name="cols-count" select="2"/>
3205
- <xsl:with-param name="table" select="$html-table"/>
3206
- </xsl:call-template>
3207
- </xsl:variable>
3208
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3209
3432
 
3210
3433
  <fo:table width="95%" table-layout="fixed">
3211
3434
 
@@ -3218,42 +3441,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3218
3441
 
3219
3442
  </xsl:when>
3220
3443
  </xsl:choose>
3221
- <xsl:choose>
3222
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3223
- <fo:table-column column-width="50%"/>
3224
- <fo:table-column column-width="50%"/>
3225
- </xsl:when>
3226
- <xsl:otherwise>
3227
- <xsl:choose>
3228
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3229
- <fo:table-column column-width="60%"/>
3230
- <fo:table-column column-width="40%"/>
3231
- </xsl:when> -->
3232
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3233
- <fo:table-column column-width="50%"/>
3234
- <fo:table-column column-width="50%"/>
3235
- </xsl:when>
3236
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3237
- <fo:table-column column-width="40%"/>
3238
- <fo:table-column column-width="60%"/>
3239
- </xsl:when>
3240
- <xsl:otherwise>
3241
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3242
- <xsl:choose>
3243
- <xsl:when test=". = 1 or . = 0">
3244
- <fo:table-column column-width="proportional-column-width(2)"/>
3245
- </xsl:when>
3246
- <xsl:otherwise>
3247
- <fo:table-column column-width="proportional-column-width({.})"/>
3248
- </xsl:otherwise>
3249
- </xsl:choose>
3250
- </xsl:for-each>
3251
- </xsl:otherwise>
3252
- </xsl:choose>
3253
- <!-- <fo:table-column column-width="15%"/>
3254
- <fo:table-column column-width="85%"/> -->
3255
- </xsl:otherwise>
3256
- </xsl:choose>
3444
+ <!-- create virtual html table for dl/[dt and dd] -->
3445
+ <xsl:variable name="html-table">
3446
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3447
+ <xsl:element name="{$ns}:table">
3448
+ <tbody>
3449
+ <xsl:apply-templates mode="dl"/>
3450
+ </tbody>
3451
+ </xsl:element>
3452
+ </xsl:variable>
3453
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3454
+ <xsl:variable name="colwidths">
3455
+ <xsl:call-template name="calculate-column-widths">
3456
+ <xsl:with-param name="cols-count" select="2"/>
3457
+ <xsl:with-param name="table" select="$html-table"/>
3458
+ </xsl:call-template>
3459
+ </xsl:variable>
3460
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3461
+ <xsl:variable name="maxlength_dt">
3462
+ <xsl:call-template name="getMaxLength_dt"/>
3463
+ </xsl:variable>
3464
+ <xsl:call-template name="setColumnWidth_dl">
3465
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3466
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3467
+ </xsl:call-template>
3257
3468
  <fo:table-body>
3258
3469
  <xsl:apply-templates>
3259
3470
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3263,7 +3474,61 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3263
3474
  </fo:block>
3264
3475
  </fo:block>
3265
3476
  </xsl:if>
3266
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
3477
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3478
+ <xsl:param name="colwidths"/>
3479
+ <xsl:param name="maxlength_dt"/>
3480
+ <xsl:choose>
3481
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3482
+ <fo:table-column column-width="50%"/>
3483
+ <fo:table-column column-width="50%"/>
3484
+ </xsl:when>
3485
+ <xsl:otherwise>
3486
+ <xsl:choose>
3487
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3488
+ <fo:table-column column-width="5%"/>
3489
+ <fo:table-column column-width="95%"/>
3490
+ </xsl:when>
3491
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3492
+ <fo:table-column column-width="10%"/>
3493
+ <fo:table-column column-width="90%"/>
3494
+ </xsl:when>
3495
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3496
+ <fo:table-column column-width="60%"/>
3497
+ <fo:table-column column-width="40%"/>
3498
+ </xsl:when> -->
3499
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3500
+ <fo:table-column column-width="50%"/>
3501
+ <fo:table-column column-width="50%"/>
3502
+ </xsl:when>
3503
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3504
+ <fo:table-column column-width="40%"/>
3505
+ <fo:table-column column-width="60%"/>
3506
+ </xsl:when>
3507
+ <xsl:otherwise>
3508
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3509
+ <xsl:choose>
3510
+ <xsl:when test=". = 1 or . = 0">
3511
+ <fo:table-column column-width="proportional-column-width(2)"/>
3512
+ </xsl:when>
3513
+ <xsl:otherwise>
3514
+ <fo:table-column column-width="proportional-column-width({.})"/>
3515
+ </xsl:otherwise>
3516
+ </xsl:choose>
3517
+ </xsl:for-each>
3518
+ </xsl:otherwise>
3519
+ </xsl:choose>
3520
+ <!-- <fo:table-column column-width="15%"/>
3521
+ <fo:table-column column-width="85%"/> -->
3522
+ </xsl:otherwise>
3523
+ </xsl:choose>
3524
+ </xsl:template><xsl:template name="getMaxLength_dt">
3525
+ <xsl:for-each select="*[local-name()='dt']">
3526
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3527
+ <xsl:if test="position() = 1">
3528
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3529
+ </xsl:if>
3530
+ </xsl:for-each>
3531
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3267
3532
  <xsl:param name="key_iso"/>
3268
3533
 
3269
3534
  <!-- <tr>
@@ -3279,6 +3544,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3279
3544
  <xsl:if test="normalize-space($key_iso) = 'true'">
3280
3545
  <xsl:attribute name="margin-top">0</xsl:attribute>
3281
3546
  </xsl:if>
3547
+ <xsl:variable name="title-note">
3548
+ <xsl:call-template name="getTitle">
3549
+ <xsl:with-param name="name" select="'title-note'"/>
3550
+ </xsl:call-template>
3551
+ </xsl:variable>
3282
3552
  <xsl:value-of select="$title-note"/>
3283
3553
  </fo:block>
3284
3554
  </fo:table-cell>
@@ -3288,7 +3558,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3288
3558
  </fo:block>
3289
3559
  </fo:table-cell>
3290
3560
  </fo:table-row>
3291
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
3561
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3292
3562
  <tr>
3293
3563
  <td>
3294
3564
  <xsl:apply-templates/>
@@ -3301,7 +3571,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3301
3571
  </td>
3302
3572
  </tr>
3303
3573
 
3304
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
3574
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3305
3575
  <xsl:param name="key_iso"/>
3306
3576
 
3307
3577
  <fo:table-row>
@@ -3320,7 +3590,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3320
3590
 
3321
3591
 
3322
3592
  <xsl:apply-templates/>
3323
-
3593
+ <!-- <xsl:if test="$namespace = 'gb'">
3594
+ <xsl:if test="ancestor::*[local-name()='formula']">
3595
+ <xsl:text>—</xsl:text>
3596
+ </xsl:if>
3597
+ </xsl:if> -->
3324
3598
  </fo:block>
3325
3599
  </fo:table-cell>
3326
3600
  <fo:table-cell>
@@ -3334,37 +3608,37 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3334
3608
  </fo:table-cell>
3335
3609
  </fo:table-row>
3336
3610
 
3337
- </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">
3611
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3338
3612
  <xsl:apply-templates/>
3339
- </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">
3613
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3340
3614
  <xsl:apply-templates/>
3341
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3615
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3342
3616
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3343
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
3617
+ </xsl:template><xsl:template match="*[local-name()='em']">
3344
3618
  <fo:inline font-style="italic">
3345
3619
  <xsl:apply-templates/>
3346
3620
  </fo:inline>
3347
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
3621
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3348
3622
  <fo:inline font-weight="bold">
3349
3623
  <xsl:apply-templates/>
3350
3624
  </fo:inline>
3351
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
3625
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3352
3626
  <fo:inline font-size="80%" vertical-align="super">
3353
3627
  <xsl:apply-templates/>
3354
3628
  </fo:inline>
3355
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
3629
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3356
3630
  <fo:inline font-size="80%" vertical-align="sub">
3357
3631
  <xsl:apply-templates/>
3358
3632
  </fo:inline>
3359
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
3633
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3360
3634
  <fo:inline font-family="Courier" font-size="10pt">
3361
3635
  <xsl:apply-templates/>
3362
3636
  </fo:inline>
3363
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
3637
+ </xsl:template><xsl:template match="*[local-name()='del']">
3364
3638
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3365
3639
  <xsl:apply-templates/>
3366
3640
  </fo:inline>
3367
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
3641
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3368
3642
  <xsl:variable name="text" select="normalize-space(.)"/>
3369
3643
  <fo:inline font-size="75%">
3370
3644
  <xsl:if test="string-length($text) &gt; 0">
@@ -3373,10 +3647,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3373
3647
  </xsl:call-template>
3374
3648
  </xsl:if>
3375
3649
  </fo:inline>
3376
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
3650
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3377
3651
  <xsl:param name="text"/>
3378
3652
  <xsl:variable name="char" select="substring($text,1,1)"/>
3379
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3653
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3654
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3380
3655
  <xsl:choose>
3381
3656
  <xsl:when test="$char=$upperCase">
3382
3657
  <fo:inline font-size="{100 div 0.75}%">
@@ -3392,7 +3667,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3392
3667
  <xsl:with-param name="text" select="substring($text,2)"/>
3393
3668
  </xsl:call-template>
3394
3669
  </xsl:if>
3395
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
3670
+ </xsl:template><xsl:template name="tokenize">
3396
3671
  <xsl:param name="text"/>
3397
3672
  <xsl:param name="separator" select="' '"/>
3398
3673
  <xsl:choose>
@@ -3440,7 +3715,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3440
3715
  </xsl:call-template>
3441
3716
  </xsl:otherwise>
3442
3717
  </xsl:choose>
3443
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
3718
+ </xsl:template><xsl:template name="max_length">
3444
3719
  <xsl:param name="words"/>
3445
3720
  <xsl:for-each select="$words//word">
3446
3721
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3448,11 +3723,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3448
3723
  <xsl:value-of select="."/>
3449
3724
  </xsl:if>
3450
3725
  </xsl:for-each>
3451
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
3726
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3452
3727
  <xsl:param name="text" select="."/>
3453
3728
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3454
3729
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3455
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
3730
+ </xsl:template><xsl:template name="add-zero-spaces">
3456
3731
  <xsl:param name="text" select="."/>
3457
3732
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3458
3733
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3505,7 +3780,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3505
3780
  <xsl:value-of select="$text"/>
3506
3781
  </xsl:otherwise>
3507
3782
  </xsl:choose>
3508
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
3783
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3509
3784
  <xsl:param name="text" select="."/>
3510
3785
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3511
3786
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3531,7 +3806,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3531
3806
  <xsl:value-of select="$text"/>
3532
3807
  </xsl:otherwise>
3533
3808
  </xsl:choose>
3534
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
3809
+ </xsl:template><xsl:template name="getSimpleTable">
3535
3810
  <xsl:variable name="simple-table">
3536
3811
 
3537
3812
  <!-- Step 1. colspan processing -->
@@ -3558,9 +3833,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3558
3833
  </xsl:choose> -->
3559
3834
  </xsl:variable>
3560
3835
  <xsl:copy-of select="$simple-table"/>
3561
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3836
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3562
3837
  <xsl:apply-templates mode="simple-table-colspan"/>
3563
- </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">
3838
+ </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">
3564
3839
  <xsl:choose>
3565
3840
  <xsl:when test="@colspan">
3566
3841
  <xsl:variable name="td">
@@ -3582,16 +3857,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3582
3857
  </xsl:element>
3583
3858
  </xsl:otherwise>
3584
3859
  </xsl:choose>
3585
- </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">
3860
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3586
3861
  <xsl:element name="tr">
3587
3862
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3588
3863
  <xsl:apply-templates mode="simple-table-colspan"/>
3589
3864
  </xsl:element>
3590
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
3865
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3591
3866
  <xsl:copy>
3592
3867
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3593
3868
  </xsl:copy>
3594
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
3869
+ </xsl:template><xsl:template name="repeatNode">
3595
3870
  <xsl:param name="count"/>
3596
3871
  <xsl:param name="node"/>
3597
3872
 
@@ -3602,18 +3877,18 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3602
3877
  </xsl:call-template>
3603
3878
  <xsl:copy-of select="$node"/>
3604
3879
  </xsl:if>
3605
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
3880
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3606
3881
  <xsl:copy>
3607
3882
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3608
3883
  </xsl:copy>
3609
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
3884
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3610
3885
  <xsl:copy>
3611
3886
  <xsl:copy-of select="tr[1]"/>
3612
3887
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3613
3888
  <xsl:with-param name="previousRow" select="tr[1]"/>
3614
3889
  </xsl:apply-templates>
3615
3890
  </xsl:copy>
3616
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
3891
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3617
3892
  <xsl:param name="previousRow"/>
3618
3893
  <xsl:variable name="currentRow" select="."/>
3619
3894
 
@@ -3647,43 +3922,53 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3647
3922
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3648
3923
  <xsl:with-param name="previousRow" select="$newRow"/>
3649
3924
  </xsl:apply-templates>
3650
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
3925
+ </xsl:template><xsl:template name="getLang">
3651
3926
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3652
3927
  <xsl:choose>
3653
3928
  <xsl:when test="$language = 'English'">en</xsl:when>
3654
3929
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3655
3930
  </xsl:choose>
3656
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
3931
+ </xsl:template><xsl:template name="capitalizeWords">
3657
3932
  <xsl:param name="str"/>
3658
3933
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3659
3934
  <xsl:choose>
3660
3935
  <xsl:when test="contains($str2, ' ')">
3661
3936
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3662
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3663
- <xsl:value-of select="substring($substr, 2)"/>
3937
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3938
+ <xsl:value-of select="substring($substr, 2)"/> -->
3939
+ <xsl:call-template name="capitalize">
3940
+ <xsl:with-param name="str" select="$substr"/>
3941
+ </xsl:call-template>
3664
3942
  <xsl:text> </xsl:text>
3665
3943
  <xsl:call-template name="capitalizeWords">
3666
3944
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3667
3945
  </xsl:call-template>
3668
3946
  </xsl:when>
3669
3947
  <xsl:otherwise>
3670
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3671
- <xsl:value-of select="substring($str2, 2)"/>
3948
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3949
+ <xsl:value-of select="substring($str2, 2)"/> -->
3950
+ <xsl:call-template name="capitalize">
3951
+ <xsl:with-param name="str" select="$str2"/>
3952
+ </xsl:call-template>
3672
3953
  </xsl:otherwise>
3673
3954
  </xsl:choose>
3674
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
3955
+ </xsl:template><xsl:template name="capitalize">
3956
+ <xsl:param name="str"/>
3957
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3958
+ <xsl:value-of select="substring($str, 2)"/>
3959
+ </xsl:template><xsl:template match="mathml:math">
3675
3960
  <fo:inline font-family="STIX2Math">
3676
3961
  <fo:instream-foreign-object fox:alt-text="Math">
3677
3962
  <xsl:copy-of select="."/>
3678
3963
  </fo:instream-foreign-object>
3679
3964
  </fo:inline>
3680
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
3965
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3681
3966
  <xsl:for-each select="*[local-name()='locality']">
3682
3967
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3683
3968
  <xsl:apply-templates select="."/>
3684
3969
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3685
3970
  </xsl:for-each>
3686
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
3971
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3687
3972
  <xsl:variable name="target">
3688
3973
  <xsl:choose>
3689
3974
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3713,7 +3998,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3713
3998
  </xsl:otherwise>
3714
3999
  </xsl:choose>
3715
4000
  </fo:inline>
3716
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
4001
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3717
4002
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3718
4003
  <!-- <xsl:choose>
3719
4004
  <xsl:when test="@lang = 'en'"></xsl:when>
@@ -3724,19 +4009,29 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3724
4009
  </xsl:choose> -->
3725
4010
  <xsl:apply-templates/>
3726
4011
  </fo:block>
3727
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
4012
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3728
4013
  <fo:inline id="{@id}"/>
3729
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
4014
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3730
4015
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4016
+ <xsl:variable name="title-appendix">
4017
+ <xsl:call-template name="getTitle">
4018
+ <xsl:with-param name="name" select="'title-appendix'"/>
4019
+ </xsl:call-template>
4020
+ </xsl:variable>
3731
4021
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3732
4022
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3733
4023
  </fo:block>
3734
4024
  <xsl:apply-templates/>
3735
- </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">
4025
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3736
4026
  <fo:inline><xsl:apply-templates/></fo:inline>
3737
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
4027
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3738
4028
  <fo:block xsl:use-attribute-sets="appendix-example-style">
3739
4029
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4030
+ <xsl:variable name="title-example">
4031
+ <xsl:call-template name="getTitle">
4032
+ <xsl:with-param name="name" select="'title-example'"/>
4033
+ </xsl:call-template>
4034
+ </xsl:variable>
3740
4035
  <xsl:value-of select="$title-example"/>
3741
4036
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3742
4037
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -3746,11 +4041,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3746
4041
  </xsl:if>
3747
4042
  </fo:block>
3748
4043
  <xsl:apply-templates/>
3749
- </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">
4044
+ </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">
3750
4045
  <fo:inline><xsl:apply-templates/></fo:inline>
3751
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
4046
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3752
4047
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3753
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
4048
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3754
4049
  <xsl:variable name="annotation-id" select="@id"/>
3755
4050
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3756
4051
  <fo:block id="{$annotation-id}" white-space="nowrap">
@@ -3760,14 +4055,25 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3760
4055
  </xsl:apply-templates>
3761
4056
  </fo:inline>
3762
4057
  </fo:block>
3763
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4058
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3764
4059
  <xsl:param name="callout"/>
3765
4060
  <fo:inline id="{@id}">
3766
4061
  <!-- for first p in annotation, put <x> -->
3767
4062
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3768
4063
  <xsl:apply-templates/>
3769
4064
  </fo:inline>
3770
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
4065
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4066
+ <xsl:variable name="title-modified">
4067
+ <xsl:call-template name="getTitle">
4068
+ <xsl:with-param name="name" select="'title-modified'"/>
4069
+ </xsl:call-template>
4070
+ </xsl:variable>
4071
+ <xsl:choose>
4072
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4073
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4074
+ </xsl:choose>
4075
+ <xsl:apply-templates/>
4076
+ </xsl:template><xsl:template name="convertDate">
3771
4077
  <xsl:param name="date"/>
3772
4078
  <xsl:param name="format" select="'short'"/>
3773
4079
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -3800,7 +4106,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3800
4106
  </xsl:choose>
3801
4107
  </xsl:variable>
3802
4108
  <xsl:value-of select="$result"/>
3803
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
4109
+ </xsl:template><xsl:template name="insertKeywords">
3804
4110
  <xsl:param name="sorting" select="'true'"/>
3805
4111
  <xsl:param name="charAtEnd" select="'.'"/>
3806
4112
  <xsl:param name="charDelim" select="', '"/>
@@ -3823,7 +4129,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3823
4129
  </xsl:for-each>
3824
4130
  </xsl:otherwise>
3825
4131
  </xsl:choose>
3826
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
4132
+ </xsl:template><xsl:template name="insertKeyword">
3827
4133
  <xsl:param name="charAtEnd"/>
3828
4134
  <xsl:param name="charDelim"/>
3829
4135
  <xsl:apply-templates/>
@@ -3831,4 +4137,105 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3831
4137
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3832
4138
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3833
4139
  </xsl:choose>
4140
+ </xsl:template><xsl:template name="addPDFUAmeta">
4141
+ <fo:declarations>
4142
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4143
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4144
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4145
+ </pdf:dictionary>
4146
+ </pdf:catalog>
4147
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4148
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4149
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4150
+ <!-- Dublin Core properties go here -->
4151
+ <dc:title>
4152
+ <xsl:variable name="title">
4153
+
4154
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4155
+
4156
+
4157
+
4158
+
4159
+ </xsl:variable>
4160
+ <xsl:choose>
4161
+ <xsl:when test="normalize-space($title) != ''">
4162
+ <xsl:value-of select="$title"/>
4163
+ </xsl:when>
4164
+ <xsl:otherwise>
4165
+ <xsl:text> </xsl:text>
4166
+ </xsl:otherwise>
4167
+ </xsl:choose>
4168
+ </dc:title>
4169
+ <dc:creator>
4170
+
4171
+
4172
+ </dc:creator>
4173
+ <dc:description>
4174
+ <xsl:variable name="abstract">
4175
+
4176
+
4177
+
4178
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4179
+
4180
+
4181
+ </xsl:variable>
4182
+ <xsl:value-of select="normalize-space($abstract)"/>
4183
+ </dc:description>
4184
+ <pdf:Keywords>
4185
+ <xsl:call-template name="insertKeywords"/>
4186
+ </pdf:Keywords>
4187
+ </rdf:Description>
4188
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4189
+ <!-- XMP properties go here -->
4190
+ <xmp:CreatorTool/>
4191
+ </rdf:Description>
4192
+ </rdf:RDF>
4193
+ </x:xmpmeta>
4194
+ </fo:declarations>
4195
+ </xsl:template><xsl:template name="getId">
4196
+ <xsl:choose>
4197
+ <xsl:when test="../@id">
4198
+ <xsl:value-of select="../@id"/>
4199
+ </xsl:when>
4200
+ <xsl:otherwise>
4201
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4202
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4203
+ </xsl:otherwise>
4204
+ </xsl:choose>
4205
+ </xsl:template><xsl:template name="getLevel">
4206
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4207
+ <xsl:variable name="level">
4208
+ <xsl:choose>
4209
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4210
+ <xsl:value-of select="$level_total - 2"/>
4211
+ </xsl:when>
4212
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4213
+ <xsl:value-of select="$level_total - 2"/>
4214
+ </xsl:when>
4215
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4216
+ <xsl:value-of select="$level_total - 2"/>
4217
+ </xsl:when>
4218
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4219
+ <xsl:otherwise>
4220
+ <xsl:value-of select="$level_total - 1"/>
4221
+ </xsl:otherwise>
4222
+ </xsl:choose>
4223
+ </xsl:variable>
4224
+ <xsl:value-of select="$level"/>
4225
+ </xsl:template><xsl:template name="getSubSection">
4226
+ <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']"/>
4227
+ </xsl:template><xsl:template name="split">
4228
+ <xsl:param name="pText" select="."/>
4229
+ <xsl:param name="sep" select="','"/>
4230
+ <xsl:if test="string-length($pText) &gt;0">
4231
+ <item>
4232
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4233
+ </item>
4234
+ <xsl:call-template name="split">
4235
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4236
+ <xsl:with-param name="sep" select="$sep"/>
4237
+ </xsl:call-template>
4238
+ </xsl:if>
4239
+ </xsl:template><xsl:template name="getDocumentId">
4240
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3834
4241
  </xsl:template></xsl:stylesheet>