metanorma-un 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
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"/>
11
+
10
12
 
11
13
 
12
14
 
@@ -337,7 +339,7 @@
337
339
 
338
340
  <xsl:variable name="display">
339
341
  <xsl:choose>
340
- <xsl:when test="$level &gt; 3">false</xsl:when>
342
+ <xsl:when test="$level &gt; $toc_level">false</xsl:when>
341
343
  <xsl:otherwise>true</xsl:otherwise>
342
344
  </xsl:choose>
343
345
  </xsl:variable>
@@ -374,7 +376,6 @@
374
376
  </xsl:if>
375
377
 
376
378
  </xsl:template>
377
- <xsl:template match="un:references[not(@normative='true')]/un:bibitem" mode="contents"/>
378
379
  <!-- ============================= -->
379
380
  <!-- ============================= -->
380
381
 
@@ -392,12 +393,9 @@
392
393
  <fo:table-body>
393
394
  <fo:table-row>
394
395
  <fo:table-cell padding-left="6mm" padding-top="2.5mm">
395
- <xsl:variable name="title-summary">
396
- <xsl:call-template name="getTitle">
397
- <xsl:with-param name="name" select="'title-summary'"/>
398
- </xsl:call-template>
399
- </xsl:variable>
400
- <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-summary"/></fo:block>
396
+ <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt" role="H2">
397
+ <xsl:apply-templates select="un:title/node()"/>
398
+ </fo:block>
401
399
  </fo:table-cell>
402
400
  <fo:table-cell>
403
401
  <fo:block> </fo:block>
@@ -411,7 +409,7 @@
411
409
  <fo:block> </fo:block>
412
410
  </fo:table-cell>
413
411
  <fo:table-cell text-align="justify" padding-bottom="12pt" padding-right="3mm">
414
- <fo:block font-size="10pt" line-height="120%"><xsl:apply-templates/></fo:block>
412
+ <fo:block font-size="10pt" line-height="120%"><xsl:apply-templates select="node()[not(self::un:title)]"/></fo:block>
415
413
  </fo:table-cell>
416
414
  <fo:table-cell>
417
415
  <fo:block> </fo:block>
@@ -553,31 +551,6 @@
553
551
  </xsl:template>
554
552
 
555
553
 
556
- <xsl:template match="un:title/un:fn | un:p/un:fn[not(ancestor::un:table)] | un:figure/un:name/un:fn" priority="2">
557
- <fo:footnote keep-with-previous.within-line="always">
558
- <xsl:variable name="number">
559
- <xsl:number level="any" count="un:fn[not(ancestor::un:table)]"/>
560
- </xsl:variable>
561
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
562
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
563
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
564
- </fo:basic-link>
565
- </fo:inline>
566
- <fo:footnote-body>
567
- <fo:block-container margin-left="-8mm">
568
- <fo:block font-size="9pt" text-align="justify" line-height="125%" font-weight="normal" text-indent="0" margin-left="8mm">
569
- <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" keep-with-next.within-line="always" vertical-align="super" padding-right="8mm"> <!-- alignment-baseline="hanging" -->
570
- <xsl:value-of select="$number + count(//un:bibitem/un:note)"/>
571
- </fo:inline>
572
- <xsl:for-each select="un:p">
573
- <xsl:apply-templates/>
574
- </xsl:for-each>
575
- </fo:block>
576
- </fo:block-container>
577
- </fo:footnote-body>
578
- </fo:footnote>
579
- </xsl:template>
580
-
581
554
  <xsl:template match="un:fn/un:p">
582
555
  <fo:block>
583
556
  <xsl:apply-templates/>
@@ -614,8 +587,9 @@
614
587
  <fo:list-item-label end-indent="label-end()">
615
588
  <fo:block>
616
589
  <xsl:choose>
617
- <!-- <xsl:when test="local-name(..) = 'ul'">&#x2014;</xsl:when> --> <!-- dash -->
618
- <xsl:when test="local-name(..) = 'ul'">•</xsl:when>
590
+ <xsl:when test="local-name(..) = 'ul'">
591
+ <xsl:call-template name="setULLabel"/>
592
+ </xsl:when>
619
593
  <xsl:otherwise> <!-- for ordered lists -->
620
594
  <xsl:choose>
621
595
  <xsl:when test="../@type = 'arabic'">
@@ -756,7 +730,7 @@
756
730
 
757
731
  <xsl:template match="un:title[parent::un:clause[@inline-header = 'true']]" priority="3"/>
758
732
 
759
- <xsl:template match="un:title">
733
+ <xsl:template match="un:title" name="title">
760
734
 
761
735
  <xsl:variable name="level">
762
736
  <xsl:call-template name="getLevel"/>
@@ -909,7 +883,7 @@
909
883
  </xsl:when>
910
884
  <xsl:otherwise>
911
885
  <xsl:apply-templates select="un:formattedref"/>
912
- <xsl:apply-templates select="un:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
886
+ <xsl:apply-templates select="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process"/>
913
887
  </xsl:otherwise>
914
888
  </xsl:choose>
915
889
  </xsl:if>
@@ -949,10 +923,10 @@
949
923
  <xsl:apply-templates/>
950
924
  </xsl:template>
951
925
 
952
- <xsl:template match="un:docidentifier[@type = 'metanorma']" mode="process">
926
+ <xsl:template match="un:docidentifier[@type = 'metanorma' or @type = 'metanorma-ordinal']" mode="process">
953
927
  <xsl:apply-templates/>
954
928
  </xsl:template>
955
- <xsl:template match="un:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
929
+ <xsl:template match="un:docidentifier[(@type != 'metanorma' and @type != 'metanorma-ordinal') or not(@type)]" mode="process">
956
930
  <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
957
931
  </xsl:template>
958
932
  <xsl:template match="un:docidentifier"/>
@@ -1117,13 +1091,6 @@
1117
1091
 
1118
1092
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1119
1093
 
1120
- <title-annex lang="en">Annex </title-annex>
1121
- <title-annex lang="fr">Annexe </title-annex>
1122
-
1123
- <title-annex lang="zh">Annex </title-annex>
1124
-
1125
-
1126
-
1127
1094
  <title-edition lang="en">
1128
1095
 
1129
1096
  <xsl:text>Edition </xsl:text>
@@ -1137,7 +1104,8 @@
1137
1104
 
1138
1105
  </title-edition>
1139
1106
 
1140
-
1107
+
1108
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
1141
1109
  <title-toc lang="en">
1142
1110
 
1143
1111
 
@@ -1145,21 +1113,9 @@
1145
1113
  </title-toc>
1146
1114
  <title-toc lang="fr">
1147
1115
 
1148
-
1149
- </title-toc>
1150
-
1151
- <title-toc lang="zh">Contents</title-toc>
1152
-
1153
-
1116
+ </title-toc>
1154
1117
 
1155
- <title-page lang="en">Page</title-page>
1156
- <title-page lang="fr">Page</title-page>
1157
1118
 
1158
- <title-key lang="en">Key</title-key>
1159
- <title-key lang="fr">Légende</title-key>
1160
-
1161
- <title-where lang="en">where</title-where>
1162
- <title-where lang="fr">où</title-where>
1163
1119
 
1164
1120
  <title-descriptors lang="en">Descriptors</title-descriptors>
1165
1121
 
@@ -1182,25 +1138,6 @@
1182
1138
 
1183
1139
  </title-subpart>
1184
1140
 
1185
- <title-modified lang="en">modified</title-modified>
1186
- <title-modified lang="fr">modifiée</title-modified>
1187
-
1188
- <title-modified lang="zh">modified</title-modified>
1189
-
1190
-
1191
-
1192
- <title-source lang="en">
1193
-
1194
- <xsl:text>SOURCE</xsl:text>
1195
-
1196
-
1197
- </title-source>
1198
-
1199
- <title-keywords lang="en">Keywords</title-keywords>
1200
-
1201
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
1202
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1203
-
1204
1141
  <title-list-tables lang="en">List of Tables</title-list-tables>
1205
1142
 
1206
1143
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -1209,37 +1146,8 @@
1209
1146
 
1210
1147
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
1211
1148
 
1212
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1213
-
1214
- <title-abstract lang="en">Abstract</title-abstract>
1215
-
1216
1149
  <title-summary lang="en">Summary</title-summary>
1217
1150
 
1218
- <title-in lang="en">in </title-in>
1219
-
1220
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1221
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1222
-
1223
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1224
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1225
-
1226
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1227
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
1228
-
1229
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1230
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
1231
-
1232
- <title-obligation-normative lang="en">normative</title-obligation-normative>
1233
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1234
-
1235
- <title-caution lang="en">CAUTION</title-caution>
1236
- <title-caution lang="zh">注意</title-caution>
1237
-
1238
- <title-warning lang="en">WARNING</title-warning>
1239
- <title-warning lang="zh">警告</title-warning>
1240
-
1241
- <title-amendment lang="en">AMENDMENT</title-amendment>
1242
-
1243
1151
  <title-continued lang="en">(continued)</title-continued>
1244
1152
  <title-continued lang="fr">(continué)</title-continued>
1245
1153
 
@@ -1343,11 +1251,14 @@
1343
1251
 
1344
1252
 
1345
1253
 
1254
+
1346
1255
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1347
1256
 
1348
1257
 
1349
1258
 
1259
+
1350
1260
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1261
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1351
1262
 
1352
1263
 
1353
1264
 
@@ -1364,7 +1275,6 @@
1364
1275
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1365
1276
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1366
1277
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1367
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1368
1278
 
1369
1279
 
1370
1280
 
@@ -1382,6 +1292,7 @@
1382
1292
 
1383
1293
 
1384
1294
 
1295
+
1385
1296
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1386
1297
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1387
1298
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1645,7 +1556,81 @@
1645
1556
 
1646
1557
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1647
1558
  <xsl:attribute name="line-height">135%</xsl:attribute>
1648
- </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">
1559
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
1560
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1561
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
1562
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1563
+
1564
+
1565
+
1566
+
1567
+
1568
+
1569
+
1570
+
1571
+
1572
+
1573
+
1574
+
1575
+
1576
+
1577
+
1578
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1579
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1580
+
1581
+
1582
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
1583
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1584
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1585
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1586
+ <xsl:attribute name="start-indent">0</xsl:attribute>
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
1605
+ <xsl:attribute name="text-align">justify</xsl:attribute>
1606
+ <xsl:attribute name="line-height">125%</xsl:attribute>
1607
+ <xsl:attribute name="margin-left">8mm</xsl:attribute>
1608
+
1609
+
1610
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
1611
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
1612
+
1613
+
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+
1621
+
1622
+
1623
+
1624
+
1625
+
1626
+
1627
+
1628
+ <xsl:attribute name="font-size">60%</xsl:attribute>
1629
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1630
+ <xsl:attribute name="padding-right">8mm</xsl:attribute>
1631
+
1632
+
1633
+ </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">
1649
1634
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1650
1635
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1651
1636
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1670,7 +1655,8 @@
1670
1655
  <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"/>
1671
1656
 
1672
1657
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1673
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1658
+
1659
+ <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']]">
1674
1660
  <xsl:sort select="@displayorder" data-type="number"/>
1675
1661
  <xsl:apply-templates select="." mode="contents"/>
1676
1662
  </xsl:for-each>
@@ -1680,7 +1666,7 @@
1680
1666
  <xsl:apply-templates select="." mode="contents"/>
1681
1667
  </xsl:for-each>
1682
1668
 
1683
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1669
+ <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')]]">
1684
1670
  <xsl:sort select="@displayorder" data-type="number"/>
1685
1671
  <xsl:apply-templates select="." mode="contents"/>
1686
1672
  </xsl:for-each>
@@ -2613,6 +2599,104 @@
2613
2599
 
2614
2600
  </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">
2615
2601
  <xsl:apply-templates/>
2602
+ </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">
2603
+
2604
+ <!-- list of footnotes to calculate actual footnotes number -->
2605
+ <xsl:variable name="p_fn_">
2606
+ <xsl:choose>
2607
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2608
+ <fn gen_id="{generate-id(.)}">
2609
+ <xsl:copy-of select="@*"/>
2610
+ <xsl:copy-of select="node()"/>
2611
+ </fn>
2612
+ </xsl:when>
2613
+ <xsl:otherwise>
2614
+ <!-- itetation for:
2615
+ footnotes in bibdata/title
2616
+ footnotes in bibliography
2617
+ footnotes in document's body (except table's head/body/foot and figure text)
2618
+ -->
2619
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2620
+ <fn gen_id="{generate-id(.)}">
2621
+ <xsl:copy-of select="@*"/>
2622
+ <xsl:copy-of select="node()"/>
2623
+ </fn>
2624
+ </xsl:for-each>
2625
+ <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']/*">
2626
+ <xsl:sort select="@displayorder" data-type="number"/>
2627
+ <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])]">
2628
+ <!-- copy unique fn -->
2629
+ <fn gen_id="{generate-id(.)}">
2630
+ <xsl:copy-of select="@*"/>
2631
+ <xsl:copy-of select="node()"/>
2632
+ </fn>
2633
+ </xsl:for-each>
2634
+ </xsl:for-each>
2635
+ </xsl:otherwise>
2636
+ </xsl:choose>
2637
+ </xsl:variable>
2638
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2639
+
2640
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
2641
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2642
+ <xsl:variable name="reference" select="@reference"/>
2643
+ <!-- fn sequence number in document -->
2644
+ <xsl:variable name="current_fn_number">
2645
+ <xsl:choose>
2646
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
2647
+ <xsl:otherwise>
2648
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2649
+ </xsl:otherwise>
2650
+ </xsl:choose>
2651
+ </xsl:variable>
2652
+ <xsl:variable name="current_fn_number_text">
2653
+ <xsl:value-of select="$current_fn_number"/>
2654
+
2655
+
2656
+ </xsl:variable>
2657
+
2658
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
2659
+ <xsl:variable name="footnote_inline">
2660
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
2661
+
2662
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
2663
+ <xsl:value-of select="$current_fn_number_text"/>
2664
+ </fo:basic-link>
2665
+ </fo:inline>
2666
+ </xsl:variable>
2667
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
2668
+ gen_id=<xsl:value-of select="$gen_id"/> -->
2669
+ <xsl:choose>
2670
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
2671
+ <xsl:copy-of select="$footnote_inline"/>
2672
+ </xsl:when>
2673
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
2674
+ <fo:footnote xsl:use-attribute-sets="fn-style">
2675
+ <xsl:copy-of select="$footnote_inline"/>
2676
+ <fo:footnote-body>
2677
+
2678
+ <fo:block-container text-indent="0" start-indent="0">
2679
+
2680
+
2681
+ <xsl:attribute name="margin-left">-8mm</xsl:attribute>
2682
+
2683
+ <fo:block xsl:use-attribute-sets="fn-body-style">
2684
+
2685
+
2686
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
2687
+
2688
+ <xsl:value-of select="$current_fn_number_text"/>
2689
+ </fo:inline>
2690
+ <xsl:apply-templates/>
2691
+ </fo:block>
2692
+ </fo:block-container>
2693
+ </fo:footnote-body>
2694
+ </fo:footnote>
2695
+ </xsl:when>
2696
+ <xsl:otherwise>
2697
+ <xsl:copy-of select="$footnote_inline"/>
2698
+ </xsl:otherwise>
2699
+ </xsl:choose>
2616
2700
  </xsl:template><xsl:template name="fn_display">
2617
2701
  <xsl:variable name="references">
2618
2702
 
@@ -2805,6 +2889,8 @@
2805
2889
 
2806
2890
  </fo:basic-link>
2807
2891
  </fo:inline>
2892
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2893
+ <fo:inline><xsl:value-of select="."/></fo:inline>
2808
2894
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2809
2895
  <fo:inline>
2810
2896
  <xsl:apply-templates/>
@@ -2853,12 +2939,9 @@
2853
2939
  <fo:block margin-bottom="12pt" text-align="left">
2854
2940
 
2855
2941
  <xsl:variable name="title-where">
2856
-
2857
-
2858
- <xsl:call-template name="getTitle">
2859
- <xsl:with-param name="name" select="'title-where'"/>
2860
- </xsl:call-template>
2861
-
2942
+ <xsl:call-template name="getLocalizedString">
2943
+ <xsl:with-param name="key">where</xsl:with-param>
2944
+ </xsl:call-template>
2862
2945
  </xsl:variable>
2863
2946
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2864
2947
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2874,12 +2957,9 @@
2874
2957
 
2875
2958
 
2876
2959
  <xsl:variable name="title-where">
2877
-
2878
-
2879
- <xsl:call-template name="getTitle">
2880
- <xsl:with-param name="name" select="'title-where'"/>
2881
- </xsl:call-template>
2882
-
2960
+ <xsl:call-template name="getLocalizedString">
2961
+ <xsl:with-param name="key">where</xsl:with-param>
2962
+ </xsl:call-template>
2883
2963
  </xsl:variable>
2884
2964
  <xsl:value-of select="$title-where"/>
2885
2965
  </fo:block>
@@ -2891,12 +2971,9 @@
2891
2971
 
2892
2972
 
2893
2973
  <xsl:variable name="title-key">
2894
-
2895
-
2896
- <xsl:call-template name="getTitle">
2897
- <xsl:with-param name="name" select="'title-key'"/>
2898
- </xsl:call-template>
2899
-
2974
+ <xsl:call-template name="getLocalizedString">
2975
+ <xsl:with-param name="key">key</xsl:with-param>
2976
+ </xsl:call-template>
2900
2977
  </xsl:variable>
2901
2978
  <xsl:value-of select="$title-key"/>
2902
2979
  </fo:block>
@@ -3162,6 +3239,7 @@
3162
3239
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3163
3240
  <xsl:apply-templates/>
3164
3241
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3242
+ <xsl:apply-templates select="@language"/>
3165
3243
  <xsl:apply-templates/>
3166
3244
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3167
3245
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -3223,6 +3301,15 @@
3223
3301
  </fo:inline>
3224
3302
  </xsl:template><xsl:template match="*[local-name()='add']">
3225
3303
  <xsl:choose>
3304
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3305
+ <fo:inline>
3306
+ <xsl:call-template name="insertTag">
3307
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3308
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3309
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3310
+ </xsl:call-template>
3311
+ </fo:inline>
3312
+ </xsl:when>
3226
3313
  <xsl:when test="@amendment">
3227
3314
  <fo:inline>
3228
3315
  <xsl:call-template name="insertTag">
@@ -3257,7 +3344,6 @@
3257
3344
  </fo:inline>
3258
3345
  </xsl:otherwise>
3259
3346
  </xsl:choose>
3260
-
3261
3347
  </xsl:template><xsl:template name="insertTag">
3262
3348
  <xsl:param name="type"/>
3263
3349
  <xsl:param name="kind"/>
@@ -3273,14 +3359,14 @@
3273
3359
  <xsl:attribute name="scaling">uniform</xsl:attribute>
3274
3360
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3275
3361
  <g>
3276
- <xsl:if test="$type = 'closing'">
3362
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3277
3363
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3278
3364
  </xsl:if>
3279
3365
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3280
3366
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3281
3367
  </g>
3282
3368
  <text font-family="Arial" x="15" y="57" font-size="40pt">
3283
- <xsl:if test="$type = 'closing'">
3369
+ <xsl:if test="$type = 'closing' or $type = 'end'">
3284
3370
  <xsl:attribute name="x">25</xsl:attribute>
3285
3371
  </xsl:if>
3286
3372
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -3773,9 +3859,9 @@
3773
3859
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3774
3860
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3775
3861
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3776
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3862
+ <xsl:apply-templates select="*[local-name()='name']"/>
3777
3863
  </fo:block>
3778
- <xsl:apply-templates/>
3864
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
3779
3865
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
3780
3866
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3781
3867
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -3795,22 +3881,6 @@
3795
3881
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3796
3882
  <xsl:apply-templates/>
3797
3883
  </fo:inline>
3798
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
3799
- <xsl:variable name="title-modified">
3800
-
3801
-
3802
- <xsl:call-template name="getTitle">
3803
- <xsl:with-param name="name" select="'title-modified'"/>
3804
- </xsl:call-template>
3805
-
3806
- </xsl:variable>
3807
-
3808
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3809
- <xsl:choose>
3810
- <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>
3811
- <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>
3812
- </xsl:choose>
3813
- <xsl:apply-templates/>
3814
3884
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3815
3885
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3816
3886
 
@@ -4388,20 +4458,67 @@
4388
4458
  </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">
4389
4459
  <xsl:apply-templates mode="contents"/>
4390
4460
  <xsl:text> </xsl:text>
4391
- </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">
4461
+ </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">
4392
4462
  <xsl:apply-templates mode="bookmarks"/>
4393
4463
  <xsl:text> </xsl:text>
4394
4464
  </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">
4395
4465
  <xsl:value-of select="."/>
4396
- </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">
4466
+ </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">
4397
4467
  <xsl:value-of select="."/>
4398
4468
  </xsl:template><xsl:template match="node()" mode="contents">
4399
4469
  <xsl:apply-templates mode="contents"/>
4470
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
4471
+ <xsl:variable name="level">
4472
+ <xsl:call-template name="getLevel">
4473
+ <xsl:with-param name="depth" select="@depth"/>
4474
+ </xsl:call-template>
4475
+ </xsl:variable>
4476
+
4477
+ <xsl:variable name="section">
4478
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4479
+ </xsl:variable>
4480
+
4481
+ <xsl:variable name="type">floating-title</xsl:variable>
4482
+
4483
+ <xsl:variable name="display">
4484
+ <xsl:choose>
4485
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
4486
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
4487
+ <xsl:otherwise>false</xsl:otherwise>
4488
+ </xsl:choose>
4489
+ </xsl:variable>
4490
+
4491
+ <xsl:variable name="skip">false</xsl:variable>
4492
+
4493
+ <xsl:if test="$skip = 'false'">
4494
+
4495
+ <xsl:variable name="title">
4496
+ <xsl:choose>
4497
+ <xsl:when test="*[local-name() = 'tab']">
4498
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
4499
+ </xsl:when>
4500
+ <xsl:otherwise>
4501
+ <xsl:copy-of select="node()"/>
4502
+ </xsl:otherwise>
4503
+ </xsl:choose>
4504
+ </xsl:variable>
4505
+
4506
+ <xsl:variable name="root">
4507
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
4508
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
4509
+ </xsl:variable>
4510
+
4511
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
4512
+ <title>
4513
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
4514
+ </title>
4515
+ </item>
4516
+ </xsl:if>
4400
4517
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4401
4518
  <xsl:apply-templates mode="bookmarks"/>
4402
4519
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4403
4520
  <xsl:apply-templates select="."/>
4404
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4521
+ </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">
4405
4522
  <xsl:apply-templates mode="bookmarks"/>
4406
4523
  </xsl:template><xsl:template name="addBookmarks">
4407
4524
  <xsl:param name="contents"/>
@@ -4572,7 +4689,10 @@
4572
4689
  </fo:block>
4573
4690
  </xsl:if>
4574
4691
  </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">
4575
- <xsl:apply-templates mode="contents_item"/>
4692
+ <xsl:param name="mode">bookmarks</xsl:param>
4693
+ <xsl:apply-templates mode="contents_item">
4694
+ <xsl:with-param name="mode" select="$mode"/>
4695
+ </xsl:apply-templates>
4576
4696
  <!-- <xsl:text> </xsl:text> -->
4577
4697
  </xsl:template><xsl:template name="getSection">
4578
4698
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -4645,6 +4765,18 @@
4645
4765
  <xsl:copy-of select="."/>
4646
4766
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4647
4767
  <xsl:text> </xsl:text>
4768
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
4769
+ <xsl:param name="mode">bookmarks</xsl:param>
4770
+ <xsl:apply-templates mode="contents_item">
4771
+ <xsl:with-param name="mode" select="$mode"/>
4772
+ </xsl:apply-templates>
4773
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
4774
+ <xsl:param name="mode">bookmarks</xsl:param>
4775
+ <xsl:if test="$mode = 'contents'">
4776
+ <xsl:copy>
4777
+ <xsl:apply-templates mode="contents_item"/>
4778
+ </xsl:copy>
4779
+ </xsl:if>
4648
4780
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4649
4781
 
4650
4782
  <fo:block-container margin-left="0mm">
@@ -4663,6 +4795,8 @@
4663
4795
 
4664
4796
 
4665
4797
 
4798
+
4799
+
4666
4800
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4667
4801
  <xsl:variable name="_font-size">
4668
4802
 
@@ -4696,13 +4830,17 @@
4696
4830
 
4697
4831
 
4698
4832
 
4833
+
4834
+
4699
4835
  <xsl:apply-templates/>
4700
4836
  </fo:block>
4701
-
4837
+
4702
4838
 
4703
4839
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4704
4840
 
4705
4841
 
4842
+
4843
+
4706
4844
  </fo:block-container>
4707
4845
  </fo:block-container>
4708
4846
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4975,42 +5113,48 @@
4975
5113
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4976
5114
 
4977
5115
 
4978
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4979
-
4980
- <xsl:variable name="element">
5116
+ <xsl:variable name="fo_element">
5117
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
4981
5118
  block
4982
5119
 
4983
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5120
+
4984
5121
  </xsl:variable>
4985
5122
 
5123
+ <!-- display 'EXAMPLE' -->
5124
+ <xsl:apply-templates select="*[local-name()='name']">
5125
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5126
+ </xsl:apply-templates>
5127
+
4986
5128
  <xsl:choose>
4987
- <xsl:when test="contains(normalize-space($element), 'block')">
4988
- <fo:block xsl:use-attribute-sets="example-body-style">
4989
- <xsl:apply-templates/>
4990
- </fo:block>
5129
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5130
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
5131
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5132
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5133
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5134
+ </xsl:apply-templates>
5135
+ </fo:block-container>
5136
+ </fo:block-container>
4991
5137
  </xsl:when>
4992
5138
  <xsl:otherwise>
4993
5139
  <fo:inline>
4994
- <xsl:apply-templates/>
5140
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
5141
+ <xsl:with-param name="fo_element" select="$fo_element"/>
5142
+ </xsl:apply-templates>
4995
5143
  </fo:inline>
4996
5144
  </xsl:otherwise>
4997
5145
  </xsl:choose>
4998
5146
 
4999
5147
  </fo:block>
5000
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
5001
-
5002
- <xsl:variable name="element">
5003
- block
5004
-
5005
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5006
- </xsl:variable>
5148
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
5149
+ <xsl:param name="fo_element">block</xsl:param>
5150
+
5007
5151
  <xsl:choose>
5008
5152
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
5009
5153
  <fo:inline>
5010
5154
  <xsl:apply-templates/>
5011
5155
  </fo:inline>
5012
5156
  </xsl:when>
5013
- <xsl:when test="contains(normalize-space($element), 'block')">
5157
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
5014
5158
  <fo:block xsl:use-attribute-sets="example-name-style">
5015
5159
  <xsl:apply-templates/>
5016
5160
  </fo:block>
@@ -5023,17 +5167,17 @@
5023
5167
  </xsl:choose>
5024
5168
 
5025
5169
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5170
+ <xsl:param name="fo_element">block</xsl:param>
5171
+
5026
5172
  <xsl:variable name="num"><xsl:number/></xsl:variable>
5027
5173
  <xsl:variable name="element">
5028
- block
5029
-
5030
5174
 
5175
+ <xsl:value-of select="$fo_element"/>
5031
5176
  </xsl:variable>
5032
5177
  <xsl:choose>
5033
- <xsl:when test="normalize-space($element) = 'block'">
5178
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
5034
5179
  <fo:block xsl:use-attribute-sets="example-p-style">
5035
5180
 
5036
- <xsl:variable name="num"><xsl:number/></xsl:variable>
5037
5181
  <xsl:if test="$num = 1">
5038
5182
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
5039
5183
  </xsl:if>
@@ -5054,45 +5198,66 @@
5054
5198
  <xsl:variable name="termsource_text">
5055
5199
  <xsl:apply-templates/>
5056
5200
  </xsl:variable>
5057
-
5058
- <xsl:choose>
5201
+ <xsl:copy-of select="$termsource_text"/>
5202
+ <!-- <xsl:choose>
5059
5203
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5060
- <!-- <xsl:apply-templates /> -->
5061
5204
  <xsl:copy-of select="$termsource_text"/>
5062
5205
  </xsl:when>
5063
5206
  <xsl:otherwise>
5064
-
5065
-
5207
+ <xsl:if test="$namespace = 'bsi'">
5208
+ <xsl:choose>
5209
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
5210
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
5211
+ </xsl:choose>
5212
+ </xsl:if>
5213
+ <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'">
5066
5214
  <xsl:text>[</xsl:text>
5067
-
5068
- <!-- <xsl:apply-templates /> -->
5215
+ </xsl:if>
5069
5216
  <xsl:copy-of select="$termsource_text"/>
5070
-
5071
-
5217
+ <xsl:if test="$namespace = 'bsi'">
5218
+ <xsl:choose>
5219
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
5220
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
5221
+ </xsl:choose>
5222
+ </xsl:if>
5223
+ <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'">
5072
5224
  <xsl:text>]</xsl:text>
5073
-
5225
+ </xsl:if>
5074
5226
  </xsl:otherwise>
5075
- </xsl:choose>
5227
+ </xsl:choose> -->
5076
5228
  </fo:block>
5077
5229
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5078
5230
  <xsl:if test="normalize-space() != ''">
5079
5231
  <xsl:value-of select="."/>
5080
5232
  </xsl:if>
5081
- </xsl:template><xsl:variable name="localized.source">
5082
- <xsl:call-template name="getLocalizedString">
5083
- <xsl:with-param name="key">source</xsl:with-param>
5084
- </xsl:call-template>
5085
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5233
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
5234
+ <fo:inline>
5235
+
5236
+
5237
+ <xsl:value-of select="."/>
5238
+ </fo:inline>
5239
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
5086
5240
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5087
5241
  <xsl:if test="normalize-space(@citeas) = ''">
5088
5242
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5089
5243
  </xsl:if>
5090
-
5091
5244
  <fo:inline xsl:use-attribute-sets="origin-style">
5092
5245
  <xsl:apply-templates/>
5093
5246
  </fo:inline>
5094
-
5095
- </fo:basic-link>
5247
+ </fo:basic-link>
5248
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
5249
+ <xsl:variable name="title-modified">
5250
+ <xsl:call-template name="getLocalizedString">
5251
+ <xsl:with-param name="key">modified</xsl:with-param>
5252
+ </xsl:call-template>
5253
+ </xsl:variable>
5254
+
5255
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
5256
+ <xsl:choose>
5257
+ <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>
5258
+ <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>
5259
+ </xsl:choose>
5260
+ <xsl:apply-templates/>
5096
5261
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5097
5262
  <fo:inline><xsl:apply-templates/></fo:inline>
5098
5263
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -5275,25 +5440,29 @@
5275
5440
  </fo:block>
5276
5441
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5277
5442
  <xsl:variable name="title-deprecated">
5278
-
5279
-
5280
- <xsl:call-template name="getTitle">
5281
- <xsl:with-param name="name" select="'title-deprecated'"/>
5282
- </xsl:call-template>
5283
-
5443
+ <xsl:call-template name="getLocalizedString">
5444
+ <xsl:with-param name="key">deprecated</xsl:with-param>
5445
+ </xsl:call-template>
5284
5446
  </xsl:variable>
5285
5447
  <fo:block xsl:use-attribute-sets="deprecates-style">
5286
5448
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
5287
5449
  </fo:block>
5450
+ </xsl:template><xsl:template name="setStyle_preferred">
5451
+ <xsl:if test="*[local-name() = 'strong']">
5452
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
5453
+ </xsl:if>
5454
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
5455
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
5288
5456
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
5289
5457
  <fo:block xsl:use-attribute-sets="definition-style">
5290
5458
  <xsl:apply-templates/>
5291
5459
  </fo:block>
5292
5460
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
5293
5461
  <xsl:apply-templates/>
5294
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
5462
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
5295
5463
  <fo:inline> <xsl:apply-templates/></fo:inline>
5296
- <fo:block> </fo:block>
5464
+ <!-- <fo:block>&#xA0;</fo:block> -->
5465
+ <fo:block/>
5297
5466
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
5298
5467
 
5299
5468
  <fo:block>
@@ -5359,6 +5528,51 @@
5359
5528
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
5360
5529
  <!-- 0xA0 to space replacement -->
5361
5530
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5531
+ </xsl:template><xsl:variable name="ul_labels_">
5532
+
5533
+
5534
+
5535
+
5536
+
5537
+
5538
+
5539
+
5540
+
5541
+
5542
+
5543
+
5544
+
5545
+
5546
+
5547
+
5548
+ <label>•</label>
5549
+
5550
+
5551
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5552
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5553
+ <xsl:variable name="list_level">
5554
+ <xsl:choose>
5555
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
5556
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
5557
+ </xsl:choose>
5558
+ </xsl:variable>
5559
+ <xsl:choose>
5560
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
5561
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
5562
+ </xsl:when>
5563
+ <xsl:when test="$list_level mod 3 = 0">
5564
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
5565
+ </xsl:when>
5566
+ <xsl:when test="$list_level mod 2 = 0">
5567
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
5568
+ </xsl:when>
5569
+ <xsl:otherwise>
5570
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
5571
+ </xsl:otherwise>
5572
+ </xsl:choose>
5573
+ </xsl:template><xsl:template match="label" mode="ul_labels">
5574
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5575
+ <xsl:value-of select="."/>
5362
5576
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5363
5577
  <xsl:choose>
5364
5578
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5569,16 +5783,30 @@
5569
5783
 
5570
5784
 
5571
5785
 
5572
-
5786
+
5787
+
5788
+
5789
+
5790
+
5791
+
5573
5792
 
5574
5793
 
5575
5794
 
5576
5795
 
5577
5796
 
5797
+
5798
+
5799
+
5800
+
5801
+ <!-- end MPFD bibitem processing -->
5578
5802
 
5803
+ <!-- start M3D bibitem processing -->
5804
+
5805
+
5806
+
5579
5807
 
5580
5808
  </xsl:template><xsl:template name="processBibitemDocId">
5581
- <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')]"/>
5809
+ <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')]"/>
5582
5810
  <xsl:choose>
5583
5811
  <xsl:when test="normalize-space($_doc_ident) != ''">
5584
5812
  <!-- <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"/>
@@ -5592,7 +5820,7 @@
5592
5820
  <xsl:if test="$type != ''">
5593
5821
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5594
5822
  </xsl:if> -->
5595
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5823
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
5596
5824
  </xsl:otherwise>
5597
5825
  </xsl:choose>
5598
5826
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -5697,7 +5925,35 @@
5697
5925
  <fo:block-container border="1pt solid black" width="50%">
5698
5926
  <fo:block> </fo:block>
5699
5927
  </fo:block-container>
5700
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
5928
+ </xsl:template><xsl:variable name="toc_level">
5929
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
5930
+ <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:-->
5931
+ <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 -->
5932
+ <xsl:choose>
5933
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
5934
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
5935
+ <xsl:otherwise><!-- default value -->
5936
+
5937
+
5938
+
5939
+
5940
+
5941
+
5942
+
5943
+
5944
+
5945
+
5946
+
5947
+
5948
+
5949
+
5950
+
5951
+
5952
+ 3
5953
+
5954
+ </xsl:otherwise>
5955
+ </xsl:choose>
5956
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
5701
5957
  <xsl:param name="colwidths"/>
5702
5958
  <xsl:variable name="colwidths_">
5703
5959
  <xsl:choose>
@@ -5777,7 +6033,7 @@
5777
6033
  </td>
5778
6034
  </xsl:for-each>
5779
6035
  <td>333</td> <!-- page number, just for fill -->
5780
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6036
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5781
6037
  <fo:inline padding-right="5mm"> </fo:inline>
5782
6038
  <fo:inline><xsl:apply-templates/></fo:inline>
5783
6039
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -5788,6 +6044,10 @@
5788
6044
  </svg>
5789
6045
  </fo:instream-foreign-object>
5790
6046
  </fo:inline>
6047
+ </xsl:template><xsl:template match="@language">
6048
+ <xsl:copy-of select="."/>
6049
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
6050
+ <xsl:call-template name="title"/>
5791
6051
  </xsl:template><xsl:template name="convertDate">
5792
6052
  <xsl:param name="date"/>
5793
6053
  <xsl:param name="format" select="'short'"/>
@@ -6145,9 +6405,15 @@
6145
6405
  </xsl:template><xsl:template name="getLocalizedString">
6146
6406
  <xsl:param name="key"/>
6147
6407
  <xsl:param name="formatted">false</xsl:param>
6408
+ <xsl:param name="lang"/>
6148
6409
 
6149
6410
  <xsl:variable name="curr_lang">
6150
- <xsl:call-template name="getLang"/>
6411
+ <xsl:choose>
6412
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6413
+ <xsl:otherwise>
6414
+ <xsl:call-template name="getLang"/>
6415
+ </xsl:otherwise>
6416
+ </xsl:choose>
6151
6417
  </xsl:variable>
6152
6418
 
6153
6419
  <xsl:variable name="data_value">
@@ -6337,4 +6603,14 @@
6337
6603
  </xsl:otherwise>
6338
6604
  </xsl:choose>
6339
6605
  </xsl:if>
6606
+ </xsl:template><xsl:template name="setAltText">
6607
+ <xsl:param name="value"/>
6608
+ <xsl:attribute name="fox:alt-text">
6609
+ <xsl:choose>
6610
+ <xsl:when test="normalize-space($value) != ''">
6611
+ <xsl:value-of select="$value"/>
6612
+ </xsl:when>
6613
+ <xsl:otherwise>_</xsl:otherwise>
6614
+ </xsl:choose>
6615
+ </xsl:attribute>
6340
6616
  </xsl:template></xsl:stylesheet>