metanorma-un 0.3.9 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" 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: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
 
@@ -25,8 +25,10 @@
25
25
 
26
26
  <xsl:variable name="doctype" select="/un:un-standard/un:bibdata/un:ext/un:doctype"/>
27
27
 
28
- <xsl:variable name="doctypenumber">
29
- <xsl:value-of select="translate(substring($doctype, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($doctype, 2)"/>
28
+ <xsl:variable name="doctypenumber">
29
+ <xsl:call-template name="capitalize">
30
+ <xsl:with-param name="str" select="$doctype"/>
31
+ </xsl:call-template>
30
32
  <xsl:text> No. </xsl:text>
31
33
  <xsl:value-of select="/un:un-standard/un:bibdata/un:docnumber"/>
32
34
  </xsl:variable>
@@ -76,42 +78,8 @@
76
78
 
77
79
  </fo:layout-master-set>
78
80
 
79
- <fo:declarations>
80
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
81
- <pdf:dictionary type="normal" key="ViewerPreferences">
82
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
83
- </pdf:dictionary>
84
- </pdf:catalog>
85
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
86
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
87
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
88
- <!-- Dublin Core properties go here -->
89
- <dc:title>
90
- <xsl:choose>
91
- <xsl:when test="$title != ''">
92
- <xsl:value-of select="$title"/>
93
- </xsl:when>
94
- <xsl:otherwise>
95
- <xsl:text> </xsl:text>
96
- </xsl:otherwise>
97
- </xsl:choose>
98
- </dc:title>
99
- <dc:creator/>
100
- <dc:description>
101
- <xsl:variable name="abstract">
102
- <xsl:copy-of select="/un:un-standard/un:preface/un:abstract//text()"/>
103
- </xsl:variable>
104
- <xsl:value-of select="normalize-space($abstract)"/>
105
- </dc:description>
106
- <pdf:Keywords/>
107
- </rdf:Description>
108
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
109
- <!-- XMP properties go here -->
110
- <xmp:CreatorTool/>
111
- </rdf:Description>
112
- </rdf:RDF>
113
- </x:xmpmeta>
114
- </fo:declarations>
81
+ <xsl:call-template name="addPDFUAmeta"/>
82
+
115
83
 
116
84
  <!-- Cover Page -->
117
85
  <fo:page-sequence master-reference="cover-page" force-page-count="even">
@@ -206,8 +174,18 @@
206
174
  <fo:page-sequence master-reference="document-preface-master" force-page-count="even" line-height="115%">
207
175
  <xsl:call-template name="insertHeaderPreface"/>
208
176
  <fo:flow flow-name="xsl-region-body" text-align="justify">
209
- <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt">Contents</fo:block>
210
- <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt">Page</fo:block>
177
+ <xsl:variable name="title-toc">
178
+ <xsl:call-template name="getTitle">
179
+ <xsl:with-param name="name" select="'title-toc'"/>
180
+ </xsl:call-template>
181
+ </xsl:variable>
182
+ <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt"><xsl:value-of select="$title-toc"/></fo:block>
183
+ <xsl:variable name="title-page">
184
+ <xsl:call-template name="getTitle">
185
+ <xsl:with-param name="name" select="'title-page'"/>
186
+ </xsl:call-template>
187
+ </xsl:variable>
188
+ <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
211
189
  <fo:block>
212
190
  <xsl:for-each select="xalan:nodeset($contents)//item[not(@type = 'table') and not(@type = 'figure') and not (@type = 'annex' or @parent = 'annex')]">
213
191
  <xsl:if test="@display = 'true' and @level &lt;= 3">
@@ -344,14 +322,7 @@
344
322
  <!-- Any node with title element - clause, definition, annex,... -->
345
323
  <xsl:template match="un:title | un:preferred" mode="contents">
346
324
  <xsl:variable name="id">
347
- <xsl:choose>
348
- <xsl:when test="../@id">
349
- <xsl:value-of select="../@id"/>
350
- </xsl:when>
351
- <xsl:otherwise>
352
- <xsl:value-of select="text()"/>
353
- </xsl:otherwise>
354
- </xsl:choose>
325
+ <xsl:call-template name="getId"/>
355
326
  </xsl:variable>
356
327
 
357
328
  <xsl:variable name="level">
@@ -398,7 +369,12 @@
398
369
  <xsl:when test="ancestor::un:annex">
399
370
  <xsl:choose>
400
371
  <xsl:when test="$level = 1">
401
- <xsl:text>Annex </xsl:text>
372
+ <xsl:variable name="title-annex">
373
+ <xsl:call-template name="getTitle">
374
+ <xsl:with-param name="name" select="'title-annex'"/>
375
+ </xsl:call-template>
376
+ </xsl:variable>
377
+ <xsl:value-of select="$title-annex"/>
402
378
  <xsl:number format="I" level="any" count="un:annex"/>
403
379
  </xsl:when>
404
380
  <xsl:otherwise>
@@ -431,7 +407,12 @@
431
407
  <xsl:template match="un:figure" mode="contents">
432
408
  <item level="" id="{@id}" type="figure">
433
409
  <xsl:attribute name="section">
434
- <xsl:text>Figure </xsl:text>
410
+ <xsl:variable name="title-figure">
411
+ <xsl:call-template name="getTitle">
412
+ <xsl:with-param name="name" select="'title-figure'"/>
413
+ </xsl:call-template>
414
+ </xsl:variable>
415
+ <xsl:value-of select="$title-figure"/>
435
416
  <xsl:choose>
436
417
  <xsl:when test="ancestor::un:annex">
437
418
  <xsl:choose>
@@ -463,7 +444,12 @@
463
444
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
464
445
  <item level="" id="{@id}" display="false" type="table">
465
446
  <xsl:attribute name="section">
466
- <xsl:text>Table </xsl:text>
447
+ <xsl:variable name="title-table">
448
+ <xsl:call-template name="getTitle">
449
+ <xsl:with-param name="name" select="'title-table'"/>
450
+ </xsl:call-template>
451
+ </xsl:variable>
452
+ <xsl:value-of select="$title-table"/>
467
453
  <xsl:choose>
468
454
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
469
455
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -487,7 +473,12 @@
487
473
  <xsl:template match="un:formula" mode="contents">
488
474
  <item level="" id="{@id}" display="false">
489
475
  <xsl:attribute name="section">
490
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="un:annex | un:formula"/><xsl:text>)</xsl:text>
476
+ <xsl:variable name="title-formula">
477
+ <xsl:call-template name="getTitle">
478
+ <xsl:with-param name="name" select="'title-formula'"/>
479
+ </xsl:call-template>
480
+ </xsl:variable>
481
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="un:annex | un:formula"/>
491
482
  </xsl:attribute>
492
483
  </item>
493
484
  </xsl:template>
@@ -516,7 +507,12 @@
516
507
  <item level="" id="{@id}" display="false" type="Terms">
517
508
  <xsl:if test="ancestor::un:annex">
518
509
  <xsl:attribute name="section">
519
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
510
+ <xsl:variable name="title-appendix">
511
+ <xsl:call-template name="getTitle">
512
+ <xsl:with-param name="name" select="'title-appendix'"/>
513
+ </xsl:call-template>
514
+ </xsl:variable>
515
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
520
516
  </xsl:attribute>
521
517
  </xsl:if>
522
518
  </item>
@@ -526,7 +522,12 @@
526
522
  <item level="" id="{@id}" display="false" type="References">
527
523
  <xsl:if test="ancestor::un:annex">
528
524
  <xsl:attribute name="section">
529
- <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/>
525
+ <xsl:variable name="title-appendix">
526
+ <xsl:call-template name="getTitle">
527
+ <xsl:with-param name="name" select="'title-appendix'"/>
528
+ </xsl:call-template>
529
+ </xsl:variable>
530
+ <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/>
530
531
  </xsl:attribute>
531
532
  </xsl:if>
532
533
  </item>
@@ -538,7 +539,12 @@
538
539
  <xsl:variable name="num">
539
540
  <xsl:number/>
540
541
  </xsl:variable>
541
- <xsl:text>Box </xsl:text><xsl:value-of select="$num"/>
542
+ <xsl:variable name="title-box">
543
+ <xsl:call-template name="getTitle">
544
+ <xsl:with-param name="name" select="'title-box'"/>
545
+ </xsl:call-template>
546
+ </xsl:variable>
547
+ <xsl:value-of select="$title-box"/><xsl:value-of select="$num"/>
542
548
  </xsl:attribute>
543
549
  </item>
544
550
  </xsl:template>
@@ -756,7 +762,12 @@
756
762
  <xsl:template match="un:ul//un:note | un:ol//un:note"/>
757
763
  <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process">
758
764
  <fo:block font-size="11pt" margin-top="4pt">
759
- <xsl:text>NOTE </xsl:text>
765
+ <xsl:variable name="title-note">
766
+ <xsl:call-template name="getTitle">
767
+ <xsl:with-param name="name" select="'title-note'"/>
768
+ </xsl:call-template>
769
+ </xsl:variable>
770
+ <xsl:value-of select="$title-note"/>
760
771
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
761
772
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
762
773
  </xsl:if>
@@ -835,11 +846,19 @@
835
846
  <xsl:variable name="num">
836
847
  <xsl:number/>
837
848
  </xsl:variable>
838
- <xsl:text>Box </xsl:text><xsl:value-of select="$num"/><xsl:text>. </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
839
- </fo:block>
840
- <fo:block margin-left="29mm" margin-right="34mm">
841
- <xsl:apply-templates/>
849
+ <xsl:variable name="title-box">
850
+ <xsl:call-template name="getTitle">
851
+ <xsl:with-param name="name" select="'title-box'"/>
852
+ </xsl:call-template>
853
+ </xsl:variable>
854
+ <xsl:value-of select="$title-box"/><xsl:value-of select="$num"/><xsl:text>. </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
842
855
  </fo:block>
856
+ <!-- <fo:block margin-left="29mm" margin-right="34mm"> -->
857
+ <fo:block-container margin-left="20mm" margin-right="20mm">
858
+ <fo:block-container margin-left="0mm" margin-right="0mm">
859
+ <xsl:apply-templates/>
860
+ </fo:block-container>
861
+ </fo:block-container>
843
862
  </fo:block-container>
844
863
  <fo:block margin-bottom="6pt"> </fo:block>
845
864
  </xsl:template>
@@ -892,14 +911,7 @@
892
911
 
893
912
  <xsl:template match="un:title">
894
913
  <xsl:variable name="id">
895
- <xsl:choose>
896
- <xsl:when test="../@id">
897
- <xsl:value-of select="../@id"/>
898
- </xsl:when>
899
- <xsl:otherwise>
900
- <xsl:value-of select="text()"/>
901
- </xsl:otherwise>
902
- </xsl:choose>
914
+ <xsl:call-template name="getId"/>
903
915
  </xsl:variable>
904
916
 
905
917
  <xsl:variable name="level">
@@ -986,7 +998,12 @@
986
998
  <xsl:template match="un:recommendation">
987
999
  <fo:block margin-left="20mm">
988
1000
  <fo:block font-weight="bold">
989
- <xsl:text>Recommendation </xsl:text>
1001
+ <xsl:variable name="title-recommendation">
1002
+ <xsl:call-template name="getTitle">
1003
+ <xsl:with-param name="name" select="'title-recommendation'"/>
1004
+ </xsl:call-template>
1005
+ </xsl:variable>
1006
+ <xsl:value-of select="$title-recommendation"/>
990
1007
  <xsl:choose>
991
1008
  <xsl:when test="ancestor::un:sections">
992
1009
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1052,12 +1069,17 @@
1052
1069
  <xsl:template match="un:figure">
1053
1070
  <fo:block-container id="{@id}">
1054
1071
  <xsl:if test="ancestor::un:admonition">
1055
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
1056
- <xsl:attribute name="margin-right">5mm</xsl:attribute>
1072
+ <xsl:attribute name="margin-left">-5mm</xsl:attribute>
1073
+ <xsl:attribute name="margin-right">-5mm</xsl:attribute>
1057
1074
  </xsl:if>
1058
1075
  <xsl:if test="un:name">
1059
1076
  <fo:block text-align="center" font-size="9pt" margin-bottom="6pt" keep-with-next="always" keep-together.within-column="always">
1060
- <xsl:text>Figure </xsl:text>
1077
+ <xsl:variable name="title-figure">
1078
+ <xsl:call-template name="getTitle">
1079
+ <xsl:with-param name="name" select="'title-figure'"/>
1080
+ </xsl:call-template>
1081
+ </xsl:variable>
1082
+ <xsl:value-of select="$title-figure"/>
1061
1083
  <xsl:choose>
1062
1084
  <xsl:when test="ancestor::un:annex">
1063
1085
  <xsl:choose>
@@ -1197,7 +1219,21 @@
1197
1219
 
1198
1220
  <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note">
1199
1221
  <fo:block-container margin-top="3pt" border-top="0.1mm solid black" space-after="12pt">
1222
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
1223
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1224
+ </xsl:if>
1200
1225
  <fo:block font-size="10pt" text-indent="0" padding-top="1.5mm">
1226
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
1227
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1228
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1229
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
1230
+ <fo:inline>
1231
+ <xsl:call-template name="capitalize">
1232
+ <xsl:with-param name="str" select="../@type"/>
1233
+ </xsl:call-template>
1234
+ <xsl:text>: </xsl:text>
1235
+ </fo:inline>
1236
+ </xsl:if>
1201
1237
  <!-- <fo:inline padding-right="4mm"><xsl:text>NOTE </xsl:text>
1202
1238
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
1203
1239
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
@@ -1210,12 +1246,17 @@
1210
1246
 
1211
1247
  <xsl:template match="un:termnote">
1212
1248
  <fo:block margin-top="4pt">
1213
- <xsl:text>NOTE </xsl:text>
1214
- <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1215
- <xsl:number/><xsl:text> </xsl:text>
1216
- </xsl:if>
1217
- <xsl:text>– </xsl:text>
1218
- <xsl:apply-templates/>
1249
+ <xsl:variable name="title-note">
1250
+ <xsl:call-template name="getTitle">
1251
+ <xsl:with-param name="name" select="'title-note'"/>
1252
+ </xsl:call-template>
1253
+ </xsl:variable>
1254
+ <xsl:value-of select="$title-note"/>
1255
+ <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1256
+ <xsl:number/><xsl:text> </xsl:text>
1257
+ </xsl:if>
1258
+ <xsl:text>– </xsl:text>
1259
+ <xsl:apply-templates/>
1219
1260
  </fo:block>
1220
1261
  </xsl:template>
1221
1262
 
@@ -1243,7 +1284,7 @@
1243
1284
  <fo:table-cell> <!-- display-align="center" -->
1244
1285
  <fo:block text-align="right">
1245
1286
  <xsl:if test="not(ancestor::un:annex)">
1246
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1287
+ <xsl:number format="(1)" level="any"/>
1247
1288
  </xsl:if>
1248
1289
  <xsl:if test="ancestor::un:annex">
1249
1290
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1267,7 +1308,12 @@
1267
1308
  </xsl:template>
1268
1309
 
1269
1310
  <xsl:template match="un:example">
1270
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1311
+ <xsl:variable name="title-example">
1312
+ <xsl:call-template name="getTitle">
1313
+ <xsl:with-param name="name" select="'title-example'"/>
1314
+ </xsl:call-template>
1315
+ </xsl:variable>
1316
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1271
1317
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1272
1318
  <xsl:apply-templates/>
1273
1319
  </fo:block>
@@ -1293,15 +1339,25 @@
1293
1339
  <!-- <xsl:if test="@type = 'inline'">
1294
1340
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1295
1341
  </xsl:if> -->
1296
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1342
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1297
1343
  <xsl:apply-templates select="un:localityStack"/>
1298
1344
  </fo:basic-link>
1299
1345
  </xsl:template>
1300
1346
 
1301
1347
  <xsl:template match="un:locality">
1348
+ <xsl:variable name="title-section">
1349
+ <xsl:call-template name="getTitle">
1350
+ <xsl:with-param name="name" select="'title-section'"/>
1351
+ </xsl:call-template>
1352
+ </xsl:variable>
1353
+ <xsl:variable name="title-clause">
1354
+ <xsl:call-template name="getTitle">
1355
+ <xsl:with-param name="name" select="'title-clause'"/>
1356
+ </xsl:call-template>
1357
+ </xsl:variable>
1302
1358
  <xsl:choose>
1303
- <xsl:when test="@type = 'section'">Section </xsl:when>
1304
- <xsl:when test="@type = 'clause'">Clause </xsl:when>
1359
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1360
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1305
1361
  <xsl:otherwise/>
1306
1362
  </xsl:choose>
1307
1363
  <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
@@ -1320,7 +1376,7 @@
1320
1376
  </fo:block>
1321
1377
  </xsl:template>
1322
1378
  <xsl:template match="un:term" mode="table">
1323
- <fo:table-row>
1379
+ <fo:table-row id="{@id}">
1324
1380
  <fo:table-cell padding-right="1mm">
1325
1381
  <fo:block margin-bottom="12pt">
1326
1382
  <xsl:apply-templates select="un:preferred"/>
@@ -1334,7 +1390,7 @@
1334
1390
  </fo:table-row>
1335
1391
  </xsl:template>
1336
1392
  <xsl:template match="un:preferred">
1337
- <fo:inline id="{../@id}">
1393
+ <fo:inline>
1338
1394
  <xsl:apply-templates/>
1339
1395
  </fo:inline>
1340
1396
  </xsl:template>
@@ -1400,15 +1456,7 @@
1400
1456
  <xsl:apply-templates/>
1401
1457
  </fo:block>
1402
1458
  </xsl:template>
1403
-
1404
- <xsl:template match="un:sourcecode">
1405
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1406
- <xsl:attribute name="white-space">pre</xsl:attribute>
1407
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1408
- <xsl:apply-templates/>
1409
- </fo:block>
1410
- </xsl:template>
1411
-
1459
+
1412
1460
  <xsl:template match="un:references">
1413
1461
  <fo:block>
1414
1462
  <xsl:if test="not(un:title)">
@@ -1451,28 +1499,6 @@
1451
1499
  </xsl:template>
1452
1500
 
1453
1501
 
1454
- <xsl:template name="getLevel">
1455
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1456
- <xsl:variable name="level">
1457
- <xsl:choose>
1458
- <xsl:when test="ancestor::un:preface">
1459
- <xsl:value-of select="$level_total - 2"/>
1460
- </xsl:when>
1461
- <xsl:when test="ancestor::un:sections">
1462
- <xsl:value-of select="$level_total - 2"/>
1463
- </xsl:when>
1464
- <xsl:when test="ancestor::un:bibliography">
1465
- <xsl:value-of select="$level_total - 2"/>
1466
- </xsl:when>
1467
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1468
- <xsl:otherwise>
1469
- <xsl:value-of select="$level_total - 1"/>
1470
- </xsl:otherwise>
1471
- </xsl:choose>
1472
- </xsl:variable>
1473
- <xsl:value-of select="$level"/>
1474
- </xsl:template>
1475
-
1476
1502
  <xsl:template name="getSection">
1477
1503
  <xsl:variable name="level">
1478
1504
  <xsl:call-template name="getLevel"/>
@@ -1500,7 +1526,12 @@
1500
1526
  <xsl:when test="ancestor::un:annex">
1501
1527
  <xsl:choose>
1502
1528
  <xsl:when test="$level = 1">
1503
- <xsl:text>Annex </xsl:text>
1529
+ <xsl:variable name="title-annex">
1530
+ <xsl:call-template name="getTitle">
1531
+ <xsl:with-param name="name" select="'title-annex'"/>
1532
+ </xsl:call-template>
1533
+ </xsl:variable>
1534
+ <xsl:value-of select="$title-annex"/>
1504
1535
  <xsl:number format="I" level="any" count="un:annex"/>
1505
1536
  <!-- <xsl:text>: </xsl:text> -->
1506
1537
  </xsl:when>
@@ -11902,16 +11933,217 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
11902
11933
  </xsl:text>
11903
11934
  </xsl:variable>
11904
11935
 
11905
- <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">
11936
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
11937
+
11938
+ <title-table lang="en">Table </title-table>
11939
+ <title-table lang="fr">Tableau </title-table>
11940
+
11941
+ <title-table lang="zh">Table </title-table>
11942
+
11943
+
11944
+
11945
+ <title-note lang="en">NOTE </title-note>
11946
+ <title-note lang="fr">NOTE </title-note>
11947
+
11948
+ <title-note lang="zh">NOTE </title-note>
11949
+
11950
+
11951
+
11952
+ <title-figure lang="en">Figure </title-figure>
11953
+ <title-figure lang="fr">Figure </title-figure>
11954
+
11955
+ <title-figure lang="zh">Figure </title-figure>
11956
+
11957
+
11958
+
11959
+ <title-example lang="en">EXAMPLE </title-example>
11960
+ <title-example lang="fr">EXEMPLE </title-example>
11961
+
11962
+ <title-example lang="zh">EXAMPLE </title-example>
11963
+
11964
+
11965
+
11966
+ <title-example-xref lang="en">Example </title-example-xref>
11967
+ <title-example-xref lang="fr">Exemple </title-example-xref>
11968
+
11969
+ <title-section lang="en">Section </title-section>
11970
+ <title-section lang="fr">Section </title-section>
11971
+
11972
+ <title-inequality lang="en">Inequality </title-inequality>
11973
+ <title-inequality lang="fr">Inequality </title-inequality>
11974
+
11975
+ <title-equation lang="en">Equation </title-equation>
11976
+ <title-equation lang="fr">Equation </title-equation>
11977
+
11978
+ <title-annex lang="en">Annex </title-annex>
11979
+ <title-annex lang="fr">Annexe </title-annex>
11980
+
11981
+ <title-annex lang="zh">Annex </title-annex>
11982
+
11983
+
11984
+
11985
+ <title-appendix lang="en">Appendix </title-appendix>
11986
+ <title-appendix lang="fr">Appendix </title-appendix>
11987
+
11988
+ <title-clause lang="en">Clause </title-clause>
11989
+ <title-clause lang="fr">Article </title-clause>
11990
+
11991
+ <title-clause lang="zh">Clause </title-clause>
11992
+
11993
+
11994
+
11995
+ <title-edition lang="en">
11996
+
11997
+ <xsl:text>Edition </xsl:text>
11998
+
11999
+
12000
+ </title-edition>
12001
+
12002
+ <title-formula lang="en">Formula </title-formula>
12003
+ <title-formula lang="fr">Formula </title-formula>
11906
12004
 
12005
+ <title-toc lang="en">
12006
+
12007
+ <xsl:text>Contents</xsl:text>
12008
+
12009
+
12010
+
12011
+ </title-toc>
12012
+ <title-toc lang="fr">Sommaire</title-toc>
12013
+
12014
+ <title-toc lang="zh">Contents</title-toc>
12015
+
12016
+
12017
+
12018
+ <title-page lang="en">Page</title-page>
12019
+ <title-page lang="fr">Page</title-page>
12020
+
12021
+ <title-key lang="en">Key</title-key>
12022
+ <title-key lang="fr">Légende</title-key>
12023
+
12024
+ <title-where lang="en">where</title-where>
12025
+ <title-where lang="fr">où</title-where>
12026
+
12027
+ <title-descriptors lang="en">Descriptors</title-descriptors>
12028
+
12029
+ <title-part lang="en">
12030
+
12031
+
12032
+ </title-part>
12033
+ <title-part lang="fr">
12034
+
12035
+
12036
+ </title-part>
12037
+ <title-part lang="zh">第 # 部分:</title-part>
12038
+
12039
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
12040
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
12041
+
12042
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
12043
+
12044
+
12045
+
12046
+ <title-modified lang="en">modified</title-modified>
12047
+ <title-modified lang="fr">modifiée</title-modified>
12048
+
12049
+ <title-modified lang="zh">modified</title-modified>
12050
+
12051
+
12052
+
12053
+ <title-source lang="en">SOURCE</title-source>
12054
+
12055
+ <title-keywords lang="en">Keywords</title-keywords>
12056
+
12057
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
12058
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
12059
+
12060
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
12061
+
12062
+ <title-list-tables lang="en">List of Tables</title-list-tables>
12063
+
12064
+ <title-list-figures lang="en">List of Figures</title-list-figures>
12065
+
12066
+ <title-recommendation lang="en">Recommendation </title-recommendation>
12067
+
12068
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
12069
+
12070
+ <title-abstract lang="en">Abstract</title-abstract>
12071
+
12072
+ <title-summary lang="en">Summary</title-summary>
12073
+
12074
+ <title-in lang="en">in </title-in>
12075
+
12076
+ <title-box lang="en">Box </title-box>
12077
+
12078
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
12079
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
12080
+
12081
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
12082
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
12083
+
12084
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
12085
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
12086
+
12087
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
12088
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
12089
+
12090
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
12091
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
11907
12092
 
11908
- </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()">
12093
+ <title-caution lang="en">CAUTION</title-caution>
12094
+ <title-caution lang="zh">注意</title-caution>
12095
+
12096
+ <title-warning lang="en">WARNING</title-warning>
12097
+ <title-warning lang="zh">警告</title-warning>
12098
+
12099
+ <title-amendment lang="en">AMENDMENT</title-amendment>
12100
+ </xsl:variable><xsl:template name="getTitle">
12101
+ <xsl:param name="name"/>
12102
+ <xsl:variable name="lang">
12103
+ <xsl:call-template name="getLang"/>
12104
+ </xsl:variable>
12105
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
12106
+ <xsl:choose>
12107
+ <xsl:when test="normalize-space($title_) != ''">
12108
+ <xsl:value-of select="$title_"/>
12109
+ </xsl:when>
12110
+ <xsl:otherwise>
12111
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
12112
+ </xsl:otherwise>
12113
+ </xsl:choose>
12114
+ </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">
12115
+
12116
+
12117
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
12118
+
12119
+
12120
+
12121
+
12122
+
12123
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
12124
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
12125
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
12126
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
12127
+
12128
+
12129
+
12130
+
12131
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
12132
+
12133
+
12134
+
12135
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
12136
+
12137
+
12138
+
12139
+ </xsl:attribute-set><xsl:template match="text()">
11909
12140
  <xsl:value-of select="."/>
11910
- </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']">
12141
+ </xsl:template><xsl:template match="*[local-name()='br']">
11911
12142
  <xsl:value-of select="$linebreak"/>
11912
- </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">
11913
- <xsl:call-template name="add-zero-spaces"/>
11914
- </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']">
12143
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
12144
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
12145
+ <xsl:call-template name="add-zero-spaces-java"/>
12146
+ </xsl:template><xsl:template match="*[local-name()='table']">
11915
12147
 
11916
12148
  <xsl:variable name="simple-table">
11917
12149
  <!-- <xsl:copy> -->
@@ -11942,7 +12174,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
11942
12174
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
11943
12175
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
11944
12176
 
11945
- <xsl:text>Table </xsl:text>
12177
+ <xsl:variable name="title-table">
12178
+ <xsl:call-template name="getTitle">
12179
+ <xsl:with-param name="name" select="'title-table'"/>
12180
+ </xsl:call-template>
12181
+ </xsl:variable>
12182
+ <xsl:value-of select="$title-table"/>
11946
12183
  <xsl:choose>
11947
12184
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
11948
12185
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -12032,6 +12269,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12032
12269
 
12033
12270
 
12034
12271
 
12272
+
12035
12273
  <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">
12036
12274
 
12037
12275
 
@@ -12051,9 +12289,10 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12051
12289
 
12052
12290
 
12053
12291
 
12292
+
12054
12293
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
12055
12294
  <xsl:choose>
12056
- <xsl:when test=". = 1">
12295
+ <xsl:when test=". = 1 or . = 0">
12057
12296
  <fo:table-column column-width="proportional-column-width(2)"/>
12058
12297
  </xsl:when>
12059
12298
  <xsl:otherwise>
@@ -12061,21 +12300,58 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12061
12300
  </xsl:otherwise>
12062
12301
  </xsl:choose>
12063
12302
  </xsl:for-each>
12064
- <xsl:apply-templates/>
12303
+
12304
+ <xsl:choose>
12305
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
12306
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
12307
+ </xsl:when>
12308
+ <xsl:otherwise>
12309
+ <xsl:apply-templates/>
12310
+ </xsl:otherwise>
12311
+ </xsl:choose>
12312
+
12065
12313
  </fo:table>
12066
12314
 
12067
12315
 
12068
12316
 
12069
12317
  </fo:block-container>
12070
- </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">
12318
+ </xsl:template><xsl:template name="getTableNumber">
12319
+ <xsl:choose>
12320
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
12321
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
12322
+ </xsl:when>
12323
+ <xsl:when test="ancestor::*[local-name()='annex']">
12324
+
12325
+
12326
+
12327
+
12328
+
12329
+
12330
+ <!-- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
12331
+ <xsl:number format="I." count="*[local-name()='annex']"/> -->
12332
+ <xsl:text>A</xsl:text> <!-- 'A' means Annex -->
12333
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex']]"/> <!-- [@id = $annex-id] -->
12334
+
12335
+
12336
+
12337
+ </xsl:when>
12338
+ <xsl:otherwise>
12339
+
12340
+
12341
+ <xsl:number format="A." count="*[local-name()='annex']"/>
12342
+ <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']"/>
12343
+
12344
+ </xsl:otherwise>
12345
+ </xsl:choose>
12346
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
12071
12347
  <xsl:apply-templates/>
12072
- </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">
12348
+ </xsl:template><xsl:template name="calculate-columns-numbers">
12073
12349
  <xsl:param name="table-row"/>
12074
12350
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
12075
12351
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
12076
12352
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
12077
12353
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
12078
- </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">
12354
+ </xsl:template><xsl:template name="calculate-column-widths">
12079
12355
  <xsl:param name="table"/>
12080
12356
  <xsl:param name="cols-count"/>
12081
12357
  <xsl:param name="curr-col" select="1"/>
@@ -12084,7 +12360,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12084
12360
  <xsl:if test="$curr-col &lt;= $cols-count">
12085
12361
  <xsl:variable name="widths">
12086
12362
  <xsl:choose>
12087
- <xsl:when test="not($table)">
12363
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
12088
12364
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
12089
12365
  <xsl:variable name="words">
12090
12366
  <xsl:call-template name="tokenize">
@@ -12123,9 +12399,16 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12123
12399
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
12124
12400
  </xsl:variable>
12125
12401
  <xsl:variable name="words">
12402
+ <xsl:variable name="string_with_added_zerospaces">
12403
+ <xsl:call-template name="add-zero-spaces-java">
12404
+ <xsl:with-param name="text" select="$td_text"/>
12405
+ </xsl:call-template>
12406
+ </xsl:variable>
12126
12407
  <xsl:call-template name="tokenize">
12127
12408
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
12128
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
12409
+ <!-- 2009 thinspace -->
12410
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
12411
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
12129
12412
  </xsl:call-template>
12130
12413
  </xsl:variable>
12131
12414
  <xsl:variable name="max_length">
@@ -12166,17 +12449,28 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12166
12449
  <xsl:with-param name="table" select="$table"/>
12167
12450
  </xsl:call-template>
12168
12451
  </xsl:if>
12169
- </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">
12452
+ </xsl:template><xsl:template match="text()" mode="td_text">
12170
12453
  <xsl:variable name="zero-space">​</xsl:variable>
12171
12454
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
12172
- </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">
12455
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
12456
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
12457
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
12458
+ <xsl:value-of select="@target"/>
12459
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
12460
+ <xsl:param name="cols-count"/>
12173
12461
  <!-- font-weight="bold" -->
12174
- <fo:table-header>
12462
+ <fo:table-header>
12463
+
12175
12464
  <xsl:apply-templates/>
12176
12465
  </fo:table-header>
12177
- </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">
12466
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
12467
+ <fo:table-body>
12468
+ <xsl:apply-templates/>
12469
+ </fo:table-body>
12470
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
12178
12471
  <xsl:apply-templates/>
12179
- </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">
12472
+ </xsl:template><xsl:template name="insertTableFooter">
12473
+ <xsl:param name="cols-count"/>
12180
12474
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
12181
12475
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
12182
12476
 
@@ -12187,22 +12481,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12187
12481
  <!-- if there are note(s) or fn(s) then create footer row -->
12188
12482
  <xsl:if test="$isNoteOrFnExist = 'true'">
12189
12483
 
12190
- <xsl:variable name="cols-count">
12191
- <xsl:choose>
12192
- <xsl:when test="../*[local-name()='thead']">
12193
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
12194
- <xsl:call-template name="calculate-columns-numbers">
12195
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
12196
- </xsl:call-template>
12197
- </xsl:when>
12198
- <xsl:otherwise>
12199
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
12200
- <xsl:call-template name="calculate-columns-numbers">
12201
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
12202
- </xsl:call-template>
12203
- </xsl:otherwise>
12204
- </xsl:choose>
12205
- </xsl:variable>
12484
+
12206
12485
 
12207
12486
  <fo:table-row>
12208
12487
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -12230,11 +12509,30 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12230
12509
  </fo:table-footer>
12231
12510
 
12232
12511
  </xsl:if>
12233
- </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']">
12512
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
12234
12513
 
12235
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
12514
+ <xsl:variable name="cols-count">
12515
+ <xsl:choose>
12516
+ <xsl:when test="../*[local-name()='thead']">
12517
+ <xsl:call-template name="calculate-columns-numbers">
12518
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
12519
+ </xsl:call-template>
12520
+ </xsl:when>
12521
+ <xsl:otherwise>
12522
+ <xsl:call-template name="calculate-columns-numbers">
12523
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
12524
+ </xsl:call-template>
12525
+ </xsl:otherwise>
12526
+ </xsl:choose>
12527
+ </xsl:variable>
12528
+
12529
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
12530
+ <xsl:with-param name="cols-count" select="$cols-count"/>
12531
+ </xsl:apply-templates>
12236
12532
 
12237
- <xsl:call-template name="insertTableFooter"/>
12533
+ <xsl:call-template name="insertTableFooter">
12534
+ <xsl:with-param name="cols-count" select="$cols-count"/>
12535
+ </xsl:call-template>
12238
12536
 
12239
12537
  <fo:table-body>
12240
12538
  <xsl:apply-templates/>
@@ -12242,7 +12540,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12242
12540
 
12243
12541
  </fo:table-body>
12244
12542
 
12245
- </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']">
12543
+ </xsl:template><xsl:template match="*[local-name()='tr']">
12246
12544
  <xsl:variable name="parent-name" select="local-name(..)"/>
12247
12545
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
12248
12546
  <fo:table-row min-height="4mm">
@@ -12262,7 +12560,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12262
12560
 
12263
12561
  <xsl:apply-templates/>
12264
12562
  </fo:table-row>
12265
- </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']">
12563
+ </xsl:template><xsl:template match="*[local-name()='th']">
12266
12564
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
12267
12565
 
12268
12566
 
@@ -12301,7 +12599,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12301
12599
  <xsl:apply-templates/>
12302
12600
  </fo:block>
12303
12601
  </fo:table-cell>
12304
- </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']">
12602
+ </xsl:template><xsl:template match="*[local-name()='td']">
12305
12603
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
12306
12604
 
12307
12605
 
@@ -12328,6 +12626,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12328
12626
  </xsl:attribute>
12329
12627
  </xsl:if>
12330
12628
  <fo:block>
12629
+
12331
12630
  <xsl:apply-templates/>
12332
12631
  </fo:block>
12333
12632
  <!-- <xsl:choose>
@@ -12343,16 +12642,34 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12343
12642
 
12344
12643
 
12345
12644
  </fo:table-cell>
12346
- </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">
12645
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
12347
12646
 
12348
12647
 
12349
12648
  <fo:block font-size="10pt" margin-bottom="12pt">
12350
12649
 
12351
12650
 
12352
12651
 
12652
+
12353
12653
  <fo:inline padding-right="2mm">
12354
12654
 
12355
- <xsl:text>NOTE </xsl:text>
12655
+
12656
+
12657
+ <xsl:if test="@type = 'source' or @type = 'abbreviation'">
12658
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
12659
+ <fo:inline>
12660
+ <xsl:call-template name="capitalize">
12661
+ <xsl:with-param name="str" select="@type"/>
12662
+ </xsl:call-template>
12663
+ <xsl:text>: </xsl:text>
12664
+ </fo:inline>
12665
+ </xsl:if>
12666
+
12667
+ <xsl:variable name="title-note">
12668
+ <xsl:call-template name="getTitle">
12669
+ <xsl:with-param name="name" select="'title-note'"/>
12670
+ </xsl:call-template>
12671
+ </xsl:variable>
12672
+ <xsl:value-of select="$title-note"/>
12356
12673
 
12357
12674
 
12358
12675
 
@@ -12362,9 +12679,9 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12362
12679
  <xsl:apply-templates mode="process"/>
12363
12680
  </fo:block>
12364
12681
 
12365
- </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">
12682
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
12366
12683
  <xsl:apply-templates/>
12367
- </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">
12684
+ </xsl:template><xsl:template name="fn_display">
12368
12685
  <xsl:variable name="references">
12369
12686
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
12370
12687
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -12381,6 +12698,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12381
12698
 
12382
12699
 
12383
12700
 
12701
+
12384
12702
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
12385
12703
 
12386
12704
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -12400,7 +12718,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12400
12718
  </fo:block>
12401
12719
  </xsl:if>
12402
12720
  </xsl:for-each>
12403
- </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">
12721
+ </xsl:template><xsl:template name="fn_name_display">
12404
12722
  <!-- <xsl:variable name="references">
12405
12723
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
12406
12724
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -12416,7 +12734,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12416
12734
  <xsl:apply-templates/>
12417
12735
  </fo:block>
12418
12736
  </xsl:for-each>
12419
- </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">
12737
+ </xsl:template><xsl:template name="fn_display_figure">
12420
12738
  <xsl:variable name="key_iso">
12421
12739
  <!-- and (not(@class) or @class !='pseudocode') -->
12422
12740
  </xsl:variable>
@@ -12427,6 +12745,36 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12427
12745
  </fn>
12428
12746
  </xsl:for-each>
12429
12747
  </xsl:variable>
12748
+
12749
+ <!-- current hierarchy is 'figure' element -->
12750
+ <xsl:variable name="following_dl_colwidths">
12751
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
12752
+ <xsl:variable name="html-table">
12753
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12754
+ <xsl:element name="{$ns}:table">
12755
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
12756
+ <tbody>
12757
+ <xsl:apply-templates mode="dl"/>
12758
+ </tbody>
12759
+ </xsl:for-each>
12760
+ </xsl:element>
12761
+ </xsl:variable>
12762
+
12763
+ <xsl:call-template name="calculate-column-widths">
12764
+ <xsl:with-param name="cols-count" select="2"/>
12765
+ <xsl:with-param name="table" select="$html-table"/>
12766
+ </xsl:call-template>
12767
+
12768
+ </xsl:if>
12769
+ </xsl:variable>
12770
+
12771
+
12772
+ <xsl:variable name="maxlength_dt">
12773
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
12774
+ <xsl:call-template name="getMaxLength_dt"/>
12775
+ </xsl:for-each>
12776
+ </xsl:variable>
12777
+
12430
12778
  <xsl:if test="xalan:nodeset($references)//fn">
12431
12779
  <fo:block>
12432
12780
  <fo:table width="95%" table-layout="fixed">
@@ -12434,8 +12782,19 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12434
12782
  <xsl:attribute name="font-size">10pt</xsl:attribute>
12435
12783
 
12436
12784
  </xsl:if>
12437
- <fo:table-column column-width="15%"/>
12438
- <fo:table-column column-width="85%"/>
12785
+ <xsl:choose>
12786
+ <!-- if there 'dl', then set same columns width -->
12787
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
12788
+ <xsl:call-template name="setColumnWidth_dl">
12789
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
12790
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
12791
+ </xsl:call-template>
12792
+ </xsl:when>
12793
+ <xsl:otherwise>
12794
+ <fo:table-column column-width="15%"/>
12795
+ <fo:table-column column-width="85%"/>
12796
+ </xsl:otherwise>
12797
+ </xsl:choose>
12439
12798
  <fo:table-body>
12440
12799
  <xsl:for-each select="xalan:nodeset($references)//fn">
12441
12800
  <xsl:variable name="reference" select="@reference"/>
@@ -12467,7 +12826,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12467
12826
  </fo:block>
12468
12827
  </xsl:if>
12469
12828
 
12470
- </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']">
12829
+ </xsl:template><xsl:template match="*[local-name()='fn']">
12471
12830
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
12472
12831
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
12473
12832
 
@@ -12479,11 +12838,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12479
12838
  <xsl:value-of select="@reference"/>
12480
12839
  </fo:basic-link>
12481
12840
  </fo:inline>
12482
- </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']">
12841
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
12483
12842
  <fo:inline>
12484
12843
  <xsl:apply-templates/>
12485
12844
  </fo:inline>
12486
- </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']">
12845
+ </xsl:template><xsl:template match="*[local-name()='dl']">
12487
12846
  <xsl:variable name="parent" select="local-name(..)"/>
12488
12847
 
12489
12848
  <xsl:variable name="key_iso">
@@ -12495,8 +12854,13 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12495
12854
 
12496
12855
 
12497
12856
  <fo:block margin-bottom="12pt" text-align="left">
12498
-
12499
- <xsl:text>where </xsl:text>
12857
+
12858
+ <xsl:variable name="title-where">
12859
+ <xsl:call-template name="getTitle">
12860
+ <xsl:with-param name="name" select="'title-where'"/>
12861
+ </xsl:call-template>
12862
+ </xsl:variable>
12863
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
12500
12864
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
12501
12865
  <xsl:text/>
12502
12866
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -12509,15 +12873,25 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12509
12873
 
12510
12874
 
12511
12875
 
12512
- <xsl:text>where</xsl:text>
12876
+ <xsl:variable name="title-where">
12877
+ <xsl:call-template name="getTitle">
12878
+ <xsl:with-param name="name" select="'title-where'"/>
12879
+ </xsl:call-template>
12880
+ </xsl:variable>
12881
+ <xsl:value-of select="$title-where"/>
12513
12882
  </fo:block>
12514
12883
  </xsl:when>
12515
12884
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
12516
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
12885
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
12517
12886
 
12518
12887
 
12519
12888
 
12520
- <xsl:text>Key</xsl:text>
12889
+ <xsl:variable name="title-key">
12890
+ <xsl:call-template name="getTitle">
12891
+ <xsl:with-param name="name" select="'title-key'"/>
12892
+ </xsl:call-template>
12893
+ </xsl:variable>
12894
+ <xsl:value-of select="$title-key"/>
12521
12895
  </fo:block>
12522
12896
  </xsl:when>
12523
12897
  </xsl:choose>
@@ -12528,26 +12902,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12528
12902
 
12529
12903
 
12530
12904
 
12905
+
12531
12906
  <fo:block>
12532
12907
 
12533
12908
 
12534
- <!-- create virtual html table for dl/[dt and dd] -->
12535
- <xsl:variable name="html-table">
12536
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12537
- <xsl:element name="{$ns}:table">
12538
- <tbody>
12539
- <xsl:apply-templates mode="dl"/>
12540
- </tbody>
12541
- </xsl:element>
12542
- </xsl:variable>
12543
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
12544
- <xsl:variable name="colwidths">
12545
- <xsl:call-template name="calculate-column-widths">
12546
- <xsl:with-param name="cols-count" select="2"/>
12547
- <xsl:with-param name="table" select="$html-table"/>
12548
- </xsl:call-template>
12549
- </xsl:variable>
12550
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
12909
+
12551
12910
 
12552
12911
  <fo:table width="95%" table-layout="fixed">
12553
12912
 
@@ -12560,42 +12919,30 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12560
12919
 
12561
12920
  </xsl:when>
12562
12921
  </xsl:choose>
12563
- <xsl:choose>
12564
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
12565
- <fo:table-column column-width="50%"/>
12566
- <fo:table-column column-width="50%"/>
12567
- </xsl:when>
12568
- <xsl:otherwise>
12569
- <xsl:choose>
12570
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
12571
- <fo:table-column column-width="60%"/>
12572
- <fo:table-column column-width="40%"/>
12573
- </xsl:when> -->
12574
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
12575
- <fo:table-column column-width="50%"/>
12576
- <fo:table-column column-width="50%"/>
12577
- </xsl:when>
12578
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
12579
- <fo:table-column column-width="40%"/>
12580
- <fo:table-column column-width="60%"/>
12581
- </xsl:when>
12582
- <xsl:otherwise>
12583
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
12584
- <xsl:choose>
12585
- <xsl:when test=". = 1">
12586
- <fo:table-column column-width="proportional-column-width(2)"/>
12587
- </xsl:when>
12588
- <xsl:otherwise>
12589
- <fo:table-column column-width="proportional-column-width({.})"/>
12590
- </xsl:otherwise>
12591
- </xsl:choose>
12592
- </xsl:for-each>
12593
- </xsl:otherwise>
12594
- </xsl:choose>
12595
- <!-- <fo:table-column column-width="15%"/>
12596
- <fo:table-column column-width="85%"/> -->
12597
- </xsl:otherwise>
12598
- </xsl:choose>
12922
+ <!-- create virtual html table for dl/[dt and dd] -->
12923
+ <xsl:variable name="html-table">
12924
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12925
+ <xsl:element name="{$ns}:table">
12926
+ <tbody>
12927
+ <xsl:apply-templates mode="dl"/>
12928
+ </tbody>
12929
+ </xsl:element>
12930
+ </xsl:variable>
12931
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
12932
+ <xsl:variable name="colwidths">
12933
+ <xsl:call-template name="calculate-column-widths">
12934
+ <xsl:with-param name="cols-count" select="2"/>
12935
+ <xsl:with-param name="table" select="$html-table"/>
12936
+ </xsl:call-template>
12937
+ </xsl:variable>
12938
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
12939
+ <xsl:variable name="maxlength_dt">
12940
+ <xsl:call-template name="getMaxLength_dt"/>
12941
+ </xsl:variable>
12942
+ <xsl:call-template name="setColumnWidth_dl">
12943
+ <xsl:with-param name="colwidths" select="$colwidths"/>
12944
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
12945
+ </xsl:call-template>
12599
12946
  <fo:table-body>
12600
12947
  <xsl:apply-templates>
12601
12948
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -12605,7 +12952,61 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12605
12952
  </fo:block>
12606
12953
  </fo:block>
12607
12954
  </xsl:if>
12608
- </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']">
12955
+ </xsl:template><xsl:template name="setColumnWidth_dl">
12956
+ <xsl:param name="colwidths"/>
12957
+ <xsl:param name="maxlength_dt"/>
12958
+ <xsl:choose>
12959
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
12960
+ <fo:table-column column-width="50%"/>
12961
+ <fo:table-column column-width="50%"/>
12962
+ </xsl:when>
12963
+ <xsl:otherwise>
12964
+ <xsl:choose>
12965
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
12966
+ <fo:table-column column-width="5%"/>
12967
+ <fo:table-column column-width="95%"/>
12968
+ </xsl:when>
12969
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
12970
+ <fo:table-column column-width="10%"/>
12971
+ <fo:table-column column-width="90%"/>
12972
+ </xsl:when>
12973
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
12974
+ <fo:table-column column-width="60%"/>
12975
+ <fo:table-column column-width="40%"/>
12976
+ </xsl:when> -->
12977
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
12978
+ <fo:table-column column-width="50%"/>
12979
+ <fo:table-column column-width="50%"/>
12980
+ </xsl:when>
12981
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
12982
+ <fo:table-column column-width="40%"/>
12983
+ <fo:table-column column-width="60%"/>
12984
+ </xsl:when>
12985
+ <xsl:otherwise>
12986
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
12987
+ <xsl:choose>
12988
+ <xsl:when test=". = 1 or . = 0">
12989
+ <fo:table-column column-width="proportional-column-width(2)"/>
12990
+ </xsl:when>
12991
+ <xsl:otherwise>
12992
+ <fo:table-column column-width="proportional-column-width({.})"/>
12993
+ </xsl:otherwise>
12994
+ </xsl:choose>
12995
+ </xsl:for-each>
12996
+ </xsl:otherwise>
12997
+ </xsl:choose>
12998
+ <!-- <fo:table-column column-width="15%"/>
12999
+ <fo:table-column column-width="85%"/> -->
13000
+ </xsl:otherwise>
13001
+ </xsl:choose>
13002
+ </xsl:template><xsl:template name="getMaxLength_dt">
13003
+ <xsl:for-each select="*[local-name()='dt']">
13004
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
13005
+ <xsl:if test="position() = 1">
13006
+ <xsl:value-of select="string-length(normalize-space(.))"/>
13007
+ </xsl:if>
13008
+ </xsl:for-each>
13009
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
12609
13010
  <xsl:param name="key_iso"/>
12610
13011
 
12611
13012
  <!-- <tr>
@@ -12621,7 +13022,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12621
13022
  <xsl:if test="normalize-space($key_iso) = 'true'">
12622
13023
  <xsl:attribute name="margin-top">0</xsl:attribute>
12623
13024
  </xsl:if>
12624
- NOTE
13025
+ <xsl:variable name="title-note">
13026
+ <xsl:call-template name="getTitle">
13027
+ <xsl:with-param name="name" select="'title-note'"/>
13028
+ </xsl:call-template>
13029
+ </xsl:variable>
13030
+ <xsl:value-of select="$title-note"/>
12625
13031
  </fo:block>
12626
13032
  </fo:table-cell>
12627
13033
  <fo:table-cell>
@@ -12630,7 +13036,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12630
13036
  </fo:block>
12631
13037
  </fo:table-cell>
12632
13038
  </fo:table-row>
12633
- </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">
13039
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
12634
13040
  <tr>
12635
13041
  <td>
12636
13042
  <xsl:apply-templates/>
@@ -12643,11 +13049,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12643
13049
  </td>
12644
13050
  </tr>
12645
13051
 
12646
- </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']">
13052
+ </xsl:template><xsl:template match="*[local-name()='dt']">
12647
13053
  <xsl:param name="key_iso"/>
12648
13054
 
12649
13055
  <fo:table-row>
12650
13056
  <fo:table-cell>
13057
+
12651
13058
  <fo:block margin-top="6pt">
12652
13059
 
12653
13060
 
@@ -12657,8 +13064,15 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12657
13064
  </xsl:if>
12658
13065
 
12659
13066
 
12660
- <xsl:apply-templates/>
12661
13067
 
13068
+
13069
+
13070
+ <xsl:apply-templates/>
13071
+ <!-- <xsl:if test="$namespace = 'gb'">
13072
+ <xsl:if test="ancestor::*[local-name()='formula']">
13073
+ <xsl:text>—</xsl:text>
13074
+ </xsl:if>
13075
+ </xsl:if> -->
12662
13076
  </fo:block>
12663
13077
  </fo:table-cell>
12664
13078
  <fo:table-cell>
@@ -12672,37 +13086,37 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12672
13086
  </fo:table-cell>
12673
13087
  </fo:table-row>
12674
13088
 
12675
- </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">
13089
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
12676
13090
  <xsl:apply-templates/>
12677
- </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">
13091
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
12678
13092
  <xsl:apply-templates/>
12679
- </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">
13093
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
12680
13094
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
12681
- </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']">
13095
+ </xsl:template><xsl:template match="*[local-name()='em']">
12682
13096
  <fo:inline font-style="italic">
12683
13097
  <xsl:apply-templates/>
12684
13098
  </fo:inline>
12685
- </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']">
13099
+ </xsl:template><xsl:template match="*[local-name()='strong']">
12686
13100
  <fo:inline font-weight="bold">
12687
13101
  <xsl:apply-templates/>
12688
13102
  </fo:inline>
12689
- </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']">
13103
+ </xsl:template><xsl:template match="*[local-name()='sup']">
12690
13104
  <fo:inline font-size="80%" vertical-align="super">
12691
13105
  <xsl:apply-templates/>
12692
13106
  </fo:inline>
12693
- </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']">
13107
+ </xsl:template><xsl:template match="*[local-name()='sub']">
12694
13108
  <fo:inline font-size="80%" vertical-align="sub">
12695
13109
  <xsl:apply-templates/>
12696
13110
  </fo:inline>
12697
- </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']">
12698
- <fo:inline font-family="Courier" font-size="10pt">
13111
+ </xsl:template><xsl:template match="*[local-name()='tt']">
13112
+ <fo:inline font-family="Courier" font-size="10pt">
12699
13113
  <xsl:apply-templates/>
12700
13114
  </fo:inline>
12701
- </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']">
13115
+ </xsl:template><xsl:template match="*[local-name()='del']">
12702
13116
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
12703
13117
  <xsl:apply-templates/>
12704
13118
  </fo:inline>
12705
- </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']]">
13119
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
12706
13120
  <xsl:variable name="text" select="normalize-space(.)"/>
12707
13121
  <fo:inline font-size="75%">
12708
13122
  <xsl:if test="string-length($text) &gt; 0">
@@ -12711,10 +13125,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12711
13125
  </xsl:call-template>
12712
13126
  </xsl:if>
12713
13127
  </fo:inline>
12714
- </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">
13128
+ </xsl:template><xsl:template name="recursiveSmallCaps">
12715
13129
  <xsl:param name="text"/>
12716
13130
  <xsl:variable name="char" select="substring($text,1,1)"/>
12717
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
13131
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
13132
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
12718
13133
  <xsl:choose>
12719
13134
  <xsl:when test="$char=$upperCase">
12720
13135
  <fo:inline font-size="{100 div 0.75}%">
@@ -12730,7 +13145,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12730
13145
  <xsl:with-param name="text" select="substring($text,2)"/>
12731
13146
  </xsl:call-template>
12732
13147
  </xsl:if>
12733
- </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">
13148
+ </xsl:template><xsl:template name="tokenize">
12734
13149
  <xsl:param name="text"/>
12735
13150
  <xsl:param name="separator" select="' '"/>
12736
13151
  <xsl:choose>
@@ -12778,7 +13193,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12778
13193
  </xsl:call-template>
12779
13194
  </xsl:otherwise>
12780
13195
  </xsl:choose>
12781
- </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">
13196
+ </xsl:template><xsl:template name="max_length">
12782
13197
  <xsl:param name="words"/>
12783
13198
  <xsl:for-each select="$words//word">
12784
13199
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -12786,7 +13201,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12786
13201
  <xsl:value-of select="."/>
12787
13202
  </xsl:if>
12788
13203
  </xsl:for-each>
12789
- </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">
13204
+ </xsl:template><xsl:template name="add-zero-spaces-java">
13205
+ <xsl:param name="text" select="."/>
13206
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
13207
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
13208
+ </xsl:template><xsl:template name="add-zero-spaces">
12790
13209
  <xsl:param name="text" select="."/>
12791
13210
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
12792
13211
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -12839,7 +13258,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12839
13258
  <xsl:value-of select="$text"/>
12840
13259
  </xsl:otherwise>
12841
13260
  </xsl:choose>
12842
- </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">
13261
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
12843
13262
  <xsl:param name="text" select="."/>
12844
13263
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
12845
13264
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -12865,7 +13284,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12865
13284
  <xsl:value-of select="$text"/>
12866
13285
  </xsl:otherwise>
12867
13286
  </xsl:choose>
12868
- </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">
13287
+ </xsl:template><xsl:template name="getSimpleTable">
12869
13288
  <xsl:variable name="simple-table">
12870
13289
 
12871
13290
  <!-- Step 1. colspan processing -->
@@ -12892,9 +13311,9 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12892
13311
  </xsl:choose> -->
12893
13312
  </xsl:variable>
12894
13313
  <xsl:copy-of select="$simple-table"/>
12895
- </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">
13314
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
12896
13315
  <xsl:apply-templates mode="simple-table-colspan"/>
12897
- </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">
13316
+ </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">
12898
13317
  <xsl:choose>
12899
13318
  <xsl:when test="@colspan">
12900
13319
  <xsl:variable name="td">
@@ -12916,16 +13335,16 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12916
13335
  </xsl:element>
12917
13336
  </xsl:otherwise>
12918
13337
  </xsl:choose>
12919
- </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">
13338
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
12920
13339
  <xsl:element name="tr">
12921
13340
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
12922
13341
  <xsl:apply-templates mode="simple-table-colspan"/>
12923
13342
  </xsl:element>
12924
- </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">
13343
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
12925
13344
  <xsl:copy>
12926
13345
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
12927
13346
  </xsl:copy>
12928
- </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">
13347
+ </xsl:template><xsl:template name="repeatNode">
12929
13348
  <xsl:param name="count"/>
12930
13349
  <xsl:param name="node"/>
12931
13350
 
@@ -12936,18 +13355,18 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12936
13355
  </xsl:call-template>
12937
13356
  <xsl:copy-of select="$node"/>
12938
13357
  </xsl:if>
12939
- </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">
13358
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
12940
13359
  <xsl:copy>
12941
13360
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
12942
13361
  </xsl:copy>
12943
- </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">
13362
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
12944
13363
  <xsl:copy>
12945
13364
  <xsl:copy-of select="tr[1]"/>
12946
13365
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
12947
13366
  <xsl:with-param name="previousRow" select="tr[1]"/>
12948
13367
  </xsl:apply-templates>
12949
13368
  </xsl:copy>
12950
- </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">
13369
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
12951
13370
  <xsl:param name="previousRow"/>
12952
13371
  <xsl:variable name="currentRow" select="."/>
12953
13372
 
@@ -12981,43 +13400,53 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12981
13400
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
12982
13401
  <xsl:with-param name="previousRow" select="$newRow"/>
12983
13402
  </xsl:apply-templates>
12984
- </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">
13403
+ </xsl:template><xsl:template name="getLang">
12985
13404
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
12986
13405
  <xsl:choose>
12987
13406
  <xsl:when test="$language = 'English'">en</xsl:when>
12988
13407
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
12989
13408
  </xsl:choose>
12990
- </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">
13409
+ </xsl:template><xsl:template name="capitalizeWords">
12991
13410
  <xsl:param name="str"/>
12992
13411
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
12993
13412
  <xsl:choose>
12994
13413
  <xsl:when test="contains($str2, ' ')">
12995
13414
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
12996
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
12997
- <xsl:value-of select="substring($substr, 2)"/>
13415
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
13416
+ <xsl:value-of select="substring($substr, 2)"/> -->
13417
+ <xsl:call-template name="capitalize">
13418
+ <xsl:with-param name="str" select="$substr"/>
13419
+ </xsl:call-template>
12998
13420
  <xsl:text> </xsl:text>
12999
13421
  <xsl:call-template name="capitalizeWords">
13000
13422
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
13001
13423
  </xsl:call-template>
13002
13424
  </xsl:when>
13003
13425
  <xsl:otherwise>
13004
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
13005
- <xsl:value-of select="substring($str2, 2)"/>
13426
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
13427
+ <xsl:value-of select="substring($str2, 2)"/> -->
13428
+ <xsl:call-template name="capitalize">
13429
+ <xsl:with-param name="str" select="$str2"/>
13430
+ </xsl:call-template>
13006
13431
  </xsl:otherwise>
13007
13432
  </xsl:choose>
13008
- </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">
13433
+ </xsl:template><xsl:template name="capitalize">
13434
+ <xsl:param name="str"/>
13435
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
13436
+ <xsl:value-of select="substring($str, 2)"/>
13437
+ </xsl:template><xsl:template match="mathml:math">
13009
13438
  <fo:inline font-family="STIX2Math">
13010
13439
  <fo:instream-foreign-object fox:alt-text="Math">
13011
13440
  <xsl:copy-of select="."/>
13012
13441
  </fo:instream-foreign-object>
13013
13442
  </fo:inline>
13014
- </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']">
13443
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
13015
13444
  <xsl:for-each select="*[local-name()='locality']">
13016
13445
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
13017
13446
  <xsl:apply-templates select="."/>
13018
13447
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
13019
13448
  </xsl:for-each>
13020
- </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">
13449
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
13021
13450
  <xsl:variable name="target">
13022
13451
  <xsl:choose>
13023
13452
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -13047,4 +13476,275 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
13047
13476
  </xsl:otherwise>
13048
13477
  </xsl:choose>
13049
13478
  </fo:inline>
13479
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
13480
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
13481
+ <!-- <xsl:choose>
13482
+ <xsl:when test="@lang = 'en'"></xsl:when>
13483
+ <xsl:otherwise> -->
13484
+ <xsl:attribute name="white-space">pre</xsl:attribute>
13485
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
13486
+ <!-- </xsl:otherwise>
13487
+ </xsl:choose> -->
13488
+ <xsl:apply-templates/>
13489
+ </fo:block>
13490
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
13491
+ <fo:inline id="{@id}"/>
13492
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
13493
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
13494
+ <xsl:variable name="title-appendix">
13495
+ <xsl:call-template name="getTitle">
13496
+ <xsl:with-param name="name" select="'title-appendix'"/>
13497
+ </xsl:call-template>
13498
+ </xsl:variable>
13499
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
13500
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
13501
+ </fo:block>
13502
+ <xsl:apply-templates/>
13503
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
13504
+ <fo:inline><xsl:apply-templates/></fo:inline>
13505
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
13506
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
13507
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
13508
+ <xsl:variable name="title-example">
13509
+ <xsl:call-template name="getTitle">
13510
+ <xsl:with-param name="name" select="'title-example'"/>
13511
+ </xsl:call-template>
13512
+ </xsl:variable>
13513
+ <xsl:value-of select="$title-example"/>
13514
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
13515
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
13516
+ </xsl:if>
13517
+ <xsl:if test="*[local-name()='name']">
13518
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
13519
+ </xsl:if>
13520
+ </fo:block>
13521
+ <xsl:apply-templates/>
13522
+ </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">
13523
+ <fo:inline><xsl:apply-templates/></fo:inline>
13524
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
13525
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
13526
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
13527
+ <xsl:variable name="annotation-id" select="@id"/>
13528
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
13529
+ <fo:block id="{$annotation-id}" white-space="nowrap">
13530
+ <fo:inline>
13531
+ <xsl:apply-templates>
13532
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
13533
+ </xsl:apply-templates>
13534
+ </fo:inline>
13535
+ </fo:block>
13536
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
13537
+ <xsl:param name="callout"/>
13538
+ <fo:inline id="{@id}">
13539
+ <!-- for first p in annotation, put <x> -->
13540
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
13541
+ <xsl:apply-templates/>
13542
+ </fo:inline>
13543
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
13544
+ <xsl:variable name="title-modified">
13545
+ <xsl:call-template name="getTitle">
13546
+ <xsl:with-param name="name" select="'title-modified'"/>
13547
+ </xsl:call-template>
13548
+ </xsl:variable>
13549
+ <xsl:choose>
13550
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
13551
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
13552
+ </xsl:choose>
13553
+ <xsl:apply-templates/>
13554
+ </xsl:template><xsl:template name="convertDate">
13555
+ <xsl:param name="date"/>
13556
+ <xsl:param name="format" select="'short'"/>
13557
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
13558
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
13559
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
13560
+ <xsl:variable name="monthStr">
13561
+ <xsl:choose>
13562
+ <xsl:when test="$month = '01'">January</xsl:when>
13563
+ <xsl:when test="$month = '02'">February</xsl:when>
13564
+ <xsl:when test="$month = '03'">March</xsl:when>
13565
+ <xsl:when test="$month = '04'">April</xsl:when>
13566
+ <xsl:when test="$month = '05'">May</xsl:when>
13567
+ <xsl:when test="$month = '06'">June</xsl:when>
13568
+ <xsl:when test="$month = '07'">July</xsl:when>
13569
+ <xsl:when test="$month = '08'">August</xsl:when>
13570
+ <xsl:when test="$month = '09'">September</xsl:when>
13571
+ <xsl:when test="$month = '10'">October</xsl:when>
13572
+ <xsl:when test="$month = '11'">November</xsl:when>
13573
+ <xsl:when test="$month = '12'">December</xsl:when>
13574
+ </xsl:choose>
13575
+ </xsl:variable>
13576
+ <xsl:variable name="result">
13577
+ <xsl:choose>
13578
+ <xsl:when test="$format = 'short' or $day = ''">
13579
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
13580
+ </xsl:when>
13581
+ <xsl:otherwise>
13582
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
13583
+ </xsl:otherwise>
13584
+ </xsl:choose>
13585
+ </xsl:variable>
13586
+ <xsl:value-of select="$result"/>
13587
+ </xsl:template><xsl:template name="insertKeywords">
13588
+ <xsl:param name="sorting" select="'true'"/>
13589
+ <xsl:param name="charAtEnd" select="'.'"/>
13590
+ <xsl:param name="charDelim" select="', '"/>
13591
+ <xsl:choose>
13592
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
13593
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
13594
+ <xsl:sort data-type="text" order="ascending"/>
13595
+ <xsl:call-template name="insertKeyword">
13596
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
13597
+ <xsl:with-param name="charDelim" select="$charDelim"/>
13598
+ </xsl:call-template>
13599
+ </xsl:for-each>
13600
+ </xsl:when>
13601
+ <xsl:otherwise>
13602
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
13603
+ <xsl:call-template name="insertKeyword">
13604
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
13605
+ <xsl:with-param name="charDelim" select="$charDelim"/>
13606
+ </xsl:call-template>
13607
+ </xsl:for-each>
13608
+ </xsl:otherwise>
13609
+ </xsl:choose>
13610
+ </xsl:template><xsl:template name="insertKeyword">
13611
+ <xsl:param name="charAtEnd"/>
13612
+ <xsl:param name="charDelim"/>
13613
+ <xsl:apply-templates/>
13614
+ <xsl:choose>
13615
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
13616
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
13617
+ </xsl:choose>
13618
+ </xsl:template><xsl:template name="addPDFUAmeta">
13619
+ <fo:declarations>
13620
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
13621
+ <pdf:dictionary type="normal" key="ViewerPreferences">
13622
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
13623
+ </pdf:dictionary>
13624
+ </pdf:catalog>
13625
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
13626
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13627
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
13628
+ <!-- Dublin Core properties go here -->
13629
+ <dc:title>
13630
+ <xsl:variable name="title">
13631
+
13632
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
13633
+
13634
+
13635
+
13636
+
13637
+ </xsl:variable>
13638
+ <xsl:choose>
13639
+ <xsl:when test="normalize-space($title) != ''">
13640
+ <xsl:value-of select="$title"/>
13641
+ </xsl:when>
13642
+ <xsl:otherwise>
13643
+ <xsl:text> </xsl:text>
13644
+ </xsl:otherwise>
13645
+ </xsl:choose>
13646
+ </dc:title>
13647
+ <dc:creator>
13648
+
13649
+
13650
+ </dc:creator>
13651
+ <dc:description>
13652
+ <xsl:variable name="abstract">
13653
+
13654
+
13655
+
13656
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
13657
+
13658
+
13659
+ </xsl:variable>
13660
+ <xsl:value-of select="normalize-space($abstract)"/>
13661
+ </dc:description>
13662
+ <pdf:Keywords>
13663
+ <xsl:call-template name="insertKeywords"/>
13664
+ </pdf:Keywords>
13665
+ </rdf:Description>
13666
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
13667
+ <!-- XMP properties go here -->
13668
+ <xmp:CreatorTool/>
13669
+ </rdf:Description>
13670
+ </rdf:RDF>
13671
+ </x:xmpmeta>
13672
+ </fo:declarations>
13673
+ </xsl:template><xsl:template name="getId">
13674
+ <xsl:choose>
13675
+ <xsl:when test="../@id">
13676
+ <xsl:value-of select="../@id"/>
13677
+ </xsl:when>
13678
+ <xsl:otherwise>
13679
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
13680
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
13681
+ </xsl:otherwise>
13682
+ </xsl:choose>
13683
+ </xsl:template><xsl:template name="getLevel">
13684
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
13685
+ <xsl:variable name="level">
13686
+ <xsl:choose>
13687
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
13688
+ <xsl:value-of select="$level_total - 2"/>
13689
+ </xsl:when>
13690
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
13691
+ <xsl:value-of select="$level_total - 2"/>
13692
+ </xsl:when>
13693
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13694
+ <xsl:value-of select="$level_total - 2"/>
13695
+ </xsl:when>
13696
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
13697
+ <xsl:otherwise>
13698
+ <xsl:value-of select="$level_total - 1"/>
13699
+ </xsl:otherwise>
13700
+ </xsl:choose>
13701
+ </xsl:variable>
13702
+ <xsl:value-of select="$level"/>
13703
+ </xsl:template><xsl:template name="getSubSection">
13704
+ <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']"/>
13705
+ </xsl:template><xsl:template name="split">
13706
+ <xsl:param name="pText" select="."/>
13707
+ <xsl:param name="sep" select="','"/>
13708
+ <xsl:if test="string-length($pText) &gt;0">
13709
+ <item>
13710
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
13711
+ </item>
13712
+ <xsl:call-template name="split">
13713
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
13714
+ <xsl:with-param name="sep" select="$sep"/>
13715
+ </xsl:call-template>
13716
+ </xsl:if>
13717
+ </xsl:template><xsl:template name="getDocumentId">
13718
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
13719
+ </xsl:template><xsl:template name="namespaceCheck">
13720
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
13721
+ <xsl:variable name="XSLNS">
13722
+
13723
+
13724
+
13725
+
13726
+ <xsl:value-of select="document('')//*/namespace::unece"/>
13727
+
13728
+
13729
+
13730
+
13731
+
13732
+
13733
+
13734
+
13735
+
13736
+ </xsl:variable>
13737
+ <xsl:if test="$documentNS != $XSLNS">
13738
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
13739
+ </xsl:if>
13740
+ </xsl:template><xsl:template name="getLanguage">
13741
+ <xsl:param name="lang"/>
13742
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
13743
+ <xsl:choose>
13744
+ <xsl:when test="$language = 'en'">English</xsl:when>
13745
+ <xsl:when test="$language = 'fr'">French</xsl:when>
13746
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
13747
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
13748
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
13749
+ </xsl:choose>
13050
13750
  </xsl:template></xsl:stylesheet>