metanorma-iso 2.8.7 → 2.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/html_iso_titlepage.html +6 -0
  3. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +10 -0
  4. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +10 -0
  5. data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -0
  6. data/lib/isodoc/iso/i18n-de.yaml +1 -0
  7. data/lib/isodoc/iso/i18n-en.yaml +3 -0
  8. data/lib/isodoc/iso/i18n-fr.yaml +3 -0
  9. data/lib/isodoc/iso/i18n-ru.yaml +3 -0
  10. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -0
  11. data/lib/isodoc/iso/iso.amendment.xsl +717 -140
  12. data/lib/isodoc/iso/iso.international-standard.xsl +717 -140
  13. data/lib/isodoc/iso/metadata.rb +12 -0
  14. data/lib/metanorma/iso/base.rb +3 -3
  15. data/lib/metanorma/iso/biblio-standoc.rng +13 -0
  16. data/lib/metanorma/iso/biblio.rng +19 -12
  17. data/lib/metanorma/iso/cleanup.rb +1 -1
  18. data/lib/metanorma/iso/cleanup_biblio.rb +9 -7
  19. data/lib/metanorma/iso/converter.rb +1 -1
  20. data/lib/metanorma/iso/front.rb +19 -14
  21. data/lib/metanorma/iso/front_contributor.rb +1 -1
  22. data/lib/metanorma/iso/front_id.rb +7 -3
  23. data/lib/metanorma/iso/processor.rb +3 -5
  24. data/lib/metanorma/iso/relaton-iso.rng +2 -0
  25. data/lib/metanorma/iso/section.rb +1 -1
  26. data/lib/metanorma/iso/validate.rb +3 -2
  27. data/lib/metanorma/iso/validate_image.rb +1 -1
  28. data/lib/metanorma/iso/validate_list.rb +1 -1
  29. data/lib/metanorma/iso/validate_requirements.rb +1 -1
  30. data/lib/metanorma/iso/validate_section.rb +1 -1
  31. data/lib/metanorma/iso/validate_style.rb +1 -1
  32. data/lib/metanorma/iso/validate_title.rb +1 -1
  33. data/lib/metanorma/iso/version.rb +2 -2
  34. data/metanorma-iso.gemspec +2 -2
  35. metadata +2 -2
@@ -273,6 +273,7 @@
273
273
  <xsl:variable name="i18n_price_based_on"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">price_based_on</xsl:with-param></xsl:call-template></xsl:variable>
274
274
  <xsl:variable name="i18n_price"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">price</xsl:with-param></xsl:call-template></xsl:variable>
275
275
  <xsl:variable name="i18n_date_first_printing"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">date_first_printing</xsl:with-param></xsl:call-template></xsl:variable>
276
+ <xsl:variable name="i18n_date_printing"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">date_printing</xsl:with-param></xsl:call-template></xsl:variable>
276
277
  <xsl:variable name="i18n_corrected_version"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">corrected_version</xsl:with-param></xsl:call-template></xsl:variable>
277
278
  <xsl:variable name="i18n_fast_track_procedure"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">fast-track-procedure</xsl:with-param></xsl:call-template></xsl:variable>
278
279
  <xsl:variable name="i18n_all_rights_reserved"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">all_rights_reserved</xsl:with-param></xsl:call-template></xsl:variable>
@@ -405,6 +406,9 @@
405
406
 
406
407
  <xsl:if test="$layoutVersion = '1951'">
407
408
  <xsl:attribute name="font-size">10pt</xsl:attribute>
409
+ <xsl:if test="$revision_date_num &gt;= 19680101">
410
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
411
+ </xsl:if>
408
412
  </xsl:if>
409
413
 
410
414
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979'">
@@ -421,7 +425,7 @@
421
425
  <xsl:attribute name="font-size">10pt</xsl:attribute>
422
426
  </xsl:if>
423
427
 
424
- <xsl:if test="$layoutVersion = '1987' and $doctype = 'technical-report'">
428
+ <xsl:if test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))">
425
429
  <xsl:attribute name="font-size">8.5pt</xsl:attribute>
426
430
  </xsl:if>
427
431
 
@@ -621,7 +625,7 @@
621
625
  <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
622
626
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm" column-count="{$layout_columns}" column-gap="{$column_gap}"/>
623
627
  <fo:region-before region-name="header-first" extent="{$marginTop}mm">
624
- <xsl:if test="$layoutVersion = '1987' and $doctype = 'technical-report'">
628
+ <xsl:if test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))">
625
629
  <xsl:attribute name="region-name">header-odd</xsl:attribute>
626
630
  </xsl:if>
627
631
  </fo:region-before>
@@ -702,11 +706,11 @@
702
706
 
703
707
  <!-- First pages for Technical Report (layout 1987) -->
704
708
  <fo:simple-page-master master-name="first-preface_1987_TR" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
705
- <fo:region-body margin-top="13mm" margin-bottom="30mm" margin-left="19mm" margin-right="{$marginLeftRight2}mm"/>
709
+ <fo:region-body margin-top="13mm" margin-bottom="30mm" margin-left="19mm" margin-right="10.5mm"/>
706
710
  <fo:region-before region-name="header-empty" extent="13mm"/>
707
711
  <fo:region-after region-name="footer-preface-first_1987_TR" extent="30mm" display-align="after"/>
708
712
  <fo:region-start region-name="left-region-first_1987_TR" extent="19mm"/>
709
- <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
713
+ <fo:region-end region-name="right-region" extent="10.5mm"/>
710
714
  </fo:simple-page-master>
711
715
  <fo:page-sequence-master master-name="preface-1987_TR">
712
716
  <fo:repeatable-page-master-alternatives>
@@ -878,7 +882,7 @@
878
882
  </fo:page-sequence>
879
883
  </xsl:when><!-- END: preface sections (Foreword, Brief history for layout 1951 ($layoutVersion = '1951') -->
880
884
 
881
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report'">
885
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))">
882
886
  <fo:page-sequence master-reference="preface-1987_TR" format="i" force-page-count="no-force">
883
887
 
884
888
  <xsl:call-template name="insertHeaderFooter">
@@ -954,7 +958,25 @@
954
958
  </fo:block>
955
959
  </fo:table-cell>
956
960
  <fo:table-cell font-size="11pt" font-weight="bold">
957
- <fo:block><xsl:value-of select="$doctype_uppercased"/> <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:docnumber"/></fo:block>
961
+ <fo:block>
962
+ <xsl:choose>
963
+ <xsl:when test="$doctype = 'addendum'">
964
+ <xsl:variable name="doctype_international_standard">
965
+ <xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.international-standard</xsl:with-param></xsl:call-template>
966
+ </xsl:variable>
967
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($doctype_international_standard))"/>
968
+ <xsl:text> </xsl:text>
969
+ <xsl:value-of select="translate(substring-before(/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-undated'], '/'),':','-')"/>
970
+ <xsl:text>/</xsl:text>
971
+ <xsl:value-of select="$doctype_localized"/>
972
+ <xsl:text> </xsl:text>
973
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@addendum"/>
974
+ </xsl:when>
975
+ <xsl:otherwise>
976
+ <xsl:value-of select="$doctype_uppercased"/> <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:docnumber"/>
977
+ </xsl:otherwise>
978
+ </xsl:choose>
979
+ </fo:block>
958
980
  </fo:table-cell>
959
981
  </fo:table-row>
960
982
  <fo:table-row display-align="after">
@@ -971,24 +993,42 @@
971
993
  <fo:block font-size="18pt" font-weight="bold" role="H1" line-height="1.05">
972
994
  <xsl:call-template name="insertTitlesLangMain"/>
973
995
  </fo:block>
974
- <xsl:for-each select="xalan:nodeset($lang_other)/lang">
975
- <xsl:variable name="lang_other" select="."/>
976
- <fo:block font-size="12pt" role="SKIP"><xsl:value-of select="$linebreak"/></fo:block>
977
- <fo:block role="H1" font-style="italic" line-height="1.2">
978
- <!-- Example: title-intro fr -->
979
- <xsl:call-template name="insertTitlesLangOther">
980
- <xsl:with-param name="lang_other" select="$lang_other"/>
981
- </xsl:call-template>
982
- </fo:block>
983
- </xsl:for-each>
996
+ <xsl:choose>
997
+ <xsl:when test="$doctype = 'addendum'">
998
+ <fo:block font-size="12pt" font-weight="bold" role="H2" line-height="1.05" margin-top="6pt">
999
+ <xsl:call-template name="printAddendumTitle"/>
1000
+ </fo:block>
1001
+
1002
+ <xsl:apply-templates select="/iso:iso-standard/iso:preface/iso:clause[@type = 'provenance']">
1003
+ <xsl:with-param name="process">true</xsl:with-param>
1004
+ </xsl:apply-templates>
1005
+
1006
+ </xsl:when>
1007
+ <xsl:otherwise>
1008
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
1009
+ <xsl:variable name="lang_other" select="."/>
1010
+ <fo:block font-size="12pt" role="SKIP"><xsl:value-of select="$linebreak"/></fo:block>
1011
+ <fo:block role="H1" font-style="italic" line-height="1.2">
1012
+ <!-- Example: title-intro fr -->
1013
+ <xsl:call-template name="insertTitlesLangOther">
1014
+ <xsl:with-param name="lang_other" select="$lang_other"/>
1015
+ </xsl:call-template>
1016
+ </fo:block>
1017
+ </xsl:for-each>
1018
+ </xsl:otherwise>
1019
+ </xsl:choose>
984
1020
  </fo:block-container>
985
1021
 
1022
+ <xsl:if test="$doctype = 'addendum'">
1023
+ <fo:block break-after="page"/>
1024
+ </xsl:if>
1025
+
986
1026
  <!-- ToC, Foreword, Introduction -->
987
1027
  <xsl:call-template name="processPrefaceSectionsDefault"/>
988
1028
 
989
1029
  </fo:flow>
990
1030
  </fo:page-sequence>
991
- </xsl:when> <!-- $layoutVersion = '1987' and $doctype = 'technical-report' -->
1031
+ </xsl:when> <!-- (($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum')) -->
992
1032
  <xsl:otherwise>
993
1033
 
994
1034
  <xsl:variable name="copyright-statement">
@@ -1348,7 +1388,7 @@
1348
1388
  <xsl:when test="$layoutVersion = '1951'"/>
1349
1389
  <xsl:when test="$layoutVersion = '1972'"/>
1350
1390
  <xsl:when test="$layoutVersion = '1979'"/>
1351
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report'"><!-- UDC, Keywords and Price renders on the first page for technical-report --></xsl:when>
1391
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))"><!-- UDC, Keywords and Price renders on the first page for technical-report --></xsl:when>
1352
1392
  <xsl:when test="$layoutVersion = '2024'">
1353
1393
  <xsl:call-template name="insertLastPage_2024"/>
1354
1394
  </xsl:when>
@@ -1364,6 +1404,23 @@
1364
1404
 
1365
1405
  </xsl:template>
1366
1406
 
1407
+ <xsl:template name="printAddendumTitle">
1408
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($doctype))"/>
1409
+ <xsl:text> </xsl:text>
1410
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@addendum"/>
1411
+ <xsl:text> : </xsl:text>
1412
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:title[@type = 'title-add']"/>
1413
+ </xsl:template>
1414
+
1415
+ <xsl:template match="iso:preface/iso:clause[@type = 'provenance']" priority="5">
1416
+ <xsl:param name="process">false</xsl:param>
1417
+ <xsl:if test="$process = 'true'">
1418
+ <fo:block margin-top="30mm" role="SKIP" font-size="8pt">
1419
+ <xsl:apply-templates/>
1420
+ </fo:block>
1421
+ </xsl:if>
1422
+ </xsl:template>
1423
+
1367
1424
  <xsl:template name="insertMainSectionsAmendmentPageSequences">
1368
1425
  <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
1369
1426
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
@@ -1444,6 +1501,10 @@
1444
1501
  <xsl:when test="$layoutVersion = '1951'">
1445
1502
  <fo:page-sequence master-reference="cover-page_1951" force-page-count="no-force">
1446
1503
  <fo:static-content flow-name="cover-page-header" font-family="Times New Roman" font-size="8.5pt" font-weight="bold">
1504
+ <xsl:if test="$revision_date_num &lt; 19680101">
1505
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
1506
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
1507
+ </xsl:if>
1447
1508
  <fo:block-container height="99%" display-align="after">
1448
1509
  <fo:block text-align-last="justify" role="SKIP">
1449
1510
  <!-- Example: UDC 669.7 : 620.178.1 -->
@@ -1470,7 +1531,14 @@
1470
1531
  </fo:block>
1471
1532
  <fo:block margin-top="2mm" font-size="8pt" font-weight="bold">
1472
1533
  <xsl:call-template name="add-letter-spacing">
1473
- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(/iso:iso-standard/iso:bibdata/iso:copyright/iso:owner/iso:organization/iso:name))"/>
1534
+ <xsl:with-param name="text">
1535
+ <xsl:choose>
1536
+ <xsl:when test="$lang = 'fr'"><xsl:value-of select="java:toUpperCase(java:java.lang.String.new('Organisation Internationale de Normalisation'))"/></xsl:when>
1537
+ <xsl:otherwise>
1538
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iso:iso-standard/iso:bibdata/iso:copyright/iso:owner/iso:organization/iso:name))"/>
1539
+ </xsl:otherwise>
1540
+ </xsl:choose>
1541
+ </xsl:with-param>
1474
1542
  <xsl:with-param name="letter-spacing" select="0.55"/>
1475
1543
  </xsl:call-template>
1476
1544
  </fo:block>
@@ -1488,14 +1556,23 @@
1488
1556
 
1489
1557
  <fo:block-container height="39mm" display-align="center">
1490
1558
  <fo:block font-size="11pt">
1491
- <xsl:call-template name="insertTitlesLangMain"/>
1559
+ <xsl:if test="$revision_date_num &lt; 19680101">
1560
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
1561
+ </xsl:if>
1562
+
1563
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1564
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1565
+ <fo:block font-size="11pt" text-transform="uppercase" margin-top="2mm">
1566
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1567
+ </fo:block>
1568
+
1492
1569
  </fo:block>
1493
1570
  </fo:block-container>
1494
1571
 
1495
1572
  <fo:block-container margin-top="8.5mm" font-size="10pt"> <!-- height="40mm" display-align="center" -->
1496
1573
  <!-- Example: 1st EDITION -->
1497
1574
  <!-- <fo:block><xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']" /></fo:block> -->
1498
- <fo:block font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']"/></fo:block>
1575
+ <fo:block><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']"/></fo:block> <!-- font-weight="bold" -->
1499
1576
  <!-- <fo:block>&#xa0;</fo:block> -->
1500
1577
  <!-- Example: October 1971 -->
1501
1578
  <fo:block margin-top="2mm" font-size="9pt">
@@ -1512,7 +1589,7 @@
1512
1589
  </fo:page-sequence>
1513
1590
  </xsl:when> <!-- END: $layoutVersion = '1951' -->
1514
1591
 
1515
- <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979'">
1592
+ <xsl:when test="$layoutVersion = '1972' or ($layoutVersion = '1979' and not($doctype = 'addendum'))">
1516
1593
  <fo:page-sequence master-reference="cover-page_1972" force-page-count="no-force">
1517
1594
  <fo:static-content flow-name="cover-page-footer" font-size="7pt">
1518
1595
  <xsl:call-template name="insertSingleLine"/>
@@ -1650,8 +1727,8 @@
1650
1727
 
1651
1728
  </fo:flow>
1652
1729
  </fo:page-sequence>
1653
- </xsl:when> <!-- END: $layoutVersion = '1972' or $layoutVersion = '1979' -->
1654
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report'"><!-- see preface pages below --></xsl:when>
1730
+ </xsl:when> <!-- END: $layoutVersion = '1972' or ($layoutVersion = '1979' and not($doctype = 'addendum')) -->
1731
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))"><!-- see preface pages below --></xsl:when>
1655
1732
  <xsl:when test="$layoutVersion = '1987'">
1656
1733
  <fo:page-sequence master-reference="cover-page_1987" force-page-count="no-force">
1657
1734
  <fo:static-content flow-name="right-region">
@@ -1731,7 +1808,7 @@
1731
1808
  </fo:block-container>
1732
1809
  </fo:flow>
1733
1810
  </fo:page-sequence>
1734
- </xsl:when>
1811
+ </xsl:when> <!-- END: $layoutVersion = '1987' -->
1735
1812
 
1736
1813
  <xsl:when test="$layoutVersion = '2024'">
1737
1814
  <fo:page-sequence master-reference="cover-page_2024" force-page-count="no-force">
@@ -2333,7 +2410,18 @@
2333
2410
  <xsl:if test="$font-size != ''">
2334
2411
  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
2335
2412
  </xsl:if>
2336
- <xsl:value-of select="$doctype_uppercased"/>
2413
+
2414
+ <xsl:choose>
2415
+ <xsl:when test="$doctype = 'addendum'">
2416
+ <xsl:variable name="doctype_international_standard">
2417
+ <xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.international-standard</xsl:with-param></xsl:call-template>
2418
+ </xsl:variable>
2419
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($doctype_international_standard))"/>
2420
+ </xsl:when>
2421
+ <xsl:otherwise>
2422
+ <xsl:value-of select="$doctype_uppercased"/>
2423
+ </xsl:otherwise>
2424
+ </xsl:choose>
2337
2425
  </xsl:otherwise>
2338
2426
  </xsl:choose>
2339
2427
  </fo:block>
@@ -2343,8 +2431,15 @@
2343
2431
  <xsl:if test="$font-size != ''">
2344
2432
  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
2345
2433
  </xsl:if>
2346
- <xsl:value-of select="$docidentifierISO_with_break"/>
2347
- <xsl:copy-of select="$docidentifier_another"/>
2434
+ <xsl:choose>
2435
+ <xsl:when test="$doctype = 'addendum'">
2436
+ <xsl:value-of select="substring-before($docidentifierISO_with_break, ':')"/>
2437
+ </xsl:when>
2438
+ <xsl:otherwise>
2439
+ <xsl:value-of select="$docidentifierISO_with_break"/>
2440
+ <xsl:copy-of select="$docidentifier_another"/>
2441
+ </xsl:otherwise>
2442
+ </xsl:choose>
2348
2443
  </fo:block>
2349
2444
  </fo:table-cell>
2350
2445
  </fo:table-row>
@@ -2358,6 +2453,23 @@
2358
2453
  </fo:block>
2359
2454
  <!-- <xsl:value-of select="$linebreak"/>
2360
2455
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
2456
+ <xsl:if test="$doctype = 'addendum'">
2457
+ <fo:block text-align="right" margin-right="0.5mm" role="SKIP">
2458
+ <fo:block font-weight="bold" margin-top="16pt">
2459
+ <xsl:value-of select="$doctype_uppercased"/>
2460
+ <xsl:text> </xsl:text>
2461
+ <xsl:variable name="addendum-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@addendum"/>
2462
+ <xsl:if test="normalize-space($addendum-number) != ''">
2463
+ <xsl:value-of select="$addendum-number"/><xsl:text> </xsl:text>
2464
+ </xsl:if>
2465
+ </fo:block>
2466
+ <fo:block>
2467
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']">
2468
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']"/>
2469
+ </xsl:if>
2470
+ </fo:block>
2471
+ </fo:block>
2472
+ </xsl:if>
2361
2473
  <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
2362
2474
  <fo:block text-align="right" margin-right="0.5mm" role="SKIP">
2363
2475
  <fo:block font-weight="bold" margin-top="4pt" role="H1">
@@ -2459,29 +2571,48 @@
2459
2571
  <xsl:call-template name="insertTripleLine"/>
2460
2572
  <fo:block-container line-height="1.1" role="SKIP">
2461
2573
  <fo:block margin-right="3.5mm" role="SKIP">
2462
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" role="H1">
2463
- <xsl:if test="$layoutVersion = '1989'">
2464
- <xsl:attribute name="font-size">16pt</xsl:attribute>
2465
- </xsl:if>
2574
+ <xsl:variable name="font_size">
2575
+ <xsl:choose>
2576
+ <xsl:when test="$layoutVersion = '1989'">16pt</xsl:when>
2577
+ <xsl:otherwise>18pt</xsl:otherwise>
2578
+ </xsl:choose>
2579
+ </xsl:variable>
2580
+ <fo:block font-size="{$font_size}" font-weight="bold" margin-top="12pt" role="H1">
2466
2581
  <xsl:call-template name="insertTitlesLangMain"/>
2467
2582
  </fo:block>
2468
2583
 
2469
- <xsl:if test="not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
2470
- <xsl:for-each select="xalan:nodeset($lang_other)/lang">
2471
- <xsl:variable name="lang_other" select="."/>
2472
-
2473
- <fo:block font-size="12pt" role="SKIP"><xsl:value-of select="$linebreak"/></fo:block>
2474
- <fo:block font-size="11pt" font-style="italic" line-height="1.1" role="H1">
2475
- <xsl:if test="$layoutVersion = '1989'">
2476
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2477
- </xsl:if>
2478
- <!-- Example: title-intro fr -->
2479
- <xsl:call-template name="insertTitlesLangOther">
2480
- <xsl:with-param name="lang_other" select="$lang_other"/>
2481
- </xsl:call-template>
2584
+ <xsl:choose>
2585
+ <xsl:when test="$doctype = 'addendum'">
2586
+ <fo:block font-size="{$font_size}" margin-top="6pt" role="H2">
2587
+ <xsl:value-of select="$doctype_uppercased"/>
2588
+ <xsl:text> </xsl:text>
2589
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@addendum"/>
2590
+ <xsl:text>:</xsl:text>
2482
2591
  </fo:block>
2483
- </xsl:for-each>
2484
- </xsl:if>
2592
+ <fo:block font-size="{$font_size}" font-weight="bold" margin-top="6pt" role="H2">
2593
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-add']/node()"/>
2594
+ </fo:block>
2595
+ </xsl:when>
2596
+ <xsl:otherwise>
2597
+ <xsl:if test="not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
2598
+ <xsl:for-each select="xalan:nodeset($lang_other)/lang">
2599
+ <xsl:variable name="lang_other" select="."/>
2600
+
2601
+ <fo:block font-size="12pt" role="SKIP"><xsl:value-of select="$linebreak"/></fo:block>
2602
+ <fo:block font-size="11pt" font-style="italic" line-height="1.1" role="H1">
2603
+ <xsl:if test="$layoutVersion = '1989'">
2604
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2605
+ </xsl:if>
2606
+ <!-- Example: title-intro fr -->
2607
+ <xsl:call-template name="insertTitlesLangOther">
2608
+ <xsl:with-param name="lang_other" select="$lang_other"/>
2609
+ </xsl:call-template>
2610
+ </fo:block>
2611
+ </xsl:for-each>
2612
+ </xsl:if>
2613
+
2614
+ </xsl:otherwise>
2615
+ </xsl:choose>
2485
2616
 
2486
2617
  <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FDIS' or $stagename_abbreviation = 'FDIS'">
2487
2618
  <fo:block margin-top="10mm">
@@ -2749,6 +2880,19 @@
2749
2880
  </xsl:if>
2750
2881
  </xsl:template>
2751
2882
 
2883
+ <!-- transform NOTE to Note for smallcaps feature working -->
2884
+ <xsl:template match="iso:note/iso:name/text() | iso:example/iso:name/text()" mode="update_xml_step1" priority="3">
2885
+ <xsl:choose>
2886
+ <xsl:when test="$layoutVersion = '1951'"> <!-- and $revision_date_num &lt; 19680101 -->
2887
+ <xsl:value-of select="substring(., 1, 1)"/>
2888
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new(substring(., 2)))"/>
2889
+ </xsl:when>
2890
+ <xsl:otherwise>
2891
+ <xsl:value-of select="."/>
2892
+ </xsl:otherwise>
2893
+ </xsl:choose>
2894
+ </xsl:template>
2895
+
2752
2896
  <xsl:template name="insertLogoImages2024">
2753
2897
  <xsl:variable name="content-height">20</xsl:variable>
2754
2898
  <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:copyright/iso:owner/iso:organization">
@@ -3202,9 +3346,21 @@
3202
3346
  </xsl:template>
3203
3347
 
3204
3348
  <xsl:template match="iso:bibdata/iso:title[@type = 'title-main']">
3349
+ <xsl:param name="body">false</xsl:param>
3205
3350
  <xsl:choose>
3206
3351
  <xsl:when test="$layoutVersion = '1951'">
3207
- <fo:block text-transform="uppercase" font-weight="bold" margin-top="5mm"><xsl:apply-templates/></fo:block>
3352
+ <fo:block text-transform="uppercase" font-weight="bold" margin-top="5mm">
3353
+ <xsl:if test="$revision_date_num &lt; 19680101">
3354
+ <xsl:if test="$body = 'false'">
3355
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
3356
+ </xsl:if>
3357
+ <xsl:if test="../iso:title[@type = 'title-intro']"> <!-- in title-intro and title-main exist both -->
3358
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
3359
+ </xsl:if>
3360
+ <xsl:attribute name="margin-top">3mm</xsl:attribute>
3361
+ </xsl:if>
3362
+ <xsl:apply-templates/>
3363
+ </fo:block>
3208
3364
  </xsl:when>
3209
3365
  <xsl:otherwise>
3210
3366
  <xsl:apply-templates/>
@@ -3271,7 +3427,7 @@
3271
3427
  </xsl:choose>
3272
3428
  </xsl:if>
3273
3429
  <xsl:choose>
3274
- <xsl:when test="$layoutVersion = '1951'"/>
3430
+ <xsl:when test="$layoutVersion = '1951'"><fo:inline font-weight="normal"><xsl:apply-templates/></fo:inline></xsl:when>
3275
3431
  <xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'true'"/>
3276
3432
  <xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'false'">
3277
3433
  <fo:inline font-weight="normal"><xsl:apply-templates/></fo:inline>
@@ -3319,32 +3475,68 @@
3319
3475
  </xsl:template>
3320
3476
 
3321
3477
  <xsl:template match="iso:sections//iso:p[@class = 'zzSTDTitle1']" priority="4">
3322
- <xsl:if test="not($layoutVersion = '1987' and $doctype = 'technical-report')">
3323
- <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
3324
- <xsl:if test="$layoutVersion = '1951'">
3325
- <xsl:attribute name="font-size">13pt</xsl:attribute>
3326
- <xsl:attribute name="text-align">center</xsl:attribute>
3327
- <xsl:attribute name="margin-top">49mm</xsl:attribute>
3328
- <xsl:attribute name="text-transform">uppercase</xsl:attribute>
3329
- <xsl:if test="$revision_date_num &gt;= 19690101">
3330
- <xsl:attribute name="font-family">Arial</xsl:attribute>
3331
- <xsl:attribute name="font-size">11pt</xsl:attribute>
3478
+ <xsl:choose>
3479
+ <xsl:when test="$layoutVersion = '1951'">
3480
+ <fo:block font-size="13pt" font-weight="bold" text-align="center" margin-top="49mm" margin-bottom="20mm" text-transform="uppercase" line-height="1.1" role="H1">
3481
+ <xsl:if test="$revision_date_num &gt;= 19680101">
3482
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
3483
+ <xsl:attribute name="font-size">10.5pt</xsl:attribute>
3484
+ <xsl:attribute name="margin-top">24mm</xsl:attribute>
3485
+ </xsl:if>
3486
+ <xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
3487
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3488
+ </xsl:if>
3489
+
3490
+ <xsl:choose>
3491
+ <xsl:when test="$revision_date_num &gt;= 19680101">
3492
+ <fo:block font-weight="normal"><xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/></fo:block>
3493
+ <fo:block space-before="24pt"><xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/></fo:block>
3494
+ </xsl:when>
3495
+ <xsl:otherwise>
3496
+
3497
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
3498
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']">
3499
+ <xsl:with-param name="body">true</xsl:with-param>
3500
+ </xsl:apply-templates>
3501
+ <fo:block font-size="11pt" text-transform="uppercase" margin-top="2mm">
3502
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
3503
+ </fo:block>
3504
+
3505
+ <!-- <xsl:apply-templates/> -->
3506
+ </xsl:otherwise>
3507
+ </xsl:choose>
3508
+
3509
+ </fo:block>
3510
+ </xsl:when>
3511
+ <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report'"/>
3512
+ <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
3513
+ <fo:block font-size="16pt" font-weight="bold" margin-top="40pt" margin-bottom="40pt" line-height="1.1" role="H1" span="all">
3514
+ <xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
3515
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3516
+ </xsl:if>
3517
+ <xsl:if test="$doctype = 'addendum'">
3518
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3519
+ </xsl:if>
3520
+ <xsl:apply-templates/>
3521
+ </fo:block>
3522
+ <xsl:if test="$doctype = 'addendum'">
3523
+ <fo:block font-size="12pt" font-weight="bold" role="H2" line-height="1.05" margin-top="6pt" margin-bottom="40pt">
3524
+ <xsl:call-template name="printAddendumTitle"/>
3525
+ </fo:block>
3332
3526
  </xsl:if>
3333
- </xsl:if>
3334
- <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
3335
- <xsl:attribute name="font-size">16pt</xsl:attribute>
3336
- <xsl:attribute name="span">all</xsl:attribute>
3337
- <xsl:attribute name="margin-bottom">40pt</xsl:attribute>
3338
- </xsl:if>
3339
- <xsl:if test="$layoutVersion = '2024'">
3340
- <xsl:attribute name="margin-top">50pt</xsl:attribute>
3341
- </xsl:if>
3342
- <xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
3343
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3344
- </xsl:if>
3345
- <xsl:apply-templates/>
3346
- </fo:block>
3347
- </xsl:if>
3527
+ </xsl:when>
3528
+ <xsl:otherwise>
3529
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1" role="H1">
3530
+ <xsl:if test="$layoutVersion = '2024'">
3531
+ <xsl:attribute name="margin-top">50pt</xsl:attribute>
3532
+ </xsl:if>
3533
+ <xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
3534
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3535
+ </xsl:if>
3536
+ <xsl:apply-templates/>
3537
+ </fo:block>
3538
+ </xsl:otherwise>
3539
+ </xsl:choose>
3348
3540
  </xsl:template>
3349
3541
 
3350
3542
  <xsl:template match="iso:sections//iso:p[@class = 'zzSTDTitle1']/iso:span[@class = 'nonboldtitle']" priority="3">
@@ -3382,6 +3574,10 @@
3382
3574
  <!-- END display titles -->
3383
3575
  <!-- ==================== -->
3384
3576
 
3577
+ <xsl:template match="*[local-name() = 'title']/*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="6">
3578
+ <fo:inline font-weight="normal"><xsl:value-of select="."/></fo:inline>
3579
+ </xsl:template>
3580
+
3385
3581
  <xsl:template match="node()">
3386
3582
  <xsl:apply-templates/>
3387
3583
  </xsl:template>
@@ -3506,7 +3702,7 @@
3506
3702
  <xsl:template match="iso:copyright-statement/iso:clause[1]/iso:title" priority="2">
3507
3703
  <xsl:choose>
3508
3704
  <xsl:when test="$layoutVersion = '1951'">
3509
- <fo:block font-weight="bold"><xsl:apply-templates/></fo:block>
3705
+ <fo:block><xsl:apply-templates/></fo:block> <!-- font-weight="bold" -->
3510
3706
  <fo:block> </fo:block>
3511
3707
  </xsl:when>
3512
3708
  <xsl:otherwise>
@@ -3570,7 +3766,7 @@
3570
3766
  </xsl:when>
3571
3767
  <xsl:when test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987'">
3572
3768
  <xsl:if test="@id = 'boilerplate-place'">
3573
- <fo:block margin-top="6pt"><xsl:if test="$layoutVersion = '1987' and $doctype = 'technical-report'"><xsl:attribute name="margin-top">0</xsl:attribute></xsl:if> </fo:block>
3769
+ <fo:block margin-top="6pt"><xsl:if test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))"><xsl:attribute name="margin-top">0</xsl:attribute></xsl:if> </fo:block>
3574
3770
  </xsl:if>
3575
3771
  <fo:block><xsl:apply-templates/></fo:block>
3576
3772
  </xsl:when>
@@ -3638,6 +3834,7 @@
3638
3834
  </xsl:template>
3639
3835
 
3640
3836
  <xsl:template match="iso:title" name="title">
3837
+ <xsl:param name="without_number">false</xsl:param>
3641
3838
 
3642
3839
  <xsl:variable name="level">
3643
3840
  <xsl:call-template name="getLevel"/>
@@ -3647,8 +3844,10 @@
3647
3844
  <xsl:choose>
3648
3845
  <xsl:when test="$layoutVersion = '1951'">
3649
3846
  <xsl:choose>
3847
+ <xsl:when test="$level = 1 and ancestor::iso:preface and $revision_date_num &gt;= 19680101">9.5pt</xsl:when> <!-- BRIEF HISTORY, FOREWORD -->
3650
3848
  <xsl:when test="$level = 1 and ancestor::iso:preface">13pt</xsl:when>
3651
- <xsl:when test="$level = 1">9pt</xsl:when>
3849
+ <xsl:when test="$revision_date_num &lt; 19680101 and ancestor::*[local-name() = 'sections'] and not(ancestor::*[local-name() = 'introduction'])">9pt</xsl:when>
3850
+ <!-- <xsl:when test="$level = 1">9pt</xsl:when> -->
3652
3851
  <xsl:otherwise>inherit</xsl:otherwise>
3653
3852
  <!-- <xsl:when test="$level = 2">10pt</xsl:when>
3654
3853
  <xsl:when test="$level &gt;= 3">9pt</xsl:when> -->
@@ -3660,7 +3859,7 @@
3660
3859
  <xsl:otherwise>9pt</xsl:otherwise>
3661
3860
  </xsl:choose>
3662
3861
  </xsl:when>
3663
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report'">
3862
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))">
3664
3863
  <xsl:choose>
3665
3864
  <xsl:when test="$level = 1">11pt</xsl:when>
3666
3865
  <xsl:when test="$level = 2">10pt</xsl:when>
@@ -3701,7 +3900,7 @@
3701
3900
  </xsl:choose>
3702
3901
  </xsl:otherwise>
3703
3902
  </xsl:choose>
3704
- </xsl:variable>
3903
+ </xsl:variable> <!-- font-size -->
3705
3904
 
3706
3905
  <xsl:variable name="element-name">
3707
3906
  <xsl:choose>
@@ -3712,7 +3911,7 @@
3712
3911
  </xsl:variable>
3713
3912
 
3714
3913
  <xsl:choose>
3715
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report' and parent::iso:foreword"><!-- skip Foreword title --></xsl:when>
3914
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum')) and parent::iso:foreword"><!-- skip Foreword title --></xsl:when>
3716
3915
  <xsl:when test="$doctype = 'amendment' and not(ancestor::iso:preface)">
3717
3916
  <fo:block font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always" role="H{$level}">
3718
3917
  <!-- <xsl:if test="$layoutVersion = '2024'">
@@ -3725,7 +3924,7 @@
3725
3924
 
3726
3925
  <xsl:otherwise>
3727
3926
 
3728
- <xsl:if test="$layoutVersion = '1987' and $doctype = 'technical-report' and parent::iso:introduction">
3927
+ <xsl:if test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum')) and parent::iso:introduction">
3729
3928
  <fo:block span="all" text-align="center" margin-top="15mm" keep-with-previous="always" role="SKIP">
3730
3929
  <fo:leader leader-pattern="rule" leader-length="12%"/>
3731
3930
  </fo:block>
@@ -3749,8 +3948,9 @@
3749
3948
  <xsl:attribute name="{$attribute-name-before}"> <!-- space-before or margin-top -->
3750
3949
  <xsl:choose>
3751
3950
  <xsl:when test="$layoutVersion = '1951' and ancestor::iso:preface and $level = 1">20mm</xsl:when>
3951
+ <xsl:when test="$layoutVersion = '1951' and $level = 1 and $revision_date_num &gt;= 19680101">12pt</xsl:when>
3752
3952
  <xsl:when test="ancestor::iso:introduction and $level &gt;= 2 and ../preceding-sibling::iso:clause">30pt</xsl:when>
3753
- <xsl:when test="$layoutVersion = '1987' and $doctype = 'technical-report' and ancestor::iso:preface and $level = 1">10mm</xsl:when>
3953
+ <xsl:when test="(($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum')) and ancestor::iso:preface and $level = 1">10mm</xsl:when>
3754
3954
  <xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or ($layoutVersion = '1989' and $revision_date_num &lt;= 19981231)) and ancestor::iso:preface and $level = 1">62mm</xsl:when>
3755
3955
  <xsl:when test="$layoutVersion = '1972' and $level = 1">30pt</xsl:when>
3756
3956
  <xsl:when test="$layoutVersion = '1989' and ancestor::iso:preface and $level = 1">56pt</xsl:when>
@@ -3769,6 +3969,9 @@
3769
3969
  <xsl:attribute name="space-after"> <!-- margin-bottom -->
3770
3970
  <xsl:choose>
3771
3971
  <xsl:when test="$layoutVersion = '1951' and $level = 1 and ancestor::iso:preface">14.7mm</xsl:when>
3972
+ <xsl:when test="$layoutVersion = '1951' and parent::iso:introduction and $revision_date_num &lt; 19680101">6mm</xsl:when>
3973
+ <xsl:when test="$layoutVersion = '1951' and parent::iso:introduction">2mm</xsl:when>
3974
+ <!-- <xsl:when test="$layoutVersion = '1951' and $revision_date_num &gt;= 19680101">4pt</xsl:when> -->
3772
3975
  <xsl:when test="$layoutVersion = '1951' and $level = 1">12pt</xsl:when>
3773
3976
  <xsl:when test="ancestor::iso:introduction and $level &gt;= 2">8pt</xsl:when>
3774
3977
  <xsl:when test="ancestor::iso:preface">18pt</xsl:when>
@@ -3785,8 +3988,13 @@
3785
3988
  </xsl:if>
3786
3989
  <xsl:if test="$layoutVersion = '1951'">
3787
3990
  <xsl:if test="$element-name = 'fo:block' and ($level = 1 or parent::iso:introduction)">
3991
+
3992
+ <xsl:if test="($revision_date_num &lt; 19690101) or ancestor::iso:preface or (parent::iso:introduction and $revision_date_num &gt;= 19680101)">
3788
3993
  <xsl:attribute name="text-align">center</xsl:attribute>
3994
+ </xsl:if>
3995
+
3789
3996
  <xsl:attribute name="text-transform">uppercase</xsl:attribute>
3997
+
3790
3998
  <xsl:if test="ancestor::iso:preface or ancestor::iso:introduction">
3791
3999
  <xsl:attribute name="font-weight">normal</xsl:attribute>
3792
4000
  </xsl:if>
@@ -3816,16 +4024,19 @@
3816
4024
  </xsl:choose>
3817
4025
  </xsl:if>
3818
4026
  <xsl:choose>
3819
- <xsl:when test="$layoutVersion = '1951' and ((ancestor::iso:preface and $level = 1) or parent::iso:introduction)">
4027
+ <xsl:when test="$layoutVersion = '1951' and ((ancestor::iso:preface and $level = 1) or (parent::iso:introduction and $revision_date_num &lt; 19680101))">
3820
4028
  <xsl:call-template name="add-letter-spacing">
3821
4029
  <xsl:with-param name="text" select="."/>
3822
4030
  <xsl:with-param name="letter-spacing" select="0.65"/>
3823
4031
  </xsl:call-template>
3824
4032
  </xsl:when>
3825
-
3826
- <xsl:when test="$layoutVersion = '1972' and ($level = 3 or $level = 4)">
3827
- <fo:inline><xsl:apply-templates select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/></fo:inline>
3828
- <xsl:apply-templates select="*[local-name() = 'tab'][1]"/>
4033
+ <xsl:when test="($layoutVersion = '1951' or $layoutVersion = '1972') and ($level = 3 or $level = 4) and *[local-name() = 'tab']">
4034
+ <xsl:if test="$without_number = 'false'">
4035
+ <fo:inline>
4036
+ <xsl:apply-templates select="*[local-name() = 'tab'][1]/preceding-sibling::node() | node()"/>
4037
+ </fo:inline>
4038
+ <xsl:apply-templates select="*[local-name() = 'tab'][1]"/>
4039
+ </xsl:if>
3829
4040
  <xsl:choose>
3830
4041
  <xsl:when test="$level = 3">
3831
4042
  <fo:inline font-weight="normal" font-style="italic"><xsl:apply-templates select="*[local-name() = 'tab'][1]/following-sibling::node()"/></fo:inline>
@@ -3876,10 +4087,18 @@
3876
4087
  </xsl:otherwise> <!-- END: $level = 4 -->
3877
4088
  </xsl:choose>
3878
4089
 
3879
- </xsl:when>
4090
+ </xsl:when> <!-- $layoutVersion = '1972' and ($level = 3 or $level = 4) -->
3880
4091
 
3881
4092
  <xsl:otherwise>
3882
- <xsl:apply-templates/>
4093
+ <xsl:choose>
4094
+ <xsl:when test="$without_number = 'true'">
4095
+ <xsl:apply-templates select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4096
+ </xsl:when>
4097
+ <xsl:otherwise>
4098
+ <xsl:apply-templates/>
4099
+ </xsl:otherwise>
4100
+ </xsl:choose>
4101
+
3883
4102
  </xsl:otherwise>
3884
4103
  </xsl:choose>
3885
4104
  <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
@@ -3895,10 +4114,13 @@
3895
4114
  </xsl:template>
3896
4115
 
3897
4116
  <xsl:template match="iso:title[../@inline-header = 'true'][following-sibling::*[1][local-name() = 'p']]" priority="3">
4117
+ <xsl:param name="without_number">false</xsl:param>
3898
4118
  <xsl:choose>
3899
4119
  <xsl:when test="($layoutVersion = '1951' or $layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989') and $layout_columns != 1"/> <!-- don't show 'title' with inline-header='true' if next element is 'p' -->
3900
4120
  <xsl:otherwise>
3901
- <xsl:call-template name="title"/>
4121
+ <xsl:call-template name="title">
4122
+ <xsl:with-param name="without_number" select="$without_number"/>
4123
+ </xsl:call-template>
3902
4124
  </xsl:otherwise>
3903
4125
  </xsl:choose>
3904
4126
  </xsl:template>
@@ -3922,7 +4144,7 @@
3922
4144
  <xsl:choose>
3923
4145
  <xsl:when test="($layoutVersion = '1951' or $layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989') and local-name() = 'clause' and count(node()) = 0 and following-sibling::*[1][local-name() = 'title' and not(@id)]"/> <!-- @id will be added to title -->
3924
4146
  <xsl:otherwise>
3925
- <xsl:call-template name="template_clause"/>
4147
+ <xsl:call-template name="template_clause_iso"/>
3926
4148
  </xsl:otherwise>
3927
4149
  </xsl:choose>
3928
4150
  </xsl:template>
@@ -3990,9 +4212,16 @@
3990
4212
  <xsl:if test="$layoutVersion = '1951'">
3991
4213
  <xsl:if test="not(ancestor::*[local-name() = 'li' or local-name() = 'td' or local-name() = 'th' or local-name() = 'dd'])">
3992
4214
  <!-- for paragraphs in the main text -->
3993
- <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
4215
+ <xsl:choose>
4216
+ <xsl:when test="$revision_date_num &lt; 19600101">
4217
+ <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
4218
+ </xsl:when>
4219
+ <xsl:otherwise>
4220
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4221
+ </xsl:otherwise>
4222
+ </xsl:choose>
3994
4223
  </xsl:if>
3995
- <xsl:if test="ancestor::iso:preface and parent::iso:clause">
4224
+ <xsl:if test="(ancestor::iso:preface and parent::iso:clause) or ancestor::iso:foreword">
3996
4225
  <xsl:attribute name="text-indent">7.1mm</xsl:attribute>
3997
4226
  </xsl:if>
3998
4227
  </xsl:if>
@@ -4092,6 +4321,16 @@
4092
4321
 
4093
4322
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/text()" priority="5">
4094
4323
  <xsl:choose>
4324
+ <xsl:when test="$layoutVersion = '1951' and not(translate(.,'0123456789','') = .)"> <!-- NOTE with number -->
4325
+ <fo:inline padding-right="2mm" role="SKIP">
4326
+ <xsl:value-of select="substring-after(., ' ')"/>
4327
+ <xsl:text>. </xsl:text>
4328
+ </fo:inline>
4329
+ </xsl:when>
4330
+ <xsl:when test="$layoutVersion = '1951'"> <!-- and $revision_date_num &lt; 19610101 -->
4331
+ <xsl:call-template name="smallcaps"/>
4332
+ <xsl:value-of select="concat('. ', $em_dash, ' ')"/>
4333
+ </xsl:when>
4095
4334
  <xsl:when test="$layoutVersion = '1987' and not(translate(.,'0123456789','') = .)"> <!-- NOTE with number -->
4096
4335
  <xsl:value-of select="substring-after(., ' ')"/>
4097
4336
  </xsl:when>
@@ -4099,6 +4338,52 @@
4099
4338
  </xsl:choose>
4100
4339
  </xsl:template>
4101
4340
 
4341
+ <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']/text()" priority="5">
4342
+ <xsl:choose>
4343
+ <xsl:when test="$layoutVersion = '1951'"> <!-- and $revision_date_num &lt; 19610101 -->
4344
+ <xsl:call-template name="smallcaps"/>
4345
+ <xsl:text>:</xsl:text>
4346
+ </xsl:when>
4347
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4348
+ </xsl:choose>
4349
+ </xsl:template>
4350
+
4351
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']/text()" priority="5">
4352
+ <xsl:choose>
4353
+ <xsl:when test="$layoutVersion = '1951' and not(ancestor::*[local-name() = 'figure'][1]/@unnumbered = 'true') and not(preceding-sibling::node())">
4354
+ <xsl:choose>
4355
+ <xsl:when test="contains(., '—')">
4356
+ <xsl:call-template name="smallcaps">
4357
+ <xsl:with-param name="txt" select="substring-before(., '—')"/>
4358
+ </xsl:call-template>
4359
+ <xsl:text>— </xsl:text>
4360
+ <xsl:value-of select="substring-after(., '—')"/>
4361
+ </xsl:when>
4362
+ <xsl:otherwise><xsl:call-template name="smallcaps"/></xsl:otherwise>
4363
+ </xsl:choose>
4364
+ </xsl:when>
4365
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4366
+ </xsl:choose>
4367
+ </xsl:template>
4368
+
4369
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'name']/text()" priority="5">
4370
+ <xsl:choose>
4371
+ <xsl:when test="$layoutVersion = '1951' and not(ancestor::*[local-name() = 'table'][1]/@unnumbered = 'true') and not(preceding-sibling::node())">
4372
+ <xsl:choose>
4373
+ <xsl:when test="contains(., '—')">
4374
+ <xsl:call-template name="smallcaps">
4375
+ <xsl:with-param name="txt" select="substring-before(., '—')"/>
4376
+ </xsl:call-template>
4377
+ <xsl:text>— </xsl:text>
4378
+ <xsl:value-of select="substring-after(., '—')"/>
4379
+ </xsl:when>
4380
+ <xsl:otherwise><xsl:call-template name="smallcaps"/></xsl:otherwise>
4381
+ </xsl:choose>
4382
+ </xsl:when>
4383
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4384
+ </xsl:choose>
4385
+ </xsl:template>
4386
+
4102
4387
  <xsl:template match="iso:clause[@type = 'section']" priority="3">
4103
4388
  <xsl:choose>
4104
4389
  <!-- skip empty clause after templates mode="update_xml_step_move_pagebreak" -->
@@ -4116,6 +4401,104 @@
4116
4401
  </xsl:choose>
4117
4402
  </xsl:template>
4118
4403
 
4404
+ <!-- main sections -->
4405
+ <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node_iso" priority="3">
4406
+ <fo:block>
4407
+ <xsl:call-template name="setId"/>
4408
+
4409
+ <xsl:call-template name="sections_element_style"/>
4410
+
4411
+ <xsl:if test="$layoutVersion = '1951' and $revision_date_num &gt;= 19680101">
4412
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
4413
+ <xsl:if test="self::iso:introduction">
4414
+ <xsl:attribute name="space-after">36pt</xsl:attribute>
4415
+ </xsl:if>
4416
+ </xsl:if>
4417
+
4418
+ <xsl:call-template name="processElementContent"/>
4419
+ </fo:block>
4420
+ </xsl:template>
4421
+
4422
+ <xsl:template match="*[local-name() = 'sections' or local-name() = 'annex']//*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause_iso"> <!-- if clause isn't empty -->
4423
+ <fo:block>
4424
+ <xsl:if test="parent::*[local-name() = 'copyright-statement']">
4425
+ <xsl:attribute name="role">SKIP</xsl:attribute>
4426
+ </xsl:if>
4427
+
4428
+ <xsl:call-template name="setId"/>
4429
+
4430
+ <xsl:call-template name="setBlockSpanAll"/>
4431
+
4432
+ <xsl:call-template name="refine_clause_style"/>
4433
+
4434
+ <xsl:call-template name="processElementContent"/>
4435
+
4436
+ </fo:block>
4437
+ </xsl:template>
4438
+
4439
+ <xsl:template name="processElementContent">
4440
+ <xsl:variable name="level">
4441
+ <xsl:call-template name="getLevel">
4442
+ <xsl:with-param name="depth" select="iso:title/@depth"/>
4443
+ </xsl:call-template>
4444
+ </xsl:variable>
4445
+ <xsl:choose>
4446
+ <xsl:when test="$layoutVersion = '1951' and ($revision_date_num &gt;= 19690101 or $level &gt;= 2) and ancestor::*[local-name() = 'sections' or local-name() = 'annex'] and not(self::iso:introduction)">
4447
+
4448
+ <fo:list-block role="SKIP">
4449
+ <xsl:attribute name="provisional-distance-between-starts">
4450
+ <xsl:choose>
4451
+ <xsl:when test="$level = 2">8mm</xsl:when>
4452
+ <xsl:when test="$level = 3">12mm</xsl:when>
4453
+ <xsl:when test="$level = 4">14mm</xsl:when>
4454
+ <xsl:when test="$level &gt; 4">16mm</xsl:when>
4455
+ <xsl:otherwise>6mm</xsl:otherwise>
4456
+ </xsl:choose>
4457
+ </xsl:attribute>
4458
+
4459
+ <fo:list-item>
4460
+ <fo:list-item-label end-indent="label-end()">
4461
+ <fo:block>
4462
+ <xsl:variable name="element_title">
4463
+ <xsl:apply-templates select="iso:title"/>
4464
+ </xsl:variable>
4465
+ <xsl:for-each select="xalan:nodeset($element_title)/*[1]"> <!-- process fo: element -->
4466
+ <xsl:copy-of select="@font-size"/>
4467
+ <xsl:copy-of select="@role"/>
4468
+ <xsl:copy-of select="@font-weight"/>
4469
+ <xsl:copy-of select="@font-style"/>
4470
+ </xsl:for-each>
4471
+ <xsl:value-of select="xalan:nodeset($element_title)/*[1]/node()[1]"/>
4472
+ </fo:block>
4473
+ </fo:list-item-label>
4474
+ <fo:list-item-body start-indent="body-start()">
4475
+ <fo:block>
4476
+ <xsl:apply-templates select="iso:title">
4477
+ <xsl:with-param name="without_number">true</xsl:with-param>
4478
+ </xsl:apply-templates>
4479
+ <xsl:apply-templates select="node()[not(local-name() = 'title')]"/>
4480
+ </fo:block>
4481
+ </fo:list-item-body>
4482
+ </fo:list-item>
4483
+ </fo:list-block>
4484
+
4485
+ </xsl:when>
4486
+ <xsl:otherwise>
4487
+ <xsl:apply-templates/>
4488
+ </xsl:otherwise>
4489
+ </xsl:choose>
4490
+ </xsl:template>
4491
+
4492
+ <!-- page_sequence/sections/clause -->
4493
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="3">
4494
+ <xsl:choose>
4495
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
4496
+ <xsl:otherwise>
4497
+ <xsl:call-template name="sections_node_iso"/>
4498
+ </xsl:otherwise>
4499
+ </xsl:choose>
4500
+ </xsl:template>
4501
+
4119
4502
  <!-- =================== -->
4120
4503
  <!-- Index processing -->
4121
4504
  <!-- =================== -->
@@ -4256,7 +4639,7 @@
4256
4639
  </xsl:call-template>
4257
4640
  <xsl:choose>
4258
4641
  <xsl:when test="$layoutVersion = '1951'"/>
4259
- <xsl:when test="not($layoutVersion = '1987' and $doctype = 'technical-report') and $insert_header_first = 'true'">
4642
+ <xsl:when test="not((($layoutVersion = '1987' and $doctype = 'technical-report') or ($layoutVersion = '1979' and $doctype = 'addendum'))) and $insert_header_first = 'true'">
4260
4643
  <xsl:call-template name="insertHeaderFirst"/>
4261
4644
  </xsl:when>
4262
4645
  </xsl:choose>
@@ -4443,9 +4826,9 @@
4443
4826
  <fo:block> </fo:block>
4444
4827
  </fo:table-cell>
4445
4828
  <fo:table-cell padding-top="-0.5mm">
4446
- <fo:block font-size="9.5pt" text-align="center">
4829
+ <fo:block font-size="9.5pt" font-weight="normal" text-align="center">
4447
4830
  <xsl:if test="$revision_date_num &gt;= 19690101">
4448
- <xsl:value-of select="$em_dash"/>  <fo:page-number/>  <xsl:value-of select="$em_dash"/>
4831
+ <xsl:value-of select="$en_dash"/>  <fo:page-number/>  <xsl:value-of select="$en_dash"/>
4449
4832
  </xsl:if>
4450
4833
  </fo:block>
4451
4834
  </fo:table-cell>
@@ -4635,13 +5018,26 @@
4635
5018
  <fo:table-row>
4636
5019
  <fo:table-cell font-size="8pt">
4637
5020
  <fo:block line-height="1" margin-top="2mm">
4638
- <xsl:variable name="date_first_printing" select="normalize-space(/iso:iso-standard/iso:metanorma-extension/iso:presentation-metadata/iso:first-printing-date)"/>
4639
- <xsl:if test="$insert_footer_last = 'true' and $date_first_printing != ''">
4640
- <fo:block><xsl:value-of select="$i18n_date_first_printing"/>:</fo:block>
5021
+ <!-- <xsl:variable name="date_first_printing" select="normalize-space(/iso:iso-standard/iso:metanorma-extension/iso:presentation-metadata/iso:first-printing-date)"/> -->
5022
+ <xsl:variable name="number_printing" select="normalize-space(/iso:iso-standard/iso:metanorma-extension/iso:presentation-metadata[iso:printing-date][1]/iso:printing-date)"/>
5023
+ <xsl:variable name="date_printing" select="normalize-space(/iso:iso-standard/iso:metanorma-extension/iso:presentation-metadata[iso:printing-date][last()]/iso:printing-date)"/>
5024
+ <xsl:if test="$insert_footer_last = 'true' and $date_printing != ''">
5025
+ <xsl:variable name="date_number_printing">
5026
+ <xsl:choose>
5027
+ <xsl:when test="$number_printing != $date_printing">
5028
+ <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($i18n_date_printing), '%', $number_printing)"/> -->
5029
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:date-printing"/>
5030
+ </xsl:when>
5031
+ <xsl:otherwise>
5032
+ <xsl:value-of select="$i18n_date_first_printing"/>
5033
+ </xsl:otherwise>
5034
+ </xsl:choose>
5035
+ </xsl:variable>
5036
+ <fo:block><xsl:value-of select="$date_number_printing"/>:</fo:block>
4641
5037
  <fo:block>
4642
5038
  <!-- Example: December 1965 -->
4643
5039
  <xsl:call-template name="convertDate">
4644
- <xsl:with-param name="date" select="$date_first_printing"/>
5040
+ <xsl:with-param name="date" select="$date_printing"/>
4645
5041
  </xsl:call-template>
4646
5042
  </fo:block>
4647
5043
  </xsl:if>
@@ -4658,9 +5054,19 @@
4658
5054
  <fo:block font-size="8.5pt" text-align="right" font-weight="bold">
4659
5055
  <xsl:variable name="price_" select="normalize-space(/iso:iso-standard/iso:metanorma-extension/iso:presentation-metadata/iso:price)"/>
4660
5056
  <xsl:variable name="price" select="java:replaceAll(java:java.lang.String.new($price_), '-{2}', $em_dash)"/>
4661
- <xsl:if test="$insert_footer_last = 'true' and $price != ''">
4662
- <!-- Example: Price: Sw. fr. 3.- -->
4663
- <xsl:value-of select="concat($i18n_price, ': ', $price)"/>
5057
+ <xsl:if test="$insert_footer_last = 'true'">
5058
+
5059
+ <xsl:choose>
5060
+ <xsl:when test="$price != ''">
5061
+ <!-- Example: Price: Sw. fr. 3.- -->
5062
+ <xsl:value-of select="concat($i18n_price, ': ', $price)"/>
5063
+ </xsl:when>
5064
+ <xsl:otherwise>
5065
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
5066
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5067
+ <xsl:call-template name="insertPriceBasedOn"/>
5068
+ </xsl:otherwise>
5069
+ </xsl:choose>
4664
5070
  </xsl:if>
4665
5071
  </fo:block>
4666
5072
  </fo:table-cell>
@@ -4720,6 +5126,15 @@
4720
5126
  </xsl:call-template>
4721
5127
  </xsl:variable>
4722
5128
 
5129
+ <xsl:template name="insertPriceBasedOn">
5130
+ <xsl:for-each select="xalan:nodeset($price_based_on_items)/item">
5131
+ <xsl:value-of select="."/>
5132
+ <xsl:if test="position() != last()">
5133
+ <fo:page-number-citation ref-id="lastBlock"/>
5134
+ </xsl:if>
5135
+ </xsl:for-each>
5136
+ </xsl:template>
5137
+
4723
5138
  <xsl:template name="insertLastPage">
4724
5139
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
4725
5140
  <xsl:call-template name="insertHeaderEven"/>
@@ -5811,6 +6226,9 @@
5811
6226
  <xsl:if test="starts-with(@id, 'array_')">
5812
6227
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
5813
6228
  </xsl:if>
6229
+ <xsl:if test="$layoutVersion = '1951'">
6230
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
6231
+ </xsl:if>
5814
6232
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
5815
6233
  <xsl:if test="normalize-space(@width) != 'text-width'">
5816
6234
  <xsl:attribute name="span">all</xsl:attribute>
@@ -5865,6 +6283,9 @@
5865
6283
  <xsl:if test="$continued = 'true'">
5866
6284
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
5867
6285
  </xsl:if>
6286
+ <xsl:if test="$layoutVersion = '1951'">
6287
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
6288
+ </xsl:if>
5868
6289
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
5869
6290
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5870
6291
  <xsl:if test="normalize-space(../@width) != 'text-width'">
@@ -6198,6 +6619,11 @@
6198
6619
 
6199
6620
  <xsl:template name="refine_note-style">
6200
6621
 
6622
+ <xsl:if test="$layoutVersion = '1951'">
6623
+ <!-- <xsl:if test="$revision_date_num &lt; 19680101"> -->
6624
+ <xsl:attribute name="font-size">8.5pt</xsl:attribute>
6625
+ <!-- </xsl:if> -->
6626
+ </xsl:if>
6201
6627
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
6202
6628
  <xsl:attribute name="font-size">9pt</xsl:attribute>
6203
6629
  </xsl:if>
@@ -6230,6 +6656,11 @@
6230
6656
  <xsl:template name="refine_note-name-style">
6231
6657
 
6232
6658
  <xsl:variable name="note_name" select="*[local-name() = 'name']"/>
6659
+ <xsl:if test="$layoutVersion = '1951'">
6660
+ <xsl:if test="$revision_date_num"> <!-- &lt; 19610101 -->
6661
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
6662
+ </xsl:if>
6663
+ </xsl:if>
6233
6664
  <xsl:if test="$layoutVersion = '1987'">
6234
6665
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6235
6666
  <xsl:if test="not(translate($note_name,'0123456789','') = $note_name)"> <!-- NOTE with number -->
@@ -6621,6 +7052,11 @@
6621
7052
 
6622
7053
  <xsl:template name="refine_fn-body-style">
6623
7054
 
7055
+ <xsl:if test="$layoutVersion = '1951'">
7056
+ <xsl:if test="$revision_date_num &gt;= 19680101">
7057
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
7058
+ </xsl:if>
7059
+ </xsl:if>
6624
7060
  <xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
6625
7061
  <xsl:attribute name="font-size">9pt</xsl:attribute>
6626
7062
  </xsl:if>
@@ -7727,6 +8163,9 @@
7727
8163
 
7728
8164
  <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
7729
8165
 
8166
+ <xsl:if test="$layoutVersion = '1951'">
8167
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
8168
+ </xsl:if>
7730
8169
  <xsl:if test="$layoutVersion = '2024'">
7731
8170
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
7732
8171
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
@@ -8740,9 +9179,17 @@
8740
9179
  </xsl:choose>
8741
9180
  </xsl:variable>
8742
9181
  <xsl:variable name="current_fn_number_text">
8743
- <xsl:value-of select="$current_fn_number"/>
8744
9182
 
8745
- <xsl:text>)</xsl:text>
9183
+ <xsl:choose>
9184
+ <xsl:when test="$layoutVersion = '1951' and translate($current_fn_number, '0123456789', '') = ''">
9185
+ <!-- replace number to asterisks -->
9186
+ <xsl:call-template name="repeat">
9187
+ <xsl:with-param name="char" select="'*'"/>
9188
+ <xsl:with-param name="count" select="$current_fn_number"/>
9189
+ </xsl:call-template>
9190
+ </xsl:when>
9191
+ <xsl:otherwise><xsl:value-of select="$current_fn_number"/><xsl:text>)</xsl:text></xsl:otherwise>
9192
+ </xsl:choose>
8746
9193
 
8747
9194
  </xsl:variable>
8748
9195
 
@@ -8782,8 +9229,10 @@
8782
9229
 
8783
9230
  <xsl:call-template name="insert_basic_link">
8784
9231
  <xsl:with-param name="element">
8785
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
8786
- <xsl:copy-of select="$current_fn_number_text"/>
9232
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
9233
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
9234
+ <xsl:copy-of select="$current_fn_number_text"/>
9235
+ </fo:inline>
8787
9236
  </fo:basic-link>
8788
9237
  </xsl:with-param>
8789
9238
  </xsl:call-template>
@@ -9064,7 +9513,7 @@
9064
9513
 
9065
9514
  <xsl:call-template name="refine_fn-reference-style"/>
9066
9515
 
9067
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9516
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9068
9517
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9069
9518
  <xsl:attribute name="internal-destination">
9070
9519
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -10088,12 +10537,23 @@
10088
10537
  </fo:inline>
10089
10538
  </xsl:template>
10090
10539
 
10091
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
10540
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
10541
+ <xsl:param name="txt"/>
10092
10542
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
10093
- <xsl:variable name="text" select="."/>
10543
+ <xsl:variable name="text">
10544
+ <xsl:choose>
10545
+ <xsl:when test="$txt != ''">
10546
+ <xsl:value-of select="$txt"/>
10547
+ </xsl:when>
10548
+ <xsl:otherwise>
10549
+ <xsl:value-of select="."/>
10550
+ </xsl:otherwise>
10551
+ </xsl:choose>
10552
+ </xsl:variable>
10094
10553
  <xsl:variable name="ratio_">
10095
10554
 
10096
10555
  <xsl:choose>
10556
+ <xsl:when test="$layoutVersion = '1951'">0.9</xsl:when>
10097
10557
  <xsl:when test="$layoutVersion = '2024'">0.8</xsl:when>
10098
10558
  <xsl:otherwise>0.75</xsl:otherwise>
10099
10559
  </xsl:choose>
@@ -11619,9 +12079,12 @@
11619
12079
  <xsl:apply-templates/>
11620
12080
  </xsl:when>
11621
12081
  <xsl:otherwise>
12082
+ <xsl:variable name="alt_text">
12083
+ <xsl:call-template name="getAltText"/>
12084
+ </xsl:variable>
11622
12085
  <xsl:call-template name="insert_basic_link">
11623
12086
  <xsl:with-param name="element">
11624
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
12087
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
11625
12088
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
11626
12089
  <xsl:attribute name="role">Annot</xsl:attribute>
11627
12090
  </xsl:if>
@@ -11648,6 +12111,14 @@
11648
12111
  </fo:inline>
11649
12112
  </xsl:template> <!-- link -->
11650
12113
 
12114
+ <xsl:template name="getAltText">
12115
+ <xsl:choose>
12116
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
12117
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
12118
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
12119
+ </xsl:choose>
12120
+ </xsl:template>
12121
+
11651
12122
  <!-- ======================== -->
11652
12123
  <!-- Appendix processing -->
11653
12124
  <!-- ======================== -->
@@ -11678,7 +12149,7 @@
11678
12149
  <xsl:template match="*[local-name() = 'callout']">
11679
12150
  <xsl:choose>
11680
12151
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
11681
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
12152
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
11682
12153
  </xsl:choose>
11683
12154
  </xsl:template>
11684
12155
 
@@ -11707,7 +12178,10 @@
11707
12178
  <xsl:template match="*[local-name() = 'xref']">
11708
12179
  <xsl:call-template name="insert_basic_link">
11709
12180
  <xsl:with-param name="element">
11710
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
12181
+ <xsl:variable name="alt_text">
12182
+ <xsl:call-template name="getAltText"/>
12183
+ </xsl:variable>
12184
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
11711
12185
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
11712
12186
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
11713
12187
  </xsl:if>
@@ -11864,13 +12338,25 @@
11864
12338
 
11865
12339
  <xsl:template name="refine_note_block_style">
11866
12340
 
11867
- <xsl:if test="$layoutVersion = '1987'">
12341
+ <xsl:if test="$layoutVersion = '1951' or $layoutVersion = '1987'">
11868
12342
  <xsl:if test="following-sibling::*[1][self::iso:note] and not(preceding-sibling::*[1][self::iso:note])">
11869
12343
  <!-- NOTES -->
11870
12344
  <fo:block font-size="9.5pt" keep-with-next="always" margin-bottom="6pt" text-transform="uppercase">
11871
- <xsl:call-template name="getLocalizedString">
11872
- <xsl:with-param name="key">Note.pl</xsl:with-param>
11873
- </xsl:call-template>
12345
+ <xsl:variable name="i18n_notes">
12346
+ <xsl:call-template name="getLocalizedString">
12347
+ <xsl:with-param name="key">Note.pl</xsl:with-param>
12348
+ </xsl:call-template>
12349
+ </xsl:variable>
12350
+ <xsl:choose>
12351
+ <xsl:when test="$layoutVersion = '1951'">
12352
+ <xsl:call-template name="smallcaps">
12353
+ <xsl:with-param name="txt" select="$i18n_notes"/>
12354
+ </xsl:call-template>
12355
+ </xsl:when>
12356
+ <xsl:otherwise>
12357
+ <xsl:value-of select="$i18n_notes"/>
12358
+ </xsl:otherwise>
12359
+ </xsl:choose>
11874
12360
  </fo:block>
11875
12361
  </xsl:if>
11876
12362
  </xsl:if>
@@ -14173,7 +14659,12 @@
14173
14659
 
14174
14660
  <xsl:variable name="fo_element">
14175
14661
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
14176
- inline
14662
+
14663
+ <xsl:choose>
14664
+ <xsl:when test="$layoutVersion = '1951' and $revision_date_num &lt; 19610101">list</xsl:when>
14665
+ <xsl:otherwise>inline</xsl:otherwise>
14666
+ </xsl:choose>
14667
+
14177
14668
  </xsl:variable>
14178
14669
 
14179
14670
  <fo:block-container margin-left="0mm" role="SKIP">
@@ -14208,12 +14699,14 @@
14208
14699
 
14209
14700
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
14210
14701
 
14211
- <xsl:variable name="provisional_distance_between_starts">
14212
- 7
14702
+ <xsl:variable name="provisional_distance_between_starts_">
14703
+ 45
14213
14704
  </xsl:variable>
14214
- <xsl:variable name="indent">
14215
- 0
14705
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
14706
+ <xsl:variable name="indent_">
14707
+ 28
14216
14708
  </xsl:variable>
14709
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
14217
14710
 
14218
14711
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
14219
14712
  <fo:list-item>
@@ -14304,7 +14797,12 @@
14304
14797
 
14305
14798
  <xsl:choose>
14306
14799
  <xsl:when test="$num = 1 and not(contains($fo_element, 'block'))">inline</xsl:when>
14307
- <xsl:otherwise>block</xsl:otherwise>
14800
+ <xsl:otherwise>
14801
+ <xsl:choose>
14802
+ <xsl:when test="$layoutVersion = '1951' and $revision_date_num &lt; 19610101">list</xsl:when>
14803
+ <xsl:otherwise>block</xsl:otherwise>
14804
+ </xsl:choose>
14805
+ </xsl:otherwise>
14308
14806
  </xsl:choose>
14309
14807
 
14310
14808
  <xsl:value-of select="$fo_element"/>
@@ -14606,6 +15104,7 @@
14606
15104
  <xsl:variable name="padding">
14607
15105
 
14608
15106
  <xsl:choose>
15107
+ <xsl:when test="$layoutVersion = '1951'">2</xsl:when>
14609
15108
  <xsl:when test="$depth = 2">3</xsl:when>
14610
15109
  <xsl:otherwise>4</xsl:otherwise>
14611
15110
  </xsl:choose>
@@ -14899,7 +15398,14 @@
14899
15398
  <!-- ===================================== -->
14900
15399
  <xsl:variable name="ul_labels_">
14901
15400
 
14902
- <label>—</label> <!-- em dash -->
15401
+ <xsl:choose>
15402
+ <xsl:when test="$layoutVersion = '1951'">
15403
+ <label>–</label> <!-- en dash -->
15404
+ </xsl:when>
15405
+ <xsl:otherwise>
15406
+ <label>—</label> <!-- em dash -->
15407
+ </xsl:otherwise>
15408
+ </xsl:choose>
14903
15409
 
14904
15410
  </xsl:variable>
14905
15411
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
@@ -14947,14 +15453,19 @@
14947
15453
  </xsl:when>
14948
15454
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
14949
15455
 
14950
- <xsl:variable name="label">
15456
+ <xsl:variable name="type" select="../@type"/>
14951
15457
 
14952
- <xsl:variable name="type" select="../@type"/>
15458
+ <xsl:variable name="label">
14953
15459
 
14954
15460
  <xsl:variable name="style_prefix_">
14955
15461
  <xsl:if test="$type = 'roman'">
14956
15462
  <!-- Example: (i) -->
14957
15463
  </xsl:if>
15464
+ <xsl:if test="$type = 'alphabet'">
15465
+
15466
+ <xsl:if test="$layoutVersion = '1951'">(</xsl:if> <!-- Example: (a) -->
15467
+
15468
+ </xsl:if>
14958
15469
  </xsl:variable>
14959
15470
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
14960
15471
 
@@ -14980,13 +15491,20 @@
14980
15491
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
14981
15492
  <xsl:value-of select="$style_prefix"/>
14982
15493
  </xsl:if>
15494
+
14983
15495
  <xsl:value-of select="@label"/>
15496
+
14984
15497
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
14985
15498
  <xsl:value-of select="$style_suffix"/>
14986
15499
  </xsl:if>
14987
15500
  </xsl:variable>
14988
15501
 
14989
- <xsl:value-of select="normalize-space($label)"/>
15502
+ <xsl:choose>
15503
+ <xsl:when test="$layoutVersion = '1951' and $type = 'alphabet'">(<fo:inline font-style="italic"><xsl:value-of select="@label"/></fo:inline>)</xsl:when>
15504
+ <xsl:otherwise>
15505
+ <xsl:value-of select="normalize-space($label)"/>
15506
+ </xsl:otherwise>
15507
+ </xsl:choose>
14990
15508
 
14991
15509
  </xsl:when>
14992
15510
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15091,11 +15609,37 @@
15091
15609
  </xsl:when>
15092
15610
  <xsl:otherwise>
15093
15611
 
15094
- <fo:block role="SKIP">
15095
- <xsl:apply-templates select="." mode="list">
15096
- <xsl:with-param name="indent" select="$indent"/>
15097
- </xsl:apply-templates>
15098
- </fo:block>
15612
+ <xsl:choose>
15613
+ <xsl:when test="$layoutVersion = '1951' and local-name() = 'ul'">
15614
+ <fo:block-container margin-left="8mm">
15615
+ <xsl:if test="ancestor::*[local-name() = 'sections' or local-name() = 'annex']">
15616
+ <xsl:variable name="level">
15617
+ <xsl:for-each select="ancestor::*[1]">
15618
+ <xsl:call-template name="getLevel"/>
15619
+ </xsl:for-each>
15620
+ </xsl:variable>
15621
+ <!-- 5 + 6 (from list-block provisional-distance-between-starts) mm -->
15622
+ <xsl:attribute name="margin-left">
15623
+ <xsl:value-of select="5 + (($level - 1) * 6)"/>mm
15624
+ </xsl:attribute>
15625
+ </xsl:if>
15626
+ <fo:block-container margin-left="0">
15627
+ <fo:block role="SKIP">
15628
+ <xsl:apply-templates select="." mode="list">
15629
+ <xsl:with-param name="indent" select="$indent"/>
15630
+ </xsl:apply-templates>
15631
+ </fo:block>
15632
+ </fo:block-container>
15633
+ </fo:block-container>
15634
+ </xsl:when>
15635
+ <xsl:otherwise>
15636
+ <fo:block role="SKIP">
15637
+ <xsl:apply-templates select="." mode="list">
15638
+ <xsl:with-param name="indent" select="$indent"/>
15639
+ </xsl:apply-templates>
15640
+ </fo:block>
15641
+ </xsl:otherwise>
15642
+ </xsl:choose>
15099
15643
 
15100
15644
  </xsl:otherwise>
15101
15645
  </xsl:choose>
@@ -15167,6 +15711,10 @@
15167
15711
 
15168
15712
  <xsl:template name="refine_list-style_provisional-distance-between-starts">
15169
15713
 
15714
+ <xsl:if test="$layoutVersion = '1951' and local-name() = 'ul'">
15715
+ <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
15716
+ </xsl:if>
15717
+
15170
15718
  </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
15171
15719
 
15172
15720
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
@@ -17322,7 +17870,8 @@
17322
17870
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
17323
17871
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
17324
17872
  <!-- Todo: need update -->
17325
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
17873
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
17874
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
17326
17875
 
17327
17876
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
17328
17877
  <xsl:attribute name="src">
@@ -17343,6 +17892,9 @@
17343
17892
  <xsl:if test="$afrelationship != ''">
17344
17893
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
17345
17894
  </xsl:if>
17895
+ <xsl:if test="$volatile != ''">
17896
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
17897
+ </xsl:if>
17346
17898
  </pdf:embedded-file>
17347
17899
  </xsl:for-each>
17348
17900
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -17353,14 +17905,18 @@
17353
17905
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
17354
17906
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
17355
17907
  <!-- Todo: need update -->
17356
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
17908
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
17909
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
17357
17910
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
17358
17911
  <xsl:if test="$description != ''">
17359
17912
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
17360
17913
  </xsl:if>
17361
17914
  <xsl:if test="$afrelationship != ''">
17362
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
17363
- </xsl:if>
17915
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
17916
+ </xsl:if>
17917
+ <xsl:if test="$volatile != ''">
17918
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
17919
+ </xsl:if>
17364
17920
  </pdf:embedded-file>
17365
17921
  </xsl:for-each>
17366
17922
  </xsl:if>
@@ -17407,10 +17963,31 @@
17407
17963
  <xsl:value-of select="$level_total - 2"/>
17408
17964
  </xsl:when>
17409
17965
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
17410
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
17966
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
17967
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
17968
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
17969
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
17970
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
17971
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
17972
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
17973
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
17974
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
17975
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
17976
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
17411
17977
  <xsl:choose>
17412
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
17413
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
17978
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
17979
+ <xsl:value-of select="number($curr_clause_depth)"/>
17980
+ </xsl:when>
17981
+ <xsl:otherwise>
17982
+ <xsl:value-of select="$level_total - 2"/>
17983
+ </xsl:otherwise>
17984
+ </xsl:choose>
17985
+ </xsl:when>
17986
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
17987
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
17988
+ <xsl:choose>
17989
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
17990
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
17414
17991
  </xsl:when>
17415
17992
  <xsl:otherwise>
17416
17993
  <xsl:value-of select="$level_total - 2"/>
@@ -17418,7 +17995,7 @@
17418
17995
  </xsl:choose>
17419
17996
  </xsl:when>
17420
17997
  <xsl:when test="ancestor::*[local-name() = 'sections']">
17421
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
17998
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
17422
17999
  <xsl:choose>
17423
18000
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
17424
18001
  <xsl:value-of select="number($upper_clause_depth + 1)"/>