metanorma-mpfa 0.6.0 → 0.6.5

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.
@@ -32,6 +32,9 @@
32
32
  <optional>
33
33
  <ref name="doctype"/>
34
34
  </optional>
35
+ <optional>
36
+ <ref name="docsubtype"/>
37
+ </optional>
35
38
  <ref name="editorialgroup"/>
36
39
  <zeroOrMore>
37
40
  <ref name="ics"/>
@@ -10,7 +10,7 @@ module IsoDoc
10
10
  @meta = Metadata.new(lang, script, labels)
11
11
  end
12
12
 
13
- def xref_init(lang, script, klass, labels, options)
13
+ def xref_init(lang, script, _klass, labels, options)
14
14
  html = HtmlConvert.new(language: lang, script: script)
15
15
  @xrefs = Xref.new(lang, script, html, labels, options)
16
16
  end
@@ -25,4 +25,3 @@ module IsoDoc
25
25
  end
26
26
  end
27
27
  end
28
-
@@ -1,15 +1,15 @@
1
1
  require "isodoc"
2
2
  require "twitter_cldr"
3
- require 'date'
3
+ require "date"
4
4
 
5
5
  module IsoDoc
6
6
  module MPFA
7
-
8
7
  class Metadata < IsoDoc::Metadata
9
8
  def initialize(lang, script, labels)
10
9
  super
11
- here = File.dirname(__FILE__)
12
- set(:logo, File.expand_path(File.join(here, "html", "mpfa-logo-no-text@4x.png")))
10
+ here = File.dirname(__FILE__)
11
+ set(:logo, File.expand_path(File.join(here, "html",
12
+ "mpfa-logo-no-text@4x.png")))
13
13
  end
14
14
 
15
15
  def title(isoxml, _out)
@@ -32,10 +32,10 @@ module IsoDoc
32
32
  end
33
33
 
34
34
  def doctype(isoxml, _out)
35
- b = isoxml&.at(ns("//bibdata/ext/doctype"))&.text || return
36
- return unless b
37
- t = b.split(/[- ]/).
38
- map{ |w| w.capitalize unless w == "MPF" }.join(" ")
35
+ b = isoxml&.at(ns("//bibdata/ext/doctype"))&.text or return
36
+
37
+ t = b.split(/[- ]/)
38
+ .map { |w| w.capitalize unless w == "MPF" }.join(" ")
39
39
  set(:doctype, t)
40
40
  end
41
41
 
@@ -51,21 +51,21 @@ module IsoDoc
51
51
 
52
52
  def version(isoxml, _out)
53
53
  super
54
- edition = isoxml.at(ns("//version/edition"))
54
+ edition = isoxml.at(ns("//bibdata/version/edition"))
55
55
  if edition
56
56
  set(
57
57
  :edition,
58
- edition.text.to_i.localize.
59
- to_rbnf_s("SpelloutRules", "spellout-ordinal").
60
- split(/(\W)/).map(&:capitalize).join
58
+ edition.text.to_i.localize
59
+ .to_rbnf_s("SpelloutRules", "spellout-ordinal")
60
+ .split(/(\W)/).map(&:capitalize).join,
61
61
  )
62
62
  end
63
63
  end
64
64
 
65
65
  def monthyr(isodate)
66
66
  date = DateTime.parse(isodate)
67
- date.strftime('%-d %B %Y') #=> "Sun 04 Feb 2001"
68
- rescue
67
+ date.strftime("%-d %B %Y") #=> "Sun 04 Feb 2001"
68
+ rescue StandardError
69
69
  # invalid dates get thrown
70
70
  isodate
71
71
  end
@@ -912,6 +912,9 @@
912
912
  <title-continued lang="en">(continued)</title-continued>
913
913
  <title-continued lang="fr">(continué)</title-continued>
914
914
 
915
+ </xsl:variable><xsl:variable name="bibdata">
916
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
917
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
915
918
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
916
919
  <xsl:param name="name"/>
917
920
  <xsl:param name="lang"/>
@@ -937,13 +940,16 @@
937
940
  </xsl:choose>
938
941
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
939
942
 
943
+
940
944
  </xsl:attribute-set><xsl:attribute-set name="link-style">
941
945
 
946
+
942
947
  <xsl:attribute name="color">blue</xsl:attribute>
943
948
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
944
949
 
945
950
 
946
951
 
952
+
947
953
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
948
954
  <xsl:attribute name="white-space">pre</xsl:attribute>
949
955
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -985,7 +991,7 @@
985
991
 
986
992
 
987
993
 
988
-
994
+
989
995
  </xsl:attribute-set><xsl:attribute-set name="example-style">
990
996
 
991
997
 
@@ -998,6 +1004,7 @@
998
1004
 
999
1005
 
1000
1006
 
1007
+
1001
1008
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1002
1009
 
1003
1010
 
@@ -1017,9 +1024,7 @@
1017
1024
 
1018
1025
 
1019
1026
 
1020
-
1021
-
1022
-
1027
+
1023
1028
 
1024
1029
 
1025
1030
 
@@ -1052,8 +1057,10 @@
1052
1057
 
1053
1058
 
1054
1059
 
1060
+
1055
1061
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1056
1062
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1063
+
1057
1064
 
1058
1065
 
1059
1066
 
@@ -1070,6 +1077,9 @@
1070
1077
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1071
1078
 
1072
1079
 
1080
+
1081
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1082
+
1073
1083
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1074
1084
 
1075
1085
 
@@ -1081,10 +1091,12 @@
1081
1091
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
1082
1092
 
1083
1093
 
1094
+
1084
1095
  <xsl:attribute name="color">blue</xsl:attribute>
1085
1096
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1086
1097
 
1087
1098
 
1099
+
1088
1100
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1089
1101
 
1090
1102
 
@@ -1093,10 +1105,12 @@
1093
1105
 
1094
1106
 
1095
1107
 
1108
+
1096
1109
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1097
1110
 
1098
1111
 
1099
1112
 
1113
+
1100
1114
 
1101
1115
 
1102
1116
 
@@ -1108,6 +1122,7 @@
1108
1122
 
1109
1123
 
1110
1124
 
1125
+
1111
1126
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1112
1127
 
1113
1128
 
@@ -1121,6 +1136,7 @@
1121
1136
 
1122
1137
 
1123
1138
 
1139
+
1124
1140
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1125
1141
 
1126
1142
 
@@ -1141,9 +1157,13 @@
1141
1157
 
1142
1158
 
1143
1159
 
1160
+
1161
+
1144
1162
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1163
+
1145
1164
 
1146
1165
 
1166
+
1147
1167
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1148
1168
 
1149
1169
 
@@ -1167,14 +1187,18 @@
1167
1187
 
1168
1188
 
1169
1189
 
1190
+
1191
+
1170
1192
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1171
1193
 
1172
1194
 
1173
1195
 
1196
+
1174
1197
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1175
1198
 
1176
1199
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1177
1200
 
1201
+
1178
1202
 
1179
1203
 
1180
1204
 
@@ -1188,6 +1212,7 @@
1188
1212
 
1189
1213
 
1190
1214
 
1215
+
1191
1216
 
1192
1217
 
1193
1218
 
@@ -1208,10 +1233,12 @@
1208
1233
 
1209
1234
 
1210
1235
 
1236
+
1211
1237
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1212
1238
 
1213
1239
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1214
1240
 
1241
+
1215
1242
  <xsl:attribute name="width">100%</xsl:attribute>
1216
1243
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1217
1244
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -1236,18 +1263,35 @@
1236
1263
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1237
1264
 
1238
1265
 
1266
+
1239
1267
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1240
1268
 
1269
+
1241
1270
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1242
1271
 
1243
1272
 
1244
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1273
+
1274
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1275
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1276
+ </xsl:variable><xsl:attribute-set name="add-style">
1245
1277
  <xsl:attribute name="color">red</xsl:attribute>
1246
1278
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1247
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1248
- <xsl:attribute name="color">red</xsl:attribute>
1279
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1280
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1281
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1282
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1283
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1284
+ <xsl:text>red</xsl:text>
1285
+ </xsl:variable><xsl:attribute-set name="del-style">
1286
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1249
1287
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1250
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1288
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1289
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1290
+
1291
+
1292
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1293
+
1294
+ </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="processPrefaceSectionsDefault_Contents">
1251
1295
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1252
1296
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1253
1297
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1292,18 +1336,19 @@
1292
1336
  <xsl:call-template name="add-zero-spaces-java"/>
1293
1337
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1294
1338
 
1339
+ <xsl:variable name="table-preamble">
1340
+
1341
+
1342
+ </xsl:variable>
1343
+
1295
1344
  <xsl:variable name="table">
1296
1345
 
1297
1346
  <xsl:variable name="simple-table">
1298
- <xsl:call-template name="getSimpleTable"/>
1347
+ <xsl:call-template name="getSimpleTable"/>
1299
1348
  </xsl:variable>
1300
1349
 
1301
-
1302
-
1303
-
1304
-
1305
1350
  <!-- <xsl:if test="$namespace = 'bipm'">
1306
- <fo:block>&#xA0;</fo:block>
1351
+ <fo:block>&#xA0;</fo:block>
1307
1352
  </xsl:if> -->
1308
1353
 
1309
1354
  <!-- $namespace = 'iso' or -->
@@ -1316,7 +1361,7 @@
1316
1361
 
1317
1362
 
1318
1363
 
1319
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1364
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1320
1365
 
1321
1366
  <!-- <xsl:variable name="cols-count">
1322
1367
  <xsl:choose>
@@ -1335,8 +1380,6 @@
1335
1380
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1336
1381
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1337
1382
 
1338
-
1339
-
1340
1383
  <xsl:variable name="colwidths">
1341
1384
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1342
1385
  <xsl:call-template name="calculate-column-widths">
@@ -1364,9 +1407,11 @@
1364
1407
  </xsl:choose>
1365
1408
  </xsl:variable>
1366
1409
 
1410
+
1367
1411
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1368
1412
 
1369
1413
 
1414
+
1370
1415
 
1371
1416
 
1372
1417
 
@@ -1377,6 +1422,8 @@
1377
1422
 
1378
1423
 
1379
1424
 
1425
+
1426
+
1380
1427
  <xsl:attribute name="space-after">12pt</xsl:attribute>
1381
1428
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1382
1429
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1399,6 +1446,8 @@
1399
1446
 
1400
1447
 
1401
1448
 
1449
+
1450
+
1402
1451
 
1403
1452
 
1404
1453
 
@@ -1408,6 +1457,7 @@
1408
1457
  <attribute name="border-bottom">2pt solid black</attribute>
1409
1458
 
1410
1459
 
1460
+
1411
1461
  </xsl:variable>
1412
1462
 
1413
1463
 
@@ -1491,7 +1541,8 @@
1491
1541
  </fo:block-container>
1492
1542
  </xsl:variable>
1493
1543
 
1494
-
1544
+ <xsl:variable name="isAdded" select="@added"/>
1545
+ <xsl:variable name="isDeleted" select="@deleted"/>
1495
1546
 
1496
1547
  <xsl:choose>
1497
1548
  <xsl:when test="@width">
@@ -1505,7 +1556,14 @@
1505
1556
  <fo:table-body>
1506
1557
  <fo:table-row>
1507
1558
  <fo:table-cell column-number="2">
1508
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1559
+ <xsl:copy-of select="$table-preamble"/>
1560
+ <fo:block>
1561
+ <xsl:call-template name="setTrackChangesStyles">
1562
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1563
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1564
+ </xsl:call-template>
1565
+ <xsl:copy-of select="$table"/>
1566
+ </fo:block>
1509
1567
  </fo:table-cell>
1510
1568
  </fo:table-row>
1511
1569
  </fo:table-body>
@@ -1516,16 +1574,45 @@
1516
1574
 
1517
1575
  </xsl:when>
1518
1576
  <xsl:otherwise>
1519
- <xsl:copy-of select="$table"/>
1577
+ <xsl:choose>
1578
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1579
+ <xsl:copy-of select="$table-preamble"/>
1580
+ <fo:block>
1581
+ <xsl:call-template name="setTrackChangesStyles">
1582
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1583
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1584
+ </xsl:call-template>
1585
+ <xsl:copy-of select="$table"/>
1586
+ </fo:block>
1587
+ </xsl:when>
1588
+ <xsl:otherwise>
1589
+ <xsl:copy-of select="$table-preamble"/>
1590
+ <xsl:copy-of select="$table"/>
1591
+ </xsl:otherwise>
1592
+ </xsl:choose>
1520
1593
  </xsl:otherwise>
1521
1594
  </xsl:choose>
1522
1595
 
1523
1596
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1597
+ <xsl:param name="continued"/>
1524
1598
  <xsl:if test="normalize-space() != ''">
1525
1599
  <fo:block xsl:use-attribute-sets="table-name-style">
1526
1600
 
1527
1601
 
1528
- <xsl:apply-templates/>
1602
+
1603
+
1604
+
1605
+ <xsl:choose>
1606
+ <xsl:when test="$continued = 'true'">
1607
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1608
+
1609
+ </xsl:when>
1610
+ <xsl:otherwise>
1611
+ <xsl:apply-templates/>
1612
+ </xsl:otherwise>
1613
+ </xsl:choose>
1614
+
1615
+
1529
1616
  </fo:block>
1530
1617
  </xsl:if>
1531
1618
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1577,7 +1664,7 @@
1577
1664
  </xsl:for-each>
1578
1665
  </xsl:when>
1579
1666
  <xsl:otherwise>
1580
- <xsl:for-each select="xalan:nodeset($table)//tr">
1667
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1581
1668
  <xsl:variable name="td_text">
1582
1669
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1583
1670
 
@@ -1662,21 +1749,22 @@
1662
1749
  <!-- font-weight="bold" -->
1663
1750
  <fo:table-header>
1664
1751
 
1752
+
1665
1753
  <xsl:apply-templates/>
1666
1754
  </fo:table-header>
1667
1755
  </xsl:template><xsl:template name="table-header-title">
1668
- <xsl:param name="cols-count"/>
1756
+ <xsl:param name="cols-count"/>
1669
1757
  <!-- row for title -->
1670
1758
  <fo:table-row>
1671
1759
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
1672
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1760
+
1761
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1762
+ <xsl:with-param name="continued">true</xsl:with-param>
1763
+ </xsl:apply-templates>
1673
1764
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1674
1765
  <xsl:call-template name="fn_name_display"/>
1675
- </xsl:for-each>
1676
- <fo:block text-align="right" font-style="italic">
1677
- <xsl:text> </xsl:text>
1678
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1679
- </fo:block>
1766
+ </xsl:for-each>
1767
+
1680
1768
  </fo:table-cell>
1681
1769
  </fo:table-row>
1682
1770
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -1897,6 +1985,7 @@
1897
1985
 
1898
1986
 
1899
1987
 
1988
+
1900
1989
  </xsl:if>
1901
1990
  <xsl:if test="$parent-name = 'tfoot'">
1902
1991
 
@@ -1906,6 +1995,10 @@
1906
1995
 
1907
1996
 
1908
1997
 
1998
+
1999
+
2000
+
2001
+
1909
2002
  <!-- <xsl:if test="$namespace = 'bipm'">
1910
2003
  <xsl:attribute name="height">8mm</xsl:attribute>
1911
2004
  </xsl:if> -->
@@ -1917,7 +2010,8 @@
1917
2010
  <xsl:attribute name="text-align">
1918
2011
  <xsl:choose>
1919
2012
  <xsl:when test="@align">
1920
- <xsl:value-of select="@align"/>
2013
+ <xsl:call-template name="setAlignment"/>
2014
+ <!-- <xsl:value-of select="@align"/> -->
1921
2015
  </xsl:when>
1922
2016
  <xsl:otherwise>center</xsl:otherwise>
1923
2017
  </xsl:choose>
@@ -1931,11 +2025,16 @@
1931
2025
 
1932
2026
 
1933
2027
 
2028
+
1934
2029
 
1935
2030
  <xsl:attribute name="border-top">solid black 2pt</xsl:attribute>
1936
2031
  <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute>
1937
2032
 
1938
2033
 
2034
+
2035
+ <xsl:if test="$lang = 'ar'">
2036
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2037
+ </xsl:if>
1939
2038
  <xsl:if test="@colspan">
1940
2039
  <xsl:attribute name="number-columns-spanned">
1941
2040
  <xsl:value-of select="@colspan"/>
@@ -1967,11 +2066,19 @@
1967
2066
  <xsl:attribute name="text-align">
1968
2067
  <xsl:choose>
1969
2068
  <xsl:when test="@align">
1970
- <xsl:value-of select="@align"/>
2069
+ <xsl:call-template name="setAlignment"/>
2070
+ <!-- <xsl:value-of select="@align"/> -->
1971
2071
  </xsl:when>
1972
2072
  <xsl:otherwise>left</xsl:otherwise>
1973
2073
  </xsl:choose>
1974
2074
  </xsl:attribute>
2075
+ <xsl:if test="$lang = 'ar'">
2076
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2077
+ </xsl:if>
2078
+
2079
+
2080
+
2081
+
1975
2082
 
1976
2083
 
1977
2084
 
@@ -1983,6 +2090,9 @@
1983
2090
 
1984
2091
 
1985
2092
 
2093
+ <xsl:if test=".//*[local-name() = 'table']">
2094
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2095
+ </xsl:if>
1986
2096
  <xsl:if test="@colspan">
1987
2097
  <xsl:attribute name="number-columns-spanned">
1988
2098
  <xsl:value-of select="@colspan"/>
@@ -2108,13 +2218,13 @@
2108
2218
  </xsl:choose>
2109
2219
  </xsl:variable>
2110
2220
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2111
- <xsl:element name="{$ns}:table">
2221
+ <!-- <xsl:element name="{$ns}:table"> -->
2112
2222
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2113
2223
  <tbody>
2114
2224
  <xsl:apply-templates mode="dl"/>
2115
2225
  </tbody>
2116
2226
  </xsl:for-each>
2117
- </xsl:element>
2227
+ <!-- </xsl:element> -->
2118
2228
  </xsl:variable>
2119
2229
 
2120
2230
  <xsl:call-template name="calculate-column-widths">
@@ -2193,6 +2303,7 @@
2193
2303
 
2194
2304
 
2195
2305
 
2306
+
2196
2307
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2197
2308
 
2198
2309
 
@@ -2205,6 +2316,8 @@
2205
2316
  <xsl:apply-templates/>
2206
2317
  </fo:inline>
2207
2318
  </xsl:template><xsl:template match="*[local-name()='dl']">
2319
+ <xsl:variable name="isAdded" select="@added"/>
2320
+ <xsl:variable name="isDeleted" select="@deleted"/>
2208
2321
  <fo:block-container>
2209
2322
 
2210
2323
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2221,6 +2334,12 @@
2221
2334
  </xsl:attribute>
2222
2335
 
2223
2336
  </xsl:if>
2337
+
2338
+ <xsl:call-template name="setTrackChangesStyles">
2339
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2340
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2341
+ </xsl:call-template>
2342
+
2224
2343
  <fo:block-container>
2225
2344
 
2226
2345
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2276,6 +2395,7 @@
2276
2395
 
2277
2396
 
2278
2397
 
2398
+
2279
2399
  <xsl:variable name="title-key">
2280
2400
 
2281
2401
 
@@ -2328,11 +2448,11 @@
2328
2448
  </xsl:choose>
2329
2449
  </xsl:variable>
2330
2450
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2331
- <xsl:element name="{$ns}:table">
2451
+ <!-- <xsl:element name="{$ns}:table"> -->
2332
2452
  <tbody>
2333
2453
  <xsl:apply-templates mode="dl"/>
2334
2454
  </tbody>
2335
- </xsl:element>
2455
+ <!-- </xsl:element> -->
2336
2456
  </xsl:variable>
2337
2457
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2338
2458
  <xsl:variable name="colwidths">
@@ -2486,6 +2606,7 @@
2486
2606
 
2487
2607
  <fo:table-row>
2488
2608
 
2609
+
2489
2610
  <fo:table-cell>
2490
2611
 
2491
2612
  <fo:block margin-top="6pt">
@@ -2501,6 +2622,7 @@
2501
2622
 
2502
2623
 
2503
2624
 
2625
+
2504
2626
  <xsl:apply-templates/>
2505
2627
  <!-- <xsl:if test="$namespace = 'gb'">
2506
2628
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2557,6 +2679,8 @@
2557
2679
 
2558
2680
  <xsl:apply-templates/>
2559
2681
  </fo:inline>
2682
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2683
+ <fo:inline padding-right="{@value}"> </fo:inline>
2560
2684
  </xsl:template><xsl:template match="*[local-name()='sup']">
2561
2685
  <fo:inline font-size="80%" vertical-align="super">
2562
2686
  <xsl:apply-templates/>
@@ -2582,6 +2706,7 @@
2582
2706
 
2583
2707
 
2584
2708
 
2709
+
2585
2710
 
2586
2711
  </xsl:variable>
2587
2712
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2600,9 +2725,71 @@
2600
2725
  <xsl:apply-templates/>
2601
2726
  </fo:inline>
2602
2727
  </xsl:template><xsl:template match="*[local-name()='add']">
2603
- <fo:inline xsl:use-attribute-sets="add-style">
2604
- <xsl:apply-templates/>
2605
- </fo:inline>
2728
+ <xsl:choose>
2729
+ <xsl:when test="@amendment">
2730
+ <fo:inline>
2731
+ <xsl:call-template name="insertTag">
2732
+ <xsl:with-param name="kind">A</xsl:with-param>
2733
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2734
+ </xsl:call-template>
2735
+ <xsl:apply-templates/>
2736
+ <xsl:call-template name="insertTag">
2737
+ <xsl:with-param name="type">closing</xsl:with-param>
2738
+ <xsl:with-param name="kind">A</xsl:with-param>
2739
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2740
+ </xsl:call-template>
2741
+ </fo:inline>
2742
+ </xsl:when>
2743
+ <xsl:when test="@corrigenda">
2744
+ <fo:inline>
2745
+ <xsl:call-template name="insertTag">
2746
+ <xsl:with-param name="kind">C</xsl:with-param>
2747
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2748
+ </xsl:call-template>
2749
+ <xsl:apply-templates/>
2750
+ <xsl:call-template name="insertTag">
2751
+ <xsl:with-param name="type">closing</xsl:with-param>
2752
+ <xsl:with-param name="kind">C</xsl:with-param>
2753
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2754
+ </xsl:call-template>
2755
+ </fo:inline>
2756
+ </xsl:when>
2757
+ <xsl:otherwise>
2758
+ <fo:inline xsl:use-attribute-sets="add-style">
2759
+ <xsl:apply-templates/>
2760
+ </fo:inline>
2761
+ </xsl:otherwise>
2762
+ </xsl:choose>
2763
+
2764
+ </xsl:template><xsl:template name="insertTag">
2765
+ <xsl:param name="type"/>
2766
+ <xsl:param name="kind"/>
2767
+ <xsl:param name="value"/>
2768
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2769
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2770
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2771
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2772
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2773
+ <xsl:attribute name="height">5mm</xsl:attribute>
2774
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2775
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2776
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2777
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2778
+ <g>
2779
+ <xsl:if test="$type = 'closing'">
2780
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2781
+ </xsl:if>
2782
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2783
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2784
+ </g>
2785
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2786
+ <xsl:if test="$type = 'closing'">
2787
+ <xsl:attribute name="x">25</xsl:attribute>
2788
+ </xsl:if>
2789
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2790
+ </text>
2791
+ </svg>
2792
+ </fo:instream-foreign-object>
2606
2793
  </xsl:template><xsl:template match="*[local-name()='del']">
2607
2794
  <fo:inline xsl:use-attribute-sets="del-style">
2608
2795
  <xsl:apply-templates/>
@@ -2901,11 +3088,15 @@
2901
3088
  </xsl:apply-templates>
2902
3089
  </xsl:template><xsl:template name="getLang">
2903
3090
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3091
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2904
3092
  <xsl:variable name="language">
2905
3093
  <xsl:choose>
2906
3094
  <xsl:when test="$language_current != ''">
2907
3095
  <xsl:value-of select="$language_current"/>
2908
3096
  </xsl:when>
3097
+ <xsl:when test="$language_current_2 != ''">
3098
+ <xsl:value-of select="$language_current_2"/>
3099
+ </xsl:when>
2909
3100
  <xsl:otherwise>
2910
3101
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2911
3102
  </xsl:otherwise>
@@ -2945,13 +3136,23 @@
2945
3136
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2946
3137
  <xsl:value-of select="substring($str, 2)"/>
2947
3138
  </xsl:template><xsl:template match="mathml:math">
2948
- <fo:inline font-family="STIX Two Math"> <!-- -->
3139
+ <xsl:variable name="isAdded" select="@added"/>
3140
+ <xsl:variable name="isDeleted" select="@deleted"/>
3141
+
3142
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3143
+
3144
+
3145
+ <xsl:call-template name="setTrackChangesStyles">
3146
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3147
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3148
+ </xsl:call-template>
2949
3149
 
2950
3150
  <xsl:variable name="mathml">
2951
3151
  <xsl:apply-templates select="." mode="mathml"/>
2952
3152
  </xsl:variable>
2953
3153
  <fo:instream-foreign-object fox:alt-text="Math">
2954
3154
 
3155
+
2955
3156
  <!-- <xsl:copy-of select="."/> -->
2956
3157
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2957
3158
  </fo:instream-foreign-object>
@@ -2969,9 +3170,27 @@
2969
3170
  <xsl:copy>
2970
3171
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
2971
3172
  </xsl:copy>
2972
- <mathml:mspace width="0.5ex"/>
3173
+ <xsl:choose>
3174
+ <!-- if in msub, then don't add space -->
3175
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3176
+ <!-- if next char in digit, don't add space -->
3177
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3178
+ <xsl:otherwise>
3179
+ <mathml:mspace width="0.5ex"/>
3180
+ </xsl:otherwise>
3181
+ </xsl:choose>
2973
3182
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2974
3183
  <xsl:variable name="target">
3184
+ <xsl:choose>
3185
+ <xsl:when test="@updatetype = 'true'">
3186
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3187
+ </xsl:when>
3188
+ <xsl:otherwise>
3189
+ <xsl:value-of select="normalize-space(@target)"/>
3190
+ </xsl:otherwise>
3191
+ </xsl:choose>
3192
+ </xsl:variable>
3193
+ <xsl:variable name="target_text">
2975
3194
  <xsl:choose>
2976
3195
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
2977
3196
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -2983,20 +3202,21 @@
2983
3202
  </xsl:variable>
2984
3203
  <fo:inline xsl:use-attribute-sets="link-style">
2985
3204
 
3205
+
2986
3206
  <xsl:choose>
2987
- <xsl:when test="$target = ''">
3207
+ <xsl:when test="$target_text = ''">
2988
3208
  <xsl:apply-templates/>
2989
3209
  </xsl:when>
2990
3210
  <xsl:otherwise>
2991
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3211
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
2992
3212
  <xsl:choose>
2993
3213
  <xsl:when test="normalize-space(.) = ''">
2994
- <!-- <xsl:value-of select="$target"/> -->
2995
3214
  <xsl:call-template name="add-zero-spaces-link-java">
2996
- <xsl:with-param name="text" select="$target"/>
3215
+ <xsl:with-param name="text" select="$target_text"/>
2997
3216
  </xsl:call-template>
2998
3217
  </xsl:when>
2999
3218
  <xsl:otherwise>
3219
+ <!-- output text from <link>text</link> -->
3000
3220
  <xsl:apply-templates/>
3001
3221
  </xsl:otherwise>
3002
3222
  </xsl:choose>
@@ -3108,6 +3328,7 @@
3108
3328
 
3109
3329
 
3110
3330
  <fo:inline xsl:use-attribute-sets="note-name-style">
3331
+
3111
3332
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3112
3333
  </fo:inline>
3113
3334
  <xsl:apply-templates/>
@@ -3133,7 +3354,9 @@
3133
3354
  </xsl:choose>
3134
3355
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3135
3356
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3357
+
3136
3358
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3359
+
3137
3360
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3138
3361
  </fo:inline>
3139
3362
  <xsl:apply-templates/>
@@ -3195,16 +3418,27 @@
3195
3418
  </fo:inline>
3196
3419
  </xsl:if>
3197
3420
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3421
+ <xsl:variable name="isAdded" select="@added"/>
3422
+ <xsl:variable name="isDeleted" select="@deleted"/>
3198
3423
  <fo:block-container id="{@id}">
3199
3424
 
3425
+ <xsl:call-template name="setTrackChangesStyles">
3426
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3427
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3428
+ </xsl:call-template>
3429
+
3200
3430
  <fo:block>
3431
+
3201
3432
  <xsl:apply-templates/>
3202
3433
  </fo:block>
3203
3434
  <xsl:call-template name="fn_display_figure"/>
3204
3435
  <xsl:for-each select="*[local-name() = 'note']">
3205
3436
  <xsl:call-template name="note"/>
3206
3437
  </xsl:for-each>
3207
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3438
+
3439
+
3440
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3441
+
3208
3442
  </fo:block-container>
3209
3443
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3210
3444
  <fo:block id="{@id}">
@@ -3216,6 +3450,8 @@
3216
3450
  <xsl:apply-templates/>
3217
3451
  </fo:block>
3218
3452
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3453
+ <xsl:variable name="isAdded" select="../@added"/>
3454
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3219
3455
  <xsl:choose>
3220
3456
  <xsl:when test="ancestor::*[local-name() = 'title']">
3221
3457
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3231,7 +3467,26 @@
3231
3467
  <xsl:variable name="src">
3232
3468
  <xsl:call-template name="image_src"/>
3233
3469
  </xsl:variable>
3234
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3470
+
3471
+ <xsl:choose>
3472
+ <xsl:when test="$isDeleted = 'true'">
3473
+ <!-- enclose in svg -->
3474
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3475
+ <xsl:attribute name="width">100%</xsl:attribute>
3476
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3477
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3478
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3479
+
3480
+
3481
+ <xsl:apply-templates select="." mode="cross_image"/>
3482
+
3483
+ </fo:instream-foreign-object>
3484
+ </xsl:when>
3485
+ <xsl:otherwise>
3486
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3487
+ </xsl:otherwise>
3488
+ </xsl:choose>
3489
+
3235
3490
  </fo:block>
3236
3491
  </xsl:otherwise>
3237
3492
  </xsl:choose>
@@ -3247,21 +3502,70 @@
3247
3502
  <xsl:value-of select="@src"/>
3248
3503
  </xsl:otherwise>
3249
3504
  </xsl:choose>
3505
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3506
+ <xsl:choose>
3507
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3508
+ <xsl:variable name="src">
3509
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3510
+ </xsl:variable>
3511
+ <xsl:variable name="width" select="document($src)/@width"/>
3512
+ <xsl:variable name="height" select="document($src)/@height"/>
3513
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3514
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3515
+ </svg>
3516
+ </xsl:when>
3517
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3518
+ <xsl:variable name="src">
3519
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3520
+ </xsl:variable>
3521
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3522
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3523
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3524
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3525
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3526
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3527
+ </svg>
3528
+ </xsl:when>
3529
+ <xsl:otherwise>
3530
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3531
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3532
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3533
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3534
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3535
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3536
+ <!-- width=<xsl:value-of select="$width"/> -->
3537
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3538
+ <!-- height=<xsl:value-of select="$height"/> -->
3539
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3540
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3541
+ <xsl:call-template name="svg_cross">
3542
+ <xsl:with-param name="width" select="$width"/>
3543
+ <xsl:with-param name="height" select="$height"/>
3544
+ </xsl:call-template>
3545
+ </svg>
3546
+ </xsl:otherwise>
3547
+ </xsl:choose>
3548
+
3549
+ </xsl:template><xsl:template name="svg_cross">
3550
+ <xsl:param name="width"/>
3551
+ <xsl:param name="height"/>
3552
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3553
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3250
3554
  </xsl:template><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">
3251
3555
  <xsl:apply-templates mode="contents"/>
3252
3556
  <xsl:text> </xsl:text>
3253
3557
  </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">
3254
3558
  <xsl:apply-templates mode="bookmarks"/>
3255
3559
  <xsl:text> </xsl:text>
3256
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3560
+ </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">
3257
3561
  <xsl:value-of select="."/>
3258
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3562
+ </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">
3259
3563
  <xsl:value-of select="."/>
3260
3564
  </xsl:template><xsl:template match="node()" mode="contents">
3261
3565
  <xsl:apply-templates mode="contents"/>
3262
3566
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3263
3567
  <xsl:apply-templates mode="bookmarks"/>
3264
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3568
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3265
3569
  <xsl:apply-templates select="."/>
3266
3570
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3267
3571
  <xsl:apply-templates mode="bookmarks"/>
@@ -3409,6 +3713,7 @@
3409
3713
  <xsl:if test="normalize-space() != ''">
3410
3714
  <fo:block xsl:use-attribute-sets="figure-name-style">
3411
3715
 
3716
+
3412
3717
  <xsl:apply-templates/>
3413
3718
  </fo:block>
3414
3719
  </xsl:if>
@@ -3460,6 +3765,8 @@
3460
3765
  </fo:list-item-body>
3461
3766
  </fo:list-item>
3462
3767
  </fo:list-block>
3768
+ </xsl:template><xsl:template name="extractSection">
3769
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3463
3770
  </xsl:template><xsl:template name="extractTitle">
3464
3771
  <xsl:choose>
3465
3772
  <xsl:when test="*[local-name() = 'tab']">
@@ -3486,6 +3793,8 @@
3486
3793
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3487
3794
 
3488
3795
  <fo:block-container margin-left="0mm">
3796
+ <xsl:copy-of select="@id"/>
3797
+
3489
3798
  <xsl:if test="parent::*[local-name() = 'note']">
3490
3799
  <xsl:attribute name="margin-left">
3491
3800
  <xsl:choose>
@@ -3496,7 +3805,9 @@
3496
3805
 
3497
3806
  </xsl:if>
3498
3807
  <fo:block-container margin-left="0mm">
3499
-
3808
+
3809
+
3810
+
3500
3811
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3501
3812
  <xsl:variable name="_font-size">
3502
3813
 
@@ -3507,6 +3818,7 @@
3507
3818
 
3508
3819
 
3509
3820
 
3821
+
3510
3822
 
3511
3823
 
3512
3824
 
@@ -3524,10 +3836,14 @@
3524
3836
  </xsl:choose>
3525
3837
  </xsl:attribute>
3526
3838
  </xsl:if>
3527
- <xsl:apply-templates/>
3528
- </fo:block>
3839
+
3840
+ <xsl:apply-templates/>
3841
+ </fo:block>
3842
+
3843
+
3529
3844
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3530
3845
 
3846
+
3531
3847
  </fo:block-container>
3532
3848
  </fo:block-container>
3533
3849
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -3762,6 +4078,7 @@
3762
4078
  </xsl:template><xsl:template match="*[local-name() = 'example']">
3763
4079
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
3764
4080
 
4081
+
3765
4082
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3766
4083
 
3767
4084
  <xsl:variable name="element">
@@ -3789,6 +4106,7 @@
3789
4106
  <xsl:variable name="element">
3790
4107
  block
3791
4108
 
4109
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3792
4110
  </xsl:variable>
3793
4111
  <xsl:choose>
3794
4112
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3796,7 +4114,7 @@
3796
4114
  <xsl:apply-templates/>
3797
4115
  </fo:inline>
3798
4116
  </xsl:when>
3799
- <xsl:when test="normalize-space($element) = 'block'">
4117
+ <xsl:when test="contains(normalize-space($element), 'block')">
3800
4118
  <fo:block xsl:use-attribute-sets="example-name-style">
3801
4119
  <xsl:apply-templates/>
3802
4120
  </fo:block>
@@ -3828,7 +4146,7 @@
3828
4146
  </fo:inline>
3829
4147
  </xsl:otherwise>
3830
4148
  </xsl:choose>
3831
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4149
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
3832
4150
  <fo:block xsl:use-attribute-sets="termsource-style">
3833
4151
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
3834
4152
  <xsl:variable name="termsource_text">
@@ -3837,11 +4155,13 @@
3837
4155
 
3838
4156
  <xsl:choose>
3839
4157
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
3840
- <xsl:apply-templates/>
4158
+ <!-- <xsl:apply-templates /> -->
4159
+ <xsl:copy-of select="$termsource_text"/>
3841
4160
  </xsl:when>
3842
4161
  <xsl:otherwise>
3843
4162
 
3844
- <xsl:apply-templates/>
4163
+ <!-- <xsl:apply-templates /> -->
4164
+ <xsl:copy-of select="$termsource_text"/>
3845
4165
 
3846
4166
  </xsl:otherwise>
3847
4167
  </xsl:choose>
@@ -3850,20 +4170,29 @@
3850
4170
  <xsl:if test="normalize-space() != ''">
3851
4171
  <xsl:value-of select="."/>
3852
4172
  </xsl:if>
3853
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4173
+ </xsl:template><xsl:variable name="localized.source">
4174
+ <xsl:call-template name="getLocalizedString">
4175
+ <xsl:with-param name="key">source</xsl:with-param>
4176
+ </xsl:call-template>
4177
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
3854
4178
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4179
+ <xsl:if test="normalize-space(@citeas) = ''">
4180
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4181
+ </xsl:if>
3855
4182
 
3856
4183
  <fo:inline>
3857
4184
 
3858
4185
 
3859
4186
 
3860
4187
 
4188
+
4189
+
3861
4190
  <xsl:call-template name="getTitle">
3862
4191
  <xsl:with-param name="name" select="'title-source'"/>
3863
4192
  </xsl:call-template>
4193
+ <xsl:text>: </xsl:text>
3864
4194
 
3865
4195
 
3866
- <xsl:text>: </xsl:text>
3867
4196
  </fo:inline>
3868
4197
 
3869
4198
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -3982,6 +4311,7 @@
3982
4311
 
3983
4312
 
3984
4313
 
4314
+
3985
4315
  3
3986
4316
 
3987
4317
  </xsl:variable>
@@ -4009,7 +4339,8 @@
4009
4339
  </fo:inline>
4010
4340
  </xsl:when>
4011
4341
  <xsl:otherwise>
4012
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4342
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4343
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4013
4344
  </xsl:otherwise>
4014
4345
  </xsl:choose>
4015
4346
 
@@ -4063,7 +4394,6 @@
4063
4394
 
4064
4395
 
4065
4396
 
4066
-
4067
4397
  <xsl:apply-templates/>
4068
4398
  </fo:block>
4069
4399
 
@@ -4080,6 +4410,7 @@
4080
4410
  <xsl:call-template name="setId"/>
4081
4411
 
4082
4412
 
4413
+
4083
4414
  <xsl:apply-templates/>
4084
4415
  </fo:block>
4085
4416
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4106,7 +4437,7 @@
4106
4437
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4107
4438
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4108
4439
  <xsl:choose>
4109
- <xsl:when test="parent::*[local-name() = 'note']">
4440
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4110
4441
  <fo:block-container>
4111
4442
  <xsl:attribute name="margin-left">
4112
4443
  <xsl:choose>
@@ -4116,6 +4447,7 @@
4116
4447
  </xsl:attribute>
4117
4448
 
4118
4449
 
4450
+
4119
4451
  <fo:block-container margin-left="0mm">
4120
4452
  <fo:block>
4121
4453
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4317,21 +4649,25 @@
4317
4649
 
4318
4650
 
4319
4651
 
4652
+
4653
+
4654
+
4655
+
4320
4656
  </xsl:template><xsl:template name="processBibitemDocId">
4321
4657
  <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')]"/>
4322
4658
  <xsl:choose>
4323
4659
  <xsl:when test="normalize-space($_doc_ident) != ''">
4324
- <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"/>
4660
+ <!-- <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"/>
4325
4661
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4326
4662
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4327
- </xsl:if>
4663
+ </xsl:if> -->
4328
4664
  <xsl:value-of select="$_doc_ident"/>
4329
4665
  </xsl:when>
4330
4666
  <xsl:otherwise>
4331
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4667
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4332
4668
  <xsl:if test="$type != ''">
4333
4669
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4334
- </xsl:if>
4670
+ </xsl:if> -->
4335
4671
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4336
4672
  </xsl:otherwise>
4337
4673
  </xsl:choose>
@@ -4373,6 +4709,70 @@
4373
4709
  <xsl:value-of select="substring(.,1,1)"/>
4374
4710
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4375
4711
  <fo:inline><xsl:apply-templates/></fo:inline>
4712
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4713
+ <fo:block>
4714
+ <xsl:apply-templates/>
4715
+ </fo:block>
4716
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4717
+ <fo:inline><xsl:apply-templates/></fo:inline>
4718
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4719
+ <fo:inline>
4720
+ <xsl:call-template name="text_input"/>
4721
+ </fo:inline>
4722
+ </xsl:template><xsl:template name="text_input">
4723
+ <xsl:variable name="count">
4724
+ <xsl:choose>
4725
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4726
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4727
+ <xsl:otherwise>10</xsl:otherwise>
4728
+ </xsl:choose>
4729
+ </xsl:variable>
4730
+ <xsl:call-template name="repeat">
4731
+ <xsl:with-param name="char" select="'_'"/>
4732
+ <xsl:with-param name="count" select="$count"/>
4733
+ </xsl:call-template>
4734
+ <xsl:text> </xsl:text>
4735
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4736
+ <xsl:variable name="caption">
4737
+ <xsl:choose>
4738
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4739
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4740
+ </xsl:choose>
4741
+ </xsl:variable>
4742
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4743
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4744
+ <fo:inline padding-right="1mm">
4745
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4746
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4747
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4748
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4749
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4750
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4751
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4752
+ </svg>
4753
+ </fo:instream-foreign-object>
4754
+ </fo:inline>
4755
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4756
+ <fo:inline padding-right="1mm">
4757
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4758
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4759
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4760
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4761
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4762
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4763
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4764
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4765
+ </svg>
4766
+ </fo:instream-foreign-object>
4767
+ </fo:inline>
4768
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4769
+ <fo:inline>
4770
+ <xsl:call-template name="text_input"/>
4771
+ </fo:inline>
4772
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4773
+ <fo:block-container border="1pt solid black" width="50%">
4774
+ <fo:block> </fo:block>
4775
+ </fo:block-container>
4376
4776
  </xsl:template><xsl:template name="convertDate">
4377
4777
  <xsl:param name="date"/>
4378
4778
  <xsl:param name="format" select="'short'"/>
@@ -4573,6 +4973,9 @@
4573
4973
  <xsl:when test="parent::*[local-name() = 'preface']">
4574
4974
  <xsl:value-of select="$level_total - 1"/>
4575
4975
  </xsl:when>
4976
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
4977
+ <xsl:value-of select="$level_total - 1"/>
4978
+ </xsl:when>
4576
4979
  <xsl:when test="ancestor::*[local-name() = 'preface']">
4577
4980
  <xsl:value-of select="$level_total - 2"/>
4578
4981
  </xsl:when>
@@ -4637,6 +5040,7 @@
4637
5040
 
4638
5041
 
4639
5042
 
5043
+
4640
5044
 
4641
5045
 
4642
5046
 
@@ -4697,17 +5101,79 @@
4697
5101
  </xsl:call-template>
4698
5102
  </xsl:if>
4699
5103
  </xsl:template><xsl:template name="getLocalizedString">
4700
- <xsl:param name="key"/>
5104
+ <xsl:param name="key"/>
4701
5105
 
4702
5106
  <xsl:variable name="curr_lang">
4703
5107
  <xsl:call-template name="getLang"/>
4704
5108
  </xsl:variable>
4705
5109
 
5110
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5111
+
4706
5112
  <xsl:choose>
5113
+ <xsl:when test="$data_value != ''">
5114
+ <xsl:value-of select="$data_value"/>
5115
+ </xsl:when>
4707
5116
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4708
5117
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4709
5118
  </xsl:when>
4710
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5119
+ <xsl:otherwise>
5120
+ <xsl:variable name="key_">
5121
+ <xsl:call-template name="capitalize">
5122
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5123
+ </xsl:call-template>
5124
+ </xsl:variable>
5125
+ <xsl:value-of select="$key_"/>
5126
+ </xsl:otherwise>
4711
5127
  </xsl:choose>
4712
5128
 
5129
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5130
+ <xsl:param name="isAdded"/>
5131
+ <xsl:param name="isDeleted"/>
5132
+ <xsl:choose>
5133
+ <xsl:when test="local-name() = 'math'">
5134
+ <xsl:if test="$isAdded = 'true'">
5135
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5136
+ </xsl:if>
5137
+ <xsl:if test="$isDeleted = 'true'">
5138
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5139
+ </xsl:if>
5140
+ </xsl:when>
5141
+ <xsl:otherwise>
5142
+ <xsl:if test="$isAdded = 'true'">
5143
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5144
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5145
+ </xsl:if>
5146
+ <xsl:if test="$isDeleted = 'true'">
5147
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5148
+ <xsl:if test="local-name() = 'table'">
5149
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5150
+ </xsl:if>
5151
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5152
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5153
+ </xsl:if>
5154
+ </xsl:otherwise>
5155
+ </xsl:choose>
5156
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5157
+ <xsl:if test="$lang = 'ar'">
5158
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5159
+ </xsl:if>
5160
+ </xsl:template><xsl:template name="setAlignment">
5161
+ <xsl:param name="align" select="normalize-space(@align)"/>
5162
+ <xsl:choose>
5163
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5164
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5165
+ <xsl:when test="$align != ''">
5166
+ <xsl:value-of select="$align"/>
5167
+ </xsl:when>
5168
+ </xsl:choose>
5169
+ </xsl:template><xsl:template name="setTextAlignment">
5170
+ <xsl:param name="default">left</xsl:param>
5171
+ <xsl:attribute name="text-align">
5172
+ <xsl:choose>
5173
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5174
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5175
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5176
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5177
+ </xsl:choose>
5178
+ </xsl:attribute>
4713
5179
  </xsl:template></xsl:stylesheet>