metanorma-un 0.3.9 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,42 +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
- </rdf:Description>
94
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
95
- <!-- XMP properties go here -->
96
- <xmp:CreatorTool/>
97
- </rdf:Description>
98
- </rdf:RDF>
99
- </x:xmpmeta>
100
- </fo:declarations>
65
+ <xsl:call-template name="addPDFUAmeta"/>
101
66
 
102
67
  <!-- Cover Page -->
103
68
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -168,7 +133,7 @@
168
133
  <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:session/un:date"/>
169
134
  </fo:block>
170
135
  <fo:block font-weight="normal">
171
- <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))"/>
172
137
  </fo:block>
173
138
  <fo:block>
174
139
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
@@ -299,14 +264,7 @@
299
264
  <!-- Any node with title element - clause, definition, annex,... -->
300
265
  <xsl:template match="un:title | un:preferred" mode="contents">
301
266
  <xsl:variable name="id">
302
- <xsl:choose>
303
- <xsl:when test="../@id">
304
- <xsl:value-of select="../@id"/>
305
- </xsl:when>
306
- <xsl:otherwise>
307
- <xsl:value-of select="text()"/>
308
- </xsl:otherwise>
309
- </xsl:choose>
267
+ <xsl:call-template name="getId"/>
310
268
  </xsl:variable>
311
269
 
312
270
  <xsl:variable name="level">
@@ -329,7 +287,12 @@
329
287
  <item id="{$id}" level="{$level}" section="{$section}" display="false" type="{$type}">
330
288
  <xsl:if test="$type = 'clause'">
331
289
  <xsl:attribute name="section">
332
- <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"/>
333
296
  <xsl:choose>
334
297
  <xsl:when test="ancestor::un:sections">
335
298
  <!-- 1, 2, 3, 4, ... from main section (not annex ...) -->
@@ -353,7 +316,12 @@
353
316
  <xsl:when test="ancestor::un:annex">
354
317
  <xsl:choose>
355
318
  <xsl:when test="$level = 1">
356
- <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"/>
357
325
  <xsl:number format="A" level="any" count="un:annex"/>
358
326
  </xsl:when>
359
327
  <xsl:otherwise>
@@ -384,7 +352,12 @@
384
352
  <xsl:template match="un:figure" mode="contents">
385
353
  <item level="" id="{@id}" type="figure">
386
354
  <xsl:attribute name="section">
387
- <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"/>
388
361
  <xsl:choose>
389
362
  <xsl:when test="ancestor::un:annex">
390
363
  <xsl:choose>
@@ -416,7 +389,12 @@
416
389
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
417
390
  <item level="" id="{@id}" display="false" type="table">
418
391
  <xsl:attribute name="section">
419
- <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"/>
420
398
  <xsl:choose>
421
399
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
422
400
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -439,7 +417,12 @@
439
417
  <xsl:template match="un:formula" mode="contents">
440
418
  <item level="" id="{@id}" display="false">
441
419
  <xsl:attribute name="section">
442
- <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"/>
443
426
  </xsl:attribute>
444
427
  </item>
445
428
  </xsl:template>
@@ -468,7 +451,12 @@
468
451
  <item level="" id="{@id}" display="false" type="Terms">
469
452
  <xsl:if test="ancestor::un:annex">
470
453
  <xsl:attribute name="section">
471
- <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"/>
472
460
  </xsl:attribute>
473
461
  </xsl:if>
474
462
  </item>
@@ -478,7 +466,12 @@
478
466
  <item level="" id="{@id}" display="false" type="References">
479
467
  <xsl:if test="ancestor::un:annex">
480
468
  <xsl:attribute name="section">
481
- <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"/>
482
475
  </xsl:attribute>
483
476
  </xsl:if>
484
477
  </item>
@@ -490,7 +483,12 @@
490
483
  <xsl:variable name="num">
491
484
  <xsl:number/>
492
485
  </xsl:variable>
493
- <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"/>
494
492
  </xsl:attribute>
495
493
  </item>
496
494
  </xsl:template>
@@ -512,7 +510,12 @@
512
510
  <fo:table-body>
513
511
  <fo:table-row>
514
512
  <fo:table-cell padding-left="6mm" padding-top="2.5mm">
515
- <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>
516
519
  </fo:table-cell>
517
520
  <fo:table-cell>
518
521
  <fo:block> </fo:block>
@@ -659,7 +662,12 @@
659
662
  <xsl:template match="un:ul//un:note | un:ol//un:note"/>
660
663
  <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process">
661
664
  <fo:block font-size="11pt" margin-top="4pt">
662
- <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"/>
663
671
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
664
672
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
665
673
  </xsl:if>
@@ -741,16 +749,24 @@
741
749
  </xsl:template>
742
750
 
743
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>
744
757
  <fo:block text-align="center" font-style="italic" keep-with-next="always" margin-bottom="6pt">
745
- <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"/>
746
759
  </fo:block>
747
760
  <fo:block-container border="0.25pt solid black" margin-left="-3mm" margin-right="-3mm" padding-top="4mm">
748
761
  <fo:block id="{@id}" font-weight="bold" margin-left="6mm" margin-right="6mm" keep-with-next="always">
749
- <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
750
- </fo:block>
751
- <fo:block margin-left="5mm" margin-right="5mm">
752
- <xsl:apply-templates/>
762
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
753
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>
754
770
  </fo:block-container>
755
771
  <fo:block margin-bottom="4pt"> </fo:block>
756
772
  </xsl:template>
@@ -813,14 +829,7 @@
813
829
 
814
830
  <xsl:template match="un:title">
815
831
  <xsl:variable name="id">
816
- <xsl:choose>
817
- <xsl:when test="../@id">
818
- <xsl:value-of select="../@id"/>
819
- </xsl:when>
820
- <xsl:otherwise>
821
- <xsl:value-of select="text()"/>
822
- </xsl:otherwise>
823
- </xsl:choose>
832
+ <xsl:call-template name="getId"/>
824
833
  </xsl:variable>
825
834
 
826
835
  <xsl:variable name="level">
@@ -931,7 +940,12 @@
931
940
  <xsl:template match="un:recommendation">
932
941
  <fo:block margin-left="20mm">
933
942
  <fo:block font-weight="bold">
934
- <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"/>
935
949
  <xsl:choose>
936
950
  <xsl:when test="ancestor::un:sections">
937
951
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1001,7 +1015,12 @@
1001
1015
  </fo:block>
1002
1016
  <xsl:if test="un:name">
1003
1017
  <fo:block text-align="center" margin-bottom="6pt" keep-with-previous="always">
1004
- <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"/>
1005
1024
  <xsl:choose>
1006
1025
  <xsl:when test="ancestor::un:annex">
1007
1026
  <xsl:choose>
@@ -1132,7 +1151,23 @@
1132
1151
 
1133
1152
  <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note">
1134
1153
  <fo:block font-size="10pt" space-after="12pt" text-indent="0">
1135
- <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"/>
1136
1171
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
1137
1172
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
1138
1173
  </xsl:if>
@@ -1143,12 +1178,17 @@
1143
1178
 
1144
1179
  <xsl:template match="un:termnote">
1145
1180
  <fo:block margin-top="4pt">
1146
- <xsl:text>NOTE </xsl:text>
1147
- <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1148
- <xsl:number/><xsl:text> </xsl:text>
1149
- </xsl:if>
1150
- <xsl:text>– </xsl:text>
1151
- <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/>
1152
1192
  </fo:block>
1153
1193
  </xsl:template>
1154
1194
 
@@ -1176,7 +1216,7 @@
1176
1216
  <fo:table-cell> <!-- display-align="center" -->
1177
1217
  <fo:block text-align="right">
1178
1218
  <xsl:if test="not(ancestor::un:annex)">
1179
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1219
+ <xsl:number format="(1)" level="any"/>
1180
1220
  </xsl:if>
1181
1221
  <xsl:if test="ancestor::un:annex">
1182
1222
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1200,7 +1240,12 @@
1200
1240
  </xsl:template>
1201
1241
 
1202
1242
  <xsl:template match="un:example">
1203
- <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>
1204
1249
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1205
1250
  <xsl:apply-templates/>
1206
1251
  </fo:block>
@@ -1227,7 +1272,7 @@
1227
1272
  <xsl:if test="@type = 'inline'">
1228
1273
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1229
1274
  </xsl:if>
1230
- <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" -->
1231
1276
 
1232
1277
  <xsl:apply-templates select="un:localityStack"/>
1233
1278
 
@@ -1236,9 +1281,19 @@
1236
1281
  </xsl:template>
1237
1282
 
1238
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>
1239
1294
  <xsl:choose>
1240
- <xsl:when test="@type = 'section'">Section </xsl:when>
1241
- <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>
1242
1297
  <xsl:otherwise/>
1243
1298
  </xsl:choose>
1244
1299
  <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
@@ -1257,7 +1312,7 @@
1257
1312
  </fo:block>
1258
1313
  </xsl:template>
1259
1314
  <xsl:template match="un:term" mode="table">
1260
- <fo:table-row>
1315
+ <fo:table-row id="{@id}">
1261
1316
  <fo:table-cell padding-right="1mm">
1262
1317
  <fo:block margin-bottom="12pt">
1263
1318
  <xsl:apply-templates select="un:preferred"/>
@@ -1271,7 +1326,7 @@
1271
1326
  </fo:table-row>
1272
1327
  </xsl:template>
1273
1328
  <xsl:template match="un:preferred">
1274
- <fo:inline id="{../@id}">
1329
+ <fo:inline>
1275
1330
  <xsl:apply-templates/>
1276
1331
  </fo:inline>
1277
1332
  </xsl:template>
@@ -1337,15 +1392,7 @@
1337
1392
  <xsl:apply-templates/>
1338
1393
  </fo:block>
1339
1394
  </xsl:template>
1340
-
1341
- <xsl:template match="un:sourcecode">
1342
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1343
- <xsl:attribute name="white-space">pre</xsl:attribute>
1344
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1345
- <xsl:apply-templates/>
1346
- </fo:block>
1347
- </xsl:template>
1348
-
1395
+
1349
1396
  <xsl:template match="un:references">
1350
1397
  <fo:block>
1351
1398
  <xsl:if test="not(un:title)">
@@ -1406,29 +1453,6 @@
1406
1453
  </fo:static-content>
1407
1454
  </xsl:template>
1408
1455
 
1409
-
1410
- <xsl:template name="getLevel">
1411
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1412
- <xsl:variable name="level">
1413
- <xsl:choose>
1414
- <xsl:when test="ancestor::un:preface">
1415
- <xsl:value-of select="$level_total - 2"/>
1416
- </xsl:when>
1417
- <xsl:when test="ancestor::un:sections">
1418
- <xsl:value-of select="$level_total - 2"/>
1419
- </xsl:when>
1420
- <xsl:when test="ancestor::un:bibliography">
1421
- <xsl:value-of select="$level_total - 2"/>
1422
- </xsl:when>
1423
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1424
- <xsl:otherwise>
1425
- <xsl:value-of select="$level_total - 1"/>
1426
- </xsl:otherwise>
1427
- </xsl:choose>
1428
- </xsl:variable>
1429
- <xsl:value-of select="$level"/>
1430
- </xsl:template>
1431
-
1432
1456
  <xsl:template name="getSection">
1433
1457
  <xsl:variable name="level">
1434
1458
  <xsl:call-template name="getLevel"/>
@@ -1456,12 +1480,17 @@
1456
1480
  <xsl:when test="ancestor::un:annex">
1457
1481
  <xsl:choose>
1458
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>
1459
1488
  <xsl:choose>
1460
1489
  <xsl:when test="local-name() = 'title'">
1461
- <xsl:text>ANNEX </xsl:text>
1490
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-annex))"/>
1462
1491
  <xsl:number format="A" level="any" count="un:annex"/>
1463
1492
  </xsl:when>
1464
- <xsl:otherwise>Annex</xsl:otherwise>
1493
+ <xsl:otherwise><xsl:value-of select="normalize-space($title-annex)"/></xsl:otherwise>
1465
1494
  </xsl:choose>
1466
1495
  </xsl:when>
1467
1496
  <xsl:otherwise>
@@ -1562,8 +1591,10 @@
1562
1591
  </xsl:choose>
1563
1592
  </xsl:variable>
1564
1593
  <xsl:choose>
1565
- <xsl:when test="$first = 'true'">
1566
- <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>
1567
1598
  </xsl:when>
1568
1599
  <xsl:otherwise>
1569
1600
  <xsl:value-of select="$value"/>
@@ -1597,17 +1628,6 @@
1597
1628
  <xsl:variable name="result" select="normalize-space(concat($day, ' ', $monthStr, ' ', $year))"/>
1598
1629
  <xsl:value-of select="$result"/>
1599
1630
  </xsl:template>
1600
-
1601
- <xsl:template name="getLanguage">
1602
- <xsl:param name="lang"/>
1603
- <xsl:variable name="language" select="translate($lang, $upper, $lower)"/>
1604
- <xsl:choose>
1605
- <xsl:when test="$language = 'en'">English</xsl:when>
1606
- <xsl:when test="$language = 'de'">Deutsch</xsl:when>
1607
- <xsl:when test="$language = 'cn'">Chinese</xsl:when>
1608
- <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
1609
- </xsl:choose>
1610
- </xsl:template>
1611
1631
 
1612
1632
  <xsl:variable name="Image-Logo">
1613
1633
  <xsl:text>
@@ -2467,16 +2487,215 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2467
2487
  </xsl:text>
2468
2488
  </xsl:variable>
2469
2489
 
2470
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
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
+
2471
2537
 
2472
2538
 
2473
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
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>
2544
+
2545
+ <title-clause lang="zh">Clause </title-clause>
2546
+
2547
+
2548
+
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>
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>
2593
+
2594
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2595
+
2596
+
2597
+
2598
+ <title-modified lang="en">modified</title-modified>
2599
+ <title-modified lang="fr">modifiée</title-modified>
2600
+
2601
+ <title-modified lang="zh">modified</title-modified>
2602
+
2603
+
2604
+
2605
+ <title-source lang="en">SOURCE</title-source>
2606
+
2607
+ <title-keywords lang="en">Keywords</title-keywords>
2608
+
2609
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2610
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2611
+
2612
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2613
+
2614
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2615
+
2616
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2617
+
2618
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2619
+
2620
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2621
+
2622
+ <title-abstract lang="en">Abstract</title-abstract>
2623
+
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">
2670
+
2671
+
2672
+
2673
+
2674
+
2675
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2676
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2677
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2678
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2679
+
2680
+
2681
+
2682
+
2683
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2684
+
2685
+
2686
+
2687
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2688
+
2689
+
2690
+
2691
+ </xsl:attribute-set><xsl:template match="text()">
2474
2692
  <xsl:value-of select="."/>
2475
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2693
+ </xsl:template><xsl:template match="*[local-name()='br']">
2476
2694
  <xsl:value-of select="$linebreak"/>
2477
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2478
- <xsl:call-template name="add-zero-spaces"/>
2479
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2695
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2696
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2697
+ <xsl:call-template name="add-zero-spaces-java"/>
2698
+ </xsl:template><xsl:template match="*[local-name()='table']">
2480
2699
 
2481
2700
  <xsl:variable name="simple-table">
2482
2701
  <!-- <xsl:copy> -->
@@ -2513,33 +2732,17 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2513
2732
 
2514
2733
 
2515
2734
 
2516
- <xsl:text>Table </xsl:text>
2517
- <xsl:choose>
2518
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2519
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2520
- </xsl:when>
2521
- <xsl:when test="ancestor::*[local-name()='annex']">
2522
-
2523
-
2524
-
2525
-
2526
-
2527
-
2528
-
2529
- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2530
- <xsl:number format="I." count="*[local-name()='annex']"/>
2531
- <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2532
-
2533
-
2534
- </xsl:when>
2535
- <xsl:otherwise>
2536
-
2537
-
2538
- <xsl:number format="A." count="*[local-name()='annex']"/>
2539
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2540
-
2541
- </xsl:otherwise>
2542
- </xsl:choose>
2735
+
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>
2741
+ <xsl:value-of select="$title-table"/>
2742
+
2743
+ <xsl:call-template name="getTableNumber"/>
2744
+
2745
+
2543
2746
  <xsl:if test="*[local-name()='name']">
2544
2747
 
2545
2748
  :
@@ -2609,6 +2812,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2609
2812
 
2610
2813
 
2611
2814
 
2815
+
2612
2816
  <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2613
2817
 
2614
2818
 
@@ -2623,9 +2827,10 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2623
2827
 
2624
2828
 
2625
2829
 
2830
+
2626
2831
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2627
2832
  <xsl:choose>
2628
- <xsl:when test=". = 1">
2833
+ <xsl:when test=". = 1 or . = 0">
2629
2834
  <fo:table-column column-width="proportional-column-width(2)"/>
2630
2835
  </xsl:when>
2631
2836
  <xsl:otherwise>
@@ -2633,21 +2838,57 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2633
2838
  </xsl:otherwise>
2634
2839
  </xsl:choose>
2635
2840
  </xsl:for-each>
2636
- <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
+
2637
2851
  </fo:table>
2638
2852
 
2639
2853
 
2640
2854
 
2641
2855
  </fo:block-container>
2642
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2856
+ </xsl:template><xsl:template name="getTableNumber">
2857
+ <xsl:choose>
2858
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2859
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2860
+ </xsl:when>
2861
+ <xsl:when test="ancestor::*[local-name()='annex']">
2862
+
2863
+
2864
+
2865
+
2866
+
2867
+
2868
+
2869
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2870
+ <xsl:number format="I." count="*[local-name()='annex']"/>
2871
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2872
+
2873
+
2874
+ </xsl:when>
2875
+ <xsl:otherwise>
2876
+
2877
+
2878
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2879
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2880
+
2881
+ </xsl:otherwise>
2882
+ </xsl:choose>
2883
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2643
2884
  <xsl:apply-templates/>
2644
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
2885
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2645
2886
  <xsl:param name="table-row"/>
2646
2887
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2647
2888
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2648
2889
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2649
2890
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2650
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
2891
+ </xsl:template><xsl:template name="calculate-column-widths">
2651
2892
  <xsl:param name="table"/>
2652
2893
  <xsl:param name="cols-count"/>
2653
2894
  <xsl:param name="curr-col" select="1"/>
@@ -2656,7 +2897,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2656
2897
  <xsl:if test="$curr-col &lt;= $cols-count">
2657
2898
  <xsl:variable name="widths">
2658
2899
  <xsl:choose>
2659
- <xsl:when test="not($table)">
2900
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2660
2901
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2661
2902
  <xsl:variable name="words">
2662
2903
  <xsl:call-template name="tokenize">
@@ -2695,9 +2936,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2695
2936
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2696
2937
  </xsl:variable>
2697
2938
  <xsl:variable name="words">
2939
+ <xsl:variable name="string_with_added_zerospaces">
2940
+ <xsl:call-template name="add-zero-spaces-java">
2941
+ <xsl:with-param name="text" select="$td_text"/>
2942
+ </xsl:call-template>
2943
+ </xsl:variable>
2698
2944
  <xsl:call-template name="tokenize">
2699
2945
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2700
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2946
+ <!-- 2009 thinspace -->
2947
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2948
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2701
2949
  </xsl:call-template>
2702
2950
  </xsl:variable>
2703
2951
  <xsl:variable name="max_length">
@@ -2738,17 +2986,28 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2738
2986
  <xsl:with-param name="table" select="$table"/>
2739
2987
  </xsl:call-template>
2740
2988
  </xsl:if>
2741
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
2989
+ </xsl:template><xsl:template match="text()" mode="td_text">
2742
2990
  <xsl:variable name="zero-space">​</xsl:variable>
2743
2991
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2744
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
2992
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2993
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2994
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2995
+ <xsl:value-of select="@target"/>
2996
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2997
+ <xsl:param name="cols-count"/>
2745
2998
  <!-- font-weight="bold" -->
2746
- <fo:table-header>
2999
+ <fo:table-header>
3000
+
2747
3001
  <xsl:apply-templates/>
2748
3002
  </fo:table-header>
2749
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
2750
3008
  <xsl:apply-templates/>
2751
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
3009
+ </xsl:template><xsl:template name="insertTableFooter">
3010
+ <xsl:param name="cols-count"/>
2752
3011
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2753
3012
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2754
3013
 
@@ -2759,22 +3018,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2759
3018
  <!-- if there are note(s) or fn(s) then create footer row -->
2760
3019
  <xsl:if test="$isNoteOrFnExist = 'true'">
2761
3020
 
2762
- <xsl:variable name="cols-count">
2763
- <xsl:choose>
2764
- <xsl:when test="../*[local-name()='thead']">
2765
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2766
- <xsl:call-template name="calculate-columns-numbers">
2767
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2768
- </xsl:call-template>
2769
- </xsl:when>
2770
- <xsl:otherwise>
2771
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2772
- <xsl:call-template name="calculate-columns-numbers">
2773
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2774
- </xsl:call-template>
2775
- </xsl:otherwise>
2776
- </xsl:choose>
2777
- </xsl:variable>
3021
+
2778
3022
 
2779
3023
  <fo:table-row>
2780
3024
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2802,11 +3046,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2802
3046
  </fo:table-footer>
2803
3047
 
2804
3048
  </xsl:if>
2805
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3049
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3050
+
3051
+ <xsl:variable name="cols-count">
3052
+ <xsl:choose>
3053
+ <xsl:when test="../*[local-name()='thead']">
3054
+ <xsl:call-template name="calculate-columns-numbers">
3055
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3056
+ </xsl:call-template>
3057
+ </xsl:when>
3058
+ <xsl:otherwise>
3059
+ <xsl:call-template name="calculate-columns-numbers">
3060
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3061
+ </xsl:call-template>
3062
+ </xsl:otherwise>
3063
+ </xsl:choose>
3064
+ </xsl:variable>
2806
3065
 
2807
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3066
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3067
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3068
+ </xsl:apply-templates>
2808
3069
 
2809
- <xsl:call-template name="insertTableFooter"/>
3070
+ <xsl:call-template name="insertTableFooter">
3071
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3072
+ </xsl:call-template>
2810
3073
 
2811
3074
  <fo:table-body>
2812
3075
  <xsl:apply-templates/>
@@ -2814,7 +3077,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2814
3077
 
2815
3078
  </fo:table-body>
2816
3079
 
2817
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3080
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2818
3081
  <xsl:variable name="parent-name" select="local-name(..)"/>
2819
3082
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2820
3083
  <fo:table-row min-height="4mm">
@@ -2838,7 +3101,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2838
3101
 
2839
3102
  <xsl:apply-templates/>
2840
3103
  </fo:table-row>
2841
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3104
+ </xsl:template><xsl:template match="*[local-name()='th']">
2842
3105
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2843
3106
 
2844
3107
 
@@ -2870,7 +3133,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2870
3133
  <xsl:apply-templates/>
2871
3134
  </fo:block>
2872
3135
  </fo:table-cell>
2873
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3136
+ </xsl:template><xsl:template match="*[local-name()='td']">
2874
3137
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2875
3138
 
2876
3139
 
@@ -2899,6 +3162,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2899
3162
  </xsl:attribute>
2900
3163
  </xsl:if>
2901
3164
  <fo:block>
3165
+
2902
3166
  <xsl:apply-templates/>
2903
3167
  </fo:block>
2904
3168
  <!-- <xsl:choose>
@@ -2914,16 +3178,34 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2914
3178
 
2915
3179
 
2916
3180
  </fo:table-cell>
2917
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
2918
3182
 
2919
3183
 
2920
3184
  <fo:block font-size="10pt" margin-bottom="12pt">
2921
3185
 
2922
3186
 
2923
3187
 
3188
+
2924
3189
  <fo:inline padding-right="2mm">
2925
3190
 
2926
- <xsl:text>NOTE </xsl:text>
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>
3208
+ <xsl:value-of select="$title-note"/>
2927
3209
 
2928
3210
 
2929
3211
 
@@ -2933,9 +3215,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2933
3215
  <xsl:apply-templates mode="process"/>
2934
3216
  </fo:block>
2935
3217
 
2936
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
2937
3219
  <xsl:apply-templates/>
2938
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3220
+ </xsl:template><xsl:template name="fn_display">
2939
3221
  <xsl:variable name="references">
2940
3222
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2941
3223
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2952,6 +3234,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2952
3234
 
2953
3235
 
2954
3236
 
3237
+
2955
3238
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2956
3239
 
2957
3240
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2971,7 +3254,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2971
3254
  </fo:block>
2972
3255
  </xsl:if>
2973
3256
  </xsl:for-each>
2974
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3257
+ </xsl:template><xsl:template name="fn_name_display">
2975
3258
  <!-- <xsl:variable name="references">
2976
3259
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2977
3260
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2987,7 +3270,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2987
3270
  <xsl:apply-templates/>
2988
3271
  </fo:block>
2989
3272
  </xsl:for-each>
2990
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3273
+ </xsl:template><xsl:template name="fn_display_figure">
2991
3274
  <xsl:variable name="key_iso">
2992
3275
  <!-- and (not(@class) or @class !='pseudocode') -->
2993
3276
  </xsl:variable>
@@ -2998,6 +3281,36 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2998
3281
  </fn>
2999
3282
  </xsl:for-each>
3000
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
+
3001
3314
  <xsl:if test="xalan:nodeset($references)//fn">
3002
3315
  <fo:block>
3003
3316
  <fo:table width="95%" table-layout="fixed">
@@ -3005,8 +3318,19 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3005
3318
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3006
3319
 
3007
3320
  </xsl:if>
3008
- <fo:table-column column-width="15%"/>
3009
- <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>
3010
3334
  <fo:table-body>
3011
3335
  <xsl:for-each select="xalan:nodeset($references)//fn">
3012
3336
  <xsl:variable name="reference" select="@reference"/>
@@ -3038,7 +3362,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3038
3362
  </fo:block>
3039
3363
  </xsl:if>
3040
3364
 
3041
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3365
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3042
3366
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3043
3367
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3044
3368
 
@@ -3050,11 +3374,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3050
3374
  <xsl:value-of select="@reference"/>
3051
3375
  </fo:basic-link>
3052
3376
  </fo:inline>
3053
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3377
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3054
3378
  <fo:inline>
3055
3379
  <xsl:apply-templates/>
3056
3380
  </fo:inline>
3057
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3381
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3058
3382
  <xsl:variable name="parent" select="local-name(..)"/>
3059
3383
 
3060
3384
  <xsl:variable name="key_iso">
@@ -3066,8 +3390,13 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3066
3390
 
3067
3391
 
3068
3392
  <fo:block margin-bottom="12pt" text-align="left">
3069
-
3070
- <xsl:text>where </xsl:text>
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>
3399
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3071
3400
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3072
3401
  <xsl:text/>
3073
3402
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3080,15 +3409,25 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3080
3409
 
3081
3410
 
3082
3411
 
3083
- <xsl:text>where</xsl:text>
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>
3417
+ <xsl:value-of select="$title-where"/>
3084
3418
  </fo:block>
3085
3419
  </xsl:when>
3086
3420
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3087
- <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">
3088
3422
 
3089
3423
 
3090
3424
 
3091
- <xsl:text>Key</xsl:text>
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>
3430
+ <xsl:value-of select="$title-key"/>
3092
3431
  </fo:block>
3093
3432
  </xsl:when>
3094
3433
  </xsl:choose>
@@ -3099,26 +3438,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3099
3438
 
3100
3439
 
3101
3440
 
3441
+
3102
3442
  <fo:block>
3103
3443
 
3104
3444
 
3105
- <!-- create virtual html table for dl/[dt and dd] -->
3106
- <xsl:variable name="html-table">
3107
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3108
- <xsl:element name="{$ns}:table">
3109
- <tbody>
3110
- <xsl:apply-templates mode="dl"/>
3111
- </tbody>
3112
- </xsl:element>
3113
- </xsl:variable>
3114
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3115
- <xsl:variable name="colwidths">
3116
- <xsl:call-template name="calculate-column-widths">
3117
- <xsl:with-param name="cols-count" select="2"/>
3118
- <xsl:with-param name="table" select="$html-table"/>
3119
- </xsl:call-template>
3120
- </xsl:variable>
3121
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3445
+
3122
3446
 
3123
3447
  <fo:table width="95%" table-layout="fixed">
3124
3448
 
@@ -3131,42 +3455,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3131
3455
 
3132
3456
  </xsl:when>
3133
3457
  </xsl:choose>
3134
- <xsl:choose>
3135
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3136
- <fo:table-column column-width="50%"/>
3137
- <fo:table-column column-width="50%"/>
3138
- </xsl:when>
3139
- <xsl:otherwise>
3140
- <xsl:choose>
3141
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3142
- <fo:table-column column-width="60%"/>
3143
- <fo:table-column column-width="40%"/>
3144
- </xsl:when> -->
3145
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3146
- <fo:table-column column-width="50%"/>
3147
- <fo:table-column column-width="50%"/>
3148
- </xsl:when>
3149
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3150
- <fo:table-column column-width="40%"/>
3151
- <fo:table-column column-width="60%"/>
3152
- </xsl:when>
3153
- <xsl:otherwise>
3154
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3155
- <xsl:choose>
3156
- <xsl:when test=". = 1">
3157
- <fo:table-column column-width="proportional-column-width(2)"/>
3158
- </xsl:when>
3159
- <xsl:otherwise>
3160
- <fo:table-column column-width="proportional-column-width({.})"/>
3161
- </xsl:otherwise>
3162
- </xsl:choose>
3163
- </xsl:for-each>
3164
- </xsl:otherwise>
3165
- </xsl:choose>
3166
- <!-- <fo:table-column column-width="15%"/>
3167
- <fo:table-column column-width="85%"/> -->
3168
- </xsl:otherwise>
3169
- </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>
3170
3482
  <fo:table-body>
3171
3483
  <xsl:apply-templates>
3172
3484
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3176,7 +3488,61 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3176
3488
  </fo:block>
3177
3489
  </fo:block>
3178
3490
  </xsl:if>
3179
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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']">
3180
3546
  <xsl:param name="key_iso"/>
3181
3547
 
3182
3548
  <!-- <tr>
@@ -3192,7 +3558,12 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3192
3558
  <xsl:if test="normalize-space($key_iso) = 'true'">
3193
3559
  <xsl:attribute name="margin-top">0</xsl:attribute>
3194
3560
  </xsl:if>
3195
- NOTE
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>
3566
+ <xsl:value-of select="$title-note"/>
3196
3567
  </fo:block>
3197
3568
  </fo:table-cell>
3198
3569
  <fo:table-cell>
@@ -3201,7 +3572,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3201
3572
  </fo:block>
3202
3573
  </fo:table-cell>
3203
3574
  </fo:table-row>
3204
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
3575
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3205
3576
  <tr>
3206
3577
  <td>
3207
3578
  <xsl:apply-templates/>
@@ -3214,11 +3585,12 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3214
3585
  </td>
3215
3586
  </tr>
3216
3587
 
3217
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
3588
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3218
3589
  <xsl:param name="key_iso"/>
3219
3590
 
3220
3591
  <fo:table-row>
3221
3592
  <fo:table-cell>
3593
+
3222
3594
  <fo:block margin-top="6pt">
3223
3595
 
3224
3596
 
@@ -3228,8 +3600,15 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3228
3600
  </xsl:if>
3229
3601
 
3230
3602
 
3231
- <xsl:apply-templates/>
3232
3603
 
3604
+
3605
+
3606
+ <xsl:apply-templates/>
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> -->
3233
3612
  </fo:block>
3234
3613
  </fo:table-cell>
3235
3614
  <fo:table-cell>
@@ -3243,37 +3622,37 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3243
3622
  </fo:table-cell>
3244
3623
  </fo:table-row>
3245
3624
 
3246
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
3247
3626
  <xsl:apply-templates/>
3248
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
3627
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3249
3628
  <xsl:apply-templates/>
3250
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3629
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3251
3630
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3252
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
3631
+ </xsl:template><xsl:template match="*[local-name()='em']">
3253
3632
  <fo:inline font-style="italic">
3254
3633
  <xsl:apply-templates/>
3255
3634
  </fo:inline>
3256
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
3635
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3257
3636
  <fo:inline font-weight="bold">
3258
3637
  <xsl:apply-templates/>
3259
3638
  </fo:inline>
3260
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
3639
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3261
3640
  <fo:inline font-size="80%" vertical-align="super">
3262
3641
  <xsl:apply-templates/>
3263
3642
  </fo:inline>
3264
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
3643
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3265
3644
  <fo:inline font-size="80%" vertical-align="sub">
3266
3645
  <xsl:apply-templates/>
3267
3646
  </fo:inline>
3268
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3269
- <fo:inline font-family="Courier" font-size="10pt">
3647
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3648
+ <fo:inline font-family="Courier" font-size="10pt">
3270
3649
  <xsl:apply-templates/>
3271
3650
  </fo:inline>
3272
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
3651
+ </xsl:template><xsl:template match="*[local-name()='del']">
3273
3652
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3274
3653
  <xsl:apply-templates/>
3275
3654
  </fo:inline>
3276
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
3655
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3277
3656
  <xsl:variable name="text" select="normalize-space(.)"/>
3278
3657
  <fo:inline font-size="75%">
3279
3658
  <xsl:if test="string-length($text) &gt; 0">
@@ -3282,10 +3661,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3282
3661
  </xsl:call-template>
3283
3662
  </xsl:if>
3284
3663
  </fo:inline>
3285
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
3664
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3286
3665
  <xsl:param name="text"/>
3287
3666
  <xsl:variable name="char" select="substring($text,1,1)"/>
3288
- <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))"/>
3289
3669
  <xsl:choose>
3290
3670
  <xsl:when test="$char=$upperCase">
3291
3671
  <fo:inline font-size="{100 div 0.75}%">
@@ -3301,7 +3681,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3301
3681
  <xsl:with-param name="text" select="substring($text,2)"/>
3302
3682
  </xsl:call-template>
3303
3683
  </xsl:if>
3304
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
3684
+ </xsl:template><xsl:template name="tokenize">
3305
3685
  <xsl:param name="text"/>
3306
3686
  <xsl:param name="separator" select="' '"/>
3307
3687
  <xsl:choose>
@@ -3349,7 +3729,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3349
3729
  </xsl:call-template>
3350
3730
  </xsl:otherwise>
3351
3731
  </xsl:choose>
3352
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
3732
+ </xsl:template><xsl:template name="max_length">
3353
3733
  <xsl:param name="words"/>
3354
3734
  <xsl:for-each select="$words//word">
3355
3735
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3357,7 +3737,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3357
3737
  <xsl:value-of select="."/>
3358
3738
  </xsl:if>
3359
3739
  </xsl:for-each>
3360
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
3740
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3741
+ <xsl:param name="text" select="."/>
3742
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3743
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3744
+ </xsl:template><xsl:template name="add-zero-spaces">
3361
3745
  <xsl:param name="text" select="."/>
3362
3746
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3363
3747
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3410,7 +3794,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3410
3794
  <xsl:value-of select="$text"/>
3411
3795
  </xsl:otherwise>
3412
3796
  </xsl:choose>
3413
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
3797
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3414
3798
  <xsl:param name="text" select="."/>
3415
3799
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3416
3800
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3436,7 +3820,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3436
3820
  <xsl:value-of select="$text"/>
3437
3821
  </xsl:otherwise>
3438
3822
  </xsl:choose>
3439
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
3823
+ </xsl:template><xsl:template name="getSimpleTable">
3440
3824
  <xsl:variable name="simple-table">
3441
3825
 
3442
3826
  <!-- Step 1. colspan processing -->
@@ -3463,9 +3847,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3463
3847
  </xsl:choose> -->
3464
3848
  </xsl:variable>
3465
3849
  <xsl:copy-of select="$simple-table"/>
3466
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
3467
3851
  <xsl:apply-templates mode="simple-table-colspan"/>
3468
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
3469
3853
  <xsl:choose>
3470
3854
  <xsl:when test="@colspan">
3471
3855
  <xsl:variable name="td">
@@ -3487,16 +3871,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3487
3871
  </xsl:element>
3488
3872
  </xsl:otherwise>
3489
3873
  </xsl:choose>
3490
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
3491
3875
  <xsl:element name="tr">
3492
3876
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3493
3877
  <xsl:apply-templates mode="simple-table-colspan"/>
3494
3878
  </xsl:element>
3495
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
3879
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3496
3880
  <xsl:copy>
3497
3881
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3498
3882
  </xsl:copy>
3499
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
3883
+ </xsl:template><xsl:template name="repeatNode">
3500
3884
  <xsl:param name="count"/>
3501
3885
  <xsl:param name="node"/>
3502
3886
 
@@ -3507,18 +3891,18 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3507
3891
  </xsl:call-template>
3508
3892
  <xsl:copy-of select="$node"/>
3509
3893
  </xsl:if>
3510
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
3894
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3511
3895
  <xsl:copy>
3512
3896
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3513
3897
  </xsl:copy>
3514
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
3898
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3515
3899
  <xsl:copy>
3516
3900
  <xsl:copy-of select="tr[1]"/>
3517
3901
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3518
3902
  <xsl:with-param name="previousRow" select="tr[1]"/>
3519
3903
  </xsl:apply-templates>
3520
3904
  </xsl:copy>
3521
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
3905
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3522
3906
  <xsl:param name="previousRow"/>
3523
3907
  <xsl:variable name="currentRow" select="."/>
3524
3908
 
@@ -3552,43 +3936,53 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3552
3936
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3553
3937
  <xsl:with-param name="previousRow" select="$newRow"/>
3554
3938
  </xsl:apply-templates>
3555
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
3939
+ </xsl:template><xsl:template name="getLang">
3556
3940
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3557
3941
  <xsl:choose>
3558
3942
  <xsl:when test="$language = 'English'">en</xsl:when>
3559
3943
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3560
3944
  </xsl:choose>
3561
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
3945
+ </xsl:template><xsl:template name="capitalizeWords">
3562
3946
  <xsl:param name="str"/>
3563
3947
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3564
3948
  <xsl:choose>
3565
3949
  <xsl:when test="contains($str2, ' ')">
3566
3950
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3567
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3568
- <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>
3569
3956
  <xsl:text> </xsl:text>
3570
3957
  <xsl:call-template name="capitalizeWords">
3571
3958
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3572
3959
  </xsl:call-template>
3573
3960
  </xsl:when>
3574
3961
  <xsl:otherwise>
3575
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3576
- <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>
3577
3967
  </xsl:otherwise>
3578
3968
  </xsl:choose>
3579
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" 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">
3580
3974
  <fo:inline font-family="STIX2Math">
3581
3975
  <fo:instream-foreign-object fox:alt-text="Math">
3582
3976
  <xsl:copy-of select="."/>
3583
3977
  </fo:instream-foreign-object>
3584
3978
  </fo:inline>
3585
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
3979
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3586
3980
  <xsl:for-each select="*[local-name()='locality']">
3587
3981
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3588
3982
  <xsl:apply-templates select="."/>
3589
3983
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3590
3984
  </xsl:for-each>
3591
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
3985
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3592
3986
  <xsl:variable name="target">
3593
3987
  <xsl:choose>
3594
3988
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3618,4 +4012,275 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3618
4012
  </xsl:otherwise>
3619
4013
  </xsl:choose>
3620
4014
  </fo:inline>
4015
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4016
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4017
+ <!-- <xsl:choose>
4018
+ <xsl:when test="@lang = 'en'"></xsl:when>
4019
+ <xsl:otherwise> -->
4020
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4021
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4022
+ <!-- </xsl:otherwise>
4023
+ </xsl:choose> -->
4024
+ <xsl:apply-templates/>
4025
+ </fo:block>
4026
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4027
+ <fo:inline id="{@id}"/>
4028
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
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>
4035
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4036
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4037
+ </fo:block>
4038
+ <xsl:apply-templates/>
4039
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4040
+ <fo:inline><xsl:apply-templates/></fo:inline>
4041
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4042
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
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>
4049
+ <xsl:value-of select="$title-example"/>
4050
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4051
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4052
+ </xsl:if>
4053
+ <xsl:if test="*[local-name()='name']">
4054
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4055
+ </xsl:if>
4056
+ </fo:block>
4057
+ <xsl:apply-templates/>
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">
4059
+ <fo:inline><xsl:apply-templates/></fo:inline>
4060
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4061
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4062
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4063
+ <xsl:variable name="annotation-id" select="@id"/>
4064
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4065
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4066
+ <fo:inline>
4067
+ <xsl:apply-templates>
4068
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4069
+ </xsl:apply-templates>
4070
+ </fo:inline>
4071
+ </fo:block>
4072
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4073
+ <xsl:param name="callout"/>
4074
+ <fo:inline id="{@id}">
4075
+ <!-- for first p in annotation, put <x> -->
4076
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4077
+ <xsl:apply-templates/>
4078
+ </fo:inline>
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">
4091
+ <xsl:param name="date"/>
4092
+ <xsl:param name="format" select="'short'"/>
4093
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4094
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4095
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4096
+ <xsl:variable name="monthStr">
4097
+ <xsl:choose>
4098
+ <xsl:when test="$month = '01'">January</xsl:when>
4099
+ <xsl:when test="$month = '02'">February</xsl:when>
4100
+ <xsl:when test="$month = '03'">March</xsl:when>
4101
+ <xsl:when test="$month = '04'">April</xsl:when>
4102
+ <xsl:when test="$month = '05'">May</xsl:when>
4103
+ <xsl:when test="$month = '06'">June</xsl:when>
4104
+ <xsl:when test="$month = '07'">July</xsl:when>
4105
+ <xsl:when test="$month = '08'">August</xsl:when>
4106
+ <xsl:when test="$month = '09'">September</xsl:when>
4107
+ <xsl:when test="$month = '10'">October</xsl:when>
4108
+ <xsl:when test="$month = '11'">November</xsl:when>
4109
+ <xsl:when test="$month = '12'">December</xsl:when>
4110
+ </xsl:choose>
4111
+ </xsl:variable>
4112
+ <xsl:variable name="result">
4113
+ <xsl:choose>
4114
+ <xsl:when test="$format = 'short' or $day = ''">
4115
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4116
+ </xsl:when>
4117
+ <xsl:otherwise>
4118
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4119
+ </xsl:otherwise>
4120
+ </xsl:choose>
4121
+ </xsl:variable>
4122
+ <xsl:value-of select="$result"/>
4123
+ </xsl:template><xsl:template name="insertKeywords">
4124
+ <xsl:param name="sorting" select="'true'"/>
4125
+ <xsl:param name="charAtEnd" select="'.'"/>
4126
+ <xsl:param name="charDelim" select="', '"/>
4127
+ <xsl:choose>
4128
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4129
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4130
+ <xsl:sort data-type="text" order="ascending"/>
4131
+ <xsl:call-template name="insertKeyword">
4132
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4133
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4134
+ </xsl:call-template>
4135
+ </xsl:for-each>
4136
+ </xsl:when>
4137
+ <xsl:otherwise>
4138
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4139
+ <xsl:call-template name="insertKeyword">
4140
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4141
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4142
+ </xsl:call-template>
4143
+ </xsl:for-each>
4144
+ </xsl:otherwise>
4145
+ </xsl:choose>
4146
+ </xsl:template><xsl:template name="insertKeyword">
4147
+ <xsl:param name="charAtEnd"/>
4148
+ <xsl:param name="charDelim"/>
4149
+ <xsl:apply-templates/>
4150
+ <xsl:choose>
4151
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4152
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
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>
3621
4286
  </xsl:template></xsl:stylesheet>