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