metanorma-m3aawg 1.8.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- <xsl:key name="kfn" match="m3d:p/m3d:fn" use="@reference"/>
12
+ <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"/>
13
13
 
14
14
 
15
15
 
@@ -363,7 +363,7 @@
363
363
  <xsl:choose>
364
364
  <xsl:when test="ancestor-or-self::m3d:preface and $level &gt;= 2">false</xsl:when>
365
365
  <xsl:when test="ancestor::m3d:annex and $level &gt;= 3">false</xsl:when>
366
- <xsl:when test="$level &lt;= 3">true</xsl:when>
366
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
367
367
  <xsl:otherwise>false</xsl:otherwise>
368
368
  </xsl:choose>
369
369
  </xsl:variable>
@@ -403,7 +403,9 @@
403
403
 
404
404
  <xsl:template name="getListItemFormat">
405
405
  <xsl:choose>
406
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
406
+ <xsl:when test="local-name(..) = 'ul'">
407
+ <xsl:call-template name="setULLabel"/>
408
+ </xsl:when>
407
409
  <xsl:otherwise> <!-- for ordered lists -->
408
410
  <xsl:choose>
409
411
  <xsl:when test="../@type = 'arabic'">
@@ -473,7 +475,7 @@
473
475
  </xsl:template>
474
476
 
475
477
 
476
- <xsl:template match="m3d:title">
478
+ <xsl:template match="m3d:title" name="title">
477
479
 
478
480
  <xsl:variable name="level">
479
481
  <xsl:call-template name="getLevel"/>
@@ -586,86 +588,14 @@
586
588
 
587
589
  </xsl:template>
588
590
 
589
- <!--
590
- <fn reference="1">
591
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
592
- </fn>
593
- -->
594
-
595
- <xsl:variable name="p_fn">
596
- <xsl:for-each select="//m3d:p/m3d:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
597
- <!-- copy unique fn -->
598
- <fn gen_id="{generate-id(.)}">
599
- <xsl:copy-of select="@*"/>
600
- <xsl:copy-of select="node()"/>
601
- </fn>
602
- </xsl:for-each>
603
- </xsl:variable>
604
-
605
- <xsl:template match="m3d:p/m3d:fn" priority="2">
606
- <xsl:variable name="gen_id" select="generate-id(.)"/>
607
- <xsl:variable name="reference" select="@reference"/>
608
- <xsl:variable name="number">
609
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
610
- </xsl:variable>
611
- <xsl:choose>
612
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
613
- <fo:footnote>
614
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
615
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
616
- <!-- <xsl:value-of select="@reference"/> -->
617
- <xsl:value-of select="$number + count(//m3d:bibitem[ancestor::m3d:references[@normative='true' or not(preceding-sibling::m3d:references)]]/m3d:note)"/>
618
- </fo:basic-link>
619
- </fo:inline>
620
- <fo:footnote-body>
621
- <fo:block font-size="9pt" margin-bottom="12pt">
622
- <fo:inline font-size="6pt" id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm">
623
- <xsl:value-of select="$number + count(//m3d:bibitem[ancestor::m3d:references[@normative='true' or not(preceding-sibling::m3d:references)]]/m3d:note)"/>
624
- </fo:inline>
625
- <xsl:for-each select="m3d:p">
626
- <xsl:apply-templates/>
627
- </xsl:for-each>
628
- </fo:block>
629
- </fo:footnote-body>
630
- </fo:footnote>
631
- </xsl:when>
632
- <xsl:otherwise>
633
- <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
634
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
635
- <xsl:value-of select="$number + count(//m3d:bibitem/m3d:note)"/>
636
- </fo:basic-link>
637
- </fo:inline>
638
- </xsl:otherwise>
639
- </xsl:choose>
640
- </xsl:template>
641
-
642
591
  <xsl:template match="m3d:p/m3d:fn/m3d:p">
643
592
  <xsl:apply-templates/>
644
593
  </xsl:template>
645
594
 
646
595
 
647
-
648
596
  <xsl:template match="m3d:bibitem">
649
597
  <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
650
- <!-- m3d:docidentifier -->
651
- <xsl:if test="m3d:docidentifier">
652
- <xsl:choose>
653
- <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
654
- <xsl:otherwise><fo:inline><xsl:value-of select="m3d:docidentifier"/></fo:inline></xsl:otherwise>
655
- </xsl:choose>
656
- </xsl:if>
657
- <xsl:apply-templates select="m3d:note"/>
658
- <xsl:if test="m3d:docidentifier">, </xsl:if>
659
- <fo:inline font-style="italic">
660
- <xsl:choose>
661
- <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
662
- <xsl:value-of select="m3d:title[@type = 'main' and @language = 'en']"/>
663
- </xsl:when>
664
- <xsl:otherwise>
665
- <xsl:value-of select="m3d:title"/>
666
- </xsl:otherwise>
667
- </xsl:choose>
668
- </fo:inline>
598
+ <xsl:call-template name="processBibitem"/>
669
599
  </fo:block>
670
600
  </xsl:template>
671
601
 
@@ -715,10 +645,6 @@
715
645
  <fo:list-item id="{@id}">
716
646
  <fo:list-item-label end-indent="label-end()">
717
647
  <fo:block>
718
- <xsl:if test="local-name(..) = 'ul'">
719
- <xsl:attribute name="font-size">18pt</xsl:attribute>
720
- <xsl:attribute name="margin-top">-0.5mm</xsl:attribute><!-- to vertical align big dot -->
721
- </xsl:if>
722
648
  <xsl:call-template name="getListItemFormat"/>
723
649
  </fo:block>
724
650
  </fo:list-item-label>
@@ -738,6 +664,7 @@
738
664
  <xsl:template match="m3d:preferred">
739
665
 
740
666
  <fo:inline>
667
+ <xsl:call-template name="setStyle_preferred"/>
741
668
  <xsl:apply-templates/>
742
669
  </fo:inline>
743
670
 
@@ -790,50 +717,30 @@
790
717
  <fo:list-item-label end-indent="label-end()">
791
718
  <fo:block>
792
719
  <fo:inline id="{@id}">
793
- <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>
794
724
  </fo:inline>
795
725
  </fo:block>
796
726
  </fo:list-item-label>
797
727
  <fo:list-item-body start-indent="body-start()">
798
728
  <fo:block text-align="justify">
799
- <xsl:variable name="docidentifier">
800
- <xsl:if test="m3d:docidentifier">
801
- <xsl:choose>
802
- <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
803
- <xsl:otherwise><xsl:value-of select="m3d:docidentifier"/></xsl:otherwise>
804
- </xsl:choose>
805
- </xsl:if>
806
- </xsl:variable>
807
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
808
- <xsl:apply-templates select="m3d:note"/>
809
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
810
- <xsl:choose>
811
- <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
812
- <xsl:apply-templates select="m3d:title[@type = 'main' and @language = 'en']"/>
813
- </xsl:when>
814
- <xsl:otherwise>
815
- <xsl:apply-templates select="m3d:title"/>
816
- </xsl:otherwise>
817
- </xsl:choose>
818
- <xsl:apply-templates select="m3d:formattedref"/>
729
+ <xsl:call-template name="processBibitem"/>
819
730
  </fo:block>
820
731
  </fo:list-item-body>
821
732
  </fo:list-item>
822
733
  </fo:list-block>
823
734
  </xsl:template>
824
735
 
825
- <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem" mode="contents"/> -->
826
- <xsl:template match="m3d:references[not(@normative='true')]/m3d:bibitem" mode="contents"/>
827
736
 
828
737
  <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem/m3d:title"> -->
829
- <xsl:template match="m3d:references[not(@normative='true')]/m3d:bibitem/m3d:title">
738
+ <xsl:template match="m3d:references/m3d:bibitem/m3d:title">
830
739
  <fo:inline font-style="italic">
831
740
  <xsl:apply-templates/>
832
741
  </fo:inline>
833
742
  </xsl:template>
834
743
 
835
-
836
-
837
744
 
838
745
  <xsl:template match="mathml:math" priority="2">
839
746
  <fo:inline font-family="Cambria Math">
@@ -903,13 +810,6 @@
903
810
 
904
811
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
905
812
 
906
- <title-annex lang="en">Annex </title-annex>
907
- <title-annex lang="fr">Annexe </title-annex>
908
-
909
- <title-annex lang="zh">Annex </title-annex>
910
-
911
-
912
-
913
813
  <title-edition lang="en">
914
814
 
915
815
 
@@ -923,7 +823,8 @@
923
823
 
924
824
  </title-edition>
925
825
 
926
-
826
+
827
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
927
828
  <title-toc lang="en">
928
829
 
929
830
 
@@ -935,21 +836,11 @@
935
836
 
936
837
  <xsl:text>Sommaire</xsl:text>
937
838
 
938
-
939
- </title-toc>
839
+ </title-toc>
940
840
 
941
841
  <title-toc lang="zh">Contents</title-toc>
942
842
 
943
843
 
944
-
945
- <title-page lang="en">Page</title-page>
946
- <title-page lang="fr">Page</title-page>
947
-
948
- <title-key lang="en">Key</title-key>
949
- <title-key lang="fr">Légende</title-key>
950
-
951
- <title-where lang="en">where</title-where>
952
- <title-where lang="fr">où</title-where>
953
844
 
954
845
  <title-descriptors lang="en">Descriptors</title-descriptors>
955
846
 
@@ -972,25 +863,6 @@
972
863
 
973
864
  </title-subpart>
974
865
 
975
- <title-modified lang="en">modified</title-modified>
976
- <title-modified lang="fr">modifiée</title-modified>
977
-
978
- <title-modified lang="zh">modified</title-modified>
979
-
980
-
981
-
982
- <title-source lang="en">
983
-
984
- <xsl:text>SOURCE</xsl:text>
985
-
986
-
987
- </title-source>
988
-
989
- <title-keywords lang="en">Keywords</title-keywords>
990
-
991
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
992
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
993
-
994
866
  <title-list-tables lang="en">List of Tables</title-list-tables>
995
867
 
996
868
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -999,37 +871,8 @@
999
871
 
1000
872
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
1001
873
 
1002
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1003
-
1004
- <title-abstract lang="en">Abstract</title-abstract>
1005
-
1006
874
  <title-summary lang="en">Summary</title-summary>
1007
875
 
1008
- <title-in lang="en">in </title-in>
1009
-
1010
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1011
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1012
-
1013
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1014
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1015
-
1016
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1017
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
1018
-
1019
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1020
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
1021
-
1022
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1023
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1024
-
1025
- <title-caution lang="en">CAUTION</title-caution>
1026
- <title-caution lang="zh">注意</title-caution>
1027
-
1028
- <title-warning lang="en">WARNING</title-warning>
1029
- <title-warning lang="zh">警告</title-warning>
1030
-
1031
- <title-amendment lang="en">AMENDMENT</title-amendment>
1032
-
1033
876
  <title-continued lang="en">(continued)</title-continued>
1034
877
  <title-continued lang="fr">(continué)</title-continued>
1035
878
 
@@ -1133,6 +976,7 @@
1133
976
 
1134
977
 
1135
978
 
979
+
1136
980
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1137
981
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1138
982
 
@@ -1146,7 +990,9 @@
1146
990
 
1147
991
 
1148
992
 
993
+
1149
994
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
995
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1150
996
 
1151
997
 
1152
998
 
@@ -1175,6 +1021,7 @@
1175
1021
 
1176
1022
 
1177
1023
 
1024
+
1178
1025
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1179
1026
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1180
1027
 
@@ -1454,7 +1301,79 @@
1454
1301
 
1455
1302
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1456
1303
  <xsl:attribute name="line-height">135%</xsl:attribute>
1457
- </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">
1304
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1305
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1306
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1307
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+
1318
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
1319
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1328
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1329
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1330
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1331
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1343
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1354
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+
1361
+
1362
+
1363
+
1364
+
1365
+ <xsl:attribute name="font-size">6pt</xsl:attribute>
1366
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1367
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1368
+
1369
+
1370
+
1371
+
1372
+
1373
+
1374
+
1375
+
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">
1458
1377
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1459
1378
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1460
1379
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1479,7 +1398,8 @@
1479
1398
  <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"/>
1480
1399
 
1481
1400
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1482
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1401
+
1402
+ <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']]">
1483
1403
  <xsl:sort select="@displayorder" data-type="number"/>
1484
1404
  <xsl:apply-templates select="." mode="contents"/>
1485
1405
  </xsl:for-each>
@@ -1489,7 +1409,7 @@
1489
1409
  <xsl:apply-templates select="." mode="contents"/>
1490
1410
  </xsl:for-each>
1491
1411
 
1492
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1412
+ <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')]]">
1493
1413
  <xsl:sort select="@displayorder" data-type="number"/>
1494
1414
  <xsl:apply-templates select="." mode="contents"/>
1495
1415
  </xsl:for-each>
@@ -2393,6 +2313,102 @@
2393
2313
 
2394
2314
  </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">
2395
2315
  <xsl:apply-templates/>
2316
+ </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">
2317
+
2318
+ <!-- list of footnotes to calculate actual footnotes number -->
2319
+ <xsl:variable name="p_fn_">
2320
+ <xsl:choose>
2321
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2322
+ <fn gen_id="{generate-id(.)}">
2323
+ <xsl:copy-of select="@*"/>
2324
+ <xsl:copy-of select="node()"/>
2325
+ </fn>
2326
+ </xsl:when>
2327
+ <xsl:otherwise>
2328
+ <!-- itetation for:
2329
+ footnotes in bibdata/title
2330
+ footnotes in bibliography
2331
+ footnotes in document's body (except table's head/body/foot and figure text)
2332
+ -->
2333
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2334
+ <fn gen_id="{generate-id(.)}">
2335
+ <xsl:copy-of select="@*"/>
2336
+ <xsl:copy-of select="node()"/>
2337
+ </fn>
2338
+ </xsl:for-each>
2339
+ <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']/*">
2340
+ <xsl:sort select="@displayorder" data-type="number"/>
2341
+ <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])]">
2342
+ <!-- copy unique fn -->
2343
+ <fn gen_id="{generate-id(.)}">
2344
+ <xsl:copy-of select="@*"/>
2345
+ <xsl:copy-of select="node()"/>
2346
+ </fn>
2347
+ </xsl:for-each>
2348
+ </xsl:for-each>
2349
+ </xsl:otherwise>
2350
+ </xsl:choose>
2351
+ </xsl:variable>
2352
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2353
+
2354
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2355
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2356
+ <xsl:variable name="reference" select="@reference"/>
2357
+ <!-- fn sequence number in document -->
2358
+ <xsl:variable name="current_fn_number">
2359
+ <xsl:choose>
2360
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2361
+ <xsl:otherwise>
2362
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2363
+ </xsl:otherwise>
2364
+ </xsl:choose>
2365
+ </xsl:variable>
2366
+ <xsl:variable name="current_fn_number_text">
2367
+ <xsl:value-of select="$current_fn_number"/>
2368
+
2369
+
2370
+ </xsl:variable>
2371
+
2372
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2373
+ <xsl:variable name="footnote_inline">
2374
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2375
+
2376
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2377
+ <xsl:value-of select="$current_fn_number_text"/>
2378
+ </fo:basic-link>
2379
+ </fo:inline>
2380
+ </xsl:variable>
2381
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2382
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2383
+ <xsl:choose>
2384
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2385
+ <xsl:copy-of select="$footnote_inline"/>
2386
+ </xsl:when>
2387
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2388
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2389
+ <xsl:copy-of select="$footnote_inline"/>
2390
+ <fo:footnote-body>
2391
+
2392
+ <fo:block-container text-indent="0" start-indent="0">
2393
+
2394
+
2395
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2396
+
2397
+
2398
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2399
+
2400
+ <xsl:value-of select="$current_fn_number_text"/>
2401
+ </fo:inline>
2402
+ <xsl:apply-templates/>
2403
+ </fo:block>
2404
+ </fo:block-container>
2405
+ </fo:footnote-body>
2406
+ </fo:footnote>
2407
+ </xsl:when>
2408
+ <xsl:otherwise>
2409
+ <xsl:copy-of select="$footnote_inline"/>
2410
+ </xsl:otherwise>
2411
+ </xsl:choose>
2396
2412
  </xsl:template><xsl:template name="fn_display">
2397
2413
  <xsl:variable name="references">
2398
2414
 
@@ -2585,6 +2601,8 @@
2585
2601
 
2586
2602
  </fo:basic-link>
2587
2603
  </fo:inline>
2604
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2605
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2588
2606
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2589
2607
  <fo:inline>
2590
2608
  <xsl:apply-templates/>
@@ -2633,12 +2651,9 @@
2633
2651
  <fo:block margin-bottom="12pt" text-align="left">
2634
2652
 
2635
2653
  <xsl:variable name="title-where">
2636
-
2637
-
2638
- <xsl:call-template name="getTitle">
2639
- <xsl:with-param name="name" select="'title-where'"/>
2640
- </xsl:call-template>
2641
-
2654
+ <xsl:call-template name="getLocalizedString">
2655
+ <xsl:with-param name="key">where</xsl:with-param>
2656
+ </xsl:call-template>
2642
2657
  </xsl:variable>
2643
2658
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2644
2659
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2654,12 +2669,9 @@
2654
2669
 
2655
2670
 
2656
2671
  <xsl:variable name="title-where">
2657
-
2658
-
2659
- <xsl:call-template name="getTitle">
2660
- <xsl:with-param name="name" select="'title-where'"/>
2661
- </xsl:call-template>
2662
-
2672
+ <xsl:call-template name="getLocalizedString">
2673
+ <xsl:with-param name="key">where</xsl:with-param>
2674
+ </xsl:call-template>
2663
2675
  </xsl:variable>
2664
2676
  <xsl:value-of select="$title-where"/>
2665
2677
  </fo:block>
@@ -2671,12 +2683,9 @@
2671
2683
 
2672
2684
 
2673
2685
  <xsl:variable name="title-key">
2674
-
2675
-
2676
- <xsl:call-template name="getTitle">
2677
- <xsl:with-param name="name" select="'title-key'"/>
2678
- </xsl:call-template>
2679
-
2686
+ <xsl:call-template name="getLocalizedString">
2687
+ <xsl:with-param name="key">key</xsl:with-param>
2688
+ </xsl:call-template>
2680
2689
  </xsl:variable>
2681
2690
  <xsl:value-of select="$title-key"/>
2682
2691
  </fo:block>
@@ -2942,6 +2951,7 @@
2942
2951
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2943
2952
  <xsl:apply-templates/>
2944
2953
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2954
+ <xsl:apply-templates select="@language"/>
2945
2955
  <xsl:apply-templates/>
2946
2956
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2947
2957
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -3008,6 +3018,15 @@
3008
3018
  </fo:inline>
3009
3019
  </xsl:template><xsl:template match="*[local-name()='add']">
3010
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>
3011
3030
  <xsl:when test="@amendment">
3012
3031
  <fo:inline>
3013
3032
  <xsl:call-template name="insertTag">
@@ -3042,7 +3061,6 @@
3042
3061
  </fo:inline>
3043
3062
  </xsl:otherwise>
3044
3063
  </xsl:choose>
3045
-
3046
3064
  </xsl:template><xsl:template name="insertTag">
3047
3065
  <xsl:param name="type"/>
3048
3066
  <xsl:param name="kind"/>
@@ -3058,14 +3076,14 @@
3058
3076
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3059
3077
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3060
3078
  <g>
3061
- <xsl:if test="$type = 'closing'">
3079
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3062
3080
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3063
3081
  </xsl:if>
3064
3082
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3065
3083
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3066
3084
  </g>
3067
3085
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3068
- <xsl:if test="$type = 'closing'">
3086
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3069
3087
  <xsl:attribute name="x">25</xsl:attribute>
3070
3088
  </xsl:if>
3071
3089
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3558,9 +3576,9 @@
3558
3576
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3559
3577
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3560
3578
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3561
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3579
+ <xsl:apply-templates select="*[local-name()='name']"/>
3562
3580
  </fo:block>
3563
- <xsl:apply-templates/>
3581
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3564
3582
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3565
3583
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3566
3584
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -3580,22 +3598,6 @@
3580
3598
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3581
3599
  <xsl:apply-templates/>
3582
3600
  </fo:inline>
3583
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3584
- <xsl:variable name="title-modified">
3585
-
3586
-
3587
- <xsl:call-template name="getTitle">
3588
- <xsl:with-param name="name" select="'title-modified'"/>
3589
- </xsl:call-template>
3590
-
3591
- </xsl:variable>
3592
-
3593
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3594
- <xsl:choose>
3595
- <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>
3596
- <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>
3597
- </xsl:choose>
3598
- <xsl:apply-templates/>
3599
3601
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3600
3602
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3601
3603
 
@@ -4166,20 +4168,67 @@
4166
4168
  </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">
4167
4169
  <xsl:apply-templates mode="contents"/>
4168
4170
  <xsl:text> </xsl:text>
4169
- </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">
4171
+ </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">
4170
4172
  <xsl:apply-templates mode="bookmarks"/>
4171
4173
  <xsl:text> </xsl:text>
4172
4174
  </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">
4173
4175
  <xsl:value-of select="."/>
4174
- </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">
4176
+ </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">
4175
4177
  <xsl:value-of select="."/>
4176
4178
  </xsl:template><xsl:template match="node()" mode="contents">
4177
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>
4178
4227
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4179
4228
  <xsl:apply-templates mode="bookmarks"/>
4180
4229
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4181
4230
  <xsl:apply-templates select="."/>
4182
- </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">
4183
4232
  <xsl:apply-templates mode="bookmarks"/>
4184
4233
  </xsl:template><xsl:template name="addBookmarks">
4185
4234
  <xsl:param name="contents"/>
@@ -4350,7 +4399,10 @@
4350
4399
  </fo:block>
4351
4400
  </xsl:if>
4352
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">
4353
- <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>
4354
4406
  <!-- <xsl:text> </xsl:text> -->
4355
4407
  </xsl:template><xsl:template name="getSection">
4356
4408
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4423,6 +4475,18 @@
4423
4475
  <xsl:copy-of select="."/>
4424
4476
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4425
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>
4426
4490
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4427
4491
 
4428
4492
  <fo:block-container margin-left="0mm">
@@ -4441,6 +4505,8 @@
4441
4505
 
4442
4506
 
4443
4507
 
4508
+
4509
+
4444
4510
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4445
4511
  <xsl:variable name="_font-size">
4446
4512
 
@@ -4474,13 +4540,17 @@
4474
4540
 
4475
4541
 
4476
4542
 
4543
+
4544
+
4477
4545
  <xsl:apply-templates/>
4478
4546
  </fo:block>
4479
-
4547
+
4480
4548
 
4481
4549
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4482
4550
 
4483
4551
 
4552
+
4553
+
4484
4554
  </fo:block-container>
4485
4555
  </fo:block-container>
4486
4556
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4753,42 +4823,48 @@
4753
4823
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4754
4824
 
4755
4825
 
4756
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4757
-
4758
- <xsl:variable name="element">
4826
+ <xsl:variable name="fo_element">
4827
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4759
4828
 
4760
4829
  inline
4761
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4830
+
4762
4831
  </xsl:variable>
4763
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
+
4764
4838
  <xsl:choose>
4765
- <xsl:when test="contains(normalize-space($element), 'block')">
4766
- <fo:block xsl:use-attribute-sets="example-body-style">
4767
- <xsl:apply-templates/>
4768
- </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>
4769
4847
  </xsl:when>
4770
4848
  <xsl:otherwise>
4771
4849
  <fo:inline>
4772
- <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>
4773
4853
  </fo:inline>
4774
4854
  </xsl:otherwise>
4775
4855
  </xsl:choose>
4776
4856
 
4777
4857
  </fo:block>
4778
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4779
-
4780
- <xsl:variable name="element">
4781
-
4782
- inline
4783
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4784
- </xsl:variable>
4858
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4859
+ <xsl:param name="fo_element">block</xsl:param>
4860
+
4785
4861
  <xsl:choose>
4786
4862
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4787
4863
  <fo:inline>
4788
4864
  <xsl:apply-templates/>
4789
4865
  </fo:inline>
4790
4866
  </xsl:when>
4791
- <xsl:when test="contains(normalize-space($element), 'block')">
4867
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4792
4868
  <fo:block xsl:use-attribute-sets="example-name-style">
4793
4869
  <xsl:apply-templates/>
4794
4870
  </fo:block>
@@ -4801,14 +4877,15 @@
4801
4877
  </xsl:choose>
4802
4878
 
4803
4879
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4880
+ <xsl:param name="fo_element">block</xsl:param>
4881
+
4804
4882
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4805
4883
  <xsl:variable name="element">
4806
- block
4807
-
4808
4884
 
4885
+ <xsl:value-of select="$fo_element"/>
4809
4886
  </xsl:variable>
4810
4887
  <xsl:choose>
4811
- <xsl:when test="normalize-space($element) = 'block'">
4888
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4812
4889
  <fo:block xsl:use-attribute-sets="example-p-style">
4813
4890
 
4814
4891
  <xsl:apply-templates/>
@@ -4827,45 +4904,66 @@
4827
4904
  <xsl:variable name="termsource_text">
4828
4905
  <xsl:apply-templates/>
4829
4906
  </xsl:variable>
4830
-
4831
- <xsl:choose>
4907
+ <xsl:copy-of select="$termsource_text"/>
4908
+ <!-- <xsl:choose>
4832
4909
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4833
- <!-- <xsl:apply-templates /> -->
4834
4910
  <xsl:copy-of select="$termsource_text"/>
4835
4911
  </xsl:when>
4836
4912
  <xsl:otherwise>
4837
-
4838
-
4913
+ <xsl:if test="$namespace = 'bsi'">
4914
+ <xsl:choose>
4915
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
4916
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
4917
+ </xsl:choose>
4918
+ </xsl:if>
4919
+ <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'">
4839
4920
  <xsl:text>[</xsl:text>
4840
-
4841
- <!-- <xsl:apply-templates /> -->
4921
+ </xsl:if>
4842
4922
  <xsl:copy-of select="$termsource_text"/>
4843
-
4844
-
4923
+ <xsl:if test="$namespace = 'bsi'">
4924
+ <xsl:choose>
4925
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
4926
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
4927
+ </xsl:choose>
4928
+ </xsl:if>
4929
+ <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'">
4845
4930
  <xsl:text>]</xsl:text>
4846
-
4931
+ </xsl:if>
4847
4932
  </xsl:otherwise>
4848
- </xsl:choose>
4933
+ </xsl:choose> -->
4849
4934
  </fo:block>
4850
4935
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4851
4936
  <xsl:if test="normalize-space() != ''">
4852
4937
  <xsl:value-of select="."/>
4853
4938
  </xsl:if>
4854
- </xsl:template><xsl:variable name="localized.source">
4855
- <xsl:call-template name="getLocalizedString">
4856
- <xsl:with-param name="key">source</xsl:with-param>
4857
- </xsl:call-template>
4858
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4939
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
4940
+ <fo:inline>
4941
+
4942
+
4943
+ <xsl:value-of select="."/>
4944
+ </fo:inline>
4945
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
4859
4946
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4860
4947
  <xsl:if test="normalize-space(@citeas) = ''">
4861
4948
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4862
4949
  </xsl:if>
4863
-
4864
4950
  <fo:inline xsl:use-attribute-sets="origin-style">
4865
4951
  <xsl:apply-templates/>
4866
4952
  </fo:inline>
4867
-
4868
- </fo:basic-link>
4953
+ </fo:basic-link>
4954
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4955
+ <xsl:variable name="title-modified">
4956
+ <xsl:call-template name="getLocalizedString">
4957
+ <xsl:with-param name="key">modified</xsl:with-param>
4958
+ </xsl:call-template>
4959
+ </xsl:variable>
4960
+
4961
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4962
+ <xsl:choose>
4963
+ <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>
4964
+ <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>
4965
+ </xsl:choose>
4966
+ <xsl:apply-templates/>
4869
4967
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4870
4968
  <fo:inline><xsl:apply-templates/></fo:inline>
4871
4969
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5049,25 +5147,29 @@
5049
5147
  </fo:block>
5050
5148
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5051
5149
  <xsl:variable name="title-deprecated">
5052
-
5053
-
5054
- <xsl:call-template name="getTitle">
5055
- <xsl:with-param name="name" select="'title-deprecated'"/>
5056
- </xsl:call-template>
5057
-
5150
+ <xsl:call-template name="getLocalizedString">
5151
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5152
+ </xsl:call-template>
5058
5153
  </xsl:variable>
5059
5154
  <fo:block xsl:use-attribute-sets="deprecates-style">
5060
5155
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5061
5156
  </fo:block>
5157
+ </xsl:template><xsl:template name="setStyle_preferred">
5158
+ <xsl:if test="*[local-name() = 'strong']">
5159
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
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)"/>
5062
5163
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5063
5164
  <fo:block xsl:use-attribute-sets="definition-style">
5064
5165
  <xsl:apply-templates/>
5065
5166
  </fo:block>
5066
5167
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5067
5168
  <xsl:apply-templates/>
5068
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5169
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5069
5170
  <fo:inline> <xsl:apply-templates/></fo:inline>
5070
- <fo:block> </fo:block>
5171
+ <!-- <fo:block>&#xA0;</fo:block> -->
5172
+ <fo:block/>
5071
5173
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5072
5174
 
5073
5175
  <fo:block break-after="page"/>
@@ -5130,6 +5232,51 @@
5130
5232
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5131
5233
  <!-- 0xA0 to space replacement -->
5132
5234
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5235
+ </xsl:template><xsl:variable name="ul_labels_">
5236
+
5237
+
5238
+
5239
+
5240
+
5241
+
5242
+
5243
+
5244
+
5245
+ <label font-size="18pt" margin-top="-0.5mm">•</label> <!-- margin-top to vertical align big dot -->
5246
+
5247
+
5248
+
5249
+
5250
+
5251
+
5252
+
5253
+
5254
+
5255
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5256
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5257
+ <xsl:variable name="list_level">
5258
+ <xsl:choose>
5259
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
5260
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
5261
+ </xsl:choose>
5262
+ </xsl:variable>
5263
+ <xsl:choose>
5264
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
5265
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
5266
+ </xsl:when>
5267
+ <xsl:when test="$list_level mod 3 = 0">
5268
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
5269
+ </xsl:when>
5270
+ <xsl:when test="$list_level mod 2 = 0">
5271
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
5272
+ </xsl:when>
5273
+ <xsl:otherwise>
5274
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
5275
+ </xsl:otherwise>
5276
+ </xsl:choose>
5277
+ </xsl:template><xsl:template match="label" mode="ul_labels">
5278
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5279
+ <xsl:value-of select="."/>
5133
5280
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5134
5281
  <xsl:choose>
5135
5282
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5340,16 +5487,52 @@
5340
5487
 
5341
5488
 
5342
5489
 
5343
-
5490
+
5491
+
5492
+
5493
+
5494
+
5495
+
5344
5496
 
5345
5497
 
5346
5498
 
5347
5499
 
5348
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 -->
5349
5530
 
5350
5531
 
5532
+
5533
+
5351
5534
  </xsl:template><xsl:template name="processBibitemDocId">
5352
- <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')]"/>
5353
5536
  <xsl:choose>
5354
5537
  <xsl:when test="normalize-space($_doc_ident) != ''">
5355
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"/>
@@ -5363,7 +5546,7 @@
5363
5546
  <xsl:if test="$type != ''">
5364
5547
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5365
5548
  </xsl:if> -->
5366
- <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')]"/>
5367
5550
  </xsl:otherwise>
5368
5551
  </xsl:choose>
5369
5552
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5468,7 +5651,35 @@
5468
5651
  <fo:block-container border="1pt solid black" width="50%">
5469
5652
  <fo:block> </fo:block>
5470
5653
  </fo:block-container>
5471
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
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 -->
5658
+ <xsl:choose>
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 -->
5661
+ <xsl:otherwise><!-- default value -->
5662
+
5663
+
5664
+
5665
+
5666
+
5667
+
5668
+
5669
+
5670
+
5671
+ 3
5672
+
5673
+
5674
+
5675
+
5676
+
5677
+
5678
+
5679
+
5680
+ </xsl:otherwise>
5681
+ </xsl:choose>
5682
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5472
5683
  <xsl:param name="colwidths"/>
5473
5684
  <xsl:variable name="colwidths_">
5474
5685
  <xsl:choose>
@@ -5548,7 +5759,7 @@
5548
5759
  </td>
5549
5760
  </xsl:for-each>
5550
5761
  <td>333</td> <!-- page number, just for fill -->
5551
- </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">
5552
5763
  <fo:inline padding-right="5mm"> </fo:inline>
5553
5764
  <fo:inline><xsl:apply-templates/></fo:inline>
5554
5765
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -5559,6 +5770,10 @@
5559
5770
  </svg>
5560
5771
  </fo:instream-foreign-object>
5561
5772
  </fo:inline>
5773
+ </xsl:template><xsl:template match="@language">
5774
+ <xsl:copy-of select="."/>
5775
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
5776
+ <xsl:call-template name="title"/>
5562
5777
  </xsl:template><xsl:template name="convertDate">
5563
5778
  <xsl:param name="date"/>
5564
5779
  <xsl:param name="format" select="'short'"/>
@@ -5916,9 +6131,15 @@
5916
6131
  </xsl:template><xsl:template name="getLocalizedString">
5917
6132
  <xsl:param name="key"/>
5918
6133
  <xsl:param name="formatted">false</xsl:param>
6134
+ <xsl:param name="lang"/>
5919
6135
 
5920
6136
  <xsl:variable name="curr_lang">
5921
- <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>
5922
6143
  </xsl:variable>
5923
6144
 
5924
6145
  <xsl:variable name="data_value">
@@ -6108,4 +6329,14 @@
6108
6329
  </xsl:otherwise>
6109
6330
  </xsl:choose>
6110
6331
  </xsl:if>
6332
+ </xsl:template><xsl:template name="setAltText">
6333
+ <xsl:param name="value"/>
6334
+ <xsl:attribute name="fox:alt-text">
6335
+ <xsl:choose>
6336
+ <xsl:when test="normalize-space($value) != ''">
6337
+ <xsl:value-of select="$value"/>
6338
+ </xsl:when>
6339
+ <xsl:otherwise>_</xsl:otherwise>
6340
+ </xsl:choose>
6341
+ </xsl:attribute>
6111
6342
  </xsl:template></xsl:stylesheet>