metanorma-ogc 1.5.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +4 -32
  3. data/.gitignore +11 -0
  4. data/Gemfile +1 -0
  5. data/lib/isodoc/ogc/biblio.rb +7 -6
  6. data/lib/isodoc/ogc/html/htmlstyle.css +48 -28
  7. data/lib/isodoc/ogc/html/htmlstyle.scss +18 -11
  8. data/lib/isodoc/ogc/html/scripts.html +0 -1
  9. data/lib/isodoc/ogc/html/wordstyle.css +30 -18
  10. data/lib/isodoc/ogc/html/wordstyle.scss +30 -18
  11. data/lib/isodoc/ogc/html/wordstyle_wp.css +22 -12
  12. data/lib/isodoc/ogc/html/wordstyle_wp.scss +22 -12
  13. data/lib/isodoc/ogc/metadata.rb +1 -0
  14. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +500 -229
  15. data/lib/isodoc/ogc/ogc.best-practice.xsl +500 -229
  16. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +500 -229
  17. data/lib/isodoc/ogc/ogc.community-practice.xsl +500 -229
  18. data/lib/isodoc/ogc/ogc.community-standard.xsl +500 -229
  19. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +500 -229
  20. data/lib/isodoc/ogc/ogc.engineering-report.xsl +500 -229
  21. data/lib/isodoc/ogc/ogc.other.xsl +500 -229
  22. data/lib/isodoc/ogc/ogc.policy.xsl +500 -229
  23. data/lib/isodoc/ogc/ogc.reference-model.xsl +500 -229
  24. data/lib/isodoc/ogc/ogc.release-notes.xsl +500 -229
  25. data/lib/isodoc/ogc/ogc.standard.xsl +500 -229
  26. data/lib/isodoc/ogc/ogc.test-suite.xsl +500 -229
  27. data/lib/isodoc/ogc/ogc.user-guide.xsl +500 -229
  28. data/lib/isodoc/ogc/ogc.white-paper.xsl +467 -215
  29. data/lib/isodoc/ogc/presentation_xml_convert.rb +29 -5
  30. data/lib/isodoc/ogc/reqt.rb +1 -1
  31. data/lib/{asciidoctor → metanorma}/ogc/basicdoc.rng +0 -0
  32. data/lib/{asciidoctor → metanorma}/ogc/biblio.rng +0 -0
  33. data/lib/{asciidoctor → metanorma}/ogc/boilerplate.xml +0 -0
  34. data/lib/{asciidoctor → metanorma}/ogc/cleanup.rb +39 -10
  35. data/lib/{asciidoctor → metanorma}/ogc/converter.rb +14 -4
  36. data/lib/{asciidoctor → metanorma}/ogc/front.rb +2 -2
  37. data/lib/{asciidoctor → metanorma}/ogc/isodoc.rng +49 -2
  38. data/lib/{asciidoctor → metanorma}/ogc/ogc.rng +0 -0
  39. data/lib/{asciidoctor → metanorma}/ogc/reqt.rng +0 -0
  40. data/lib/{asciidoctor → metanorma}/ogc/validate.rb +1 -1
  41. data/lib/metanorma/ogc/version.rb +1 -1
  42. data/lib/metanorma/ogc.rb +1 -0
  43. data/lib/metanorma-ogc.rb +0 -1
  44. data/metanorma-ogc.gemspec +1 -1
  45. metadata +15 -16
  46. data/lib/asciidoctor/ogc.rb +0 -6
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+
10
12
  <xsl:variable name="pageWidth" select="215.9"/>
11
13
  <xsl:variable name="pageHeight" select="279.4"/>
12
14
  <xsl:variable name="marginLeftRight1" select="35"/>
@@ -423,7 +425,7 @@
423
425
 
424
426
  <fo:block-container line-height="130%">
425
427
  <fo:block role="TOC">
426
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
428
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and normalize-space(@id) != '']">
427
429
 
428
430
  <fo:block role="TOCI">
429
431
  <xsl:if test="@level = 1">
@@ -432,7 +434,7 @@
432
434
  <xsl:if test="@level = 1 or @parent = 'annex'">
433
435
  <xsl:attribute name="font-size">12pt</xsl:attribute>
434
436
  </xsl:if>
435
- <xsl:if test="@level = 2 and not(@parent = 'annex')">
437
+ <xsl:if test="@level &gt;= 2 and not(@parent = 'annex')">
436
438
  <xsl:attribute name="font-size">10pt</xsl:attribute>
437
439
  </xsl:if>
438
440
 
@@ -450,7 +452,10 @@
450
452
  </fo:list-item-label>
451
453
  <fo:list-item-body start-indent="body-start()">
452
454
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
453
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
455
+ <fo:basic-link internal-destination="{@id}">
456
+ <xsl:call-template name="setAltText">
457
+ <xsl:with-param name="value" select="text()"/>
458
+ </xsl:call-template>
454
459
  <xsl:variable name="sectionTitle">
455
460
  <xsl:apply-templates select="title"/>
456
461
  </xsl:variable>
@@ -467,8 +472,17 @@
467
472
  </fo:list-block>
468
473
  </xsl:when>
469
474
  <xsl:otherwise>
470
- <fo:block text-align-last="justify" margin-left="8mm">
471
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
475
+ <xsl:variable name="margin-left">
476
+ <xsl:choose>
477
+ <xsl:when test="number(@level) != 'NaN'"><xsl:value-of select="(@level - 1) * 8"/></xsl:when>
478
+ <xsl:otherwise>8</xsl:otherwise>
479
+ </xsl:choose>
480
+ </xsl:variable>
481
+ <fo:block text-align-last="justify" margin-left="{$margin-left}mm">
482
+ <fo:basic-link internal-destination="{@id}">
483
+ <xsl:call-template name="setAltText">
484
+ <xsl:with-param name="value" select="text()"/>
485
+ </xsl:call-template>
472
486
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
473
487
  <xsl:text> </xsl:text>
474
488
  <xsl:apply-templates select="title"/>
@@ -503,9 +517,12 @@
503
517
  </fo:block-container>
504
518
  </fo:block-container>
505
519
  <fo:block-container line-height="130%">
506
- <xsl:for-each select="//ogc:table[@id and ogc:name]"> <!-- contains(ogc:name, '—') -->
520
+ <xsl:for-each select="//ogc:table[@id and ogc:name and normalize-space(@id) != '']"> <!-- contains(ogc:name, '—') -->
507
521
  <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
508
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
522
+ <fo:basic-link internal-destination="{@id}">
523
+ <xsl:call-template name="setAltText">
524
+ <xsl:with-param name="value" select="ogc:name"/>
525
+ </xsl:call-template>
509
526
  <xsl:apply-templates select="ogc:name" mode="contents"/>
510
527
  <fo:inline keep-together.within-line="always">
511
528
  <fo:leader leader-pattern="dots"/>
@@ -518,7 +535,7 @@
518
535
  </xsl:if>
519
536
 
520
537
  <xsl:variable name="list_of_figures_">
521
- <xsl:for-each select="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true')] | //*[@id and starts-with(ogc:name, 'Figure ')]">
538
+ <xsl:for-each select="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(ogc:name, 'Figure ') and normalize-space(@id) != '']">
522
539
  <figure id="{@id}" alt-text="{ogc:name}">
523
540
  <xsl:apply-templates select="ogc:name" mode="contents"/>
524
541
  </figure>
@@ -545,7 +562,10 @@
545
562
  <!-- <xsl:for-each select="//ogc:figure[@id and ogc:name and not(@unnumbered = 'true')] or //*[@id and starts-with(ogc:name, 'Figure ')]"> --> <!-- contains(ogc:name, '—') -->
546
563
  <xsl:for-each select="$list_of_figures/figure"> <!-- contains(ogc:name, '—') -->
547
564
  <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
548
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@alt-text}">
565
+ <fo:basic-link internal-destination="{@id}">
566
+ <xsl:call-template name="setAltText">
567
+ <xsl:with-param name="value" select="@alt-text"/>
568
+ </xsl:call-template>
549
569
  <!-- <xsl:apply-templates select="ogc:name" mode="contents"/> -->
550
570
  <xsl:copy-of select="node()"/>
551
571
  <fo:inline keep-together.within-line="always">
@@ -576,9 +596,12 @@
576
596
 
577
597
  <fo:block-container line-height="130%">
578
598
  <!-- <xsl:for-each select="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]"> -->
579
- <xsl:for-each select="xalan:nodeset($toc_recommendations)/*">
599
+ <xsl:for-each select="xalan:nodeset($toc_recommendations)/*[normalize-space(@id) != '']">
580
600
  <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
581
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@alt-text}">
601
+ <fo:basic-link internal-destination="{@id}">
602
+ <xsl:call-template name="setAltText">
603
+ <xsl:with-param name="value" select="@alt-text"/>
604
+ </xsl:call-template>
582
605
  <xsl:copy-of select="title/node()"/>
583
606
  <xsl:text> </xsl:text>
584
607
  <fo:inline keep-together.within-line="always">
@@ -758,7 +781,7 @@
758
781
 
759
782
  <xsl:variable name="display">
760
783
  <xsl:choose>
761
- <xsl:when test="$level &gt;= 3">false</xsl:when>
784
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
762
785
  <xsl:otherwise>true</xsl:otherwise>
763
786
  </xsl:choose>
764
787
  </xsl:variable>
@@ -900,7 +923,7 @@
900
923
  </fo:block>
901
924
  </xsl:template>
902
925
 
903
- <xsl:template match="ogc:title">
926
+ <xsl:template match="ogc:title" name="title">
904
927
 
905
928
  <xsl:variable name="level">
906
929
  <xsl:call-template name="getLevel"/>
@@ -1066,32 +1089,6 @@
1066
1089
  </xsl:if>
1067
1090
  </xsl:template>
1068
1091
 
1069
- <!--
1070
- <fn reference="1">
1071
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1072
- </fn>
1073
- -->
1074
- <xsl:template match="ogc:title//ogc:fn | ogc:name//ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)] | ogc:p/*/ogc:fn[not(ancestor::ogc:table)] | ogc:sourcecode/ogc:fn[not(ancestor::ogc:table)]" priority="2" name="fn">
1075
- <fo:footnote keep-with-previous.within-line="always">
1076
- <xsl:variable name="number" select="@reference"/>
1077
-
1078
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
1079
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
1080
- <xsl:value-of select="$number"/><!-- + count(//ogc:bibitem/ogc:note) -->
1081
- </fo:basic-link>
1082
- </fo:inline>
1083
- <fo:footnote-body>
1084
- <fo:block font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="{$color_main}" line-height="124%" text-align="justify">
1085
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
1086
- <xsl:value-of select="$number "/><!-- + count(//ogc:bibitem/ogc:note) -->
1087
- </fo:inline>
1088
- <xsl:for-each select="ogc:p">
1089
- <xsl:apply-templates/>
1090
- </xsl:for-each>
1091
- </fo:block>
1092
- </fo:footnote-body>
1093
- </fo:footnote>
1094
- </xsl:template>
1095
1092
 
1096
1093
  <xsl:template match="ogc:fn/ogc:p">
1097
1094
  <fo:block>
@@ -1176,13 +1173,10 @@
1176
1173
  <fo:list-item id="{@id}">
1177
1174
  <fo:list-item-label end-indent="label-end()">
1178
1175
  <fo:block>
1179
- <xsl:if test="local-name(..) = 'ul'">
1180
- <xsl:attribute name="color">
1181
- <xsl:value-of select="$color_design"/>
1182
- </xsl:attribute>
1183
- </xsl:if>
1184
1176
  <xsl:choose>
1185
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
1177
+ <xsl:when test="local-name(..) = 'ul'">
1178
+ <xsl:call-template name="setULLabel"/>
1179
+ </xsl:when>
1186
1180
  <xsl:otherwise> <!-- for ordered lists -->
1187
1181
  <xsl:choose>
1188
1182
  <xsl:when test="../@class = 'steps'">
@@ -1312,8 +1306,6 @@
1312
1306
  </fo:list-block>
1313
1307
  </xsl:template>
1314
1308
 
1315
-
1316
- <xsl:template match="ogc:references[not(@normative='true')]/ogc:bibitem" mode="contents"/>
1317
1309
 
1318
1310
  <xsl:template match="ogc:bibitem/ogc:title">
1319
1311
  <fo:inline font-style="italic">
@@ -1693,13 +1685,6 @@
1693
1685
 
1694
1686
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1695
1687
 
1696
- <title-annex lang="en">Annex </title-annex>
1697
- <title-annex lang="fr">Annexe </title-annex>
1698
-
1699
- <title-annex lang="zh">Annex </title-annex>
1700
-
1701
-
1702
-
1703
1688
  <title-edition lang="en">
1704
1689
 
1705
1690
 
@@ -1713,7 +1698,8 @@
1713
1698
 
1714
1699
  </title-edition>
1715
1700
 
1716
-
1701
+
1702
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
1717
1703
  <title-toc lang="en">
1718
1704
 
1719
1705
  <xsl:text>Contents</xsl:text>
@@ -1725,21 +1711,11 @@
1725
1711
 
1726
1712
  <xsl:text>Sommaire</xsl:text>
1727
1713
 
1728
-
1729
- </title-toc>
1714
+ </title-toc>
1730
1715
 
1731
1716
  <title-toc lang="zh">Contents</title-toc>
1732
1717
 
1733
1718
 
1734
-
1735
- <title-page lang="en">Page</title-page>
1736
- <title-page lang="fr">Page</title-page>
1737
-
1738
- <title-key lang="en">Key</title-key>
1739
- <title-key lang="fr">Légende</title-key>
1740
-
1741
- <title-where lang="en">where</title-where>
1742
- <title-where lang="fr">où</title-where>
1743
1719
 
1744
1720
  <title-descriptors lang="en">Descriptors</title-descriptors>
1745
1721
 
@@ -1762,25 +1738,6 @@
1762
1738
 
1763
1739
  </title-subpart>
1764
1740
 
1765
- <title-modified lang="en">modified</title-modified>
1766
- <title-modified lang="fr">modifiée</title-modified>
1767
-
1768
- <title-modified lang="zh">modified</title-modified>
1769
-
1770
-
1771
-
1772
- <title-source lang="en">
1773
-
1774
-
1775
- <xsl:text>Source</xsl:text>
1776
-
1777
- </title-source>
1778
-
1779
- <title-keywords lang="en">Keywords</title-keywords>
1780
-
1781
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
1782
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1783
-
1784
1741
  <title-list-tables lang="en">List of Tables</title-list-tables>
1785
1742
 
1786
1743
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -1789,37 +1746,8 @@
1789
1746
 
1790
1747
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
1791
1748
 
1792
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1793
-
1794
- <title-abstract lang="en">Abstract</title-abstract>
1795
-
1796
1749
  <title-summary lang="en">Summary</title-summary>
1797
1750
 
1798
- <title-in lang="en">in </title-in>
1799
-
1800
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1801
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1802
-
1803
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1804
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1805
-
1806
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1807
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
1808
-
1809
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1810
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
1811
-
1812
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1813
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1814
-
1815
- <title-caution lang="en">CAUTION</title-caution>
1816
- <title-caution lang="zh">注意</title-caution>
1817
-
1818
- <title-warning lang="en">WARNING</title-warning>
1819
- <title-warning lang="zh">警告</title-warning>
1820
-
1821
- <title-amendment lang="en">AMENDMENT</title-amendment>
1822
-
1823
1751
  <title-continued lang="en">(continued)</title-continued>
1824
1752
  <title-continued lang="fr">(continué)</title-continued>
1825
1753
 
@@ -1962,6 +1890,7 @@
1962
1890
 
1963
1891
 
1964
1892
 
1893
+
1965
1894
 
1966
1895
  <xsl:attribute name="margin-top">10pt</xsl:attribute>
1967
1896
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1975,7 +1904,9 @@
1975
1904
 
1976
1905
 
1977
1906
 
1907
+
1978
1908
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1909
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1979
1910
 
1980
1911
 
1981
1912
 
@@ -1987,7 +1918,6 @@
1987
1918
 
1988
1919
 
1989
1920
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1990
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1991
1921
 
1992
1922
 
1993
1923
 
@@ -2005,6 +1935,7 @@
2005
1935
 
2006
1936
 
2007
1937
 
1938
+
2008
1939
 
2009
1940
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
2010
1941
 
@@ -2304,7 +2235,81 @@
2304
2235
 
2305
2236
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2306
2237
  <xsl:attribute name="line-height">135%</xsl:attribute>
2307
- </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">
2238
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2239
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2240
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2241
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2242
+
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+
2250
+
2251
+
2252
+
2253
+
2254
+
2255
+ <xsl:attribute name="font-size">65%</xsl:attribute>
2256
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2257
+
2258
+
2259
+
2260
+
2261
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2262
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2263
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2264
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2265
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2266
+
2267
+
2268
+
2269
+
2270
+
2271
+
2272
+
2273
+
2274
+
2275
+
2276
+
2277
+
2278
+
2279
+
2280
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2281
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2282
+ <xsl:attribute name="color"><xsl:value-of select="$color_main"/></xsl:attribute>
2283
+ <xsl:attribute name="line-height">124%</xsl:attribute>
2284
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2285
+
2286
+
2287
+
2288
+
2289
+
2290
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2291
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+
2305
+
2306
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2307
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2308
+
2309
+
2310
+
2311
+
2312
+ </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">
2308
2313
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2309
2314
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2310
2315
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3271,6 +3276,102 @@
3271
3276
 
3272
3277
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3273
3278
  <xsl:apply-templates/>
3279
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
3280
+
3281
+ <!-- list of footnotes to calculate actual footnotes number -->
3282
+ <xsl:variable name="p_fn_">
3283
+ <xsl:choose>
3284
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3285
+ <fn gen_id="{generate-id(.)}">
3286
+ <xsl:copy-of select="@*"/>
3287
+ <xsl:copy-of select="node()"/>
3288
+ </fn>
3289
+ </xsl:when>
3290
+ <xsl:otherwise>
3291
+ <!-- itetation for:
3292
+ footnotes in bibdata/title
3293
+ footnotes in bibliography
3294
+ footnotes in document's body (except table's head/body/foot and figure text)
3295
+ -->
3296
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3297
+ <fn gen_id="{generate-id(.)}">
3298
+ <xsl:copy-of select="@*"/>
3299
+ <xsl:copy-of select="node()"/>
3300
+ </fn>
3301
+ </xsl:for-each>
3302
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
3303
+ <xsl:sort select="@displayorder" data-type="number"/>
3304
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3305
+ <!-- copy unique fn -->
3306
+ <fn gen_id="{generate-id(.)}">
3307
+ <xsl:copy-of select="@*"/>
3308
+ <xsl:copy-of select="node()"/>
3309
+ </fn>
3310
+ </xsl:for-each>
3311
+ </xsl:for-each>
3312
+ </xsl:otherwise>
3313
+ </xsl:choose>
3314
+ </xsl:variable>
3315
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3316
+
3317
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3318
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3319
+ <xsl:variable name="reference" select="@reference"/>
3320
+ <!-- fn sequence number in document -->
3321
+ <xsl:variable name="current_fn_number">
3322
+ <xsl:choose>
3323
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3324
+ <xsl:otherwise>
3325
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3326
+ </xsl:otherwise>
3327
+ </xsl:choose>
3328
+ </xsl:variable>
3329
+ <xsl:variable name="current_fn_number_text">
3330
+ <xsl:value-of select="$current_fn_number"/>
3331
+
3332
+
3333
+ </xsl:variable>
3334
+
3335
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3336
+ <xsl:variable name="footnote_inline">
3337
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3338
+
3339
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3340
+ <xsl:value-of select="$current_fn_number_text"/>
3341
+ </fo:basic-link>
3342
+ </fo:inline>
3343
+ </xsl:variable>
3344
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3345
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3346
+ <xsl:choose>
3347
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3348
+ <xsl:copy-of select="$footnote_inline"/>
3349
+ </xsl:when>
3350
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3351
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3352
+ <xsl:copy-of select="$footnote_inline"/>
3353
+ <fo:footnote-body>
3354
+
3355
+ <fo:block-container text-indent="0" start-indent="0">
3356
+
3357
+
3358
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3359
+
3360
+
3361
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3362
+
3363
+ <xsl:value-of select="$current_fn_number_text"/>
3364
+ </fo:inline>
3365
+ <xsl:apply-templates/>
3366
+ </fo:block>
3367
+ </fo:block-container>
3368
+ </fo:footnote-body>
3369
+ </fo:footnote>
3370
+ </xsl:when>
3371
+ <xsl:otherwise>
3372
+ <xsl:copy-of select="$footnote_inline"/>
3373
+ </xsl:otherwise>
3374
+ </xsl:choose>
3274
3375
  </xsl:template><xsl:template name="fn_display">
3275
3376
  <xsl:variable name="references">
3276
3377
 
@@ -3476,6 +3577,8 @@
3476
3577
 
3477
3578
  </fo:basic-link>
3478
3579
  </fo:inline>
3580
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3581
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3479
3582
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3480
3583
  <fo:inline>
3481
3584
  <xsl:apply-templates/>
@@ -3524,12 +3627,9 @@
3524
3627
  <fo:block margin-bottom="12pt" text-align="left">
3525
3628
 
3526
3629
  <xsl:variable name="title-where">
3527
-
3528
-
3529
- <xsl:call-template name="getTitle">
3530
- <xsl:with-param name="name" select="'title-where'"/>
3531
- </xsl:call-template>
3532
-
3630
+ <xsl:call-template name="getLocalizedString">
3631
+ <xsl:with-param name="key">where</xsl:with-param>
3632
+ </xsl:call-template>
3533
3633
  </xsl:variable>
3534
3634
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3535
3635
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -3545,12 +3645,9 @@
3545
3645
 
3546
3646
 
3547
3647
  <xsl:variable name="title-where">
3548
-
3549
-
3550
- <xsl:call-template name="getTitle">
3551
- <xsl:with-param name="name" select="'title-where'"/>
3552
- </xsl:call-template>
3553
-
3648
+ <xsl:call-template name="getLocalizedString">
3649
+ <xsl:with-param name="key">where</xsl:with-param>
3650
+ </xsl:call-template>
3554
3651
  </xsl:variable>
3555
3652
  <xsl:value-of select="$title-where"/>
3556
3653
  </fo:block>
@@ -3562,12 +3659,9 @@
3562
3659
 
3563
3660
 
3564
3661
  <xsl:variable name="title-key">
3565
-
3566
-
3567
- <xsl:call-template name="getTitle">
3568
- <xsl:with-param name="name" select="'title-key'"/>
3569
- </xsl:call-template>
3570
-
3662
+ <xsl:call-template name="getLocalizedString">
3663
+ <xsl:with-param name="key">key</xsl:with-param>
3664
+ </xsl:call-template>
3571
3665
  </xsl:variable>
3572
3666
  <xsl:value-of select="$title-key"/>
3573
3667
  </fo:block>
@@ -3838,6 +3932,7 @@
3838
3932
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3839
3933
  <xsl:apply-templates/>
3840
3934
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3935
+ <xsl:apply-templates select="@language"/>
3841
3936
  <xsl:apply-templates/>
3842
3937
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3843
3938
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -3899,6 +3994,15 @@
3899
3994
  </fo:inline>
3900
3995
  </xsl:template><xsl:template match="*[local-name()='add']">
3901
3996
  <xsl:choose>
3997
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3998
+ <fo:inline>
3999
+ <xsl:call-template name="insertTag">
4000
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4001
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4002
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4003
+ </xsl:call-template>
4004
+ </fo:inline>
4005
+ </xsl:when>
3902
4006
  <xsl:when test="@amendment">
3903
4007
  <fo:inline>
3904
4008
  <xsl:call-template name="insertTag">
@@ -3933,7 +4037,6 @@
3933
4037
  </fo:inline>
3934
4038
  </xsl:otherwise>
3935
4039
  </xsl:choose>
3936
-
3937
4040
  </xsl:template><xsl:template name="insertTag">
3938
4041
  <xsl:param name="type"/>
3939
4042
  <xsl:param name="kind"/>
@@ -3949,14 +4052,14 @@
3949
4052
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3950
4053
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3951
4054
  <g>
3952
- <xsl:if test="$type = 'closing'">
4055
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3953
4056
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3954
4057
  </xsl:if>
3955
4058
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3956
4059
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3957
4060
  </g>
3958
4061
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3959
- <xsl:if test="$type = 'closing'">
4062
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3960
4063
  <xsl:attribute name="x">25</xsl:attribute>
3961
4064
  </xsl:if>
3962
4065
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -4449,9 +4552,9 @@
4449
4552
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4450
4553
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4451
4554
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4452
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4555
+ <xsl:apply-templates select="*[local-name()='name']"/>
4453
4556
  </fo:block>
4454
- <xsl:apply-templates/>
4557
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
4455
4558
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
4456
4559
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4457
4560
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4471,22 +4574,6 @@
4471
4574
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4472
4575
  <xsl:apply-templates/>
4473
4576
  </fo:inline>
4474
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
4475
- <xsl:variable name="title-modified">
4476
-
4477
-
4478
- <xsl:call-template name="getTitle">
4479
- <xsl:with-param name="name" select="'title-modified'"/>
4480
- </xsl:call-template>
4481
-
4482
- </xsl:variable>
4483
-
4484
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4485
- <xsl:choose>
4486
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4487
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4488
- </xsl:choose>
4489
- <xsl:apply-templates/>
4490
4577
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4491
4578
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4492
4579
 
@@ -5068,11 +5155,58 @@
5068
5155
  <xsl:value-of select="."/>
5069
5156
  </xsl:template><xsl:template match="node()" mode="contents">
5070
5157
  <xsl:apply-templates mode="contents"/>
5158
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
5159
+ <xsl:variable name="level">
5160
+ <xsl:call-template name="getLevel">
5161
+ <xsl:with-param name="depth" select="@depth"/>
5162
+ </xsl:call-template>
5163
+ </xsl:variable>
5164
+
5165
+ <xsl:variable name="section">
5166
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5167
+ </xsl:variable>
5168
+
5169
+ <xsl:variable name="type">floating-title</xsl:variable>
5170
+
5171
+ <xsl:variable name="display">
5172
+ <xsl:choose>
5173
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
5174
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
5175
+ <xsl:otherwise>false</xsl:otherwise>
5176
+ </xsl:choose>
5177
+ </xsl:variable>
5178
+
5179
+ <xsl:variable name="skip">false</xsl:variable>
5180
+
5181
+ <xsl:if test="$skip = 'false'">
5182
+
5183
+ <xsl:variable name="title">
5184
+ <xsl:choose>
5185
+ <xsl:when test="*[local-name() = 'tab']">
5186
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
5187
+ </xsl:when>
5188
+ <xsl:otherwise>
5189
+ <xsl:copy-of select="node()"/>
5190
+ </xsl:otherwise>
5191
+ </xsl:choose>
5192
+ </xsl:variable>
5193
+
5194
+ <xsl:variable name="root">
5195
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
5196
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
5197
+ </xsl:variable>
5198
+
5199
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
5200
+ <title>
5201
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
5202
+ </title>
5203
+ </item>
5204
+ </xsl:if>
5071
5205
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5072
5206
  <xsl:apply-templates mode="bookmarks"/>
5073
5207
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5074
5208
  <xsl:apply-templates select="."/>
5075
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5209
+ </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">
5076
5210
  <xsl:apply-templates mode="bookmarks"/>
5077
5211
  </xsl:template><xsl:template name="addBookmarks">
5078
5212
  <xsl:param name="contents"/>
@@ -5315,7 +5449,10 @@
5315
5449
  </fo:block>
5316
5450
  </xsl:if>
5317
5451
  </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">
5318
- <xsl:apply-templates mode="contents_item"/>
5452
+ <xsl:param name="mode">bookmarks</xsl:param>
5453
+ <xsl:apply-templates mode="contents_item">
5454
+ <xsl:with-param name="mode" select="$mode"/>
5455
+ </xsl:apply-templates>
5319
5456
  <!-- <xsl:text> </xsl:text> -->
5320
5457
  </xsl:template><xsl:template name="getSection">
5321
5458
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -5388,6 +5525,18 @@
5388
5525
  <xsl:copy-of select="."/>
5389
5526
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5390
5527
  <xsl:text> </xsl:text>
5528
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
5529
+ <xsl:param name="mode">bookmarks</xsl:param>
5530
+ <xsl:apply-templates mode="contents_item">
5531
+ <xsl:with-param name="mode" select="$mode"/>
5532
+ </xsl:apply-templates>
5533
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
5534
+ <xsl:param name="mode">bookmarks</xsl:param>
5535
+ <xsl:if test="$mode = 'contents'">
5536
+ <xsl:copy>
5537
+ <xsl:apply-templates mode="contents_item"/>
5538
+ </xsl:copy>
5539
+ </xsl:if>
5391
5540
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5392
5541
 
5393
5542
  <fo:block-container margin-left="0mm">
@@ -5746,42 +5895,48 @@
5746
5895
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5747
5896
 
5748
5897
 
5749
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5750
-
5751
- <xsl:variable name="element">
5898
+ <xsl:variable name="fo_element">
5899
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
5752
5900
 
5753
5901
  inline
5754
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5902
+
5755
5903
  </xsl:variable>
5756
5904
 
5905
+ <!-- display 'EXAMPLE' -->
5906
+ <xsl:apply-templates select="*[local-name()='name']">
5907
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5908
+ </xsl:apply-templates>
5909
+
5757
5910
  <xsl:choose>
5758
- <xsl:when test="contains(normalize-space($element), 'block')">
5759
- <fo:block xsl:use-attribute-sets="example-body-style">
5760
- <xsl:apply-templates/>
5761
- </fo:block>
5911
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5912
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5913
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5914
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5915
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5916
+ </xsl:apply-templates>
5917
+ </fo:block-container>
5918
+ </fo:block-container>
5762
5919
  </xsl:when>
5763
5920
  <xsl:otherwise>
5764
5921
  <fo:inline>
5765
- <xsl:apply-templates/>
5922
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5923
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5924
+ </xsl:apply-templates>
5766
5925
  </fo:inline>
5767
5926
  </xsl:otherwise>
5768
5927
  </xsl:choose>
5769
5928
 
5770
5929
  </fo:block>
5771
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
5772
-
5773
- <xsl:variable name="element">
5774
-
5775
- inline
5776
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5777
- </xsl:variable>
5930
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5931
+ <xsl:param name="fo_element">block</xsl:param>
5932
+
5778
5933
  <xsl:choose>
5779
5934
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
5780
5935
  <fo:inline>
5781
5936
  <xsl:apply-templates/>
5782
5937
  </fo:inline>
5783
5938
  </xsl:when>
5784
- <xsl:when test="contains(normalize-space($element), 'block')">
5939
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5785
5940
  <fo:block xsl:use-attribute-sets="example-name-style">
5786
5941
  <xsl:apply-templates/>
5787
5942
  </fo:block>
@@ -5794,14 +5949,15 @@
5794
5949
  </xsl:choose>
5795
5950
 
5796
5951
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5952
+ <xsl:param name="fo_element">block</xsl:param>
5953
+
5797
5954
  <xsl:variable name="num"><xsl:number/></xsl:variable>
5798
5955
  <xsl:variable name="element">
5799
5956
 
5800
-
5801
- inline
5957
+ <xsl:value-of select="$fo_element"/>
5802
5958
  </xsl:variable>
5803
5959
  <xsl:choose>
5804
- <xsl:when test="normalize-space($element) = 'block'">
5960
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
5805
5961
  <fo:block xsl:use-attribute-sets="example-p-style">
5806
5962
 
5807
5963
  <xsl:apply-templates/>
@@ -5820,59 +5976,68 @@
5820
5976
  <xsl:variable name="termsource_text">
5821
5977
  <xsl:apply-templates/>
5822
5978
  </xsl:variable>
5823
-
5824
- <xsl:choose>
5979
+ <xsl:copy-of select="$termsource_text"/>
5980
+ <!-- <xsl:choose>
5825
5981
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5826
- <!-- <xsl:apply-templates /> -->
5827
5982
  <xsl:copy-of select="$termsource_text"/>
5828
5983
  </xsl:when>
5829
5984
  <xsl:otherwise>
5830
-
5831
-
5832
- <!-- <xsl:apply-templates /> -->
5985
+ <xsl:if test="$namespace = 'bsi'">
5986
+ <xsl:choose>
5987
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5988
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5989
+ </xsl:choose>
5990
+ </xsl:if>
5991
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
5992
+ <xsl:text>[</xsl:text>
5993
+ </xsl:if>
5833
5994
  <xsl:copy-of select="$termsource_text"/>
5834
-
5835
-
5995
+ <xsl:if test="$namespace = 'bsi'">
5996
+ <xsl:choose>
5997
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5998
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5999
+ </xsl:choose>
6000
+ </xsl:if>
6001
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
6002
+ <xsl:text>]</xsl:text>
6003
+ </xsl:if>
5836
6004
  </xsl:otherwise>
5837
- </xsl:choose>
6005
+ </xsl:choose> -->
5838
6006
  </fo:block>
5839
6007
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5840
6008
  <xsl:if test="normalize-space() != ''">
5841
6009
  <xsl:value-of select="."/>
5842
6010
  </xsl:if>
5843
- </xsl:template><xsl:variable name="localized.source">
5844
- <xsl:call-template name="getLocalizedString">
5845
- <xsl:with-param name="key">source</xsl:with-param>
5846
- </xsl:call-template>
5847
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6011
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6012
+ <fo:inline>
6013
+
6014
+
6015
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
6016
+
6017
+ <xsl:value-of select="."/>
6018
+ </fo:inline>
6019
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5848
6020
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5849
6021
  <xsl:if test="normalize-space(@citeas) = ''">
5850
6022
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5851
6023
  </xsl:if>
5852
-
5853
- <xsl:text>[</xsl:text>
5854
- <fo:inline>
5855
-
5856
- <xsl:attribute name="font-weight">bold</xsl:attribute>
5857
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
5858
-
5859
-
5860
-
5861
-
5862
-
5863
- <xsl:value-of select="$localized.source"/>
5864
- <xsl:text>: </xsl:text>
5865
-
5866
-
5867
-
5868
-
5869
- </fo:inline>
5870
-
5871
6024
  <fo:inline xsl:use-attribute-sets="origin-style">
5872
6025
  <xsl:apply-templates/>
5873
6026
  </fo:inline>
5874
- <xsl:text>]</xsl:text>
5875
- </fo:basic-link>
6027
+ </fo:basic-link>
6028
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6029
+ <xsl:variable name="title-modified">
6030
+ <xsl:call-template name="getLocalizedString">
6031
+ <xsl:with-param name="key">modified</xsl:with-param>
6032
+ </xsl:call-template>
6033
+ </xsl:variable>
6034
+
6035
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6036
+ <xsl:choose>
6037
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
6038
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
6039
+ </xsl:choose>
6040
+ <xsl:apply-templates/>
5876
6041
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5877
6042
  <fo:inline><xsl:apply-templates/></fo:inline>
5878
6043
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6054,12 +6219,9 @@
6054
6219
  </fo:block>
6055
6220
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6056
6221
  <xsl:variable name="title-deprecated">
6057
-
6058
- <xsl:call-template name="getLocalizedString">
6059
- <xsl:with-param name="key">deprecated</xsl:with-param>
6060
- </xsl:call-template>
6061
-
6062
-
6222
+ <xsl:call-template name="getLocalizedString">
6223
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6224
+ </xsl:call-template>
6063
6225
  </xsl:variable>
6064
6226
  <fo:block xsl:use-attribute-sets="deprecates-style">
6065
6227
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -6068,6 +6230,8 @@
6068
6230
  <xsl:if test="*[local-name() = 'strong']">
6069
6231
  <xsl:attribute name="font-weight">normal</xsl:attribute>
6070
6232
  </xsl:if>
6233
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
6234
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6071
6235
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6072
6236
  <fo:block xsl:use-attribute-sets="definition-style">
6073
6237
  <xsl:apply-templates/>
@@ -6138,6 +6302,51 @@
6138
6302
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6139
6303
  <!-- 0xA0 to space replacement -->
6140
6304
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6305
+ </xsl:template><xsl:variable name="ul_labels_">
6306
+
6307
+
6308
+
6309
+
6310
+
6311
+
6312
+
6313
+
6314
+
6315
+
6316
+
6317
+
6318
+
6319
+ <label color="{$color_design}">•</label>
6320
+
6321
+
6322
+
6323
+
6324
+
6325
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6326
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6327
+ <xsl:variable name="list_level">
6328
+ <xsl:choose>
6329
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
6330
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
6331
+ </xsl:choose>
6332
+ </xsl:variable>
6333
+ <xsl:choose>
6334
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
6335
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
6336
+ </xsl:when>
6337
+ <xsl:when test="$list_level mod 3 = 0">
6338
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
6339
+ </xsl:when>
6340
+ <xsl:when test="$list_level mod 2 = 0">
6341
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
6342
+ </xsl:when>
6343
+ <xsl:otherwise>
6344
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
6345
+ </xsl:otherwise>
6346
+ </xsl:choose>
6347
+ </xsl:template><xsl:template match="label" mode="ul_labels">
6348
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6349
+ <xsl:value-of select="."/>
6141
6350
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6142
6351
  <xsl:choose>
6143
6352
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6349,6 +6558,26 @@
6349
6558
 
6350
6559
 
6351
6560
 
6561
+
6562
+
6563
+
6564
+
6565
+
6566
+
6567
+
6568
+
6569
+
6570
+
6571
+
6572
+
6573
+
6574
+
6575
+ <!-- end MPFD bibitem processing -->
6576
+
6577
+ <!-- start M3D bibitem processing -->
6578
+
6579
+
6580
+
6352
6581
  <!-- start OGC bibtem processing -->
6353
6582
  <xsl:choose>
6354
6583
  <xsl:when test="*[local-name() = 'formattedref']">
@@ -6492,14 +6721,8 @@
6492
6721
  <!-- end OGC bibitem processing-->
6493
6722
 
6494
6723
 
6495
-
6496
-
6497
-
6498
-
6499
-
6500
-
6501
6724
  </xsl:template><xsl:template name="processBibitemDocId">
6502
- <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')]"/>
6725
+ <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')]"/>
6503
6726
  <xsl:choose>
6504
6727
  <xsl:when test="normalize-space($_doc_ident) != ''">
6505
6728
  <!-- <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"/>
@@ -6513,7 +6736,7 @@
6513
6736
  <xsl:if test="$type != ''">
6514
6737
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6515
6738
  </xsl:if> -->
6516
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6739
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
6517
6740
  </xsl:otherwise>
6518
6741
  </xsl:choose>
6519
6742
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -6618,7 +6841,35 @@
6618
6841
  <fo:block-container border="1pt solid black" width="50%">
6619
6842
  <fo:block> </fo:block>
6620
6843
  </fo:block-container>
6621
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
6844
+ </xsl:template><xsl:variable name="toc_level">
6845
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
6846
+ <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:-->
6847
+ <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 -->
6848
+ <xsl:choose>
6849
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
6850
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
6851
+ <xsl:otherwise><!-- default value -->
6852
+
6853
+
6854
+
6855
+
6856
+
6857
+
6858
+
6859
+
6860
+
6861
+
6862
+
6863
+
6864
+
6865
+ 2
6866
+
6867
+
6868
+
6869
+
6870
+ </xsl:otherwise>
6871
+ </xsl:choose>
6872
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6622
6873
  <xsl:param name="colwidths"/>
6623
6874
  <xsl:variable name="colwidths_">
6624
6875
  <xsl:choose>
@@ -6698,7 +6949,7 @@
6698
6949
  </td>
6699
6950
  </xsl:for-each>
6700
6951
  <td>333</td> <!-- page number, just for fill -->
6701
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6952
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6702
6953
  <fo:inline padding-right="5mm"> </fo:inline>
6703
6954
  <fo:inline><xsl:apply-templates/></fo:inline>
6704
6955
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6709,6 +6960,10 @@
6709
6960
  </svg>
6710
6961
  </fo:instream-foreign-object>
6711
6962
  </fo:inline>
6963
+ </xsl:template><xsl:template match="@language">
6964
+ <xsl:copy-of select="."/>
6965
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
6966
+ <xsl:call-template name="title"/>
6712
6967
  </xsl:template><xsl:template name="convertDate">
6713
6968
  <xsl:param name="date"/>
6714
6969
  <xsl:param name="format" select="'short'"/>
@@ -7066,9 +7321,15 @@
7066
7321
  </xsl:template><xsl:template name="getLocalizedString">
7067
7322
  <xsl:param name="key"/>
7068
7323
  <xsl:param name="formatted">false</xsl:param>
7324
+ <xsl:param name="lang"/>
7069
7325
 
7070
7326
  <xsl:variable name="curr_lang">
7071
- <xsl:call-template name="getLang"/>
7327
+ <xsl:choose>
7328
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7329
+ <xsl:otherwise>
7330
+ <xsl:call-template name="getLang"/>
7331
+ </xsl:otherwise>
7332
+ </xsl:choose>
7072
7333
  </xsl:variable>
7073
7334
 
7074
7335
  <xsl:variable name="data_value">
@@ -7258,4 +7519,14 @@
7258
7519
  </xsl:otherwise>
7259
7520
  </xsl:choose>
7260
7521
  </xsl:if>
7522
+ </xsl:template><xsl:template name="setAltText">
7523
+ <xsl:param name="value"/>
7524
+ <xsl:attribute name="fox:alt-text">
7525
+ <xsl:choose>
7526
+ <xsl:when test="normalize-space($value) != ''">
7527
+ <xsl:value-of select="$value"/>
7528
+ </xsl:when>
7529
+ <xsl:otherwise>_</xsl:otherwise>
7530
+ </xsl:choose>
7531
+ </xsl:attribute>
7261
7532
  </xsl:template></xsl:stylesheet>