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.
@@ -1258,9 +1258,6 @@
1258
1258
 
1259
1259
  <xsl:variable name="title-toc">
1260
1260
  <fo:inline>
1261
- <!-- <xsl:call-template name="getTitle">
1262
- <xsl:with-param name="name" select="'title-toc'"/>
1263
- </xsl:call-template> -->
1264
1261
  <xsl:call-template name="getLocalizedString">
1265
1262
  <xsl:with-param name="key">table_of_contents</xsl:with-param>
1266
1263
  </xsl:call-template>
@@ -1432,7 +1429,12 @@
1432
1429
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']">
1433
1430
  <fo:block role="H2">
1434
1431
  <xsl:if test="$part_num != ''">
1435
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part_num)"/>
1432
+ <xsl:call-template name="getLocalizedString">
1433
+ <xsl:with-param name="key">Part.sg</xsl:with-param>
1434
+ <xsl:with-param name="lang" select="$curr_lang"/>
1435
+ </xsl:call-template>
1436
+ <xsl:text> </xsl:text>
1437
+ <xsl:value-of select="$part_num"/>
1436
1438
  </xsl:if>
1437
1439
  <xsl:text>: </xsl:text>
1438
1440
  <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']" mode="title"/>
@@ -1757,9 +1759,13 @@
1757
1759
  <xsl:if test="$part_num != ''">
1758
1760
  <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1759
1761
  <!-- Part -->
1760
- <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/></fo:block>
1762
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}">
1763
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/>
1764
+ </fo:block>
1761
1765
  <!-- Partie -->
1762
- <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/></fo:block>
1766
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}">
1767
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/>
1768
+ </fo:block>
1763
1769
  </xsl:if>
1764
1770
 
1765
1771
  <fo:block font-size="{$font-size-factor * 30.4}pt">
@@ -3340,11 +3346,13 @@
3340
3346
  <fo:table-body>
3341
3347
  <fo:table-row>
3342
3348
  <fo:table-cell>
3343
- <fo:block><xsl:apply-templates select="*[local-name()='name']" mode="presentation"/></fo:block>
3349
+ <fo:block>
3350
+ <xsl:apply-templates select="*[local-name()='name']"/>
3351
+ </fo:block>
3344
3352
  </fo:table-cell>
3345
3353
  <fo:table-cell>
3346
3354
  <fo:block>
3347
- <xsl:apply-templates/>
3355
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3348
3356
  </fo:block>
3349
3357
  </fo:table-cell>
3350
3358
  </fo:table-row>
@@ -3428,14 +3436,17 @@
3428
3436
  <fo:block>
3429
3437
  <fo:inline>
3430
3438
  <!-- <xsl:number format="1."/> -->
3431
- <xsl:choose>
3432
- <xsl:when test="bipm:docidentifier[@type='metanorma']">
3433
- <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
3434
- </xsl:when>
3435
- <xsl:otherwise>
3436
- <xsl:number format="[1]"/>
3437
- </xsl:otherwise>
3438
- </xsl:choose>
3439
+ <xsl:value-of select="bipm:docidentifier[@type='metanorma-ordinal']"/>
3440
+ <xsl:if test="not(bipm:docidentifier[@type='metanorma-ordinal'])">
3441
+ <xsl:choose>
3442
+ <xsl:when test="bipm:docidentifier[@type='metanorma']">
3443
+ <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
3444
+ </xsl:when>
3445
+ <xsl:otherwise>
3446
+ <xsl:number format="[1]"/>
3447
+ </xsl:otherwise>
3448
+ </xsl:choose>
3449
+ </xsl:if>
3439
3450
  </fo:inline>
3440
3451
  </fo:block>
3441
3452
  </fo:list-item-label>
@@ -3449,8 +3460,6 @@
3449
3460
  </fo:list-block>
3450
3461
  </xsl:template>
3451
3462
 
3452
-
3453
- <xsl:template match="bipm:references[not(@normative='true')]/bipm:bibitem" mode="contents"/>
3454
3463
 
3455
3464
  <xsl:template match="bipm:bibitem/bipm:title">
3456
3465
  <fo:inline font-style="italic">
@@ -3458,7 +3467,7 @@
3458
3467
  </fo:inline>
3459
3468
  </xsl:template>
3460
3469
 
3461
- <xsl:template match="bipm:references/bipm:bibitem/bipm:docidentifier[@type='metanorma' and ../bipm:formattedref]"/>
3470
+ <xsl:template match="bipm:references/bipm:bibitem/bipm:docidentifier[(@type='metanorma' or @type='metanorma-ordinal') and ../bipm:formattedref]"/>
3462
3471
 
3463
3472
 
3464
3473
  <xsl:template match="bipm:pagebreak">
@@ -4654,13 +4663,6 @@
4654
4663
 
4655
4664
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
4656
4665
 
4657
- <title-annex lang="en">Annex </title-annex>
4658
- <title-annex lang="fr">Annexe </title-annex>
4659
-
4660
- <title-annex lang="zh">Annex </title-annex>
4661
-
4662
-
4663
-
4664
4666
  <title-edition lang="en">
4665
4667
 
4666
4668
  <xsl:text>Edition </xsl:text>
@@ -4674,33 +4676,18 @@
4674
4676
 
4675
4677
  </title-edition>
4676
4678
 
4677
-
4679
+
4680
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
4678
4681
  <title-toc lang="en">
4679
4682
 
4680
- <xsl:text>Contents</xsl:text>
4681
-
4682
4683
 
4683
4684
 
4684
4685
  </title-toc>
4685
4686
  <title-toc lang="fr">
4686
4687
 
4687
-
4688
- <xsl:text>Table des matières</xsl:text>
4689
-
4690
- </title-toc>
4691
-
4692
- <title-toc lang="zh">Contents</title-toc>
4693
-
4694
-
4688
+ </title-toc>
4695
4689
 
4696
- <title-page lang="en">Page</title-page>
4697
- <title-page lang="fr">Page</title-page>
4698
4690
 
4699
- <title-key lang="en">Key</title-key>
4700
- <title-key lang="fr">Légende</title-key>
4701
-
4702
- <title-where lang="en">where</title-where>
4703
- <title-where lang="fr">où</title-where>
4704
4691
 
4705
4692
  <title-descriptors lang="en">Descriptors</title-descriptors>
4706
4693
 
@@ -4731,25 +4718,6 @@
4731
4718
 
4732
4719
  </title-subpart>
4733
4720
 
4734
- <title-modified lang="en">modified</title-modified>
4735
- <title-modified lang="fr">modifiée</title-modified>
4736
-
4737
- <title-modified lang="zh">modified</title-modified>
4738
-
4739
-
4740
-
4741
- <title-source lang="en">
4742
-
4743
- <xsl:text>SOURCE</xsl:text>
4744
-
4745
-
4746
- </title-source>
4747
-
4748
- <title-keywords lang="en">Keywords</title-keywords>
4749
-
4750
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
4751
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
4752
-
4753
4721
  <title-list-tables lang="en">List of Tables</title-list-tables>
4754
4722
 
4755
4723
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -4758,37 +4726,8 @@
4758
4726
 
4759
4727
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
4760
4728
 
4761
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
4762
-
4763
- <title-abstract lang="en">Abstract</title-abstract>
4764
-
4765
4729
  <title-summary lang="en">Summary</title-summary>
4766
4730
 
4767
- <title-in lang="en">in </title-in>
4768
-
4769
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
4770
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
4771
-
4772
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
4773
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
4774
-
4775
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
4776
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
4777
-
4778
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
4779
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
4780
-
4781
- <title-obligation-normative lang="en">normative</title-obligation-normative>
4782
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
4783
-
4784
- <title-caution lang="en">CAUTION</title-caution>
4785
- <title-caution lang="zh">注意</title-caution>
4786
-
4787
- <title-warning lang="en">WARNING</title-warning>
4788
- <title-warning lang="zh">警告</title-warning>
4789
-
4790
- <title-amendment lang="en">AMENDMENT</title-amendment>
4791
-
4792
4731
  <title-continued lang="en">(continued)</title-continued>
4793
4732
  <title-continued lang="fr">(continué)</title-continued>
4794
4733
 
@@ -4893,6 +4832,7 @@
4893
4832
 
4894
4833
 
4895
4834
 
4835
+
4896
4836
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
4897
4837
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4898
4838
 
@@ -4901,7 +4841,9 @@
4901
4841
 
4902
4842
 
4903
4843
 
4844
+
4904
4845
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
4846
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4905
4847
 
4906
4848
 
4907
4849
 
@@ -4936,6 +4878,7 @@
4936
4878
 
4937
4879
 
4938
4880
 
4881
+
4939
4882
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4940
4883
 
4941
4884
 
@@ -5259,7 +5202,7 @@
5259
5202
 
5260
5203
 
5261
5204
 
5262
- </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">
5205
+ </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">
5263
5206
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
5264
5207
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
5265
5208
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -6657,12 +6600,9 @@
6657
6600
  <fo:block margin-bottom="12pt" text-align="left">
6658
6601
 
6659
6602
  <xsl:variable name="title-where">
6660
-
6661
-
6662
- <xsl:call-template name="getTitle">
6663
- <xsl:with-param name="name" select="'title-where'"/>
6664
- </xsl:call-template>
6665
-
6603
+ <xsl:call-template name="getLocalizedString">
6604
+ <xsl:with-param name="key">where</xsl:with-param>
6605
+ </xsl:call-template>
6666
6606
  </xsl:variable>
6667
6607
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
6668
6608
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -6678,12 +6618,9 @@
6678
6618
 
6679
6619
 
6680
6620
  <xsl:variable name="title-where">
6681
-
6682
-
6683
- <xsl:call-template name="getTitle">
6684
- <xsl:with-param name="name" select="'title-where'"/>
6685
- </xsl:call-template>
6686
-
6621
+ <xsl:call-template name="getLocalizedString">
6622
+ <xsl:with-param name="key">where</xsl:with-param>
6623
+ </xsl:call-template>
6687
6624
  </xsl:variable>
6688
6625
  <xsl:value-of select="$title-where"/>
6689
6626
  </fo:block>
@@ -6695,12 +6632,9 @@
6695
6632
 
6696
6633
 
6697
6634
  <xsl:variable name="title-key">
6698
-
6699
-
6700
- <xsl:call-template name="getTitle">
6701
- <xsl:with-param name="name" select="'title-key'"/>
6702
- </xsl:call-template>
6703
-
6635
+ <xsl:call-template name="getLocalizedString">
6636
+ <xsl:with-param name="key">key</xsl:with-param>
6637
+ </xsl:call-template>
6704
6638
  </xsl:variable>
6705
6639
  <xsl:value-of select="$title-key"/>
6706
6640
  </fo:block>
@@ -7031,6 +6965,15 @@
7031
6965
  </fo:inline>
7032
6966
  </xsl:template><xsl:template match="*[local-name()='add']">
7033
6967
  <xsl:choose>
6968
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
6969
+ <fo:inline>
6970
+ <xsl:call-template name="insertTag">
6971
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
6972
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
6973
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
6974
+ </xsl:call-template>
6975
+ </fo:inline>
6976
+ </xsl:when>
7034
6977
  <xsl:when test="@amendment">
7035
6978
  <fo:inline>
7036
6979
  <xsl:call-template name="insertTag">
@@ -7065,7 +7008,6 @@
7065
7008
  </fo:inline>
7066
7009
  </xsl:otherwise>
7067
7010
  </xsl:choose>
7068
-
7069
7011
  </xsl:template><xsl:template name="insertTag">
7070
7012
  <xsl:param name="type"/>
7071
7013
  <xsl:param name="kind"/>
@@ -7081,14 +7023,14 @@
7081
7023
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7082
7024
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7083
7025
  <g>
7084
- <xsl:if test="$type = 'closing'">
7026
+ <xsl:if test="$type = 'closing' or $type = 'end'">
7085
7027
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
7086
7028
  </xsl:if>
7087
7029
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
7088
7030
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
7089
7031
  </g>
7090
7032
  <text font-family="Arial" x="15" y="57" font-size="40pt">
7091
- <xsl:if test="$type = 'closing'">
7033
+ <xsl:if test="$type = 'closing' or $type = 'end'">
7092
7034
  <xsl:attribute name="x">25</xsl:attribute>
7093
7035
  </xsl:if>
7094
7036
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -7609,9 +7551,9 @@
7609
7551
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
7610
7552
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
7611
7553
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
7612
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
7554
+ <xsl:apply-templates select="*[local-name()='name']"/>
7613
7555
  </fo:block>
7614
- <xsl:apply-templates/>
7556
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
7615
7557
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
7616
7558
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
7617
7559
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -8224,11 +8166,58 @@
8224
8166
  <xsl:value-of select="."/>
8225
8167
  </xsl:template><xsl:template match="node()" mode="contents">
8226
8168
  <xsl:apply-templates mode="contents"/>
8169
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
8170
+ <xsl:variable name="level">
8171
+ <xsl:call-template name="getLevel">
8172
+ <xsl:with-param name="depth" select="@depth"/>
8173
+ </xsl:call-template>
8174
+ </xsl:variable>
8175
+
8176
+ <xsl:variable name="section">
8177
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8178
+ </xsl:variable>
8179
+
8180
+ <xsl:variable name="type">floating-title</xsl:variable>
8181
+
8182
+ <xsl:variable name="display">
8183
+ <xsl:choose>
8184
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
8185
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
8186
+ <xsl:otherwise>false</xsl:otherwise>
8187
+ </xsl:choose>
8188
+ </xsl:variable>
8189
+
8190
+ <xsl:variable name="skip">false</xsl:variable>
8191
+
8192
+ <xsl:if test="$skip = 'false'">
8193
+
8194
+ <xsl:variable name="title">
8195
+ <xsl:choose>
8196
+ <xsl:when test="*[local-name() = 'tab']">
8197
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
8198
+ </xsl:when>
8199
+ <xsl:otherwise>
8200
+ <xsl:copy-of select="node()"/>
8201
+ </xsl:otherwise>
8202
+ </xsl:choose>
8203
+ </xsl:variable>
8204
+
8205
+ <xsl:variable name="root">
8206
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
8207
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
8208
+ </xsl:variable>
8209
+
8210
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
8211
+ <title>
8212
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
8213
+ </title>
8214
+ </item>
8215
+ </xsl:if>
8227
8216
  </xsl:template><xsl:template match="node()" mode="bookmarks">
8228
8217
  <xsl:apply-templates mode="bookmarks"/>
8229
8218
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
8230
8219
  <xsl:apply-templates select="."/>
8231
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
8220
+ </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">
8232
8221
  <xsl:apply-templates mode="bookmarks"/>
8233
8222
  </xsl:template><xsl:template name="addBookmarks">
8234
8223
  <xsl:param name="contents"/>
@@ -8413,7 +8402,10 @@
8413
8402
  </fo:block>
8414
8403
  </xsl:if>
8415
8404
  </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">
8416
- <xsl:apply-templates mode="contents_item"/>
8405
+ <xsl:param name="mode">bookmarks</xsl:param>
8406
+ <xsl:apply-templates mode="contents_item">
8407
+ <xsl:with-param name="mode" select="$mode"/>
8408
+ </xsl:apply-templates>
8417
8409
  <!-- <xsl:text> </xsl:text> -->
8418
8410
  </xsl:template><xsl:template name="getSection">
8419
8411
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -8486,6 +8478,18 @@
8486
8478
  <xsl:copy-of select="."/>
8487
8479
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
8488
8480
  <xsl:text> </xsl:text>
8481
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
8482
+ <xsl:param name="mode">bookmarks</xsl:param>
8483
+ <xsl:apply-templates mode="contents_item">
8484
+ <xsl:with-param name="mode" select="$mode"/>
8485
+ </xsl:apply-templates>
8486
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
8487
+ <xsl:param name="mode">bookmarks</xsl:param>
8488
+ <xsl:if test="$mode = 'contents'">
8489
+ <xsl:copy>
8490
+ <xsl:apply-templates mode="contents_item"/>
8491
+ </xsl:copy>
8492
+ </xsl:if>
8489
8493
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8490
8494
 
8491
8495
  <fo:block-container margin-left="0mm">
@@ -8822,42 +8826,48 @@
8822
8826
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
8823
8827
 
8824
8828
 
8825
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
8826
-
8827
- <xsl:variable name="element">
8829
+ <xsl:variable name="fo_element">
8830
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
8828
8831
  block
8829
8832
 
8830
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
8833
+
8831
8834
  </xsl:variable>
8832
8835
 
8836
+ <!-- display 'EXAMPLE' -->
8837
+ <xsl:apply-templates select="*[local-name()='name']">
8838
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8839
+ </xsl:apply-templates>
8840
+
8833
8841
  <xsl:choose>
8834
- <xsl:when test="contains(normalize-space($element), 'block')">
8835
- <fo:block xsl:use-attribute-sets="example-body-style">
8836
- <xsl:apply-templates/>
8837
- </fo:block>
8842
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
8843
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
8844
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8845
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8846
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8847
+ </xsl:apply-templates>
8848
+ </fo:block-container>
8849
+ </fo:block-container>
8838
8850
  </xsl:when>
8839
8851
  <xsl:otherwise>
8840
8852
  <fo:inline>
8841
- <xsl:apply-templates/>
8853
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8854
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8855
+ </xsl:apply-templates>
8842
8856
  </fo:inline>
8843
8857
  </xsl:otherwise>
8844
8858
  </xsl:choose>
8845
8859
 
8846
8860
  </fo:block>
8847
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
8848
-
8849
- <xsl:variable name="element">
8850
- block
8851
-
8852
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
8853
- </xsl:variable>
8861
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
8862
+ <xsl:param name="fo_element">block</xsl:param>
8863
+
8854
8864
  <xsl:choose>
8855
8865
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
8856
8866
  <fo:inline>
8857
8867
  <xsl:apply-templates/>
8858
8868
  </fo:inline>
8859
8869
  </xsl:when>
8860
- <xsl:when test="contains(normalize-space($element), 'block')">
8870
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
8861
8871
  <fo:block xsl:use-attribute-sets="example-name-style">
8862
8872
  <xsl:apply-templates/>
8863
8873
  </fo:block>
@@ -8870,14 +8880,15 @@
8870
8880
  </xsl:choose>
8871
8881
 
8872
8882
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
8883
+ <xsl:param name="fo_element">block</xsl:param>
8884
+
8873
8885
  <xsl:variable name="num"><xsl:number/></xsl:variable>
8874
8886
  <xsl:variable name="element">
8875
- block
8876
-
8877
8887
 
8888
+ <xsl:value-of select="$fo_element"/>
8878
8889
  </xsl:variable>
8879
8890
  <xsl:choose>
8880
- <xsl:when test="normalize-space($element) = 'block'">
8891
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
8881
8892
  <fo:block xsl:use-attribute-sets="example-p-style">
8882
8893
 
8883
8894
  <xsl:apply-templates/>
@@ -8945,12 +8956,9 @@
8945
8956
  </fo:basic-link>
8946
8957
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
8947
8958
  <xsl:variable name="title-modified">
8948
-
8949
-
8950
- <xsl:call-template name="getTitle">
8951
- <xsl:with-param name="name" select="'title-modified'"/>
8952
- </xsl:call-template>
8953
-
8959
+ <xsl:call-template name="getLocalizedString">
8960
+ <xsl:with-param name="key">modified</xsl:with-param>
8961
+ </xsl:call-template>
8954
8962
  </xsl:variable>
8955
8963
 
8956
8964
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -9148,12 +9156,9 @@
9148
9156
  </fo:block>
9149
9157
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
9150
9158
  <xsl:variable name="title-deprecated">
9151
-
9152
- <xsl:call-template name="getLocalizedString">
9153
- <xsl:with-param name="key">deprecated</xsl:with-param>
9154
- </xsl:call-template>
9155
-
9156
-
9159
+ <xsl:call-template name="getLocalizedString">
9160
+ <xsl:with-param name="key">deprecated</xsl:with-param>
9161
+ </xsl:call-template>
9157
9162
  </xsl:variable>
9158
9163
  <fo:block xsl:use-attribute-sets="deprecates-style">
9159
9164
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -9162,6 +9167,8 @@
9162
9167
  <xsl:if test="*[local-name() = 'strong']">
9163
9168
  <xsl:attribute name="font-weight">normal</xsl:attribute>
9164
9169
  </xsl:if>
9170
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
9171
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
9165
9172
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
9166
9173
  <fo:block xsl:use-attribute-sets="definition-style">
9167
9174
  <xsl:apply-templates/>
@@ -9493,7 +9500,7 @@
9493
9500
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9494
9501
  </xsl:when>
9495
9502
  <xsl:otherwise>
9496
- <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
9503
+ <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
9497
9504
 
9498
9505
  <xsl:value-of select="$docidentifier"/>
9499
9506
  <xsl:if test="$docidentifier != '' and *[local-name() = 'title']">, </xsl:if>
@@ -9517,16 +9524,30 @@
9517
9524
  <!-- end BIPM bibitem processing-->
9518
9525
 
9519
9526
 
9520
-
9527
+
9528
+
9529
+
9530
+
9531
+
9532
+
9521
9533
 
9522
9534
 
9523
9535
 
9524
9536
 
9525
9537
 
9538
+
9539
+
9540
+
9541
+
9542
+ <!-- end MPFD bibitem processing -->
9526
9543
 
9544
+ <!-- start M3D bibitem processing -->
9545
+
9546
+
9547
+
9527
9548
 
9528
9549
  </xsl:template><xsl:template name="processBibitemDocId">
9529
- <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')]"/>
9550
+ <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')]"/>
9530
9551
  <xsl:choose>
9531
9552
  <xsl:when test="normalize-space($_doc_ident) != ''">
9532
9553
  <!-- <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"/>
@@ -9540,7 +9561,7 @@
9540
9561
  <xsl:if test="$type != ''">
9541
9562
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9542
9563
  </xsl:if> -->
9543
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
9564
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9544
9565
  </xsl:otherwise>
9545
9566
  </xsl:choose>
9546
9567
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -9646,8 +9667,12 @@
9646
9667
  <fo:block> </fo:block>
9647
9668
  </fo:block-container>
9648
9669
  </xsl:template><xsl:variable name="toc_level">
9670
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
9671
+ <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:-->
9672
+ <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 -->
9649
9673
  <xsl:choose>
9650
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
9674
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
9675
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
9651
9676
  <xsl:otherwise><!-- default value -->
9652
9677
  3
9653
9678
 
@@ -9749,7 +9774,7 @@
9749
9774
  </td>
9750
9775
  </xsl:for-each>
9751
9776
  <td>333</td> <!-- page number, just for fill -->
9752
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9777
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9753
9778
  <fo:inline padding-right="5mm"> </fo:inline>
9754
9779
  <fo:inline><xsl:apply-templates/></fo:inline>
9755
9780
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -10121,9 +10146,15 @@
10121
10146
  </xsl:template><xsl:template name="getLocalizedString">
10122
10147
  <xsl:param name="key"/>
10123
10148
  <xsl:param name="formatted">false</xsl:param>
10149
+ <xsl:param name="lang"/>
10124
10150
 
10125
10151
  <xsl:variable name="curr_lang">
10126
- <xsl:call-template name="getLang"/>
10152
+ <xsl:choose>
10153
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
10154
+ <xsl:otherwise>
10155
+ <xsl:call-template name="getLang"/>
10156
+ </xsl:otherwise>
10157
+ </xsl:choose>
10127
10158
  </xsl:variable>
10128
10159
 
10129
10160
  <xsl:variable name="data_value">