metanorma-mpfa 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
- <xsl:key name="kfn" match="mpfd:p/mpfd:fn" use="@reference"/>
10
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
11
 
12
12
 
13
13
 
@@ -287,7 +287,7 @@
287
287
 
288
288
  <xsl:variable name="display">
289
289
  <xsl:choose>
290
- <xsl:when test="$level &gt;= 3">false</xsl:when>
290
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
291
291
  <xsl:otherwise>true</xsl:otherwise>
292
292
  </xsl:choose>
293
293
  </xsl:variable>
@@ -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"/>
@@ -332,7 +330,9 @@
332
330
 
333
331
  <xsl:template name="getListItemFormat">
334
332
  <xsl:choose>
335
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!--• dash -->
333
+ <xsl:when test="local-name(..) = 'ul'">
334
+ <xsl:call-template name="setULLabel"/>
335
+ </xsl:when>
336
336
  <xsl:otherwise> <!-- for ordered lists -->
337
337
  <xsl:choose>
338
338
  <xsl:when test="../@type = 'arabic'">
@@ -357,7 +357,7 @@
357
357
 
358
358
 
359
359
 
360
- <xsl:template match="mpfd:title">
360
+ <xsl:template match="mpfd:title" name="title">
361
361
 
362
362
  <xsl:variable name="level">
363
363
  <xsl:call-template name="getLevel"/>
@@ -458,84 +458,11 @@
458
458
 
459
459
  </xsl:template>
460
460
 
461
- <!--
462
- <fn reference="1">
463
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
464
- </fn>
465
- -->
466
-
467
- <xsl:variable name="p_fn">
468
- <xsl:for-each select="//mpfd:p/mpfd:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
469
- <!-- copy unique fn -->
470
- <fn gen_id="{generate-id(.)}">
471
- <xsl:copy-of select="@*"/>
472
- <xsl:copy-of select="node()"/>
473
- </fn>
474
- </xsl:for-each>
475
- </xsl:variable>
476
461
 
477
- <xsl:template match="mpfd:p/mpfd:fn" priority="2">
478
- <xsl:variable name="gen_id" select="generate-id(.)"/>
479
- <xsl:variable name="reference" select="@reference"/>
480
- <xsl:variable name="number">
481
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
482
- </xsl:variable>
483
- <xsl:choose>
484
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
485
- <fo:footnote>
486
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
487
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
488
- <!-- <xsl:value-of select="@reference"/> -->
489
- <xsl:value-of select="$number + count(//mpfd:bibitem[ancestor::mpfd:references[@id='_normative_references' or not(preceding-sibling::mpfd:references)]]/mpfd:note)"/>
490
- </fo:basic-link>
491
- </fo:inline>
492
- <fo:footnote-body>
493
- <fo:block font-size="9pt" margin-bottom="12pt">
494
- <fo:inline font-size="6pt" id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm">
495
- <xsl:value-of select="$number + count(//mpfd:bibitem[ancestor::mpfd:references[@id='_normative_references' or not(preceding-sibling::mpfd:references)]]/mpfd:note)"/>
496
- </fo:inline>
497
- <xsl:for-each select="mpfd:p">
498
- <xsl:apply-templates/>
499
- </xsl:for-each>
500
- </fo:block>
501
- </fo:footnote-body>
502
- </fo:footnote>
503
- </xsl:when>
504
- <xsl:otherwise>
505
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
506
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
507
- <xsl:value-of select="$number + count(//mpfd:bibitem/mpfd:note)"/>
508
- </fo:basic-link>
509
- </fo:inline>
510
- </xsl:otherwise>
511
- </xsl:choose>
512
- </xsl:template>
513
-
514
-
515
-
516
-
517
462
 
518
463
  <xsl:template match="mpfd:bibitem">
519
- <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
520
- <!-- mpfd:docidentifier -->
521
- <xsl:if test="mpfd:docidentifier">
522
- <xsl:choose>
523
- <xsl:when test="mpfd:docidentifier/@type = 'metanorma'"/>
524
- <xsl:otherwise><fo:inline><xsl:value-of select="mpfd:docidentifier"/></fo:inline></xsl:otherwise>
525
- </xsl:choose>
526
- </xsl:if>
527
- <xsl:apply-templates select="mpfd:note"/>
528
- <xsl:if test="mpfd:docidentifier">, </xsl:if>
529
- <fo:inline font-style="italic">
530
- <xsl:choose>
531
- <xsl:when test="mpfd:title[@type = 'main' and @language = 'en']">
532
- <xsl:value-of select="mpfd:title[@type = 'main' and @language = 'en']"/>
533
- </xsl:when>
534
- <xsl:otherwise>
535
- <xsl:value-of select="mpfd:title"/>
536
- </xsl:otherwise>
537
- </xsl:choose>
538
- </fo:inline>
464
+ <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm">
465
+ <xsl:call-template name="processBibitem"/>
539
466
  </fo:block>
540
467
  </xsl:template>
541
468
 
@@ -593,11 +520,6 @@
593
520
  <fo:list-item id="{@id}">
594
521
  <fo:list-item-label end-indent="label-end()">
595
522
  <fo:block>
596
- <!-- to vertical align big dot -->
597
- <!-- <xsl:if test="local-name(..) = 'ul'">
598
- <xsl:attribute name="font-size">18pt</xsl:attribute>
599
- <xsl:attribute name="margin-top">-0.5mm</xsl:attribute>
600
- </xsl:if> -->
601
523
  <xsl:call-template name="getListItemFormat"/>
602
524
  </fo:block>
603
525
  </fo:list-item-label>
@@ -615,6 +537,7 @@
615
537
 
616
538
  <xsl:template match="mpfd:preferred">
617
539
  <fo:inline font-weight="bold">
540
+ <xsl:call-template name="setStyle_preferred"/>
618
541
  <xsl:apply-templates/>
619
542
  </fo:inline>
620
543
  <xsl:if test="not(following-sibling::*[1][local-name() = 'preferred'])">
@@ -646,41 +569,23 @@
646
569
  <fo:list-item-label end-indent="label-end()">
647
570
  <fo:block>
648
571
  <fo:inline>
649
- <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>
650
576
  </fo:inline>
651
577
  </fo:block>
652
578
  </fo:list-item-label>
653
579
  <fo:list-item-body start-indent="body-start()">
654
580
  <fo:block text-align="justify">
655
- <xsl:variable name="docidentifier">
656
- <xsl:if test="mpfd:docidentifier">
657
- <xsl:choose>
658
- <xsl:when test="mpfd:docidentifier/@type = 'metanorma'"/>
659
- <xsl:otherwise><xsl:value-of select="mpfd:docidentifier"/></xsl:otherwise>
660
- </xsl:choose>
661
- </xsl:if>
662
- </xsl:variable>
663
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
664
- <xsl:apply-templates select="mpfd:note"/>
665
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
666
- <xsl:choose>
667
- <xsl:when test="mpfd:title[@type = 'main' and @language = 'en']">
668
- <xsl:apply-templates select="mpfd:title[@type = 'main' and @language = 'en']"/>
669
- </xsl:when>
670
- <xsl:otherwise>
671
- <xsl:apply-templates select="mpfd:title"/>
672
- </xsl:otherwise>
673
- </xsl:choose>
674
- <xsl:apply-templates select="mpfd:formattedref"/>
581
+ <xsl:call-template name="processBibitem"/>
675
582
  </fo:block>
676
583
  </fo:list-item-body>
677
584
  </fo:list-item>
678
585
  </fo:list-block>
679
586
  </xsl:template>
680
587
 
681
- <xsl:template match="mpfd:references[not(@normative='true')]/mpfd:bibitem" mode="contents"/>
682
-
683
- <xsl:template match="mpfd:references[not(@normative='true')]/mpfd:bibitem/mpfd:title">
588
+ <xsl:template match="mpfd:references/mpfd:bibitem/mpfd:title">
684
589
  <fo:inline font-style="italic">
685
590
  <xsl:apply-templates/>
686
591
  </fo:inline>
@@ -793,11 +698,6 @@
793
698
 
794
699
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
795
700
 
796
- <title-annex lang="en">Annex </title-annex>
797
- <title-annex lang="fr">Annexe </title-annex>
798
-
799
-
800
-
801
701
  <title-edition lang="en">
802
702
 
803
703
  <xsl:text>Edition </xsl:text>
@@ -811,7 +711,8 @@
811
711
 
812
712
  </title-edition>
813
713
 
814
-
714
+
715
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
815
716
  <title-toc lang="en">
816
717
 
817
718
  <xsl:text>Contents</xsl:text>
@@ -823,19 +724,11 @@
823
724
 
824
725
  <xsl:text>Sommaire</xsl:text>
825
726
 
826
-
827
- </title-toc>
828
-
727
+ </title-toc>
829
728
 
729
+ <title-toc lang="zh">Contents</title-toc>
830
730
 
831
- <title-page lang="en">Page</title-page>
832
- <title-page lang="fr">Page</title-page>
833
731
 
834
- <title-key lang="en">Key</title-key>
835
- <title-key lang="fr">Légende</title-key>
836
-
837
- <title-where lang="en">where</title-where>
838
- <title-where lang="fr">où</title-where>
839
732
 
840
733
  <title-descriptors lang="en">Descriptors</title-descriptors>
841
734
 
@@ -858,25 +751,6 @@
858
751
 
859
752
  </title-subpart>
860
753
 
861
- <title-modified lang="en">modified</title-modified>
862
- <title-modified lang="fr">modifiée</title-modified>
863
-
864
- <title-modified lang="zh">modified</title-modified>
865
-
866
-
867
-
868
- <title-source lang="en">
869
-
870
- <xsl:text>SOURCE</xsl:text>
871
-
872
-
873
- </title-source>
874
-
875
- <title-keywords lang="en">Keywords</title-keywords>
876
-
877
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
878
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
879
-
880
754
  <title-list-tables lang="en">List of Tables</title-list-tables>
881
755
 
882
756
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -885,37 +759,8 @@
885
759
 
886
760
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
887
761
 
888
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
889
-
890
- <title-abstract lang="en">Abstract</title-abstract>
891
-
892
762
  <title-summary lang="en">Summary</title-summary>
893
763
 
894
- <title-in lang="en">in </title-in>
895
-
896
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
897
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
898
-
899
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
900
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
901
-
902
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
903
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
904
-
905
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
906
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
907
-
908
- <title-obligation-normative lang="en">normative</title-obligation-normative>
909
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
910
-
911
- <title-caution lang="en">CAUTION</title-caution>
912
- <title-caution lang="zh">注意</title-caution>
913
-
914
- <title-warning lang="en">WARNING</title-warning>
915
- <title-warning lang="zh">警告</title-warning>
916
-
917
- <title-amendment lang="en">AMENDMENT</title-amendment>
918
-
919
764
  <title-continued lang="en">(continued)</title-continued>
920
765
  <title-continued lang="fr">(continué)</title-continued>
921
766
 
@@ -1018,14 +863,17 @@
1018
863
 
1019
864
 
1020
865
 
866
+
1021
867
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1022
868
 
1023
869
 
1024
870
 
871
+
1025
872
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
1026
873
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1027
874
 
1028
875
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
876
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1029
877
 
1030
878
 
1031
879
 
@@ -1045,7 +893,6 @@
1045
893
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1046
894
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1047
895
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1048
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1049
896
 
1050
897
 
1051
898
  </xsl:attribute-set><xsl:attribute-set name="example-p-style">
@@ -1063,6 +910,7 @@
1063
910
 
1064
911
 
1065
912
 
913
+
1066
914
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1067
915
 
1068
916
 
@@ -1316,7 +1164,79 @@
1316
1164
 
1317
1165
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1318
1166
  <xsl:attribute name="line-height">135%</xsl:attribute>
1319
- </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">
1167
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1168
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1169
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1170
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
1183
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1191
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1192
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1193
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1194
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1207
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1208
+
1209
+
1210
+
1211
+
1212
+
1213
+
1214
+
1215
+
1216
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1217
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+ <xsl:attribute name="font-size">6pt</xsl:attribute>
1230
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1231
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+
1238
+
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">
1320
1240
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1321
1241
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1322
1242
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1341,7 +1261,8 @@
1341
1261
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1342
1262
 
1343
1263
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1344
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1264
+
1265
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
1345
1266
  <xsl:sort select="@displayorder" data-type="number"/>
1346
1267
  <xsl:apply-templates select="." mode="contents"/>
1347
1268
  </xsl:for-each>
@@ -1351,7 +1272,7 @@
1351
1272
  <xsl:apply-templates select="." mode="contents"/>
1352
1273
  </xsl:for-each>
1353
1274
 
1354
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1275
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1355
1276
  <xsl:sort select="@displayorder" data-type="number"/>
1356
1277
  <xsl:apply-templates select="." mode="contents"/>
1357
1278
  </xsl:for-each>
@@ -2255,6 +2176,102 @@
2255
2176
 
2256
2177
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2257
2178
  <xsl:apply-templates/>
2179
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
2180
+
2181
+ <!-- list of footnotes to calculate actual footnotes number -->
2182
+ <xsl:variable name="p_fn_">
2183
+ <xsl:choose>
2184
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2185
+ <fn gen_id="{generate-id(.)}">
2186
+ <xsl:copy-of select="@*"/>
2187
+ <xsl:copy-of select="node()"/>
2188
+ </fn>
2189
+ </xsl:when>
2190
+ <xsl:otherwise>
2191
+ <!-- itetation for:
2192
+ footnotes in bibdata/title
2193
+ footnotes in bibliography
2194
+ footnotes in document's body (except table's head/body/foot and figure text)
2195
+ -->
2196
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2197
+ <fn gen_id="{generate-id(.)}">
2198
+ <xsl:copy-of select="@*"/>
2199
+ <xsl:copy-of select="node()"/>
2200
+ </fn>
2201
+ </xsl:for-each>
2202
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
2203
+ <xsl:sort select="@displayorder" data-type="number"/>
2204
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
2205
+ <!-- copy unique fn -->
2206
+ <fn gen_id="{generate-id(.)}">
2207
+ <xsl:copy-of select="@*"/>
2208
+ <xsl:copy-of select="node()"/>
2209
+ </fn>
2210
+ </xsl:for-each>
2211
+ </xsl:for-each>
2212
+ </xsl:otherwise>
2213
+ </xsl:choose>
2214
+ </xsl:variable>
2215
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2216
+
2217
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2218
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2219
+ <xsl:variable name="reference" select="@reference"/>
2220
+ <!-- fn sequence number in document -->
2221
+ <xsl:variable name="current_fn_number">
2222
+ <xsl:choose>
2223
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2224
+ <xsl:otherwise>
2225
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2226
+ </xsl:otherwise>
2227
+ </xsl:choose>
2228
+ </xsl:variable>
2229
+ <xsl:variable name="current_fn_number_text">
2230
+ <xsl:value-of select="$current_fn_number"/>
2231
+
2232
+
2233
+ </xsl:variable>
2234
+
2235
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2236
+ <xsl:variable name="footnote_inline">
2237
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2238
+
2239
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2240
+ <xsl:value-of select="$current_fn_number_text"/>
2241
+ </fo:basic-link>
2242
+ </fo:inline>
2243
+ </xsl:variable>
2244
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2245
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2246
+ <xsl:choose>
2247
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2248
+ <xsl:copy-of select="$footnote_inline"/>
2249
+ </xsl:when>
2250
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2251
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2252
+ <xsl:copy-of select="$footnote_inline"/>
2253
+ <fo:footnote-body>
2254
+
2255
+ <fo:block-container text-indent="0" start-indent="0">
2256
+
2257
+
2258
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2259
+
2260
+
2261
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2262
+
2263
+ <xsl:value-of select="$current_fn_number_text"/>
2264
+ </fo:inline>
2265
+ <xsl:apply-templates/>
2266
+ </fo:block>
2267
+ </fo:block-container>
2268
+ </fo:footnote-body>
2269
+ </fo:footnote>
2270
+ </xsl:when>
2271
+ <xsl:otherwise>
2272
+ <xsl:copy-of select="$footnote_inline"/>
2273
+ </xsl:otherwise>
2274
+ </xsl:choose>
2258
2275
  </xsl:template><xsl:template name="fn_display">
2259
2276
  <xsl:variable name="references">
2260
2277
 
@@ -2445,6 +2462,8 @@
2445
2462
 
2446
2463
  </fo:basic-link>
2447
2464
  </fo:inline>
2465
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2466
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2448
2467
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2449
2468
  <fo:inline>
2450
2469
  <xsl:apply-templates/>
@@ -2493,12 +2512,9 @@
2493
2512
  <fo:block margin-bottom="12pt" text-align="left">
2494
2513
 
2495
2514
  <xsl:variable name="title-where">
2496
-
2497
-
2498
- <xsl:call-template name="getTitle">
2499
- <xsl:with-param name="name" select="'title-where'"/>
2500
- </xsl:call-template>
2501
-
2515
+ <xsl:call-template name="getLocalizedString">
2516
+ <xsl:with-param name="key">where</xsl:with-param>
2517
+ </xsl:call-template>
2502
2518
  </xsl:variable>
2503
2519
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2504
2520
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2514,12 +2530,9 @@
2514
2530
 
2515
2531
 
2516
2532
  <xsl:variable name="title-where">
2517
-
2518
-
2519
- <xsl:call-template name="getTitle">
2520
- <xsl:with-param name="name" select="'title-where'"/>
2521
- </xsl:call-template>
2522
-
2533
+ <xsl:call-template name="getLocalizedString">
2534
+ <xsl:with-param name="key">where</xsl:with-param>
2535
+ </xsl:call-template>
2523
2536
  </xsl:variable>
2524
2537
  <xsl:value-of select="$title-where"/>
2525
2538
  </fo:block>
@@ -2531,12 +2544,9 @@
2531
2544
 
2532
2545
 
2533
2546
  <xsl:variable name="title-key">
2534
-
2535
-
2536
- <xsl:call-template name="getTitle">
2537
- <xsl:with-param name="name" select="'title-key'"/>
2538
- </xsl:call-template>
2539
-
2547
+ <xsl:call-template name="getLocalizedString">
2548
+ <xsl:with-param name="key">key</xsl:with-param>
2549
+ </xsl:call-template>
2540
2550
  </xsl:variable>
2541
2551
  <xsl:value-of select="$title-key"/>
2542
2552
  </fo:block>
@@ -2802,6 +2812,7 @@
2802
2812
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2803
2813
  <xsl:apply-templates/>
2804
2814
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2815
+ <xsl:apply-templates select="@language"/>
2805
2816
  <xsl:apply-templates/>
2806
2817
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2807
2818
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -2863,6 +2874,15 @@
2863
2874
  </fo:inline>
2864
2875
  </xsl:template><xsl:template match="*[local-name()='add']">
2865
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>
2866
2886
  <xsl:when test="@amendment">
2867
2887
  <fo:inline>
2868
2888
  <xsl:call-template name="insertTag">
@@ -2897,7 +2917,6 @@
2897
2917
  </fo:inline>
2898
2918
  </xsl:otherwise>
2899
2919
  </xsl:choose>
2900
-
2901
2920
  </xsl:template><xsl:template name="insertTag">
2902
2921
  <xsl:param name="type"/>
2903
2922
  <xsl:param name="kind"/>
@@ -2913,14 +2932,14 @@
2913
2932
  <xsl:attribute name="scaling">uniform</xsl:attribute>
2914
2933
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2915
2934
  <g>
2916
- <xsl:if test="$type = 'closing'">
2935
+ <xsl:if test="$type = 'closing' or $type = 'end'">
2917
2936
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2918
2937
  </xsl:if>
2919
2938
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2920
2939
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2921
2940
  </g>
2922
2941
  <text font-family="Arial" x="15" y="57" font-size="40pt">
2923
- <xsl:if test="$type = 'closing'">
2942
+ <xsl:if test="$type = 'closing' or $type = 'end'">
2924
2943
  <xsl:attribute name="x">25</xsl:attribute>
2925
2944
  </xsl:if>
2926
2945
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3413,9 +3432,9 @@
3413
3432
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3414
3433
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3415
3434
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3416
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3435
+ <xsl:apply-templates select="*[local-name()='name']"/>
3417
3436
  </fo:block>
3418
- <xsl:apply-templates/>
3437
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3419
3438
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3420
3439
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3421
3440
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -3435,22 +3454,6 @@
3435
3454
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3436
3455
  <xsl:apply-templates/>
3437
3456
  </fo:inline>
3438
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3439
- <xsl:variable name="title-modified">
3440
-
3441
-
3442
- <xsl:call-template name="getTitle">
3443
- <xsl:with-param name="name" select="'title-modified'"/>
3444
- </xsl:call-template>
3445
-
3446
- </xsl:variable>
3447
-
3448
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3449
- <xsl:choose>
3450
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3451
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3452
- </xsl:choose>
3453
- <xsl:apply-templates/>
3454
3457
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3455
3458
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3456
3459
 
@@ -4015,20 +4018,67 @@
4015
4018
  </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4016
4019
  <xsl:apply-templates mode="contents"/>
4017
4020
  <xsl:text> </xsl:text>
4018
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
4021
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
4019
4022
  <xsl:apply-templates mode="bookmarks"/>
4020
4023
  <xsl:text> </xsl:text>
4021
4024
  </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
4022
4025
  <xsl:value-of select="."/>
4023
- </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
4026
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
4024
4027
  <xsl:value-of select="."/>
4025
4028
  </xsl:template><xsl:template match="node()" mode="contents">
4026
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>
4027
4077
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4028
4078
  <xsl:apply-templates mode="bookmarks"/>
4029
4079
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4030
4080
  <xsl:apply-templates select="."/>
4031
- </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">
4032
4082
  <xsl:apply-templates mode="bookmarks"/>
4033
4083
  </xsl:template><xsl:template name="addBookmarks">
4034
4084
  <xsl:param name="contents"/>
@@ -4199,7 +4249,10 @@
4199
4249
  </fo:block>
4200
4250
  </xsl:if>
4201
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">
4202
- <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>
4203
4256
  <!-- <xsl:text> </xsl:text> -->
4204
4257
  </xsl:template><xsl:template name="getSection">
4205
4258
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4272,6 +4325,18 @@
4272
4325
  <xsl:copy-of select="."/>
4273
4326
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4274
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>
4275
4340
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4276
4341
 
4277
4342
  <fo:block-container margin-left="0mm">
@@ -4290,6 +4355,8 @@
4290
4355
 
4291
4356
 
4292
4357
 
4358
+
4359
+
4293
4360
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4294
4361
  <xsl:variable name="_font-size">
4295
4362
 
@@ -4323,13 +4390,17 @@
4323
4390
 
4324
4391
 
4325
4392
 
4393
+
4394
+
4326
4395
  <xsl:apply-templates/>
4327
4396
  </fo:block>
4328
-
4397
+
4329
4398
 
4330
4399
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4331
4400
 
4332
4401
 
4402
+
4403
+
4333
4404
  </fo:block-container>
4334
4405
  </fo:block-container>
4335
4406
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4602,42 +4673,48 @@
4602
4673
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4603
4674
 
4604
4675
 
4605
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4606
-
4607
- <xsl:variable name="element">
4676
+ <xsl:variable name="fo_element">
4677
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4608
4678
  block
4609
4679
 
4610
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4680
+
4611
4681
  </xsl:variable>
4612
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
+
4613
4688
  <xsl:choose>
4614
- <xsl:when test="contains(normalize-space($element), 'block')">
4615
- <fo:block xsl:use-attribute-sets="example-body-style">
4616
- <xsl:apply-templates/>
4617
- </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>
4618
4697
  </xsl:when>
4619
4698
  <xsl:otherwise>
4620
4699
  <fo:inline>
4621
- <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>
4622
4703
  </fo:inline>
4623
4704
  </xsl:otherwise>
4624
4705
  </xsl:choose>
4625
4706
 
4626
4707
  </fo:block>
4627
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4628
-
4629
- <xsl:variable name="element">
4630
- block
4631
-
4632
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4633
- </xsl:variable>
4708
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4709
+ <xsl:param name="fo_element">block</xsl:param>
4710
+
4634
4711
  <xsl:choose>
4635
4712
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4636
4713
  <fo:inline>
4637
4714
  <xsl:apply-templates/>
4638
4715
  </fo:inline>
4639
4716
  </xsl:when>
4640
- <xsl:when test="contains(normalize-space($element), 'block')">
4717
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4641
4718
  <fo:block xsl:use-attribute-sets="example-name-style">
4642
4719
  <xsl:apply-templates/>
4643
4720
  </fo:block>
@@ -4650,14 +4727,15 @@
4650
4727
  </xsl:choose>
4651
4728
 
4652
4729
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4730
+ <xsl:param name="fo_element">block</xsl:param>
4731
+
4653
4732
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4654
4733
  <xsl:variable name="element">
4655
- block
4656
-
4657
4734
 
4735
+ <xsl:value-of select="$fo_element"/>
4658
4736
  </xsl:variable>
4659
4737
  <xsl:choose>
4660
- <xsl:when test="normalize-space($element) = 'block'">
4738
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4661
4739
  <fo:block xsl:use-attribute-sets="example-p-style">
4662
4740
 
4663
4741
  <xsl:apply-templates/>
@@ -4676,58 +4754,66 @@
4676
4754
  <xsl:variable name="termsource_text">
4677
4755
  <xsl:apply-templates/>
4678
4756
  </xsl:variable>
4679
-
4680
- <xsl:choose>
4757
+ <xsl:copy-of select="$termsource_text"/>
4758
+ <!-- <xsl:choose>
4681
4759
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4682
- <!-- <xsl:apply-templates /> -->
4683
4760
  <xsl:copy-of select="$termsource_text"/>
4684
4761
  </xsl:when>
4685
4762
  <xsl:otherwise>
4686
-
4687
-
4688
- <!-- <xsl:apply-templates /> -->
4763
+ <xsl:if test="$namespace = 'bsi'">
4764
+ <xsl:choose>
4765
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
4766
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
4767
+ </xsl:choose>
4768
+ </xsl:if>
4769
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
4770
+ <xsl:text>[</xsl:text>
4771
+ </xsl:if>
4689
4772
  <xsl:copy-of select="$termsource_text"/>
4690
-
4691
-
4773
+ <xsl:if test="$namespace = 'bsi'">
4774
+ <xsl:choose>
4775
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
4776
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
4777
+ </xsl:choose>
4778
+ </xsl:if>
4779
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
4780
+ <xsl:text>]</xsl:text>
4781
+ </xsl:if>
4692
4782
  </xsl:otherwise>
4693
- </xsl:choose>
4783
+ </xsl:choose> -->
4694
4784
  </fo:block>
4695
4785
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4696
4786
  <xsl:if test="normalize-space() != ''">
4697
4787
  <xsl:value-of select="."/>
4698
4788
  </xsl:if>
4699
- </xsl:template><xsl:variable name="localized.source">
4700
- <xsl:call-template name="getLocalizedString">
4701
- <xsl:with-param name="key">source</xsl:with-param>
4702
- </xsl:call-template>
4703
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4789
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
4790
+ <fo:inline>
4791
+
4792
+
4793
+ <xsl:value-of select="."/>
4794
+ </fo:inline>
4795
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
4704
4796
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4705
4797
  <xsl:if test="normalize-space(@citeas) = ''">
4706
4798
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4707
4799
  </xsl:if>
4708
-
4709
-
4710
- <fo:inline>
4711
-
4712
-
4713
-
4714
-
4715
-
4716
-
4717
-
4718
- <xsl:call-template name="getTitle">
4719
- <xsl:with-param name="name" select="'title-source'"/>
4720
- </xsl:call-template>
4721
- <xsl:text>: </xsl:text>
4722
-
4723
-
4724
- </fo:inline>
4725
-
4726
4800
  <fo:inline xsl:use-attribute-sets="origin-style">
4727
4801
  <xsl:apply-templates/>
4728
4802
  </fo:inline>
4729
-
4730
- </fo:basic-link>
4803
+ </fo:basic-link>
4804
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4805
+ <xsl:variable name="title-modified">
4806
+ <xsl:call-template name="getLocalizedString">
4807
+ <xsl:with-param name="key">modified</xsl:with-param>
4808
+ </xsl:call-template>
4809
+ </xsl:variable>
4810
+
4811
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4812
+ <xsl:choose>
4813
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4814
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4815
+ </xsl:choose>
4816
+ <xsl:apply-templates/>
4731
4817
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4732
4818
  <fo:inline><xsl:apply-templates/></fo:inline>
4733
4819
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -4906,25 +4992,29 @@
4906
4992
  </fo:block>
4907
4993
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4908
4994
  <xsl:variable name="title-deprecated">
4909
-
4910
-
4911
- <xsl:call-template name="getTitle">
4912
- <xsl:with-param name="name" select="'title-deprecated'"/>
4913
- </xsl:call-template>
4914
-
4995
+ <xsl:call-template name="getLocalizedString">
4996
+ <xsl:with-param name="key">deprecated</xsl:with-param>
4997
+ </xsl:call-template>
4915
4998
  </xsl:variable>
4916
4999
  <fo:block xsl:use-attribute-sets="deprecates-style">
4917
5000
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
4918
5001
  </fo:block>
5002
+ </xsl:template><xsl:template name="setStyle_preferred">
5003
+ <xsl:if test="*[local-name() = 'strong']">
5004
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
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)"/>
4919
5008
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
4920
5009
  <fo:block xsl:use-attribute-sets="definition-style">
4921
5010
  <xsl:apply-templates/>
4922
5011
  </fo:block>
4923
5012
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
4924
5013
  <xsl:apply-templates/>
4925
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5014
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
4926
5015
  <fo:inline> <xsl:apply-templates/></fo:inline>
4927
- <fo:block> </fo:block>
5016
+ <!-- <fo:block>&#xA0;</fo:block> -->
5017
+ <fo:block/>
4928
5018
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
4929
5019
 
4930
5020
  <fo:block>
@@ -4980,6 +5070,51 @@
4980
5070
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
4981
5071
  <!-- 0xA0 to space replacement -->
4982
5072
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5073
+ </xsl:template><xsl:variable name="ul_labels_">
5074
+
5075
+
5076
+
5077
+
5078
+
5079
+
5080
+
5081
+
5082
+
5083
+
5084
+ <label>—</label> <!-- em dash -->
5085
+
5086
+
5087
+
5088
+
5089
+
5090
+
5091
+
5092
+
5093
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5094
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5095
+ <xsl:variable name="list_level">
5096
+ <xsl:choose>
5097
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
5098
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
5099
+ </xsl:choose>
5100
+ </xsl:variable>
5101
+ <xsl:choose>
5102
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
5103
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
5104
+ </xsl:when>
5105
+ <xsl:when test="$list_level mod 3 = 0">
5106
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
5107
+ </xsl:when>
5108
+ <xsl:when test="$list_level mod 2 = 0">
5109
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
5110
+ </xsl:when>
5111
+ <xsl:otherwise>
5112
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
5113
+ </xsl:otherwise>
5114
+ </xsl:choose>
5115
+ </xsl:template><xsl:template match="label" mode="ul_labels">
5116
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5117
+ <xsl:value-of select="."/>
4983
5118
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4984
5119
  <xsl:choose>
4985
5120
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5190,16 +5325,50 @@
5190
5325
 
5191
5326
 
5192
5327
 
5193
-
5328
+
5329
+
5330
+
5331
+
5332
+
5333
+
5194
5334
 
5195
5335
 
5196
5336
 
5197
5337
 
5198
5338
 
5339
+
5340
+
5341
+
5199
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
+
5367
+
5368
+
5200
5369
 
5201
5370
  </xsl:template><xsl:template name="processBibitemDocId">
5202
- <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')]"/>
5203
5372
  <xsl:choose>
5204
5373
  <xsl:when test="normalize-space($_doc_ident) != ''">
5205
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"/>
@@ -5213,7 +5382,7 @@
5213
5382
  <xsl:if test="$type != ''">
5214
5383
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5215
5384
  </xsl:if> -->
5216
- <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')]"/>
5217
5386
  </xsl:otherwise>
5218
5387
  </xsl:choose>
5219
5388
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5318,7 +5487,35 @@
5318
5487
  <fo:block-container border="1pt solid black" width="50%">
5319
5488
  <fo:block> </fo:block>
5320
5489
  </fo:block-container>
5321
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
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 -->
5494
+ <xsl:choose>
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 -->
5497
+ <xsl:otherwise><!-- default value -->
5498
+
5499
+
5500
+
5501
+
5502
+
5503
+
5504
+
5505
+
5506
+
5507
+
5508
+ 2
5509
+
5510
+
5511
+
5512
+
5513
+
5514
+
5515
+
5516
+ </xsl:otherwise>
5517
+ </xsl:choose>
5518
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5322
5519
  <xsl:param name="colwidths"/>
5323
5520
  <xsl:variable name="colwidths_">
5324
5521
  <xsl:choose>
@@ -5398,7 +5595,7 @@
5398
5595
  </td>
5399
5596
  </xsl:for-each>
5400
5597
  <td>333</td> <!-- page number, just for fill -->
5401
- </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">
5402
5599
  <fo:inline padding-right="5mm"> </fo:inline>
5403
5600
  <fo:inline><xsl:apply-templates/></fo:inline>
5404
5601
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -5409,6 +5606,10 @@
5409
5606
  </svg>
5410
5607
  </fo:instream-foreign-object>
5411
5608
  </fo:inline>
5609
+ </xsl:template><xsl:template match="@language">
5610
+ <xsl:copy-of select="."/>
5611
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
5612
+ <xsl:call-template name="title"/>
5412
5613
  </xsl:template><xsl:template name="convertDate">
5413
5614
  <xsl:param name="date"/>
5414
5615
  <xsl:param name="format" select="'short'"/>
@@ -5759,9 +5960,15 @@
5759
5960
  </xsl:template><xsl:template name="getLocalizedString">
5760
5961
  <xsl:param name="key"/>
5761
5962
  <xsl:param name="formatted">false</xsl:param>
5963
+ <xsl:param name="lang"/>
5762
5964
 
5763
5965
  <xsl:variable name="curr_lang">
5764
- <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>
5765
5972
  </xsl:variable>
5766
5973
 
5767
5974
  <xsl:variable name="data_value">
@@ -5951,4 +6158,14 @@
5951
6158
  </xsl:otherwise>
5952
6159
  </xsl:choose>
5953
6160
  </xsl:if>
6161
+ </xsl:template><xsl:template name="setAltText">
6162
+ <xsl:param name="value"/>
6163
+ <xsl:attribute name="fox:alt-text">
6164
+ <xsl:choose>
6165
+ <xsl:when test="normalize-space($value) != ''">
6166
+ <xsl:value-of select="$value"/>
6167
+ </xsl:when>
6168
+ <xsl:otherwise>_</xsl:otherwise>
6169
+ </xsl:choose>
6170
+ </xsl:attribute>
5954
6171
  </xsl:template></xsl:stylesheet>