metanorma-mpfa 0.7.5 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -322,8 +322,6 @@
322
322
  <fo:inline> </fo:inline>
323
323
  </xsl:template>
324
324
 
325
-
326
- <xsl:template match="mpfd:bibitem" mode="contents"/>
327
325
 
328
326
  <xsl:template match="mpfd:references" mode="contents">
329
327
  <xsl:apply-templates mode="contents"/>
@@ -463,26 +461,8 @@
463
461
 
464
462
 
465
463
  <xsl:template match="mpfd:bibitem">
466
- <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
467
- <!-- mpfd:docidentifier -->
468
- <xsl:if test="mpfd:docidentifier">
469
- <xsl:choose>
470
- <xsl:when test="mpfd:docidentifier/@type = 'metanorma'"/>
471
- <xsl:otherwise><fo:inline><xsl:value-of select="mpfd:docidentifier"/></fo:inline></xsl:otherwise>
472
- </xsl:choose>
473
- </xsl:if>
474
- <xsl:apply-templates select="mpfd:note"/>
475
- <xsl:if test="mpfd:docidentifier">, </xsl:if>
476
- <fo:inline font-style="italic">
477
- <xsl:choose>
478
- <xsl:when test="mpfd:title[@type = 'main' and @language = 'en']">
479
- <xsl:value-of select="mpfd:title[@type = 'main' and @language = 'en']"/>
480
- </xsl:when>
481
- <xsl:otherwise>
482
- <xsl:value-of select="mpfd:title"/>
483
- </xsl:otherwise>
484
- </xsl:choose>
485
- </fo:inline>
464
+ <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm">
465
+ <xsl:call-template name="processBibitem"/>
486
466
  </fo:block>
487
467
  </xsl:template>
488
468
 
@@ -589,41 +569,23 @@
589
569
  <fo:list-item-label end-indent="label-end()">
590
570
  <fo:block>
591
571
  <fo:inline>
592
- <xsl:number format="[1]"/>
572
+ <xsl:value-of select="mpfd:docidentifier[@type = 'metanorma-ordinal']"/>
573
+ <xsl:if test="not(mpfd:docidentifier[@type = 'metanorma-ordinal'])">
574
+ <xsl:number format="[1]"/>
575
+ </xsl:if>
593
576
  </fo:inline>
594
577
  </fo:block>
595
578
  </fo:list-item-label>
596
579
  <fo:list-item-body start-indent="body-start()">
597
580
  <fo:block text-align="justify">
598
- <xsl:variable name="docidentifier">
599
- <xsl:if test="mpfd:docidentifier">
600
- <xsl:choose>
601
- <xsl:when test="mpfd:docidentifier/@type = 'metanorma'"/>
602
- <xsl:otherwise><xsl:value-of select="mpfd:docidentifier"/></xsl:otherwise>
603
- </xsl:choose>
604
- </xsl:if>
605
- </xsl:variable>
606
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
607
- <xsl:apply-templates select="mpfd:note"/>
608
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
609
- <xsl:choose>
610
- <xsl:when test="mpfd:title[@type = 'main' and @language = 'en']">
611
- <xsl:apply-templates select="mpfd:title[@type = 'main' and @language = 'en']"/>
612
- </xsl:when>
613
- <xsl:otherwise>
614
- <xsl:apply-templates select="mpfd:title"/>
615
- </xsl:otherwise>
616
- </xsl:choose>
617
- <xsl:apply-templates select="mpfd:formattedref"/>
581
+ <xsl:call-template name="processBibitem"/>
618
582
  </fo:block>
619
583
  </fo:list-item-body>
620
584
  </fo:list-item>
621
585
  </fo:list-block>
622
586
  </xsl:template>
623
587
 
624
- <xsl:template match="mpfd:references[not(@normative='true')]/mpfd:bibitem" mode="contents"/>
625
-
626
- <xsl:template match="mpfd:references[not(@normative='true')]/mpfd:bibitem/mpfd:title">
588
+ <xsl:template match="mpfd:references/mpfd:bibitem/mpfd:title">
627
589
  <fo:inline font-style="italic">
628
590
  <xsl:apply-templates/>
629
591
  </fo:inline>
@@ -736,11 +698,6 @@
736
698
 
737
699
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
738
700
 
739
- <title-annex lang="en">Annex </title-annex>
740
- <title-annex lang="fr">Annexe </title-annex>
741
-
742
-
743
-
744
701
  <title-edition lang="en">
745
702
 
746
703
  <xsl:text>Edition </xsl:text>
@@ -754,7 +711,8 @@
754
711
 
755
712
  </title-edition>
756
713
 
757
-
714
+
715
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
758
716
  <title-toc lang="en">
759
717
 
760
718
  <xsl:text>Contents</xsl:text>
@@ -766,19 +724,11 @@
766
724
 
767
725
  <xsl:text>Sommaire</xsl:text>
768
726
 
769
-
770
- </title-toc>
771
-
727
+ </title-toc>
772
728
 
729
+ <title-toc lang="zh">Contents</title-toc>
773
730
 
774
- <title-page lang="en">Page</title-page>
775
- <title-page lang="fr">Page</title-page>
776
731
 
777
- <title-key lang="en">Key</title-key>
778
- <title-key lang="fr">Légende</title-key>
779
-
780
- <title-where lang="en">where</title-where>
781
- <title-where lang="fr">où</title-where>
782
732
 
783
733
  <title-descriptors lang="en">Descriptors</title-descriptors>
784
734
 
@@ -801,25 +751,6 @@
801
751
 
802
752
  </title-subpart>
803
753
 
804
- <title-modified lang="en">modified</title-modified>
805
- <title-modified lang="fr">modifiée</title-modified>
806
-
807
- <title-modified lang="zh">modified</title-modified>
808
-
809
-
810
-
811
- <title-source lang="en">
812
-
813
- <xsl:text>SOURCE</xsl:text>
814
-
815
-
816
- </title-source>
817
-
818
- <title-keywords lang="en">Keywords</title-keywords>
819
-
820
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
821
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
822
-
823
754
  <title-list-tables lang="en">List of Tables</title-list-tables>
824
755
 
825
756
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -828,37 +759,8 @@
828
759
 
829
760
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
830
761
 
831
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
832
-
833
- <title-abstract lang="en">Abstract</title-abstract>
834
-
835
762
  <title-summary lang="en">Summary</title-summary>
836
763
 
837
- <title-in lang="en">in </title-in>
838
-
839
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
840
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
841
-
842
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
843
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
844
-
845
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
846
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
847
-
848
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
849
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
850
-
851
- <title-obligation-normative lang="en">normative</title-obligation-normative>
852
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
853
-
854
- <title-caution lang="en">CAUTION</title-caution>
855
- <title-caution lang="zh">注意</title-caution>
856
-
857
- <title-warning lang="en">WARNING</title-warning>
858
- <title-warning lang="zh">警告</title-warning>
859
-
860
- <title-amendment lang="en">AMENDMENT</title-amendment>
861
-
862
764
  <title-continued lang="en">(continued)</title-continued>
863
765
  <title-continued lang="fr">(continué)</title-continued>
864
766
 
@@ -961,14 +863,17 @@
961
863
 
962
864
 
963
865
 
866
+
964
867
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
965
868
 
966
869
 
967
870
 
871
+
968
872
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
969
873
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
970
874
 
971
875
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
876
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
972
877
 
973
878
 
974
879
 
@@ -988,7 +893,6 @@
988
893
  <xsl:attribute name="font-weight">bold</xsl:attribute>
989
894
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
990
895
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
991
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
992
896
 
993
897
 
994
898
  </xsl:attribute-set><xsl:attribute-set name="example-p-style">
@@ -1006,6 +910,7 @@
1006
910
 
1007
911
 
1008
912
 
913
+
1009
914
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1010
915
 
1011
916
 
@@ -1331,7 +1236,7 @@
1331
1236
 
1332
1237
 
1333
1238
 
1334
- </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">
1239
+ </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">
1335
1240
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1336
1241
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1337
1242
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2607,12 +2512,9 @@
2607
2512
  <fo:block margin-bottom="12pt" text-align="left">
2608
2513
 
2609
2514
  <xsl:variable name="title-where">
2610
-
2611
-
2612
- <xsl:call-template name="getTitle">
2613
- <xsl:with-param name="name" select="'title-where'"/>
2614
- </xsl:call-template>
2615
-
2515
+ <xsl:call-template name="getLocalizedString">
2516
+ <xsl:with-param name="key">where</xsl:with-param>
2517
+ </xsl:call-template>
2616
2518
  </xsl:variable>
2617
2519
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2618
2520
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2628,12 +2530,9 @@
2628
2530
 
2629
2531
 
2630
2532
  <xsl:variable name="title-where">
2631
-
2632
-
2633
- <xsl:call-template name="getTitle">
2634
- <xsl:with-param name="name" select="'title-where'"/>
2635
- </xsl:call-template>
2636
-
2533
+ <xsl:call-template name="getLocalizedString">
2534
+ <xsl:with-param name="key">where</xsl:with-param>
2535
+ </xsl:call-template>
2637
2536
  </xsl:variable>
2638
2537
  <xsl:value-of select="$title-where"/>
2639
2538
  </fo:block>
@@ -2645,12 +2544,9 @@
2645
2544
 
2646
2545
 
2647
2546
  <xsl:variable name="title-key">
2648
-
2649
-
2650
- <xsl:call-template name="getTitle">
2651
- <xsl:with-param name="name" select="'title-key'"/>
2652
- </xsl:call-template>
2653
-
2547
+ <xsl:call-template name="getLocalizedString">
2548
+ <xsl:with-param name="key">key</xsl:with-param>
2549
+ </xsl:call-template>
2654
2550
  </xsl:variable>
2655
2551
  <xsl:value-of select="$title-key"/>
2656
2552
  </fo:block>
@@ -2978,6 +2874,15 @@
2978
2874
  </fo:inline>
2979
2875
  </xsl:template><xsl:template match="*[local-name()='add']">
2980
2876
  <xsl:choose>
2877
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
2878
+ <fo:inline>
2879
+ <xsl:call-template name="insertTag">
2880
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
2881
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
2882
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
2883
+ </xsl:call-template>
2884
+ </fo:inline>
2885
+ </xsl:when>
2981
2886
  <xsl:when test="@amendment">
2982
2887
  <fo:inline>
2983
2888
  <xsl:call-template name="insertTag">
@@ -3012,7 +2917,6 @@
3012
2917
  </fo:inline>
3013
2918
  </xsl:otherwise>
3014
2919
  </xsl:choose>
3015
-
3016
2920
  </xsl:template><xsl:template name="insertTag">
3017
2921
  <xsl:param name="type"/>
3018
2922
  <xsl:param name="kind"/>
@@ -3028,14 +2932,14 @@
3028
2932
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3029
2933
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3030
2934
  <g>
3031
- <xsl:if test="$type = 'closing'">
2935
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3032
2936
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3033
2937
  </xsl:if>
3034
2938
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3035
2939
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3036
2940
  </g>
3037
2941
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3038
- <xsl:if test="$type = 'closing'">
2942
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3039
2943
  <xsl:attribute name="x">25</xsl:attribute>
3040
2944
  </xsl:if>
3041
2945
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3528,9 +3432,9 @@
3528
3432
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3529
3433
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3530
3434
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3531
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3435
+ <xsl:apply-templates select="*[local-name()='name']"/>
3532
3436
  </fo:block>
3533
- <xsl:apply-templates/>
3437
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3534
3438
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3535
3439
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3536
3440
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4123,11 +4027,58 @@
4123
4027
  <xsl:value-of select="."/>
4124
4028
  </xsl:template><xsl:template match="node()" mode="contents">
4125
4029
  <xsl:apply-templates mode="contents"/>
4030
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4031
+ <xsl:variable name="level">
4032
+ <xsl:call-template name="getLevel">
4033
+ <xsl:with-param name="depth" select="@depth"/>
4034
+ </xsl:call-template>
4035
+ </xsl:variable>
4036
+
4037
+ <xsl:variable name="section">
4038
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4039
+ </xsl:variable>
4040
+
4041
+ <xsl:variable name="type">floating-title</xsl:variable>
4042
+
4043
+ <xsl:variable name="display">
4044
+ <xsl:choose>
4045
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4046
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4047
+ <xsl:otherwise>false</xsl:otherwise>
4048
+ </xsl:choose>
4049
+ </xsl:variable>
4050
+
4051
+ <xsl:variable name="skip">false</xsl:variable>
4052
+
4053
+ <xsl:if test="$skip = 'false'">
4054
+
4055
+ <xsl:variable name="title">
4056
+ <xsl:choose>
4057
+ <xsl:when test="*[local-name() = 'tab']">
4058
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4059
+ </xsl:when>
4060
+ <xsl:otherwise>
4061
+ <xsl:copy-of select="node()"/>
4062
+ </xsl:otherwise>
4063
+ </xsl:choose>
4064
+ </xsl:variable>
4065
+
4066
+ <xsl:variable name="root">
4067
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4068
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4069
+ </xsl:variable>
4070
+
4071
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4072
+ <title>
4073
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4074
+ </title>
4075
+ </item>
4076
+ </xsl:if>
4126
4077
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4127
4078
  <xsl:apply-templates mode="bookmarks"/>
4128
4079
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4129
4080
  <xsl:apply-templates select="."/>
4130
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4081
+ </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">
4131
4082
  <xsl:apply-templates mode="bookmarks"/>
4132
4083
  </xsl:template><xsl:template name="addBookmarks">
4133
4084
  <xsl:param name="contents"/>
@@ -4298,7 +4249,10 @@
4298
4249
  </fo:block>
4299
4250
  </xsl:if>
4300
4251
  </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">
4301
- <xsl:apply-templates mode="contents_item"/>
4252
+ <xsl:param name="mode">bookmarks</xsl:param>
4253
+ <xsl:apply-templates mode="contents_item">
4254
+ <xsl:with-param name="mode" select="$mode"/>
4255
+ </xsl:apply-templates>
4302
4256
  <!-- <xsl:text> </xsl:text> -->
4303
4257
  </xsl:template><xsl:template name="getSection">
4304
4258
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4371,6 +4325,18 @@
4371
4325
  <xsl:copy-of select="."/>
4372
4326
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4373
4327
  <xsl:text> </xsl:text>
4328
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4329
+ <xsl:param name="mode">bookmarks</xsl:param>
4330
+ <xsl:apply-templates mode="contents_item">
4331
+ <xsl:with-param name="mode" select="$mode"/>
4332
+ </xsl:apply-templates>
4333
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4334
+ <xsl:param name="mode">bookmarks</xsl:param>
4335
+ <xsl:if test="$mode = 'contents'">
4336
+ <xsl:copy>
4337
+ <xsl:apply-templates mode="contents_item"/>
4338
+ </xsl:copy>
4339
+ </xsl:if>
4374
4340
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4375
4341
 
4376
4342
  <fo:block-container margin-left="0mm">
@@ -4707,42 +4673,48 @@
4707
4673
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4708
4674
 
4709
4675
 
4710
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4711
-
4712
- <xsl:variable name="element">
4676
+ <xsl:variable name="fo_element">
4677
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4713
4678
  block
4714
4679
 
4715
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4680
+
4716
4681
  </xsl:variable>
4717
4682
 
4683
+ <!-- display 'EXAMPLE' -->
4684
+ <xsl:apply-templates select="*[local-name()='name']">
4685
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4686
+ </xsl:apply-templates>
4687
+
4718
4688
  <xsl:choose>
4719
- <xsl:when test="contains(normalize-space($element), 'block')">
4720
- <fo:block xsl:use-attribute-sets="example-body-style">
4721
- <xsl:apply-templates/>
4722
- </fo:block>
4689
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4690
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
4691
+ <fo:block-container margin-left="0mm" margin-right="0mm">
4692
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4693
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4694
+ </xsl:apply-templates>
4695
+ </fo:block-container>
4696
+ </fo:block-container>
4723
4697
  </xsl:when>
4724
4698
  <xsl:otherwise>
4725
4699
  <fo:inline>
4726
- <xsl:apply-templates/>
4700
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4701
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4702
+ </xsl:apply-templates>
4727
4703
  </fo:inline>
4728
4704
  </xsl:otherwise>
4729
4705
  </xsl:choose>
4730
4706
 
4731
4707
  </fo:block>
4732
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4733
-
4734
- <xsl:variable name="element">
4735
- block
4736
-
4737
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4738
- </xsl:variable>
4708
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4709
+ <xsl:param name="fo_element">block</xsl:param>
4710
+
4739
4711
  <xsl:choose>
4740
4712
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4741
4713
  <fo:inline>
4742
4714
  <xsl:apply-templates/>
4743
4715
  </fo:inline>
4744
4716
  </xsl:when>
4745
- <xsl:when test="contains(normalize-space($element), 'block')">
4717
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4746
4718
  <fo:block xsl:use-attribute-sets="example-name-style">
4747
4719
  <xsl:apply-templates/>
4748
4720
  </fo:block>
@@ -4755,14 +4727,15 @@
4755
4727
  </xsl:choose>
4756
4728
 
4757
4729
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4730
+ <xsl:param name="fo_element">block</xsl:param>
4731
+
4758
4732
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4759
4733
  <xsl:variable name="element">
4760
- block
4761
-
4762
4734
 
4735
+ <xsl:value-of select="$fo_element"/>
4763
4736
  </xsl:variable>
4764
4737
  <xsl:choose>
4765
- <xsl:when test="normalize-space($element) = 'block'">
4738
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4766
4739
  <fo:block xsl:use-attribute-sets="example-p-style">
4767
4740
 
4768
4741
  <xsl:apply-templates/>
@@ -4830,12 +4803,9 @@
4830
4803
  </fo:basic-link>
4831
4804
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
4832
4805
  <xsl:variable name="title-modified">
4833
-
4834
-
4835
- <xsl:call-template name="getTitle">
4836
- <xsl:with-param name="name" select="'title-modified'"/>
4837
- </xsl:call-template>
4838
-
4806
+ <xsl:call-template name="getLocalizedString">
4807
+ <xsl:with-param name="key">modified</xsl:with-param>
4808
+ </xsl:call-template>
4839
4809
  </xsl:variable>
4840
4810
 
4841
4811
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -5022,12 +4992,9 @@
5022
4992
  </fo:block>
5023
4993
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5024
4994
  <xsl:variable name="title-deprecated">
5025
-
5026
-
5027
- <xsl:call-template name="getTitle">
5028
- <xsl:with-param name="name" select="'title-deprecated'"/>
5029
- </xsl:call-template>
5030
-
4995
+ <xsl:call-template name="getLocalizedString">
4996
+ <xsl:with-param name="key">deprecated</xsl:with-param>
4997
+ </xsl:call-template>
5031
4998
  </xsl:variable>
5032
4999
  <fo:block xsl:use-attribute-sets="deprecates-style">
5033
5000
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5036,6 +5003,8 @@
5036
5003
  <xsl:if test="*[local-name() = 'strong']">
5037
5004
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5038
5005
  </xsl:if>
5006
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5007
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5039
5008
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5040
5009
  <fo:block xsl:use-attribute-sets="definition-style">
5041
5010
  <xsl:apply-templates/>
@@ -5356,16 +5325,50 @@
5356
5325
 
5357
5326
 
5358
5327
 
5359
-
5328
+
5329
+
5330
+
5331
+
5332
+
5333
+
5360
5334
 
5361
5335
 
5362
5336
 
5363
5337
 
5364
5338
 
5339
+
5340
+
5341
+
5342
+
5343
+ <!-- start MPFD bibitem processing -->
5344
+ <xsl:variable name="docidentifier">
5345
+ <xsl:choose>
5346
+ <xsl:when test="mpfd:docidentifier/@type = 'metanorma'"/>
5347
+ <xsl:otherwise><xsl:value-of select="mpfd:docidentifier[not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
5348
+ </xsl:choose>
5349
+ </xsl:variable>
5350
+ <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
5351
+ <xsl:apply-templates select="mpfd:note"/>
5352
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
5353
+ <xsl:choose>
5354
+ <xsl:when test="mpfd:title[@type = 'main' and @language = 'en']">
5355
+ <xsl:apply-templates select="mpfd:title[@type = 'main' and @language = 'en']"/>
5356
+ </xsl:when>
5357
+ <xsl:otherwise>
5358
+ <xsl:apply-templates select="mpfd:title"/>
5359
+ </xsl:otherwise>
5360
+ </xsl:choose>
5361
+ <xsl:apply-templates select="mpfd:formattedref"/>
5362
+
5363
+ <!-- end MPFD bibitem processing -->
5364
+
5365
+ <!-- start M3D bibitem processing -->
5366
+
5365
5367
 
5368
+
5366
5369
 
5367
5370
  </xsl:template><xsl:template name="processBibitemDocId">
5368
- <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')]"/>
5371
+ <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')]"/>
5369
5372
  <xsl:choose>
5370
5373
  <xsl:when test="normalize-space($_doc_ident) != ''">
5371
5374
  <!-- <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"/>
@@ -5379,7 +5382,7 @@
5379
5382
  <xsl:if test="$type != ''">
5380
5383
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5381
5384
  </xsl:if> -->
5382
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5385
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5383
5386
  </xsl:otherwise>
5384
5387
  </xsl:choose>
5385
5388
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5485,8 +5488,12 @@
5485
5488
  <fo:block> </fo:block>
5486
5489
  </fo:block-container>
5487
5490
  </xsl:template><xsl:variable name="toc_level">
5491
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5492
+ <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:-->
5493
+ <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 -->
5488
5494
  <xsl:choose>
5489
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5495
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5496
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5490
5497
  <xsl:otherwise><!-- default value -->
5491
5498
 
5492
5499
 
@@ -5588,7 +5595,7 @@
5588
5595
  </td>
5589
5596
  </xsl:for-each>
5590
5597
  <td>333</td> <!-- page number, just for fill -->
5591
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5598
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5592
5599
  <fo:inline padding-right="5mm"> </fo:inline>
5593
5600
  <fo:inline><xsl:apply-templates/></fo:inline>
5594
5601
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -5953,9 +5960,15 @@
5953
5960
  </xsl:template><xsl:template name="getLocalizedString">
5954
5961
  <xsl:param name="key"/>
5955
5962
  <xsl:param name="formatted">false</xsl:param>
5963
+ <xsl:param name="lang"/>
5956
5964
 
5957
5965
  <xsl:variable name="curr_lang">
5958
- <xsl:call-template name="getLang"/>
5966
+ <xsl:choose>
5967
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
5968
+ <xsl:otherwise>
5969
+ <xsl:call-template name="getLang"/>
5970
+ </xsl:otherwise>
5971
+ </xsl:choose>
5959
5972
  </xsl:variable>
5960
5973
 
5961
5974
  <xsl:variable name="data_value">