metanorma-itu 1.0.14 → 1.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,14 @@
4
4
 
5
5
 
6
6
 
7
+ <xsl:key name="kfn" match="itu:p/itu:fn" use="@reference"/>
7
8
 
8
9
 
10
+
11
+ <xsl:variable name="debug">false</xsl:variable>
9
12
  <xsl:variable name="pageWidth" select="'210mm'"/>
10
13
  <xsl:variable name="pageHeight" select="'297mm'"/>
11
-
14
+
12
15
  <!-- Rec. ITU-T G.650.1 (03/2018) -->
13
16
  <xsl:variable name="footerprefix" select="'Rec. '"/>
14
17
  <xsl:variable name="docname">
@@ -366,10 +369,12 @@
366
369
  <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:copyright-statement"/>
367
370
  </fo:block>
368
371
 
369
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
370
- DEBUG
371
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
372
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
372
+ <xsl:if test="$debug = 'true'">
373
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
374
+ DEBUG
375
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
376
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
377
+ </xsl:if>
373
378
 
374
379
  <xsl:if test="xalan:nodeset($contents)//item">
375
380
  <fo:block break-after="page"/>
@@ -879,6 +884,7 @@
879
884
  <xsl:value-of select="string-length($numtmp) - string-length(translate($numtmp, '.', '')) + 1"/>
880
885
  </xsl:variable>
881
886
  <xsl:choose>
887
+ <xsl:when test="local-name(..) = 'ul' and itu:ul and local-name(../../..) != 'ul'">•</xsl:when> <!-- dash &#x2014; -->
882
888
  <xsl:when test="local-name(..) = 'ul'">–</xsl:when> <!-- dash &#x2014; -->
883
889
  <xsl:otherwise>
884
890
  <!-- for Ordered Lists -->
@@ -896,7 +902,9 @@
896
902
  <xsl:number format="i)"/>
897
903
  </xsl:when>
898
904
  <xsl:otherwise>
899
- <xsl:number format="1.)"/>
905
+ <!-- <xsl:number format="1.)"/> -->
906
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/156 -->
907
+ <xsl:number format="1)"/>
900
908
  </xsl:otherwise>
901
909
  </xsl:choose>
902
910
  </xsl:otherwise>
@@ -964,6 +972,9 @@
964
972
  <xsl:template match="itu:note/itu:p" name="note">
965
973
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
966
974
  <fo:block font-size="11pt" space-before="4pt" text-align="justify">
975
+ <xsl:if test="ancestor::itu:figure">
976
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
977
+ </xsl:if>
967
978
  <xsl:text>NOTE </xsl:text>
968
979
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
969
980
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
@@ -1259,28 +1270,52 @@
1259
1270
  </xsl:choose>
1260
1271
  </xsl:template>
1261
1272
 
1273
+ <xsl:variable name="p_fn">
1274
+ <xsl:for-each select="//itu:p/itu:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1275
+ <!-- copy unique fn -->
1276
+ <fn gen_id="{generate-id(.)}">
1277
+ <xsl:copy-of select="@*"/>
1278
+ <xsl:copy-of select="node()"/>
1279
+ </fn>
1280
+ </xsl:for-each>
1281
+ </xsl:variable>
1282
+
1262
1283
  <xsl:template match="itu:p/itu:fn" priority="2">
1263
- <fo:footnote>
1264
- <xsl:variable name="number">
1265
- <xsl:number level="any" count="itu:p/itu:fn"/>
1266
- </xsl:variable>
1267
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1268
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1269
- <!-- <xsl:value-of select="@reference"/> -->
1270
- <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/>
1271
- </fo:basic-link>
1272
- </fo:inline>
1273
- <fo:footnote-body>
1274
- <fo:block font-size="11pt" margin-bottom="12pt">
1275
- <fo:inline id="footnote_{@reference}_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%"> <!-- alignment-baseline="hanging" -->
1276
- <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/>
1284
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
1285
+ <xsl:variable name="reference" select="@reference"/>
1286
+ <xsl:variable name="number">
1287
+ <!-- <xsl:number level="any" count="itu:p/itu:fn"/> -->
1288
+ <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1289
+ </xsl:variable>
1290
+ <xsl:choose>
1291
+ <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1292
+ <fo:footnote>
1293
+ <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1294
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1295
+ <!-- <xsl:value-of select="@reference"/> -->
1296
+ <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/>
1297
+ </fo:basic-link>
1277
1298
  </fo:inline>
1278
- <xsl:for-each select="itu:p">
1279
- <xsl:apply-templates/>
1280
- </xsl:for-each>
1281
- </fo:block>
1282
- </fo:footnote-body>
1283
- </fo:footnote>
1299
+ <fo:footnote-body>
1300
+ <fo:block font-size="11pt" margin-bottom="12pt">
1301
+ <fo:inline id="footnote_{@reference}_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%">
1302
+ <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/>
1303
+ </fo:inline>
1304
+ <xsl:for-each select="itu:p">
1305
+ <xsl:apply-templates/>
1306
+ </xsl:for-each>
1307
+ </fo:block>
1308
+ </fo:footnote-body>
1309
+ </fo:footnote>
1310
+ </xsl:when>
1311
+ <xsl:otherwise>
1312
+ <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1313
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1314
+ <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/>
1315
+ </fo:basic-link>
1316
+ </fo:inline>
1317
+ </xsl:otherwise>
1318
+ </xsl:choose>
1284
1319
  </xsl:template>
1285
1320
 
1286
1321
 
@@ -1325,12 +1360,16 @@
1325
1360
  </xsl:if>
1326
1361
  <xsl:if test="itu:name">
1327
1362
  <xsl:text> — </xsl:text>
1328
- <xsl:value-of select="itu:name"/>
1363
+ <xsl:apply-templates select="itu:name" mode="process"/>
1329
1364
  </xsl:if>
1330
1365
  </fo:block>
1331
1366
  </fo:block-container>
1332
1367
  </xsl:template>
1333
1368
 
1369
+ <xsl:template match="itu:figure/itu:name" mode="process">
1370
+ <xsl:apply-templates/>
1371
+ </xsl:template>
1372
+
1334
1373
  <xsl:template match="itu:figure/itu:name"/>
1335
1374
  <xsl:template match="itu:figure/itu:fn" priority="2"/>
1336
1375
  <xsl:template match="itu:figure/itu:note"/>
@@ -1429,6 +1468,9 @@
1429
1468
  </xsl:if>
1430
1469
  <xsl:if test="local-name(..) = 'ul'">
1431
1470
  <xsl:attribute name="margin-left">15mm</xsl:attribute>
1471
+ <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1472
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1473
+ </xsl:if>
1432
1474
  </xsl:if>
1433
1475
  <fo:block-container margin-left="0mm">
1434
1476
  <xsl:apply-templates/>
@@ -1448,7 +1490,7 @@
1448
1490
  </fo:block>
1449
1491
  </xsl:template>
1450
1492
 
1451
- <xsl:template match="itu:link">
1493
+ <xsl:template match="itu:link" priority="2">
1452
1494
  <fo:inline color="blue">
1453
1495
  <xsl:if test="local-name(..) = 'formattedref' or ancestor::itu:preface">
1454
1496
  <xsl:attribute name="font-family">Arial</xsl:attribute>
@@ -1457,16 +1499,7 @@
1457
1499
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1458
1500
  </xsl:if>
1459
1501
  </xsl:if>
1460
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
1461
- <xsl:choose>
1462
- <xsl:when test="normalize-space(.) = ''">
1463
- <xsl:value-of select="@target"/>
1464
- </xsl:when>
1465
- <xsl:otherwise>
1466
- <xsl:apply-templates/>
1467
- </xsl:otherwise>
1468
- </xsl:choose>
1469
- </fo:basic-link>
1502
+ <xsl:call-template name="link"/>
1470
1503
  </fo:inline>
1471
1504
  </xsl:template>
1472
1505
 
@@ -1697,18 +1730,21 @@
1697
1730
  <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text>
1698
1731
  </xsl:otherwise>
1699
1732
  </xsl:choose>
1700
- <xsl:if test="itu:locality">
1701
- <xsl:text>, </xsl:text>
1702
- <xsl:choose>
1703
- <xsl:when test="itu:locality/@type = 'section'">Section </xsl:when>
1704
- <xsl:otherwise/>
1705
- </xsl:choose>
1706
- <xsl:apply-templates select="itu:locality"/>
1707
- </xsl:if>
1733
+
1734
+ <xsl:apply-templates select="itu:localityStack"/>
1735
+
1708
1736
  </fo:basic-link>
1709
1737
  </fo:inline>
1710
1738
  </xsl:template>
1711
1739
 
1740
+ <xsl:template match="itu:locality">
1741
+ <xsl:choose>
1742
+ <xsl:when test="@type ='section'">Section</xsl:when>
1743
+ <xsl:otherwise/>
1744
+ </xsl:choose>
1745
+ <xsl:value-of select="itu:referenceFrom"/>
1746
+ </xsl:template>
1747
+
1712
1748
  <xsl:template match="itu:references[position() &gt; 1]">
1713
1749
  <fo:block break-after="page"/>
1714
1750
  <xsl:apply-templates/>
@@ -2365,11 +2401,14 @@
2365
2401
  </xsl:choose>
2366
2402
  </xsl:template>
2367
2403
 
2368
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2404
+ <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
2405
+
2406
+
2407
+ </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2369
2408
  <xsl:value-of select="."/>
2370
2409
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2371
2410
  <xsl:value-of select="$linebreak"/>
2372
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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">
2411
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2373
2412
  <xsl:call-template name="add-zero-spaces"/>
2374
2413
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2375
2414
 
@@ -2387,7 +2426,9 @@
2387
2426
 
2388
2427
  <fo:block space-before="18pt"> </fo:block>
2389
2428
 
2390
-
2429
+ <!-- <xsl:if test="$namespace = 'iso'">
2430
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2431
+ </xsl:if> -->
2391
2432
 
2392
2433
  <xsl:choose>
2393
2434
  <xsl:when test="@unnumbered = 'true'"/>
@@ -2401,6 +2442,8 @@
2401
2442
 
2402
2443
 
2403
2444
 
2445
+
2446
+
2404
2447
  <xsl:text>Table </xsl:text>
2405
2448
  <xsl:choose>
2406
2449
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
@@ -2409,6 +2452,8 @@
2409
2452
  <xsl:when test="ancestor::*[local-name()='annex']">
2410
2453
 
2411
2454
 
2455
+
2456
+
2412
2457
  <xsl:choose>
2413
2458
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2414
2459
  <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
@@ -2481,11 +2526,11 @@
2481
2526
  </xsl:call-template>
2482
2527
  </xsl:variable>
2483
2528
 
2484
- <xsl:variable name="colwidths2">
2529
+ <!-- <xsl:variable name="colwidths2">
2485
2530
  <xsl:call-template name="calculate-column-widths">
2486
2531
  <xsl:with-param name="cols-count" select="$cols-count"/>
2487
2532
  </xsl:call-template>
2488
- </xsl:variable>
2533
+ </xsl:variable> -->
2489
2534
 
2490
2535
  <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2491
2536
  colwidthsNew=<xsl:copy-of select="$colwidths"/>
@@ -2511,7 +2556,8 @@
2511
2556
  <xsl:attribute name="space-after">18pt</xsl:attribute>
2512
2557
 
2513
2558
 
2514
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
2559
+
2560
+ <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">
2515
2561
 
2516
2562
 
2517
2563
 
@@ -2523,6 +2569,7 @@
2523
2569
 
2524
2570
 
2525
2571
 
2572
+
2526
2573
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2527
2574
 
2528
2575
 
@@ -2538,6 +2585,9 @@
2538
2585
  </xsl:for-each>
2539
2586
  <xsl:apply-templates/>
2540
2587
  </fo:table>
2588
+
2589
+
2590
+
2541
2591
  </fo:block-container>
2542
2592
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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">
2543
2593
  <xsl:apply-templates/>
@@ -2591,9 +2641,13 @@
2591
2641
  </xsl:when>
2592
2642
  <xsl:otherwise>
2593
2643
  <xsl:for-each select="xalan:nodeset($table)//tr">
2644
+ <xsl:variable name="td_text">
2645
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2646
+ </xsl:variable>
2594
2647
  <xsl:variable name="words">
2595
2648
  <xsl:call-template name="tokenize">
2596
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
2649
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2650
+ <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2597
2651
  </xsl:call-template>
2598
2652
  </xsl:variable>
2599
2653
  <xsl:variable name="max_length">
@@ -2634,62 +2688,86 @@
2634
2688
  <xsl:with-param name="table" select="$table"/>
2635
2689
  </xsl:call-template>
2636
2690
  </xsl:if>
2691
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
2692
+ <xsl:variable name="zero-space">​</xsl:variable>
2693
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2637
2694
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
2638
- <!-- <fo:table-header font-weight="bold">
2639
- <xsl:apply-templates />
2640
- </fo:table-header> -->
2641
- <xsl:apply-templates/>
2695
+ <!-- font-weight="bold" -->
2696
+ <fo:table-header>
2697
+ <xsl:apply-templates/>
2698
+ </fo:table-header>
2642
2699
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
2643
2700
  <xsl:apply-templates/>
2701
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
2702
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2703
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2704
+
2705
+ <fo:table-footer>
2706
+
2707
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2708
+
2709
+ <!-- if there are note(s) or fn(s) then create footer row -->
2710
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2711
+
2712
+ <xsl:variable name="cols-count">
2713
+ <xsl:choose>
2714
+ <xsl:when test="../*[local-name()='thead']">
2715
+ <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2716
+ <xsl:call-template name="calculate-columns-numbers">
2717
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2718
+ </xsl:call-template>
2719
+ </xsl:when>
2720
+ <xsl:otherwise>
2721
+ <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2722
+ <xsl:call-template name="calculate-columns-numbers">
2723
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2724
+ </xsl:call-template>
2725
+ </xsl:otherwise>
2726
+ </xsl:choose>
2727
+ </xsl:variable>
2728
+
2729
+ <fo:table-row>
2730
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2731
+
2732
+
2733
+
2734
+ <xsl:if test="ancestor::*[local-name()='preface']">
2735
+ <xsl:attribute name="border">solid black 0pt</xsl:attribute>
2736
+ </xsl:if>
2737
+
2738
+ <!-- fn will be processed inside 'note' processing -->
2739
+
2740
+
2741
+ <!-- except gb -->
2742
+
2743
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2744
+
2745
+
2746
+ <!-- horizontal row separator -->
2747
+
2748
+
2749
+ <!-- fn processing -->
2750
+ <xsl:call-template name="fn_display"/>
2751
+
2752
+ </fo:table-cell>
2753
+ </fo:table-row>
2754
+
2755
+ </xsl:if>
2756
+ </fo:table-footer>
2757
+
2758
+ </xsl:if>
2644
2759
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
2645
- <xsl:variable name="cols-count">
2646
- <xsl:choose>
2647
- <xsl:when test="../*[local-name()='thead']">
2648
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2649
- <xsl:call-template name="calculate-columns-numbers">
2650
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2651
- </xsl:call-template>
2652
- </xsl:when>
2653
- <xsl:otherwise>
2654
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2655
- <xsl:call-template name="calculate-columns-numbers">
2656
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2657
- </xsl:call-template>
2658
- </xsl:otherwise>
2659
- </xsl:choose>
2660
- </xsl:variable>
2661
-
2760
+
2761
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2762
+
2763
+ <xsl:call-template name="insertTableFooter"/>
2764
+
2662
2765
  <fo:table-body>
2663
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2664
2766
  <xsl:apply-templates/>
2665
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2666
- <!-- if there are note(s) or fn(s) then create footer row -->
2667
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
2668
- <fo:table-row>
2669
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2670
-
2671
-
2672
-
2673
- <xsl:if test="ancestor::*[local-name()='preface']">
2674
- <xsl:attribute name="border">solid black 0pt</xsl:attribute>
2675
- </xsl:if>
2676
-
2677
- <!-- fn will be processed inside 'note' processing -->
2678
-
2679
-
2680
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2681
-
2682
- <!-- horizontal row separator -->
2683
-
2684
-
2685
- <!-- fn processing -->
2686
- <xsl:call-template name="fn_display"/>
2687
-
2688
- </fo:table-cell>
2689
- </fo:table-row>
2690
-
2691
- </xsl:if>
2767
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2768
+
2692
2769
  </fo:table-body>
2770
+
2693
2771
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
2694
2772
  <xsl:variable name="parent-name" select="local-name(..)"/>
2695
2773
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2707,6 +2785,7 @@
2707
2785
 
2708
2786
  </xsl:if>
2709
2787
 
2788
+
2710
2789
  <xsl:apply-templates/>
2711
2790
  </fo:table-row>
2712
2791
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
@@ -2750,6 +2829,8 @@
2750
2829
 
2751
2830
 
2752
2831
 
2832
+
2833
+
2753
2834
  <xsl:if test="@colspan">
2754
2835
  <xsl:attribute name="number-columns-spanned">
2755
2836
  <xsl:value-of select="@colspan"/>
@@ -2782,13 +2863,17 @@
2782
2863
  <fo:block font-size="10pt" margin-bottom="12pt">
2783
2864
 
2784
2865
 
2866
+
2785
2867
  <fo:inline padding-right="2mm">
2868
+
2786
2869
  <xsl:text>NOTE </xsl:text>
2787
2870
 
2788
2871
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2789
2872
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
2790
2873
  <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
2791
2874
  </xsl:if>
2875
+
2876
+
2792
2877
 
2793
2878
 
2794
2879
  </fo:inline>
@@ -2817,6 +2902,7 @@
2817
2902
  <fo:block margin-bottom="12pt">
2818
2903
 
2819
2904
 
2905
+
2820
2906
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2821
2907
 
2822
2908
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2824,6 +2910,7 @@
2824
2910
 
2825
2911
 
2826
2912
 
2913
+
2827
2914
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
2828
2915
 
2829
2916
 
@@ -2913,6 +3000,7 @@
2913
3000
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
2914
3001
 
2915
3002
 
3003
+
2916
3004
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2917
3005
  <xsl:attribute name="color">blue</xsl:attribute>
2918
3006
 
@@ -2938,7 +3026,7 @@
2938
3026
 
2939
3027
 
2940
3028
  <fo:block margin-bottom="12pt" text-align="left">
2941
-
3029
+
2942
3030
  <xsl:text>where </xsl:text>
2943
3031
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
2944
3032
  <xsl:text/>
@@ -2953,6 +3041,7 @@
2953
3041
 
2954
3042
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2955
3043
 
3044
+
2956
3045
  <xsl:text>where</xsl:text>
2957
3046
  </fo:block>
2958
3047
  </xsl:when>
@@ -2960,6 +3049,7 @@
2960
3049
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
2961
3050
 
2962
3051
 
3052
+
2963
3053
  <xsl:text>Key</xsl:text>
2964
3054
  </fo:block>
2965
3055
  </xsl:when>
@@ -2975,9 +3065,9 @@
2975
3065
  </xsl:if>
2976
3066
 
2977
3067
 
2978
-
2979
3068
  <fo:block>
2980
3069
 
3070
+
2981
3071
  <!-- create virtual html table for dl/[dt and dd] -->
2982
3072
  <xsl:variable name="html-table">
2983
3073
  <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
@@ -2997,6 +3087,7 @@
2997
3087
  <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2998
3088
 
2999
3089
  <fo:table width="95%" table-layout="fixed">
3090
+
3000
3091
  <xsl:choose>
3001
3092
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3002
3093
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -3096,6 +3187,7 @@
3096
3187
  <fo:table-cell>
3097
3188
  <fo:block margin-top="6pt">
3098
3189
 
3190
+
3099
3191
  <xsl:if test="normalize-space($key_iso) = 'true'">
3100
3192
  <xsl:attribute name="margin-top">0</xsl:attribute>
3101
3193
 
@@ -3103,6 +3195,7 @@
3103
3195
 
3104
3196
 
3105
3197
  <xsl:apply-templates/>
3198
+
3106
3199
  </fo:block>
3107
3200
  </fo:table-cell>
3108
3201
  <fo:table-cell>
@@ -3123,7 +3216,7 @@
3123
3216
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
3124
3217
  <xsl:apply-templates/>
3125
3218
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" 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">
3126
- <fo:inline><xsl:apply-templates/></fo:inline>
3219
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3127
3220
  </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
3128
3221
  <fo:inline font-style="italic">
3129
3222
  <xsl:apply-templates/>
@@ -3238,6 +3331,7 @@
3238
3331
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3239
3332
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3240
3333
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3334
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3241
3335
  <xsl:variable name="zero-space">​</xsl:variable>
3242
3336
  <xsl:choose>
3243
3337
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -3272,6 +3366,14 @@
3272
3366
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3273
3367
  </xsl:call-template>
3274
3368
  </xsl:when>
3369
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
3370
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
3371
+ <xsl:value-of select="$zero-space-after-underscore"/>
3372
+ <xsl:value-of select="$zero-space"/>
3373
+ <xsl:call-template name="add-zero-spaces">
3374
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
3375
+ </xsl:call-template>
3376
+ </xsl:when>
3275
3377
  <xsl:otherwise>
3276
3378
  <xsl:value-of select="$text"/>
3277
3379
  </xsl:otherwise>
@@ -3448,4 +3550,40 @@
3448
3550
  <xsl:copy-of select="."/>
3449
3551
  </fo:instream-foreign-object>
3450
3552
  </fo:inline>
3553
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
3554
+ <xsl:for-each select="*[local-name()='locality']">
3555
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3556
+ <xsl:apply-templates select="."/>
3557
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3558
+ </xsl:for-each>
3559
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
3560
+ <xsl:variable name="target">
3561
+ <xsl:choose>
3562
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3563
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
3564
+ </xsl:when>
3565
+ <xsl:otherwise>
3566
+ <xsl:value-of select="normalize-space(@target)"/>
3567
+ </xsl:otherwise>
3568
+ </xsl:choose>
3569
+ </xsl:variable>
3570
+ <fo:inline xsl:use-attribute-sets="link-style">
3571
+ <xsl:choose>
3572
+ <xsl:when test="$target = ''">
3573
+ <xsl:apply-templates/>
3574
+ </xsl:when>
3575
+ <xsl:otherwise>
3576
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3577
+ <xsl:choose>
3578
+ <xsl:when test="normalize-space(.) = ''">
3579
+ <xsl:value-of select="$target"/>
3580
+ </xsl:when>
3581
+ <xsl:otherwise>
3582
+ <xsl:apply-templates/>
3583
+ </xsl:otherwise>
3584
+ </xsl:choose>
3585
+ </fo:basic-link>
3586
+ </xsl:otherwise>
3587
+ </xsl:choose>
3588
+ </fo:inline>
3451
3589
  </xsl:template></xsl:stylesheet>