metanorma-csa 1.9.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@
6
6
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
+
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"/>
9
11
 
10
12
  <xsl:variable name="pageWidth" select="215.9"/>
11
13
  <xsl:variable name="pageHeight" select="279.4"/>
@@ -140,12 +142,11 @@
140
142
 
141
143
  <fo:block break-after="page"/>
142
144
 
143
- <xsl:variable name="title-acknowledgements">
144
- <xsl:call-template name="getTitle">
145
- <xsl:with-param name="name" select="'title-acknowledgements'"/>
145
+ <fo:block font-size="26pt" margin-bottom="18pt" role="H1">
146
+ <xsl:call-template name="getLocalizedString">
147
+ <xsl:with-param name="key">acknowledgements</xsl:with-param>
146
148
  </xsl:call-template>
147
- </xsl:variable>
148
- <fo:block font-size="26pt" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-acknowledgements"/></fo:block>
149
+ </fo:block>
149
150
 
150
151
  <xsl:variable name="persons">
151
152
  <xsl:for-each select="/csa:csa-standard/csa:bibdata/csa:contributor[csa:person]">
@@ -214,7 +215,7 @@
214
215
  <fo:list-block>
215
216
  <xsl:attribute name="provisional-distance-between-starts">
216
217
  <xsl:choose>
217
- <xsl:when test="@level = 2">10mm</xsl:when>
218
+ <xsl:when test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 10"/>mm</xsl:when>
218
219
  <xsl:otherwise>3mm</xsl:otherwise>
219
220
  </xsl:choose>
220
221
  </xsl:attribute>
@@ -278,7 +279,7 @@
278
279
 
279
280
  <xsl:variable name="display">
280
281
  <xsl:choose>
281
- <xsl:when test="$level &gt;= 3">false</xsl:when>
282
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
282
283
  <xsl:otherwise>true</xsl:otherwise>
283
284
  </xsl:choose>
284
285
  </xsl:variable>
@@ -417,7 +418,7 @@
417
418
  </fo:block>
418
419
  </xsl:template>
419
420
 
420
- <xsl:template match="csa:title">
421
+ <xsl:template match="csa:title" name="title">
421
422
 
422
423
  <xsl:variable name="level">
423
424
  <xsl:call-template name="getLevel"/>
@@ -525,32 +526,6 @@
525
526
  </xsl:if>
526
527
  </xsl:template>
527
528
 
528
- <!--
529
- <fn reference="1">
530
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
531
- </fn>
532
- -->
533
- <xsl:template match="csa:title/csa:fn | csa:p/csa:fn[not(ancestor::csa:table)]" priority="2">
534
- <fo:footnote keep-with-previous.within-line="always">
535
- <xsl:variable name="number" select="@reference"/>
536
-
537
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
538
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
539
- <xsl:value-of select="$number"/><!-- + count(//csa:bibitem/csa:note) -->
540
- </fo:basic-link>
541
- </fo:inline>
542
- <fo:footnote-body>
543
- <fo:block font-family="Azo Sans Lt" font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="rgb(168, 170, 173)" text-align="left">
544
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super">
545
- <xsl:value-of select="$number "/><!-- + count(//csa:bibitem/csa:note) -->
546
- </fo:inline>
547
- <xsl:for-each select="csa:p">
548
- <xsl:apply-templates/>
549
- </xsl:for-each>
550
- </fo:block>
551
- </fo:footnote-body>
552
- </fo:footnote>
553
- </xsl:template>
554
529
 
555
530
  <xsl:template match="csa:fn/csa:p">
556
531
  <fo:block>
@@ -561,46 +536,7 @@
561
536
 
562
537
  <xsl:template match="csa:bibitem">
563
538
  <fo:block id="{@id}" margin-bottom="12pt" start-indent="12mm" text-indent="-12mm" line-height="145%">
564
- <xsl:if test=".//csa:fn">
565
- <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
566
- </xsl:if>
567
- <xsl:choose>
568
- <xsl:when test="csa:formattedref">
569
- <xsl:apply-templates select="csa:formattedref"/>
570
- </xsl:when>
571
- <xsl:otherwise>
572
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
573
- <xsl:apply-templates/>
574
- <xsl:if test="position() != last()">, </xsl:if>
575
- <xsl:if test="position() = last()">: </xsl:if>
576
- </xsl:for-each>
577
- <!-- csa:docidentifier -->
578
- <!-- <xsl:if test="csa:docidentifier">
579
- <xsl:value-of select="csa:docidentifier/@type"/><xsl:text> </xsl:text>
580
- <xsl:value-of select="csa:docidentifier"/>
581
- </xsl:if> -->
582
- <xsl:value-of select="csa:docidentifier"/>
583
- <xsl:apply-templates select="csa:note"/>
584
- <xsl:if test="csa:docidentifier">, </xsl:if>
585
- <fo:inline font-style="italic">
586
- <xsl:choose>
587
- <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
588
- <xsl:value-of select="csa:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
589
- </xsl:when>
590
- <xsl:otherwise>
591
- <xsl:value-of select="csa:title"/><xsl:text>. </xsl:text>
592
- </xsl:otherwise>
593
- </xsl:choose>
594
- </fo:inline>
595
- <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
596
- <xsl:apply-templates/>
597
- <xsl:if test="position() != last()">, </xsl:if>
598
- </xsl:for-each>
599
- <xsl:if test="csa:date[@type='published']/csa:on">
600
- <xsl:text>(</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>)</xsl:text>
601
- </xsl:if>
602
- </xsl:otherwise>
603
- </xsl:choose>
539
+ <xsl:call-template name="processBibitem"/>
604
540
  </fo:block>
605
541
  </xsl:template>
606
542
 
@@ -675,8 +611,11 @@
675
611
  <fo:list-item-label end-indent="label-end()">
676
612
  <fo:block>
677
613
  <xsl:choose>
678
- <xsl:when test="local-name(..) = 'ul' and (../ancestor::csa:ul or ../ancestor::csa:ol)">-</xsl:when> <!-- &#x2014; dash -->
679
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
614
+ <xsl:when test="local-name(..) = 'ul'">
615
+ <xsl:call-template name="setULLabel"/>
616
+ </xsl:when>
617
+ <!-- <xsl:when test="local-name(..) = 'ul' and (../ancestor::csa:ul or ../ancestor::csa:ol)">-</xsl:when> --> <!-- &#x2014; dash -->
618
+ <!-- <xsl:when test="local-name(..) = 'ul'">•</xsl:when> --> <!-- &#x2014; dash -->
680
619
  <xsl:otherwise> <!-- for ordered lists -->
681
620
  <xsl:choose>
682
621
  <xsl:when test="../@type = 'arabic'">
@@ -738,6 +677,7 @@
738
677
  <xsl:apply-templates select="ancestor::csa:term[1]/csa:name" mode="presentation"/>
739
678
  </fo:block>
740
679
  <fo:block font-weight="bold" keep-with-next="always" line-height="1">
680
+ <xsl:call-template name="setStyle_preferred"/>
741
681
  <xsl:apply-templates/>
742
682
  </fo:block>
743
683
  </fo:block>
@@ -759,7 +699,10 @@
759
699
  <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem">
760
700
  <fo:block margin-bottom="12pt" line-height="145%">
761
701
  <fo:inline id="{@id}">
762
- <xsl:number format="[1]"/>
702
+ <xsl:value-of select="csa:docidentifier[@type = 'metanorma-ordinal']"/>
703
+ <xsl:if test="not(csa:docidentifier[@type = 'metanorma-ordinal'])">
704
+ <xsl:number format="[1]"/>
705
+ </xsl:if>
763
706
  </fo:inline>
764
707
 
765
708
  <xsl:if test="not(csa:formattedref)">
@@ -779,13 +722,13 @@
779
722
 
780
723
  </xsl:if>
781
724
 
782
- <xsl:if test="csa:docidentifier">
725
+ <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">
783
726
  <xsl:choose>
784
727
  <xsl:when test="csa:docidentifier/@type = 'ISO' and csa:formattedref"/>
785
728
  <xsl:when test="csa:docidentifier/@type = 'OGC' and csa:formattedref"/>
786
729
  <xsl:otherwise><fo:inline>
787
730
  <!-- <xsl:if test="csa:docidentifier/@type = 'OGC'">OGC </xsl:if> -->
788
- <xsl:value-of select="csa:docidentifier"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
731
+ <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/><xsl:apply-templates select="csa:note"/>, </fo:inline></xsl:otherwise>
789
732
  </xsl:choose>
790
733
  </xsl:if>
791
734
 
@@ -818,8 +761,6 @@
818
761
  </fo:block>
819
762
  </xsl:template>
820
763
 
821
- <!-- <xsl:template match="csa:references[@id = '_bibliography']/csa:bibitem" mode="contents"/> [position() &gt; 1] -->
822
- <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem" mode="contents"/>
823
764
 
824
765
  <!-- <xsl:template match="csa:references[@id = '_bibliography']/csa:bibitem/csa:title"> [position() &gt; 1]-->
825
766
  <xsl:template match="csa:references[not(@normative='true')]/csa:bibitem/csa:title">
@@ -900,13 +841,6 @@
900
841
 
901
842
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
902
843
 
903
- <title-annex lang="en">Annex </title-annex>
904
- <title-annex lang="fr">Annexe </title-annex>
905
-
906
- <title-annex lang="zh">Annex </title-annex>
907
-
908
-
909
-
910
844
  <title-edition lang="en">
911
845
 
912
846
 
@@ -920,7 +854,8 @@
920
854
 
921
855
  </title-edition>
922
856
 
923
-
857
+
858
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
924
859
  <title-toc lang="en">
925
860
 
926
861
 
@@ -932,21 +867,11 @@
932
867
 
933
868
  <xsl:text>Sommaire</xsl:text>
934
869
 
935
-
936
- </title-toc>
870
+ </title-toc>
937
871
 
938
872
  <title-toc lang="zh">Contents</title-toc>
939
873
 
940
874
 
941
-
942
- <title-page lang="en">Page</title-page>
943
- <title-page lang="fr">Page</title-page>
944
-
945
- <title-key lang="en">Key</title-key>
946
- <title-key lang="fr">Légende</title-key>
947
-
948
- <title-where lang="en">where</title-where>
949
- <title-where lang="fr">où</title-where>
950
875
 
951
876
  <title-descriptors lang="en">Descriptors</title-descriptors>
952
877
 
@@ -969,25 +894,6 @@
969
894
 
970
895
  </title-subpart>
971
896
 
972
- <title-modified lang="en">modified</title-modified>
973
- <title-modified lang="fr">modifiée</title-modified>
974
-
975
- <title-modified lang="zh">modified</title-modified>
976
-
977
-
978
-
979
- <title-source lang="en">
980
-
981
- <xsl:text>SOURCE</xsl:text>
982
-
983
-
984
- </title-source>
985
-
986
- <title-keywords lang="en">Keywords</title-keywords>
987
-
988
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
989
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
990
-
991
897
  <title-list-tables lang="en">List of Tables</title-list-tables>
992
898
 
993
899
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -996,37 +902,8 @@
996
902
 
997
903
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
998
904
 
999
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1000
-
1001
- <title-abstract lang="en">Abstract</title-abstract>
1002
-
1003
905
  <title-summary lang="en">Summary</title-summary>
1004
906
 
1005
- <title-in lang="en">in </title-in>
1006
-
1007
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1008
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1009
-
1010
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1011
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1012
-
1013
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1014
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
1015
-
1016
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1017
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
1018
-
1019
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1020
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1021
-
1022
- <title-caution lang="en">CAUTION</title-caution>
1023
- <title-caution lang="zh">注意</title-caution>
1024
-
1025
- <title-warning lang="en">WARNING</title-warning>
1026
- <title-warning lang="zh">警告</title-warning>
1027
-
1028
- <title-amendment lang="en">AMENDMENT</title-amendment>
1029
-
1030
907
  <title-continued lang="en">(continued)</title-continued>
1031
908
  <title-continued lang="fr">(continué)</title-continued>
1032
909
 
@@ -1139,6 +1016,7 @@
1139
1016
 
1140
1017
 
1141
1018
 
1019
+
1142
1020
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1143
1021
 
1144
1022
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
@@ -1146,12 +1024,13 @@
1146
1024
 
1147
1025
 
1148
1026
 
1027
+
1149
1028
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1029
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1150
1030
 
1151
1031
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1152
1032
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1153
1033
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1154
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1155
1034
 
1156
1035
 
1157
1036
 
@@ -1186,6 +1065,7 @@
1186
1065
 
1187
1066
 
1188
1067
 
1068
+
1189
1069
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1190
1070
 
1191
1071
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1458,7 +1338,81 @@
1458
1338
 
1459
1339
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1460
1340
  <xsl:attribute name="line-height">135%</xsl:attribute>
1461
- </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">
1341
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1342
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1343
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1344
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1345
+
1346
+
1347
+
1348
+ <xsl:attribute name="font-size">65%</xsl:attribute>
1349
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+
1361
+
1362
+
1363
+
1364
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1365
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1366
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1367
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1368
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1369
+
1370
+
1371
+
1372
+ <xsl:attribute name="font-family">Azo Sans Lt</xsl:attribute>
1373
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1374
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1375
+ <xsl:attribute name="color">rgb(168, 170, 173)</xsl:attribute>
1376
+ <xsl:attribute name="text-align">left</xsl:attribute>
1377
+
1378
+
1379
+
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+
1390
+
1391
+
1392
+
1393
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1394
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1395
+
1396
+
1397
+
1398
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1399
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+ </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">
1462
1416
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1463
1417
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1464
1418
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1483,7 +1437,8 @@
1483
1437
  <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"/>
1484
1438
 
1485
1439
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1486
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1440
+
1441
+ <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']]">
1487
1442
  <xsl:sort select="@displayorder" data-type="number"/>
1488
1443
  <xsl:apply-templates select="." mode="contents"/>
1489
1444
  </xsl:for-each>
@@ -1493,7 +1448,7 @@
1493
1448
  <xsl:apply-templates select="." mode="contents"/>
1494
1449
  </xsl:for-each>
1495
1450
 
1496
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1451
+ <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')]]">
1497
1452
  <xsl:sort select="@displayorder" data-type="number"/>
1498
1453
  <xsl:apply-templates select="." mode="contents"/>
1499
1454
  </xsl:for-each>
@@ -2385,6 +2340,102 @@
2385
2340
 
2386
2341
  </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">
2387
2342
  <xsl:apply-templates/>
2343
+ </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">
2344
+
2345
+ <!-- list of footnotes to calculate actual footnotes number -->
2346
+ <xsl:variable name="p_fn_">
2347
+ <xsl:choose>
2348
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2349
+ <fn gen_id="{generate-id(.)}">
2350
+ <xsl:copy-of select="@*"/>
2351
+ <xsl:copy-of select="node()"/>
2352
+ </fn>
2353
+ </xsl:when>
2354
+ <xsl:otherwise>
2355
+ <!-- itetation for:
2356
+ footnotes in bibdata/title
2357
+ footnotes in bibliography
2358
+ footnotes in document's body (except table's head/body/foot and figure text)
2359
+ -->
2360
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2361
+ <fn gen_id="{generate-id(.)}">
2362
+ <xsl:copy-of select="@*"/>
2363
+ <xsl:copy-of select="node()"/>
2364
+ </fn>
2365
+ </xsl:for-each>
2366
+ <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']/*">
2367
+ <xsl:sort select="@displayorder" data-type="number"/>
2368
+ <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])]">
2369
+ <!-- copy unique fn -->
2370
+ <fn gen_id="{generate-id(.)}">
2371
+ <xsl:copy-of select="@*"/>
2372
+ <xsl:copy-of select="node()"/>
2373
+ </fn>
2374
+ </xsl:for-each>
2375
+ </xsl:for-each>
2376
+ </xsl:otherwise>
2377
+ </xsl:choose>
2378
+ </xsl:variable>
2379
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2380
+
2381
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2382
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2383
+ <xsl:variable name="reference" select="@reference"/>
2384
+ <!-- fn sequence number in document -->
2385
+ <xsl:variable name="current_fn_number">
2386
+ <xsl:choose>
2387
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2388
+ <xsl:otherwise>
2389
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2390
+ </xsl:otherwise>
2391
+ </xsl:choose>
2392
+ </xsl:variable>
2393
+ <xsl:variable name="current_fn_number_text">
2394
+ <xsl:value-of select="$current_fn_number"/>
2395
+
2396
+
2397
+ </xsl:variable>
2398
+
2399
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2400
+ <xsl:variable name="footnote_inline">
2401
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2402
+
2403
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2404
+ <xsl:value-of select="$current_fn_number_text"/>
2405
+ </fo:basic-link>
2406
+ </fo:inline>
2407
+ </xsl:variable>
2408
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2409
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2410
+ <xsl:choose>
2411
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2412
+ <xsl:copy-of select="$footnote_inline"/>
2413
+ </xsl:when>
2414
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2415
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2416
+ <xsl:copy-of select="$footnote_inline"/>
2417
+ <fo:footnote-body>
2418
+
2419
+ <fo:block-container text-indent="0" start-indent="0">
2420
+
2421
+
2422
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2423
+
2424
+
2425
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2426
+
2427
+ <xsl:value-of select="$current_fn_number_text"/>
2428
+ </fo:inline>
2429
+ <xsl:apply-templates/>
2430
+ </fo:block>
2431
+ </fo:block-container>
2432
+ </fo:footnote-body>
2433
+ </fo:footnote>
2434
+ </xsl:when>
2435
+ <xsl:otherwise>
2436
+ <xsl:copy-of select="$footnote_inline"/>
2437
+ </xsl:otherwise>
2438
+ </xsl:choose>
2388
2439
  </xsl:template><xsl:template name="fn_display">
2389
2440
  <xsl:variable name="references">
2390
2441
 
@@ -2575,6 +2626,8 @@
2575
2626
 
2576
2627
  </fo:basic-link>
2577
2628
  </fo:inline>
2629
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2630
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2578
2631
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2579
2632
  <fo:inline>
2580
2633
  <xsl:apply-templates/>
@@ -2623,12 +2676,9 @@
2623
2676
  <fo:block margin-bottom="12pt" text-align="left">
2624
2677
 
2625
2678
  <xsl:variable name="title-where">
2626
-
2627
-
2628
- <xsl:call-template name="getTitle">
2629
- <xsl:with-param name="name" select="'title-where'"/>
2630
- </xsl:call-template>
2631
-
2679
+ <xsl:call-template name="getLocalizedString">
2680
+ <xsl:with-param name="key">where</xsl:with-param>
2681
+ </xsl:call-template>
2632
2682
  </xsl:variable>
2633
2683
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2634
2684
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2644,12 +2694,9 @@
2644
2694
 
2645
2695
 
2646
2696
  <xsl:variable name="title-where">
2647
-
2648
-
2649
- <xsl:call-template name="getTitle">
2650
- <xsl:with-param name="name" select="'title-where'"/>
2651
- </xsl:call-template>
2652
-
2697
+ <xsl:call-template name="getLocalizedString">
2698
+ <xsl:with-param name="key">where</xsl:with-param>
2699
+ </xsl:call-template>
2653
2700
  </xsl:variable>
2654
2701
  <xsl:value-of select="$title-where"/>
2655
2702
  </fo:block>
@@ -2661,12 +2708,9 @@
2661
2708
 
2662
2709
 
2663
2710
  <xsl:variable name="title-key">
2664
-
2665
-
2666
- <xsl:call-template name="getTitle">
2667
- <xsl:with-param name="name" select="'title-key'"/>
2668
- </xsl:call-template>
2669
-
2711
+ <xsl:call-template name="getLocalizedString">
2712
+ <xsl:with-param name="key">key</xsl:with-param>
2713
+ </xsl:call-template>
2670
2714
  </xsl:variable>
2671
2715
  <xsl:value-of select="$title-key"/>
2672
2716
  </fo:block>
@@ -2932,6 +2976,7 @@
2932
2976
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2933
2977
  <xsl:apply-templates/>
2934
2978
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2979
+ <xsl:apply-templates select="@language"/>
2935
2980
  <xsl:apply-templates/>
2936
2981
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2937
2982
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -2993,6 +3038,15 @@
2993
3038
  </fo:inline>
2994
3039
  </xsl:template><xsl:template match="*[local-name()='add']">
2995
3040
  <xsl:choose>
3041
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3042
+ <fo:inline>
3043
+ <xsl:call-template name="insertTag">
3044
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3045
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3046
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3047
+ </xsl:call-template>
3048
+ </fo:inline>
3049
+ </xsl:when>
2996
3050
  <xsl:when test="@amendment">
2997
3051
  <fo:inline>
2998
3052
  <xsl:call-template name="insertTag">
@@ -3027,7 +3081,6 @@
3027
3081
  </fo:inline>
3028
3082
  </xsl:otherwise>
3029
3083
  </xsl:choose>
3030
-
3031
3084
  </xsl:template><xsl:template name="insertTag">
3032
3085
  <xsl:param name="type"/>
3033
3086
  <xsl:param name="kind"/>
@@ -3043,14 +3096,14 @@
3043
3096
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3044
3097
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3045
3098
  <g>
3046
- <xsl:if test="$type = 'closing'">
3099
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3047
3100
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3048
3101
  </xsl:if>
3049
3102
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3050
3103
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3051
3104
  </g>
3052
3105
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3053
- <xsl:if test="$type = 'closing'">
3106
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3054
3107
  <xsl:attribute name="x">25</xsl:attribute>
3055
3108
  </xsl:if>
3056
3109
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3543,9 +3596,9 @@
3543
3596
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3544
3597
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3545
3598
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3546
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3599
+ <xsl:apply-templates select="*[local-name()='name']"/>
3547
3600
  </fo:block>
3548
- <xsl:apply-templates/>
3601
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3549
3602
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3550
3603
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3551
3604
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -3565,22 +3618,6 @@
3565
3618
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3566
3619
  <xsl:apply-templates/>
3567
3620
  </fo:inline>
3568
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3569
- <xsl:variable name="title-modified">
3570
-
3571
-
3572
- <xsl:call-template name="getTitle">
3573
- <xsl:with-param name="name" select="'title-modified'"/>
3574
- </xsl:call-template>
3575
-
3576
- </xsl:variable>
3577
-
3578
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3579
- <xsl:choose>
3580
- <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>
3581
- <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>
3582
- </xsl:choose>
3583
- <xsl:apply-templates/>
3584
3621
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3585
3622
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3586
3623
 
@@ -4149,20 +4186,67 @@
4149
4186
  </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">
4150
4187
  <xsl:apply-templates mode="contents"/>
4151
4188
  <xsl:text> </xsl:text>
4152
- </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">
4189
+ </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">
4153
4190
  <xsl:apply-templates mode="bookmarks"/>
4154
4191
  <xsl:text> </xsl:text>
4155
4192
  </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">
4156
4193
  <xsl:value-of select="."/>
4157
- </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">
4194
+ </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">
4158
4195
  <xsl:value-of select="."/>
4159
4196
  </xsl:template><xsl:template match="node()" mode="contents">
4160
4197
  <xsl:apply-templates mode="contents"/>
4198
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4199
+ <xsl:variable name="level">
4200
+ <xsl:call-template name="getLevel">
4201
+ <xsl:with-param name="depth" select="@depth"/>
4202
+ </xsl:call-template>
4203
+ </xsl:variable>
4204
+
4205
+ <xsl:variable name="section">
4206
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4207
+ </xsl:variable>
4208
+
4209
+ <xsl:variable name="type">floating-title</xsl:variable>
4210
+
4211
+ <xsl:variable name="display">
4212
+ <xsl:choose>
4213
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4214
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4215
+ <xsl:otherwise>false</xsl:otherwise>
4216
+ </xsl:choose>
4217
+ </xsl:variable>
4218
+
4219
+ <xsl:variable name="skip">false</xsl:variable>
4220
+
4221
+ <xsl:if test="$skip = 'false'">
4222
+
4223
+ <xsl:variable name="title">
4224
+ <xsl:choose>
4225
+ <xsl:when test="*[local-name() = 'tab']">
4226
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4227
+ </xsl:when>
4228
+ <xsl:otherwise>
4229
+ <xsl:copy-of select="node()"/>
4230
+ </xsl:otherwise>
4231
+ </xsl:choose>
4232
+ </xsl:variable>
4233
+
4234
+ <xsl:variable name="root">
4235
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4236
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4237
+ </xsl:variable>
4238
+
4239
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4240
+ <title>
4241
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4242
+ </title>
4243
+ </item>
4244
+ </xsl:if>
4161
4245
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4162
4246
  <xsl:apply-templates mode="bookmarks"/>
4163
4247
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4164
4248
  <xsl:apply-templates select="."/>
4165
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4249
+ </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">
4166
4250
  <xsl:apply-templates mode="bookmarks"/>
4167
4251
  </xsl:template><xsl:template name="addBookmarks">
4168
4252
  <xsl:param name="contents"/>
@@ -4333,7 +4417,10 @@
4333
4417
  </fo:block>
4334
4418
  </xsl:if>
4335
4419
  </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">
4336
- <xsl:apply-templates mode="contents_item"/>
4420
+ <xsl:param name="mode">bookmarks</xsl:param>
4421
+ <xsl:apply-templates mode="contents_item">
4422
+ <xsl:with-param name="mode" select="$mode"/>
4423
+ </xsl:apply-templates>
4337
4424
  <!-- <xsl:text> </xsl:text> -->
4338
4425
  </xsl:template><xsl:template name="getSection">
4339
4426
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4406,6 +4493,18 @@
4406
4493
  <xsl:copy-of select="."/>
4407
4494
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4408
4495
  <xsl:text> </xsl:text>
4496
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4497
+ <xsl:param name="mode">bookmarks</xsl:param>
4498
+ <xsl:apply-templates mode="contents_item">
4499
+ <xsl:with-param name="mode" select="$mode"/>
4500
+ </xsl:apply-templates>
4501
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4502
+ <xsl:param name="mode">bookmarks</xsl:param>
4503
+ <xsl:if test="$mode = 'contents'">
4504
+ <xsl:copy>
4505
+ <xsl:apply-templates mode="contents_item"/>
4506
+ </xsl:copy>
4507
+ </xsl:if>
4409
4508
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4410
4509
 
4411
4510
  <fo:block-container margin-left="0mm">
@@ -4424,6 +4523,8 @@
4424
4523
 
4425
4524
 
4426
4525
 
4526
+
4527
+
4427
4528
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4428
4529
  <xsl:variable name="_font-size">
4429
4530
  10
@@ -4457,13 +4558,17 @@
4457
4558
 
4458
4559
 
4459
4560
 
4561
+
4562
+
4460
4563
  <xsl:apply-templates/>
4461
4564
  </fo:block>
4462
-
4565
+
4463
4566
 
4464
4567
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4465
4568
 
4466
4569
 
4570
+
4571
+
4467
4572
  </fo:block-container>
4468
4573
  </fo:block-container>
4469
4574
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4736,42 +4841,48 @@
4736
4841
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4737
4842
 
4738
4843
 
4739
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4740
-
4741
- <xsl:variable name="element">
4844
+ <xsl:variable name="fo_element">
4845
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4742
4846
  block
4743
4847
 
4744
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
4848
+
4745
4849
  </xsl:variable>
4746
4850
 
4851
+ <!-- display 'EXAMPLE' -->
4852
+ <xsl:apply-templates select="*[local-name()='name']">
4853
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4854
+ </xsl:apply-templates>
4855
+
4747
4856
  <xsl:choose>
4748
- <xsl:when test="contains(normalize-space($element), 'block')">
4749
- <fo:block xsl:use-attribute-sets="example-body-style">
4750
- <xsl:apply-templates/>
4751
- </fo:block>
4857
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4858
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
4859
+ <fo:block-container margin-left="0mm" margin-right="0mm">
4860
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4861
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4862
+ </xsl:apply-templates>
4863
+ </fo:block-container>
4864
+ </fo:block-container>
4752
4865
  </xsl:when>
4753
4866
  <xsl:otherwise>
4754
4867
  <fo:inline>
4755
- <xsl:apply-templates/>
4868
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
4869
+ <xsl:with-param name="fo_element" select="$fo_element"/>
4870
+ </xsl:apply-templates>
4756
4871
  </fo:inline>
4757
4872
  </xsl:otherwise>
4758
4873
  </xsl:choose>
4759
4874
 
4760
4875
  </fo:block>
4761
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
4762
-
4763
- <xsl:variable name="element">
4764
- block
4765
-
4766
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4767
- </xsl:variable>
4876
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
4877
+ <xsl:param name="fo_element">block</xsl:param>
4878
+
4768
4879
  <xsl:choose>
4769
4880
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
4770
4881
  <fo:inline>
4771
4882
  <xsl:apply-templates/>
4772
4883
  </fo:inline>
4773
4884
  </xsl:when>
4774
- <xsl:when test="contains(normalize-space($element), 'block')">
4885
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
4775
4886
  <fo:block xsl:use-attribute-sets="example-name-style">
4776
4887
  <xsl:apply-templates/>
4777
4888
  </fo:block>
@@ -4784,14 +4895,15 @@
4784
4895
  </xsl:choose>
4785
4896
 
4786
4897
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4898
+ <xsl:param name="fo_element">block</xsl:param>
4899
+
4787
4900
  <xsl:variable name="num"><xsl:number/></xsl:variable>
4788
4901
  <xsl:variable name="element">
4789
- block
4790
-
4791
4902
 
4903
+ <xsl:value-of select="$fo_element"/>
4792
4904
  </xsl:variable>
4793
4905
  <xsl:choose>
4794
- <xsl:when test="normalize-space($element) = 'block'">
4906
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
4795
4907
  <fo:block xsl:use-attribute-sets="example-p-style">
4796
4908
 
4797
4909
  <xsl:apply-templates/>
@@ -4810,62 +4922,66 @@
4810
4922
  <xsl:variable name="termsource_text">
4811
4923
  <xsl:apply-templates/>
4812
4924
  </xsl:variable>
4813
-
4814
- <xsl:choose>
4925
+ <xsl:copy-of select="$termsource_text"/>
4926
+ <!-- <xsl:choose>
4815
4927
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4816
- <!-- <xsl:apply-templates /> -->
4817
4928
  <xsl:copy-of select="$termsource_text"/>
4818
4929
  </xsl:when>
4819
4930
  <xsl:otherwise>
4820
-
4821
-
4931
+ <xsl:if test="$namespace = 'bsi'">
4932
+ <xsl:choose>
4933
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
4934
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
4935
+ </xsl:choose>
4936
+ </xsl:if>
4937
+ <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'">
4822
4938
  <xsl:text>[</xsl:text>
4823
-
4824
- <!-- <xsl:apply-templates /> -->
4939
+ </xsl:if>
4825
4940
  <xsl:copy-of select="$termsource_text"/>
4826
-
4827
-
4941
+ <xsl:if test="$namespace = 'bsi'">
4942
+ <xsl:choose>
4943
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
4944
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
4945
+ </xsl:choose>
4946
+ </xsl:if>
4947
+ <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'">
4828
4948
  <xsl:text>]</xsl:text>
4829
-
4949
+ </xsl:if>
4830
4950
  </xsl:otherwise>
4831
- </xsl:choose>
4951
+ </xsl:choose> -->
4832
4952
  </fo:block>
4833
4953
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4834
4954
  <xsl:if test="normalize-space() != ''">
4835
4955
  <xsl:value-of select="."/>
4836
4956
  </xsl:if>
4837
- </xsl:template><xsl:variable name="localized.source">
4838
- <xsl:call-template name="getLocalizedString">
4839
- <xsl:with-param name="key">source</xsl:with-param>
4840
- </xsl:call-template>
4841
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4957
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
4958
+ <fo:inline>
4959
+
4960
+
4961
+ <xsl:value-of select="."/>
4962
+ </fo:inline>
4963
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
4842
4964
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4843
4965
  <xsl:if test="normalize-space(@citeas) = ''">
4844
4966
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4845
4967
  </xsl:if>
4846
-
4847
-
4848
- <fo:inline>
4849
-
4850
-
4851
-
4852
-
4853
-
4854
-
4855
-
4856
- <xsl:call-template name="getTitle">
4857
- <xsl:with-param name="name" select="'title-source'"/>
4858
- </xsl:call-template>
4859
- <xsl:text>: </xsl:text>
4860
-
4861
-
4862
- </fo:inline>
4863
-
4864
4968
  <fo:inline xsl:use-attribute-sets="origin-style">
4865
4969
  <xsl:apply-templates/>
4866
4970
  </fo:inline>
4867
-
4868
- </fo:basic-link>
4971
+ </fo:basic-link>
4972
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4973
+ <xsl:variable name="title-modified">
4974
+ <xsl:call-template name="getLocalizedString">
4975
+ <xsl:with-param name="key">modified</xsl:with-param>
4976
+ </xsl:call-template>
4977
+ </xsl:variable>
4978
+
4979
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4980
+ <xsl:choose>
4981
+ <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>
4982
+ <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>
4983
+ </xsl:choose>
4984
+ <xsl:apply-templates/>
4869
4985
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4870
4986
  <fo:inline><xsl:apply-templates/></fo:inline>
4871
4987
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5041,25 +5157,29 @@
5041
5157
  </fo:block>
5042
5158
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5043
5159
  <xsl:variable name="title-deprecated">
5044
-
5045
-
5046
- <xsl:call-template name="getTitle">
5047
- <xsl:with-param name="name" select="'title-deprecated'"/>
5048
- </xsl:call-template>
5049
-
5160
+ <xsl:call-template name="getLocalizedString">
5161
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5162
+ </xsl:call-template>
5050
5163
  </xsl:variable>
5051
5164
  <fo:block xsl:use-attribute-sets="deprecates-style">
5052
5165
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5053
5166
  </fo:block>
5167
+ </xsl:template><xsl:template name="setStyle_preferred">
5168
+ <xsl:if test="*[local-name() = 'strong']">
5169
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5170
+ </xsl:if>
5171
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5172
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5054
5173
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5055
5174
  <fo:block xsl:use-attribute-sets="definition-style">
5056
5175
  <xsl:apply-templates/>
5057
5176
  </fo:block>
5058
5177
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5059
5178
  <xsl:apply-templates/>
5060
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5179
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5061
5180
  <fo:inline> <xsl:apply-templates/></fo:inline>
5062
- <fo:block> </fo:block>
5181
+ <!-- <fo:block>&#xA0;</fo:block> -->
5182
+ <fo:block/>
5063
5183
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5064
5184
 
5065
5185
  <fo:block>
@@ -5120,6 +5240,53 @@
5120
5240
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5121
5241
  <!-- 0xA0 to space replacement -->
5122
5242
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5243
+ </xsl:template><xsl:variable name="ul_labels_">
5244
+
5245
+
5246
+
5247
+ <label level="1">•</label>
5248
+ <label level="2">-</label><!-- minus -->
5249
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
5250
+
5251
+
5252
+
5253
+
5254
+
5255
+
5256
+
5257
+
5258
+
5259
+
5260
+
5261
+
5262
+
5263
+
5264
+
5265
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5266
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5267
+ <xsl:variable name="list_level">
5268
+ <xsl:choose>
5269
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
5270
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
5271
+ </xsl:choose>
5272
+ </xsl:variable>
5273
+ <xsl:choose>
5274
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
5275
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
5276
+ </xsl:when>
5277
+ <xsl:when test="$list_level mod 3 = 0">
5278
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
5279
+ </xsl:when>
5280
+ <xsl:when test="$list_level mod 2 = 0">
5281
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
5282
+ </xsl:when>
5283
+ <xsl:otherwise>
5284
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
5285
+ </xsl:otherwise>
5286
+ </xsl:choose>
5287
+ </xsl:template><xsl:template match="label" mode="ul_labels">
5288
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5289
+ <xsl:value-of select="."/>
5123
5290
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5124
5291
  <xsl:choose>
5125
5292
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5330,16 +5497,73 @@
5330
5497
 
5331
5498
 
5332
5499
 
5333
-
5500
+
5501
+
5502
+
5503
+ <!-- start CSA bibtem processing -->
5504
+ <xsl:if test=".//csa:fn">
5505
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
5506
+ </xsl:if>
5507
+ <xsl:choose>
5508
+ <xsl:when test="csa:formattedref">
5509
+ <xsl:apply-templates select="csa:formattedref"/>
5510
+ </xsl:when>
5511
+ <xsl:otherwise>
5512
+ <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
5513
+ <xsl:apply-templates/>
5514
+ <xsl:if test="position() != last()">, </xsl:if>
5515
+ <xsl:if test="position() = last()">: </xsl:if>
5516
+ </xsl:for-each>
5517
+ <!-- csa:docidentifier -->
5518
+ <!-- <xsl:if test="csa:docidentifier">
5519
+ <xsl:value-of select="csa:docidentifier/@type"/><xsl:text> </xsl:text>
5520
+ <xsl:value-of select="csa:docidentifier"/>
5521
+ </xsl:if> -->
5522
+ <xsl:value-of select="csa:docidentifier[not(@type = 'metanorma-ordinal')]"/>
5523
+ <xsl:apply-templates select="csa:note"/>
5524
+ <xsl:if test="csa:docidentifier[not(@type = 'metanorma-ordinal')]">, </xsl:if>
5525
+ <fo:inline font-style="italic">
5526
+ <xsl:choose>
5527
+ <xsl:when test="csa:title[@type = 'main' and @language = 'en']">
5528
+ <xsl:value-of select="csa:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
5529
+ </xsl:when>
5530
+ <xsl:otherwise>
5531
+ <xsl:value-of select="csa:title"/><xsl:text>. </xsl:text>
5532
+ </xsl:otherwise>
5533
+ </xsl:choose>
5534
+ </fo:inline>
5535
+ <xsl:for-each select="csa:contributor[csa:role/@type='publisher']/csa:organization/csa:name">
5536
+ <xsl:apply-templates/>
5537
+ <xsl:if test="position() != last()">, </xsl:if>
5538
+ </xsl:for-each>
5539
+ <xsl:if test="csa:date[@type='published']/csa:on">
5540
+ <xsl:text>(</xsl:text><xsl:value-of select="csa:date[@type='published']/csa:on"/><xsl:text>)</xsl:text>
5541
+ </xsl:if>
5542
+ </xsl:otherwise>
5543
+ </xsl:choose>
5544
+ <!-- end CSA bibtem processing -->
5545
+
5546
+
5547
+
5548
+
5334
5549
 
5335
5550
 
5336
5551
 
5337
5552
 
5338
5553
 
5554
+
5555
+
5556
+
5557
+
5558
+ <!-- end MPFD bibitem processing -->
5559
+
5560
+ <!-- start M3D bibitem processing -->
5561
+
5339
5562
 
5563
+
5340
5564
 
5341
5565
  </xsl:template><xsl:template name="processBibitemDocId">
5342
- <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')]"/>
5566
+ <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')]"/>
5343
5567
  <xsl:choose>
5344
5568
  <xsl:when test="normalize-space($_doc_ident) != ''">
5345
5569
  <!-- <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"/>
@@ -5353,7 +5577,7 @@
5353
5577
  <xsl:if test="$type != ''">
5354
5578
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5355
5579
  </xsl:if> -->
5356
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5580
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5357
5581
  </xsl:otherwise>
5358
5582
  </xsl:choose>
5359
5583
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5458,7 +5682,35 @@
5458
5682
  <fo:block-container border="1pt solid black" width="50%">
5459
5683
  <fo:block> </fo:block>
5460
5684
  </fo:block-container>
5461
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5685
+ </xsl:template><xsl:variable name="toc_level">
5686
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5687
+ <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:-->
5688
+ <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 -->
5689
+ <xsl:choose>
5690
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5691
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5692
+ <xsl:otherwise><!-- default value -->
5693
+
5694
+
5695
+ 2
5696
+
5697
+
5698
+
5699
+
5700
+
5701
+
5702
+
5703
+
5704
+
5705
+
5706
+
5707
+
5708
+
5709
+
5710
+
5711
+ </xsl:otherwise>
5712
+ </xsl:choose>
5713
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5462
5714
  <xsl:param name="colwidths"/>
5463
5715
  <xsl:variable name="colwidths_">
5464
5716
  <xsl:choose>
@@ -5538,7 +5790,7 @@
5538
5790
  </td>
5539
5791
  </xsl:for-each>
5540
5792
  <td>333</td> <!-- page number, just for fill -->
5541
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5793
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5542
5794
  <fo:inline padding-right="5mm"> </fo:inline>
5543
5795
  <fo:inline><xsl:apply-templates/></fo:inline>
5544
5796
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -5549,6 +5801,10 @@
5549
5801
  </svg>
5550
5802
  </fo:instream-foreign-object>
5551
5803
  </fo:inline>
5804
+ </xsl:template><xsl:template match="@language">
5805
+ <xsl:copy-of select="."/>
5806
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
5807
+ <xsl:call-template name="title"/>
5552
5808
  </xsl:template><xsl:template name="convertDate">
5553
5809
  <xsl:param name="date"/>
5554
5810
  <xsl:param name="format" select="'short'"/>
@@ -5906,9 +6162,15 @@
5906
6162
  </xsl:template><xsl:template name="getLocalizedString">
5907
6163
  <xsl:param name="key"/>
5908
6164
  <xsl:param name="formatted">false</xsl:param>
6165
+ <xsl:param name="lang"/>
5909
6166
 
5910
6167
  <xsl:variable name="curr_lang">
5911
- <xsl:call-template name="getLang"/>
6168
+ <xsl:choose>
6169
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6170
+ <xsl:otherwise>
6171
+ <xsl:call-template name="getLang"/>
6172
+ </xsl:otherwise>
6173
+ </xsl:choose>
5912
6174
  </xsl:variable>
5913
6175
 
5914
6176
  <xsl:variable name="data_value">
@@ -6098,4 +6360,14 @@
6098
6360
  </xsl:otherwise>
6099
6361
  </xsl:choose>
6100
6362
  </xsl:if>
6363
+ </xsl:template><xsl:template name="setAltText">
6364
+ <xsl:param name="value"/>
6365
+ <xsl:attribute name="fox:alt-text">
6366
+ <xsl:choose>
6367
+ <xsl:when test="normalize-space($value) != ''">
6368
+ <xsl:value-of select="$value"/>
6369
+ </xsl:when>
6370
+ <xsl:otherwise>_</xsl:otherwise>
6371
+ </xsl:choose>
6372
+ </xsl:attribute>
6101
6373
  </xsl:template></xsl:stylesheet>