metanorma-bipm 1.2.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -727,40 +727,8 @@
727
727
 
728
728
 
729
729
  <xsl:template match="*[local-name()='bibitem']">
730
- <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
731
- <xsl:variable name="docidentifier">
732
- <xsl:if test="*[local-name()='docidentifier']">
733
- <xsl:choose>
734
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
735
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier']"/></xsl:otherwise>
736
- </xsl:choose>
737
- </xsl:if>
738
- </xsl:variable>
739
- <xsl:value-of select="$docidentifier"/>
740
-
741
- <xsl:choose>
742
- <xsl:when test="*[local-name()='formattedref']">
743
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
744
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
745
- </xsl:when>
746
- <xsl:otherwise>
747
- <xsl:apply-templates select="*[local-name()='note']"/>
748
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
749
- <fo:inline font-style="italic">
750
- <xsl:choose>
751
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
752
- <xsl:value-of select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
753
- </xsl:when>
754
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
755
- <xsl:value-of select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
756
- </xsl:when>
757
- <xsl:otherwise>
758
- <xsl:value-of select="*[local-name()='title']"/>
759
- </xsl:otherwise>
760
- </xsl:choose>
761
- </fo:inline>
762
- </xsl:otherwise>
763
- </xsl:choose>
730
+ <fo:block id="{@id}" margin-bottom="6pt">
731
+ <xsl:call-template name="processBibitem"/>
764
732
  </fo:block>
765
733
  </xsl:template>
766
734
 
@@ -925,44 +893,24 @@
925
893
  <fo:list-item-label end-indent="label-end()">
926
894
  <fo:block>
927
895
  <fo:inline id="{@id}">
928
- <xsl:number format="[1]"/>
896
+ <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
897
+ <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
898
+ <xsl:number format="[1]"/>
899
+ </xsl:if>
929
900
  </fo:inline>
930
901
  </fo:block>
931
902
  </fo:list-item-label>
932
903
  <fo:list-item-body start-indent="body-start()">
933
904
  <fo:block>
934
- <xsl:variable name="docidentifier">
935
- <xsl:if test="*[local-name()='docidentifier']">
936
- <xsl:choose>
937
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
938
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier']"/></xsl:otherwise>
939
- </xsl:choose>
940
- </xsl:if>
941
- </xsl:variable>
942
- <xsl:value-of select="$docidentifier"/>
943
- <xsl:apply-templates select="*[local-name()='note']"/>
944
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
945
- <xsl:choose>
946
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
947
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
948
- </xsl:when>
949
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
950
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
951
- </xsl:when>
952
- <xsl:otherwise>
953
- <xsl:apply-templates select="*[local-name()='title']"/>
954
- </xsl:otherwise>
955
- </xsl:choose>
956
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
905
+ <xsl:call-template name="processBibitem"/>
957
906
  </fo:block>
958
907
  </fo:list-item-body>
959
908
  </fo:list-item>
960
909
  </fo:list-block>
961
910
  </xsl:template>
962
911
 
963
- <xsl:template match="*[local-name()='references']/*[local-name()='bibitem']" mode="contents"/>
964
912
 
965
- <xsl:template match="*[local-name()='references'][not(@normative='true')]/*[local-name()='bibitem']/*[local-name()='title']">
913
+ <xsl:template match="*[local-name()='references']/*[local-name()='bibitem']/*[local-name()='title']">
966
914
  <fo:inline font-style="italic">
967
915
  <xsl:apply-templates/>
968
916
  </fo:inline>
@@ -2014,11 +1962,6 @@
2014
1962
 
2015
1963
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2016
1964
 
2017
- <title-annex lang="en">Annex </title-annex>
2018
- <title-annex lang="fr">Annexe </title-annex>
2019
-
2020
-
2021
-
2022
1965
  <title-edition lang="en">
2023
1966
 
2024
1967
  <xsl:text>Edition </xsl:text>
@@ -2032,7 +1975,8 @@
2032
1975
 
2033
1976
  </title-edition>
2034
1977
 
2035
-
1978
+
1979
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2036
1980
  <title-toc lang="en">
2037
1981
 
2038
1982
 
@@ -2040,19 +1984,9 @@
2040
1984
  </title-toc>
2041
1985
  <title-toc lang="fr">
2042
1986
 
2043
-
2044
- </title-toc>
2045
-
2046
-
1987
+ </title-toc>
2047
1988
 
2048
- <title-page lang="en">Page</title-page>
2049
- <title-page lang="fr">Page</title-page>
2050
1989
 
2051
- <title-key lang="en">Key</title-key>
2052
- <title-key lang="fr">Légende</title-key>
2053
-
2054
- <title-where lang="en">where</title-where>
2055
- <title-where lang="fr">où</title-where>
2056
1990
 
2057
1991
  <title-descriptors lang="en">Descriptors</title-descriptors>
2058
1992
 
@@ -2075,21 +2009,6 @@
2075
2009
 
2076
2010
  </title-subpart>
2077
2011
 
2078
- <title-modified lang="en">modified</title-modified>
2079
- <title-modified lang="fr">modifiée</title-modified>
2080
-
2081
-
2082
-
2083
- <title-source lang="en">
2084
-
2085
-
2086
- </title-source>
2087
-
2088
- <title-keywords lang="en">Keywords</title-keywords>
2089
-
2090
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2091
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2092
-
2093
2012
  <title-list-tables lang="en">List of Tables</title-list-tables>
2094
2013
 
2095
2014
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2098,37 +2017,8 @@
2098
2017
 
2099
2018
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2100
2019
 
2101
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2102
-
2103
- <title-abstract lang="en">Abstract</title-abstract>
2104
-
2105
2020
  <title-summary lang="en">Summary</title-summary>
2106
2021
 
2107
- <title-in lang="en">in </title-in>
2108
-
2109
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2110
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2111
-
2112
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2113
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2114
-
2115
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2116
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2117
-
2118
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2119
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2120
-
2121
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2122
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2123
-
2124
- <title-caution lang="en">CAUTION</title-caution>
2125
- <title-caution lang="zh">注意</title-caution>
2126
-
2127
- <title-warning lang="en">WARNING</title-warning>
2128
- <title-warning lang="zh">警告</title-warning>
2129
-
2130
- <title-amendment lang="en">AMENDMENT</title-amendment>
2131
-
2132
2022
  <title-continued lang="en">(continued)</title-continued>
2133
2023
  <title-continued lang="fr">(continué)</title-continued>
2134
2024
 
@@ -2246,16 +2136,18 @@
2246
2136
 
2247
2137
 
2248
2138
 
2139
+
2249
2140
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2250
2141
 
2251
2142
 
2252
2143
 
2144
+
2253
2145
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2146
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2254
2147
 
2255
2148
 
2256
2149
 
2257
2150
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2258
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2259
2151
 
2260
2152
 
2261
2153
 
@@ -2290,6 +2182,7 @@
2290
2182
 
2291
2183
 
2292
2184
 
2185
+
2293
2186
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2294
2187
 
2295
2188
 
@@ -2651,7 +2544,7 @@
2651
2544
 
2652
2545
 
2653
2546
 
2654
- </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">
2547
+ </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">
2655
2548
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2656
2549
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2657
2550
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4043,12 +3936,9 @@
4043
3936
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
4044
3937
 
4045
3938
  <xsl:variable name="title-where">
4046
-
4047
- <xsl:call-template name="getLocalizedString">
4048
- <xsl:with-param name="key">where</xsl:with-param>
4049
- </xsl:call-template>
4050
-
4051
-
3939
+ <xsl:call-template name="getLocalizedString">
3940
+ <xsl:with-param name="key">where</xsl:with-param>
3941
+ </xsl:call-template>
4052
3942
  </xsl:variable>
4053
3943
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4054
3944
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -4066,12 +3956,9 @@
4066
3956
 
4067
3957
 
4068
3958
  <xsl:variable name="title-where">
4069
-
4070
- <xsl:call-template name="getLocalizedString">
4071
- <xsl:with-param name="key">where</xsl:with-param>
4072
- </xsl:call-template>
4073
-
4074
-
3959
+ <xsl:call-template name="getLocalizedString">
3960
+ <xsl:with-param name="key">where</xsl:with-param>
3961
+ </xsl:call-template>
4075
3962
  </xsl:variable>
4076
3963
  <xsl:value-of select="$title-where"/>
4077
3964
  </fo:block>
@@ -4086,12 +3973,9 @@
4086
3973
 
4087
3974
 
4088
3975
  <xsl:variable name="title-key">
4089
-
4090
- <xsl:call-template name="getLocalizedString">
4091
- <xsl:with-param name="key">key</xsl:with-param>
4092
- </xsl:call-template>
4093
-
4094
-
3976
+ <xsl:call-template name="getLocalizedString">
3977
+ <xsl:with-param name="key">key</xsl:with-param>
3978
+ </xsl:call-template>
4095
3979
  </xsl:variable>
4096
3980
  <xsl:value-of select="$title-key"/>
4097
3981
  </fo:block>
@@ -4426,6 +4310,15 @@
4426
4310
  </fo:inline>
4427
4311
  </xsl:template><xsl:template match="*[local-name()='add']">
4428
4312
  <xsl:choose>
4313
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4314
+ <fo:inline>
4315
+ <xsl:call-template name="insertTag">
4316
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4317
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4318
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4319
+ </xsl:call-template>
4320
+ </fo:inline>
4321
+ </xsl:when>
4429
4322
  <xsl:when test="@amendment">
4430
4323
  <fo:inline>
4431
4324
  <xsl:call-template name="insertTag">
@@ -4460,7 +4353,6 @@
4460
4353
  </fo:inline>
4461
4354
  </xsl:otherwise>
4462
4355
  </xsl:choose>
4463
-
4464
4356
  </xsl:template><xsl:template name="insertTag">
4465
4357
  <xsl:param name="type"/>
4466
4358
  <xsl:param name="kind"/>
@@ -4476,14 +4368,14 @@
4476
4368
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4477
4369
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4478
4370
  <g>
4479
- <xsl:if test="$type = 'closing'">
4371
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4480
4372
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4481
4373
  </xsl:if>
4482
4374
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4483
4375
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4484
4376
  </g>
4485
4377
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4486
- <xsl:if test="$type = 'closing'">
4378
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4487
4379
  <xsl:attribute name="x">25</xsl:attribute>
4488
4380
  </xsl:if>
4489
4381
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -4976,9 +4868,9 @@
4976
4868
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4977
4869
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4978
4870
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4979
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4871
+ <xsl:apply-templates select="*[local-name()='name']"/>
4980
4872
  </fo:block>
4981
- <xsl:apply-templates/>
4873
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
4982
4874
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
4983
4875
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4984
4876
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -5573,11 +5465,58 @@
5573
5465
  <xsl:value-of select="."/>
5574
5466
  </xsl:template><xsl:template match="node()" mode="contents">
5575
5467
  <xsl:apply-templates mode="contents"/>
5468
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
5469
+ <xsl:variable name="level">
5470
+ <xsl:call-template name="getLevel">
5471
+ <xsl:with-param name="depth" select="@depth"/>
5472
+ </xsl:call-template>
5473
+ </xsl:variable>
5474
+
5475
+ <xsl:variable name="section">
5476
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5477
+ </xsl:variable>
5478
+
5479
+ <xsl:variable name="type">floating-title</xsl:variable>
5480
+
5481
+ <xsl:variable name="display">
5482
+ <xsl:choose>
5483
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
5484
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
5485
+ <xsl:otherwise>false</xsl:otherwise>
5486
+ </xsl:choose>
5487
+ </xsl:variable>
5488
+
5489
+ <xsl:variable name="skip">false</xsl:variable>
5490
+
5491
+ <xsl:if test="$skip = 'false'">
5492
+
5493
+ <xsl:variable name="title">
5494
+ <xsl:choose>
5495
+ <xsl:when test="*[local-name() = 'tab']">
5496
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
5497
+ </xsl:when>
5498
+ <xsl:otherwise>
5499
+ <xsl:copy-of select="node()"/>
5500
+ </xsl:otherwise>
5501
+ </xsl:choose>
5502
+ </xsl:variable>
5503
+
5504
+ <xsl:variable name="root">
5505
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
5506
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
5507
+ </xsl:variable>
5508
+
5509
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
5510
+ <title>
5511
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
5512
+ </title>
5513
+ </item>
5514
+ </xsl:if>
5576
5515
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5577
5516
  <xsl:apply-templates mode="bookmarks"/>
5578
5517
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5579
5518
  <xsl:apply-templates select="."/>
5580
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5519
+ </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">
5581
5520
  <xsl:apply-templates mode="bookmarks"/>
5582
5521
  </xsl:template><xsl:template name="addBookmarks">
5583
5522
  <xsl:param name="contents"/>
@@ -5748,7 +5687,10 @@
5748
5687
  </fo:block>
5749
5688
  </xsl:if>
5750
5689
  </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">
5751
- <xsl:apply-templates mode="contents_item"/>
5690
+ <xsl:param name="mode">bookmarks</xsl:param>
5691
+ <xsl:apply-templates mode="contents_item">
5692
+ <xsl:with-param name="mode" select="$mode"/>
5693
+ </xsl:apply-templates>
5752
5694
  <!-- <xsl:text> </xsl:text> -->
5753
5695
  </xsl:template><xsl:template name="getSection">
5754
5696
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -5821,6 +5763,18 @@
5821
5763
  <xsl:copy-of select="."/>
5822
5764
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5823
5765
  <xsl:text> </xsl:text>
5766
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
5767
+ <xsl:param name="mode">bookmarks</xsl:param>
5768
+ <xsl:apply-templates mode="contents_item">
5769
+ <xsl:with-param name="mode" select="$mode"/>
5770
+ </xsl:apply-templates>
5771
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
5772
+ <xsl:param name="mode">bookmarks</xsl:param>
5773
+ <xsl:if test="$mode = 'contents'">
5774
+ <xsl:copy>
5775
+ <xsl:apply-templates mode="contents_item"/>
5776
+ </xsl:copy>
5777
+ </xsl:if>
5824
5778
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5825
5779
 
5826
5780
  <fo:block-container margin-left="0mm">
@@ -6157,42 +6111,48 @@
6157
6111
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6158
6112
 
6159
6113
 
6160
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6161
-
6162
- <xsl:variable name="element">
6114
+ <xsl:variable name="fo_element">
6115
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6163
6116
 
6164
6117
  inline
6165
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6118
+
6166
6119
  </xsl:variable>
6167
6120
 
6121
+ <!-- display 'EXAMPLE' -->
6122
+ <xsl:apply-templates select="*[local-name()='name']">
6123
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6124
+ </xsl:apply-templates>
6125
+
6168
6126
  <xsl:choose>
6169
- <xsl:when test="contains(normalize-space($element), 'block')">
6170
- <fo:block xsl:use-attribute-sets="example-body-style">
6171
- <xsl:apply-templates/>
6172
- </fo:block>
6127
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6128
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6129
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6130
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6131
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6132
+ </xsl:apply-templates>
6133
+ </fo:block-container>
6134
+ </fo:block-container>
6173
6135
  </xsl:when>
6174
6136
  <xsl:otherwise>
6175
6137
  <fo:inline>
6176
- <xsl:apply-templates/>
6138
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6139
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6140
+ </xsl:apply-templates>
6177
6141
  </fo:inline>
6178
6142
  </xsl:otherwise>
6179
6143
  </xsl:choose>
6180
6144
 
6181
6145
  </fo:block>
6182
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6183
-
6184
- <xsl:variable name="element">
6185
-
6186
- inline
6187
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6188
- </xsl:variable>
6146
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6147
+ <xsl:param name="fo_element">block</xsl:param>
6148
+
6189
6149
  <xsl:choose>
6190
6150
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6191
6151
  <fo:inline>
6192
6152
  <xsl:apply-templates/>
6193
6153
  </fo:inline>
6194
6154
  </xsl:when>
6195
- <xsl:when test="contains(normalize-space($element), 'block')">
6155
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6196
6156
  <fo:block xsl:use-attribute-sets="example-name-style">
6197
6157
  <xsl:apply-templates/>
6198
6158
  </fo:block>
@@ -6205,19 +6165,20 @@
6205
6165
  </xsl:choose>
6206
6166
 
6207
6167
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6168
+ <xsl:param name="fo_element">block</xsl:param>
6169
+
6208
6170
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6209
6171
  <xsl:variable name="element">
6210
6172
 
6211
-
6212
6173
  <xsl:choose>
6213
6174
  <xsl:when test="$num = 1">inline</xsl:when>
6214
6175
  <xsl:otherwise>block</xsl:otherwise>
6215
6176
  </xsl:choose>
6216
6177
 
6217
-
6178
+ <xsl:value-of select="$fo_element"/>
6218
6179
  </xsl:variable>
6219
6180
  <xsl:choose>
6220
- <xsl:when test="normalize-space($element) = 'block'">
6181
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6221
6182
  <fo:block xsl:use-attribute-sets="example-p-style">
6222
6183
 
6223
6184
  <xsl:apply-templates/>
@@ -6285,12 +6246,9 @@
6285
6246
  </fo:basic-link>
6286
6247
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
6287
6248
  <xsl:variable name="title-modified">
6288
-
6289
- <xsl:call-template name="getLocalizedString">
6290
- <xsl:with-param name="key">modified</xsl:with-param>
6291
- </xsl:call-template>
6292
-
6293
-
6249
+ <xsl:call-template name="getLocalizedString">
6250
+ <xsl:with-param name="key">modified</xsl:with-param>
6251
+ </xsl:call-template>
6294
6252
  </xsl:variable>
6295
6253
 
6296
6254
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -6489,12 +6447,9 @@
6489
6447
  </fo:block>
6490
6448
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6491
6449
  <xsl:variable name="title-deprecated">
6492
-
6493
- <xsl:call-template name="getLocalizedString">
6494
- <xsl:with-param name="key">deprecated</xsl:with-param>
6495
- </xsl:call-template>
6496
-
6497
-
6450
+ <xsl:call-template name="getLocalizedString">
6451
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6452
+ </xsl:call-template>
6498
6453
  </xsl:variable>
6499
6454
  <fo:block xsl:use-attribute-sets="deprecates-style">
6500
6455
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -6503,6 +6458,8 @@
6503
6458
  <xsl:if test="*[local-name() = 'strong']">
6504
6459
  <xsl:attribute name="font-weight">normal</xsl:attribute>
6505
6460
  </xsl:if>
6461
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
6462
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6506
6463
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6507
6464
  <fo:block xsl:use-attribute-sets="definition-style">
6508
6465
  <xsl:apply-templates/>
@@ -6834,16 +6791,64 @@
6834
6791
 
6835
6792
 
6836
6793
 
6837
-
6794
+
6795
+
6796
+
6797
+
6798
+
6799
+
6838
6800
 
6839
6801
 
6840
6802
 
6841
6803
 
6842
6804
 
6805
+
6806
+
6807
+ <!-- start JCGM bibitem processing -->
6808
+ <xsl:variable name="docidentifier">
6809
+ <xsl:if test="*[local-name()='docidentifier']">
6810
+ <xsl:choose>
6811
+ <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
6812
+ <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
6813
+ </xsl:choose>
6814
+ </xsl:if>
6815
+ </xsl:variable>
6816
+ <xsl:value-of select="$docidentifier"/>
6817
+
6818
+ <xsl:choose>
6819
+ <xsl:when test="*[local-name()='formattedref']">
6820
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6821
+ <xsl:apply-templates select="*[local-name()='formattedref']"/>
6822
+ </xsl:when>
6823
+ <xsl:otherwise>
6824
+ <xsl:apply-templates select="*[local-name()='note']"/>
6825
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6826
+ <xsl:choose>
6827
+ <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
6828
+ <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
6829
+ </xsl:when>
6830
+ <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
6831
+ <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
6832
+ </xsl:when>
6833
+ <xsl:otherwise>
6834
+ <xsl:apply-templates select="*[local-name()='title']"/>
6835
+ </xsl:otherwise>
6836
+ </xsl:choose>
6837
+ </xsl:otherwise>
6838
+ </xsl:choose>
6839
+ <!-- end JCGM bibitem processing -->
6840
+
6841
+
6842
+
6843
+ <!-- end MPFD bibitem processing -->
6844
+
6845
+ <!-- start M3D bibitem processing -->
6843
6846
 
6844
6847
 
6848
+
6849
+
6845
6850
  </xsl:template><xsl:template name="processBibitemDocId">
6846
- <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')]"/>
6851
+ <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')]"/>
6847
6852
  <xsl:choose>
6848
6853
  <xsl:when test="normalize-space($_doc_ident) != ''">
6849
6854
  <!-- <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"/>
@@ -6857,7 +6862,7 @@
6857
6862
  <xsl:if test="$type != ''">
6858
6863
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6859
6864
  </xsl:if> -->
6860
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6865
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
6861
6866
  </xsl:otherwise>
6862
6867
  </xsl:choose>
6863
6868
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -6963,8 +6968,12 @@
6963
6968
  <fo:block> </fo:block>
6964
6969
  </fo:block-container>
6965
6970
  </xsl:template><xsl:variable name="toc_level">
6971
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
6972
+ <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:-->
6973
+ <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 -->
6966
6974
  <xsl:choose>
6967
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
6975
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
6976
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
6968
6977
  <xsl:otherwise><!-- default value -->
6969
6978
 
6970
6979
 
@@ -7066,7 +7075,7 @@
7066
7075
  </td>
7067
7076
  </xsl:for-each>
7068
7077
  <td>333</td> <!-- page number, just for fill -->
7069
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7078
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7070
7079
  <fo:inline padding-right="5mm"> </fo:inline>
7071
7080
  <fo:inline><xsl:apply-templates/></fo:inline>
7072
7081
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -7435,9 +7444,15 @@
7435
7444
  </xsl:template><xsl:template name="getLocalizedString">
7436
7445
  <xsl:param name="key"/>
7437
7446
  <xsl:param name="formatted">false</xsl:param>
7447
+ <xsl:param name="lang"/>
7438
7448
 
7439
7449
  <xsl:variable name="curr_lang">
7440
- <xsl:call-template name="getLang"/>
7450
+ <xsl:choose>
7451
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7452
+ <xsl:otherwise>
7453
+ <xsl:call-template name="getLang"/>
7454
+ </xsl:otherwise>
7455
+ </xsl:choose>
7441
7456
  </xsl:variable>
7442
7457
 
7443
7458
  <xsl:variable name="data_value">