metanorma-un 0.3.10 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1138,4 +1138,3 @@ ol
1138
1138
  ul
1139
1139
  {margin-bottom:0cm;
1140
1140
  margin-left:18pt;}
1141
-
@@ -84,8 +84,8 @@ module IsoDoc
84
84
  if node["inline-header"] == "true"
85
85
  inline_header_title(out, node, c1)
86
86
  else
87
- div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h|
88
- lbl = anchor(node['id'], :label, false)
87
+ div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
88
+ lbl = @xrefs.anchor(node['id'], :label, false)
89
89
  h << "#{lbl}. " if lbl && !@suppressheadingnumbers
90
90
  insert_tab(h, 1) if lbl && !@suppressheadingnumbers
91
91
  c1&.children&.each { |c2| parse(c2, h) }
@@ -22,20 +22,6 @@ module IsoDoc
22
22
  "un.plenary-attachment.xsl" : "unece.recommendation.xsl"
23
23
  end
24
24
  end
25
-
26
- def convert(filename, file = nil, debug = false)
27
- file = File.read(filename, encoding: "utf-8") if file.nil?
28
- docxml, outname_html, dir = convert_init(file, filename, debug)
29
- /\.xml$/.match(filename) or
30
- filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
31
- f.write file
32
- f.path
33
- end
34
- FileUtils.rm_rf dir
35
- ::Metanorma::Output::XslfoPdf.new.convert(
36
- filename, outname_html + ".pdf",
37
- File.join(@libdir, pdf_stylesheet(docxml)))
38
- end
39
25
  end
40
26
  end
41
27
  end
@@ -0,0 +1,10 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module UN
6
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ end
8
+ end
9
+ end
10
+
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:barcode="http://barcode4j.krysalis.org/ns" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:barcode="http://barcode4j.krysalis.org/ns" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -62,44 +62,7 @@
62
62
  </fo:page-sequence-master>
63
63
  </fo:layout-master-set>
64
64
 
65
- <fo:declarations>
66
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
67
- <pdf:dictionary type="normal" key="ViewerPreferences">
68
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
69
- </pdf:dictionary>
70
- </pdf:catalog>
71
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
72
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
73
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
74
- <!-- Dublin Core properties go here -->
75
- <dc:title>
76
- <xsl:choose>
77
- <xsl:when test="$title != ''">
78
- <xsl:value-of select="$title"/>
79
- </xsl:when>
80
- <xsl:otherwise>
81
- <xsl:text> </xsl:text>
82
- </xsl:otherwise>
83
- </xsl:choose>
84
- </dc:title>
85
- <dc:creator/>
86
- <dc:description>
87
- <xsl:variable name="abstract">
88
- <xsl:copy-of select="/un:un-standard/un:preface/un:abstract//text()"/>
89
- </xsl:variable>
90
- <xsl:value-of select="normalize-space($abstract)"/>
91
- </dc:description>
92
- <pdf:Keywords>
93
- <xsl:call-template name="insertKeywords"/>
94
- </pdf:Keywords>
95
- </rdf:Description>
96
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
97
- <!-- XMP properties go here -->
98
- <xmp:CreatorTool/>
99
- </rdf:Description>
100
- </rdf:RDF>
101
- </x:xmpmeta>
102
- </fo:declarations>
65
+ <xsl:call-template name="addPDFUAmeta"/>
103
66
 
104
67
  <!-- Cover Page -->
105
68
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -170,7 +133,7 @@
170
133
  <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:session/un:date"/>
171
134
  </fo:block>
172
135
  <fo:block font-weight="normal">
173
- <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:title, $upper, $lower)"/>
136
+ <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new(/un:un-standard/un:sections/un:clause[1]/un:title))"/>
174
137
  </fo:block>
175
138
  <fo:block>
176
139
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
@@ -301,14 +264,7 @@
301
264
  <!-- Any node with title element - clause, definition, annex,... -->
302
265
  <xsl:template match="un:title | un:preferred" mode="contents">
303
266
  <xsl:variable name="id">
304
- <xsl:choose>
305
- <xsl:when test="../@id">
306
- <xsl:value-of select="../@id"/>
307
- </xsl:when>
308
- <xsl:otherwise>
309
- <xsl:value-of select="text()"/>
310
- </xsl:otherwise>
311
- </xsl:choose>
267
+ <xsl:call-template name="getId"/>
312
268
  </xsl:variable>
313
269
 
314
270
  <xsl:variable name="level">
@@ -331,7 +287,12 @@
331
287
  <item id="{$id}" level="{$level}" section="{$section}" display="false" type="{$type}">
332
288
  <xsl:if test="$type = 'clause'">
333
289
  <xsl:attribute name="section">
334
- <xsl:text>Clause </xsl:text>
290
+ <xsl:variable name="title-clause">
291
+ <xsl:call-template name="getTitle">
292
+ <xsl:with-param name="name" select="'title-clause'"/>
293
+ </xsl:call-template>
294
+ </xsl:variable>
295
+ <xsl:value-of select="$title-clause"/>
335
296
  <xsl:choose>
336
297
  <xsl:when test="ancestor::un:sections">
337
298
  <!-- 1, 2, 3, 4, ... from main section (not annex ...) -->
@@ -355,7 +316,12 @@
355
316
  <xsl:when test="ancestor::un:annex">
356
317
  <xsl:choose>
357
318
  <xsl:when test="$level = 1">
358
- <xsl:text>Annex </xsl:text>
319
+ <xsl:variable name="title-annex">
320
+ <xsl:call-template name="getTitle">
321
+ <xsl:with-param name="name" select="'title-annex'"/>
322
+ </xsl:call-template>
323
+ </xsl:variable>
324
+ <xsl:value-of select="$title-annex"/>
359
325
  <xsl:number format="A" level="any" count="un:annex"/>
360
326
  </xsl:when>
361
327
  <xsl:otherwise>
@@ -386,7 +352,12 @@
386
352
  <xsl:template match="un:figure" mode="contents">
387
353
  <item level="" id="{@id}" type="figure">
388
354
  <xsl:attribute name="section">
389
- <xsl:text>Figure </xsl:text>
355
+ <xsl:variable name="title-figure">
356
+ <xsl:call-template name="getTitle">
357
+ <xsl:with-param name="name" select="'title-figure'"/>
358
+ </xsl:call-template>
359
+ </xsl:variable>
360
+ <xsl:value-of select="$title-figure"/>
390
361
  <xsl:choose>
391
362
  <xsl:when test="ancestor::un:annex">
392
363
  <xsl:choose>
@@ -418,7 +389,12 @@
418
389
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
419
390
  <item level="" id="{@id}" display="false" type="table">
420
391
  <xsl:attribute name="section">
421
- <xsl:text>Table </xsl:text>
392
+ <xsl:variable name="title-table">
393
+ <xsl:call-template name="getTitle">
394
+ <xsl:with-param name="name" select="'title-table'"/>
395
+ </xsl:call-template>
396
+ </xsl:variable>
397
+ <xsl:value-of select="$title-table"/>
422
398
  <xsl:choose>
423
399
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
424
400
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -441,7 +417,12 @@
441
417
  <xsl:template match="un:formula" mode="contents">
442
418
  <item level="" id="{@id}" display="false">
443
419
  <xsl:attribute name="section">
444
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="un:annex | un:formula"/><xsl:text>)</xsl:text>
420
+ <xsl:variable name="title-formula">
421
+ <xsl:call-template name="getTitle">
422
+ <xsl:with-param name="name" select="'title-formula'"/>
423
+ </xsl:call-template>
424
+ </xsl:variable>
425
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="un:annex | un:formula"/>
445
426
  </xsl:attribute>
446
427
  </item>
447
428
  </xsl:template>
@@ -470,7 +451,12 @@
470
451
  <item level="" id="{@id}" display="false" type="Terms">
471
452
  <xsl:if test="ancestor::un:annex">
472
453
  <xsl:attribute name="section">
473
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
454
+ <xsl:variable name="title-appendix">
455
+ <xsl:call-template name="getTitle">
456
+ <xsl:with-param name="name" select="'title-appendix'"/>
457
+ </xsl:call-template>
458
+ </xsl:variable>
459
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
474
460
  </xsl:attribute>
475
461
  </xsl:if>
476
462
  </item>
@@ -480,7 +466,12 @@
480
466
  <item level="" id="{@id}" display="false" type="References">
481
467
  <xsl:if test="ancestor::un:annex">
482
468
  <xsl:attribute name="section">
483
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
469
+ <xsl:variable name="title-appendix">
470
+ <xsl:call-template name="getTitle">
471
+ <xsl:with-param name="name" select="'title-appendix'"/>
472
+ </xsl:call-template>
473
+ </xsl:variable>
474
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
484
475
  </xsl:attribute>
485
476
  </xsl:if>
486
477
  </item>
@@ -492,7 +483,12 @@
492
483
  <xsl:variable name="num">
493
484
  <xsl:number/>
494
485
  </xsl:variable>
495
- <xsl:text>Box </xsl:text><xsl:value-of select="$num"/>
486
+ <xsl:variable name="title-box">
487
+ <xsl:call-template name="getTitle">
488
+ <xsl:with-param name="name" select="'title-box'"/>
489
+ </xsl:call-template>
490
+ </xsl:variable>
491
+ <xsl:value-of select="$title-box"/><xsl:value-of select="$num"/>
496
492
  </xsl:attribute>
497
493
  </item>
498
494
  </xsl:template>
@@ -514,7 +510,12 @@
514
510
  <fo:table-body>
515
511
  <fo:table-row>
516
512
  <fo:table-cell padding-left="6mm" padding-top="2.5mm">
517
- <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt">Summary</fo:block>
513
+ <xsl:variable name="title-summary">
514
+ <xsl:call-template name="getTitle">
515
+ <xsl:with-param name="name" select="'title-summary'"/>
516
+ </xsl:call-template>
517
+ </xsl:variable>
518
+ <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-summary"/></fo:block>
518
519
  </fo:table-cell>
519
520
  <fo:table-cell>
520
521
  <fo:block> </fo:block>
@@ -661,7 +662,12 @@
661
662
  <xsl:template match="un:ul//un:note | un:ol//un:note"/>
662
663
  <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process">
663
664
  <fo:block font-size="11pt" margin-top="4pt">
664
- <xsl:text>NOTE </xsl:text>
665
+ <xsl:variable name="title-note">
666
+ <xsl:call-template name="getTitle">
667
+ <xsl:with-param name="name" select="'title-note'"/>
668
+ </xsl:call-template>
669
+ </xsl:variable>
670
+ <xsl:value-of select="$title-note"/>
665
671
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
666
672
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
667
673
  </xsl:if>
@@ -743,16 +749,24 @@
743
749
  </xsl:template>
744
750
 
745
751
  <xsl:template match="un:admonition">
752
+ <xsl:variable name="title-box">
753
+ <xsl:call-template name="getTitle">
754
+ <xsl:with-param name="name" select="'title-box'"/>
755
+ </xsl:call-template>
756
+ </xsl:variable>
746
757
  <fo:block text-align="center" font-style="italic" keep-with-next="always" margin-bottom="6pt">
747
- <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
758
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
748
759
  </fo:block>
749
760
  <fo:block-container border="0.25pt solid black" margin-left="-3mm" margin-right="-3mm" padding-top="4mm">
750
761
  <fo:block id="{@id}" font-weight="bold" margin-left="6mm" margin-right="6mm" keep-with-next="always">
751
- <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
752
- </fo:block>
753
- <fo:block margin-left="5mm" margin-right="5mm">
754
- <xsl:apply-templates/>
762
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
755
763
  </fo:block>
764
+ <!-- <fo:block margin-left="5mm" margin-right="5mm"> -->
765
+ <fo:block-container margin-left="2mm" margin-right="2mm">
766
+ <fo:block-container margin-left="0mm" margin-right="0mm">
767
+ <xsl:apply-templates/>
768
+ </fo:block-container>
769
+ </fo:block-container>
756
770
  </fo:block-container>
757
771
  <fo:block margin-bottom="4pt"> </fo:block>
758
772
  </xsl:template>
@@ -815,14 +829,7 @@
815
829
 
816
830
  <xsl:template match="un:title">
817
831
  <xsl:variable name="id">
818
- <xsl:choose>
819
- <xsl:when test="../@id">
820
- <xsl:value-of select="../@id"/>
821
- </xsl:when>
822
- <xsl:otherwise>
823
- <xsl:value-of select="text()"/>
824
- </xsl:otherwise>
825
- </xsl:choose>
832
+ <xsl:call-template name="getId"/>
826
833
  </xsl:variable>
827
834
 
828
835
  <xsl:variable name="level">
@@ -933,7 +940,12 @@
933
940
  <xsl:template match="un:recommendation">
934
941
  <fo:block margin-left="20mm">
935
942
  <fo:block font-weight="bold">
936
- <xsl:text>Recommendation </xsl:text>
943
+ <xsl:variable name="title-recommendation">
944
+ <xsl:call-template name="getTitle">
945
+ <xsl:with-param name="name" select="'title-recommendation'"/>
946
+ </xsl:call-template>
947
+ </xsl:variable>
948
+ <xsl:value-of select="$title-recommendation"/>
937
949
  <xsl:choose>
938
950
  <xsl:when test="ancestor::un:sections">
939
951
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1003,7 +1015,12 @@
1003
1015
  </fo:block>
1004
1016
  <xsl:if test="un:name">
1005
1017
  <fo:block text-align="center" margin-bottom="6pt" keep-with-previous="always">
1006
- <xsl:text>Figure </xsl:text>
1018
+ <xsl:variable name="title-figure">
1019
+ <xsl:call-template name="getTitle">
1020
+ <xsl:with-param name="name" select="'title-figure'"/>
1021
+ </xsl:call-template>
1022
+ </xsl:variable>
1023
+ <xsl:value-of select="$title-figure"/>
1007
1024
  <xsl:choose>
1008
1025
  <xsl:when test="ancestor::un:annex">
1009
1026
  <xsl:choose>
@@ -1134,7 +1151,23 @@
1134
1151
 
1135
1152
  <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note">
1136
1153
  <fo:block font-size="10pt" space-after="12pt" text-indent="0">
1137
- <fo:inline padding-right="4mm"><xsl:text>NOTE </xsl:text>
1154
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
1155
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1156
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1157
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
1158
+ <fo:inline>
1159
+ <xsl:call-template name="capitalize">
1160
+ <xsl:with-param name="str" select="../@type"/>
1161
+ </xsl:call-template>
1162
+ <xsl:text>: </xsl:text>
1163
+ </fo:inline>
1164
+ </xsl:if>
1165
+ <xsl:variable name="title-note">
1166
+ <xsl:call-template name="getTitle">
1167
+ <xsl:with-param name="name" select="'title-note'"/>
1168
+ </xsl:call-template>
1169
+ </xsl:variable>
1170
+ <fo:inline padding-right="4mm"><xsl:value-of select="$title-note"/>
1138
1171
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
1139
1172
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
1140
1173
  </xsl:if>
@@ -1145,12 +1178,17 @@
1145
1178
 
1146
1179
  <xsl:template match="un:termnote">
1147
1180
  <fo:block margin-top="4pt">
1148
- <xsl:text>NOTE </xsl:text>
1149
- <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1150
- <xsl:number/><xsl:text> </xsl:text>
1151
- </xsl:if>
1152
- <xsl:text>– </xsl:text>
1153
- <xsl:apply-templates/>
1181
+ <xsl:variable name="title-note">
1182
+ <xsl:call-template name="getTitle">
1183
+ <xsl:with-param name="name" select="'title-note'"/>
1184
+ </xsl:call-template>
1185
+ </xsl:variable>
1186
+ <xsl:value-of select="$title-note"/>
1187
+ <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1188
+ <xsl:number/><xsl:text> </xsl:text>
1189
+ </xsl:if>
1190
+ <xsl:text>– </xsl:text>
1191
+ <xsl:apply-templates/>
1154
1192
  </fo:block>
1155
1193
  </xsl:template>
1156
1194
 
@@ -1178,7 +1216,7 @@
1178
1216
  <fo:table-cell> <!-- display-align="center" -->
1179
1217
  <fo:block text-align="right">
1180
1218
  <xsl:if test="not(ancestor::un:annex)">
1181
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1219
+ <xsl:number format="(1)" level="any"/>
1182
1220
  </xsl:if>
1183
1221
  <xsl:if test="ancestor::un:annex">
1184
1222
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1202,7 +1240,12 @@
1202
1240
  </xsl:template>
1203
1241
 
1204
1242
  <xsl:template match="un:example">
1205
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1243
+ <xsl:variable name="title-example">
1244
+ <xsl:call-template name="getTitle">
1245
+ <xsl:with-param name="name" select="'title-example'"/>
1246
+ </xsl:call-template>
1247
+ </xsl:variable>
1248
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1206
1249
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1207
1250
  <xsl:apply-templates/>
1208
1251
  </fo:block>
@@ -1229,7 +1272,7 @@
1229
1272
  <xsl:if test="@type = 'inline'">
1230
1273
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1231
1274
  </xsl:if>
1232
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1275
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1233
1276
 
1234
1277
  <xsl:apply-templates select="un:localityStack"/>
1235
1278
 
@@ -1238,9 +1281,19 @@
1238
1281
  </xsl:template>
1239
1282
 
1240
1283
  <xsl:template match="un:locality">
1284
+ <xsl:variable name="title-section">
1285
+ <xsl:call-template name="getTitle">
1286
+ <xsl:with-param name="name" select="'title-section'"/>
1287
+ </xsl:call-template>
1288
+ </xsl:variable>
1289
+ <xsl:variable name="title-clause">
1290
+ <xsl:call-template name="getTitle">
1291
+ <xsl:with-param name="name" select="'title-clause'"/>
1292
+ </xsl:call-template>
1293
+ </xsl:variable>
1241
1294
  <xsl:choose>
1242
- <xsl:when test="@type = 'section'">Section </xsl:when>
1243
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
1295
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1296
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1244
1297
  <xsl:otherwise/>
1245
1298
  </xsl:choose>
1246
1299
  <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
@@ -1259,7 +1312,7 @@
1259
1312
  </fo:block>
1260
1313
  </xsl:template>
1261
1314
  <xsl:template match="un:term" mode="table">
1262
- <fo:table-row>
1315
+ <fo:table-row id="{@id}">
1263
1316
  <fo:table-cell padding-right="1mm">
1264
1317
  <fo:block margin-bottom="12pt">
1265
1318
  <xsl:apply-templates select="un:preferred"/>
@@ -1273,7 +1326,7 @@
1273
1326
  </fo:table-row>
1274
1327
  </xsl:template>
1275
1328
  <xsl:template match="un:preferred">
1276
- <fo:inline id="{../@id}">
1329
+ <fo:inline>
1277
1330
  <xsl:apply-templates/>
1278
1331
  </fo:inline>
1279
1332
  </xsl:template>
@@ -1400,29 +1453,6 @@
1400
1453
  </fo:static-content>
1401
1454
  </xsl:template>
1402
1455
 
1403
-
1404
- <xsl:template name="getLevel">
1405
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1406
- <xsl:variable name="level">
1407
- <xsl:choose>
1408
- <xsl:when test="ancestor::un:preface">
1409
- <xsl:value-of select="$level_total - 2"/>
1410
- </xsl:when>
1411
- <xsl:when test="ancestor::un:sections">
1412
- <xsl:value-of select="$level_total - 2"/>
1413
- </xsl:when>
1414
- <xsl:when test="ancestor::un:bibliography">
1415
- <xsl:value-of select="$level_total - 2"/>
1416
- </xsl:when>
1417
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1418
- <xsl:otherwise>
1419
- <xsl:value-of select="$level_total - 1"/>
1420
- </xsl:otherwise>
1421
- </xsl:choose>
1422
- </xsl:variable>
1423
- <xsl:value-of select="$level"/>
1424
- </xsl:template>
1425
-
1426
1456
  <xsl:template name="getSection">
1427
1457
  <xsl:variable name="level">
1428
1458
  <xsl:call-template name="getLevel"/>
@@ -1450,12 +1480,17 @@
1450
1480
  <xsl:when test="ancestor::un:annex">
1451
1481
  <xsl:choose>
1452
1482
  <xsl:when test="$level = 1">
1483
+ <xsl:variable name="title-annex">
1484
+ <xsl:call-template name="getTitle">
1485
+ <xsl:with-param name="name" select="'title-annex'"/>
1486
+ </xsl:call-template>
1487
+ </xsl:variable>
1453
1488
  <xsl:choose>
1454
1489
  <xsl:when test="local-name() = 'title'">
1455
- <xsl:text>ANNEX </xsl:text>
1490
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-annex))"/>
1456
1491
  <xsl:number format="A" level="any" count="un:annex"/>
1457
1492
  </xsl:when>
1458
- <xsl:otherwise>Annex</xsl:otherwise>
1493
+ <xsl:otherwise><xsl:value-of select="normalize-space($title-annex)"/></xsl:otherwise>
1459
1494
  </xsl:choose>
1460
1495
  </xsl:when>
1461
1496
  <xsl:otherwise>
@@ -1556,8 +1591,10 @@
1556
1591
  </xsl:choose>
1557
1592
  </xsl:variable>
1558
1593
  <xsl:choose>
1559
- <xsl:when test="$first = 'true'">
1560
- <xsl:value-of select="translate(substring($value, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($value, 2)"/>
1594
+ <xsl:when test="$first = 'true'">
1595
+ <xsl:call-template name="capitalize">
1596
+ <xsl:with-param name="str" select="$value"/>
1597
+ </xsl:call-template>
1561
1598
  </xsl:when>
1562
1599
  <xsl:otherwise>
1563
1600
  <xsl:value-of select="$value"/>
@@ -1591,17 +1628,6 @@
1591
1628
  <xsl:variable name="result" select="normalize-space(concat($day, ' ', $monthStr, ' ', $year))"/>
1592
1629
  <xsl:value-of select="$result"/>
1593
1630
  </xsl:template>
1594
-
1595
- <xsl:template name="getLanguage">
1596
- <xsl:param name="lang"/>
1597
- <xsl:variable name="language" select="translate($lang, $upper, $lower)"/>
1598
- <xsl:choose>
1599
- <xsl:when test="$language = 'en'">English</xsl:when>
1600
- <xsl:when test="$language = 'de'">Deutsch</xsl:when>
1601
- <xsl:when test="$language = 'cn'">Chinese</xsl:when>
1602
- <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
1603
- </xsl:choose>
1604
- </xsl:template>
1605
1631
 
1606
1632
  <xsl:variable name="Image-Logo">
1607
1633
  <xsl:text>
@@ -2461,47 +2487,186 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2461
2487
  </xsl:text>
2462
2488
  </xsl:variable>
2463
2489
 
2464
- <xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table">
2490
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2491
+
2492
+ <title-table lang="en">Table </title-table>
2493
+ <title-table lang="fr">Tableau </title-table>
2494
+
2495
+ <title-table lang="zh">Table </title-table>
2496
+
2497
+
2498
+
2499
+ <title-note lang="en">NOTE </title-note>
2500
+ <title-note lang="fr">NOTE </title-note>
2501
+
2502
+ <title-note lang="zh">NOTE </title-note>
2503
+
2504
+
2505
+
2506
+ <title-figure lang="en">Figure </title-figure>
2507
+ <title-figure lang="fr">Figure </title-figure>
2508
+
2509
+ <title-figure lang="zh">Figure </title-figure>
2510
+
2511
+
2512
+
2513
+ <title-example lang="en">EXAMPLE </title-example>
2514
+ <title-example lang="fr">EXEMPLE </title-example>
2515
+
2516
+ <title-example lang="zh">EXAMPLE </title-example>
2517
+
2518
+
2519
+
2520
+ <title-example-xref lang="en">Example </title-example-xref>
2521
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2522
+
2523
+ <title-section lang="en">Section </title-section>
2524
+ <title-section lang="fr">Section </title-section>
2525
+
2526
+ <title-inequality lang="en">Inequality </title-inequality>
2527
+ <title-inequality lang="fr">Inequality </title-inequality>
2528
+
2529
+ <title-equation lang="en">Equation </title-equation>
2530
+ <title-equation lang="fr">Equation </title-equation>
2531
+
2532
+ <title-annex lang="en">Annex </title-annex>
2533
+ <title-annex lang="fr">Annexe </title-annex>
2534
+
2535
+ <title-annex lang="zh">Annex </title-annex>
2536
+
2537
+
2538
+
2539
+ <title-appendix lang="en">Appendix </title-appendix>
2540
+ <title-appendix lang="fr">Appendix </title-appendix>
2541
+
2542
+ <title-clause lang="en">Clause </title-clause>
2543
+ <title-clause lang="fr">Article </title-clause>
2465
2544
 
2466
- <xsl:text>Table </xsl:text>
2545
+ <title-clause lang="zh">Clause </title-clause>
2467
2546
 
2468
2547
 
2469
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
2470
2548
 
2471
- <xsl:text>NOTE </xsl:text>
2549
+ <title-edition lang="en">
2550
+
2551
+ <xsl:text>Edition </xsl:text>
2552
+
2553
+
2554
+ </title-edition>
2555
+
2556
+ <title-formula lang="en">Formula </title-formula>
2557
+ <title-formula lang="fr">Formula </title-formula>
2558
+
2559
+ <title-toc lang="en">
2560
+
2561
+
2562
+
2563
+ </title-toc>
2564
+ <title-toc lang="fr">Sommaire</title-toc>
2565
+
2566
+ <title-toc lang="zh">Contents</title-toc>
2567
+
2568
+
2569
+
2570
+ <title-page lang="en">Page</title-page>
2571
+ <title-page lang="fr">Page</title-page>
2572
+
2573
+ <title-key lang="en">Key</title-key>
2574
+ <title-key lang="fr">Légende</title-key>
2575
+
2576
+ <title-where lang="en">where</title-where>
2577
+ <title-where lang="fr">où</title-where>
2578
+
2579
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2580
+
2581
+ <title-part lang="en">
2582
+
2583
+
2584
+ </title-part>
2585
+ <title-part lang="fr">
2586
+
2587
+
2588
+ </title-part>
2589
+ <title-part lang="zh">第 # 部分:</title-part>
2472
2590
 
2591
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2592
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2473
2593
 
2474
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
2594
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2475
2595
 
2476
- <xsl:text>Figure </xsl:text>
2477
2596
 
2478
2597
 
2479
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
2598
+ <title-modified lang="en">modified</title-modified>
2599
+ <title-modified lang="fr">modifiée</title-modified>
2480
2600
 
2481
- <xsl:text>EXAMPLE </xsl:text>
2601
+ <title-modified lang="zh">modified</title-modified>
2482
2602
 
2483
2603
 
2484
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex">
2485
2604
 
2486
- <xsl:text>Annex </xsl:text>
2605
+ <title-source lang="en">SOURCE</title-source>
2487
2606
 
2607
+ <title-keywords lang="en">Keywords</title-keywords>
2488
2608
 
2489
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
2490
- <xsl:text>Appendix </xsl:text>
2491
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">
2609
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2610
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2492
2611
 
2493
- <xsl:text>Clause </xsl:text>
2612
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2494
2613
 
2614
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2495
2615
 
2496
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
2497
- <xsl:text>Edition </xsl:text>
2498
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">
2616
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2499
2617
 
2618
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2500
2619
 
2501
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style">
2620
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2502
2621
 
2622
+ <title-abstract lang="en">Abstract</title-abstract>
2503
2623
 
2504
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
2624
+ <title-summary lang="en">Summary</title-summary>
2625
+
2626
+ <title-in lang="en">in </title-in>
2627
+
2628
+ <title-box lang="en">Box </title-box>
2629
+
2630
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2631
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2632
+
2633
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2634
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2635
+
2636
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2637
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2638
+
2639
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2640
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2641
+
2642
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2643
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2644
+
2645
+ <title-caution lang="en">CAUTION</title-caution>
2646
+ <title-caution lang="zh">注意</title-caution>
2647
+
2648
+ <title-warning lang="en">WARNING</title-warning>
2649
+ <title-warning lang="zh">警告</title-warning>
2650
+
2651
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2652
+ </xsl:variable><xsl:template name="getTitle">
2653
+ <xsl:param name="name"/>
2654
+ <xsl:variable name="lang">
2655
+ <xsl:call-template name="getLang"/>
2656
+ </xsl:variable>
2657
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2658
+ <xsl:choose>
2659
+ <xsl:when test="normalize-space($title_) != ''">
2660
+ <xsl:value-of select="$title_"/>
2661
+ </xsl:when>
2662
+ <xsl:otherwise>
2663
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2664
+ </xsl:otherwise>
2665
+ </xsl:choose>
2666
+ </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">
2667
+
2668
+
2669
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2505
2670
 
2506
2671
 
2507
2672
 
@@ -2515,22 +2680,22 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2515
2680
 
2516
2681
 
2517
2682
 
2518
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">
2683
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2519
2684
 
2520
2685
 
2521
2686
 
2522
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">
2687
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2523
2688
 
2524
2689
 
2525
2690
 
2526
- </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
2691
+ </xsl:attribute-set><xsl:template match="text()">
2527
2692
  <xsl:value-of select="."/>
2528
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
2693
+ </xsl:template><xsl:template match="*[local-name()='br']">
2529
2694
  <xsl:value-of select="$linebreak"/>
2530
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2695
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2531
2696
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2532
2697
  <xsl:call-template name="add-zero-spaces-java"/>
2533
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">
2698
+ </xsl:template><xsl:template match="*[local-name()='table']">
2534
2699
 
2535
2700
  <xsl:variable name="simple-table">
2536
2701
  <!-- <xsl:copy> -->
@@ -2568,7 +2733,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2568
2733
 
2569
2734
 
2570
2735
 
2571
-
2736
+ <xsl:variable name="title-table">
2737
+ <xsl:call-template name="getTitle">
2738
+ <xsl:with-param name="name" select="'title-table'"/>
2739
+ </xsl:call-template>
2740
+ </xsl:variable>
2572
2741
  <xsl:value-of select="$title-table"/>
2573
2742
 
2574
2743
  <xsl:call-template name="getTableNumber"/>
@@ -2669,13 +2838,22 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2669
2838
  </xsl:otherwise>
2670
2839
  </xsl:choose>
2671
2840
  </xsl:for-each>
2672
- <xsl:apply-templates/>
2841
+
2842
+ <xsl:choose>
2843
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2844
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2845
+ </xsl:when>
2846
+ <xsl:otherwise>
2847
+ <xsl:apply-templates/>
2848
+ </xsl:otherwise>
2849
+ </xsl:choose>
2850
+
2673
2851
  </fo:table>
2674
2852
 
2675
2853
 
2676
2854
 
2677
2855
  </fo:block-container>
2678
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
2856
+ </xsl:template><xsl:template name="getTableNumber">
2679
2857
  <xsl:choose>
2680
2858
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2681
2859
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -2702,15 +2880,15 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2702
2880
 
2703
2881
  </xsl:otherwise>
2704
2882
  </xsl:choose>
2705
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2883
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2706
2884
  <xsl:apply-templates/>
2707
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
2885
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2708
2886
  <xsl:param name="table-row"/>
2709
2887
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2710
2888
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2711
2889
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2712
2890
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2713
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
2891
+ </xsl:template><xsl:template name="calculate-column-widths">
2714
2892
  <xsl:param name="table"/>
2715
2893
  <xsl:param name="cols-count"/>
2716
2894
  <xsl:param name="curr-col" select="1"/>
@@ -2808,23 +2986,27 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2808
2986
  <xsl:with-param name="table" select="$table"/>
2809
2987
  </xsl:call-template>
2810
2988
  </xsl:if>
2811
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
2989
+ </xsl:template><xsl:template match="text()" mode="td_text">
2812
2990
  <xsl:variable name="zero-space">​</xsl:variable>
2813
2991
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2814
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
2992
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2815
2993
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2816
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
2994
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2817
2995
  <xsl:value-of select="@target"/>
2818
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process">
2996
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2819
2997
  <xsl:param name="cols-count"/>
2820
2998
  <!-- font-weight="bold" -->
2821
2999
  <fo:table-header>
2822
3000
 
2823
3001
  <xsl:apply-templates/>
2824
3002
  </fo:table-header>
2825
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process">
3003
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3004
+ <fo:table-body>
3005
+ <xsl:apply-templates/>
3006
+ </fo:table-body>
3007
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2826
3008
  <xsl:apply-templates/>
2827
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
3009
+ </xsl:template><xsl:template name="insertTableFooter">
2828
3010
  <xsl:param name="cols-count"/>
2829
3011
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2830
3012
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -2864,7 +3046,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2864
3046
  </fo:table-footer>
2865
3047
 
2866
3048
  </xsl:if>
2867
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">
3049
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2868
3050
 
2869
3051
  <xsl:variable name="cols-count">
2870
3052
  <xsl:choose>
@@ -2895,7 +3077,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2895
3077
 
2896
3078
  </fo:table-body>
2897
3079
 
2898
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
3080
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2899
3081
  <xsl:variable name="parent-name" select="local-name(..)"/>
2900
3082
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2901
3083
  <fo:table-row min-height="4mm">
@@ -2919,7 +3101,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2919
3101
 
2920
3102
  <xsl:apply-templates/>
2921
3103
  </fo:table-row>
2922
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
3104
+ </xsl:template><xsl:template match="*[local-name()='th']">
2923
3105
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2924
3106
 
2925
3107
 
@@ -2951,7 +3133,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2951
3133
  <xsl:apply-templates/>
2952
3134
  </fo:block>
2953
3135
  </fo:table-cell>
2954
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
3136
+ </xsl:template><xsl:template match="*[local-name()='td']">
2955
3137
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2956
3138
 
2957
3139
 
@@ -2996,7 +3178,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2996
3178
 
2997
3179
 
2998
3180
  </fo:table-cell>
2999
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3181
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3000
3182
 
3001
3183
 
3002
3184
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3007,6 +3189,22 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3007
3189
  <fo:inline padding-right="2mm">
3008
3190
 
3009
3191
 
3192
+
3193
+ <xsl:if test="@type = 'source' or @type = 'abbreviation'">
3194
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
3195
+ <fo:inline>
3196
+ <xsl:call-template name="capitalize">
3197
+ <xsl:with-param name="str" select="@type"/>
3198
+ </xsl:call-template>
3199
+ <xsl:text>: </xsl:text>
3200
+ </fo:inline>
3201
+ </xsl:if>
3202
+
3203
+ <xsl:variable name="title-note">
3204
+ <xsl:call-template name="getTitle">
3205
+ <xsl:with-param name="name" select="'title-note'"/>
3206
+ </xsl:call-template>
3207
+ </xsl:variable>
3010
3208
  <xsl:value-of select="$title-note"/>
3011
3209
 
3012
3210
 
@@ -3017,9 +3215,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3017
3215
  <xsl:apply-templates mode="process"/>
3018
3216
  </fo:block>
3019
3217
 
3020
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3218
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3021
3219
  <xsl:apply-templates/>
3022
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
3220
+ </xsl:template><xsl:template name="fn_display">
3023
3221
  <xsl:variable name="references">
3024
3222
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3025
3223
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3056,7 +3254,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3056
3254
  </fo:block>
3057
3255
  </xsl:if>
3058
3256
  </xsl:for-each>
3059
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
3257
+ </xsl:template><xsl:template name="fn_name_display">
3060
3258
  <!-- <xsl:variable name="references">
3061
3259
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3062
3260
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3072,7 +3270,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3072
3270
  <xsl:apply-templates/>
3073
3271
  </fo:block>
3074
3272
  </xsl:for-each>
3075
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
3273
+ </xsl:template><xsl:template name="fn_display_figure">
3076
3274
  <xsl:variable name="key_iso">
3077
3275
  <!-- and (not(@class) or @class !='pseudocode') -->
3078
3276
  </xsl:variable>
@@ -3083,6 +3281,36 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3083
3281
  </fn>
3084
3282
  </xsl:for-each>
3085
3283
  </xsl:variable>
3284
+
3285
+ <!-- current hierarchy is 'figure' element -->
3286
+ <xsl:variable name="following_dl_colwidths">
3287
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3288
+ <xsl:variable name="html-table">
3289
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3290
+ <xsl:element name="{$ns}:table">
3291
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3292
+ <tbody>
3293
+ <xsl:apply-templates mode="dl"/>
3294
+ </tbody>
3295
+ </xsl:for-each>
3296
+ </xsl:element>
3297
+ </xsl:variable>
3298
+
3299
+ <xsl:call-template name="calculate-column-widths">
3300
+ <xsl:with-param name="cols-count" select="2"/>
3301
+ <xsl:with-param name="table" select="$html-table"/>
3302
+ </xsl:call-template>
3303
+
3304
+ </xsl:if>
3305
+ </xsl:variable>
3306
+
3307
+
3308
+ <xsl:variable name="maxlength_dt">
3309
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3310
+ <xsl:call-template name="getMaxLength_dt"/>
3311
+ </xsl:for-each>
3312
+ </xsl:variable>
3313
+
3086
3314
  <xsl:if test="xalan:nodeset($references)//fn">
3087
3315
  <fo:block>
3088
3316
  <fo:table width="95%" table-layout="fixed">
@@ -3090,8 +3318,19 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3090
3318
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3091
3319
 
3092
3320
  </xsl:if>
3093
- <fo:table-column column-width="15%"/>
3094
- <fo:table-column column-width="85%"/>
3321
+ <xsl:choose>
3322
+ <!-- if there 'dl', then set same columns width -->
3323
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3324
+ <xsl:call-template name="setColumnWidth_dl">
3325
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3326
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3327
+ </xsl:call-template>
3328
+ </xsl:when>
3329
+ <xsl:otherwise>
3330
+ <fo:table-column column-width="15%"/>
3331
+ <fo:table-column column-width="85%"/>
3332
+ </xsl:otherwise>
3333
+ </xsl:choose>
3095
3334
  <fo:table-body>
3096
3335
  <xsl:for-each select="xalan:nodeset($references)//fn">
3097
3336
  <xsl:variable name="reference" select="@reference"/>
@@ -3123,7 +3362,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3123
3362
  </fo:block>
3124
3363
  </xsl:if>
3125
3364
 
3126
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
3365
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3127
3366
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3128
3367
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3129
3368
 
@@ -3135,11 +3374,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3135
3374
  <xsl:value-of select="@reference"/>
3136
3375
  </fo:basic-link>
3137
3376
  </fo:inline>
3138
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
3377
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3139
3378
  <fo:inline>
3140
3379
  <xsl:apply-templates/>
3141
3380
  </fo:inline>
3142
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
3381
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3143
3382
  <xsl:variable name="parent" select="local-name(..)"/>
3144
3383
 
3145
3384
  <xsl:variable name="key_iso">
@@ -3152,6 +3391,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3152
3391
 
3153
3392
  <fo:block margin-bottom="12pt" text-align="left">
3154
3393
 
3394
+ <xsl:variable name="title-where">
3395
+ <xsl:call-template name="getTitle">
3396
+ <xsl:with-param name="name" select="'title-where'"/>
3397
+ </xsl:call-template>
3398
+ </xsl:variable>
3155
3399
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3156
3400
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3157
3401
  <xsl:text/>
@@ -3165,14 +3409,24 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3165
3409
 
3166
3410
 
3167
3411
 
3412
+ <xsl:variable name="title-where">
3413
+ <xsl:call-template name="getTitle">
3414
+ <xsl:with-param name="name" select="'title-where'"/>
3415
+ </xsl:call-template>
3416
+ </xsl:variable>
3168
3417
  <xsl:value-of select="$title-where"/>
3169
3418
  </fo:block>
3170
3419
  </xsl:when>
3171
3420
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3172
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3421
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3173
3422
 
3174
3423
 
3175
3424
 
3425
+ <xsl:variable name="title-key">
3426
+ <xsl:call-template name="getTitle">
3427
+ <xsl:with-param name="name" select="'title-key'"/>
3428
+ </xsl:call-template>
3429
+ </xsl:variable>
3176
3430
  <xsl:value-of select="$title-key"/>
3177
3431
  </fo:block>
3178
3432
  </xsl:when>
@@ -3189,23 +3443,6 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3189
3443
 
3190
3444
 
3191
3445
 
3192
- <!-- create virtual html table for dl/[dt and dd] -->
3193
- <xsl:variable name="html-table">
3194
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3195
- <xsl:element name="{$ns}:table">
3196
- <tbody>
3197
- <xsl:apply-templates mode="dl"/>
3198
- </tbody>
3199
- </xsl:element>
3200
- </xsl:variable>
3201
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3202
- <xsl:variable name="colwidths">
3203
- <xsl:call-template name="calculate-column-widths">
3204
- <xsl:with-param name="cols-count" select="2"/>
3205
- <xsl:with-param name="table" select="$html-table"/>
3206
- </xsl:call-template>
3207
- </xsl:variable>
3208
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3209
3446
 
3210
3447
  <fo:table width="95%" table-layout="fixed">
3211
3448
 
@@ -3218,42 +3455,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3218
3455
 
3219
3456
  </xsl:when>
3220
3457
  </xsl:choose>
3221
- <xsl:choose>
3222
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3223
- <fo:table-column column-width="50%"/>
3224
- <fo:table-column column-width="50%"/>
3225
- </xsl:when>
3226
- <xsl:otherwise>
3227
- <xsl:choose>
3228
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3229
- <fo:table-column column-width="60%"/>
3230
- <fo:table-column column-width="40%"/>
3231
- </xsl:when> -->
3232
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3233
- <fo:table-column column-width="50%"/>
3234
- <fo:table-column column-width="50%"/>
3235
- </xsl:when>
3236
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3237
- <fo:table-column column-width="40%"/>
3238
- <fo:table-column column-width="60%"/>
3239
- </xsl:when>
3240
- <xsl:otherwise>
3241
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3242
- <xsl:choose>
3243
- <xsl:when test=". = 1 or . = 0">
3244
- <fo:table-column column-width="proportional-column-width(2)"/>
3245
- </xsl:when>
3246
- <xsl:otherwise>
3247
- <fo:table-column column-width="proportional-column-width({.})"/>
3248
- </xsl:otherwise>
3249
- </xsl:choose>
3250
- </xsl:for-each>
3251
- </xsl:otherwise>
3252
- </xsl:choose>
3253
- <!-- <fo:table-column column-width="15%"/>
3254
- <fo:table-column column-width="85%"/> -->
3255
- </xsl:otherwise>
3256
- </xsl:choose>
3458
+ <!-- create virtual html table for dl/[dt and dd] -->
3459
+ <xsl:variable name="html-table">
3460
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3461
+ <xsl:element name="{$ns}:table">
3462
+ <tbody>
3463
+ <xsl:apply-templates mode="dl"/>
3464
+ </tbody>
3465
+ </xsl:element>
3466
+ </xsl:variable>
3467
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3468
+ <xsl:variable name="colwidths">
3469
+ <xsl:call-template name="calculate-column-widths">
3470
+ <xsl:with-param name="cols-count" select="2"/>
3471
+ <xsl:with-param name="table" select="$html-table"/>
3472
+ </xsl:call-template>
3473
+ </xsl:variable>
3474
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3475
+ <xsl:variable name="maxlength_dt">
3476
+ <xsl:call-template name="getMaxLength_dt"/>
3477
+ </xsl:variable>
3478
+ <xsl:call-template name="setColumnWidth_dl">
3479
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3480
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3481
+ </xsl:call-template>
3257
3482
  <fo:table-body>
3258
3483
  <xsl:apply-templates>
3259
3484
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3263,7 +3488,61 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3263
3488
  </fo:block>
3264
3489
  </fo:block>
3265
3490
  </xsl:if>
3266
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
3491
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3492
+ <xsl:param name="colwidths"/>
3493
+ <xsl:param name="maxlength_dt"/>
3494
+ <xsl:choose>
3495
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3496
+ <fo:table-column column-width="50%"/>
3497
+ <fo:table-column column-width="50%"/>
3498
+ </xsl:when>
3499
+ <xsl:otherwise>
3500
+ <xsl:choose>
3501
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3502
+ <fo:table-column column-width="5%"/>
3503
+ <fo:table-column column-width="95%"/>
3504
+ </xsl:when>
3505
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3506
+ <fo:table-column column-width="10%"/>
3507
+ <fo:table-column column-width="90%"/>
3508
+ </xsl:when>
3509
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3510
+ <fo:table-column column-width="60%"/>
3511
+ <fo:table-column column-width="40%"/>
3512
+ </xsl:when> -->
3513
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3514
+ <fo:table-column column-width="50%"/>
3515
+ <fo:table-column column-width="50%"/>
3516
+ </xsl:when>
3517
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3518
+ <fo:table-column column-width="40%"/>
3519
+ <fo:table-column column-width="60%"/>
3520
+ </xsl:when>
3521
+ <xsl:otherwise>
3522
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3523
+ <xsl:choose>
3524
+ <xsl:when test=". = 1 or . = 0">
3525
+ <fo:table-column column-width="proportional-column-width(2)"/>
3526
+ </xsl:when>
3527
+ <xsl:otherwise>
3528
+ <fo:table-column column-width="proportional-column-width({.})"/>
3529
+ </xsl:otherwise>
3530
+ </xsl:choose>
3531
+ </xsl:for-each>
3532
+ </xsl:otherwise>
3533
+ </xsl:choose>
3534
+ <!-- <fo:table-column column-width="15%"/>
3535
+ <fo:table-column column-width="85%"/> -->
3536
+ </xsl:otherwise>
3537
+ </xsl:choose>
3538
+ </xsl:template><xsl:template name="getMaxLength_dt">
3539
+ <xsl:for-each select="*[local-name()='dt']">
3540
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3541
+ <xsl:if test="position() = 1">
3542
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3543
+ </xsl:if>
3544
+ </xsl:for-each>
3545
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3267
3546
  <xsl:param name="key_iso"/>
3268
3547
 
3269
3548
  <!-- <tr>
@@ -3279,6 +3558,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3279
3558
  <xsl:if test="normalize-space($key_iso) = 'true'">
3280
3559
  <xsl:attribute name="margin-top">0</xsl:attribute>
3281
3560
  </xsl:if>
3561
+ <xsl:variable name="title-note">
3562
+ <xsl:call-template name="getTitle">
3563
+ <xsl:with-param name="name" select="'title-note'"/>
3564
+ </xsl:call-template>
3565
+ </xsl:variable>
3282
3566
  <xsl:value-of select="$title-note"/>
3283
3567
  </fo:block>
3284
3568
  </fo:table-cell>
@@ -3288,7 +3572,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3288
3572
  </fo:block>
3289
3573
  </fo:table-cell>
3290
3574
  </fo:table-row>
3291
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
3575
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3292
3576
  <tr>
3293
3577
  <td>
3294
3578
  <xsl:apply-templates/>
@@ -3301,7 +3585,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3301
3585
  </td>
3302
3586
  </tr>
3303
3587
 
3304
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
3588
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3305
3589
  <xsl:param name="key_iso"/>
3306
3590
 
3307
3591
  <fo:table-row>
@@ -3320,7 +3604,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3320
3604
 
3321
3605
 
3322
3606
  <xsl:apply-templates/>
3323
-
3607
+ <!-- <xsl:if test="$namespace = 'gb'">
3608
+ <xsl:if test="ancestor::*[local-name()='formula']">
3609
+ <xsl:text>—</xsl:text>
3610
+ </xsl:if>
3611
+ </xsl:if> -->
3324
3612
  </fo:block>
3325
3613
  </fo:table-cell>
3326
3614
  <fo:table-cell>
@@ -3334,37 +3622,37 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3334
3622
  </fo:table-cell>
3335
3623
  </fo:table-row>
3336
3624
 
3337
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process">
3625
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3338
3626
  <xsl:apply-templates/>
3339
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process">
3627
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3340
3628
  <xsl:apply-templates/>
3341
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3629
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3342
3630
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3343
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
3631
+ </xsl:template><xsl:template match="*[local-name()='em']">
3344
3632
  <fo:inline font-style="italic">
3345
3633
  <xsl:apply-templates/>
3346
3634
  </fo:inline>
3347
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
3635
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3348
3636
  <fo:inline font-weight="bold">
3349
3637
  <xsl:apply-templates/>
3350
3638
  </fo:inline>
3351
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
3639
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3352
3640
  <fo:inline font-size="80%" vertical-align="super">
3353
3641
  <xsl:apply-templates/>
3354
3642
  </fo:inline>
3355
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
3643
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3356
3644
  <fo:inline font-size="80%" vertical-align="sub">
3357
3645
  <xsl:apply-templates/>
3358
3646
  </fo:inline>
3359
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
3647
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3360
3648
  <fo:inline font-family="Courier" font-size="10pt">
3361
3649
  <xsl:apply-templates/>
3362
3650
  </fo:inline>
3363
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
3651
+ </xsl:template><xsl:template match="*[local-name()='del']">
3364
3652
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3365
3653
  <xsl:apply-templates/>
3366
3654
  </fo:inline>
3367
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
3655
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3368
3656
  <xsl:variable name="text" select="normalize-space(.)"/>
3369
3657
  <fo:inline font-size="75%">
3370
3658
  <xsl:if test="string-length($text) &gt; 0">
@@ -3373,10 +3661,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3373
3661
  </xsl:call-template>
3374
3662
  </xsl:if>
3375
3663
  </fo:inline>
3376
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
3664
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3377
3665
  <xsl:param name="text"/>
3378
3666
  <xsl:variable name="char" select="substring($text,1,1)"/>
3379
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3667
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3668
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3380
3669
  <xsl:choose>
3381
3670
  <xsl:when test="$char=$upperCase">
3382
3671
  <fo:inline font-size="{100 div 0.75}%">
@@ -3392,7 +3681,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3392
3681
  <xsl:with-param name="text" select="substring($text,2)"/>
3393
3682
  </xsl:call-template>
3394
3683
  </xsl:if>
3395
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
3684
+ </xsl:template><xsl:template name="tokenize">
3396
3685
  <xsl:param name="text"/>
3397
3686
  <xsl:param name="separator" select="' '"/>
3398
3687
  <xsl:choose>
@@ -3440,7 +3729,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3440
3729
  </xsl:call-template>
3441
3730
  </xsl:otherwise>
3442
3731
  </xsl:choose>
3443
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
3732
+ </xsl:template><xsl:template name="max_length">
3444
3733
  <xsl:param name="words"/>
3445
3734
  <xsl:for-each select="$words//word">
3446
3735
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3448,11 +3737,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3448
3737
  <xsl:value-of select="."/>
3449
3738
  </xsl:if>
3450
3739
  </xsl:for-each>
3451
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
3740
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3452
3741
  <xsl:param name="text" select="."/>
3453
3742
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3454
3743
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3455
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
3744
+ </xsl:template><xsl:template name="add-zero-spaces">
3456
3745
  <xsl:param name="text" select="."/>
3457
3746
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3458
3747
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3505,7 +3794,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3505
3794
  <xsl:value-of select="$text"/>
3506
3795
  </xsl:otherwise>
3507
3796
  </xsl:choose>
3508
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
3797
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3509
3798
  <xsl:param name="text" select="."/>
3510
3799
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3511
3800
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3531,7 +3820,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3531
3820
  <xsl:value-of select="$text"/>
3532
3821
  </xsl:otherwise>
3533
3822
  </xsl:choose>
3534
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
3823
+ </xsl:template><xsl:template name="getSimpleTable">
3535
3824
  <xsl:variable name="simple-table">
3536
3825
 
3537
3826
  <!-- Step 1. colspan processing -->
@@ -3558,9 +3847,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3558
3847
  </xsl:choose> -->
3559
3848
  </xsl:variable>
3560
3849
  <xsl:copy-of select="$simple-table"/>
3561
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3850
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3562
3851
  <xsl:apply-templates mode="simple-table-colspan"/>
3563
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3852
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3564
3853
  <xsl:choose>
3565
3854
  <xsl:when test="@colspan">
3566
3855
  <xsl:variable name="td">
@@ -3582,16 +3871,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3582
3871
  </xsl:element>
3583
3872
  </xsl:otherwise>
3584
3873
  </xsl:choose>
3585
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan">
3874
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3586
3875
  <xsl:element name="tr">
3587
3876
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3588
3877
  <xsl:apply-templates mode="simple-table-colspan"/>
3589
3878
  </xsl:element>
3590
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
3879
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3591
3880
  <xsl:copy>
3592
3881
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3593
3882
  </xsl:copy>
3594
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
3883
+ </xsl:template><xsl:template name="repeatNode">
3595
3884
  <xsl:param name="count"/>
3596
3885
  <xsl:param name="node"/>
3597
3886
 
@@ -3602,18 +3891,18 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3602
3891
  </xsl:call-template>
3603
3892
  <xsl:copy-of select="$node"/>
3604
3893
  </xsl:if>
3605
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
3894
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3606
3895
  <xsl:copy>
3607
3896
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3608
3897
  </xsl:copy>
3609
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
3898
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3610
3899
  <xsl:copy>
3611
3900
  <xsl:copy-of select="tr[1]"/>
3612
3901
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3613
3902
  <xsl:with-param name="previousRow" select="tr[1]"/>
3614
3903
  </xsl:apply-templates>
3615
3904
  </xsl:copy>
3616
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
3905
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3617
3906
  <xsl:param name="previousRow"/>
3618
3907
  <xsl:variable name="currentRow" select="."/>
3619
3908
 
@@ -3647,43 +3936,53 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3647
3936
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3648
3937
  <xsl:with-param name="previousRow" select="$newRow"/>
3649
3938
  </xsl:apply-templates>
3650
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
3939
+ </xsl:template><xsl:template name="getLang">
3651
3940
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3652
3941
  <xsl:choose>
3653
3942
  <xsl:when test="$language = 'English'">en</xsl:when>
3654
3943
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3655
3944
  </xsl:choose>
3656
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
3945
+ </xsl:template><xsl:template name="capitalizeWords">
3657
3946
  <xsl:param name="str"/>
3658
3947
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3659
3948
  <xsl:choose>
3660
3949
  <xsl:when test="contains($str2, ' ')">
3661
3950
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3662
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3663
- <xsl:value-of select="substring($substr, 2)"/>
3951
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3952
+ <xsl:value-of select="substring($substr, 2)"/> -->
3953
+ <xsl:call-template name="capitalize">
3954
+ <xsl:with-param name="str" select="$substr"/>
3955
+ </xsl:call-template>
3664
3956
  <xsl:text> </xsl:text>
3665
3957
  <xsl:call-template name="capitalizeWords">
3666
3958
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3667
3959
  </xsl:call-template>
3668
3960
  </xsl:when>
3669
3961
  <xsl:otherwise>
3670
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3671
- <xsl:value-of select="substring($str2, 2)"/>
3962
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3963
+ <xsl:value-of select="substring($str2, 2)"/> -->
3964
+ <xsl:call-template name="capitalize">
3965
+ <xsl:with-param name="str" select="$str2"/>
3966
+ </xsl:call-template>
3672
3967
  </xsl:otherwise>
3673
3968
  </xsl:choose>
3674
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
3969
+ </xsl:template><xsl:template name="capitalize">
3970
+ <xsl:param name="str"/>
3971
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3972
+ <xsl:value-of select="substring($str, 2)"/>
3973
+ </xsl:template><xsl:template match="mathml:math">
3675
3974
  <fo:inline font-family="STIX2Math">
3676
3975
  <fo:instream-foreign-object fox:alt-text="Math">
3677
3976
  <xsl:copy-of select="."/>
3678
3977
  </fo:instream-foreign-object>
3679
3978
  </fo:inline>
3680
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
3979
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3681
3980
  <xsl:for-each select="*[local-name()='locality']">
3682
3981
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3683
3982
  <xsl:apply-templates select="."/>
3684
3983
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3685
3984
  </xsl:for-each>
3686
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
3985
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3687
3986
  <xsl:variable name="target">
3688
3987
  <xsl:choose>
3689
3988
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3713,7 +4012,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3713
4012
  </xsl:otherwise>
3714
4013
  </xsl:choose>
3715
4014
  </fo:inline>
3716
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
4015
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3717
4016
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3718
4017
  <!-- <xsl:choose>
3719
4018
  <xsl:when test="@lang = 'en'"></xsl:when>
@@ -3724,19 +4023,29 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3724
4023
  </xsl:choose> -->
3725
4024
  <xsl:apply-templates/>
3726
4025
  </fo:block>
3727
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
4026
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3728
4027
  <fo:inline id="{@id}"/>
3729
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
4028
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3730
4029
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4030
+ <xsl:variable name="title-appendix">
4031
+ <xsl:call-template name="getTitle">
4032
+ <xsl:with-param name="name" select="'title-appendix'"/>
4033
+ </xsl:call-template>
4034
+ </xsl:variable>
3731
4035
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3732
4036
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3733
4037
  </fo:block>
3734
4038
  <xsl:apply-templates/>
3735
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4039
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3736
4040
  <fo:inline><xsl:apply-templates/></fo:inline>
3737
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
4041
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3738
4042
  <fo:block xsl:use-attribute-sets="appendix-example-style">
3739
4043
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4044
+ <xsl:variable name="title-example">
4045
+ <xsl:call-template name="getTitle">
4046
+ <xsl:with-param name="name" select="'title-example'"/>
4047
+ </xsl:call-template>
4048
+ </xsl:variable>
3740
4049
  <xsl:value-of select="$title-example"/>
3741
4050
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3742
4051
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -3746,11 +4055,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3746
4055
  </xsl:if>
3747
4056
  </fo:block>
3748
4057
  <xsl:apply-templates/>
3749
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4058
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3750
4059
  <fo:inline><xsl:apply-templates/></fo:inline>
3751
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
4060
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3752
4061
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3753
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
4062
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3754
4063
  <xsl:variable name="annotation-id" select="@id"/>
3755
4064
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3756
4065
  <fo:block id="{$annotation-id}" white-space="nowrap">
@@ -3760,14 +4069,25 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3760
4069
  </xsl:apply-templates>
3761
4070
  </fo:inline>
3762
4071
  </fo:block>
3763
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4072
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3764
4073
  <xsl:param name="callout"/>
3765
4074
  <fo:inline id="{@id}">
3766
4075
  <!-- for first p in annotation, put <x> -->
3767
4076
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3768
4077
  <xsl:apply-templates/>
3769
4078
  </fo:inline>
3770
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
4079
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4080
+ <xsl:variable name="title-modified">
4081
+ <xsl:call-template name="getTitle">
4082
+ <xsl:with-param name="name" select="'title-modified'"/>
4083
+ </xsl:call-template>
4084
+ </xsl:variable>
4085
+ <xsl:choose>
4086
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4087
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4088
+ </xsl:choose>
4089
+ <xsl:apply-templates/>
4090
+ </xsl:template><xsl:template name="convertDate">
3771
4091
  <xsl:param name="date"/>
3772
4092
  <xsl:param name="format" select="'short'"/>
3773
4093
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -3800,7 +4120,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3800
4120
  </xsl:choose>
3801
4121
  </xsl:variable>
3802
4122
  <xsl:value-of select="$result"/>
3803
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
4123
+ </xsl:template><xsl:template name="insertKeywords">
3804
4124
  <xsl:param name="sorting" select="'true'"/>
3805
4125
  <xsl:param name="charAtEnd" select="'.'"/>
3806
4126
  <xsl:param name="charDelim" select="', '"/>
@@ -3823,7 +4143,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3823
4143
  </xsl:for-each>
3824
4144
  </xsl:otherwise>
3825
4145
  </xsl:choose>
3826
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
4146
+ </xsl:template><xsl:template name="insertKeyword">
3827
4147
  <xsl:param name="charAtEnd"/>
3828
4148
  <xsl:param name="charDelim"/>
3829
4149
  <xsl:apply-templates/>
@@ -3831,4 +4151,136 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3831
4151
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3832
4152
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3833
4153
  </xsl:choose>
4154
+ </xsl:template><xsl:template name="addPDFUAmeta">
4155
+ <fo:declarations>
4156
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4157
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4158
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4159
+ </pdf:dictionary>
4160
+ </pdf:catalog>
4161
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4162
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4163
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4164
+ <!-- Dublin Core properties go here -->
4165
+ <dc:title>
4166
+ <xsl:variable name="title">
4167
+
4168
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4169
+
4170
+
4171
+
4172
+
4173
+ </xsl:variable>
4174
+ <xsl:choose>
4175
+ <xsl:when test="normalize-space($title) != ''">
4176
+ <xsl:value-of select="$title"/>
4177
+ </xsl:when>
4178
+ <xsl:otherwise>
4179
+ <xsl:text> </xsl:text>
4180
+ </xsl:otherwise>
4181
+ </xsl:choose>
4182
+ </dc:title>
4183
+ <dc:creator>
4184
+
4185
+
4186
+ </dc:creator>
4187
+ <dc:description>
4188
+ <xsl:variable name="abstract">
4189
+
4190
+
4191
+
4192
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4193
+
4194
+
4195
+ </xsl:variable>
4196
+ <xsl:value-of select="normalize-space($abstract)"/>
4197
+ </dc:description>
4198
+ <pdf:Keywords>
4199
+ <xsl:call-template name="insertKeywords"/>
4200
+ </pdf:Keywords>
4201
+ </rdf:Description>
4202
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4203
+ <!-- XMP properties go here -->
4204
+ <xmp:CreatorTool/>
4205
+ </rdf:Description>
4206
+ </rdf:RDF>
4207
+ </x:xmpmeta>
4208
+ </fo:declarations>
4209
+ </xsl:template><xsl:template name="getId">
4210
+ <xsl:choose>
4211
+ <xsl:when test="../@id">
4212
+ <xsl:value-of select="../@id"/>
4213
+ </xsl:when>
4214
+ <xsl:otherwise>
4215
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4216
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4217
+ </xsl:otherwise>
4218
+ </xsl:choose>
4219
+ </xsl:template><xsl:template name="getLevel">
4220
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4221
+ <xsl:variable name="level">
4222
+ <xsl:choose>
4223
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4224
+ <xsl:value-of select="$level_total - 2"/>
4225
+ </xsl:when>
4226
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4227
+ <xsl:value-of select="$level_total - 2"/>
4228
+ </xsl:when>
4229
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4230
+ <xsl:value-of select="$level_total - 2"/>
4231
+ </xsl:when>
4232
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4233
+ <xsl:otherwise>
4234
+ <xsl:value-of select="$level_total - 1"/>
4235
+ </xsl:otherwise>
4236
+ </xsl:choose>
4237
+ </xsl:variable>
4238
+ <xsl:value-of select="$level"/>
4239
+ </xsl:template><xsl:template name="getSubSection">
4240
+ <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']"/>
4241
+ </xsl:template><xsl:template name="split">
4242
+ <xsl:param name="pText" select="."/>
4243
+ <xsl:param name="sep" select="','"/>
4244
+ <xsl:if test="string-length($pText) &gt;0">
4245
+ <item>
4246
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4247
+ </item>
4248
+ <xsl:call-template name="split">
4249
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4250
+ <xsl:with-param name="sep" select="$sep"/>
4251
+ </xsl:call-template>
4252
+ </xsl:if>
4253
+ </xsl:template><xsl:template name="getDocumentId">
4254
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4255
+ </xsl:template><xsl:template name="namespaceCheck">
4256
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4257
+ <xsl:variable name="XSLNS">
4258
+
4259
+
4260
+
4261
+
4262
+ <xsl:value-of select="document('')//*/namespace::unece"/>
4263
+
4264
+
4265
+
4266
+
4267
+
4268
+
4269
+
4270
+
4271
+
4272
+ </xsl:variable>
4273
+ <xsl:if test="$documentNS != $XSLNS">
4274
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4275
+ </xsl:if>
4276
+ </xsl:template><xsl:template name="getLanguage">
4277
+ <xsl:param name="lang"/>
4278
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4279
+ <xsl:choose>
4280
+ <xsl:when test="$language = 'en'">English</xsl:when>
4281
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4282
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4283
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4284
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4285
+ </xsl:choose>
3834
4286
  </xsl:template></xsl:stylesheet>