metanorma-itu 1.4.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -540,6 +540,7 @@
540
540
  </fo:block>
541
541
  </fo:block-container>
542
542
  <fo:block-container font-family="Arial">
543
+ <xsl:variable name="annexid" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid)"/>
543
544
  <fo:table width="100%" table-layout="fixed"> <!-- 175.4mm-->
544
545
  <fo:table-column column-width="25.2mm"/>
545
546
  <fo:table-column column-width="44.4mm"/>
@@ -638,16 +639,15 @@
638
639
  </fo:block-container>
639
640
  </fo:table-cell>
640
641
  <fo:table-cell text-align="right">
641
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
642
+ <xsl:if test="$annexid != ''">
642
643
  <fo:block-container>
643
- <xsl:call-template name="setWritingMode"/>
644
+ <xsl:call-template name="setWritingMode"/>
644
645
  <fo:block font-size="18pt" font-weight="bold">
645
- <xsl:variable name="title-annex">
646
- <xsl:call-template name="getTitle">
647
- <xsl:with-param name="name" select="'title-annex'"/>
648
- </xsl:call-template>
649
- </xsl:variable>
650
- <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
646
+ <xsl:call-template name="getLocalizedString">
647
+ <xsl:with-param name="key">annex</xsl:with-param>
648
+ </xsl:call-template>
649
+ <xsl:text> </xsl:text>
650
+ <xsl:value-of select="$annexid"/>
651
651
  </fo:block>
652
652
  </fo:block-container>
653
653
  </xsl:if>
@@ -888,13 +888,13 @@
888
888
  </xsl:otherwise>
889
889
  </xsl:choose>
890
890
 
891
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
892
- <xsl:variable name="title-annex">
893
- <xsl:call-template name="getTitle">
894
- <xsl:with-param name="name" select="'title-annex'"/>
895
- </xsl:call-template>
896
- </xsl:variable>
897
- <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
891
+ <xsl:if test="$annexid != ''">
892
+ <xsl:text> — </xsl:text>
893
+ <xsl:call-template name="getLocalizedString">
894
+ <xsl:with-param name="key">annex</xsl:with-param>
895
+ </xsl:call-template>
896
+ <xsl:text> </xsl:text>
897
+ <xsl:value-of select="$annexid"/>
898
898
  </xsl:if>
899
899
  </fo:block>
900
900
  </fo:block-container>
@@ -963,12 +963,9 @@
963
963
  <xsl:value-of select="$linebreak"/>
964
964
  </fo:block>
965
965
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
966
- <xsl:variable name="title-keywords">
967
- <xsl:call-template name="getTitle">
968
- <xsl:with-param name="name" select="'title-keywords'"/>
969
- </xsl:call-template>
970
- </xsl:variable>
971
- <xsl:value-of select="$title-keywords"/>
966
+ <xsl:call-template name="getLocalizedString">
967
+ <xsl:with-param name="key">keywords</xsl:with-param>
968
+ </xsl:call-template>
972
969
  </fo:block>
973
970
  <fo:block>
974
971
  <xsl:call-template name="insertKeywords"/>
@@ -1298,10 +1295,7 @@
1298
1295
  <xsl:template match="itu:br" mode="contents_item" priority="2">
1299
1296
  <fo:inline> </fo:inline>
1300
1297
  </xsl:template>
1301
-
1302
1298
 
1303
-
1304
- <xsl:template match="itu:bibitem" mode="contents"/>
1305
1299
 
1306
1300
  <xsl:template match="itu:references" mode="contents">
1307
1301
  <xsl:apply-templates mode="contents"/>
@@ -1512,7 +1506,7 @@
1512
1506
  <xsl:otherwise>
1513
1507
  <fo:inline padding-right="5mm">
1514
1508
  <xsl:text>[</xsl:text>
1515
- <xsl:value-of select="itu:docidentifier"/>
1509
+ <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
1516
1510
  <xsl:text>] </xsl:text>
1517
1511
  </fo:inline>
1518
1512
  </xsl:otherwise>
@@ -1523,13 +1517,13 @@
1523
1517
  <xsl:text> </xsl:text>
1524
1518
  <xsl:choose>
1525
1519
  <xsl:when test="itu:docidentifier[@type = 'metanorma']">
1526
- <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma')]">
1527
- <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma')]"/>
1520
+ <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]">
1521
+ <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/>
1528
1522
  <xsl:text>, </xsl:text>
1529
1523
  </xsl:if>
1530
1524
  </xsl:when>
1531
1525
  <xsl:otherwise>
1532
- <xsl:value-of select="itu:docidentifier"/>
1526
+ <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
1533
1527
  <xsl:if test="itu:title">
1534
1528
  <xsl:text>, </xsl:text>
1535
1529
  </xsl:if>
@@ -1878,9 +1872,9 @@
1878
1872
  -->
1879
1873
  <xsl:template match="itu:annex//itu:bibitem">
1880
1874
  <fo:block margin-top="6pt" margin-left="10mm" text-indent="-10mm">
1881
- <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier"/>]</fo:inline>
1875
+ <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>]</fo:inline>
1882
1876
  <xsl:text> </xsl:text>
1883
- <xsl:apply-templates select="itu:docidentifier" mode="content"/>
1877
+ <xsl:apply-templates select="itu:docidentifier[not(@type = 'metanorma-ordinal')]" mode="content"/>
1884
1878
  <xsl:if test="node()[local-name(.) != current()/itu:docidentifier]">, </xsl:if>
1885
1879
  <xsl:apply-templates/>
1886
1880
  </fo:block>
@@ -2298,13 +2292,6 @@
2298
2292
 
2299
2293
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2300
2294
 
2301
- <title-annex lang="en">Annex </title-annex>
2302
- <title-annex lang="fr">Annexe </title-annex>
2303
-
2304
- <title-annex lang="zh">Annex </title-annex>
2305
-
2306
-
2307
-
2308
2295
  <title-edition lang="en">
2309
2296
 
2310
2297
  <xsl:text>Edition </xsl:text>
@@ -2318,33 +2305,18 @@
2318
2305
 
2319
2306
  </title-edition>
2320
2307
 
2321
-
2308
+
2309
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2322
2310
  <title-toc lang="en">
2323
2311
 
2324
2312
 
2325
- <xsl:text>Table of Contents</xsl:text>
2326
-
2327
2313
 
2328
2314
  </title-toc>
2329
2315
  <title-toc lang="fr">
2330
2316
 
2331
- <xsl:text>Sommaire</xsl:text>
2332
-
2333
-
2334
- </title-toc>
2335
-
2336
- <title-toc lang="zh">Contents</title-toc>
2337
-
2338
-
2317
+ </title-toc>
2339
2318
 
2340
- <title-page lang="en">Page</title-page>
2341
- <title-page lang="fr">Page</title-page>
2342
2319
 
2343
- <title-key lang="en">Key</title-key>
2344
- <title-key lang="fr">Légende</title-key>
2345
-
2346
- <title-where lang="en">where</title-where>
2347
- <title-where lang="fr">où</title-where>
2348
2320
 
2349
2321
  <title-descriptors lang="en">Descriptors</title-descriptors>
2350
2322
 
@@ -2367,25 +2339,6 @@
2367
2339
 
2368
2340
  </title-subpart>
2369
2341
 
2370
- <title-modified lang="en">modified</title-modified>
2371
- <title-modified lang="fr">modifiée</title-modified>
2372
-
2373
- <title-modified lang="zh">modified</title-modified>
2374
-
2375
-
2376
-
2377
- <title-source lang="en">
2378
-
2379
- <xsl:text>SOURCE</xsl:text>
2380
-
2381
-
2382
- </title-source>
2383
-
2384
- <title-keywords lang="en">Keywords</title-keywords>
2385
-
2386
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2387
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2388
-
2389
2342
  <title-list-tables lang="en">List of Tables</title-list-tables>
2390
2343
 
2391
2344
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2394,37 +2347,8 @@
2394
2347
 
2395
2348
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2396
2349
 
2397
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2398
-
2399
- <title-abstract lang="en">Abstract</title-abstract>
2400
-
2401
2350
  <title-summary lang="en">Summary</title-summary>
2402
2351
 
2403
- <title-in lang="en">in </title-in>
2404
-
2405
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2406
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2407
-
2408
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2409
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2410
-
2411
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2412
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2413
-
2414
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2415
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2416
-
2417
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2418
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2419
-
2420
- <title-caution lang="en">CAUTION</title-caution>
2421
- <title-caution lang="zh">注意</title-caution>
2422
-
2423
- <title-warning lang="en">WARNING</title-warning>
2424
- <title-warning lang="zh">警告</title-warning>
2425
-
2426
- <title-amendment lang="en">AMENDMENT</title-amendment>
2427
-
2428
2352
  <title-continued lang="en">(continued)</title-continued>
2429
2353
  <title-continued lang="fr">(continué)</title-continued>
2430
2354
 
@@ -2524,6 +2448,7 @@
2524
2448
 
2525
2449
 
2526
2450
 
2451
+
2527
2452
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2528
2453
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2529
2454
 
@@ -2538,7 +2463,9 @@
2538
2463
 
2539
2464
 
2540
2465
 
2466
+
2541
2467
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2468
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2542
2469
 
2543
2470
 
2544
2471
 
@@ -2565,6 +2492,7 @@
2565
2492
 
2566
2493
 
2567
2494
 
2495
+
2568
2496
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2569
2497
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2570
2498
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2919,7 +2847,7 @@
2919
2847
 
2920
2848
 
2921
2849
 
2922
- </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">
2850
+ </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">
2923
2851
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2924
2852
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2925
2853
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4279,12 +4207,9 @@
4279
4207
  <fo:block margin-bottom="12pt" text-align="left">
4280
4208
 
4281
4209
  <xsl:variable name="title-where">
4282
-
4283
-
4284
- <xsl:call-template name="getTitle">
4285
- <xsl:with-param name="name" select="'title-where'"/>
4286
- </xsl:call-template>
4287
-
4210
+ <xsl:call-template name="getLocalizedString">
4211
+ <xsl:with-param name="key">where</xsl:with-param>
4212
+ </xsl:call-template>
4288
4213
  </xsl:variable>
4289
4214
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
4290
4215
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -4302,12 +4227,9 @@
4302
4227
 
4303
4228
 
4304
4229
  <xsl:variable name="title-where">
4305
-
4306
-
4307
- <xsl:call-template name="getTitle">
4308
- <xsl:with-param name="name" select="'title-where'"/>
4309
- </xsl:call-template>
4310
-
4230
+ <xsl:call-template name="getLocalizedString">
4231
+ <xsl:with-param name="key">where</xsl:with-param>
4232
+ </xsl:call-template>
4311
4233
  </xsl:variable>
4312
4234
  <xsl:value-of select="$title-where"/>:
4313
4235
  </fo:block>
@@ -4319,12 +4241,9 @@
4319
4241
 
4320
4242
 
4321
4243
  <xsl:variable name="title-key">
4322
-
4323
-
4324
- <xsl:call-template name="getTitle">
4325
- <xsl:with-param name="name" select="'title-key'"/>
4326
- </xsl:call-template>
4327
-
4244
+ <xsl:call-template name="getLocalizedString">
4245
+ <xsl:with-param name="key">key</xsl:with-param>
4246
+ </xsl:call-template>
4328
4247
  </xsl:variable>
4329
4248
  <xsl:value-of select="$title-key"/>
4330
4249
  </fo:block>
@@ -4669,6 +4588,15 @@
4669
4588
  </fo:inline>
4670
4589
  </xsl:template><xsl:template match="*[local-name()='add']">
4671
4590
  <xsl:choose>
4591
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4592
+ <fo:inline>
4593
+ <xsl:call-template name="insertTag">
4594
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4595
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4596
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4597
+ </xsl:call-template>
4598
+ </fo:inline>
4599
+ </xsl:when>
4672
4600
  <xsl:when test="@amendment">
4673
4601
  <fo:inline>
4674
4602
  <xsl:call-template name="insertTag">
@@ -4703,7 +4631,6 @@
4703
4631
  </fo:inline>
4704
4632
  </xsl:otherwise>
4705
4633
  </xsl:choose>
4706
-
4707
4634
  </xsl:template><xsl:template name="insertTag">
4708
4635
  <xsl:param name="type"/>
4709
4636
  <xsl:param name="kind"/>
@@ -4719,14 +4646,14 @@
4719
4646
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4720
4647
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4721
4648
  <g>
4722
- <xsl:if test="$type = 'closing'">
4649
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4723
4650
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4724
4651
  </xsl:if>
4725
4652
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4726
4653
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4727
4654
  </g>
4728
4655
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4729
- <xsl:if test="$type = 'closing'">
4656
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4730
4657
  <xsl:attribute name="x">25</xsl:attribute>
4731
4658
  </xsl:if>
4732
4659
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -5219,9 +5146,9 @@
5219
5146
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
5220
5147
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
5221
5148
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
5222
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5149
+ <xsl:apply-templates select="*[local-name()='name']"/>
5223
5150
  </fo:block>
5224
- <xsl:apply-templates/>
5151
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
5225
5152
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
5226
5153
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5227
5154
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -5822,11 +5749,58 @@
5822
5749
  <xsl:value-of select="."/>
5823
5750
  </xsl:template><xsl:template match="node()" mode="contents">
5824
5751
  <xsl:apply-templates mode="contents"/>
5752
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
5753
+ <xsl:variable name="level">
5754
+ <xsl:call-template name="getLevel">
5755
+ <xsl:with-param name="depth" select="@depth"/>
5756
+ </xsl:call-template>
5757
+ </xsl:variable>
5758
+
5759
+ <xsl:variable name="section">
5760
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5761
+ </xsl:variable>
5762
+
5763
+ <xsl:variable name="type">floating-title</xsl:variable>
5764
+
5765
+ <xsl:variable name="display">
5766
+ <xsl:choose>
5767
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
5768
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
5769
+ <xsl:otherwise>false</xsl:otherwise>
5770
+ </xsl:choose>
5771
+ </xsl:variable>
5772
+
5773
+ <xsl:variable name="skip">false</xsl:variable>
5774
+
5775
+ <xsl:if test="$skip = 'false'">
5776
+
5777
+ <xsl:variable name="title">
5778
+ <xsl:choose>
5779
+ <xsl:when test="*[local-name() = 'tab']">
5780
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
5781
+ </xsl:when>
5782
+ <xsl:otherwise>
5783
+ <xsl:copy-of select="node()"/>
5784
+ </xsl:otherwise>
5785
+ </xsl:choose>
5786
+ </xsl:variable>
5787
+
5788
+ <xsl:variable name="root">
5789
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
5790
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
5791
+ </xsl:variable>
5792
+
5793
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
5794
+ <title>
5795
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
5796
+ </title>
5797
+ </item>
5798
+ </xsl:if>
5825
5799
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5826
5800
  <xsl:apply-templates mode="bookmarks"/>
5827
5801
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5828
5802
  <xsl:apply-templates select="."/>
5829
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5803
+ </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">
5830
5804
  <xsl:apply-templates mode="bookmarks"/>
5831
5805
  </xsl:template><xsl:template name="addBookmarks">
5832
5806
  <xsl:param name="contents"/>
@@ -5997,7 +5971,10 @@
5997
5971
  </fo:block>
5998
5972
  </xsl:if>
5999
5973
  </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">
6000
- <xsl:apply-templates mode="contents_item"/>
5974
+ <xsl:param name="mode">bookmarks</xsl:param>
5975
+ <xsl:apply-templates mode="contents_item">
5976
+ <xsl:with-param name="mode" select="$mode"/>
5977
+ </xsl:apply-templates>
6001
5978
  <!-- <xsl:text> </xsl:text> -->
6002
5979
  </xsl:template><xsl:template name="getSection">
6003
5980
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -6070,6 +6047,18 @@
6070
6047
  <xsl:copy-of select="."/>
6071
6048
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6072
6049
  <xsl:text> </xsl:text>
6050
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
6051
+ <xsl:param name="mode">bookmarks</xsl:param>
6052
+ <xsl:apply-templates mode="contents_item">
6053
+ <xsl:with-param name="mode" select="$mode"/>
6054
+ </xsl:apply-templates>
6055
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
6056
+ <xsl:param name="mode">bookmarks</xsl:param>
6057
+ <xsl:if test="$mode = 'contents'">
6058
+ <xsl:copy>
6059
+ <xsl:apply-templates mode="contents_item"/>
6060
+ </xsl:copy>
6061
+ </xsl:if>
6073
6062
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6074
6063
 
6075
6064
  <fo:block-container margin-left="0mm">
@@ -6406,42 +6395,48 @@
6406
6395
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6407
6396
 
6408
6397
 
6409
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6410
-
6411
- <xsl:variable name="element">
6398
+ <xsl:variable name="fo_element">
6399
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6412
6400
  block
6413
6401
 
6414
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6402
+
6415
6403
  </xsl:variable>
6416
6404
 
6405
+ <!-- display 'EXAMPLE' -->
6406
+ <xsl:apply-templates select="*[local-name()='name']">
6407
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6408
+ </xsl:apply-templates>
6409
+
6417
6410
  <xsl:choose>
6418
- <xsl:when test="contains(normalize-space($element), 'block')">
6419
- <fo:block xsl:use-attribute-sets="example-body-style">
6420
- <xsl:apply-templates/>
6421
- </fo:block>
6411
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6412
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6413
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6414
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6415
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6416
+ </xsl:apply-templates>
6417
+ </fo:block-container>
6418
+ </fo:block-container>
6422
6419
  </xsl:when>
6423
6420
  <xsl:otherwise>
6424
6421
  <fo:inline>
6425
- <xsl:apply-templates/>
6422
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6423
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6424
+ </xsl:apply-templates>
6426
6425
  </fo:inline>
6427
6426
  </xsl:otherwise>
6428
6427
  </xsl:choose>
6429
6428
 
6430
6429
  </fo:block>
6431
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6432
-
6433
- <xsl:variable name="element">
6434
- block
6435
-
6436
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6437
- </xsl:variable>
6430
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6431
+ <xsl:param name="fo_element">block</xsl:param>
6432
+
6438
6433
  <xsl:choose>
6439
6434
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6440
6435
  <fo:inline>
6441
6436
  <xsl:apply-templates/>
6442
6437
  </fo:inline>
6443
6438
  </xsl:when>
6444
- <xsl:when test="contains(normalize-space($element), 'block')">
6439
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6445
6440
  <fo:block xsl:use-attribute-sets="example-name-style">
6446
6441
  <xsl:apply-templates/>
6447
6442
  </fo:block>
@@ -6454,14 +6449,15 @@
6454
6449
  </xsl:choose>
6455
6450
 
6456
6451
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6452
+ <xsl:param name="fo_element">block</xsl:param>
6453
+
6457
6454
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6458
6455
  <xsl:variable name="element">
6459
- block
6460
-
6461
6456
 
6457
+ <xsl:value-of select="$fo_element"/>
6462
6458
  </xsl:variable>
6463
6459
  <xsl:choose>
6464
- <xsl:when test="normalize-space($element) = 'block'">
6460
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6465
6461
  <fo:block xsl:use-attribute-sets="example-p-style">
6466
6462
 
6467
6463
  <xsl:apply-templates/>
@@ -6529,12 +6525,9 @@
6529
6525
  </fo:basic-link>
6530
6526
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
6531
6527
  <xsl:variable name="title-modified">
6532
-
6533
-
6534
- <xsl:call-template name="getTitle">
6535
- <xsl:with-param name="name" select="'title-modified'"/>
6536
- </xsl:call-template>
6537
-
6528
+ <xsl:call-template name="getLocalizedString">
6529
+ <xsl:with-param name="key">modified</xsl:with-param>
6530
+ </xsl:call-template>
6538
6531
  </xsl:variable>
6539
6532
 
6540
6533
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -6726,12 +6719,9 @@
6726
6719
  </fo:block>
6727
6720
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6728
6721
  <xsl:variable name="title-deprecated">
6729
-
6730
- <xsl:call-template name="getLocalizedString">
6731
- <xsl:with-param name="key">deprecated</xsl:with-param>
6732
- </xsl:call-template>
6733
-
6734
-
6722
+ <xsl:call-template name="getLocalizedString">
6723
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6724
+ </xsl:call-template>
6735
6725
  </xsl:variable>
6736
6726
  <fo:block xsl:use-attribute-sets="deprecates-style">
6737
6727
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -6740,6 +6730,8 @@
6740
6730
  <xsl:if test="*[local-name() = 'strong']">
6741
6731
  <xsl:attribute name="font-weight">normal</xsl:attribute>
6742
6732
  </xsl:if>
6733
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
6734
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6743
6735
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6744
6736
  <fo:block xsl:use-attribute-sets="definition-style">
6745
6737
  <xsl:apply-templates/>
@@ -7069,16 +7061,30 @@
7069
7061
 
7070
7062
 
7071
7063
 
7072
-
7064
+
7065
+
7066
+
7067
+
7068
+
7069
+
7073
7070
 
7074
7071
 
7075
7072
 
7076
7073
 
7077
7074
 
7075
+
7076
+
7077
+
7078
+
7079
+ <!-- end MPFD bibitem processing -->
7080
+
7081
+ <!-- start M3D bibitem processing -->
7082
+
7078
7083
 
7084
+
7079
7085
 
7080
7086
  </xsl:template><xsl:template name="processBibitemDocId">
7081
- <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')]"/>
7087
+ <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')]"/>
7082
7088
  <xsl:choose>
7083
7089
  <xsl:when test="normalize-space($_doc_ident) != ''">
7084
7090
  <!-- <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"/>
@@ -7092,7 +7098,7 @@
7092
7098
  <xsl:if test="$type != ''">
7093
7099
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
7094
7100
  </xsl:if> -->
7095
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
7101
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
7096
7102
  </xsl:otherwise>
7097
7103
  </xsl:choose>
7098
7104
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -7198,8 +7204,12 @@
7198
7204
  <fo:block> </fo:block>
7199
7205
  </fo:block-container>
7200
7206
  </xsl:template><xsl:variable name="toc_level">
7207
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
7208
+ <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:-->
7209
+ <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 -->
7201
7210
  <xsl:choose>
7202
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
7211
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
7212
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
7203
7213
  <xsl:otherwise><!-- default value -->
7204
7214
 
7205
7215
 
@@ -7301,7 +7311,7 @@
7301
7311
  </td>
7302
7312
  </xsl:for-each>
7303
7313
  <td>333</td> <!-- page number, just for fill -->
7304
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7314
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7305
7315
  <fo:inline padding-right="5mm"> </fo:inline>
7306
7316
  <fo:inline><xsl:apply-templates/></fo:inline>
7307
7317
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -7673,9 +7683,15 @@
7673
7683
  </xsl:template><xsl:template name="getLocalizedString">
7674
7684
  <xsl:param name="key"/>
7675
7685
  <xsl:param name="formatted">false</xsl:param>
7686
+ <xsl:param name="lang"/>
7676
7687
 
7677
7688
  <xsl:variable name="curr_lang">
7678
- <xsl:call-template name="getLang"/>
7689
+ <xsl:choose>
7690
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7691
+ <xsl:otherwise>
7692
+ <xsl:call-template name="getLang"/>
7693
+ </xsl:otherwise>
7694
+ </xsl:choose>
7679
7695
  </xsl:variable>
7680
7696
 
7681
7697
  <xsl:variable name="data_value">