metanorma-m3aawg 1.8.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -595,25 +595,7 @@
595
595
 
596
596
  <xsl:template match="m3d:bibitem">
597
597
  <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
598
- <!-- m3d:docidentifier -->
599
- <xsl:if test="m3d:docidentifier">
600
- <xsl:choose>
601
- <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
602
- <xsl:otherwise><fo:inline><xsl:value-of select="m3d:docidentifier"/></fo:inline></xsl:otherwise>
603
- </xsl:choose>
604
- </xsl:if>
605
- <xsl:apply-templates select="m3d:note"/>
606
- <xsl:if test="m3d:docidentifier">, </xsl:if>
607
- <fo:inline font-style="italic">
608
- <xsl:choose>
609
- <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
610
- <xsl:value-of select="m3d:title[@type = 'main' and @language = 'en']"/>
611
- </xsl:when>
612
- <xsl:otherwise>
613
- <xsl:value-of select="m3d:title"/>
614
- </xsl:otherwise>
615
- </xsl:choose>
616
- </fo:inline>
598
+ <xsl:call-template name="processBibitem"/>
617
599
  </fo:block>
618
600
  </xsl:template>
619
601
 
@@ -735,50 +717,30 @@
735
717
  <fo:list-item-label end-indent="label-end()">
736
718
  <fo:block>
737
719
  <fo:inline id="{@id}">
738
- <xsl:number format="[1]"/>
720
+ <xsl:value-of select="m3d:docidentifier[@type = 'metanorma-ordinal']"/>
721
+ <xsl:if test="not(m3d:docidentifier[@type = 'metanorma-ordinal'])">
722
+ <xsl:number format="[1]"/>
723
+ </xsl:if>
739
724
  </fo:inline>
740
725
  </fo:block>
741
726
  </fo:list-item-label>
742
727
  <fo:list-item-body start-indent="body-start()">
743
728
  <fo:block text-align="justify">
744
- <xsl:variable name="docidentifier">
745
- <xsl:if test="m3d:docidentifier">
746
- <xsl:choose>
747
- <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
748
- <xsl:otherwise><xsl:value-of select="m3d:docidentifier"/></xsl:otherwise>
749
- </xsl:choose>
750
- </xsl:if>
751
- </xsl:variable>
752
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
753
- <xsl:apply-templates select="m3d:note"/>
754
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
755
- <xsl:choose>
756
- <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
757
- <xsl:apply-templates select="m3d:title[@type = 'main' and @language = 'en']"/>
758
- </xsl:when>
759
- <xsl:otherwise>
760
- <xsl:apply-templates select="m3d:title"/>
761
- </xsl:otherwise>
762
- </xsl:choose>
763
- <xsl:apply-templates select="m3d:formattedref"/>
729
+ <xsl:call-template name="processBibitem"/>
764
730
  </fo:block>
765
731
  </fo:list-item-body>
766
732
  </fo:list-item>
767
733
  </fo:list-block>
768
734
  </xsl:template>
769
735
 
770
- <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem" mode="contents"/> -->
771
- <xsl:template match="m3d:references[not(@normative='true')]/m3d:bibitem" mode="contents"/>
772
736
 
773
737
  <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem/m3d:title"> -->
774
- <xsl:template match="m3d:references[not(@normative='true')]/m3d:bibitem/m3d:title">
738
+ <xsl:template match="m3d:references/m3d:bibitem/m3d:title">
775
739
  <fo:inline font-style="italic">
776
740
  <xsl:apply-templates/>
777
741
  </fo:inline>
778
742
  </xsl:template>
779
743
 
780
-
781
-
782
744
 
783
745
  <xsl:template match="mathml:math" priority="2">
784
746
  <fo:inline font-family="Cambria Math">
@@ -848,13 +810,6 @@
848
810
 
849
811
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
850
812
 
851
- <title-annex lang="en">Annex </title-annex>
852
- <title-annex lang="fr">Annexe </title-annex>
853
-
854
- <title-annex lang="zh">Annex </title-annex>
855
-
856
-
857
-
858
813
  <title-edition lang="en">
859
814
 
860
815
 
@@ -868,7 +823,8 @@
868
823
 
869
824
  </title-edition>
870
825
 
871
-
826
+
827
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
872
828
  <title-toc lang="en">
873
829
 
874
830
 
@@ -880,21 +836,11 @@
880
836
 
881
837
  <xsl:text>Sommaire</xsl:text>
882
838
 
883
-
884
- </title-toc>
839
+ </title-toc>
885
840
 
886
841
  <title-toc lang="zh">Contents</title-toc>
887
842
 
888
843
 
889
-
890
- <title-page lang="en">Page</title-page>
891
- <title-page lang="fr">Page</title-page>
892
-
893
- <title-key lang="en">Key</title-key>
894
- <title-key lang="fr">Légende</title-key>
895
-
896
- <title-where lang="en">where</title-where>
897
- <title-where lang="fr">où</title-where>
898
844
 
899
845
  <title-descriptors lang="en">Descriptors</title-descriptors>
900
846
 
@@ -917,25 +863,6 @@
917
863
 
918
864
  </title-subpart>
919
865
 
920
- <title-modified lang="en">modified</title-modified>
921
- <title-modified lang="fr">modifiée</title-modified>
922
-
923
- <title-modified lang="zh">modified</title-modified>
924
-
925
-
926
-
927
- <title-source lang="en">
928
-
929
- <xsl:text>SOURCE</xsl:text>
930
-
931
-
932
- </title-source>
933
-
934
- <title-keywords lang="en">Keywords</title-keywords>
935
-
936
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
937
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
938
-
939
866
  <title-list-tables lang="en">List of Tables</title-list-tables>
940
867
 
941
868
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -944,37 +871,8 @@
944
871
 
945
872
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
946
873
 
947
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
948
-
949
- <title-abstract lang="en">Abstract</title-abstract>
950
-
951
874
  <title-summary lang="en">Summary</title-summary>
952
875
 
953
- <title-in lang="en">in </title-in>
954
-
955
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
956
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
957
-
958
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
959
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
960
-
961
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
962
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
963
-
964
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
965
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
966
-
967
- <title-obligation-normative lang="en">normative</title-obligation-normative>
968
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
969
-
970
- <title-caution lang="en">CAUTION</title-caution>
971
- <title-caution lang="zh">注意</title-caution>
972
-
973
- <title-warning lang="en">WARNING</title-warning>
974
- <title-warning lang="zh">警告</title-warning>
975
-
976
- <title-amendment lang="en">AMENDMENT</title-amendment>
977
-
978
876
  <title-continued lang="en">(continued)</title-continued>
979
877
  <title-continued lang="fr">(continué)</title-continued>
980
878
 
@@ -1078,6 +976,7 @@
1078
976
 
1079
977
 
1080
978
 
979
+
1081
980
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1082
981
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1083
982
 
@@ -1091,7 +990,9 @@
1091
990
 
1092
991
 
1093
992
 
993
+
1094
994
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
995
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1095
996
 
1096
997
 
1097
998
 
@@ -1120,6 +1021,7 @@
1120
1021
 
1121
1022
 
1122
1023
 
1024
+
1123
1025
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1124
1026
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1125
1027
 
@@ -1471,7 +1373,7 @@
1471
1373
 
1472
1374
 
1473
1375
 
1474
- </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">
1376
+ </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">
1475
1377
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1476
1378
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1477
1379
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2749,12 +2651,9 @@
2749
2651
  <fo:block margin-bottom="12pt" text-align="left">
2750
2652
 
2751
2653
  <xsl:variable name="title-where">
2752
-
2753
-
2754
- <xsl:call-template name="getTitle">
2755
- <xsl:with-param name="name" select="'title-where'"/>
2756
- </xsl:call-template>
2757
-
2654
+ <xsl:call-template name="getLocalizedString">
2655
+ <xsl:with-param name="key">where</xsl:with-param>
2656
+ </xsl:call-template>
2758
2657
  </xsl:variable>
2759
2658
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2760
2659
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2770,12 +2669,9 @@
2770
2669
 
2771
2670
 
2772
2671
  <xsl:variable name="title-where">
2773
-
2774
-
2775
- <xsl:call-template name="getTitle">
2776
- <xsl:with-param name="name" select="'title-where'"/>
2777
- </xsl:call-template>
2778
-
2672
+ <xsl:call-template name="getLocalizedString">
2673
+ <xsl:with-param name="key">where</xsl:with-param>
2674
+ </xsl:call-template>
2779
2675
  </xsl:variable>
2780
2676
  <xsl:value-of select="$title-where"/>
2781
2677
  </fo:block>
@@ -2787,12 +2683,9 @@
2787
2683
 
2788
2684
 
2789
2685
  <xsl:variable name="title-key">
2790
-
2791
-
2792
- <xsl:call-template name="getTitle">
2793
- <xsl:with-param name="name" select="'title-key'"/>
2794
- </xsl:call-template>
2795
-
2686
+ <xsl:call-template name="getLocalizedString">
2687
+ <xsl:with-param name="key">key</xsl:with-param>
2688
+ </xsl:call-template>
2796
2689
  </xsl:variable>
2797
2690
  <xsl:value-of select="$title-key"/>
2798
2691
  </fo:block>
@@ -3125,6 +3018,15 @@
3125
3018
  </fo:inline>
3126
3019
  </xsl:template><xsl:template match="*[local-name()='add']">
3127
3020
  <xsl:choose>
3021
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3022
+ <fo:inline>
3023
+ <xsl:call-template name="insertTag">
3024
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3025
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3026
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3027
+ </xsl:call-template>
3028
+ </fo:inline>
3029
+ </xsl:when>
3128
3030
  <xsl:when test="@amendment">
3129
3031
  <fo:inline>
3130
3032
  <xsl:call-template name="insertTag">
@@ -3159,7 +3061,6 @@
3159
3061
  </fo:inline>
3160
3062
  </xsl:otherwise>
3161
3063
  </xsl:choose>
3162
-
3163
3064
  </xsl:template><xsl:template name="insertTag">
3164
3065
  <xsl:param name="type"/>
3165
3066
  <xsl:param name="kind"/>
@@ -3175,14 +3076,14 @@
3175
3076
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3176
3077
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3177
3078
  <g>
3178
- <xsl:if test="$type = 'closing'">
3079
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3179
3080
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3180
3081
  </xsl:if>
3181
3082
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3182
3083
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3183
3084
  </g>
3184
3085
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3185
- <xsl:if test="$type = 'closing'">
3086
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3186
3087
  <xsl:attribute name="x">25</xsl:attribute>
3187
3088
  </xsl:if>
3188
3089
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3675,9 +3576,9 @@
3675
3576
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3676
3577
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3677
3578
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3678
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3579
+ <xsl:apply-templates select="*[local-name()='name']"/>
3679
3580
  </fo:block>
3680
- <xsl:apply-templates/>
3581
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3681
3582
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3682
3583
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3683
3584
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4276,11 +4177,58 @@
4276
4177
  <xsl:value-of select="."/>
4277
4178
  </xsl:template><xsl:template match="node()" mode="contents">
4278
4179
  <xsl:apply-templates mode="contents"/>
4180
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4181
+ <xsl:variable name="level">
4182
+ <xsl:call-template name="getLevel">
4183
+ <xsl:with-param name="depth" select="@depth"/>
4184
+ </xsl:call-template>
4185
+ </xsl:variable>
4186
+
4187
+ <xsl:variable name="section">
4188
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4189
+ </xsl:variable>
4190
+
4191
+ <xsl:variable name="type">floating-title</xsl:variable>
4192
+
4193
+ <xsl:variable name="display">
4194
+ <xsl:choose>
4195
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4196
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4197
+ <xsl:otherwise>false</xsl:otherwise>
4198
+ </xsl:choose>
4199
+ </xsl:variable>
4200
+
4201
+ <xsl:variable name="skip">false</xsl:variable>
4202
+
4203
+ <xsl:if test="$skip = 'false'">
4204
+
4205
+ <xsl:variable name="title">
4206
+ <xsl:choose>
4207
+ <xsl:when test="*[local-name() = 'tab']">
4208
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4209
+ </xsl:when>
4210
+ <xsl:otherwise>
4211
+ <xsl:copy-of select="node()"/>
4212
+ </xsl:otherwise>
4213
+ </xsl:choose>
4214
+ </xsl:variable>
4215
+
4216
+ <xsl:variable name="root">
4217
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4218
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4219
+ </xsl:variable>
4220
+
4221
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4222
+ <title>
4223
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4224
+ </title>
4225
+ </item>
4226
+ </xsl:if>
4279
4227
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4280
4228
  <xsl:apply-templates mode="bookmarks"/>
4281
4229
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4282
4230
  <xsl:apply-templates select="."/>
4283
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4231
+ </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">
4284
4232
  <xsl:apply-templates mode="bookmarks"/>
4285
4233
  </xsl:template><xsl:template name="addBookmarks">
4286
4234
  <xsl:param name="contents"/>
@@ -4451,7 +4399,10 @@
4451
4399
  </fo:block>
4452
4400
  </xsl:if>
4453
4401
  </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">
4454
- <xsl:apply-templates mode="contents_item"/>
4402
+ <xsl:param name="mode">bookmarks</xsl:param>
4403
+ <xsl:apply-templates mode="contents_item">
4404
+ <xsl:with-param name="mode" select="$mode"/>
4405
+ </xsl:apply-templates>
4455
4406
  <!-- <xsl:text> </xsl:text> -->
4456
4407
  </xsl:template><xsl:template name="getSection">
4457
4408
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4524,6 +4475,18 @@
4524
4475
  <xsl:copy-of select="."/>
4525
4476
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4526
4477
  <xsl:text> </xsl:text>
4478
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4479
+ <xsl:param name="mode">bookmarks</xsl:param>
4480
+ <xsl:apply-templates mode="contents_item">
4481
+ <xsl:with-param name="mode" select="$mode"/>
4482
+ </xsl:apply-templates>
4483
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4484
+ <xsl:param name="mode">bookmarks</xsl:param>
4485
+ <xsl:if test="$mode = 'contents'">
4486
+ <xsl:copy>
4487
+ <xsl:apply-templates mode="contents_item"/>
4488
+ </xsl:copy>
4489
+ </xsl:if>
4527
4490
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4528
4491
 
4529
4492
  <fo:block-container margin-left="0mm">
@@ -4860,42 +4823,48 @@
4860
4823
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4861
4824
 
4862
4825
 
4863
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4864
-
4865
- <xsl:variable name="element">
4826
+ <xsl:variable name="fo_element">
4827
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4866
4828
 
4867
4829
  inline
4868
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4830
+
4869
4831
  </xsl:variable>
4870
4832
 
4833
+ <!-- display 'EXAMPLE' -->
4834
+ <xsl:apply-templates select="*[local-name()='name']">
4835
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4836
+ </xsl:apply-templates>
4837
+
4871
4838
  <xsl:choose>
4872
- <xsl:when test="contains(normalize-space($element), 'block')">
4873
- <fo:block xsl:use-attribute-sets="example-body-style">
4874
- <xsl:apply-templates/>
4875
- </fo:block>
4839
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4840
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
4841
+ <fo:block-container margin-left="0mm" margin-right="0mm">
4842
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4843
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4844
+ </xsl:apply-templates>
4845
+ </fo:block-container>
4846
+ </fo:block-container>
4876
4847
  </xsl:when>
4877
4848
  <xsl:otherwise>
4878
4849
  <fo:inline>
4879
- <xsl:apply-templates/>
4850
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4851
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4852
+ </xsl:apply-templates>
4880
4853
  </fo:inline>
4881
4854
  </xsl:otherwise>
4882
4855
  </xsl:choose>
4883
4856
 
4884
4857
  </fo:block>
4885
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4886
-
4887
- <xsl:variable name="element">
4888
-
4889
- inline
4890
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4891
- </xsl:variable>
4858
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4859
+ <xsl:param name="fo_element">block</xsl:param>
4860
+
4892
4861
  <xsl:choose>
4893
4862
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4894
4863
  <fo:inline>
4895
4864
  <xsl:apply-templates/>
4896
4865
  </fo:inline>
4897
4866
  </xsl:when>
4898
- <xsl:when test="contains(normalize-space($element), 'block')">
4867
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4899
4868
  <fo:block xsl:use-attribute-sets="example-name-style">
4900
4869
  <xsl:apply-templates/>
4901
4870
  </fo:block>
@@ -4908,14 +4877,15 @@
4908
4877
  </xsl:choose>
4909
4878
 
4910
4879
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4880
+ <xsl:param name="fo_element">block</xsl:param>
4881
+
4911
4882
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4912
4883
  <xsl:variable name="element">
4913
- block
4914
-
4915
4884
 
4885
+ <xsl:value-of select="$fo_element"/>
4916
4886
  </xsl:variable>
4917
4887
  <xsl:choose>
4918
- <xsl:when test="normalize-space($element) = 'block'">
4888
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4919
4889
  <fo:block xsl:use-attribute-sets="example-p-style">
4920
4890
 
4921
4891
  <xsl:apply-templates/>
@@ -4983,12 +4953,9 @@
4983
4953
  </fo:basic-link>
4984
4954
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
4985
4955
  <xsl:variable name="title-modified">
4986
-
4987
-
4988
- <xsl:call-template name="getTitle">
4989
- <xsl:with-param name="name" select="'title-modified'"/>
4990
- </xsl:call-template>
4991
-
4956
+ <xsl:call-template name="getLocalizedString">
4957
+ <xsl:with-param name="key">modified</xsl:with-param>
4958
+ </xsl:call-template>
4992
4959
  </xsl:variable>
4993
4960
 
4994
4961
  <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
@@ -5180,12 +5147,9 @@
5180
5147
  </fo:block>
5181
5148
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5182
5149
  <xsl:variable name="title-deprecated">
5183
-
5184
- <xsl:call-template name="getLocalizedString">
5185
- <xsl:with-param name="key">deprecated</xsl:with-param>
5186
- </xsl:call-template>
5187
-
5188
-
5150
+ <xsl:call-template name="getLocalizedString">
5151
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5152
+ </xsl:call-template>
5189
5153
  </xsl:variable>
5190
5154
  <fo:block xsl:use-attribute-sets="deprecates-style">
5191
5155
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5194,6 +5158,8 @@
5194
5158
  <xsl:if test="*[local-name() = 'strong']">
5195
5159
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5196
5160
  </xsl:if>
5161
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5162
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5197
5163
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5198
5164
  <fo:block xsl:use-attribute-sets="definition-style">
5199
5165
  <xsl:apply-templates/>
@@ -5521,16 +5487,52 @@
5521
5487
 
5522
5488
 
5523
5489
 
5524
-
5490
+
5491
+
5492
+
5493
+
5494
+
5495
+
5525
5496
 
5526
5497
 
5527
5498
 
5528
5499
 
5529
5500
 
5501
+
5502
+
5503
+
5504
+
5505
+ <!-- end MPFD bibitem processing -->
5506
+
5507
+ <!-- start M3D bibitem processing -->
5508
+
5509
+ <xsl:variable name="docidentifier">
5510
+ <xsl:if test="m3d:docidentifier">
5511
+ <xsl:choose>
5512
+ <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
5513
+ <xsl:otherwise><xsl:value-of select="m3d:docidentifier[not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
5514
+ </xsl:choose>
5515
+ </xsl:if>
5516
+ </xsl:variable>
5517
+ <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
5518
+ <xsl:apply-templates select="m3d:note"/>
5519
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
5520
+ <xsl:choose>
5521
+ <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
5522
+ <xsl:apply-templates select="m3d:title[@type = 'main' and @language = 'en']"/>
5523
+ </xsl:when>
5524
+ <xsl:otherwise>
5525
+ <xsl:apply-templates select="m3d:title"/>
5526
+ </xsl:otherwise>
5527
+ </xsl:choose>
5528
+ <xsl:apply-templates select="m3d:formattedref"/>
5529
+ <!-- end MPFD bibitem processing -->
5530
+
5530
5531
 
5532
+
5531
5533
 
5532
5534
  </xsl:template><xsl:template name="processBibitemDocId">
5533
- <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')]"/>
5535
+ <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')]"/>
5534
5536
  <xsl:choose>
5535
5537
  <xsl:when test="normalize-space($_doc_ident) != ''">
5536
5538
  <!-- <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"/>
@@ -5544,7 +5546,7 @@
5544
5546
  <xsl:if test="$type != ''">
5545
5547
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5546
5548
  </xsl:if> -->
5547
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5549
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5548
5550
  </xsl:otherwise>
5549
5551
  </xsl:choose>
5550
5552
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5650,8 +5652,12 @@
5650
5652
  <fo:block> </fo:block>
5651
5653
  </fo:block-container>
5652
5654
  </xsl:template><xsl:variable name="toc_level">
5655
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5656
+ <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:-->
5657
+ <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 -->
5653
5658
  <xsl:choose>
5654
- <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
5659
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5660
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5655
5661
  <xsl:otherwise><!-- default value -->
5656
5662
 
5657
5663
 
@@ -5753,7 +5759,7 @@
5753
5759
  </td>
5754
5760
  </xsl:for-each>
5755
5761
  <td>333</td> <!-- page number, just for fill -->
5756
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5762
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5757
5763
  <fo:inline padding-right="5mm"> </fo:inline>
5758
5764
  <fo:inline><xsl:apply-templates/></fo:inline>
5759
5765
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6125,9 +6131,15 @@
6125
6131
  </xsl:template><xsl:template name="getLocalizedString">
6126
6132
  <xsl:param name="key"/>
6127
6133
  <xsl:param name="formatted">false</xsl:param>
6134
+ <xsl:param name="lang"/>
6128
6135
 
6129
6136
  <xsl:variable name="curr_lang">
6130
- <xsl:call-template name="getLang"/>
6137
+ <xsl:choose>
6138
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6139
+ <xsl:otherwise>
6140
+ <xsl:call-template name="getLang"/>
6141
+ </xsl:otherwise>
6142
+ </xsl:choose>
6131
6143
  </xsl:variable>
6132
6144
 
6133
6145
  <xsl:variable name="data_value">