metanorma-un 0.3.7 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" 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
 
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+ <xsl:variable name="debug">false</xsl:variable>
9
10
  <xsl:variable name="pageWidth" select="'210mm'"/>
10
11
  <xsl:variable name="pageHeight" select="'297mm'"/>
11
12
 
@@ -24,8 +25,10 @@
24
25
 
25
26
  <xsl:variable name="doctype" select="/un:un-standard/un:bibdata/un:ext/un:doctype"/>
26
27
 
27
- <xsl:variable name="doctypenumber">
28
- <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>
29
32
  <xsl:text> No. </xsl:text>
30
33
  <xsl:value-of select="/un:un-standard/un:bibdata/un:docnumber"/>
31
34
  </xsl:variable>
@@ -75,42 +78,8 @@
75
78
 
76
79
  </fo:layout-master-set>
77
80
 
78
- <fo:declarations>
79
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
80
- <pdf:dictionary type="normal" key="ViewerPreferences">
81
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
82
- </pdf:dictionary>
83
- </pdf:catalog>
84
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
85
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
86
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
87
- <!-- Dublin Core properties go here -->
88
- <dc:title>
89
- <xsl:choose>
90
- <xsl:when test="$title != ''">
91
- <xsl:value-of select="$title"/>
92
- </xsl:when>
93
- <xsl:otherwise>
94
- <xsl:text> </xsl:text>
95
- </xsl:otherwise>
96
- </xsl:choose>
97
- </dc:title>
98
- <dc:creator/>
99
- <dc:description>
100
- <xsl:variable name="abstract">
101
- <xsl:copy-of select="/un:un-standard/un:preface/un:abstract//text()"/>
102
- </xsl:variable>
103
- <xsl:value-of select="normalize-space($abstract)"/>
104
- </dc:description>
105
- <pdf:Keywords/>
106
- </rdf:Description>
107
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
108
- <!-- XMP properties go here -->
109
- <xmp:CreatorTool/>
110
- </rdf:Description>
111
- </rdf:RDF>
112
- </x:xmpmeta>
113
- </fo:declarations>
81
+ <xsl:call-template name="addPDFUAmeta"/>
82
+
114
83
 
115
84
  <!-- Cover Page -->
116
85
  <fo:page-sequence master-reference="cover-page" force-page-count="even">
@@ -205,8 +174,18 @@
205
174
  <fo:page-sequence master-reference="document-preface-master" force-page-count="even" line-height="115%">
206
175
  <xsl:call-template name="insertHeaderPreface"/>
207
176
  <fo:flow flow-name="xsl-region-body" text-align="justify">
208
- <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt">Contents</fo:block>
209
- <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>
210
189
  <fo:block>
211
190
  <xsl:for-each select="xalan:nodeset($contents)//item[not(@type = 'table') and not(@type = 'figure') and not (@type = 'annex' or @parent = 'annex')]">
212
191
  <xsl:if test="@display = 'true' and @level &lt;= 3">
@@ -289,10 +268,12 @@
289
268
  <xsl:call-template name="insertFooter"/>
290
269
  <fo:flow flow-name="xsl-region-body">
291
270
 
292
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
293
- DEBUG
294
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
295
- <xsl:text disable-output-escaping="yes"> --&gt;</xsl:text>
271
+ <xsl:if test="$debug = 'true'">
272
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
273
+ DEBUG
274
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
275
+ <xsl:text disable-output-escaping="yes"> --&gt;</xsl:text>
276
+ </xsl:if>
296
277
 
297
278
  <fo:block>
298
279
  <xsl:apply-templates select="/un:un-standard/un:sections/*"/>
@@ -341,14 +322,7 @@
341
322
  <!-- Any node with title element - clause, definition, annex,... -->
342
323
  <xsl:template match="un:title | un:preferred" mode="contents">
343
324
  <xsl:variable name="id">
344
- <xsl:choose>
345
- <xsl:when test="../@id">
346
- <xsl:value-of select="../@id"/>
347
- </xsl:when>
348
- <xsl:otherwise>
349
- <xsl:value-of select="text()"/>
350
- </xsl:otherwise>
351
- </xsl:choose>
325
+ <xsl:call-template name="getId"/>
352
326
  </xsl:variable>
353
327
 
354
328
  <xsl:variable name="level">
@@ -395,7 +369,12 @@
395
369
  <xsl:when test="ancestor::un:annex">
396
370
  <xsl:choose>
397
371
  <xsl:when test="$level = 1">
398
- <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"/>
399
378
  <xsl:number format="I" level="any" count="un:annex"/>
400
379
  </xsl:when>
401
380
  <xsl:otherwise>
@@ -428,7 +407,12 @@
428
407
  <xsl:template match="un:figure" mode="contents">
429
408
  <item level="" id="{@id}" type="figure">
430
409
  <xsl:attribute name="section">
431
- <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"/>
432
416
  <xsl:choose>
433
417
  <xsl:when test="ancestor::un:annex">
434
418
  <xsl:choose>
@@ -460,7 +444,12 @@
460
444
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
461
445
  <item level="" id="{@id}" display="false" type="table">
462
446
  <xsl:attribute name="section">
463
- <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"/>
464
453
  <xsl:choose>
465
454
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
466
455
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -484,7 +473,12 @@
484
473
  <xsl:template match="un:formula" mode="contents">
485
474
  <item level="" id="{@id}" display="false">
486
475
  <xsl:attribute name="section">
487
- <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"/>
488
482
  </xsl:attribute>
489
483
  </item>
490
484
  </xsl:template>
@@ -513,7 +507,12 @@
513
507
  <item level="" id="{@id}" display="false" type="Terms">
514
508
  <xsl:if test="ancestor::un:annex">
515
509
  <xsl:attribute name="section">
516
- <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"/>
517
516
  </xsl:attribute>
518
517
  </xsl:if>
519
518
  </item>
@@ -523,7 +522,12 @@
523
522
  <item level="" id="{@id}" display="false" type="References">
524
523
  <xsl:if test="ancestor::un:annex">
525
524
  <xsl:attribute name="section">
526
- <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"/>
527
531
  </xsl:attribute>
528
532
  </xsl:if>
529
533
  </item>
@@ -535,7 +539,12 @@
535
539
  <xsl:variable name="num">
536
540
  <xsl:number/>
537
541
  </xsl:variable>
538
- <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"/>
539
548
  </xsl:attribute>
540
549
  </item>
541
550
  </xsl:template>
@@ -617,7 +626,7 @@
617
626
  </fo:block>
618
627
  </xsl:template>
619
628
 
620
- <xsl:template match="un:feedback-statement//un:clause//un:p//un:link"/>
629
+ <xsl:template match="un:feedback-statement//un:clause//un:p//un:link" priority="2"/>
621
630
 
622
631
  <xsl:template name="show_fs_table">
623
632
  <fo:block>
@@ -753,7 +762,12 @@
753
762
  <xsl:template match="un:ul//un:note | un:ol//un:note"/>
754
763
  <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process">
755
764
  <fo:block font-size="11pt" margin-top="4pt">
756
- <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"/>
757
771
  <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note">
758
772
  <xsl:number count="un:note"/><xsl:text> </xsl:text>
759
773
  </xsl:if>
@@ -813,20 +827,7 @@
813
827
  <xsl:apply-templates/>
814
828
  </fo:block>
815
829
  </xsl:template>
816
-
817
- <xsl:template match="un:link">
818
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
819
- <xsl:choose>
820
- <xsl:when test="normalize-space(.) = ''">
821
- <xsl:value-of select="@target"/>
822
- </xsl:when>
823
- <xsl:otherwise>
824
- <xsl:apply-templates/>
825
- </xsl:otherwise>
826
- </xsl:choose>
827
- </fo:basic-link>
828
- </xsl:template>
829
-
830
+
830
831
  <xsl:template match="un:xref">
831
832
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
832
833
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
@@ -845,7 +846,12 @@
845
846
  <xsl:variable name="num">
846
847
  <xsl:number/>
847
848
  </xsl:variable>
848
- <xsl:text>Box </xsl:text><xsl:value-of select="$num"/><xsl:text>. </xsl:text><xsl:apply-templates select="un:name" mode="process"/>
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"/>
849
855
  </fo:block>
850
856
  <fo:block margin-left="29mm" margin-right="34mm">
851
857
  <xsl:apply-templates/>
@@ -902,14 +908,7 @@
902
908
 
903
909
  <xsl:template match="un:title">
904
910
  <xsl:variable name="id">
905
- <xsl:choose>
906
- <xsl:when test="../@id">
907
- <xsl:value-of select="../@id"/>
908
- </xsl:when>
909
- <xsl:otherwise>
910
- <xsl:value-of select="text()"/>
911
- </xsl:otherwise>
912
- </xsl:choose>
911
+ <xsl:call-template name="getId"/>
913
912
  </xsl:variable>
914
913
 
915
914
  <xsl:variable name="level">
@@ -996,7 +995,12 @@
996
995
  <xsl:template match="un:recommendation">
997
996
  <fo:block margin-left="20mm">
998
997
  <fo:block font-weight="bold">
999
- <xsl:text>Recommendation </xsl:text>
998
+ <xsl:variable name="title-recommendation">
999
+ <xsl:call-template name="getTitle">
1000
+ <xsl:with-param name="name" select="'title-recommendation'"/>
1001
+ </xsl:call-template>
1002
+ </xsl:variable>
1003
+ <xsl:value-of select="$title-recommendation"/>
1000
1004
  <xsl:choose>
1001
1005
  <xsl:when test="ancestor::un:sections">
1002
1006
  <xsl:number level="any" count="un:sections//un:recommendation"/>
@@ -1067,7 +1071,12 @@
1067
1071
  </xsl:if>
1068
1072
  <xsl:if test="un:name">
1069
1073
  <fo:block text-align="center" font-size="9pt" margin-bottom="6pt" keep-with-next="always" keep-together.within-column="always">
1070
- <xsl:text>Figure </xsl:text>
1074
+ <xsl:variable name="title-figure">
1075
+ <xsl:call-template name="getTitle">
1076
+ <xsl:with-param name="name" select="'title-figure'"/>
1077
+ </xsl:call-template>
1078
+ </xsl:variable>
1079
+ <xsl:value-of select="$title-figure"/>
1071
1080
  <xsl:choose>
1072
1081
  <xsl:when test="ancestor::un:annex">
1073
1082
  <xsl:choose>
@@ -1220,12 +1229,17 @@
1220
1229
 
1221
1230
  <xsl:template match="un:termnote">
1222
1231
  <fo:block margin-top="4pt">
1223
- <xsl:text>NOTE </xsl:text>
1224
- <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1225
- <xsl:number/><xsl:text> </xsl:text>
1226
- </xsl:if>
1227
- <xsl:text>– </xsl:text>
1228
- <xsl:apply-templates/>
1232
+ <xsl:variable name="title-note">
1233
+ <xsl:call-template name="getTitle">
1234
+ <xsl:with-param name="name" select="'title-note'"/>
1235
+ </xsl:call-template>
1236
+ </xsl:variable>
1237
+ <xsl:value-of select="$title-note"/>
1238
+ <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote">
1239
+ <xsl:number/><xsl:text> </xsl:text>
1240
+ </xsl:if>
1241
+ <xsl:text>– </xsl:text>
1242
+ <xsl:apply-templates/>
1229
1243
  </fo:block>
1230
1244
  </xsl:template>
1231
1245
 
@@ -1253,7 +1267,7 @@
1253
1267
  <fo:table-cell> <!-- display-align="center" -->
1254
1268
  <fo:block text-align="right">
1255
1269
  <xsl:if test="not(ancestor::un:annex)">
1256
- <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text>
1270
+ <xsl:number format="(1)" level="any"/>
1257
1271
  </xsl:if>
1258
1272
  <xsl:if test="ancestor::un:annex">
1259
1273
  <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/>
@@ -1277,7 +1291,12 @@
1277
1291
  </xsl:template>
1278
1292
 
1279
1293
  <xsl:template match="un:example">
1280
- <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block>
1294
+ <xsl:variable name="title-example">
1295
+ <xsl:call-template name="getTitle">
1296
+ <xsl:with-param name="name" select="'title-example'"/>
1297
+ </xsl:call-template>
1298
+ </xsl:variable>
1299
+ <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block>
1281
1300
  <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm">
1282
1301
  <xsl:apply-templates/>
1283
1302
  </fo:block>
@@ -1303,19 +1322,30 @@
1303
1322
  <!-- <xsl:if test="@type = 'inline'">
1304
1323
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1305
1324
  </xsl:if> -->
1306
- <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1307
- <xsl:if test="un:locality">
1308
- <xsl:text>, </xsl:text>
1309
- <xsl:choose>
1310
- <xsl:when test="un:locality/@type = 'section'">Section </xsl:when>
1311
- <xsl:when test="un:locality/@type = 'clause'">Clause </xsl:when>
1312
- <xsl:otherwise/>
1313
- </xsl:choose>
1314
- <xsl:apply-templates select="un:locality"/>
1315
- </xsl:if>
1325
+ <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" -->
1326
+ <xsl:apply-templates select="un:localityStack"/>
1316
1327
  </fo:basic-link>
1317
1328
  </xsl:template>
1318
1329
 
1330
+ <xsl:template match="un:locality">
1331
+ <xsl:variable name="title-section">
1332
+ <xsl:call-template name="getTitle">
1333
+ <xsl:with-param name="name" select="'title-section'"/>
1334
+ </xsl:call-template>
1335
+ </xsl:variable>
1336
+ <xsl:variable name="title-clause">
1337
+ <xsl:call-template name="getTitle">
1338
+ <xsl:with-param name="name" select="'title-clause'"/>
1339
+ </xsl:call-template>
1340
+ </xsl:variable>
1341
+ <xsl:choose>
1342
+ <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when>
1343
+ <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1344
+ <xsl:otherwise/>
1345
+ </xsl:choose>
1346
+ <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/>
1347
+ </xsl:template>
1348
+
1319
1349
 
1320
1350
  <xsl:template match="un:terms[un:term[un:preferred and un:definition]]">
1321
1351
  <fo:block id="{@id}">
@@ -1329,7 +1359,7 @@
1329
1359
  </fo:block>
1330
1360
  </xsl:template>
1331
1361
  <xsl:template match="un:term" mode="table">
1332
- <fo:table-row>
1362
+ <fo:table-row id="{@id}">
1333
1363
  <fo:table-cell padding-right="1mm">
1334
1364
  <fo:block margin-bottom="12pt">
1335
1365
  <xsl:apply-templates select="un:preferred"/>
@@ -1343,7 +1373,7 @@
1343
1373
  </fo:table-row>
1344
1374
  </xsl:template>
1345
1375
  <xsl:template match="un:preferred">
1346
- <fo:inline id="{../@id}">
1376
+ <fo:inline>
1347
1377
  <xsl:apply-templates/>
1348
1378
  </fo:inline>
1349
1379
  </xsl:template>
@@ -1409,15 +1439,7 @@
1409
1439
  <xsl:apply-templates/>
1410
1440
  </fo:block>
1411
1441
  </xsl:template>
1412
-
1413
- <xsl:template match="un:sourcecode">
1414
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1415
- <xsl:attribute name="white-space">pre</xsl:attribute>
1416
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1417
- <xsl:apply-templates/>
1418
- </fo:block>
1419
- </xsl:template>
1420
-
1442
+
1421
1443
  <xsl:template match="un:references">
1422
1444
  <fo:block>
1423
1445
  <xsl:if test="not(un:title)">
@@ -1460,28 +1482,6 @@
1460
1482
  </xsl:template>
1461
1483
 
1462
1484
 
1463
- <xsl:template name="getLevel">
1464
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1465
- <xsl:variable name="level">
1466
- <xsl:choose>
1467
- <xsl:when test="ancestor::un:preface">
1468
- <xsl:value-of select="$level_total - 2"/>
1469
- </xsl:when>
1470
- <xsl:when test="ancestor::un:sections">
1471
- <xsl:value-of select="$level_total - 2"/>
1472
- </xsl:when>
1473
- <xsl:when test="ancestor::un:bibliography">
1474
- <xsl:value-of select="$level_total - 2"/>
1475
- </xsl:when>
1476
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1477
- <xsl:otherwise>
1478
- <xsl:value-of select="$level_total - 1"/>
1479
- </xsl:otherwise>
1480
- </xsl:choose>
1481
- </xsl:variable>
1482
- <xsl:value-of select="$level"/>
1483
- </xsl:template>
1484
-
1485
1485
  <xsl:template name="getSection">
1486
1486
  <xsl:variable name="level">
1487
1487
  <xsl:call-template name="getLevel"/>
@@ -1509,7 +1509,12 @@
1509
1509
  <xsl:when test="ancestor::un:annex">
1510
1510
  <xsl:choose>
1511
1511
  <xsl:when test="$level = 1">
1512
- <xsl:text>Annex </xsl:text>
1512
+ <xsl:variable name="title-annex">
1513
+ <xsl:call-template name="getTitle">
1514
+ <xsl:with-param name="name" select="'title-annex'"/>
1515
+ </xsl:call-template>
1516
+ </xsl:variable>
1517
+ <xsl:value-of select="$title-annex"/>
1513
1518
  <xsl:number format="I" level="any" count="un:annex"/>
1514
1519
  <!-- <xsl:text>: </xsl:text> -->
1515
1520
  </xsl:when>
@@ -11911,13 +11916,217 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
11911
11916
  </xsl:text>
11912
11917
  </xsl:variable>
11913
11918
 
11914
- <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: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()">
11919
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
11920
+
11921
+ <title-table lang="en">Table </title-table>
11922
+ <title-table lang="fr">Tableau </title-table>
11923
+
11924
+ <title-table lang="zh">Table </title-table>
11925
+
11926
+
11927
+
11928
+ <title-note lang="en">NOTE </title-note>
11929
+ <title-note lang="fr">NOTE </title-note>
11930
+
11931
+ <title-note lang="zh">NOTE </title-note>
11932
+
11933
+
11934
+
11935
+ <title-figure lang="en">Figure </title-figure>
11936
+ <title-figure lang="fr">Figure </title-figure>
11937
+
11938
+ <title-figure lang="zh">Figure </title-figure>
11939
+
11940
+
11941
+
11942
+ <title-example lang="en">EXAMPLE </title-example>
11943
+ <title-example lang="fr">EXEMPLE </title-example>
11944
+
11945
+ <title-example lang="zh">EXAMPLE </title-example>
11946
+
11947
+
11948
+
11949
+ <title-example-xref lang="en">Example </title-example-xref>
11950
+ <title-example-xref lang="fr">Exemple </title-example-xref>
11951
+
11952
+ <title-section lang="en">Section </title-section>
11953
+ <title-section lang="fr">Section </title-section>
11954
+
11955
+ <title-inequality lang="en">Inequality </title-inequality>
11956
+ <title-inequality lang="fr">Inequality </title-inequality>
11957
+
11958
+ <title-equation lang="en">Equation </title-equation>
11959
+ <title-equation lang="fr">Equation </title-equation>
11960
+
11961
+ <title-annex lang="en">Annex </title-annex>
11962
+ <title-annex lang="fr">Annexe </title-annex>
11963
+
11964
+ <title-annex lang="zh">Annex </title-annex>
11965
+
11966
+
11967
+
11968
+ <title-appendix lang="en">Appendix </title-appendix>
11969
+ <title-appendix lang="fr">Appendix </title-appendix>
11970
+
11971
+ <title-clause lang="en">Clause </title-clause>
11972
+ <title-clause lang="fr">Article </title-clause>
11973
+
11974
+ <title-clause lang="zh">Clause </title-clause>
11975
+
11976
+
11977
+
11978
+ <title-edition lang="en">
11979
+
11980
+ <xsl:text>Edition </xsl:text>
11981
+
11982
+
11983
+ </title-edition>
11984
+
11985
+ <title-formula lang="en">Formula </title-formula>
11986
+ <title-formula lang="fr">Formula </title-formula>
11987
+
11988
+ <title-toc lang="en">
11989
+
11990
+ <xsl:text>Contents</xsl:text>
11991
+
11992
+
11993
+
11994
+ </title-toc>
11995
+ <title-toc lang="fr">Sommaire</title-toc>
11996
+
11997
+ <title-toc lang="zh">Contents</title-toc>
11998
+
11999
+
12000
+
12001
+ <title-page lang="en">Page</title-page>
12002
+ <title-page lang="fr">Page</title-page>
12003
+
12004
+ <title-key lang="en">Key</title-key>
12005
+ <title-key lang="fr">Légende</title-key>
12006
+
12007
+ <title-where lang="en">where</title-where>
12008
+ <title-where lang="fr">où</title-where>
12009
+
12010
+ <title-descriptors lang="en">Descriptors</title-descriptors>
12011
+
12012
+ <title-part lang="en">
12013
+
12014
+
12015
+ </title-part>
12016
+ <title-part lang="fr">
12017
+
12018
+
12019
+ </title-part>
12020
+ <title-part lang="zh">第 # 部分:</title-part>
12021
+
12022
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
12023
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
12024
+
12025
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
12026
+
12027
+
12028
+
12029
+ <title-modified lang="en">modified</title-modified>
12030
+ <title-modified lang="fr">modifiée</title-modified>
12031
+
12032
+ <title-modified lang="zh">modified</title-modified>
12033
+
12034
+
12035
+
12036
+ <title-source lang="en">SOURCE</title-source>
12037
+
12038
+ <title-keywords lang="en">Keywords</title-keywords>
12039
+
12040
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
12041
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
12042
+
12043
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
12044
+
12045
+ <title-list-tables lang="en">List of Tables</title-list-tables>
12046
+
12047
+ <title-list-figures lang="en">List of Figures</title-list-figures>
12048
+
12049
+ <title-recommendation lang="en">Recommendation </title-recommendation>
12050
+
12051
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
12052
+
12053
+ <title-abstract lang="en">Abstract</title-abstract>
12054
+
12055
+ <title-summary lang="en">Summary</title-summary>
12056
+
12057
+ <title-in lang="en">in </title-in>
12058
+
12059
+ <title-box lang="en">Box </title-box>
12060
+
12061
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
12062
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
12063
+
12064
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
12065
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
12066
+
12067
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
12068
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
12069
+
12070
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
12071
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
12072
+
12073
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
12074
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
12075
+
12076
+ <title-caution lang="en">CAUTION</title-caution>
12077
+ <title-caution lang="zh">注意</title-caution>
12078
+
12079
+ <title-warning lang="en">WARNING</title-warning>
12080
+ <title-warning lang="zh">警告</title-warning>
12081
+
12082
+ <title-amendment lang="en">AMENDMENT</title-amendment>
12083
+ </xsl:variable><xsl:template name="getTitle">
12084
+ <xsl:param name="name"/>
12085
+ <xsl:variable name="lang">
12086
+ <xsl:call-template name="getLang"/>
12087
+ </xsl:variable>
12088
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
12089
+ <xsl:choose>
12090
+ <xsl:when test="normalize-space($title_) != ''">
12091
+ <xsl:value-of select="$title_"/>
12092
+ </xsl:when>
12093
+ <xsl:otherwise>
12094
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
12095
+ </xsl:otherwise>
12096
+ </xsl:choose>
12097
+ </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">
12098
+
12099
+
12100
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
12101
+
12102
+
12103
+
12104
+
12105
+
12106
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
12107
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
12108
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
12109
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
12110
+
12111
+
12112
+
12113
+
12114
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
12115
+
12116
+
12117
+
12118
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
12119
+
12120
+
12121
+
12122
+ </xsl:attribute-set><xsl:template match="text()">
11915
12123
  <xsl:value-of select="."/>
11916
- </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']">
12124
+ </xsl:template><xsl:template match="*[local-name()='br']">
11917
12125
  <xsl:value-of select="$linebreak"/>
11918
- </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()" priority="1">
11919
- <xsl:call-template name="add-zero-spaces"/>
11920
- </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']">
12126
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
12127
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
12128
+ <xsl:call-template name="add-zero-spaces-java"/>
12129
+ </xsl:template><xsl:template match="*[local-name()='table']">
11921
12130
 
11922
12131
  <xsl:variable name="simple-table">
11923
12132
  <!-- <xsl:copy> -->
@@ -11931,7 +12140,9 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
11931
12140
 
11932
12141
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
11933
12142
 
11934
-
12143
+ <!-- <xsl:if test="$namespace = 'iso'">
12144
+ <fo:block space-before="6pt">&#xA0;</fo:block>
12145
+ </xsl:if> -->
11935
12146
 
11936
12147
  <xsl:choose>
11937
12148
  <xsl:when test="@unnumbered = 'true'"/>
@@ -11946,7 +12157,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
11946
12157
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
11947
12158
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
11948
12159
 
11949
- <xsl:text>Table </xsl:text>
12160
+ <xsl:variable name="title-table">
12161
+ <xsl:call-template name="getTitle">
12162
+ <xsl:with-param name="name" select="'title-table'"/>
12163
+ </xsl:call-template>
12164
+ </xsl:variable>
12165
+ <xsl:value-of select="$title-table"/>
11950
12166
  <xsl:choose>
11951
12167
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
11952
12168
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -12009,11 +12225,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12009
12225
  </xsl:call-template>
12010
12226
  </xsl:variable>
12011
12227
 
12012
- <xsl:variable name="colwidths2">
12228
+ <!-- <xsl:variable name="colwidths2">
12013
12229
  <xsl:call-template name="calculate-column-widths">
12014
12230
  <xsl:with-param name="cols-count" select="$cols-count"/>
12015
12231
  </xsl:call-template>
12016
- </xsl:variable>
12232
+ </xsl:variable> -->
12017
12233
 
12018
12234
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
12019
12235
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -12035,7 +12251,10 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12035
12251
 
12036
12252
 
12037
12253
 
12038
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
12254
+
12255
+
12256
+ <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">
12257
+
12039
12258
 
12040
12259
 
12041
12260
 
@@ -12053,9 +12272,10 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12053
12272
 
12054
12273
 
12055
12274
 
12275
+
12056
12276
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
12057
12277
  <xsl:choose>
12058
- <xsl:when test=". = 1">
12278
+ <xsl:when test=". = 1 or . = 0">
12059
12279
  <fo:table-column column-width="proportional-column-width(2)"/>
12060
12280
  </xsl:when>
12061
12281
  <xsl:otherwise>
@@ -12063,18 +12283,58 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12063
12283
  </xsl:otherwise>
12064
12284
  </xsl:choose>
12065
12285
  </xsl:for-each>
12066
- <xsl:apply-templates/>
12286
+
12287
+ <xsl:choose>
12288
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
12289
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
12290
+ </xsl:when>
12291
+ <xsl:otherwise>
12292
+ <xsl:apply-templates/>
12293
+ </xsl:otherwise>
12294
+ </xsl:choose>
12295
+
12067
12296
  </fo:table>
12297
+
12298
+
12299
+
12068
12300
  </fo:block-container>
12069
- </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">
12301
+ </xsl:template><xsl:template name="getTableNumber">
12302
+ <xsl:choose>
12303
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
12304
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
12305
+ </xsl:when>
12306
+ <xsl:when test="ancestor::*[local-name()='annex']">
12307
+
12308
+
12309
+
12310
+
12311
+
12312
+
12313
+ <!-- <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
12314
+ <xsl:number format="I." count="*[local-name()='annex']"/> -->
12315
+ <xsl:text>A</xsl:text> <!-- 'A' means Annex -->
12316
+ <xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex']]"/> <!-- [@id = $annex-id] -->
12317
+
12318
+
12319
+
12320
+ </xsl:when>
12321
+ <xsl:otherwise>
12322
+
12323
+
12324
+ <xsl:number format="A." count="*[local-name()='annex']"/>
12325
+ <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']"/>
12326
+
12327
+ </xsl:otherwise>
12328
+ </xsl:choose>
12329
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
12070
12330
  <xsl:apply-templates/>
12071
- </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">
12331
+ </xsl:template><xsl:template name="calculate-columns-numbers">
12072
12332
  <xsl:param name="table-row"/>
12073
12333
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
12074
12334
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
12075
12335
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
12076
12336
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
12077
- </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">
12337
+ </xsl:template><xsl:template name="calculate-column-widths">
12078
12338
  <xsl:param name="table"/>
12079
12339
  <xsl:param name="cols-count"/>
12080
12340
  <xsl:param name="curr-col" select="1"/>
@@ -12083,7 +12343,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12083
12343
  <xsl:if test="$curr-col &lt;= $cols-count">
12084
12344
  <xsl:variable name="widths">
12085
12345
  <xsl:choose>
12086
- <xsl:when test="not($table)">
12346
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
12087
12347
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
12088
12348
  <xsl:variable name="words">
12089
12349
  <xsl:call-template name="tokenize">
@@ -12118,9 +12378,20 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12118
12378
  </xsl:when>
12119
12379
  <xsl:otherwise>
12120
12380
  <xsl:for-each select="xalan:nodeset($table)//tr">
12381
+ <xsl:variable name="td_text">
12382
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
12383
+ </xsl:variable>
12121
12384
  <xsl:variable name="words">
12385
+ <xsl:variable name="string_with_added_zerospaces">
12386
+ <xsl:call-template name="add-zero-spaces-java">
12387
+ <xsl:with-param name="text" select="$td_text"/>
12388
+ </xsl:call-template>
12389
+ </xsl:variable>
12122
12390
  <xsl:call-template name="tokenize">
12123
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
12391
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
12392
+ <!-- 2009 thinspace -->
12393
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
12394
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
12124
12395
  </xsl:call-template>
12125
12396
  </xsl:variable>
12126
12397
  <xsl:variable name="max_length">
@@ -12161,59 +12432,98 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12161
12432
  <xsl:with-param name="table" select="$table"/>
12162
12433
  </xsl:call-template>
12163
12434
  </xsl:if>
12164
- </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">
12165
- <!-- <fo:table-header font-weight="bold">
12166
- <xsl:apply-templates />
12167
- </fo:table-header> -->
12168
- <xsl:apply-templates/>
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="*[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">
12435
+ </xsl:template><xsl:template match="text()" mode="td_text">
12436
+ <xsl:variable name="zero-space">​</xsl:variable>
12437
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
12438
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
12439
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
12440
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
12441
+ <xsl:value-of select="@target"/>
12442
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
12443
+ <xsl:param name="cols-count"/>
12444
+ <!-- font-weight="bold" -->
12445
+ <fo:table-header>
12446
+
12447
+ <xsl:apply-templates/>
12448
+ </fo:table-header>
12449
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
12450
+ <fo:table-body>
12451
+ <xsl:apply-templates/>
12452
+ </fo:table-body>
12453
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
12170
12454
  <xsl:apply-templates/>
12171
- </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']">
12455
+ </xsl:template><xsl:template name="insertTableFooter">
12456
+ <xsl:param name="cols-count"/>
12457
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
12458
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
12459
+
12460
+ <fo:table-footer>
12461
+
12462
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
12463
+
12464
+ <!-- if there are note(s) or fn(s) then create footer row -->
12465
+ <xsl:if test="$isNoteOrFnExist = 'true'">
12466
+
12467
+
12468
+
12469
+ <fo:table-row>
12470
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
12471
+
12472
+
12473
+
12474
+ <!-- fn will be processed inside 'note' processing -->
12475
+
12476
+
12477
+ <!-- except gb -->
12478
+
12479
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
12480
+
12481
+
12482
+ <!-- horizontal row separator -->
12483
+
12484
+
12485
+ <!-- fn processing -->
12486
+ <xsl:call-template name="fn_display"/>
12487
+
12488
+ </fo:table-cell>
12489
+ </fo:table-row>
12490
+
12491
+ </xsl:if>
12492
+ </fo:table-footer>
12493
+
12494
+ </xsl:if>
12495
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
12496
+
12172
12497
  <xsl:variable name="cols-count">
12173
12498
  <xsl:choose>
12174
- <xsl:when test="../*[local-name()='thead']">
12175
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
12499
+ <xsl:when test="../*[local-name()='thead']">
12176
12500
  <xsl:call-template name="calculate-columns-numbers">
12177
12501
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
12178
12502
  </xsl:call-template>
12179
12503
  </xsl:when>
12180
- <xsl:otherwise>
12181
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
12504
+ <xsl:otherwise>
12182
12505
  <xsl:call-template name="calculate-columns-numbers">
12183
12506
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
12184
12507
  </xsl:call-template>
12185
12508
  </xsl:otherwise>
12186
12509
  </xsl:choose>
12187
12510
  </xsl:variable>
12188
-
12511
+
12512
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
12513
+ <xsl:with-param name="cols-count" select="$cols-count"/>
12514
+ </xsl:apply-templates>
12515
+
12516
+ <xsl:call-template name="insertTableFooter">
12517
+ <xsl:with-param name="cols-count" select="$cols-count"/>
12518
+ </xsl:call-template>
12519
+
12189
12520
  <fo:table-body>
12190
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
12191
12521
  <xsl:apply-templates/>
12192
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
12193
- <!-- if there are note(s) or fn(s) then create footer row -->
12194
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
12195
- <fo:table-row>
12196
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
12197
-
12198
-
12199
-
12200
- <!-- fn will be processed inside 'note' processing -->
12201
-
12202
-
12203
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
12204
-
12205
- <!-- horizontal row separator -->
12206
-
12207
-
12208
- <!-- fn processing -->
12209
- <xsl:call-template name="fn_display"/>
12210
-
12211
- </fo:table-cell>
12212
- </fo:table-row>
12213
-
12214
- </xsl:if>
12522
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
12523
+
12215
12524
  </fo:table-body>
12216
- </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']">
12525
+
12526
+ </xsl:template><xsl:template match="*[local-name()='tr']">
12217
12527
  <xsl:variable name="parent-name" select="local-name(..)"/>
12218
12528
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
12219
12529
  <fo:table-row min-height="4mm">
@@ -12230,9 +12540,10 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12230
12540
 
12231
12541
  </xsl:if>
12232
12542
 
12543
+
12233
12544
  <xsl:apply-templates/>
12234
12545
  </fo:table-row>
12235
- </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']">
12546
+ </xsl:template><xsl:template match="*[local-name()='th']">
12236
12547
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
12237
12548
 
12238
12549
 
@@ -12271,13 +12582,15 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12271
12582
  <xsl:apply-templates/>
12272
12583
  </fo:block>
12273
12584
  </fo:table-cell>
12274
- </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']">
12585
+ </xsl:template><xsl:template match="*[local-name()='td']">
12275
12586
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
12276
12587
 
12277
12588
 
12278
12589
 
12279
12590
 
12280
12591
 
12592
+
12593
+
12281
12594
  <xsl:if test="ancestor::*[local-name()='sections']">
12282
12595
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
12283
12596
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -12296,6 +12609,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12296
12609
  </xsl:attribute>
12297
12610
  </xsl:if>
12298
12611
  <fo:block>
12612
+
12299
12613
  <xsl:apply-templates/>
12300
12614
  </fo:block>
12301
12615
  <!-- <xsl:choose>
@@ -12311,14 +12625,24 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12311
12625
 
12312
12626
 
12313
12627
  </fo:table-cell>
12314
- </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">
12628
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
12315
12629
 
12316
12630
 
12317
12631
  <fo:block font-size="10pt" margin-bottom="12pt">
12318
12632
 
12319
12633
 
12634
+
12635
+
12320
12636
  <fo:inline padding-right="2mm">
12321
- <xsl:text>NOTE </xsl:text>
12637
+
12638
+
12639
+ <xsl:variable name="title-note">
12640
+ <xsl:call-template name="getTitle">
12641
+ <xsl:with-param name="name" select="'title-note'"/>
12642
+ </xsl:call-template>
12643
+ </xsl:variable>
12644
+ <xsl:value-of select="$title-note"/>
12645
+
12322
12646
 
12323
12647
 
12324
12648
  <xsl:number format="1 "/>
@@ -12327,9 +12651,9 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12327
12651
  <xsl:apply-templates mode="process"/>
12328
12652
  </fo:block>
12329
12653
 
12330
- </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">
12654
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
12331
12655
  <xsl:apply-templates/>
12332
- </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">
12656
+ </xsl:template><xsl:template name="fn_display">
12333
12657
  <xsl:variable name="references">
12334
12658
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
12335
12659
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -12345,6 +12669,8 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12345
12669
  <fo:block margin-bottom="12pt">
12346
12670
 
12347
12671
 
12672
+
12673
+
12348
12674
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
12349
12675
 
12350
12676
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -12353,6 +12679,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12353
12679
 
12354
12680
 
12355
12681
 
12682
+
12356
12683
  <xsl:value-of select="@reference"/>
12357
12684
 
12358
12685
  </fo:inline>
@@ -12363,7 +12690,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12363
12690
  </fo:block>
12364
12691
  </xsl:if>
12365
12692
  </xsl:for-each>
12366
- </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">
12693
+ </xsl:template><xsl:template name="fn_name_display">
12367
12694
  <!-- <xsl:variable name="references">
12368
12695
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
12369
12696
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -12379,7 +12706,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12379
12706
  <xsl:apply-templates/>
12380
12707
  </fo:block>
12381
12708
  </xsl:for-each>
12382
- </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">
12709
+ </xsl:template><xsl:template name="fn_display_figure">
12383
12710
  <xsl:variable name="key_iso">
12384
12711
  <!-- and (not(@class) or @class !='pseudocode') -->
12385
12712
  </xsl:variable>
@@ -12390,6 +12717,36 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12390
12717
  </fn>
12391
12718
  </xsl:for-each>
12392
12719
  </xsl:variable>
12720
+
12721
+ <!-- current hierarchy is 'figure' element -->
12722
+ <xsl:variable name="following_dl_colwidths">
12723
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
12724
+ <xsl:variable name="html-table">
12725
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12726
+ <xsl:element name="{$ns}:table">
12727
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
12728
+ <tbody>
12729
+ <xsl:apply-templates mode="dl"/>
12730
+ </tbody>
12731
+ </xsl:for-each>
12732
+ </xsl:element>
12733
+ </xsl:variable>
12734
+
12735
+ <xsl:call-template name="calculate-column-widths">
12736
+ <xsl:with-param name="cols-count" select="2"/>
12737
+ <xsl:with-param name="table" select="$html-table"/>
12738
+ </xsl:call-template>
12739
+
12740
+ </xsl:if>
12741
+ </xsl:variable>
12742
+
12743
+
12744
+ <xsl:variable name="maxlength_dt">
12745
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
12746
+ <xsl:call-template name="getMaxLength_dt"/>
12747
+ </xsl:for-each>
12748
+ </xsl:variable>
12749
+
12393
12750
  <xsl:if test="xalan:nodeset($references)//fn">
12394
12751
  <fo:block>
12395
12752
  <fo:table width="95%" table-layout="fixed">
@@ -12397,8 +12754,19 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12397
12754
  <xsl:attribute name="font-size">10pt</xsl:attribute>
12398
12755
 
12399
12756
  </xsl:if>
12400
- <fo:table-column column-width="15%"/>
12401
- <fo:table-column column-width="85%"/>
12757
+ <xsl:choose>
12758
+ <!-- if there 'dl', then set same columns width -->
12759
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
12760
+ <xsl:call-template name="setColumnWidth_dl">
12761
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
12762
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
12763
+ </xsl:call-template>
12764
+ </xsl:when>
12765
+ <xsl:otherwise>
12766
+ <fo:table-column column-width="15%"/>
12767
+ <fo:table-column column-width="85%"/>
12768
+ </xsl:otherwise>
12769
+ </xsl:choose>
12402
12770
  <fo:table-body>
12403
12771
  <xsl:for-each select="xalan:nodeset($references)//fn">
12404
12772
  <xsl:variable name="reference" select="@reference"/>
@@ -12430,22 +12798,23 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12430
12798
  </fo:block>
12431
12799
  </xsl:if>
12432
12800
 
12433
- </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']">
12801
+ </xsl:template><xsl:template match="*[local-name()='fn']">
12434
12802
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
12435
12803
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
12436
12804
 
12437
12805
 
12438
12806
 
12807
+
12439
12808
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
12440
12809
 
12441
12810
  <xsl:value-of select="@reference"/>
12442
12811
  </fo:basic-link>
12443
12812
  </fo:inline>
12444
- </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']">
12813
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
12445
12814
  <fo:inline>
12446
12815
  <xsl:apply-templates/>
12447
12816
  </fo:inline>
12448
- </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']">
12817
+ </xsl:template><xsl:template match="*[local-name()='dl']">
12449
12818
  <xsl:variable name="parent" select="local-name(..)"/>
12450
12819
 
12451
12820
  <xsl:variable name="key_iso">
@@ -12458,7 +12827,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12458
12827
 
12459
12828
  <fo:block margin-bottom="12pt" text-align="left">
12460
12829
 
12461
- <xsl:text>where </xsl:text>
12830
+ <xsl:variable name="title-where">
12831
+ <xsl:call-template name="getTitle">
12832
+ <xsl:with-param name="name" select="'title-where'"/>
12833
+ </xsl:call-template>
12834
+ </xsl:variable>
12835
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
12462
12836
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
12463
12837
  <xsl:text/>
12464
12838
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -12470,14 +12844,26 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12470
12844
 
12471
12845
 
12472
12846
 
12473
- <xsl:text>where</xsl:text>
12847
+
12848
+ <xsl:variable name="title-where">
12849
+ <xsl:call-template name="getTitle">
12850
+ <xsl:with-param name="name" select="'title-where'"/>
12851
+ </xsl:call-template>
12852
+ </xsl:variable>
12853
+ <xsl:value-of select="$title-where"/>
12474
12854
  </fo:block>
12475
12855
  </xsl:when>
12476
12856
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
12477
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
12857
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
12478
12858
 
12479
12859
 
12480
- <xsl:text>Key</xsl:text>
12860
+
12861
+ <xsl:variable name="title-key">
12862
+ <xsl:call-template name="getTitle">
12863
+ <xsl:with-param name="name" select="'title-key'"/>
12864
+ </xsl:call-template>
12865
+ </xsl:variable>
12866
+ <xsl:value-of select="$title-key"/>
12481
12867
  </fo:block>
12482
12868
  </xsl:when>
12483
12869
  </xsl:choose>
@@ -12491,25 +12877,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12491
12877
 
12492
12878
  <fo:block>
12493
12879
 
12494
- <!-- create virtual html table for dl/[dt and dd] -->
12495
- <xsl:variable name="html-table">
12496
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12497
- <xsl:element name="{$ns}:table">
12498
- <tbody>
12499
- <xsl:apply-templates mode="dl"/>
12500
- </tbody>
12501
- </xsl:element>
12502
- </xsl:variable>
12503
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
12504
- <xsl:variable name="colwidths">
12505
- <xsl:call-template name="calculate-column-widths">
12506
- <xsl:with-param name="cols-count" select="2"/>
12507
- <xsl:with-param name="table" select="$html-table"/>
12508
- </xsl:call-template>
12509
- </xsl:variable>
12510
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
12880
+
12881
+
12511
12882
 
12512
12883
  <fo:table width="95%" table-layout="fixed">
12884
+
12513
12885
  <xsl:choose>
12514
12886
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
12515
12887
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -12519,42 +12891,30 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12519
12891
 
12520
12892
  </xsl:when>
12521
12893
  </xsl:choose>
12522
- <xsl:choose>
12523
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
12524
- <fo:table-column column-width="50%"/>
12525
- <fo:table-column column-width="50%"/>
12526
- </xsl:when>
12527
- <xsl:otherwise>
12528
- <xsl:choose>
12529
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
12530
- <fo:table-column column-width="60%"/>
12531
- <fo:table-column column-width="40%"/>
12532
- </xsl:when> -->
12533
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
12534
- <fo:table-column column-width="50%"/>
12535
- <fo:table-column column-width="50%"/>
12536
- </xsl:when>
12537
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
12538
- <fo:table-column column-width="40%"/>
12539
- <fo:table-column column-width="60%"/>
12540
- </xsl:when>
12541
- <xsl:otherwise>
12542
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
12543
- <xsl:choose>
12544
- <xsl:when test=". = 1">
12545
- <fo:table-column column-width="proportional-column-width(2)"/>
12546
- </xsl:when>
12547
- <xsl:otherwise>
12548
- <fo:table-column column-width="proportional-column-width({.})"/>
12549
- </xsl:otherwise>
12550
- </xsl:choose>
12551
- </xsl:for-each>
12552
- </xsl:otherwise>
12553
- </xsl:choose>
12554
- <!-- <fo:table-column column-width="15%"/>
12555
- <fo:table-column column-width="85%"/> -->
12556
- </xsl:otherwise>
12557
- </xsl:choose>
12894
+ <!-- create virtual html table for dl/[dt and dd] -->
12895
+ <xsl:variable name="html-table">
12896
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
12897
+ <xsl:element name="{$ns}:table">
12898
+ <tbody>
12899
+ <xsl:apply-templates mode="dl"/>
12900
+ </tbody>
12901
+ </xsl:element>
12902
+ </xsl:variable>
12903
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
12904
+ <xsl:variable name="colwidths">
12905
+ <xsl:call-template name="calculate-column-widths">
12906
+ <xsl:with-param name="cols-count" select="2"/>
12907
+ <xsl:with-param name="table" select="$html-table"/>
12908
+ </xsl:call-template>
12909
+ </xsl:variable>
12910
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
12911
+ <xsl:variable name="maxlength_dt">
12912
+ <xsl:call-template name="getMaxLength_dt"/>
12913
+ </xsl:variable>
12914
+ <xsl:call-template name="setColumnWidth_dl">
12915
+ <xsl:with-param name="colwidths" select="$colwidths"/>
12916
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
12917
+ </xsl:call-template>
12558
12918
  <fo:table-body>
12559
12919
  <xsl:apply-templates>
12560
12920
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -12564,7 +12924,61 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12564
12924
  </fo:block>
12565
12925
  </fo:block>
12566
12926
  </xsl:if>
12567
- </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']">
12927
+ </xsl:template><xsl:template name="setColumnWidth_dl">
12928
+ <xsl:param name="colwidths"/>
12929
+ <xsl:param name="maxlength_dt"/>
12930
+ <xsl:choose>
12931
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
12932
+ <fo:table-column column-width="50%"/>
12933
+ <fo:table-column column-width="50%"/>
12934
+ </xsl:when>
12935
+ <xsl:otherwise>
12936
+ <xsl:choose>
12937
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
12938
+ <fo:table-column column-width="5%"/>
12939
+ <fo:table-column column-width="95%"/>
12940
+ </xsl:when>
12941
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
12942
+ <fo:table-column column-width="10%"/>
12943
+ <fo:table-column column-width="90%"/>
12944
+ </xsl:when>
12945
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
12946
+ <fo:table-column column-width="60%"/>
12947
+ <fo:table-column column-width="40%"/>
12948
+ </xsl:when> -->
12949
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
12950
+ <fo:table-column column-width="50%"/>
12951
+ <fo:table-column column-width="50%"/>
12952
+ </xsl:when>
12953
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
12954
+ <fo:table-column column-width="40%"/>
12955
+ <fo:table-column column-width="60%"/>
12956
+ </xsl:when>
12957
+ <xsl:otherwise>
12958
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
12959
+ <xsl:choose>
12960
+ <xsl:when test=". = 1 or . = 0">
12961
+ <fo:table-column column-width="proportional-column-width(2)"/>
12962
+ </xsl:when>
12963
+ <xsl:otherwise>
12964
+ <fo:table-column column-width="proportional-column-width({.})"/>
12965
+ </xsl:otherwise>
12966
+ </xsl:choose>
12967
+ </xsl:for-each>
12968
+ </xsl:otherwise>
12969
+ </xsl:choose>
12970
+ <!-- <fo:table-column column-width="15%"/>
12971
+ <fo:table-column column-width="85%"/> -->
12972
+ </xsl:otherwise>
12973
+ </xsl:choose>
12974
+ </xsl:template><xsl:template name="getMaxLength_dt">
12975
+ <xsl:for-each select="*[local-name()='dt']">
12976
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
12977
+ <xsl:if test="position() = 1">
12978
+ <xsl:value-of select="string-length(normalize-space(.))"/>
12979
+ </xsl:if>
12980
+ </xsl:for-each>
12981
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
12568
12982
  <xsl:param name="key_iso"/>
12569
12983
 
12570
12984
  <!-- <tr>
@@ -12580,7 +12994,12 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12580
12994
  <xsl:if test="normalize-space($key_iso) = 'true'">
12581
12995
  <xsl:attribute name="margin-top">0</xsl:attribute>
12582
12996
  </xsl:if>
12583
- NOTE
12997
+ <xsl:variable name="title-note">
12998
+ <xsl:call-template name="getTitle">
12999
+ <xsl:with-param name="name" select="'title-note'"/>
13000
+ </xsl:call-template>
13001
+ </xsl:variable>
13002
+ <xsl:value-of select="$title-note"/>
12584
13003
  </fo:block>
12585
13004
  </fo:table-cell>
12586
13005
  <fo:table-cell>
@@ -12589,7 +13008,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12589
13008
  </fo:block>
12590
13009
  </fo:table-cell>
12591
13010
  </fo:table-row>
12592
- </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">
13011
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
12593
13012
  <tr>
12594
13013
  <td>
12595
13014
  <xsl:apply-templates/>
@@ -12602,20 +13021,30 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12602
13021
  </td>
12603
13022
  </tr>
12604
13023
 
12605
- </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']">
13024
+ </xsl:template><xsl:template match="*[local-name()='dt']">
12606
13025
  <xsl:param name="key_iso"/>
12607
13026
 
12608
13027
  <fo:table-row>
12609
13028
  <fo:table-cell>
13029
+
12610
13030
  <fo:block margin-top="6pt">
12611
13031
 
13032
+
12612
13033
  <xsl:if test="normalize-space($key_iso) = 'true'">
12613
13034
  <xsl:attribute name="margin-top">0</xsl:attribute>
12614
13035
 
12615
13036
  </xsl:if>
12616
13037
 
12617
13038
 
13039
+
13040
+
13041
+
12618
13042
  <xsl:apply-templates/>
13043
+ <!-- <xsl:if test="$namespace = 'gb'">
13044
+ <xsl:if test="ancestor::*[local-name()='formula']">
13045
+ <xsl:text>—</xsl:text>
13046
+ </xsl:if>
13047
+ </xsl:if> -->
12619
13048
  </fo:block>
12620
13049
  </fo:table-cell>
12621
13050
  <fo:table-cell>
@@ -12629,37 +13058,37 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12629
13058
  </fo:table-cell>
12630
13059
  </fo:table-row>
12631
13060
 
12632
- </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">
13061
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
12633
13062
  <xsl:apply-templates/>
12634
- </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">
13063
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
12635
13064
  <xsl:apply-templates/>
12636
- </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">
12637
- <fo:inline><xsl:apply-templates/></fo:inline>
12638
- </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']">
13065
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
13066
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
13067
+ </xsl:template><xsl:template match="*[local-name()='em']">
12639
13068
  <fo:inline font-style="italic">
12640
13069
  <xsl:apply-templates/>
12641
13070
  </fo:inline>
12642
- </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']">
13071
+ </xsl:template><xsl:template match="*[local-name()='strong']">
12643
13072
  <fo:inline font-weight="bold">
12644
13073
  <xsl:apply-templates/>
12645
13074
  </fo:inline>
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()='sup']">
13075
+ </xsl:template><xsl:template match="*[local-name()='sup']">
12647
13076
  <fo:inline font-size="80%" vertical-align="super">
12648
13077
  <xsl:apply-templates/>
12649
13078
  </fo:inline>
12650
- </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']">
13079
+ </xsl:template><xsl:template match="*[local-name()='sub']">
12651
13080
  <fo:inline font-size="80%" vertical-align="sub">
12652
13081
  <xsl:apply-templates/>
12653
13082
  </fo:inline>
12654
- </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']">
12655
- <fo:inline font-family="Courier" font-size="10pt">
13083
+ </xsl:template><xsl:template match="*[local-name()='tt']">
13084
+ <fo:inline font-family="Courier" font-size="10pt">
12656
13085
  <xsl:apply-templates/>
12657
13086
  </fo:inline>
12658
- </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']">
13087
+ </xsl:template><xsl:template match="*[local-name()='del']">
12659
13088
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
12660
13089
  <xsl:apply-templates/>
12661
13090
  </fo:inline>
12662
- </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']]">
13091
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
12663
13092
  <xsl:variable name="text" select="normalize-space(.)"/>
12664
13093
  <fo:inline font-size="75%">
12665
13094
  <xsl:if test="string-length($text) &gt; 0">
@@ -12668,10 +13097,11 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12668
13097
  </xsl:call-template>
12669
13098
  </xsl:if>
12670
13099
  </fo:inline>
12671
- </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">
13100
+ </xsl:template><xsl:template name="recursiveSmallCaps">
12672
13101
  <xsl:param name="text"/>
12673
13102
  <xsl:variable name="char" select="substring($text,1,1)"/>
12674
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
13103
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
13104
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
12675
13105
  <xsl:choose>
12676
13106
  <xsl:when test="$char=$upperCase">
12677
13107
  <fo:inline font-size="{100 div 0.75}%">
@@ -12687,7 +13117,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12687
13117
  <xsl:with-param name="text" select="substring($text,2)"/>
12688
13118
  </xsl:call-template>
12689
13119
  </xsl:if>
12690
- </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">
13120
+ </xsl:template><xsl:template name="tokenize">
12691
13121
  <xsl:param name="text"/>
12692
13122
  <xsl:param name="separator" select="' '"/>
12693
13123
  <xsl:choose>
@@ -12735,7 +13165,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12735
13165
  </xsl:call-template>
12736
13166
  </xsl:otherwise>
12737
13167
  </xsl:choose>
12738
- </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">
13168
+ </xsl:template><xsl:template name="max_length">
12739
13169
  <xsl:param name="words"/>
12740
13170
  <xsl:for-each select="$words//word">
12741
13171
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -12743,12 +13173,17 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12743
13173
  <xsl:value-of select="."/>
12744
13174
  </xsl:if>
12745
13175
  </xsl:for-each>
12746
- </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">
13176
+ </xsl:template><xsl:template name="add-zero-spaces-java">
13177
+ <xsl:param name="text" select="."/>
13178
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
13179
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
13180
+ </xsl:template><xsl:template name="add-zero-spaces">
12747
13181
  <xsl:param name="text" select="."/>
12748
13182
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
12749
13183
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
12750
13184
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
12751
13185
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
13186
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
12752
13187
  <xsl:variable name="zero-space">​</xsl:variable>
12753
13188
  <xsl:choose>
12754
13189
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -12783,11 +13218,19 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12783
13218
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
12784
13219
  </xsl:call-template>
12785
13220
  </xsl:when>
13221
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
13222
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
13223
+ <xsl:value-of select="$zero-space-after-underscore"/>
13224
+ <xsl:value-of select="$zero-space"/>
13225
+ <xsl:call-template name="add-zero-spaces">
13226
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
13227
+ </xsl:call-template>
13228
+ </xsl:when>
12786
13229
  <xsl:otherwise>
12787
13230
  <xsl:value-of select="$text"/>
12788
13231
  </xsl:otherwise>
12789
13232
  </xsl:choose>
12790
- </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">
13233
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
12791
13234
  <xsl:param name="text" select="."/>
12792
13235
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
12793
13236
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -12813,7 +13256,7 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12813
13256
  <xsl:value-of select="$text"/>
12814
13257
  </xsl:otherwise>
12815
13258
  </xsl:choose>
12816
- </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">
13259
+ </xsl:template><xsl:template name="getSimpleTable">
12817
13260
  <xsl:variable name="simple-table">
12818
13261
 
12819
13262
  <!-- Step 1. colspan processing -->
@@ -12840,9 +13283,9 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12840
13283
  </xsl:choose> -->
12841
13284
  </xsl:variable>
12842
13285
  <xsl:copy-of select="$simple-table"/>
12843
- </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">
13286
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
12844
13287
  <xsl:apply-templates mode="simple-table-colspan"/>
12845
- </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">
13288
+ </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">
12846
13289
  <xsl:choose>
12847
13290
  <xsl:when test="@colspan">
12848
13291
  <xsl:variable name="td">
@@ -12864,16 +13307,16 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12864
13307
  </xsl:element>
12865
13308
  </xsl:otherwise>
12866
13309
  </xsl:choose>
12867
- </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">
13310
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
12868
13311
  <xsl:element name="tr">
12869
13312
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
12870
13313
  <xsl:apply-templates mode="simple-table-colspan"/>
12871
13314
  </xsl:element>
12872
- </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">
13315
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
12873
13316
  <xsl:copy>
12874
13317
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
12875
13318
  </xsl:copy>
12876
- </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">
13319
+ </xsl:template><xsl:template name="repeatNode">
12877
13320
  <xsl:param name="count"/>
12878
13321
  <xsl:param name="node"/>
12879
13322
 
@@ -12884,18 +13327,18 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12884
13327
  </xsl:call-template>
12885
13328
  <xsl:copy-of select="$node"/>
12886
13329
  </xsl:if>
12887
- </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">
13330
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
12888
13331
  <xsl:copy>
12889
13332
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
12890
13333
  </xsl:copy>
12891
- </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">
13334
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
12892
13335
  <xsl:copy>
12893
13336
  <xsl:copy-of select="tr[1]"/>
12894
13337
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
12895
13338
  <xsl:with-param name="previousRow" select="tr[1]"/>
12896
13339
  </xsl:apply-templates>
12897
13340
  </xsl:copy>
12898
- </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">
13341
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
12899
13342
  <xsl:param name="previousRow"/>
12900
13343
  <xsl:variable name="currentRow" select="."/>
12901
13344
 
@@ -12929,34 +13372,320 @@ w+FwgnQ4HA4nSIfD4XCCdDgcDidIh8Ph6HT8T4ABAB91/nepRFURAAAAAElFTkSuQmCC
12929
13372
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
12930
13373
  <xsl:with-param name="previousRow" select="$newRow"/>
12931
13374
  </xsl:apply-templates>
12932
- </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">
13375
+ </xsl:template><xsl:template name="getLang">
12933
13376
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
12934
13377
  <xsl:choose>
12935
13378
  <xsl:when test="$language = 'English'">en</xsl:when>
12936
13379
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
12937
13380
  </xsl:choose>
12938
- </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">
13381
+ </xsl:template><xsl:template name="capitalizeWords">
12939
13382
  <xsl:param name="str"/>
12940
13383
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
12941
13384
  <xsl:choose>
12942
13385
  <xsl:when test="contains($str2, ' ')">
12943
13386
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
12944
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
12945
- <xsl:value-of select="substring($substr, 2)"/>
13387
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
13388
+ <xsl:value-of select="substring($substr, 2)"/> -->
13389
+ <xsl:call-template name="capitalize">
13390
+ <xsl:with-param name="str" select="$substr"/>
13391
+ </xsl:call-template>
12946
13392
  <xsl:text> </xsl:text>
12947
13393
  <xsl:call-template name="capitalizeWords">
12948
13394
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
12949
13395
  </xsl:call-template>
12950
13396
  </xsl:when>
12951
13397
  <xsl:otherwise>
12952
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
12953
- <xsl:value-of select="substring($str2, 2)"/>
13398
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
13399
+ <xsl:value-of select="substring($str2, 2)"/> -->
13400
+ <xsl:call-template name="capitalize">
13401
+ <xsl:with-param name="str" select="$str2"/>
13402
+ </xsl:call-template>
12954
13403
  </xsl:otherwise>
12955
13404
  </xsl:choose>
12956
- </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">
13405
+ </xsl:template><xsl:template name="capitalize">
13406
+ <xsl:param name="str"/>
13407
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
13408
+ <xsl:value-of select="substring($str, 2)"/>
13409
+ </xsl:template><xsl:template match="mathml:math">
12957
13410
  <fo:inline font-family="STIX2Math">
12958
13411
  <fo:instream-foreign-object fox:alt-text="Math">
12959
13412
  <xsl:copy-of select="."/>
12960
13413
  </fo:instream-foreign-object>
12961
13414
  </fo:inline>
13415
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
13416
+ <xsl:for-each select="*[local-name()='locality']">
13417
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
13418
+ <xsl:apply-templates select="."/>
13419
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
13420
+ </xsl:for-each>
13421
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
13422
+ <xsl:variable name="target">
13423
+ <xsl:choose>
13424
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
13425
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
13426
+ </xsl:when>
13427
+ <xsl:otherwise>
13428
+ <xsl:value-of select="normalize-space(@target)"/>
13429
+ </xsl:otherwise>
13430
+ </xsl:choose>
13431
+ </xsl:variable>
13432
+ <fo:inline xsl:use-attribute-sets="link-style">
13433
+ <xsl:choose>
13434
+ <xsl:when test="$target = ''">
13435
+ <xsl:apply-templates/>
13436
+ </xsl:when>
13437
+ <xsl:otherwise>
13438
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
13439
+ <xsl:choose>
13440
+ <xsl:when test="normalize-space(.) = ''">
13441
+ <xsl:value-of select="$target"/>
13442
+ </xsl:when>
13443
+ <xsl:otherwise>
13444
+ <xsl:apply-templates/>
13445
+ </xsl:otherwise>
13446
+ </xsl:choose>
13447
+ </fo:basic-link>
13448
+ </xsl:otherwise>
13449
+ </xsl:choose>
13450
+ </fo:inline>
13451
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
13452
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
13453
+ <!-- <xsl:choose>
13454
+ <xsl:when test="@lang = 'en'"></xsl:when>
13455
+ <xsl:otherwise> -->
13456
+ <xsl:attribute name="white-space">pre</xsl:attribute>
13457
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
13458
+ <!-- </xsl:otherwise>
13459
+ </xsl:choose> -->
13460
+ <xsl:apply-templates/>
13461
+ </fo:block>
13462
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
13463
+ <fo:inline id="{@id}"/>
13464
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
13465
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
13466
+ <xsl:variable name="title-appendix">
13467
+ <xsl:call-template name="getTitle">
13468
+ <xsl:with-param name="name" select="'title-appendix'"/>
13469
+ </xsl:call-template>
13470
+ </xsl:variable>
13471
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
13472
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
13473
+ </fo:block>
13474
+ <xsl:apply-templates/>
13475
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
13476
+ <fo:inline><xsl:apply-templates/></fo:inline>
13477
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
13478
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
13479
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
13480
+ <xsl:variable name="title-example">
13481
+ <xsl:call-template name="getTitle">
13482
+ <xsl:with-param name="name" select="'title-example'"/>
13483
+ </xsl:call-template>
13484
+ </xsl:variable>
13485
+ <xsl:value-of select="$title-example"/>
13486
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
13487
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
13488
+ </xsl:if>
13489
+ <xsl:if test="*[local-name()='name']">
13490
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
13491
+ </xsl:if>
13492
+ </fo:block>
13493
+ <xsl:apply-templates/>
13494
+ </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">
13495
+ <fo:inline><xsl:apply-templates/></fo:inline>
13496
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
13497
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
13498
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
13499
+ <xsl:variable name="annotation-id" select="@id"/>
13500
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
13501
+ <fo:block id="{$annotation-id}" white-space="nowrap">
13502
+ <fo:inline>
13503
+ <xsl:apply-templates>
13504
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
13505
+ </xsl:apply-templates>
13506
+ </fo:inline>
13507
+ </fo:block>
13508
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
13509
+ <xsl:param name="callout"/>
13510
+ <fo:inline id="{@id}">
13511
+ <!-- for first p in annotation, put <x> -->
13512
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
13513
+ <xsl:apply-templates/>
13514
+ </fo:inline>
13515
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
13516
+ <xsl:variable name="title-modified">
13517
+ <xsl:call-template name="getTitle">
13518
+ <xsl:with-param name="name" select="'title-modified'"/>
13519
+ </xsl:call-template>
13520
+ </xsl:variable>
13521
+ <xsl:choose>
13522
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
13523
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
13524
+ </xsl:choose>
13525
+ <xsl:apply-templates/>
13526
+ </xsl:template><xsl:template name="convertDate">
13527
+ <xsl:param name="date"/>
13528
+ <xsl:param name="format" select="'short'"/>
13529
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
13530
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
13531
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
13532
+ <xsl:variable name="monthStr">
13533
+ <xsl:choose>
13534
+ <xsl:when test="$month = '01'">January</xsl:when>
13535
+ <xsl:when test="$month = '02'">February</xsl:when>
13536
+ <xsl:when test="$month = '03'">March</xsl:when>
13537
+ <xsl:when test="$month = '04'">April</xsl:when>
13538
+ <xsl:when test="$month = '05'">May</xsl:when>
13539
+ <xsl:when test="$month = '06'">June</xsl:when>
13540
+ <xsl:when test="$month = '07'">July</xsl:when>
13541
+ <xsl:when test="$month = '08'">August</xsl:when>
13542
+ <xsl:when test="$month = '09'">September</xsl:when>
13543
+ <xsl:when test="$month = '10'">October</xsl:when>
13544
+ <xsl:when test="$month = '11'">November</xsl:when>
13545
+ <xsl:when test="$month = '12'">December</xsl:when>
13546
+ </xsl:choose>
13547
+ </xsl:variable>
13548
+ <xsl:variable name="result">
13549
+ <xsl:choose>
13550
+ <xsl:when test="$format = 'short' or $day = ''">
13551
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
13552
+ </xsl:when>
13553
+ <xsl:otherwise>
13554
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
13555
+ </xsl:otherwise>
13556
+ </xsl:choose>
13557
+ </xsl:variable>
13558
+ <xsl:value-of select="$result"/>
13559
+ </xsl:template><xsl:template name="insertKeywords">
13560
+ <xsl:param name="sorting" select="'true'"/>
13561
+ <xsl:param name="charAtEnd" select="'.'"/>
13562
+ <xsl:param name="charDelim" select="', '"/>
13563
+ <xsl:choose>
13564
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
13565
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
13566
+ <xsl:sort data-type="text" order="ascending"/>
13567
+ <xsl:call-template name="insertKeyword">
13568
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
13569
+ <xsl:with-param name="charDelim" select="$charDelim"/>
13570
+ </xsl:call-template>
13571
+ </xsl:for-each>
13572
+ </xsl:when>
13573
+ <xsl:otherwise>
13574
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
13575
+ <xsl:call-template name="insertKeyword">
13576
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
13577
+ <xsl:with-param name="charDelim" select="$charDelim"/>
13578
+ </xsl:call-template>
13579
+ </xsl:for-each>
13580
+ </xsl:otherwise>
13581
+ </xsl:choose>
13582
+ </xsl:template><xsl:template name="insertKeyword">
13583
+ <xsl:param name="charAtEnd"/>
13584
+ <xsl:param name="charDelim"/>
13585
+ <xsl:apply-templates/>
13586
+ <xsl:choose>
13587
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
13588
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
13589
+ </xsl:choose>
13590
+ </xsl:template><xsl:template name="addPDFUAmeta">
13591
+ <fo:declarations>
13592
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
13593
+ <pdf:dictionary type="normal" key="ViewerPreferences">
13594
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
13595
+ </pdf:dictionary>
13596
+ </pdf:catalog>
13597
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
13598
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13599
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
13600
+ <!-- Dublin Core properties go here -->
13601
+ <dc:title>
13602
+ <xsl:variable name="title">
13603
+
13604
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
13605
+
13606
+
13607
+
13608
+
13609
+ </xsl:variable>
13610
+ <xsl:choose>
13611
+ <xsl:when test="normalize-space($title) != ''">
13612
+ <xsl:value-of select="$title"/>
13613
+ </xsl:when>
13614
+ <xsl:otherwise>
13615
+ <xsl:text> </xsl:text>
13616
+ </xsl:otherwise>
13617
+ </xsl:choose>
13618
+ </dc:title>
13619
+ <dc:creator>
13620
+
13621
+
13622
+ </dc:creator>
13623
+ <dc:description>
13624
+ <xsl:variable name="abstract">
13625
+
13626
+
13627
+
13628
+ <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
13629
+
13630
+
13631
+ </xsl:variable>
13632
+ <xsl:value-of select="normalize-space($abstract)"/>
13633
+ </dc:description>
13634
+ <pdf:Keywords>
13635
+ <xsl:call-template name="insertKeywords"/>
13636
+ </pdf:Keywords>
13637
+ </rdf:Description>
13638
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
13639
+ <!-- XMP properties go here -->
13640
+ <xmp:CreatorTool/>
13641
+ </rdf:Description>
13642
+ </rdf:RDF>
13643
+ </x:xmpmeta>
13644
+ </fo:declarations>
13645
+ </xsl:template><xsl:template name="getId">
13646
+ <xsl:choose>
13647
+ <xsl:when test="../@id">
13648
+ <xsl:value-of select="../@id"/>
13649
+ </xsl:when>
13650
+ <xsl:otherwise>
13651
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
13652
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
13653
+ </xsl:otherwise>
13654
+ </xsl:choose>
13655
+ </xsl:template><xsl:template name="getLevel">
13656
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
13657
+ <xsl:variable name="level">
13658
+ <xsl:choose>
13659
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
13660
+ <xsl:value-of select="$level_total - 2"/>
13661
+ </xsl:when>
13662
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
13663
+ <xsl:value-of select="$level_total - 2"/>
13664
+ </xsl:when>
13665
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13666
+ <xsl:value-of select="$level_total - 2"/>
13667
+ </xsl:when>
13668
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
13669
+ <xsl:otherwise>
13670
+ <xsl:value-of select="$level_total - 1"/>
13671
+ </xsl:otherwise>
13672
+ </xsl:choose>
13673
+ </xsl:variable>
13674
+ <xsl:value-of select="$level"/>
13675
+ </xsl:template><xsl:template name="getSubSection">
13676
+ <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']"/>
13677
+ </xsl:template><xsl:template name="split">
13678
+ <xsl:param name="pText" select="."/>
13679
+ <xsl:param name="sep" select="','"/>
13680
+ <xsl:if test="string-length($pText) &gt;0">
13681
+ <item>
13682
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
13683
+ </item>
13684
+ <xsl:call-template name="split">
13685
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
13686
+ <xsl:with-param name="sep" select="$sep"/>
13687
+ </xsl:call-template>
13688
+ </xsl:if>
13689
+ </xsl:template><xsl:template name="getDocumentId">
13690
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
12962
13691
  </xsl:template></xsl:stylesheet>