metanorma-un 0.3.8 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,12 +749,17 @@
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"/>
762
+ <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
750
763
  </fo:block>
751
764
  <fo:block margin-left="5mm" margin-right="5mm">
752
765
  <xsl:apply-templates/>
@@ -813,14 +826,7 @@
813
826
 
814
827
  <xsl:template match="un:title">
815
828
  <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>
829
+ <xsl:call-template name="getId"/>
824
830
  </xsl:variable>
825
831
 
826
832
  <xsl:variable name="level">
@@ -931,7 +937,12 @@
931
937
  <xsl:template match="un:recommendation">
932
938
  <fo:block margin-left="20mm">
933
939
  <fo:block font-weight="bold">
934
- <xsl:text>Recommendation </xsl:text>
940
+ <xsl:variable name="title-recommendation">
941
+ <xsl:call-template name="getTitle">
942
+ <xsl:with-param name="name" select="'title-recommendation'"/>
943
+ </xsl:call-template>
944
+ </xsl:variable>
945
+ <xsl:value-of select="$title-recommendation"/>
935
946
  <xsl:choose>
936
947
  <xsl:when test="ancestor::un:sections">
937
948
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1001,7 +1012,12 @@
1001
1012
  </fo:block>
1002
1013
  <xsl:if test="un:name">
1003
1014
  <fo:block text-align="center" margin-bottom="6pt" keep-with-previous="always">
1004
- <xsl:text>Figure </xsl:text>
1015
+ <xsl:variable name="title-figure">
1016
+ <xsl:call-template name="getTitle">
1017
+ <xsl:with-param name="name" select="'title-figure'"/>
1018
+ </xsl:call-template>
1019
+ </xsl:variable>
1020
+ <xsl:value-of select="$title-figure"/>
1005
1021
  <xsl:choose>
1006
1022
  <xsl:when test="ancestor::un:annex">
1007
1023
  <xsl:choose>
@@ -1132,7 +1148,12 @@
1132
1148
 
1133
1149
  <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note">
1134
1150
  <fo:block font-size="10pt" space-after="12pt" text-indent="0">
1135
- <fo:inline padding-right="4mm"><xsl:text>NOTE </xsl:text>
1151
+ <xsl:variable name="title-note">
1152
+ <xsl:call-template name="getTitle">
1153
+ <xsl:with-param name="name" select="'title-note'"/>
1154
+ </xsl:call-template>
1155
+ </xsl:variable>
1156
+ <fo:inline padding-right="4mm"><xsl:value-of select="$title-note"/>
1136
1157
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
1137
1158
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
1138
1159
  </xsl:if>
@@ -1143,12 +1164,17 @@
1143
1164
 
1144
1165
  <xsl:template match="un:termnote">
1145
1166
  <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/>
1167
+ <xsl:variable name="title-note">
1168
+ <xsl:call-template name="getTitle">
1169
+ <xsl:with-param name="name" select="'title-note'"/>
1170
+ </xsl:call-template>
1171
+ </xsl:variable>
1172
+ <xsl:value-of select="$title-note"/>
1173
+ <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1174
+ <xsl:number/><xsl:text> </xsl:text>
1175
+ </xsl:if>
1176
+ <xsl:text>– </xsl:text>
1177
+ <xsl:apply-templates/>
1152
1178
  </fo:block>
1153
1179
  </xsl:template>
1154
1180
 
@@ -1176,7 +1202,7 @@
1176
1202
  <fo:table-cell> <!-- display-align="center" -->
1177
1203
  <fo:block text-align="right">
1178
1204
  <xsl:if test="not(ancestor::un:annex)">
1179
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1205
+ <xsl:number format="(1)" level="any"/>
1180
1206
  </xsl:if>
1181
1207
  <xsl:if test="ancestor::un:annex">
1182
1208
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1200,7 +1226,12 @@
1200
1226
  </xsl:template>
1201
1227
 
1202
1228
  <xsl:template match="un:example">
1203
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1229
+ <xsl:variable name="title-example">
1230
+ <xsl:call-template name="getTitle">
1231
+ <xsl:with-param name="name" select="'title-example'"/>
1232
+ </xsl:call-template>
1233
+ </xsl:variable>
1234
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1204
1235
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1205
1236
  <xsl:apply-templates/>
1206
1237
  </fo:block>
@@ -1227,7 +1258,7 @@
1227
1258
  <xsl:if test="@type = 'inline'">
1228
1259
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1229
1260
  </xsl:if>
1230
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1261
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1231
1262
 
1232
1263
  <xsl:apply-templates select="un:localityStack"/>
1233
1264
 
@@ -1236,9 +1267,19 @@
1236
1267
  </xsl:template>
1237
1268
 
1238
1269
  <xsl:template match="un:locality">
1270
+ <xsl:variable name="title-section">
1271
+ <xsl:call-template name="getTitle">
1272
+ <xsl:with-param name="name" select="'title-section'"/>
1273
+ </xsl:call-template>
1274
+ </xsl:variable>
1275
+ <xsl:variable name="title-clause">
1276
+ <xsl:call-template name="getTitle">
1277
+ <xsl:with-param name="name" select="'title-clause'"/>
1278
+ </xsl:call-template>
1279
+ </xsl:variable>
1239
1280
  <xsl:choose>
1240
- <xsl:when test="@type = 'section'">Section </xsl:when>
1241
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
1281
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1282
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1242
1283
  <xsl:otherwise/>
1243
1284
  </xsl:choose>
1244
1285
  <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
@@ -1257,7 +1298,7 @@
1257
1298
  </fo:block>
1258
1299
  </xsl:template>
1259
1300
  <xsl:template match="un:term" mode="table">
1260
- <fo:table-row>
1301
+ <fo:table-row id="{@id}">
1261
1302
  <fo:table-cell padding-right="1mm">
1262
1303
  <fo:block margin-bottom="12pt">
1263
1304
  <xsl:apply-templates select="un:preferred"/>
@@ -1271,7 +1312,7 @@
1271
1312
  </fo:table-row>
1272
1313
  </xsl:template>
1273
1314
  <xsl:template match="un:preferred">
1274
- <fo:inline id="{../@id}">
1315
+ <fo:inline>
1275
1316
  <xsl:apply-templates/>
1276
1317
  </fo:inline>
1277
1318
  </xsl:template>
@@ -1337,15 +1378,7 @@
1337
1378
  <xsl:apply-templates/>
1338
1379
  </fo:block>
1339
1380
  </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
-
1381
+
1349
1382
  <xsl:template match="un:references">
1350
1383
  <fo:block>
1351
1384
  <xsl:if test="not(un:title)">
@@ -1406,29 +1439,6 @@
1406
1439
  </fo:static-content>
1407
1440
  </xsl:template>
1408
1441
 
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
1442
  <xsl:template name="getSection">
1433
1443
  <xsl:variable name="level">
1434
1444
  <xsl:call-template name="getLevel"/>
@@ -1456,12 +1466,17 @@
1456
1466
  <xsl:when test="ancestor::un:annex">
1457
1467
  <xsl:choose>
1458
1468
  <xsl:when test="$level = 1">
1469
+ <xsl:variable name="title-annex">
1470
+ <xsl:call-template name="getTitle">
1471
+ <xsl:with-param name="name" select="'title-annex'"/>
1472
+ </xsl:call-template>
1473
+ </xsl:variable>
1459
1474
  <xsl:choose>
1460
1475
  <xsl:when test="local-name() = 'title'">
1461
- <xsl:text>ANNEX </xsl:text>
1476
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-annex))"/>
1462
1477
  <xsl:number format="A" level="any" count="un:annex"/>
1463
1478
  </xsl:when>
1464
- <xsl:otherwise>Annex</xsl:otherwise>
1479
+ <xsl:otherwise><xsl:value-of select="normalize-space($title-annex)"/></xsl:otherwise>
1465
1480
  </xsl:choose>
1466
1481
  </xsl:when>
1467
1482
  <xsl:otherwise>
@@ -1562,8 +1577,10 @@
1562
1577
  </xsl:choose>
1563
1578
  </xsl:variable>
1564
1579
  <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)"/>
1580
+ <xsl:when test="$first = 'true'">
1581
+ <xsl:call-template name="capitalize">
1582
+ <xsl:with-param name="str" select="$value"/>
1583
+ </xsl:call-template>
1567
1584
  </xsl:when>
1568
1585
  <xsl:otherwise>
1569
1586
  <xsl:value-of select="$value"/>
@@ -1599,8 +1616,8 @@
1599
1616
  </xsl:template>
1600
1617
 
1601
1618
  <xsl:template name="getLanguage">
1602
- <xsl:param name="lang"/>
1603
- <xsl:variable name="language" select="translate($lang, $upper, $lower)"/>
1619
+ <xsl:param name="lang"/>
1620
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
1604
1621
  <xsl:choose>
1605
1622
  <xsl:when test="$language = 'en'">English</xsl:when>
1606
1623
  <xsl:when test="$language = 'de'">Deutsch</xsl:when>
@@ -2467,16 +2484,215 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2467
2484
  </xsl:text>
2468
2485
  </xsl:variable>
2469
2486
 
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">
2487
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2488
+
2489
+ <title-table lang="en">Table </title-table>
2490
+ <title-table lang="fr">Tableau </title-table>
2491
+
2492
+ <title-table lang="zh">Table </title-table>
2493
+
2494
+
2495
+
2496
+ <title-note lang="en">NOTE </title-note>
2497
+ <title-note lang="fr">NOTE </title-note>
2498
+
2499
+ <title-note lang="zh">NOTE </title-note>
2500
+
2501
+
2502
+
2503
+ <title-figure lang="en">Figure </title-figure>
2504
+ <title-figure lang="fr">Figure </title-figure>
2505
+
2506
+ <title-figure lang="zh">Figure </title-figure>
2507
+
2508
+
2509
+
2510
+ <title-example lang="en">EXAMPLE </title-example>
2511
+ <title-example lang="fr">EXEMPLE </title-example>
2512
+
2513
+ <title-example lang="zh">EXAMPLE </title-example>
2514
+
2471
2515
 
2472
2516
 
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()">
2517
+ <title-example-xref lang="en">Example </title-example-xref>
2518
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2519
+
2520
+ <title-section lang="en">Section </title-section>
2521
+ <title-section lang="fr">Section </title-section>
2522
+
2523
+ <title-inequality lang="en">Inequality </title-inequality>
2524
+ <title-inequality lang="fr">Inequality </title-inequality>
2525
+
2526
+ <title-equation lang="en">Equation </title-equation>
2527
+ <title-equation lang="fr">Equation </title-equation>
2528
+
2529
+ <title-annex lang="en">Annex </title-annex>
2530
+ <title-annex lang="fr">Annexe </title-annex>
2531
+
2532
+ <title-annex lang="zh">Annex </title-annex>
2533
+
2534
+
2535
+
2536
+ <title-appendix lang="en">Appendix </title-appendix>
2537
+ <title-appendix lang="fr">Appendix </title-appendix>
2538
+
2539
+ <title-clause lang="en">Clause </title-clause>
2540
+ <title-clause lang="fr">Article </title-clause>
2541
+
2542
+ <title-clause lang="zh">Clause </title-clause>
2543
+
2544
+
2545
+
2546
+ <title-edition lang="en">
2547
+
2548
+ <xsl:text>Edition </xsl:text>
2549
+
2550
+
2551
+ </title-edition>
2552
+
2553
+ <title-formula lang="en">Formula </title-formula>
2554
+ <title-formula lang="fr">Formula </title-formula>
2555
+
2556
+ <title-toc lang="en">
2557
+
2558
+
2559
+
2560
+ </title-toc>
2561
+ <title-toc lang="fr">Sommaire</title-toc>
2562
+
2563
+ <title-toc lang="zh">Contents</title-toc>
2564
+
2565
+
2566
+
2567
+ <title-page lang="en">Page</title-page>
2568
+ <title-page lang="fr">Page</title-page>
2569
+
2570
+ <title-key lang="en">Key</title-key>
2571
+ <title-key lang="fr">Légende</title-key>
2572
+
2573
+ <title-where lang="en">where</title-where>
2574
+ <title-where lang="fr">où</title-where>
2575
+
2576
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2577
+
2578
+ <title-part lang="en">
2579
+
2580
+
2581
+ </title-part>
2582
+ <title-part lang="fr">
2583
+
2584
+
2585
+ </title-part>
2586
+ <title-part lang="zh">第 # 部分:</title-part>
2587
+
2588
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2589
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2590
+
2591
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2592
+
2593
+
2594
+
2595
+ <title-modified lang="en">modified</title-modified>
2596
+ <title-modified lang="fr">modifiée</title-modified>
2597
+
2598
+ <title-modified lang="zh">modified</title-modified>
2599
+
2600
+
2601
+
2602
+ <title-source lang="en">SOURCE</title-source>
2603
+
2604
+ <title-keywords lang="en">Keywords</title-keywords>
2605
+
2606
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2607
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2608
+
2609
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2610
+
2611
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2612
+
2613
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2614
+
2615
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2616
+
2617
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2618
+
2619
+ <title-abstract lang="en">Abstract</title-abstract>
2620
+
2621
+ <title-summary lang="en">Summary</title-summary>
2622
+
2623
+ <title-in lang="en">in </title-in>
2624
+
2625
+ <title-box lang="en">Box </title-box>
2626
+
2627
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2628
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2629
+
2630
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2631
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2632
+
2633
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2634
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2635
+
2636
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2637
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2638
+
2639
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2640
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2641
+
2642
+ <title-caution lang="en">CAUTION</title-caution>
2643
+ <title-caution lang="zh">注意</title-caution>
2644
+
2645
+ <title-warning lang="en">WARNING</title-warning>
2646
+ <title-warning lang="zh">警告</title-warning>
2647
+
2648
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2649
+ </xsl:variable><xsl:template name="getTitle">
2650
+ <xsl:param name="name"/>
2651
+ <xsl:variable name="lang">
2652
+ <xsl:call-template name="getLang"/>
2653
+ </xsl:variable>
2654
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2655
+ <xsl:choose>
2656
+ <xsl:when test="normalize-space($title_) != ''">
2657
+ <xsl:value-of select="$title_"/>
2658
+ </xsl:when>
2659
+ <xsl:otherwise>
2660
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2661
+ </xsl:otherwise>
2662
+ </xsl:choose>
2663
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2664
+
2665
+
2666
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2667
+
2668
+
2669
+
2670
+
2671
+
2672
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2673
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2674
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2675
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2676
+
2677
+
2678
+
2679
+
2680
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2681
+
2682
+
2683
+
2684
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2685
+
2686
+
2687
+
2688
+ </xsl:attribute-set><xsl:template match="text()">
2474
2689
  <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']">
2690
+ </xsl:template><xsl:template match="*[local-name()='br']">
2476
2691
  <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']">
2692
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2693
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2694
+ <xsl:call-template name="add-zero-spaces-java"/>
2695
+ </xsl:template><xsl:template match="*[local-name()='table']">
2480
2696
 
2481
2697
  <xsl:variable name="simple-table">
2482
2698
  <!-- <xsl:copy> -->
@@ -2513,33 +2729,17 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2513
2729
 
2514
2730
 
2515
2731
 
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>
2732
+
2733
+ <xsl:variable name="title-table">
2734
+ <xsl:call-template name="getTitle">
2735
+ <xsl:with-param name="name" select="'title-table'"/>
2736
+ </xsl:call-template>
2737
+ </xsl:variable>
2738
+ <xsl:value-of select="$title-table"/>
2739
+
2740
+ <xsl:call-template name="getTableNumber"/>
2741
+
2742
+
2543
2743
  <xsl:if test="*[local-name()='name']">
2544
2744
 
2545
2745
  :
@@ -2609,6 +2809,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2609
2809
 
2610
2810
 
2611
2811
 
2812
+
2612
2813
  <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
2814
 
2614
2815
 
@@ -2623,9 +2824,10 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2623
2824
 
2624
2825
 
2625
2826
 
2827
+
2626
2828
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2627
2829
  <xsl:choose>
2628
- <xsl:when test=". = 1">
2830
+ <xsl:when test=". = 1 or . = 0">
2629
2831
  <fo:table-column column-width="proportional-column-width(2)"/>
2630
2832
  </xsl:when>
2631
2833
  <xsl:otherwise>
@@ -2633,21 +2835,57 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2633
2835
  </xsl:otherwise>
2634
2836
  </xsl:choose>
2635
2837
  </xsl:for-each>
2636
- <xsl:apply-templates/>
2838
+
2839
+ <xsl:choose>
2840
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2841
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2842
+ </xsl:when>
2843
+ <xsl:otherwise>
2844
+ <xsl:apply-templates/>
2845
+ </xsl:otherwise>
2846
+ </xsl:choose>
2847
+
2637
2848
  </fo:table>
2638
2849
 
2639
2850
 
2640
2851
 
2641
2852
  </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">
2853
+ </xsl:template><xsl:template name="getTableNumber">
2854
+ <xsl:choose>
2855
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2856
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2857
+ </xsl:when>
2858
+ <xsl:when test="ancestor::*[local-name()='annex']">
2859
+
2860
+
2861
+
2862
+
2863
+
2864
+
2865
+
2866
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2867
+ <xsl:number format="I." count="*[local-name()='annex']"/>
2868
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2869
+
2870
+
2871
+ </xsl:when>
2872
+ <xsl:otherwise>
2873
+
2874
+
2875
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2876
+ <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']"/>
2877
+
2878
+ </xsl:otherwise>
2879
+ </xsl:choose>
2880
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2643
2881
  <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">
2882
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2645
2883
  <xsl:param name="table-row"/>
2646
2884
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2647
2885
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2648
2886
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2649
2887
  <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">
2888
+ </xsl:template><xsl:template name="calculate-column-widths">
2651
2889
  <xsl:param name="table"/>
2652
2890
  <xsl:param name="cols-count"/>
2653
2891
  <xsl:param name="curr-col" select="1"/>
@@ -2656,7 +2894,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2656
2894
  <xsl:if test="$curr-col &lt;= $cols-count">
2657
2895
  <xsl:variable name="widths">
2658
2896
  <xsl:choose>
2659
- <xsl:when test="not($table)">
2897
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2660
2898
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2661
2899
  <xsl:variable name="words">
2662
2900
  <xsl:call-template name="tokenize">
@@ -2695,9 +2933,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2695
2933
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2696
2934
  </xsl:variable>
2697
2935
  <xsl:variable name="words">
2936
+ <xsl:variable name="string_with_added_zerospaces">
2937
+ <xsl:call-template name="add-zero-spaces-java">
2938
+ <xsl:with-param name="text" select="$td_text"/>
2939
+ </xsl:call-template>
2940
+ </xsl:variable>
2698
2941
  <xsl:call-template name="tokenize">
2699
2942
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2700
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2943
+ <!-- 2009 thinspace -->
2944
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2945
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2701
2946
  </xsl:call-template>
2702
2947
  </xsl:variable>
2703
2948
  <xsl:variable name="max_length">
@@ -2738,17 +2983,28 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2738
2983
  <xsl:with-param name="table" select="$table"/>
2739
2984
  </xsl:call-template>
2740
2985
  </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">
2986
+ </xsl:template><xsl:template match="text()" mode="td_text">
2742
2987
  <xsl:variable name="zero-space">​</xsl:variable>
2743
2988
  <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">
2989
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2990
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2991
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2992
+ <xsl:value-of select="@target"/>
2993
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2994
+ <xsl:param name="cols-count"/>
2745
2995
  <!-- font-weight="bold" -->
2746
- <fo:table-header>
2996
+ <fo:table-header>
2997
+
2747
2998
  <xsl:apply-templates/>
2748
2999
  </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">
3000
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3001
+ <fo:table-body>
3002
+ <xsl:apply-templates/>
3003
+ </fo:table-body>
3004
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2750
3005
  <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">
3006
+ </xsl:template><xsl:template name="insertTableFooter">
3007
+ <xsl:param name="cols-count"/>
2752
3008
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2753
3009
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2754
3010
 
@@ -2759,22 +3015,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2759
3015
  <!-- if there are note(s) or fn(s) then create footer row -->
2760
3016
  <xsl:if test="$isNoteOrFnExist = 'true'">
2761
3017
 
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>
3018
+
2778
3019
 
2779
3020
  <fo:table-row>
2780
3021
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2802,11 +3043,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2802
3043
  </fo:table-footer>
2803
3044
 
2804
3045
  </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']">
3046
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2806
3047
 
2807
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3048
+ <xsl:variable name="cols-count">
3049
+ <xsl:choose>
3050
+ <xsl:when test="../*[local-name()='thead']">
3051
+ <xsl:call-template name="calculate-columns-numbers">
3052
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3053
+ </xsl:call-template>
3054
+ </xsl:when>
3055
+ <xsl:otherwise>
3056
+ <xsl:call-template name="calculate-columns-numbers">
3057
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3058
+ </xsl:call-template>
3059
+ </xsl:otherwise>
3060
+ </xsl:choose>
3061
+ </xsl:variable>
3062
+
3063
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3064
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3065
+ </xsl:apply-templates>
2808
3066
 
2809
- <xsl:call-template name="insertTableFooter"/>
3067
+ <xsl:call-template name="insertTableFooter">
3068
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3069
+ </xsl:call-template>
2810
3070
 
2811
3071
  <fo:table-body>
2812
3072
  <xsl:apply-templates/>
@@ -2814,7 +3074,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2814
3074
 
2815
3075
  </fo:table-body>
2816
3076
 
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']">
3077
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2818
3078
  <xsl:variable name="parent-name" select="local-name(..)"/>
2819
3079
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2820
3080
  <fo:table-row min-height="4mm">
@@ -2838,7 +3098,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2838
3098
 
2839
3099
  <xsl:apply-templates/>
2840
3100
  </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']">
3101
+ </xsl:template><xsl:template match="*[local-name()='th']">
2842
3102
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2843
3103
 
2844
3104
 
@@ -2870,7 +3130,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2870
3130
  <xsl:apply-templates/>
2871
3131
  </fo:block>
2872
3132
  </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']">
3133
+ </xsl:template><xsl:template match="*[local-name()='td']">
2874
3134
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2875
3135
 
2876
3136
 
@@ -2899,6 +3159,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2899
3159
  </xsl:attribute>
2900
3160
  </xsl:if>
2901
3161
  <fo:block>
3162
+
2902
3163
  <xsl:apply-templates/>
2903
3164
  </fo:block>
2904
3165
  <!-- <xsl:choose>
@@ -2914,16 +3175,23 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2914
3175
 
2915
3176
 
2916
3177
  </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">
3178
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2918
3179
 
2919
3180
 
2920
3181
  <fo:block font-size="10pt" margin-bottom="12pt">
2921
3182
 
2922
3183
 
2923
3184
 
3185
+
2924
3186
  <fo:inline padding-right="2mm">
2925
3187
 
2926
- <xsl:text>NOTE </xsl:text>
3188
+
3189
+ <xsl:variable name="title-note">
3190
+ <xsl:call-template name="getTitle">
3191
+ <xsl:with-param name="name" select="'title-note'"/>
3192
+ </xsl:call-template>
3193
+ </xsl:variable>
3194
+ <xsl:value-of select="$title-note"/>
2927
3195
 
2928
3196
 
2929
3197
 
@@ -2933,9 +3201,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2933
3201
  <xsl:apply-templates mode="process"/>
2934
3202
  </fo:block>
2935
3203
 
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">
3204
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2937
3205
  <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">
3206
+ </xsl:template><xsl:template name="fn_display">
2939
3207
  <xsl:variable name="references">
2940
3208
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2941
3209
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2952,6 +3220,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2952
3220
 
2953
3221
 
2954
3222
 
3223
+
2955
3224
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2956
3225
 
2957
3226
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2971,7 +3240,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2971
3240
  </fo:block>
2972
3241
  </xsl:if>
2973
3242
  </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">
3243
+ </xsl:template><xsl:template name="fn_name_display">
2975
3244
  <!-- <xsl:variable name="references">
2976
3245
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2977
3246
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2987,7 +3256,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2987
3256
  <xsl:apply-templates/>
2988
3257
  </fo:block>
2989
3258
  </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">
3259
+ </xsl:template><xsl:template name="fn_display_figure">
2991
3260
  <xsl:variable name="key_iso">
2992
3261
  <!-- and (not(@class) or @class !='pseudocode') -->
2993
3262
  </xsl:variable>
@@ -2998,6 +3267,36 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
2998
3267
  </fn>
2999
3268
  </xsl:for-each>
3000
3269
  </xsl:variable>
3270
+
3271
+ <!-- current hierarchy is 'figure' element -->
3272
+ <xsl:variable name="following_dl_colwidths">
3273
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3274
+ <xsl:variable name="html-table">
3275
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3276
+ <xsl:element name="{$ns}:table">
3277
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3278
+ <tbody>
3279
+ <xsl:apply-templates mode="dl"/>
3280
+ </tbody>
3281
+ </xsl:for-each>
3282
+ </xsl:element>
3283
+ </xsl:variable>
3284
+
3285
+ <xsl:call-template name="calculate-column-widths">
3286
+ <xsl:with-param name="cols-count" select="2"/>
3287
+ <xsl:with-param name="table" select="$html-table"/>
3288
+ </xsl:call-template>
3289
+
3290
+ </xsl:if>
3291
+ </xsl:variable>
3292
+
3293
+
3294
+ <xsl:variable name="maxlength_dt">
3295
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3296
+ <xsl:call-template name="getMaxLength_dt"/>
3297
+ </xsl:for-each>
3298
+ </xsl:variable>
3299
+
3001
3300
  <xsl:if test="xalan:nodeset($references)//fn">
3002
3301
  <fo:block>
3003
3302
  <fo:table width="95%" table-layout="fixed">
@@ -3005,8 +3304,19 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3005
3304
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3006
3305
 
3007
3306
  </xsl:if>
3008
- <fo:table-column column-width="15%"/>
3009
- <fo:table-column column-width="85%"/>
3307
+ <xsl:choose>
3308
+ <!-- if there 'dl', then set same columns width -->
3309
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3310
+ <xsl:call-template name="setColumnWidth_dl">
3311
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3312
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3313
+ </xsl:call-template>
3314
+ </xsl:when>
3315
+ <xsl:otherwise>
3316
+ <fo:table-column column-width="15%"/>
3317
+ <fo:table-column column-width="85%"/>
3318
+ </xsl:otherwise>
3319
+ </xsl:choose>
3010
3320
  <fo:table-body>
3011
3321
  <xsl:for-each select="xalan:nodeset($references)//fn">
3012
3322
  <xsl:variable name="reference" select="@reference"/>
@@ -3038,7 +3348,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3038
3348
  </fo:block>
3039
3349
  </xsl:if>
3040
3350
 
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']">
3351
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3042
3352
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3043
3353
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3044
3354
 
@@ -3050,11 +3360,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3050
3360
  <xsl:value-of select="@reference"/>
3051
3361
  </fo:basic-link>
3052
3362
  </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']">
3363
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3054
3364
  <fo:inline>
3055
3365
  <xsl:apply-templates/>
3056
3366
  </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']">
3367
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3058
3368
  <xsl:variable name="parent" select="local-name(..)"/>
3059
3369
 
3060
3370
  <xsl:variable name="key_iso">
@@ -3066,8 +3376,13 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3066
3376
 
3067
3377
 
3068
3378
  <fo:block margin-bottom="12pt" text-align="left">
3069
-
3070
- <xsl:text>where </xsl:text>
3379
+
3380
+ <xsl:variable name="title-where">
3381
+ <xsl:call-template name="getTitle">
3382
+ <xsl:with-param name="name" select="'title-where'"/>
3383
+ </xsl:call-template>
3384
+ </xsl:variable>
3385
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3071
3386
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3072
3387
  <xsl:text/>
3073
3388
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3080,15 +3395,25 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3080
3395
 
3081
3396
 
3082
3397
 
3083
- <xsl:text>where</xsl:text>
3398
+ <xsl:variable name="title-where">
3399
+ <xsl:call-template name="getTitle">
3400
+ <xsl:with-param name="name" select="'title-where'"/>
3401
+ </xsl:call-template>
3402
+ </xsl:variable>
3403
+ <xsl:value-of select="$title-where"/>
3084
3404
  </fo:block>
3085
3405
  </xsl:when>
3086
3406
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3087
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3407
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3088
3408
 
3089
3409
 
3090
3410
 
3091
- <xsl:text>Key</xsl:text>
3411
+ <xsl:variable name="title-key">
3412
+ <xsl:call-template name="getTitle">
3413
+ <xsl:with-param name="name" select="'title-key'"/>
3414
+ </xsl:call-template>
3415
+ </xsl:variable>
3416
+ <xsl:value-of select="$title-key"/>
3092
3417
  </fo:block>
3093
3418
  </xsl:when>
3094
3419
  </xsl:choose>
@@ -3099,26 +3424,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3099
3424
 
3100
3425
 
3101
3426
 
3427
+
3102
3428
  <fo:block>
3103
3429
 
3104
3430
 
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"/> -->
3431
+
3122
3432
 
3123
3433
  <fo:table width="95%" table-layout="fixed">
3124
3434
 
@@ -3131,42 +3441,30 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3131
3441
 
3132
3442
  </xsl:when>
3133
3443
  </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>
3444
+ <!-- create virtual html table for dl/[dt and dd] -->
3445
+ <xsl:variable name="html-table">
3446
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3447
+ <xsl:element name="{$ns}:table">
3448
+ <tbody>
3449
+ <xsl:apply-templates mode="dl"/>
3450
+ </tbody>
3451
+ </xsl:element>
3452
+ </xsl:variable>
3453
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3454
+ <xsl:variable name="colwidths">
3455
+ <xsl:call-template name="calculate-column-widths">
3456
+ <xsl:with-param name="cols-count" select="2"/>
3457
+ <xsl:with-param name="table" select="$html-table"/>
3458
+ </xsl:call-template>
3459
+ </xsl:variable>
3460
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3461
+ <xsl:variable name="maxlength_dt">
3462
+ <xsl:call-template name="getMaxLength_dt"/>
3463
+ </xsl:variable>
3464
+ <xsl:call-template name="setColumnWidth_dl">
3465
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3466
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3467
+ </xsl:call-template>
3170
3468
  <fo:table-body>
3171
3469
  <xsl:apply-templates>
3172
3470
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3176,7 +3474,61 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3176
3474
  </fo:block>
3177
3475
  </fo:block>
3178
3476
  </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']">
3477
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3478
+ <xsl:param name="colwidths"/>
3479
+ <xsl:param name="maxlength_dt"/>
3480
+ <xsl:choose>
3481
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3482
+ <fo:table-column column-width="50%"/>
3483
+ <fo:table-column column-width="50%"/>
3484
+ </xsl:when>
3485
+ <xsl:otherwise>
3486
+ <xsl:choose>
3487
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3488
+ <fo:table-column column-width="5%"/>
3489
+ <fo:table-column column-width="95%"/>
3490
+ </xsl:when>
3491
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3492
+ <fo:table-column column-width="10%"/>
3493
+ <fo:table-column column-width="90%"/>
3494
+ </xsl:when>
3495
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3496
+ <fo:table-column column-width="60%"/>
3497
+ <fo:table-column column-width="40%"/>
3498
+ </xsl:when> -->
3499
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3500
+ <fo:table-column column-width="50%"/>
3501
+ <fo:table-column column-width="50%"/>
3502
+ </xsl:when>
3503
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3504
+ <fo:table-column column-width="40%"/>
3505
+ <fo:table-column column-width="60%"/>
3506
+ </xsl:when>
3507
+ <xsl:otherwise>
3508
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3509
+ <xsl:choose>
3510
+ <xsl:when test=". = 1 or . = 0">
3511
+ <fo:table-column column-width="proportional-column-width(2)"/>
3512
+ </xsl:when>
3513
+ <xsl:otherwise>
3514
+ <fo:table-column column-width="proportional-column-width({.})"/>
3515
+ </xsl:otherwise>
3516
+ </xsl:choose>
3517
+ </xsl:for-each>
3518
+ </xsl:otherwise>
3519
+ </xsl:choose>
3520
+ <!-- <fo:table-column column-width="15%"/>
3521
+ <fo:table-column column-width="85%"/> -->
3522
+ </xsl:otherwise>
3523
+ </xsl:choose>
3524
+ </xsl:template><xsl:template name="getMaxLength_dt">
3525
+ <xsl:for-each select="*[local-name()='dt']">
3526
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3527
+ <xsl:if test="position() = 1">
3528
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3529
+ </xsl:if>
3530
+ </xsl:for-each>
3531
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3180
3532
  <xsl:param name="key_iso"/>
3181
3533
 
3182
3534
  <!-- <tr>
@@ -3192,7 +3544,12 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3192
3544
  <xsl:if test="normalize-space($key_iso) = 'true'">
3193
3545
  <xsl:attribute name="margin-top">0</xsl:attribute>
3194
3546
  </xsl:if>
3195
- NOTE
3547
+ <xsl:variable name="title-note">
3548
+ <xsl:call-template name="getTitle">
3549
+ <xsl:with-param name="name" select="'title-note'"/>
3550
+ </xsl:call-template>
3551
+ </xsl:variable>
3552
+ <xsl:value-of select="$title-note"/>
3196
3553
  </fo:block>
3197
3554
  </fo:table-cell>
3198
3555
  <fo:table-cell>
@@ -3201,7 +3558,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3201
3558
  </fo:block>
3202
3559
  </fo:table-cell>
3203
3560
  </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">
3561
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3205
3562
  <tr>
3206
3563
  <td>
3207
3564
  <xsl:apply-templates/>
@@ -3214,11 +3571,12 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3214
3571
  </td>
3215
3572
  </tr>
3216
3573
 
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']">
3574
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3218
3575
  <xsl:param name="key_iso"/>
3219
3576
 
3220
3577
  <fo:table-row>
3221
3578
  <fo:table-cell>
3579
+
3222
3580
  <fo:block margin-top="6pt">
3223
3581
 
3224
3582
 
@@ -3228,8 +3586,15 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3228
3586
  </xsl:if>
3229
3587
 
3230
3588
 
3231
- <xsl:apply-templates/>
3232
3589
 
3590
+
3591
+
3592
+ <xsl:apply-templates/>
3593
+ <!-- <xsl:if test="$namespace = 'gb'">
3594
+ <xsl:if test="ancestor::*[local-name()='formula']">
3595
+ <xsl:text>—</xsl:text>
3596
+ </xsl:if>
3597
+ </xsl:if> -->
3233
3598
  </fo:block>
3234
3599
  </fo:table-cell>
3235
3600
  <fo:table-cell>
@@ -3243,37 +3608,37 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3243
3608
  </fo:table-cell>
3244
3609
  </fo:table-row>
3245
3610
 
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">
3611
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3247
3612
  <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">
3613
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3249
3614
  <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">
3615
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3251
3616
  <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']">
3617
+ </xsl:template><xsl:template match="*[local-name()='em']">
3253
3618
  <fo:inline font-style="italic">
3254
3619
  <xsl:apply-templates/>
3255
3620
  </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']">
3621
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3257
3622
  <fo:inline font-weight="bold">
3258
3623
  <xsl:apply-templates/>
3259
3624
  </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']">
3625
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3261
3626
  <fo:inline font-size="80%" vertical-align="super">
3262
3627
  <xsl:apply-templates/>
3263
3628
  </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']">
3629
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3265
3630
  <fo:inline font-size="80%" vertical-align="sub">
3266
3631
  <xsl:apply-templates/>
3267
3632
  </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">
3633
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3634
+ <fo:inline font-family="Courier" font-size="10pt">
3270
3635
  <xsl:apply-templates/>
3271
3636
  </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']">
3637
+ </xsl:template><xsl:template match="*[local-name()='del']">
3273
3638
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3274
3639
  <xsl:apply-templates/>
3275
3640
  </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']]">
3641
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3277
3642
  <xsl:variable name="text" select="normalize-space(.)"/>
3278
3643
  <fo:inline font-size="75%">
3279
3644
  <xsl:if test="string-length($text) &gt; 0">
@@ -3282,10 +3647,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3282
3647
  </xsl:call-template>
3283
3648
  </xsl:if>
3284
3649
  </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">
3650
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3286
3651
  <xsl:param name="text"/>
3287
3652
  <xsl:variable name="char" select="substring($text,1,1)"/>
3288
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3653
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3654
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3289
3655
  <xsl:choose>
3290
3656
  <xsl:when test="$char=$upperCase">
3291
3657
  <fo:inline font-size="{100 div 0.75}%">
@@ -3301,7 +3667,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3301
3667
  <xsl:with-param name="text" select="substring($text,2)"/>
3302
3668
  </xsl:call-template>
3303
3669
  </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">
3670
+ </xsl:template><xsl:template name="tokenize">
3305
3671
  <xsl:param name="text"/>
3306
3672
  <xsl:param name="separator" select="' '"/>
3307
3673
  <xsl:choose>
@@ -3349,7 +3715,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3349
3715
  </xsl:call-template>
3350
3716
  </xsl:otherwise>
3351
3717
  </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">
3718
+ </xsl:template><xsl:template name="max_length">
3353
3719
  <xsl:param name="words"/>
3354
3720
  <xsl:for-each select="$words//word">
3355
3721
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3357,7 +3723,11 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3357
3723
  <xsl:value-of select="."/>
3358
3724
  </xsl:if>
3359
3725
  </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">
3726
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3727
+ <xsl:param name="text" select="."/>
3728
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3729
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3730
+ </xsl:template><xsl:template name="add-zero-spaces">
3361
3731
  <xsl:param name="text" select="."/>
3362
3732
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3363
3733
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3410,7 +3780,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3410
3780
  <xsl:value-of select="$text"/>
3411
3781
  </xsl:otherwise>
3412
3782
  </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">
3783
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3414
3784
  <xsl:param name="text" select="."/>
3415
3785
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3416
3786
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3436,7 +3806,7 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3436
3806
  <xsl:value-of select="$text"/>
3437
3807
  </xsl:otherwise>
3438
3808
  </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">
3809
+ </xsl:template><xsl:template name="getSimpleTable">
3440
3810
  <xsl:variable name="simple-table">
3441
3811
 
3442
3812
  <!-- Step 1. colspan processing -->
@@ -3463,9 +3833,9 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3463
3833
  </xsl:choose> -->
3464
3834
  </xsl:variable>
3465
3835
  <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">
3836
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3467
3837
  <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">
3838
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3469
3839
  <xsl:choose>
3470
3840
  <xsl:when test="@colspan">
3471
3841
  <xsl:variable name="td">
@@ -3487,16 +3857,16 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3487
3857
  </xsl:element>
3488
3858
  </xsl:otherwise>
3489
3859
  </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">
3860
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3491
3861
  <xsl:element name="tr">
3492
3862
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3493
3863
  <xsl:apply-templates mode="simple-table-colspan"/>
3494
3864
  </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">
3865
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3496
3866
  <xsl:copy>
3497
3867
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3498
3868
  </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">
3869
+ </xsl:template><xsl:template name="repeatNode">
3500
3870
  <xsl:param name="count"/>
3501
3871
  <xsl:param name="node"/>
3502
3872
 
@@ -3507,18 +3877,18 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3507
3877
  </xsl:call-template>
3508
3878
  <xsl:copy-of select="$node"/>
3509
3879
  </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">
3880
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3511
3881
  <xsl:copy>
3512
3882
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3513
3883
  </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">
3884
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3515
3885
  <xsl:copy>
3516
3886
  <xsl:copy-of select="tr[1]"/>
3517
3887
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3518
3888
  <xsl:with-param name="previousRow" select="tr[1]"/>
3519
3889
  </xsl:apply-templates>
3520
3890
  </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">
3891
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3522
3892
  <xsl:param name="previousRow"/>
3523
3893
  <xsl:variable name="currentRow" select="."/>
3524
3894
 
@@ -3552,43 +3922,53 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3552
3922
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3553
3923
  <xsl:with-param name="previousRow" select="$newRow"/>
3554
3924
  </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">
3925
+ </xsl:template><xsl:template name="getLang">
3556
3926
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3557
3927
  <xsl:choose>
3558
3928
  <xsl:when test="$language = 'English'">en</xsl:when>
3559
3929
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3560
3930
  </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">
3931
+ </xsl:template><xsl:template name="capitalizeWords">
3562
3932
  <xsl:param name="str"/>
3563
3933
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3564
3934
  <xsl:choose>
3565
3935
  <xsl:when test="contains($str2, ' ')">
3566
3936
  <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)"/>
3937
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3938
+ <xsl:value-of select="substring($substr, 2)"/> -->
3939
+ <xsl:call-template name="capitalize">
3940
+ <xsl:with-param name="str" select="$substr"/>
3941
+ </xsl:call-template>
3569
3942
  <xsl:text> </xsl:text>
3570
3943
  <xsl:call-template name="capitalizeWords">
3571
3944
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3572
3945
  </xsl:call-template>
3573
3946
  </xsl:when>
3574
3947
  <xsl:otherwise>
3575
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3576
- <xsl:value-of select="substring($str2, 2)"/>
3948
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3949
+ <xsl:value-of select="substring($str2, 2)"/> -->
3950
+ <xsl:call-template name="capitalize">
3951
+ <xsl:with-param name="str" select="$str2"/>
3952
+ </xsl:call-template>
3577
3953
  </xsl:otherwise>
3578
3954
  </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">
3955
+ </xsl:template><xsl:template name="capitalize">
3956
+ <xsl:param name="str"/>
3957
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3958
+ <xsl:value-of select="substring($str, 2)"/>
3959
+ </xsl:template><xsl:template match="mathml:math">
3580
3960
  <fo:inline font-family="STIX2Math">
3581
3961
  <fo:instream-foreign-object fox:alt-text="Math">
3582
3962
  <xsl:copy-of select="."/>
3583
3963
  </fo:instream-foreign-object>
3584
3964
  </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']">
3965
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3586
3966
  <xsl:for-each select="*[local-name()='locality']">
3587
3967
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3588
3968
  <xsl:apply-templates select="."/>
3589
3969
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3590
3970
  </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">
3971
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3592
3972
  <xsl:variable name="target">
3593
3973
  <xsl:choose>
3594
3974
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3618,4 +3998,244 @@ k7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO
3618
3998
  </xsl:otherwise>
3619
3999
  </xsl:choose>
3620
4000
  </fo:inline>
4001
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4002
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4003
+ <!-- <xsl:choose>
4004
+ <xsl:when test="@lang = 'en'"></xsl:when>
4005
+ <xsl:otherwise> -->
4006
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4007
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4008
+ <!-- </xsl:otherwise>
4009
+ </xsl:choose> -->
4010
+ <xsl:apply-templates/>
4011
+ </fo:block>
4012
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4013
+ <fo:inline id="{@id}"/>
4014
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4015
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4016
+ <xsl:variable name="title-appendix">
4017
+ <xsl:call-template name="getTitle">
4018
+ <xsl:with-param name="name" select="'title-appendix'"/>
4019
+ </xsl:call-template>
4020
+ </xsl:variable>
4021
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4022
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4023
+ </fo:block>
4024
+ <xsl:apply-templates/>
4025
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4026
+ <fo:inline><xsl:apply-templates/></fo:inline>
4027
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4028
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4029
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4030
+ <xsl:variable name="title-example">
4031
+ <xsl:call-template name="getTitle">
4032
+ <xsl:with-param name="name" select="'title-example'"/>
4033
+ </xsl:call-template>
4034
+ </xsl:variable>
4035
+ <xsl:value-of select="$title-example"/>
4036
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4037
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4038
+ </xsl:if>
4039
+ <xsl:if test="*[local-name()='name']">
4040
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4041
+ </xsl:if>
4042
+ </fo:block>
4043
+ <xsl:apply-templates/>
4044
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4045
+ <fo:inline><xsl:apply-templates/></fo:inline>
4046
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4047
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4048
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4049
+ <xsl:variable name="annotation-id" select="@id"/>
4050
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4051
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4052
+ <fo:inline>
4053
+ <xsl:apply-templates>
4054
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4055
+ </xsl:apply-templates>
4056
+ </fo:inline>
4057
+ </fo:block>
4058
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4059
+ <xsl:param name="callout"/>
4060
+ <fo:inline id="{@id}">
4061
+ <!-- for first p in annotation, put <x> -->
4062
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4063
+ <xsl:apply-templates/>
4064
+ </fo:inline>
4065
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4066
+ <xsl:variable name="title-modified">
4067
+ <xsl:call-template name="getTitle">
4068
+ <xsl:with-param name="name" select="'title-modified'"/>
4069
+ </xsl:call-template>
4070
+ </xsl:variable>
4071
+ <xsl:choose>
4072
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4073
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4074
+ </xsl:choose>
4075
+ <xsl:apply-templates/>
4076
+ </xsl:template><xsl:template name="convertDate">
4077
+ <xsl:param name="date"/>
4078
+ <xsl:param name="format" select="'short'"/>
4079
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4080
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4081
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4082
+ <xsl:variable name="monthStr">
4083
+ <xsl:choose>
4084
+ <xsl:when test="$month = '01'">January</xsl:when>
4085
+ <xsl:when test="$month = '02'">February</xsl:when>
4086
+ <xsl:when test="$month = '03'">March</xsl:when>
4087
+ <xsl:when test="$month = '04'">April</xsl:when>
4088
+ <xsl:when test="$month = '05'">May</xsl:when>
4089
+ <xsl:when test="$month = '06'">June</xsl:when>
4090
+ <xsl:when test="$month = '07'">July</xsl:when>
4091
+ <xsl:when test="$month = '08'">August</xsl:when>
4092
+ <xsl:when test="$month = '09'">September</xsl:when>
4093
+ <xsl:when test="$month = '10'">October</xsl:when>
4094
+ <xsl:when test="$month = '11'">November</xsl:when>
4095
+ <xsl:when test="$month = '12'">December</xsl:when>
4096
+ </xsl:choose>
4097
+ </xsl:variable>
4098
+ <xsl:variable name="result">
4099
+ <xsl:choose>
4100
+ <xsl:when test="$format = 'short' or $day = ''">
4101
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4102
+ </xsl:when>
4103
+ <xsl:otherwise>
4104
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4105
+ </xsl:otherwise>
4106
+ </xsl:choose>
4107
+ </xsl:variable>
4108
+ <xsl:value-of select="$result"/>
4109
+ </xsl:template><xsl:template name="insertKeywords">
4110
+ <xsl:param name="sorting" select="'true'"/>
4111
+ <xsl:param name="charAtEnd" select="'.'"/>
4112
+ <xsl:param name="charDelim" select="', '"/>
4113
+ <xsl:choose>
4114
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4115
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4116
+ <xsl:sort data-type="text" order="ascending"/>
4117
+ <xsl:call-template name="insertKeyword">
4118
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4119
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4120
+ </xsl:call-template>
4121
+ </xsl:for-each>
4122
+ </xsl:when>
4123
+ <xsl:otherwise>
4124
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4125
+ <xsl:call-template name="insertKeyword">
4126
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4127
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4128
+ </xsl:call-template>
4129
+ </xsl:for-each>
4130
+ </xsl:otherwise>
4131
+ </xsl:choose>
4132
+ </xsl:template><xsl:template name="insertKeyword">
4133
+ <xsl:param name="charAtEnd"/>
4134
+ <xsl:param name="charDelim"/>
4135
+ <xsl:apply-templates/>
4136
+ <xsl:choose>
4137
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4138
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4139
+ </xsl:choose>
4140
+ </xsl:template><xsl:template name="addPDFUAmeta">
4141
+ <fo:declarations>
4142
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4143
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4144
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4145
+ </pdf:dictionary>
4146
+ </pdf:catalog>
4147
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4148
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4149
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4150
+ <!-- Dublin Core properties go here -->
4151
+ <dc:title>
4152
+ <xsl:variable name="title">
4153
+
4154
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4155
+
4156
+
4157
+
4158
+
4159
+ </xsl:variable>
4160
+ <xsl:choose>
4161
+ <xsl:when test="normalize-space($title) != ''">
4162
+ <xsl:value-of select="$title"/>
4163
+ </xsl:when>
4164
+ <xsl:otherwise>
4165
+ <xsl:text> </xsl:text>
4166
+ </xsl:otherwise>
4167
+ </xsl:choose>
4168
+ </dc:title>
4169
+ <dc:creator>
4170
+
4171
+
4172
+ </dc:creator>
4173
+ <dc:description>
4174
+ <xsl:variable name="abstract">
4175
+
4176
+
4177
+
4178
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4179
+
4180
+
4181
+ </xsl:variable>
4182
+ <xsl:value-of select="normalize-space($abstract)"/>
4183
+ </dc:description>
4184
+ <pdf:Keywords>
4185
+ <xsl:call-template name="insertKeywords"/>
4186
+ </pdf:Keywords>
4187
+ </rdf:Description>
4188
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4189
+ <!-- XMP properties go here -->
4190
+ <xmp:CreatorTool/>
4191
+ </rdf:Description>
4192
+ </rdf:RDF>
4193
+ </x:xmpmeta>
4194
+ </fo:declarations>
4195
+ </xsl:template><xsl:template name="getId">
4196
+ <xsl:choose>
4197
+ <xsl:when test="../@id">
4198
+ <xsl:value-of select="../@id"/>
4199
+ </xsl:when>
4200
+ <xsl:otherwise>
4201
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4202
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4203
+ </xsl:otherwise>
4204
+ </xsl:choose>
4205
+ </xsl:template><xsl:template name="getLevel">
4206
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4207
+ <xsl:variable name="level">
4208
+ <xsl:choose>
4209
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4210
+ <xsl:value-of select="$level_total - 2"/>
4211
+ </xsl:when>
4212
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4213
+ <xsl:value-of select="$level_total - 2"/>
4214
+ </xsl:when>
4215
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4216
+ <xsl:value-of select="$level_total - 2"/>
4217
+ </xsl:when>
4218
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4219
+ <xsl:otherwise>
4220
+ <xsl:value-of select="$level_total - 1"/>
4221
+ </xsl:otherwise>
4222
+ </xsl:choose>
4223
+ </xsl:variable>
4224
+ <xsl:value-of select="$level"/>
4225
+ </xsl:template><xsl:template name="getSubSection">
4226
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
4227
+ </xsl:template><xsl:template name="split">
4228
+ <xsl:param name="pText" select="."/>
4229
+ <xsl:param name="sep" select="','"/>
4230
+ <xsl:if test="string-length($pText) &gt;0">
4231
+ <item>
4232
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4233
+ </item>
4234
+ <xsl:call-template name="split">
4235
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4236
+ <xsl:with-param name="sep" select="$sep"/>
4237
+ </xsl:call-template>
4238
+ </xsl:if>
4239
+ </xsl:template><xsl:template name="getDocumentId">
4240
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3621
4241
  </xsl:template></xsl:stylesheet>