metanorma-iec 1.4.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +4 -32
  3. data/.gitignore +14 -0
  4. data/Gemfile +4 -0
  5. data/lib/isodoc/iec/base_convert.rb +3 -2
  6. data/lib/isodoc/iec/html/htmlstyle.css +1 -1
  7. data/lib/isodoc/iec/html/htmlstyle.scss +1 -1
  8. data/lib/isodoc/iec/html_convert.rb +2 -1
  9. data/lib/isodoc/iec/iec.international-standard.xsl +294 -214
  10. data/lib/isodoc/iec/xref.rb +9 -8
  11. data/lib/{asciidoctor → metanorma}/iec/basicdoc.rng +0 -0
  12. data/lib/{asciidoctor → metanorma}/iec/biblio.rng +0 -0
  13. data/lib/{asciidoctor → metanorma}/iec/converter.rb +22 -1
  14. data/lib/{asciidoctor → metanorma}/iec/front.rb +1 -1
  15. data/lib/{asciidoctor → metanorma}/iec/iec.rng +0 -0
  16. data/lib/{asciidoctor → metanorma}/iec/iec_intro_en.xml +0 -0
  17. data/lib/{asciidoctor → metanorma}/iec/iec_intro_fr.xml +0 -0
  18. data/lib/{asciidoctor → metanorma}/iec/isodoc.rng +29 -0
  19. data/lib/{asciidoctor → metanorma}/iec/isostandard.rng +0 -0
  20. data/lib/{asciidoctor → metanorma}/iec/reqt.rng +0 -0
  21. data/lib/metanorma/iec/version.rb +1 -1
  22. data/lib/metanorma-iec.rb +1 -1
  23. data/metanorma-iec.gemspec +1 -1
  24. data/spec/isodoc/iev_spec.rb +5 -4
  25. data/spec/isodoc/ref_spec.rb +359 -353
  26. data/spec/{asciidoctor → metanorma}/base_spec.rb +1 -1
  27. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
  28. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +1 -1
  29. data/spec/{asciidoctor → metanorma}/iev_spec.rb +1 -1
  30. data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
  31. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  32. data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
  33. data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
  34. data/spec/spec_helper.rb +2 -2
  35. metadata +22 -22
@@ -502,24 +502,34 @@
502
502
  <fo:block font-size="9pt" color="{$color_blue}" line-height="150%">
503
503
  <fo:block-container width="40mm">
504
504
  <fo:block>
505
- <!-- <xsl:variable name="publisher" select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor[iec:role/@type = 'publisher']/iec:organization/iec:name))"/> -->
506
- <!-- <xsl:value-of select="$publisher"/> -->
507
- <xsl:value-of select="(//iec:iec-standard)[1]/iec:localized-strings/iec:localized-string[@key='IEC' and @language=$lang]"/>
505
+ <xsl:call-template name="getLocalizedString">
506
+ <xsl:with-param name="key">IEC</xsl:with-param>
507
+ <xsl:with-param name="lang"><xsl:value-of select="$lang"/></xsl:with-param>
508
+ </xsl:call-template>
508
509
  </fo:block>
509
510
  </fo:block-container>
510
511
  </fo:block>
511
- <xsl:if test="(//iec:iec-standard)[2]/iec:localized-strings/iec:localized-string[@key='IEC' and @language=$lang_second]">
512
+
513
+ <xsl:variable name="IEC_lang_second">
514
+ <xsl:call-template name="getLocalizedString">
515
+ <xsl:with-param name="key">IEC</xsl:with-param>
516
+ <xsl:with-param name="lang"><xsl:value-of select="$lang_second"/></xsl:with-param>
517
+ </xsl:call-template>
518
+ </xsl:variable>
519
+
520
+ <xsl:if test="normalize-space($IEC_lang_second) != ''">
512
521
  <fo:block font-size="9pt" line-height="150%" margin-top="8pt">
513
522
  <fo:block-container width="40mm">
514
523
  <fo:block>
515
524
  <!-- <xsl:value-of select="'COMMISSION ELECTROTECHNIQUE INTERNATIONALE'"/> -->
516
- <xsl:value-of select="(//iec:iec-standard)[2]/iec:localized-strings/iec:localized-string[@key='IEC' and @language=$lang_second]"/>
525
+ <xsl:value-of select="$IEC_lang_second"/>
517
526
  </fo:block>
518
527
  </fo:block-container>
519
528
  </fo:block>
520
529
  </xsl:if>
521
530
  </fo:block-container>
522
531
 
532
+ <xsl:variable name="price_code_value" select="//iec:iec-standard/iec:bibdata/iec:ext/iec:price-code"/>
523
533
  <fo:table table-layout="fixed" width="102%" margin-top="-9mm" margin-bottom="2mm">
524
534
  <fo:table-column column-width="148mm"/>
525
535
  <fo:table-column column-width="16mm"/>
@@ -527,29 +537,34 @@
527
537
  <fo:table-row border-bottom="0.5pt solid {$color_gray}" height="16mm">
528
538
  <fo:table-cell font-size="8pt" text-align="right" display-align="center">
529
539
  <fo:block>
530
- <fo:block color="{$color_blue}" margin-bottom="3pt">
531
- <!-- PRICE CODE -->
532
- <xsl:variable name="price_code">
533
- <!-- <xsl:call-template name="getLocalizedString">
534
- <xsl:with-param name="key">price-code</xsl:with-param>
535
- </xsl:call-template> -->
536
- <xsl:value-of select="(//iec:iec-standard)[1]/iec:localized-strings/iec:localized-string[@key='price-code' and @language=$lang]"/>
537
- </xsl:variable>
538
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($price_code))"/>
539
- </fo:block>
540
- <!-- <xsl:if test="$lang != 'fr'">
541
- <fo:block>CODE PRIX</fo:block>
542
- </xsl:if> -->
543
- <fo:block>
544
- <xsl:variable name="price_code">
545
- <xsl:value-of select="(//iec:iec-standard)[2]/iec:localized-strings/iec:localized-string[@key='price-code' and @language=$lang_second]"/>
546
- </xsl:variable>
547
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($price_code))"/>
548
- </fo:block>
540
+ <xsl:if test="normalize-space($price_code_value) != ''">
541
+ <fo:block color="{$color_blue}" margin-bottom="3pt">
542
+ <!-- PRICE CODE -->
543
+ <xsl:variable name="price_code">
544
+ <xsl:call-template name="getLocalizedString">
545
+ <xsl:with-param name="key">price-code</xsl:with-param>
546
+ <xsl:with-param name="lang"><xsl:value-of select="$lang"/></xsl:with-param>
547
+ </xsl:call-template>
548
+ </xsl:variable>
549
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($price_code))"/>
550
+ </fo:block>
551
+ <!-- <xsl:if test="$lang != 'fr'">
552
+ <fo:block>CODE PRIX</fo:block>
553
+ </xsl:if> -->
554
+ <fo:block>
555
+ <xsl:variable name="price_code">
556
+ <xsl:call-template name="getLocalizedString">
557
+ <xsl:with-param name="key">price-code</xsl:with-param>
558
+ <xsl:with-param name="lang"><xsl:value-of select="$lang_second"/></xsl:with-param>
559
+ </xsl:call-template>
560
+ </xsl:variable>
561
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($price_code))"/>
562
+ </fo:block>
563
+ </xsl:if>
549
564
  </fo:block>
550
565
  </fo:table-cell>
551
566
  <fo:table-cell font-size="25pt" font-weight="bold" color="{$color_gray}" text-align="right" display-align="center">
552
- <fo:block padding-top="1mm"><xsl:value-of select="//iec:iec-standard/iec:bibdata/iec:ext/iec:price-code"/></fo:block>
567
+ <fo:block padding-top="1mm"><xsl:value-of select="$price_code_value"/></fo:block>
553
568
  </fo:table-cell>
554
569
  </fo:table-row>
555
570
  </fo:table-body>
@@ -1378,7 +1393,13 @@
1378
1393
  <xsl:text> — </xsl:text>
1379
1394
  <xsl:value-of select="$linebreak"/>
1380
1395
  <xsl:if test="$part != ''">
1381
- <xsl:variable name="localized_part" select="(//iec:iec-standard)[1]/iec:localized-strings/iec:localized-string[@key='locality.part' and @language=$lang]"/>
1396
+ <xsl:variable name="localized_part">
1397
+ <xsl:call-template name="getLocalizedString">
1398
+ <xsl:with-param name="key">locality.part</xsl:with-param>
1399
+ <xsl:with-param name="lang"><xsl:value-of select="$lang"/></xsl:with-param>
1400
+ </xsl:call-template>
1401
+ </xsl:variable>
1402
+
1382
1403
  <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($localized_part),'#',$part)"/> -->
1383
1404
  <xsl:value-of select="concat($localized_part ,' ',$part, ': ')"/>
1384
1405
  <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
@@ -1404,10 +1425,17 @@
1404
1425
  <xsl:value-of select="$linebreak"/>
1405
1426
  <xsl:if test="$part != ''">
1406
1427
 
1428
+ <xsl:variable name="locality_part_lang_second">
1429
+ <xsl:call-template name="getLocalizedString">
1430
+ <xsl:with-param name="key">locality.part</xsl:with-param>
1431
+ <xsl:with-param name="lang"><xsl:value-of select="$lang_second"/></xsl:with-param>
1432
+ </xsl:call-template>
1433
+ </xsl:variable>
1434
+
1407
1435
  <xsl:choose>
1408
- <xsl:when test="(//iec:iec-standard)[2]/iec:localized-strings/iec:localized-string[@key='locality.part' and @language=$lang_second]">
1436
+ <xsl:when test="normalize-space($locality_part_lang_second)">
1409
1437
  <xsl:variable name="localized_part">
1410
- <xsl:value-of select="(//iec:iec-standard)[2]/iec:localized-strings/iec:localized-string[@key='locality.part' and @language=$lang_second]"/>
1438
+ <xsl:value-of select="$locality_part_lang_second"/>
1411
1439
  </xsl:variable>
1412
1440
  <xsl:value-of select="concat($localized_part ,' ',$part, ': ')"/>
1413
1441
  </xsl:when>
@@ -1434,8 +1462,8 @@
1434
1462
  <fo:block role="TOC">
1435
1463
  <fo:block font-size="12pt" text-align="center" margin-bottom="22pt" role="H1">
1436
1464
  <xsl:variable name="title-toc">
1437
- <xsl:call-template name="getTitle">
1438
- <xsl:with-param name="name" select="'title-toc'"/>
1465
+ <xsl:call-template name="getLocalizedString">
1466
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1439
1467
  </xsl:call-template>
1440
1468
  </xsl:variable>
1441
1469
  <xsl:call-template name="addLetterSpacing">
@@ -1459,6 +1487,9 @@
1459
1487
  <xsl:if test="@type = 'indexsect'">
1460
1488
  <xsl:attribute name="space-before">16pt</xsl:attribute>
1461
1489
  </xsl:if>
1490
+ <xsl:if test="@type = 'references'">
1491
+ <xsl:attribute name="space-before">5pt</xsl:attribute>
1492
+ </xsl:if>
1462
1493
  <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
1463
1494
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
1464
1495
  </xsl:if> -->
@@ -1468,6 +1499,7 @@
1468
1499
  <fo:list-block>
1469
1500
  <xsl:attribute name="margin-left">
1470
1501
  <xsl:choose>
1502
+ <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1471
1503
  <xsl:when test="@level = 2">8mm</xsl:when>
1472
1504
  <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1473
1505
  <xsl:otherwise>0mm</xsl:otherwise>
@@ -1547,8 +1579,12 @@
1547
1579
  <xsl:param name="lang" select="$lang"/>
1548
1580
  <fo:block break-after="page"/>
1549
1581
  <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1550
- <!-- <fo:block><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor/iec:organization/iec:name))"/></fo:block> -->
1551
- <fo:block><xsl:value-of select="/iec:iec-standard/iec:localized-strings/iec:localized-string[@key='IEC' and @language=$lang]"/></fo:block>
1582
+ <fo:block>
1583
+ <xsl:call-template name="getLocalizedString">
1584
+ <xsl:with-param name="key">IEC</xsl:with-param>
1585
+ <xsl:with-param name="lang"><xsl:value-of select="$lang"/></xsl:with-param>
1586
+ </xsl:call-template>
1587
+ </fo:block>
1552
1588
  <fo:block>___________</fo:block>
1553
1589
  <fo:block> </fo:block>
1554
1590
  <fo:block font-weight="bold" role="H1">
@@ -1563,9 +1599,13 @@
1563
1599
  <fo:block>
1564
1600
  <xsl:if test="$part != ''">
1565
1601
  <!-- Example: Part 1: Riz -->
1566
- <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/> -->
1567
- <xsl:variable name="localized_part" select="//iec:iec-standard/iec:localized-strings/iec:localized-string[@key='locality.part' and @language = $lang]"/>
1568
- <xsl:value-of select="concat($localized_part ,' ',$part, ': ')"/>
1602
+ <xsl:variable name="localized_part">
1603
+ <xsl:call-template name="getLocalizedString">
1604
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1605
+ <xsl:with-param name="lang" select="$lang"/>
1606
+ </xsl:call-template>
1607
+ </xsl:variable>
1608
+ <xsl:value-of select="concat($localized_part ,' ', $part, ': ')"/>
1569
1609
  </xsl:if>
1570
1610
  <xsl:value-of select="$title-part"/>
1571
1611
  </fo:block>
@@ -1608,8 +1648,12 @@
1608
1648
  <fo:block>
1609
1649
  <xsl:if test="$part != ''">
1610
1650
  <!-- Example: Part 1: Rice -->
1611
- <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/> -->
1612
- <xsl:variable name="localized_part" select="//iec:iec-standard/iec:localized-strings/iec:localized-string[@key='locality.part' and @language = $lang]"/>
1651
+ <xsl:variable name="localized_part">
1652
+ <xsl:call-template name="getLocalizedString">
1653
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1654
+ <xsl:with-param name="lang" select="$lang"/>
1655
+ </xsl:call-template>
1656
+ </xsl:variable>
1613
1657
  <xsl:value-of select="concat($localized_part ,' ',$part, ': ')"/>
1614
1658
  </xsl:if>
1615
1659
  <xsl:value-of select="$title-part"/>
@@ -1751,6 +1795,10 @@
1751
1795
  <xsl:call-template name="getName"/>
1752
1796
  </xsl:variable>
1753
1797
 
1798
+ <xsl:variable name="variant_title">
1799
+ <xsl:copy-of select="iec:variant-title/node()"/>
1800
+ </xsl:variable>
1801
+
1754
1802
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" display="{$display}">
1755
1803
  <xsl:if test="$type ='appendix'">
1756
1804
  <xsl:attribute name="section"/>
@@ -1763,6 +1811,10 @@
1763
1811
  <!-- <xsl:when test="$type = 'foreword' or $type = 'introduction'">
1764
1812
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1765
1813
  </xsl:when> -->
1814
+ <xsl:when test="normalize-space($variant_title) != ''">
1815
+ <xsl:attribute name="variant-title">true</xsl:attribute>
1816
+ <xsl:apply-templates select="xalan:nodeset($variant_title)" mode="contents_item"/>
1817
+ </xsl:when>
1766
1818
  <xsl:when test="$type = 'indexsect'">
1767
1819
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1768
1820
  </xsl:when>
@@ -2099,25 +2151,7 @@
2099
2151
 
2100
2152
  <xsl:template match="iec:bibitem">
2101
2153
  <fo:block id="{@id}" margin-top="5pt" margin-bottom="10pt"> <!-- letter-spacing="0.4pt" -->
2102
- <!-- iec:docidentifier -->
2103
- <xsl:if test="iec:docidentifier">
2104
- <xsl:choose>
2105
- <xsl:when test="iec:docidentifier/@type = 'metanorma'"/>
2106
- <xsl:otherwise><fo:inline><xsl:value-of select="iec:docidentifier"/></fo:inline></xsl:otherwise>
2107
- </xsl:choose>
2108
- </xsl:if>
2109
- <xsl:apply-templates select="iec:note"/>
2110
- <xsl:if test="iec:docidentifier">, </xsl:if>
2111
- <fo:inline font-style="italic">
2112
- <xsl:choose>
2113
- <xsl:when test="iec:title[@type = 'main' and @language = 'en']">
2114
- <xsl:value-of select="iec:title[@type = 'main' and @language = 'en']"/>
2115
- </xsl:when>
2116
- <xsl:otherwise>
2117
- <xsl:value-of select="iec:title"/>
2118
- </xsl:otherwise>
2119
- </xsl:choose>
2120
- </fo:inline>
2154
+ <xsl:call-template name="processBibitem"/>
2121
2155
  </fo:block>
2122
2156
  </xsl:template>
2123
2157
 
@@ -2219,7 +2253,10 @@
2219
2253
  <xsl:call-template name="getLevelTermName"/>
2220
2254
  </xsl:variable>
2221
2255
  <fo:block line-height="1.1" space-before="14pt" role="H{$levelTerm}">
2222
- <xsl:if test="parent::iec:term">
2256
+ <xsl:if test="preceding-sibling::*[1][self::iec:preferred]">
2257
+ <xsl:attribute name="space-before">1pt</xsl:attribute>
2258
+ </xsl:if>
2259
+ <xsl:if test="parent::iec:term and not(preceding-sibling::iec:preferred)"> <!-- if first preffered in term, then display term's name -->
2223
2260
  <fo:block font-weight="bold" keep-with-next="always">
2224
2261
  <xsl:apply-templates select="ancestor::iec:term[1]/iec:name" mode="presentation"/>
2225
2262
  </fo:block>
@@ -2249,35 +2286,22 @@
2249
2286
  <fo:list-item>
2250
2287
  <fo:list-item-label end-indent="label-end()">
2251
2288
  <fo:block id="{@id}">
2252
- <xsl:number format="[1]"/>
2289
+ <xsl:value-of select="iec:docidentifier[@type = 'metanorma-ordinal']"/>
2290
+ <xsl:if test="not(iec:docidentifier[@type = 'metanorma-ordinal'])">
2291
+ <xsl:number format="[1]"/>
2292
+ </xsl:if>
2253
2293
  </fo:block>
2254
2294
  </fo:list-item-label>
2255
2295
  <fo:list-item-body start-indent="body-start()">
2256
2296
  <fo:block>
2257
- <xsl:if test="iec:docidentifier">
2258
- <xsl:choose>
2259
- <xsl:when test="iec:docidentifier/@type = 'metanorma'"/>
2260
- <xsl:otherwise><fo:inline><xsl:value-of select="iec:docidentifier"/>, </fo:inline></xsl:otherwise>
2261
- </xsl:choose>
2262
- </xsl:if>
2263
- <xsl:choose>
2264
- <xsl:when test="iec:title[@type = 'main' and @language = 'en']">
2265
- <xsl:apply-templates select="iec:title[@type = 'main' and @language = 'en']"/>
2266
- </xsl:when>
2267
- <xsl:otherwise>
2268
- <xsl:apply-templates select="iec:title"/>
2269
- </xsl:otherwise>
2270
- </xsl:choose>
2271
- <xsl:apply-templates select="iec:formattedref"/>
2297
+ <xsl:call-template name="processBibitem"/>
2272
2298
  </fo:block>
2273
2299
  </fo:list-item-body>
2274
2300
  </fo:list-item>
2275
2301
  </fo:list-block>
2276
2302
  </xsl:template>
2277
2303
 
2278
- <xsl:template match="iec:references[not(@normative='true')]/iec:bibitem" mode="contents"/>
2279
-
2280
- <xsl:template match="iec:references[not(@normative='true')]/iec:bibitem/iec:title">
2304
+ <xsl:template match="iec:references/iec:bibitem/iec:title">
2281
2305
  <fo:inline font-style="italic">
2282
2306
  <xsl:apply-templates/>
2283
2307
  </fo:inline>
@@ -2557,13 +2581,6 @@
2557
2581
 
2558
2582
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2559
2583
 
2560
- <title-annex lang="en">Annex </title-annex>
2561
- <title-annex lang="fr">Annexe </title-annex>
2562
-
2563
- <title-annex lang="zh">Annex </title-annex>
2564
-
2565
-
2566
-
2567
2584
  <title-edition lang="en">
2568
2585
 
2569
2586
  <xsl:text>Edition </xsl:text>
@@ -2577,33 +2594,18 @@
2577
2594
 
2578
2595
  </title-edition>
2579
2596
 
2580
-
2597
+
2598
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2581
2599
  <title-toc lang="en">
2582
2600
 
2583
- <xsl:text>Contents</xsl:text>
2584
-
2585
2601
 
2586
2602
 
2587
2603
  </title-toc>
2588
2604
  <title-toc lang="fr">
2589
2605
 
2590
- <xsl:text>Sommaire</xsl:text>
2591
-
2592
-
2593
- </title-toc>
2594
-
2595
- <title-toc lang="zh">Contents</title-toc>
2596
-
2597
-
2606
+ </title-toc>
2598
2607
 
2599
- <title-page lang="en">Page</title-page>
2600
- <title-page lang="fr">Page</title-page>
2601
2608
 
2602
- <title-key lang="en">Key</title-key>
2603
- <title-key lang="fr">Légende</title-key>
2604
-
2605
- <title-where lang="en">where</title-where>
2606
- <title-where lang="fr">où</title-where>
2607
2609
 
2608
2610
  <title-descriptors lang="en">Descriptors</title-descriptors>
2609
2611
 
@@ -2630,25 +2632,6 @@
2630
2632
 
2631
2633
  </title-subpart>
2632
2634
 
2633
- <title-modified lang="en">modified</title-modified>
2634
- <title-modified lang="fr">modifiée</title-modified>
2635
-
2636
- <title-modified lang="zh">modified</title-modified>
2637
-
2638
-
2639
-
2640
- <title-source lang="en">
2641
-
2642
- <xsl:text>SOURCE</xsl:text>
2643
-
2644
-
2645
- </title-source>
2646
-
2647
- <title-keywords lang="en">Keywords</title-keywords>
2648
-
2649
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2650
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2651
-
2652
2635
  <title-list-tables lang="en">List of Tables</title-list-tables>
2653
2636
 
2654
2637
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2657,37 +2640,8 @@
2657
2640
 
2658
2641
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2659
2642
 
2660
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2661
-
2662
- <title-abstract lang="en">Abstract</title-abstract>
2663
-
2664
2643
  <title-summary lang="en">Summary</title-summary>
2665
2644
 
2666
- <title-in lang="en">in </title-in>
2667
-
2668
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2669
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2670
-
2671
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2672
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2673
-
2674
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2675
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2676
-
2677
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2678
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2679
-
2680
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2681
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2682
-
2683
- <title-caution lang="en">CAUTION</title-caution>
2684
- <title-caution lang="zh">注意</title-caution>
2685
-
2686
- <title-warning lang="en">WARNING</title-warning>
2687
- <title-warning lang="zh">警告</title-warning>
2688
-
2689
- <title-amendment lang="en">AMENDMENT</title-amendment>
2690
-
2691
2645
  <title-continued lang="en">(continued)</title-continued>
2692
2646
  <title-continued lang="fr">(continué)</title-continued>
2693
2647
 
@@ -2786,6 +2740,10 @@
2786
2740
 
2787
2741
 
2788
2742
 
2743
+ <xsl:attribute name="space-before">8pt</xsl:attribute>
2744
+ <xsl:attribute name="space-after">8pt</xsl:attribute>
2745
+
2746
+
2789
2747
 
2790
2748
 
2791
2749
 
@@ -2798,7 +2756,11 @@
2798
2756
 
2799
2757
 
2800
2758
 
2759
+ <xsl:attribute name="margin-left">10mm</xsl:attribute>
2760
+
2761
+
2801
2762
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2763
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2802
2764
 
2803
2765
 
2804
2766
 
@@ -2823,6 +2785,9 @@
2823
2785
 
2824
2786
 
2825
2787
 
2788
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
2789
+
2790
+
2826
2791
 
2827
2792
 
2828
2793
 
@@ -3185,7 +3150,7 @@
3185
3150
 
3186
3151
 
3187
3152
 
3188
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
3153
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
3189
3154
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
3190
3155
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
3191
3156
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4538,12 +4503,9 @@
4538
4503
 
4539
4504
 
4540
4505
  <xsl:variable name="title-where">
4541
-
4542
-
4543
- <xsl:call-template name="getTitle">
4544
- <xsl:with-param name="name" select="'title-where'"/>
4545
- </xsl:call-template>
4546
-
4506
+ <xsl:call-template name="getLocalizedString">
4507
+ <xsl:with-param name="key">where</xsl:with-param>
4508
+ </xsl:call-template>
4547
4509
  </xsl:variable>
4548
4510
  <xsl:value-of select="$title-where"/>
4549
4511
  </fo:block>
@@ -4566,12 +4528,9 @@
4566
4528
 
4567
4529
 
4568
4530
  <xsl:variable name="title-where">
4569
-
4570
-
4571
- <xsl:call-template name="getTitle">
4572
- <xsl:with-param name="name" select="'title-where'"/>
4573
- </xsl:call-template>
4574
-
4531
+ <xsl:call-template name="getLocalizedString">
4532
+ <xsl:with-param name="key">where</xsl:with-param>
4533
+ </xsl:call-template>
4575
4534
  </xsl:variable>
4576
4535
  <xsl:value-of select="$title-where"/>
4577
4536
  </fo:block>
@@ -4586,12 +4545,9 @@
4586
4545
 
4587
4546
 
4588
4547
  <xsl:variable name="title-key">
4589
-
4590
-
4591
- <xsl:call-template name="getTitle">
4592
- <xsl:with-param name="name" select="'title-key'"/>
4593
- </xsl:call-template>
4594
-
4548
+ <xsl:call-template name="getLocalizedString">
4549
+ <xsl:with-param name="key">key</xsl:with-param>
4550
+ </xsl:call-template>
4595
4551
  </xsl:variable>
4596
4552
  <xsl:value-of select="$title-key"/>
4597
4553
  </fo:block>
@@ -4925,6 +4881,15 @@
4925
4881
  </fo:inline>
4926
4882
  </xsl:template><xsl:template match="*[local-name()='add']">
4927
4883
  <xsl:choose>
4884
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4885
+ <fo:inline>
4886
+ <xsl:call-template name="insertTag">
4887
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4888
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4889
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4890
+ </xsl:call-template>
4891
+ </fo:inline>
4892
+ </xsl:when>
4928
4893
  <xsl:when test="@amendment">
4929
4894
  <fo:inline>
4930
4895
  <xsl:call-template name="insertTag">
@@ -4959,7 +4924,6 @@
4959
4924
  </fo:inline>
4960
4925
  </xsl:otherwise>
4961
4926
  </xsl:choose>
4962
-
4963
4927
  </xsl:template><xsl:template name="insertTag">
4964
4928
  <xsl:param name="type"/>
4965
4929
  <xsl:param name="kind"/>
@@ -4975,14 +4939,14 @@
4975
4939
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4976
4940
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4977
4941
  <g>
4978
- <xsl:if test="$type = 'closing'">
4942
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4979
4943
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4980
4944
  </xsl:if>
4981
4945
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4982
4946
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4983
4947
  </g>
4984
4948
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4985
- <xsl:if test="$type = 'closing'">
4949
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4986
4950
  <xsl:attribute name="x">25</xsl:attribute>
4987
4951
  </xsl:if>
4988
4952
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -5479,9 +5443,9 @@
5479
5443
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
5480
5444
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
5481
5445
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
5482
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5446
+ <xsl:apply-templates select="*[local-name()='name']"/>
5483
5447
  </fo:block>
5484
- <xsl:apply-templates/>
5448
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
5485
5449
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
5486
5450
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5487
5451
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -6076,11 +6040,58 @@
6076
6040
  <xsl:value-of select="."/>
6077
6041
  </xsl:template><xsl:template match="node()" mode="contents">
6078
6042
  <xsl:apply-templates mode="contents"/>
6043
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
6044
+ <xsl:variable name="level">
6045
+ <xsl:call-template name="getLevel">
6046
+ <xsl:with-param name="depth" select="@depth"/>
6047
+ </xsl:call-template>
6048
+ </xsl:variable>
6049
+
6050
+ <xsl:variable name="section">
6051
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6052
+ </xsl:variable>
6053
+
6054
+ <xsl:variable name="type">floating-title</xsl:variable>
6055
+
6056
+ <xsl:variable name="display">
6057
+ <xsl:choose>
6058
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
6059
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
6060
+ <xsl:otherwise>false</xsl:otherwise>
6061
+ </xsl:choose>
6062
+ </xsl:variable>
6063
+
6064
+ <xsl:variable name="skip">false</xsl:variable>
6065
+
6066
+ <xsl:if test="$skip = 'false'">
6067
+
6068
+ <xsl:variable name="title">
6069
+ <xsl:choose>
6070
+ <xsl:when test="*[local-name() = 'tab']">
6071
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
6072
+ </xsl:when>
6073
+ <xsl:otherwise>
6074
+ <xsl:copy-of select="node()"/>
6075
+ </xsl:otherwise>
6076
+ </xsl:choose>
6077
+ </xsl:variable>
6078
+
6079
+ <xsl:variable name="root">
6080
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
6081
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
6082
+ </xsl:variable>
6083
+
6084
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
6085
+ <title>
6086
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
6087
+ </title>
6088
+ </item>
6089
+ </xsl:if>
6079
6090
  </xsl:template><xsl:template match="node()" mode="bookmarks">
6080
6091
  <xsl:apply-templates mode="bookmarks"/>
6081
6092
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
6082
6093
  <xsl:apply-templates select="."/>
6083
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
6094
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
6084
6095
  <xsl:apply-templates mode="bookmarks"/>
6085
6096
  </xsl:template><xsl:template name="addBookmarks">
6086
6097
  <xsl:param name="contents"/>
@@ -6251,7 +6262,10 @@
6251
6262
  </fo:block>
6252
6263
  </xsl:if>
6253
6264
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item">
6254
- <xsl:apply-templates mode="contents_item"/>
6265
+ <xsl:param name="mode">bookmarks</xsl:param>
6266
+ <xsl:apply-templates mode="contents_item">
6267
+ <xsl:with-param name="mode" select="$mode"/>
6268
+ </xsl:apply-templates>
6255
6269
  <!-- <xsl:text> </xsl:text> -->
6256
6270
  </xsl:template><xsl:template name="getSection">
6257
6271
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -6324,6 +6338,18 @@
6324
6338
  <xsl:copy-of select="."/>
6325
6339
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6326
6340
  <xsl:text> </xsl:text>
6341
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
6342
+ <xsl:param name="mode">bookmarks</xsl:param>
6343
+ <xsl:apply-templates mode="contents_item">
6344
+ <xsl:with-param name="mode" select="$mode"/>
6345
+ </xsl:apply-templates>
6346
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
6347
+ <xsl:param name="mode">bookmarks</xsl:param>
6348
+ <xsl:if test="$mode = 'contents'">
6349
+ <xsl:copy>
6350
+ <xsl:apply-templates mode="contents_item"/>
6351
+ </xsl:copy>
6352
+ </xsl:if>
6327
6353
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6328
6354
 
6329
6355
  <fo:block-container margin-left="0mm">
@@ -6660,42 +6686,54 @@
6660
6686
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6661
6687
 
6662
6688
 
6663
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6664
-
6665
- <xsl:variable name="element">
6689
+ <xsl:variable name="fo_element">
6690
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6666
6691
 
6667
- inline
6668
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6692
+
6693
+
6694
+ <xsl:choose>
6695
+ <!-- if example contains only one (except 'name') element (paragraph for example), then display it on the same line as EXAMPLE title -->
6696
+ <xsl:when test="count(*[not(local-name() = 'name')]) = 1">inline</xsl:when>
6697
+ <xsl:otherwise>block</xsl:otherwise>
6698
+ </xsl:choose>
6699
+
6669
6700
  </xsl:variable>
6670
6701
 
6702
+ <!-- display 'EXAMPLE' -->
6703
+ <xsl:apply-templates select="*[local-name()='name']">
6704
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6705
+ </xsl:apply-templates>
6706
+
6671
6707
  <xsl:choose>
6672
- <xsl:when test="contains(normalize-space($element), 'block')">
6673
- <fo:block xsl:use-attribute-sets="example-body-style">
6674
- <xsl:apply-templates/>
6675
- </fo:block>
6708
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6709
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6710
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6711
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6712
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6713
+ </xsl:apply-templates>
6714
+ </fo:block-container>
6715
+ </fo:block-container>
6676
6716
  </xsl:when>
6677
6717
  <xsl:otherwise>
6678
6718
  <fo:inline>
6679
- <xsl:apply-templates/>
6719
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6720
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6721
+ </xsl:apply-templates>
6680
6722
  </fo:inline>
6681
6723
  </xsl:otherwise>
6682
6724
  </xsl:choose>
6683
6725
 
6684
6726
  </fo:block>
6685
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6686
-
6687
- <xsl:variable name="element">
6688
-
6689
- inline
6690
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6691
- </xsl:variable>
6727
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6728
+ <xsl:param name="fo_element">block</xsl:param>
6729
+
6692
6730
  <xsl:choose>
6693
6731
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6694
6732
  <fo:inline>
6695
6733
  <xsl:apply-templates/>
6696
6734
  </fo:inline>
6697
6735
  </xsl:when>
6698
- <xsl:when test="contains(normalize-space($element), 'block')">
6736
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6699
6737
  <fo:block xsl:use-attribute-sets="example-name-style">
6700
6738
  <xsl:apply-templates/>
6701
6739
  </fo:block>
@@ -6708,14 +6746,15 @@
6708
6746
  </xsl:choose>
6709
6747
 
6710
6748
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6749
+ <xsl:param name="fo_element">block</xsl:param>
6750
+
6711
6751
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6712
6752
  <xsl:variable name="element">
6713
- block
6714
-
6715
6753
 
6754
+ <xsl:value-of select="$fo_element"/>
6716
6755
  </xsl:variable>
6717
6756
  <xsl:choose>
6718
- <xsl:when test="normalize-space($element) = 'block'">
6757
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6719
6758
  <fo:block xsl:use-attribute-sets="example-p-style">
6720
6759
 
6721
6760
  <xsl:apply-templates/>
@@ -6783,12 +6822,9 @@
6783
6822
  </fo:basic-link>
6784
6823
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
6785
6824
  <xsl:variable name="title-modified">
6786
-
6787
-
6788
- <xsl:call-template name="getTitle">
6789
- <xsl:with-param name="name" select="'title-modified'"/>
6790
- </xsl:call-template>
6791
-
6825
+ <xsl:call-template name="getLocalizedString">
6826
+ <xsl:with-param name="key">modified</xsl:with-param>
6827
+ </xsl:call-template>
6792
6828
  </xsl:variable>
6793
6829
 
6794
6830
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -6979,12 +7015,9 @@
6979
7015
  </fo:block>
6980
7016
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6981
7017
  <xsl:variable name="title-deprecated">
6982
-
6983
- <xsl:call-template name="getLocalizedString">
6984
- <xsl:with-param name="key">deprecated</xsl:with-param>
6985
- </xsl:call-template>
6986
-
6987
-
7018
+ <xsl:call-template name="getLocalizedString">
7019
+ <xsl:with-param name="key">deprecated</xsl:with-param>
7020
+ </xsl:call-template>
6988
7021
  </xsl:variable>
6989
7022
  <fo:block xsl:use-attribute-sets="deprecates-style">
6990
7023
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -6993,6 +7026,8 @@
6993
7026
  <xsl:if test="*[local-name() = 'strong']">
6994
7027
  <xsl:attribute name="font-weight">normal</xsl:attribute>
6995
7028
  </xsl:if>
7029
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
7030
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6996
7031
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6997
7032
  <fo:block xsl:use-attribute-sets="definition-style">
6998
7033
  <xsl:apply-templates/>
@@ -7315,16 +7350,51 @@
7315
7350
 
7316
7351
 
7317
7352
 
7318
-
7353
+
7354
+
7355
+
7356
+
7357
+
7358
+
7359
+
7360
+ <!-- start IEC bibtem processing -->
7361
+ <xsl:variable name="docidentifier">
7362
+ <xsl:choose>
7363
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
7364
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
7365
+ </xsl:choose>
7366
+ </xsl:variable>
7367
+ <xsl:value-of select="$docidentifier"/>
7368
+ <xsl:apply-templates select="iec:note"/>
7369
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
7370
+ <xsl:choose>
7371
+ <xsl:when test="iec:title[@type = 'main' and @language = 'en']">
7372
+ <xsl:apply-templates select="iec:title[@type = 'main' and @language = 'en']"/>
7373
+ </xsl:when>
7374
+ <xsl:otherwise>
7375
+ <xsl:apply-templates select="iec:title"/>
7376
+ </xsl:otherwise>
7377
+ </xsl:choose>
7378
+ <xsl:apply-templates select="iec:formattedref"/>
7379
+ <!-- end IEC bibtem processing -->
7319
7380
 
7320
7381
 
7321
7382
 
7322
7383
 
7323
7384
 
7385
+
7386
+
7387
+
7388
+
7389
+ <!-- end MPFD bibitem processing -->
7324
7390
 
7391
+ <!-- start M3D bibitem processing -->
7392
+
7393
+
7394
+
7325
7395
 
7326
7396
  </xsl:template><xsl:template name="processBibitemDocId">
7327
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
7397
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
7328
7398
  <xsl:choose>
7329
7399
  <xsl:when test="normalize-space($_doc_ident) != ''">
7330
7400
  <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
@@ -7338,7 +7408,7 @@
7338
7408
  <xsl:if test="$type != ''">
7339
7409
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
7340
7410
  </xsl:if> -->
7341
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
7411
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
7342
7412
  </xsl:otherwise>
7343
7413
  </xsl:choose>
7344
7414
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -7444,8 +7514,12 @@
7444
7514
  <fo:block> </fo:block>
7445
7515
  </fo:block-container>
7446
7516
  </xsl:template><xsl:variable name="toc_level">
7517
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
7518
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
7519
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
7447
7520
  <xsl:choose>
7448
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7521
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
7522
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
7449
7523
  <xsl:otherwise><!-- default value -->
7450
7524
 
7451
7525
 
@@ -7547,7 +7621,7 @@
7547
7621
  </td>
7548
7622
  </xsl:for-each>
7549
7623
  <td>333</td> <!-- page number, just for fill -->
7550
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7624
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7551
7625
  <fo:inline padding-right="5mm"> </fo:inline>
7552
7626
  <fo:inline><xsl:apply-templates/></fo:inline>
7553
7627
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -7919,9 +7993,15 @@
7919
7993
  </xsl:template><xsl:template name="getLocalizedString">
7920
7994
  <xsl:param name="key"/>
7921
7995
  <xsl:param name="formatted">false</xsl:param>
7996
+ <xsl:param name="lang"/>
7922
7997
 
7923
7998
  <xsl:variable name="curr_lang">
7924
- <xsl:call-template name="getLang"/>
7999
+ <xsl:choose>
8000
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8001
+ <xsl:otherwise>
8002
+ <xsl:call-template name="getLang"/>
8003
+ </xsl:otherwise>
8004
+ </xsl:choose>
7925
8005
  </xsl:variable>
7926
8006
 
7927
8007
  <xsl:variable name="data_value">