metanorma-iso 1.10.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -33
  3. data/.github/workflows/ubuntu.yml +1 -1
  4. data/.gitignore +26 -0
  5. data/Gemfile +1 -1
  6. data/Makefile +1 -1
  7. data/lib/asciidoctor/iso/base.rb +2 -69
  8. data/lib/asciidoctor/iso/cleanup.rb +2 -175
  9. data/lib/asciidoctor/iso/converter.rb +2 -17
  10. data/lib/asciidoctor/iso/deprecated.rb +5 -0
  11. data/lib/asciidoctor/iso/front.rb +2 -156
  12. data/lib/asciidoctor/iso/front_id.rb +2 -221
  13. data/lib/asciidoctor/iso/section.rb +2 -48
  14. data/lib/asciidoctor/iso/validate.rb +2 -171
  15. data/lib/asciidoctor/iso/validate_image.rb +2 -96
  16. data/lib/asciidoctor/iso/validate_requirements.rb +2 -110
  17. data/lib/asciidoctor/iso/validate_section.rb +2 -246
  18. data/lib/asciidoctor/iso/validate_style.rb +2 -169
  19. data/lib/asciidoctor/iso/validate_title.rb +2 -104
  20. data/lib/isodoc/iso/base_convert.rb +14 -31
  21. data/lib/isodoc/iso/html/style-human.css +40 -8
  22. data/lib/isodoc/iso/html/style-human.scss +36 -8
  23. data/lib/isodoc/iso/html/style-iso.css +35 -5
  24. data/lib/isodoc/iso/html/style-iso.scss +31 -5
  25. data/lib/isodoc/iso/html/wordstyle.css +10 -8
  26. data/lib/isodoc/iso/html/wordstyle.scss +10 -8
  27. data/lib/isodoc/iso/html_convert.rb +83 -22
  28. data/lib/isodoc/iso/index.rb +53 -45
  29. data/lib/isodoc/iso/iso.amendment.xsl +477 -264
  30. data/lib/isodoc/iso/iso.international-standard.xsl +477 -264
  31. data/lib/isodoc/iso/metadata.rb +27 -22
  32. data/lib/isodoc/iso/presentation_xml_convert.rb +42 -17
  33. data/lib/isodoc/iso/sts_convert.rb +2 -4
  34. data/lib/isodoc/iso/word_convert.rb +0 -2
  35. data/lib/metanorma/iso/base.rb +70 -0
  36. data/lib/{asciidoctor → metanorma}/iso/basicdoc.rng +0 -0
  37. data/lib/{asciidoctor → metanorma}/iso/biblio.rng +0 -0
  38. data/lib/{asciidoctor → metanorma}/iso/boilerplate-fr.xml +0 -0
  39. data/lib/{asciidoctor → metanorma}/iso/boilerplate.xml +0 -0
  40. data/lib/metanorma/iso/cleanup.rb +176 -0
  41. data/lib/metanorma/iso/converter.rb +18 -0
  42. data/lib/metanorma/iso/front.rb +170 -0
  43. data/lib/metanorma/iso/front_id.rb +225 -0
  44. data/lib/{asciidoctor → metanorma}/iso/isodoc.rng +49 -2
  45. data/lib/{asciidoctor → metanorma}/iso/isostandard-amd.rng +0 -0
  46. data/lib/{asciidoctor → metanorma}/iso/isostandard.rnc +0 -0
  47. data/lib/{asciidoctor → metanorma}/iso/isostandard.rng +14 -0
  48. data/lib/{asciidoctor → metanorma}/iso/reqt.rng +0 -0
  49. data/lib/metanorma/iso/section.rb +49 -0
  50. data/lib/metanorma/iso/validate.rb +172 -0
  51. data/lib/metanorma/iso/validate_image.rb +97 -0
  52. data/lib/metanorma/iso/validate_requirements.rb +111 -0
  53. data/lib/metanorma/iso/validate_section.rb +247 -0
  54. data/lib/metanorma/iso/validate_style.rb +170 -0
  55. data/lib/metanorma/iso/validate_title.rb +105 -0
  56. data/lib/metanorma/iso/version.rb +1 -1
  57. data/lib/metanorma-iso.rb +1 -1
  58. data/metanorma-iso.gemspec +2 -2
  59. data/spec/isodoc/amd_spec.rb +261 -250
  60. data/spec/isodoc/inline_spec.rb +238 -212
  61. data/spec/isodoc/iso_spec.rb +3 -1
  62. data/spec/isodoc/postproc_spec.rb +111 -28
  63. data/spec/isodoc/ref_spec.rb +4 -2
  64. data/spec/isodoc/section_spec.rb +1 -1
  65. data/spec/isodoc/terms_spec.rb +17 -24
  66. data/spec/{asciidoctor → metanorma}/amd_spec.rb +1 -1
  67. data/spec/metanorma/base_spec.rb +1185 -0
  68. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  69. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
  70. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +1 -1
  71. data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
  72. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  73. data/spec/metanorma/processor_spec.rb +1 -1
  74. data/spec/{asciidoctor → metanorma}/refs_spec.rb +1 -1
  75. data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
  76. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  77. data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
  78. data/spec/spec_helper.rb +1 -1
  79. data/spec/vcr_cassettes/docrels.yml +35 -425
  80. metadata +40 -27
  81. data/spec/asciidoctor/base_spec.rb +0 -1333
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
12
+ <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"/>
13
13
 
14
14
  <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
15
15
 
@@ -457,14 +457,6 @@
457
457
  <fo:block-container>
458
458
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
459
459
  <xsl:value-of select="$stage-fullname-uppercased"/>
460
- <!-- <xsl:if test="$doctype = 'amendment'">
461
- <xsl:variable name="title-amendment">
462
- <xsl:call-template name="getTitle">
463
- <xsl:with-param name="name" select="'title-amendment'"/>
464
- </xsl:call-template>
465
- </xsl:variable>
466
- <xsl:text> </xsl:text><xsl:value-of select="$title-amendment"/>
467
- </xsl:if> -->
468
460
  </fo:block>
469
461
  <fo:block font-size="20pt" font-weight="bold" text-align="right">
470
462
  <xsl:value-of select="$docidentifierISO"/>
@@ -655,12 +647,8 @@
655
647
  <xsl:if test="$doctype = 'amendment'">
656
648
  <fo:block text-align="right" margin-right="0.5mm">
657
649
  <fo:block font-weight="bold" margin-top="4pt" role="H1">
658
- <xsl:variable name="title-amendment">
659
- <xsl:call-template name="getTitle">
660
- <xsl:with-param name="name" select="'title-amendment'"/>
661
- </xsl:call-template>
662
- </xsl:variable>
663
- <xsl:value-of select="$title-amendment"/><xsl:text> </xsl:text>
650
+ <xsl:value-of select="$doctype_uppercased"/>
651
+ <xsl:text> </xsl:text>
664
652
  <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
665
653
  <xsl:if test="normalize-space($amendment-number) != ''">
666
654
  <xsl:value-of select="$amendment-number"/><xsl:text> </xsl:text>
@@ -1193,8 +1181,13 @@
1193
1181
  <xsl:if test="normalize-space($title-part-doc-lang) != ''">
1194
1182
  <xsl:if test="$part != ''">
1195
1183
  <xsl:text> — </xsl:text>
1196
- <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1197
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$lang]),'#',$part)"/>
1184
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1185
+ <xsl:call-template name="getLocalizedString">
1186
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1187
+ </xsl:call-template>
1188
+ <xsl:text> </xsl:text>
1189
+ <xsl:value-of select="$part"/>
1190
+ <xsl:text>:</xsl:text>
1198
1191
  <!-- <xsl:value-of select="$title-part-en"/>
1199
1192
  <xsl:value-of select="$part"/>
1200
1193
  <xsl:text>:</xsl:text> -->
@@ -1334,12 +1327,7 @@
1334
1327
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1335
1328
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1336
1329
  <fo:block font-weight="normal" line-height="1.1">
1337
- <xsl:variable name="title-amendment">
1338
- <xsl:call-template name="getTitle">
1339
- <xsl:with-param name="name" select="'title-amendment'"/>
1340
- </xsl:call-template>
1341
- </xsl:variable>
1342
- <xsl:value-of select="$title-amendment"/>
1330
+ <xsl:value-of select="$doctype_uppercased"/>
1343
1331
  <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1344
1332
  <xsl:if test="normalize-space($amendment-number) != ''">
1345
1333
  <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
@@ -1423,7 +1411,9 @@
1423
1411
 
1424
1412
  <xsl:template name="getListItemFormat">
1425
1413
  <xsl:choose>
1426
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1414
+ <xsl:when test="local-name(..) = 'ul'">
1415
+ <xsl:call-template name="setULLabel"/>
1416
+ </xsl:when>
1427
1417
  <xsl:otherwise> <!-- for ordered lists -->
1428
1418
  <xsl:choose>
1429
1419
  <xsl:when test="../@type = 'arabic'">
@@ -1545,7 +1535,7 @@
1545
1535
  </xsl:choose>
1546
1536
  </xsl:template>
1547
1537
 
1548
- <xsl:template match="iso:title">
1538
+ <xsl:template match="iso:title" name="title">
1549
1539
 
1550
1540
  <xsl:variable name="level">
1551
1541
  <xsl:call-template name="getLevel"/>
@@ -1686,69 +1676,19 @@
1686
1676
  <xsl:template match="iso:li//iso:p//text()">
1687
1677
  <xsl:choose>
1688
1678
  <xsl:when test="contains(., '&#9;')">
1679
+ <!-- <fo:inline white-space="pre"><xsl:value-of select="translate(., $thinspace, ' ')"/></fo:inline> -->
1689
1680
  <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1690
1681
  </xsl:when>
1691
1682
  <xsl:otherwise>
1683
+ <!-- <xsl:value-of select="translate(., $thinspace, ' ')"/> -->
1692
1684
  <xsl:value-of select="."/>
1693
1685
  </xsl:otherwise>
1694
1686
  </xsl:choose>
1695
1687
 
1696
1688
  </xsl:template>
1697
1689
 
1698
- <!--
1699
- <fn reference="1">
1700
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1701
- </fn>
1702
- -->
1703
1690
 
1704
- <xsl:variable name="p_fn">
1705
- <xsl:for-each select="//iso:p/iso:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1706
- <!-- copy unique fn -->
1707
- <fn gen_id="{generate-id(.)}">
1708
- <xsl:copy-of select="@*"/>
1709
- <xsl:copy-of select="node()"/>
1710
- </fn>
1711
- </xsl:for-each>
1712
- </xsl:variable>
1713
1691
 
1714
- <xsl:template match="iso:p/iso:fn" priority="2">
1715
- <xsl:variable name="gen_id" select="generate-id(.)"/>
1716
- <xsl:variable name="reference" select="@reference"/>
1717
- <xsl:variable name="number">
1718
- <!-- <xsl:number level="any" count="iso:p/iso:fn"/> -->
1719
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1720
- </xsl:variable>
1721
- <xsl:choose>
1722
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1723
- <fo:footnote>
1724
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1725
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1726
- <!-- <xsl:value-of select="@reference"/> -->
1727
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1728
- </fo:basic-link>
1729
- </fo:inline>
1730
- <fo:footnote-body>
1731
- <fo:block font-size="10pt" margin-bottom="12pt">
1732
- <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1733
- <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@normative='true']]/iso:note)"/><xsl:text>)</xsl:text>
1734
- </fo:inline>
1735
- <xsl:for-each select="iso:p">
1736
- <xsl:apply-templates/>
1737
- </xsl:for-each>
1738
- </fo:block>
1739
- </fo:footnote-body>
1740
- </fo:footnote>
1741
- </xsl:when>
1742
- <xsl:otherwise>
1743
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1744
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1745
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/>
1746
- </fo:basic-link>
1747
- </fo:inline>
1748
- </xsl:otherwise>
1749
- </xsl:choose>
1750
- </xsl:template>
1751
-
1752
1692
  <xsl:template match="iso:p/iso:fn/iso:p">
1753
1693
  <xsl:apply-templates/>
1754
1694
  </xsl:template>
@@ -1859,7 +1799,10 @@
1859
1799
  <fo:list-item-label end-indent="label-end()">
1860
1800
  <fo:block>
1861
1801
  <fo:inline id="{@id}">
1862
- <xsl:number format="[1]"/>
1802
+ <xsl:value-of select="iso:docidentifier[@type = 'metanorma-ordinal']"/>
1803
+ <xsl:if test="not(iso:docidentifier[@type = 'metanorma-ordinal'])">
1804
+ <xsl:number format="[1]"/>
1805
+ </xsl:if>
1863
1806
  </fo:inline>
1864
1807
  </fo:block>
1865
1808
  </fo:list-item-label>
@@ -1872,9 +1815,6 @@
1872
1815
  </fo:list-block>
1873
1816
  </xsl:template>
1874
1817
 
1875
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> [not(@normative='true')] -->
1876
- <xsl:template match="iso:references/iso:bibitem" mode="contents"/>
1877
-
1878
1818
  <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> iso:references[not(@normative='true')]/ -->
1879
1819
  <xsl:template match="iso:bibitem/iso:title">
1880
1820
  <fo:inline font-style="italic">
@@ -2011,6 +1951,11 @@
2011
1951
  <!-- End of Index processing -->
2012
1952
  <!-- =================== -->
2013
1953
 
1954
+ <!-- <xsl:variable name="thinspace" select="'&#x2009;'"/>
1955
+ <xsl:template match="text()[contains(., $thinspace)]">
1956
+ <xsl:value-of select="translate(., $thinspace, ' ')"/>
1957
+ </xsl:template> -->
1958
+
2014
1959
 
2015
1960
  <xsl:template name="insertHeaderFooter">
2016
1961
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2165,13 +2110,6 @@
2165
2110
 
2166
2111
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2167
2112
 
2168
- <title-annex lang="en">Annex </title-annex>
2169
- <title-annex lang="fr">Annexe </title-annex>
2170
-
2171
- <title-annex lang="zh">Annex </title-annex>
2172
-
2173
-
2174
-
2175
2113
  <title-edition lang="en">
2176
2114
 
2177
2115
  <xsl:text>Edition </xsl:text>
@@ -2185,33 +2123,18 @@
2185
2123
 
2186
2124
  </title-edition>
2187
2125
 
2188
-
2126
+
2127
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2189
2128
  <title-toc lang="en">
2190
2129
 
2191
- <xsl:text>Contents</xsl:text>
2192
-
2193
2130
 
2194
2131
 
2195
2132
  </title-toc>
2196
2133
  <title-toc lang="fr">
2197
2134
 
2198
- <xsl:text>Sommaire</xsl:text>
2199
-
2200
-
2201
- </title-toc>
2202
-
2203
- <title-toc lang="zh">Contents</title-toc>
2204
-
2205
-
2135
+ </title-toc>
2206
2136
 
2207
- <title-page lang="en">Page</title-page>
2208
- <title-page lang="fr">Page</title-page>
2209
2137
 
2210
- <title-key lang="en">Key</title-key>
2211
- <title-key lang="fr">Légende</title-key>
2212
-
2213
- <title-where lang="en">where</title-where>
2214
- <title-where lang="fr">où</title-where>
2215
2138
 
2216
2139
  <title-descriptors lang="en">Descriptors</title-descriptors>
2217
2140
 
@@ -2238,25 +2161,6 @@
2238
2161
 
2239
2162
  </title-subpart>
2240
2163
 
2241
- <title-modified lang="en">modified</title-modified>
2242
- <title-modified lang="fr">modifiée</title-modified>
2243
-
2244
- <title-modified lang="zh">modified</title-modified>
2245
-
2246
-
2247
-
2248
- <title-source lang="en">
2249
-
2250
- <xsl:text>SOURCE</xsl:text>
2251
-
2252
-
2253
- </title-source>
2254
-
2255
- <title-keywords lang="en">Keywords</title-keywords>
2256
-
2257
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2258
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2259
-
2260
2164
  <title-list-tables lang="en">List of Tables</title-list-tables>
2261
2165
 
2262
2166
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2265,37 +2169,8 @@
2265
2169
 
2266
2170
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2267
2171
 
2268
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2269
-
2270
- <title-abstract lang="en">Abstract</title-abstract>
2271
-
2272
2172
  <title-summary lang="en">Summary</title-summary>
2273
2173
 
2274
- <title-in lang="en">in </title-in>
2275
-
2276
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2277
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2278
-
2279
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2280
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2281
-
2282
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2283
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2284
-
2285
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2286
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2287
-
2288
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2289
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2290
-
2291
- <title-caution lang="en">CAUTION</title-caution>
2292
- <title-caution lang="zh">注意</title-caution>
2293
-
2294
- <title-warning lang="en">WARNING</title-warning>
2295
- <title-warning lang="zh">警告</title-warning>
2296
-
2297
- <title-amendment lang="en">AMENDMENT</title-amendment>
2298
-
2299
2174
  <title-continued lang="en">(continued)</title-continued>
2300
2175
  <title-continued lang="fr">(continué)</title-continued>
2301
2176
 
@@ -2410,16 +2285,18 @@
2410
2285
 
2411
2286
 
2412
2287
 
2288
+
2413
2289
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2414
2290
 
2415
2291
 
2416
2292
 
2293
+
2417
2294
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2295
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2418
2296
 
2419
2297
 
2420
2298
 
2421
2299
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2422
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2423
2300
 
2424
2301
 
2425
2302
 
@@ -2445,6 +2322,7 @@
2445
2322
 
2446
2323
 
2447
2324
 
2325
+
2448
2326
  <xsl:attribute name="text-align">justify</xsl:attribute>
2449
2327
 
2450
2328
 
@@ -2741,7 +2619,77 @@
2741
2619
 
2742
2620
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2743
2621
  <xsl:attribute name="line-height">135%</xsl:attribute>
2744
- </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">
2622
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2623
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2624
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2625
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2626
+
2627
+
2628
+
2629
+
2630
+
2631
+
2632
+
2633
+
2634
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2635
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2636
+
2637
+
2638
+
2639
+
2640
+
2641
+
2642
+
2643
+
2644
+
2645
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2646
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2647
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2648
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2649
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2650
+
2651
+
2652
+
2653
+
2654
+
2655
+
2656
+
2657
+
2658
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2659
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2660
+
2661
+
2662
+
2663
+
2664
+
2665
+
2666
+
2667
+
2668
+
2669
+
2670
+
2671
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2672
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2673
+
2674
+
2675
+
2676
+
2677
+
2678
+
2679
+
2680
+
2681
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
2682
+
2683
+
2684
+
2685
+
2686
+
2687
+
2688
+
2689
+
2690
+
2691
+
2692
+ </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">
2745
2693
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2746
2694
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2747
2695
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3783,6 +3731,104 @@
3783
3731
 
3784
3732
  </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">
3785
3733
  <xsl:apply-templates/>
3734
+ </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">
3735
+
3736
+ <!-- list of footnotes to calculate actual footnotes number -->
3737
+ <xsl:variable name="p_fn_">
3738
+ <xsl:choose>
3739
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3740
+ <fn gen_id="{generate-id(.)}">
3741
+ <xsl:copy-of select="@*"/>
3742
+ <xsl:copy-of select="node()"/>
3743
+ </fn>
3744
+ </xsl:when>
3745
+ <xsl:otherwise>
3746
+ <!-- itetation for:
3747
+ footnotes in bibdata/title
3748
+ footnotes in bibliography
3749
+ footnotes in document's body (except table's head/body/foot and figure text)
3750
+ -->
3751
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3752
+ <fn gen_id="{generate-id(.)}">
3753
+ <xsl:copy-of select="@*"/>
3754
+ <xsl:copy-of select="node()"/>
3755
+ </fn>
3756
+ </xsl:for-each>
3757
+ <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']/*">
3758
+ <xsl:sort select="@displayorder" data-type="number"/>
3759
+ <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])]">
3760
+ <!-- copy unique fn -->
3761
+ <fn gen_id="{generate-id(.)}">
3762
+ <xsl:copy-of select="@*"/>
3763
+ <xsl:copy-of select="node()"/>
3764
+ </fn>
3765
+ </xsl:for-each>
3766
+ </xsl:for-each>
3767
+ </xsl:otherwise>
3768
+ </xsl:choose>
3769
+ </xsl:variable>
3770
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3771
+
3772
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3773
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3774
+ <xsl:variable name="reference" select="@reference"/>
3775
+ <!-- fn sequence number in document -->
3776
+ <xsl:variable name="current_fn_number">
3777
+ <xsl:choose>
3778
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3779
+ <xsl:otherwise>
3780
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3781
+ </xsl:otherwise>
3782
+ </xsl:choose>
3783
+ </xsl:variable>
3784
+ <xsl:variable name="current_fn_number_text">
3785
+ <xsl:value-of select="$current_fn_number"/>
3786
+
3787
+
3788
+ <xsl:text>)</xsl:text>
3789
+
3790
+ </xsl:variable>
3791
+
3792
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3793
+ <xsl:variable name="footnote_inline">
3794
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3795
+
3796
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3797
+ <xsl:value-of select="$current_fn_number_text"/>
3798
+ </fo:basic-link>
3799
+ </fo:inline>
3800
+ </xsl:variable>
3801
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3802
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3803
+ <xsl:choose>
3804
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3805
+ <xsl:copy-of select="$footnote_inline"/>
3806
+ </xsl:when>
3807
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3808
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3809
+ <xsl:copy-of select="$footnote_inline"/>
3810
+ <fo:footnote-body>
3811
+
3812
+ <fo:block-container text-indent="0" start-indent="0">
3813
+
3814
+
3815
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3816
+
3817
+
3818
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3819
+
3820
+ <xsl:value-of select="$current_fn_number_text"/>
3821
+ </fo:inline>
3822
+ <xsl:apply-templates/>
3823
+ </fo:block>
3824
+ </fo:block-container>
3825
+ </fo:footnote-body>
3826
+ </fo:footnote>
3827
+ </xsl:when>
3828
+ <xsl:otherwise>
3829
+ <xsl:copy-of select="$footnote_inline"/>
3830
+ </xsl:otherwise>
3831
+ </xsl:choose>
3786
3832
  </xsl:template><xsl:template name="fn_display">
3787
3833
  <xsl:variable name="references">
3788
3834
 
@@ -3984,6 +4030,8 @@
3984
4030
 
3985
4031
  </fo:basic-link>
3986
4032
  </fo:inline>
4033
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4034
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3987
4035
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3988
4036
  <fo:inline>
3989
4037
  <xsl:apply-templates/>
@@ -4036,12 +4084,9 @@
4036
4084
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
4037
4085
 
4038
4086
  <xsl:variable name="title-where">
4039
-
4040
- <xsl:call-template name="getLocalizedString">
4041
- <xsl:with-param name="key">where</xsl:with-param>
4042
- </xsl:call-template>
4043
-
4044
-
4087
+ <xsl:call-template name="getLocalizedString">
4088
+ <xsl:with-param name="key">where</xsl:with-param>
4089
+ </xsl:call-template>
4045
4090
  </xsl:variable>
4046
4091
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4047
4092
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -4059,12 +4104,9 @@
4059
4104
 
4060
4105
 
4061
4106
  <xsl:variable name="title-where">
4062
-
4063
- <xsl:call-template name="getLocalizedString">
4064
- <xsl:with-param name="key">where</xsl:with-param>
4065
- </xsl:call-template>
4066
-
4067
-
4107
+ <xsl:call-template name="getLocalizedString">
4108
+ <xsl:with-param name="key">where</xsl:with-param>
4109
+ </xsl:call-template>
4068
4110
  </xsl:variable>
4069
4111
  <xsl:value-of select="$title-where"/>
4070
4112
  </fo:block>
@@ -4079,12 +4121,9 @@
4079
4121
 
4080
4122
 
4081
4123
  <xsl:variable name="title-key">
4082
-
4083
- <xsl:call-template name="getLocalizedString">
4084
- <xsl:with-param name="key">key</xsl:with-param>
4085
- </xsl:call-template>
4086
-
4087
-
4124
+ <xsl:call-template name="getLocalizedString">
4125
+ <xsl:with-param name="key">key</xsl:with-param>
4126
+ </xsl:call-template>
4088
4127
  </xsl:variable>
4089
4128
  <xsl:value-of select="$title-key"/>
4090
4129
  </fo:block>
@@ -4357,6 +4396,7 @@
4357
4396
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4358
4397
  <xsl:apply-templates/>
4359
4398
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4399
+ <xsl:apply-templates select="@language"/>
4360
4400
  <xsl:apply-templates/>
4361
4401
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4362
4402
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -4418,6 +4458,15 @@
4418
4458
  </fo:inline>
4419
4459
  </xsl:template><xsl:template match="*[local-name()='add']">
4420
4460
  <xsl:choose>
4461
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4462
+ <fo:inline>
4463
+ <xsl:call-template name="insertTag">
4464
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4465
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4466
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4467
+ </xsl:call-template>
4468
+ </fo:inline>
4469
+ </xsl:when>
4421
4470
  <xsl:when test="@amendment">
4422
4471
  <fo:inline>
4423
4472
  <xsl:call-template name="insertTag">
@@ -4452,7 +4501,6 @@
4452
4501
  </fo:inline>
4453
4502
  </xsl:otherwise>
4454
4503
  </xsl:choose>
4455
-
4456
4504
  </xsl:template><xsl:template name="insertTag">
4457
4505
  <xsl:param name="type"/>
4458
4506
  <xsl:param name="kind"/>
@@ -4468,14 +4516,14 @@
4468
4516
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4469
4517
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4470
4518
  <g>
4471
- <xsl:if test="$type = 'closing'">
4519
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4472
4520
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4473
4521
  </xsl:if>
4474
4522
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4475
4523
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4476
4524
  </g>
4477
4525
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4478
- <xsl:if test="$type = 'closing'">
4526
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4479
4527
  <xsl:attribute name="x">25</xsl:attribute>
4480
4528
  </xsl:if>
4481
4529
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -4975,9 +5023,9 @@
4975
5023
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4976
5024
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4977
5025
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4978
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5026
+ <xsl:apply-templates select="*[local-name()='name']"/>
4979
5027
  </fo:block>
4980
- <xsl:apply-templates/>
5028
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
4981
5029
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
4982
5030
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4983
5031
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4997,22 +5045,6 @@
4997
5045
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4998
5046
  <xsl:apply-templates/>
4999
5047
  </fo:inline>
5000
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
5001
- <xsl:variable name="title-modified">
5002
-
5003
- <xsl:call-template name="getLocalizedString">
5004
- <xsl:with-param name="key">modified</xsl:with-param>
5005
- </xsl:call-template>
5006
-
5007
-
5008
- </xsl:variable>
5009
-
5010
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5011
- <xsl:choose>
5012
- <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>
5013
- <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>
5014
- </xsl:choose>
5015
- <xsl:apply-templates/>
5016
5048
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5017
5049
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5018
5050
 
@@ -5590,11 +5622,58 @@
5590
5622
  <xsl:value-of select="."/>
5591
5623
  </xsl:template><xsl:template match="node()" mode="contents">
5592
5624
  <xsl:apply-templates mode="contents"/>
5625
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
5626
+ <xsl:variable name="level">
5627
+ <xsl:call-template name="getLevel">
5628
+ <xsl:with-param name="depth" select="@depth"/>
5629
+ </xsl:call-template>
5630
+ </xsl:variable>
5631
+
5632
+ <xsl:variable name="section">
5633
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5634
+ </xsl:variable>
5635
+
5636
+ <xsl:variable name="type">floating-title</xsl:variable>
5637
+
5638
+ <xsl:variable name="display">
5639
+ <xsl:choose>
5640
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
5641
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
5642
+ <xsl:otherwise>false</xsl:otherwise>
5643
+ </xsl:choose>
5644
+ </xsl:variable>
5645
+
5646
+ <xsl:variable name="skip">false</xsl:variable>
5647
+
5648
+ <xsl:if test="$skip = 'false'">
5649
+
5650
+ <xsl:variable name="title">
5651
+ <xsl:choose>
5652
+ <xsl:when test="*[local-name() = 'tab']">
5653
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
5654
+ </xsl:when>
5655
+ <xsl:otherwise>
5656
+ <xsl:copy-of select="node()"/>
5657
+ </xsl:otherwise>
5658
+ </xsl:choose>
5659
+ </xsl:variable>
5660
+
5661
+ <xsl:variable name="root">
5662
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
5663
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
5664
+ </xsl:variable>
5665
+
5666
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
5667
+ <title>
5668
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
5669
+ </title>
5670
+ </item>
5671
+ </xsl:if>
5593
5672
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5594
5673
  <xsl:apply-templates mode="bookmarks"/>
5595
5674
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5596
5675
  <xsl:apply-templates select="."/>
5597
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5676
+ </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">
5598
5677
  <xsl:apply-templates mode="bookmarks"/>
5599
5678
  </xsl:template><xsl:template name="addBookmarks">
5600
5679
  <xsl:param name="contents"/>
@@ -5765,7 +5844,10 @@
5765
5844
  </fo:block>
5766
5845
  </xsl:if>
5767
5846
  </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">
5768
- <xsl:apply-templates mode="contents_item"/>
5847
+ <xsl:param name="mode">bookmarks</xsl:param>
5848
+ <xsl:apply-templates mode="contents_item">
5849
+ <xsl:with-param name="mode" select="$mode"/>
5850
+ </xsl:apply-templates>
5769
5851
  <!-- <xsl:text> </xsl:text> -->
5770
5852
  </xsl:template><xsl:template name="getSection">
5771
5853
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -5838,6 +5920,18 @@
5838
5920
  <xsl:copy-of select="."/>
5839
5921
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5840
5922
  <xsl:text> </xsl:text>
5923
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
5924
+ <xsl:param name="mode">bookmarks</xsl:param>
5925
+ <xsl:apply-templates mode="contents_item">
5926
+ <xsl:with-param name="mode" select="$mode"/>
5927
+ </xsl:apply-templates>
5928
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
5929
+ <xsl:param name="mode">bookmarks</xsl:param>
5930
+ <xsl:if test="$mode = 'contents'">
5931
+ <xsl:copy>
5932
+ <xsl:apply-templates mode="contents_item"/>
5933
+ </xsl:copy>
5934
+ </xsl:if>
5841
5935
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5842
5936
 
5843
5937
  <fo:block-container margin-left="0mm">
@@ -6174,42 +6268,48 @@
6174
6268
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6175
6269
 
6176
6270
 
6177
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6178
-
6179
- <xsl:variable name="element">
6271
+ <xsl:variable name="fo_element">
6272
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6180
6273
 
6181
6274
  inline
6182
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6275
+
6183
6276
  </xsl:variable>
6184
6277
 
6278
+ <!-- display 'EXAMPLE' -->
6279
+ <xsl:apply-templates select="*[local-name()='name']">
6280
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6281
+ </xsl:apply-templates>
6282
+
6185
6283
  <xsl:choose>
6186
- <xsl:when test="contains(normalize-space($element), 'block')">
6187
- <fo:block xsl:use-attribute-sets="example-body-style">
6188
- <xsl:apply-templates/>
6189
- </fo:block>
6284
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6285
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6286
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6287
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6288
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6289
+ </xsl:apply-templates>
6290
+ </fo:block-container>
6291
+ </fo:block-container>
6190
6292
  </xsl:when>
6191
6293
  <xsl:otherwise>
6192
6294
  <fo:inline>
6193
- <xsl:apply-templates/>
6295
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6296
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6297
+ </xsl:apply-templates>
6194
6298
  </fo:inline>
6195
6299
  </xsl:otherwise>
6196
6300
  </xsl:choose>
6197
6301
 
6198
6302
  </fo:block>
6199
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6200
-
6201
- <xsl:variable name="element">
6202
-
6203
- inline
6204
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6205
- </xsl:variable>
6303
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6304
+ <xsl:param name="fo_element">block</xsl:param>
6305
+
6206
6306
  <xsl:choose>
6207
6307
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6208
6308
  <fo:inline>
6209
6309
  <xsl:apply-templates/>
6210
6310
  </fo:inline>
6211
6311
  </xsl:when>
6212
- <xsl:when test="contains(normalize-space($element), 'block')">
6312
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6213
6313
  <fo:block xsl:use-attribute-sets="example-name-style">
6214
6314
  <xsl:apply-templates/>
6215
6315
  </fo:block>
@@ -6222,19 +6322,20 @@
6222
6322
  </xsl:choose>
6223
6323
 
6224
6324
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6325
+ <xsl:param name="fo_element">block</xsl:param>
6326
+
6225
6327
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6226
6328
  <xsl:variable name="element">
6227
6329
 
6228
-
6229
6330
  <xsl:choose>
6230
6331
  <xsl:when test="$num = 1">inline</xsl:when>
6231
6332
  <xsl:otherwise>block</xsl:otherwise>
6232
6333
  </xsl:choose>
6233
6334
 
6234
-
6335
+ <xsl:value-of select="$fo_element"/>
6235
6336
  </xsl:variable>
6236
6337
  <xsl:choose>
6237
- <xsl:when test="normalize-space($element) = 'block'">
6338
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6238
6339
  <fo:block xsl:use-attribute-sets="example-p-style">
6239
6340
 
6240
6341
  <xsl:apply-templates/>
@@ -6253,60 +6354,66 @@
6253
6354
  <xsl:variable name="termsource_text">
6254
6355
  <xsl:apply-templates/>
6255
6356
  </xsl:variable>
6256
-
6257
- <xsl:choose>
6357
+ <xsl:copy-of select="$termsource_text"/>
6358
+ <!-- <xsl:choose>
6258
6359
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6259
- <!-- <xsl:apply-templates /> -->
6260
6360
  <xsl:copy-of select="$termsource_text"/>
6261
6361
  </xsl:when>
6262
6362
  <xsl:otherwise>
6263
-
6264
-
6363
+ <xsl:if test="$namespace = 'bsi'">
6364
+ <xsl:choose>
6365
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6366
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6367
+ </xsl:choose>
6368
+ </xsl:if>
6369
+ <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'">
6265
6370
  <xsl:text>[</xsl:text>
6266
-
6267
- <!-- <xsl:apply-templates /> -->
6371
+ </xsl:if>
6268
6372
  <xsl:copy-of select="$termsource_text"/>
6269
-
6270
-
6373
+ <xsl:if test="$namespace = 'bsi'">
6374
+ <xsl:choose>
6375
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6376
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6377
+ </xsl:choose>
6378
+ </xsl:if>
6379
+ <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'">
6271
6380
  <xsl:text>]</xsl:text>
6272
-
6381
+ </xsl:if>
6273
6382
  </xsl:otherwise>
6274
- </xsl:choose>
6383
+ </xsl:choose> -->
6275
6384
  </fo:block>
6276
6385
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6277
6386
  <xsl:if test="normalize-space() != ''">
6278
6387
  <xsl:value-of select="."/>
6279
6388
  </xsl:if>
6280
- </xsl:template><xsl:variable name="localized.source">
6281
- <xsl:call-template name="getLocalizedString">
6282
- <xsl:with-param name="key">source</xsl:with-param>
6283
- </xsl:call-template>
6284
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6389
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6390
+ <fo:inline>
6391
+
6392
+
6393
+ <xsl:value-of select="."/>
6394
+ </fo:inline>
6395
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6285
6396
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6286
6397
  <xsl:if test="normalize-space(@citeas) = ''">
6287
6398
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6288
6399
  </xsl:if>
6289
-
6290
-
6291
- <fo:inline>
6292
-
6293
-
6294
-
6295
-
6296
-
6297
- <xsl:value-of select="$localized.source"/>
6298
- <xsl:text>: </xsl:text>
6299
-
6300
-
6301
-
6302
-
6303
- </fo:inline>
6304
-
6305
6400
  <fo:inline xsl:use-attribute-sets="origin-style">
6306
6401
  <xsl:apply-templates/>
6307
6402
  </fo:inline>
6308
-
6309
- </fo:basic-link>
6403
+ </fo:basic-link>
6404
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6405
+ <xsl:variable name="title-modified">
6406
+ <xsl:call-template name="getLocalizedString">
6407
+ <xsl:with-param name="key">modified</xsl:with-param>
6408
+ </xsl:call-template>
6409
+ </xsl:variable>
6410
+
6411
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6412
+ <xsl:choose>
6413
+ <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>
6414
+ <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>
6415
+ </xsl:choose>
6416
+ <xsl:apply-templates/>
6310
6417
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6311
6418
  <fo:inline><xsl:apply-templates/></fo:inline>
6312
6419
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6487,12 +6594,9 @@
6487
6594
  </fo:block>
6488
6595
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6489
6596
  <xsl:variable name="title-deprecated">
6490
-
6491
- <xsl:call-template name="getLocalizedString">
6492
- <xsl:with-param name="key">deprecated</xsl:with-param>
6493
- </xsl:call-template>
6494
-
6495
-
6597
+ <xsl:call-template name="getLocalizedString">
6598
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6599
+ </xsl:call-template>
6496
6600
  </xsl:variable>
6497
6601
  <fo:block xsl:use-attribute-sets="deprecates-style">
6498
6602
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -6501,6 +6605,8 @@
6501
6605
  <xsl:if test="*[local-name() = 'strong']">
6502
6606
  <xsl:attribute name="font-weight">normal</xsl:attribute>
6503
6607
  </xsl:if>
6608
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
6609
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6504
6610
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6505
6611
  <fo:block xsl:use-attribute-sets="definition-style">
6506
6612
  <xsl:apply-templates/>
@@ -6571,6 +6677,51 @@
6571
6677
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6572
6678
  <!-- 0xA0 to space replacement -->
6573
6679
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6680
+ </xsl:template><xsl:variable name="ul_labels_">
6681
+
6682
+
6683
+
6684
+
6685
+
6686
+
6687
+
6688
+ <label>—</label> <!-- em dash -->
6689
+
6690
+
6691
+
6692
+
6693
+
6694
+
6695
+
6696
+
6697
+
6698
+
6699
+
6700
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6701
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6702
+ <xsl:variable name="list_level">
6703
+ <xsl:choose>
6704
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
6705
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
6706
+ </xsl:choose>
6707
+ </xsl:variable>
6708
+ <xsl:choose>
6709
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
6710
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
6711
+ </xsl:when>
6712
+ <xsl:when test="$list_level mod 3 = 0">
6713
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
6714
+ </xsl:when>
6715
+ <xsl:when test="$list_level mod 2 = 0">
6716
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
6717
+ </xsl:when>
6718
+ <xsl:otherwise>
6719
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
6720
+ </xsl:otherwise>
6721
+ </xsl:choose>
6722
+ </xsl:template><xsl:template match="label" mode="ul_labels">
6723
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6724
+ <xsl:value-of select="."/>
6574
6725
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6575
6726
  <xsl:choose>
6576
6727
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6781,7 +6932,12 @@
6781
6932
 
6782
6933
 
6783
6934
 
6784
-
6935
+
6936
+
6937
+
6938
+
6939
+
6940
+
6785
6941
 
6786
6942
 
6787
6943
 
@@ -6792,7 +6948,7 @@
6792
6948
  <xsl:if test="*[local-name() = 'docidentifier']">
6793
6949
  <xsl:choose>
6794
6950
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6795
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier']"/></xsl:otherwise>
6951
+ <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
6796
6952
  </xsl:choose>
6797
6953
  </xsl:if>
6798
6954
  </xsl:variable>
@@ -6813,10 +6969,19 @@
6813
6969
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6814
6970
  <!-- end ISO bibitem processing -->
6815
6971
 
6972
+
6973
+
6974
+
6975
+
6976
+ <!-- end MPFD bibitem processing -->
6816
6977
 
6978
+ <!-- start M3D bibitem processing -->
6979
+
6980
+
6981
+
6817
6982
 
6818
6983
  </xsl:template><xsl:template name="processBibitemDocId">
6819
- <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')]"/>
6984
+ <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')]"/>
6820
6985
  <xsl:choose>
6821
6986
  <xsl:when test="normalize-space($_doc_ident) != ''">
6822
6987
  <!-- <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"/>
@@ -6830,7 +6995,7 @@
6830
6995
  <xsl:if test="$type != ''">
6831
6996
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6832
6997
  </xsl:if> -->
6833
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6998
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
6834
6999
  </xsl:otherwise>
6835
7000
  </xsl:choose>
6836
7001
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -6935,7 +7100,35 @@
6935
7100
  <fo:block-container border="1pt solid black" width="50%">
6936
7101
  <fo:block> </fo:block>
6937
7102
  </fo:block-container>
6938
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
7103
+ </xsl:template><xsl:variable name="toc_level">
7104
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
7105
+ <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:-->
7106
+ <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 -->
7107
+ <xsl:choose>
7108
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
7109
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
7110
+ <xsl:otherwise><!-- default value -->
7111
+
7112
+
7113
+
7114
+
7115
+
7116
+
7117
+
7118
+
7119
+
7120
+
7121
+
7122
+
7123
+
7124
+
7125
+
7126
+
7127
+
7128
+
7129
+ </xsl:otherwise>
7130
+ </xsl:choose>
7131
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6939
7132
  <xsl:param name="colwidths"/>
6940
7133
  <xsl:variable name="colwidths_">
6941
7134
  <xsl:choose>
@@ -7015,7 +7208,7 @@
7015
7208
  </td>
7016
7209
  </xsl:for-each>
7017
7210
  <td>333</td> <!-- page number, just for fill -->
7018
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7211
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7019
7212
  <fo:inline padding-right="5mm"> </fo:inline>
7020
7213
  <fo:inline><xsl:apply-templates/></fo:inline>
7021
7214
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -7026,6 +7219,10 @@
7026
7219
  </svg>
7027
7220
  </fo:instream-foreign-object>
7028
7221
  </fo:inline>
7222
+ </xsl:template><xsl:template match="@language">
7223
+ <xsl:copy-of select="."/>
7224
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
7225
+ <xsl:call-template name="title"/>
7029
7226
  </xsl:template><xsl:template name="convertDate">
7030
7227
  <xsl:param name="date"/>
7031
7228
  <xsl:param name="format" select="'short'"/>
@@ -7383,9 +7580,15 @@
7383
7580
  </xsl:template><xsl:template name="getLocalizedString">
7384
7581
  <xsl:param name="key"/>
7385
7582
  <xsl:param name="formatted">false</xsl:param>
7583
+ <xsl:param name="lang"/>
7386
7584
 
7387
7585
  <xsl:variable name="curr_lang">
7388
- <xsl:call-template name="getLang"/>
7586
+ <xsl:choose>
7587
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7588
+ <xsl:otherwise>
7589
+ <xsl:call-template name="getLang"/>
7590
+ </xsl:otherwise>
7591
+ </xsl:choose>
7389
7592
  </xsl:variable>
7390
7593
 
7391
7594
  <xsl:variable name="data_value">
@@ -7575,4 +7778,14 @@
7575
7778
  </xsl:otherwise>
7576
7779
  </xsl:choose>
7577
7780
  </xsl:if>
7781
+ </xsl:template><xsl:template name="setAltText">
7782
+ <xsl:param name="value"/>
7783
+ <xsl:attribute name="fox:alt-text">
7784
+ <xsl:choose>
7785
+ <xsl:when test="normalize-space($value) != ''">
7786
+ <xsl:value-of select="$value"/>
7787
+ </xsl:when>
7788
+ <xsl:otherwise>_</xsl:otherwise>
7789
+ </xsl:choose>
7790
+ </xsl:attribute>
7578
7791
  </xsl:template></xsl:stylesheet>