metanorma-un 0.7.5 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -376,7 +376,6 @@
376
376
  </xsl:if>
377
377
 
378
378
  </xsl:template>
379
- <xsl:template match="un:references[not(@normative='true')]/un:bibitem" mode="contents"/>
380
379
  <!-- ============================= -->
381
380
  <!-- ============================= -->
382
381
 
@@ -394,12 +393,9 @@
394
393
  <fo:table-body>
395
394
  <fo:table-row>
396
395
  <fo:table-cell padding-left="6mm" padding-top="2.5mm">
397
- <xsl:variable name="title-summary">
398
- <xsl:call-template name="getTitle">
399
- <xsl:with-param name="name" select="'title-summary'"/>
400
- </xsl:call-template>
401
- </xsl:variable>
402
- <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-summary"/></fo:block>
396
+ <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt" role="H2">
397
+ <xsl:apply-templates select="un:title/node()"/>
398
+ </fo:block>
403
399
  </fo:table-cell>
404
400
  <fo:table-cell>
405
401
  <fo:block> </fo:block>
@@ -413,7 +409,7 @@
413
409
  <fo:block> </fo:block>
414
410
  </fo:table-cell>
415
411
  <fo:table-cell text-align="justify" padding-bottom="12pt" padding-right="3mm">
416
- <fo:block font-size="10pt" line-height="120%"><xsl:apply-templates/></fo:block>
412
+ <fo:block font-size="10pt" line-height="120%"><xsl:apply-templates select="node()[not(self::un:title)]"/></fo:block>
417
413
  </fo:table-cell>
418
414
  <fo:table-cell>
419
415
  <fo:block> </fo:block>
@@ -887,7 +883,7 @@
887
883
  </xsl:when>
888
884
  <xsl:otherwise>
889
885
  <xsl:apply-templates select="un:formattedref"/>
890
- <xsl:apply-templates select="un:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
886
+ <xsl:apply-templates select="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process"/>
891
887
  </xsl:otherwise>
892
888
  </xsl:choose>
893
889
  </xsl:if>
@@ -927,10 +923,10 @@
927
923
  <xsl:apply-templates/>
928
924
  </xsl:template>
929
925
 
930
- <xsl:template match="un:docidentifier[@type = 'metanorma']" mode="process">
926
+ <xsl:template match="un:docidentifier[@type = 'metanorma' or @type = 'metanorma-ordinal']" mode="process">
931
927
  <xsl:apply-templates/>
932
928
  </xsl:template>
933
- <xsl:template match="un:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
929
+ <xsl:template match="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process">
934
930
  <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
935
931
  </xsl:template>
936
932
  <xsl:template match="un:docidentifier"/>
@@ -1095,13 +1091,6 @@
1095
1091
 
1096
1092
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1097
1093
 
1098
- <title-annex lang="en">Annex </title-annex>
1099
- <title-annex lang="fr">Annexe </title-annex>
1100
-
1101
- <title-annex lang="zh">Annex </title-annex>
1102
-
1103
-
1104
-
1105
1094
  <title-edition lang="en">
1106
1095
 
1107
1096
  <xsl:text>Edition </xsl:text>
@@ -1115,7 +1104,8 @@
1115
1104
 
1116
1105
  </title-edition>
1117
1106
 
1118
-
1107
+
1108
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
1119
1109
  <title-toc lang="en">
1120
1110
 
1121
1111
 
@@ -1123,21 +1113,9 @@
1123
1113
  </title-toc>
1124
1114
  <title-toc lang="fr">
1125
1115
 
1126
-
1127
- </title-toc>
1128
-
1129
- <title-toc lang="zh">Contents</title-toc>
1130
-
1131
-
1116
+ </title-toc>
1132
1117
 
1133
- <title-page lang="en">Page</title-page>
1134
- <title-page lang="fr">Page</title-page>
1135
1118
 
1136
- <title-key lang="en">Key</title-key>
1137
- <title-key lang="fr">Légende</title-key>
1138
-
1139
- <title-where lang="en">where</title-where>
1140
- <title-where lang="fr">où</title-where>
1141
1119
 
1142
1120
  <title-descriptors lang="en">Descriptors</title-descriptors>
1143
1121
 
@@ -1160,25 +1138,6 @@
1160
1138
 
1161
1139
  </title-subpart>
1162
1140
 
1163
- <title-modified lang="en">modified</title-modified>
1164
- <title-modified lang="fr">modifiée</title-modified>
1165
-
1166
- <title-modified lang="zh">modified</title-modified>
1167
-
1168
-
1169
-
1170
- <title-source lang="en">
1171
-
1172
- <xsl:text>SOURCE</xsl:text>
1173
-
1174
-
1175
- </title-source>
1176
-
1177
- <title-keywords lang="en">Keywords</title-keywords>
1178
-
1179
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
1180
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1181
-
1182
1141
  <title-list-tables lang="en">List of Tables</title-list-tables>
1183
1142
 
1184
1143
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -1187,37 +1146,8 @@
1187
1146
 
1188
1147
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
1189
1148
 
1190
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1191
-
1192
- <title-abstract lang="en">Abstract</title-abstract>
1193
-
1194
1149
  <title-summary lang="en">Summary</title-summary>
1195
1150
 
1196
- <title-in lang="en">in </title-in>
1197
-
1198
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1199
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1200
-
1201
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1202
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1203
-
1204
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1205
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
1206
-
1207
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1208
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
1209
-
1210
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1211
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1212
-
1213
- <title-caution lang="en">CAUTION</title-caution>
1214
- <title-caution lang="zh">注意</title-caution>
1215
-
1216
- <title-warning lang="en">WARNING</title-warning>
1217
- <title-warning lang="zh">警告</title-warning>
1218
-
1219
- <title-amendment lang="en">AMENDMENT</title-amendment>
1220
-
1221
1151
  <title-continued lang="en">(continued)</title-continued>
1222
1152
  <title-continued lang="fr">(continué)</title-continued>
1223
1153
 
@@ -1321,11 +1251,14 @@
1321
1251
 
1322
1252
 
1323
1253
 
1254
+
1324
1255
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1325
1256
 
1326
1257
 
1327
1258
 
1259
+
1328
1260
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1261
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1329
1262
 
1330
1263
 
1331
1264
 
@@ -1342,7 +1275,6 @@
1342
1275
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1343
1276
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1344
1277
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1345
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1346
1278
 
1347
1279
 
1348
1280
 
@@ -1360,6 +1292,7 @@
1360
1292
 
1361
1293
 
1362
1294
 
1295
+
1363
1296
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1364
1297
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1365
1298
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1697,7 +1630,7 @@
1697
1630
  <xsl:attribute name="padding-right">8mm</xsl:attribute>
1698
1631
 
1699
1632
 
1700
- </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">
1633
+ </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">
1701
1634
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1702
1635
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1703
1636
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3006,12 +2939,9 @@
3006
2939
  <fo:block margin-bottom="12pt" text-align="left">
3007
2940
 
3008
2941
  <xsl:variable name="title-where">
3009
-
3010
-
3011
- <xsl:call-template name="getTitle">
3012
- <xsl:with-param name="name" select="'title-where'"/>
3013
- </xsl:call-template>
3014
-
2942
+ <xsl:call-template name="getLocalizedString">
2943
+ <xsl:with-param name="key">where</xsl:with-param>
2944
+ </xsl:call-template>
3015
2945
  </xsl:variable>
3016
2946
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3017
2947
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -3027,12 +2957,9 @@
3027
2957
 
3028
2958
 
3029
2959
  <xsl:variable name="title-where">
3030
-
3031
-
3032
- <xsl:call-template name="getTitle">
3033
- <xsl:with-param name="name" select="'title-where'"/>
3034
- </xsl:call-template>
3035
-
2960
+ <xsl:call-template name="getLocalizedString">
2961
+ <xsl:with-param name="key">where</xsl:with-param>
2962
+ </xsl:call-template>
3036
2963
  </xsl:variable>
3037
2964
  <xsl:value-of select="$title-where"/>
3038
2965
  </fo:block>
@@ -3044,12 +2971,9 @@
3044
2971
 
3045
2972
 
3046
2973
  <xsl:variable name="title-key">
3047
-
3048
-
3049
- <xsl:call-template name="getTitle">
3050
- <xsl:with-param name="name" select="'title-key'"/>
3051
- </xsl:call-template>
3052
-
2974
+ <xsl:call-template name="getLocalizedString">
2975
+ <xsl:with-param name="key">key</xsl:with-param>
2976
+ </xsl:call-template>
3053
2977
  </xsl:variable>
3054
2978
  <xsl:value-of select="$title-key"/>
3055
2979
  </fo:block>
@@ -3377,6 +3301,15 @@
3377
3301
  </fo:inline>
3378
3302
  </xsl:template><xsl:template match="*[local-name()='add']">
3379
3303
  <xsl:choose>
3304
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3305
+ <fo:inline>
3306
+ <xsl:call-template name="insertTag">
3307
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3308
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3309
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3310
+ </xsl:call-template>
3311
+ </fo:inline>
3312
+ </xsl:when>
3380
3313
  <xsl:when test="@amendment">
3381
3314
  <fo:inline>
3382
3315
  <xsl:call-template name="insertTag">
@@ -3411,7 +3344,6 @@
3411
3344
  </fo:inline>
3412
3345
  </xsl:otherwise>
3413
3346
  </xsl:choose>
3414
-
3415
3347
  </xsl:template><xsl:template name="insertTag">
3416
3348
  <xsl:param name="type"/>
3417
3349
  <xsl:param name="kind"/>
@@ -3427,14 +3359,14 @@
3427
3359
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3428
3360
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3429
3361
  <g>
3430
- <xsl:if test="$type = 'closing'">
3362
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3431
3363
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3432
3364
  </xsl:if>
3433
3365
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3434
3366
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3435
3367
  </g>
3436
3368
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3437
- <xsl:if test="$type = 'closing'">
3369
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3438
3370
  <xsl:attribute name="x">25</xsl:attribute>
3439
3371
  </xsl:if>
3440
3372
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3927,9 +3859,9 @@
3927
3859
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3928
3860
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3929
3861
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3930
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3862
+ <xsl:apply-templates select="*[local-name()='name']"/>
3931
3863
  </fo:block>
3932
- <xsl:apply-templates/>
3864
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3933
3865
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3934
3866
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3935
3867
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4535,11 +4467,58 @@
4535
4467
  <xsl:value-of select="."/>
4536
4468
  </xsl:template><xsl:template match="node()" mode="contents">
4537
4469
  <xsl:apply-templates mode="contents"/>
4470
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4471
+ <xsl:variable name="level">
4472
+ <xsl:call-template name="getLevel">
4473
+ <xsl:with-param name="depth" select="@depth"/>
4474
+ </xsl:call-template>
4475
+ </xsl:variable>
4476
+
4477
+ <xsl:variable name="section">
4478
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4479
+ </xsl:variable>
4480
+
4481
+ <xsl:variable name="type">floating-title</xsl:variable>
4482
+
4483
+ <xsl:variable name="display">
4484
+ <xsl:choose>
4485
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4486
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4487
+ <xsl:otherwise>false</xsl:otherwise>
4488
+ </xsl:choose>
4489
+ </xsl:variable>
4490
+
4491
+ <xsl:variable name="skip">false</xsl:variable>
4492
+
4493
+ <xsl:if test="$skip = 'false'">
4494
+
4495
+ <xsl:variable name="title">
4496
+ <xsl:choose>
4497
+ <xsl:when test="*[local-name() = 'tab']">
4498
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4499
+ </xsl:when>
4500
+ <xsl:otherwise>
4501
+ <xsl:copy-of select="node()"/>
4502
+ </xsl:otherwise>
4503
+ </xsl:choose>
4504
+ </xsl:variable>
4505
+
4506
+ <xsl:variable name="root">
4507
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4508
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4509
+ </xsl:variable>
4510
+
4511
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4512
+ <title>
4513
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4514
+ </title>
4515
+ </item>
4516
+ </xsl:if>
4538
4517
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4539
4518
  <xsl:apply-templates mode="bookmarks"/>
4540
4519
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4541
4520
  <xsl:apply-templates select="."/>
4542
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4521
+ </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">
4543
4522
  <xsl:apply-templates mode="bookmarks"/>
4544
4523
  </xsl:template><xsl:template name="addBookmarks">
4545
4524
  <xsl:param name="contents"/>
@@ -4710,7 +4689,10 @@
4710
4689
  </fo:block>
4711
4690
  </xsl:if>
4712
4691
  </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">
4713
- <xsl:apply-templates mode="contents_item"/>
4692
+ <xsl:param name="mode">bookmarks</xsl:param>
4693
+ <xsl:apply-templates mode="contents_item">
4694
+ <xsl:with-param name="mode" select="$mode"/>
4695
+ </xsl:apply-templates>
4714
4696
  <!-- <xsl:text> </xsl:text> -->
4715
4697
  </xsl:template><xsl:template name="getSection">
4716
4698
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4783,6 +4765,18 @@
4783
4765
  <xsl:copy-of select="."/>
4784
4766
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4785
4767
  <xsl:text> </xsl:text>
4768
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4769
+ <xsl:param name="mode">bookmarks</xsl:param>
4770
+ <xsl:apply-templates mode="contents_item">
4771
+ <xsl:with-param name="mode" select="$mode"/>
4772
+ </xsl:apply-templates>
4773
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4774
+ <xsl:param name="mode">bookmarks</xsl:param>
4775
+ <xsl:if test="$mode = 'contents'">
4776
+ <xsl:copy>
4777
+ <xsl:apply-templates mode="contents_item"/>
4778
+ </xsl:copy>
4779
+ </xsl:if>
4786
4780
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4787
4781
 
4788
4782
  <fo:block-container margin-left="0mm">
@@ -5119,42 +5113,48 @@
5119
5113
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5120
5114
 
5121
5115
 
5122
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5123
-
5124
- <xsl:variable name="element">
5116
+ <xsl:variable name="fo_element">
5117
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
5125
5118
  block
5126
5119
 
5127
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5120
+
5128
5121
  </xsl:variable>
5129
5122
 
5123
+ <!-- display 'EXAMPLE' -->
5124
+ <xsl:apply-templates select="*[local-name()='name']">
5125
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5126
+ </xsl:apply-templates>
5127
+
5130
5128
  <xsl:choose>
5131
- <xsl:when test="contains(normalize-space($element), 'block')">
5132
- <fo:block xsl:use-attribute-sets="example-body-style">
5133
- <xsl:apply-templates/>
5134
- </fo:block>
5129
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5130
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5131
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5132
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5133
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5134
+ </xsl:apply-templates>
5135
+ </fo:block-container>
5136
+ </fo:block-container>
5135
5137
  </xsl:when>
5136
5138
  <xsl:otherwise>
5137
5139
  <fo:inline>
5138
- <xsl:apply-templates/>
5140
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5141
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5142
+ </xsl:apply-templates>
5139
5143
  </fo:inline>
5140
5144
  </xsl:otherwise>
5141
5145
  </xsl:choose>
5142
5146
 
5143
5147
  </fo:block>
5144
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
5145
-
5146
- <xsl:variable name="element">
5147
- block
5148
-
5149
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5150
- </xsl:variable>
5148
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5149
+ <xsl:param name="fo_element">block</xsl:param>
5150
+
5151
5151
  <xsl:choose>
5152
5152
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
5153
5153
  <fo:inline>
5154
5154
  <xsl:apply-templates/>
5155
5155
  </fo:inline>
5156
5156
  </xsl:when>
5157
- <xsl:when test="contains(normalize-space($element), 'block')">
5157
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5158
5158
  <fo:block xsl:use-attribute-sets="example-name-style">
5159
5159
  <xsl:apply-templates/>
5160
5160
  </fo:block>
@@ -5167,17 +5167,17 @@
5167
5167
  </xsl:choose>
5168
5168
 
5169
5169
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5170
+ <xsl:param name="fo_element">block</xsl:param>
5171
+
5170
5172
  <xsl:variable name="num"><xsl:number/></xsl:variable>
5171
5173
  <xsl:variable name="element">
5172
- block
5173
-
5174
5174
 
5175
+ <xsl:value-of select="$fo_element"/>
5175
5176
  </xsl:variable>
5176
5177
  <xsl:choose>
5177
- <xsl:when test="normalize-space($element) = 'block'">
5178
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
5178
5179
  <fo:block xsl:use-attribute-sets="example-p-style">
5179
5180
 
5180
- <xsl:variable name="num"><xsl:number/></xsl:variable>
5181
5181
  <xsl:if test="$num = 1">
5182
5182
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
5183
5183
  </xsl:if>
@@ -5247,12 +5247,9 @@
5247
5247
  </fo:basic-link>
5248
5248
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
5249
5249
  <xsl:variable name="title-modified">
5250
-
5251
-
5252
- <xsl:call-template name="getTitle">
5253
- <xsl:with-param name="name" select="'title-modified'"/>
5254
- </xsl:call-template>
5255
-
5250
+ <xsl:call-template name="getLocalizedString">
5251
+ <xsl:with-param name="key">modified</xsl:with-param>
5252
+ </xsl:call-template>
5256
5253
  </xsl:variable>
5257
5254
 
5258
5255
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -5443,12 +5440,9 @@
5443
5440
  </fo:block>
5444
5441
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5445
5442
  <xsl:variable name="title-deprecated">
5446
-
5447
-
5448
- <xsl:call-template name="getTitle">
5449
- <xsl:with-param name="name" select="'title-deprecated'"/>
5450
- </xsl:call-template>
5451
-
5443
+ <xsl:call-template name="getLocalizedString">
5444
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5445
+ </xsl:call-template>
5452
5446
  </xsl:variable>
5453
5447
  <fo:block xsl:use-attribute-sets="deprecates-style">
5454
5448
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5457,6 +5451,8 @@
5457
5451
  <xsl:if test="*[local-name() = 'strong']">
5458
5452
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5459
5453
  </xsl:if>
5454
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5455
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5460
5456
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5461
5457
  <fo:block xsl:use-attribute-sets="definition-style">
5462
5458
  <xsl:apply-templates/>
@@ -5787,16 +5783,30 @@
5787
5783
 
5788
5784
 
5789
5785
 
5790
-
5786
+
5787
+
5788
+
5789
+
5790
+
5791
+
5791
5792
 
5792
5793
 
5793
5794
 
5794
5795
 
5795
5796
 
5797
+
5798
+
5799
+
5800
+
5801
+ <!-- end MPFD bibitem processing -->
5802
+
5803
+ <!-- start M3D bibitem processing -->
5796
5804
 
5797
5805
 
5806
+
5807
+
5798
5808
  </xsl:template><xsl:template name="processBibitemDocId">
5799
- <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')]"/>
5809
+ <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')]"/>
5800
5810
  <xsl:choose>
5801
5811
  <xsl:when test="normalize-space($_doc_ident) != ''">
5802
5812
  <!-- <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"/>
@@ -5810,7 +5820,7 @@
5810
5820
  <xsl:if test="$type != ''">
5811
5821
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5812
5822
  </xsl:if> -->
5813
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5823
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5814
5824
  </xsl:otherwise>
5815
5825
  </xsl:choose>
5816
5826
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5916,8 +5926,12 @@
5916
5926
  <fo:block> </fo:block>
5917
5927
  </fo:block-container>
5918
5928
  </xsl:template><xsl:variable name="toc_level">
5929
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5930
+ <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:-->
5931
+ <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 -->
5919
5932
  <xsl:choose>
5920
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5933
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5934
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5921
5935
  <xsl:otherwise><!-- default value -->
5922
5936
 
5923
5937
 
@@ -6019,7 +6033,7 @@
6019
6033
  </td>
6020
6034
  </xsl:for-each>
6021
6035
  <td>333</td> <!-- page number, just for fill -->
6022
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6036
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6023
6037
  <fo:inline padding-right="5mm"> </fo:inline>
6024
6038
  <fo:inline><xsl:apply-templates/></fo:inline>
6025
6039
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6391,9 +6405,15 @@
6391
6405
  </xsl:template><xsl:template name="getLocalizedString">
6392
6406
  <xsl:param name="key"/>
6393
6407
  <xsl:param name="formatted">false</xsl:param>
6408
+ <xsl:param name="lang"/>
6394
6409
 
6395
6410
  <xsl:variable name="curr_lang">
6396
- <xsl:call-template name="getLang"/>
6411
+ <xsl:choose>
6412
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6413
+ <xsl:otherwise>
6414
+ <xsl:call-template name="getLang"/>
6415
+ </xsl:otherwise>
6416
+ </xsl:choose>
6397
6417
  </xsl:variable>
6398
6418
 
6399
6419
  <xsl:variable name="data_value">