metanorma-cc 1.6.9 → 1.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@
5
5
  <xsl:param name="svg_images"/>
6
6
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
8
9
 
9
10
  <xsl:variable name="pageWidth" select="'210mm'"/>
10
11
  <xsl:variable name="pageHeight" select="'297mm'"/>
@@ -931,6 +932,9 @@
931
932
  <title-continued lang="en">(continued)</title-continued>
932
933
  <title-continued lang="fr">(continué)</title-continued>
933
934
 
935
+ </xsl:variable><xsl:variable name="bibdata">
936
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
937
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
934
938
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
935
939
  <xsl:param name="name"/>
936
940
  <xsl:param name="lang"/>
@@ -956,13 +960,16 @@
956
960
  </xsl:choose>
957
961
  </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">
958
962
 
963
+
959
964
  </xsl:attribute-set><xsl:attribute-set name="link-style">
960
965
 
966
+
961
967
  <xsl:attribute name="color">blue</xsl:attribute>
962
968
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
963
969
 
964
970
 
965
971
 
972
+
966
973
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
967
974
  <xsl:attribute name="white-space">pre</xsl:attribute>
968
975
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1026,6 +1033,7 @@
1026
1033
 
1027
1034
 
1028
1035
 
1036
+
1029
1037
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1030
1038
 
1031
1039
 
@@ -1048,9 +1056,7 @@
1048
1056
 
1049
1057
 
1050
1058
 
1051
-
1052
-
1053
-
1059
+
1054
1060
 
1055
1061
 
1056
1062
 
@@ -1081,6 +1087,7 @@
1081
1087
 
1082
1088
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1083
1089
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1090
+
1084
1091
 
1085
1092
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1086
1093
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1097,6 +1104,7 @@
1097
1104
 
1098
1105
 
1099
1106
 
1107
+
1100
1108
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1101
1109
 
1102
1110
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1118,6 +1126,8 @@
1118
1126
 
1119
1127
 
1120
1128
 
1129
+
1130
+
1121
1131
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1122
1132
 
1123
1133
 
@@ -1126,9 +1136,11 @@
1126
1136
 
1127
1137
 
1128
1138
 
1139
+
1129
1140
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1130
1141
 
1131
1142
 
1143
+
1132
1144
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1133
1145
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1134
1146
 
@@ -1147,6 +1159,7 @@
1147
1159
  </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">
1148
1160
 
1149
1161
 
1162
+
1150
1163
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
1151
1164
 
1152
1165
 
@@ -1177,6 +1190,7 @@
1177
1190
 
1178
1191
  </xsl:attribute-set><xsl:attribute-set name="termnote-style">
1179
1192
 
1193
+
1180
1194
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1181
1195
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1182
1196
 
@@ -1185,6 +1199,7 @@
1185
1199
 
1186
1200
 
1187
1201
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1202
+
1188
1203
 
1189
1204
 
1190
1205
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -1208,20 +1223,24 @@
1208
1223
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1209
1224
 
1210
1225
 
1226
+
1211
1227
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1212
1228
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1213
1229
 
1214
1230
 
1215
1231
 
1216
1232
 
1233
+
1217
1234
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1218
1235
 
1219
1236
 
1220
1237
 
1238
+
1221
1239
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1222
1240
 
1223
1241
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1224
1242
 
1243
+
1225
1244
 
1226
1245
 
1227
1246
 
@@ -1254,10 +1273,12 @@
1254
1273
 
1255
1274
 
1256
1275
 
1276
+
1257
1277
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1258
1278
 
1259
1279
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1260
1280
 
1281
+
1261
1282
  <xsl:attribute name="width">100%</xsl:attribute>
1262
1283
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1263
1284
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -1283,15 +1304,36 @@
1283
1304
 
1284
1305
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1285
1306
 
1286
-
1307
+
1308
+
1287
1309
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1288
1310
 
1311
+
1289
1312
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1290
1313
 
1291
1314
 
1292
1315
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1293
1316
 
1294
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1317
+
1318
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1319
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1320
+ </xsl:variable><xsl:attribute-set name="add-style">
1321
+ <xsl:attribute name="color">red</xsl:attribute>
1322
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1323
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1324
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1325
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1326
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1327
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1328
+ <xsl:text>red</xsl:text>
1329
+ </xsl:variable><xsl:attribute-set name="del-style">
1330
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1331
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1332
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1333
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1334
+
1335
+
1336
+ </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">
1295
1337
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1296
1338
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1297
1339
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1336,16 +1378,17 @@
1336
1378
  <xsl:call-template name="add-zero-spaces-java"/>
1337
1379
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1338
1380
 
1381
+ <xsl:variable name="table-preamble">
1382
+
1383
+
1384
+ </xsl:variable>
1385
+
1339
1386
  <xsl:variable name="table">
1340
1387
 
1341
1388
  <xsl:variable name="simple-table">
1342
1389
  <xsl:call-template name="getSimpleTable"/>
1343
1390
  </xsl:variable>
1344
1391
 
1345
-
1346
-
1347
-
1348
-
1349
1392
  <!-- <xsl:if test="$namespace = 'bipm'">
1350
1393
  <fo:block>&#xA0;</fo:block>
1351
1394
  </xsl:if> -->
@@ -1360,7 +1403,7 @@
1360
1403
 
1361
1404
 
1362
1405
 
1363
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1406
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1364
1407
 
1365
1408
  <!-- <xsl:variable name="cols-count">
1366
1409
  <xsl:choose>
@@ -1379,8 +1422,6 @@
1379
1422
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1380
1423
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1381
1424
 
1382
-
1383
-
1384
1425
  <xsl:variable name="colwidths">
1385
1426
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1386
1427
  <xsl:call-template name="calculate-column-widths">
@@ -1408,8 +1449,10 @@
1408
1449
  </xsl:choose>
1409
1450
  </xsl:variable>
1410
1451
 
1452
+
1411
1453
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1412
1454
 
1455
+
1413
1456
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1414
1457
 
1415
1458
 
@@ -1425,6 +1468,8 @@
1425
1468
 
1426
1469
 
1427
1470
 
1471
+
1472
+
1428
1473
  <xsl:variable name="table_width">
1429
1474
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1430
1475
  100%
@@ -1441,6 +1486,8 @@
1441
1486
 
1442
1487
 
1443
1488
 
1489
+
1490
+
1444
1491
 
1445
1492
 
1446
1493
 
@@ -1530,7 +1577,8 @@
1530
1577
  </fo:block-container>
1531
1578
  </xsl:variable>
1532
1579
 
1533
-
1580
+ <xsl:variable name="isAdded" select="@added"/>
1581
+ <xsl:variable name="isDeleted" select="@deleted"/>
1534
1582
 
1535
1583
  <xsl:choose>
1536
1584
  <xsl:when test="@width">
@@ -1544,7 +1592,14 @@
1544
1592
  <fo:table-body>
1545
1593
  <fo:table-row>
1546
1594
  <fo:table-cell column-number="2">
1547
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1595
+ <xsl:copy-of select="$table-preamble"/>
1596
+ <fo:block>
1597
+ <xsl:call-template name="setTrackChangesStyles">
1598
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1599
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1600
+ </xsl:call-template>
1601
+ <xsl:copy-of select="$table"/>
1602
+ </fo:block>
1548
1603
  </fo:table-cell>
1549
1604
  </fo:table-row>
1550
1605
  </fo:table-body>
@@ -1555,16 +1610,42 @@
1555
1610
 
1556
1611
  </xsl:when>
1557
1612
  <xsl:otherwise>
1558
- <xsl:copy-of select="$table"/>
1613
+ <xsl:choose>
1614
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1615
+ <xsl:copy-of select="$table-preamble"/>
1616
+ <fo:block>
1617
+ <xsl:call-template name="setTrackChangesStyles">
1618
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1619
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1620
+ </xsl:call-template>
1621
+ <xsl:copy-of select="$table"/>
1622
+ </fo:block>
1623
+ </xsl:when>
1624
+ <xsl:otherwise>
1625
+ <xsl:copy-of select="$table-preamble"/>
1626
+ <xsl:copy-of select="$table"/>
1627
+ </xsl:otherwise>
1628
+ </xsl:choose>
1559
1629
  </xsl:otherwise>
1560
1630
  </xsl:choose>
1561
1631
 
1562
1632
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1633
+ <xsl:param name="continued"/>
1563
1634
  <xsl:if test="normalize-space() != ''">
1564
1635
  <fo:block xsl:use-attribute-sets="table-name-style">
1565
1636
 
1566
1637
 
1567
- <xsl:apply-templates/>
1638
+ <xsl:choose>
1639
+ <xsl:when test="$continued = 'true'">
1640
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1641
+
1642
+ </xsl:when>
1643
+ <xsl:otherwise>
1644
+ <xsl:apply-templates/>
1645
+ </xsl:otherwise>
1646
+ </xsl:choose>
1647
+
1648
+
1568
1649
  </fo:block>
1569
1650
  </xsl:if>
1570
1651
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1616,7 +1697,7 @@
1616
1697
  </xsl:for-each>
1617
1698
  </xsl:when>
1618
1699
  <xsl:otherwise>
1619
- <xsl:for-each select="xalan:nodeset($table)//tr">
1700
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1620
1701
  <xsl:variable name="td_text">
1621
1702
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1622
1703
 
@@ -1704,18 +1785,18 @@
1704
1785
  <xsl:apply-templates/>
1705
1786
  </fo:table-header>
1706
1787
  </xsl:template><xsl:template name="table-header-title">
1707
- <xsl:param name="cols-count"/>
1788
+ <xsl:param name="cols-count"/>
1708
1789
  <!-- row for title -->
1709
1790
  <fo:table-row>
1710
1791
  <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">
1711
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1792
+
1793
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1794
+ <xsl:with-param name="continued">true</xsl:with-param>
1795
+ </xsl:apply-templates>
1712
1796
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1713
1797
  <xsl:call-template name="fn_name_display"/>
1714
- </xsl:for-each>
1715
- <fo:block text-align="right" font-style="italic">
1716
- <xsl:text> </xsl:text>
1717
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1718
- </fo:block>
1798
+ </xsl:for-each>
1799
+
1719
1800
  </fo:table-cell>
1720
1801
  </fo:table-row>
1721
1802
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -1936,6 +2017,7 @@
1936
2017
 
1937
2018
 
1938
2019
 
2020
+
1939
2021
  </xsl:if>
1940
2022
  <xsl:if test="$parent-name = 'tfoot'">
1941
2023
 
@@ -1956,7 +2038,8 @@
1956
2038
  <xsl:attribute name="text-align">
1957
2039
  <xsl:choose>
1958
2040
  <xsl:when test="@align">
1959
- <xsl:value-of select="@align"/>
2041
+ <xsl:call-template name="setAlignment"/>
2042
+ <!-- <xsl:value-of select="@align"/> -->
1960
2043
  </xsl:when>
1961
2044
  <xsl:otherwise>center</xsl:otherwise>
1962
2045
  </xsl:choose>
@@ -1972,6 +2055,11 @@
1972
2055
 
1973
2056
 
1974
2057
 
2058
+
2059
+
2060
+ <xsl:if test="$lang = 'ar'">
2061
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2062
+ </xsl:if>
1975
2063
  <xsl:if test="@colspan">
1976
2064
  <xsl:attribute name="number-columns-spanned">
1977
2065
  <xsl:value-of select="@colspan"/>
@@ -2003,11 +2091,16 @@
2003
2091
  <xsl:attribute name="text-align">
2004
2092
  <xsl:choose>
2005
2093
  <xsl:when test="@align">
2006
- <xsl:value-of select="@align"/>
2094
+ <xsl:call-template name="setAlignment"/>
2095
+ <!-- <xsl:value-of select="@align"/> -->
2007
2096
  </xsl:when>
2008
2097
  <xsl:otherwise>left</xsl:otherwise>
2009
2098
  </xsl:choose>
2010
2099
  </xsl:attribute>
2100
+ <xsl:if test="$lang = 'ar'">
2101
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2102
+ </xsl:if>
2103
+
2011
2104
 
2012
2105
 
2013
2106
 
@@ -2019,6 +2112,9 @@
2019
2112
 
2020
2113
 
2021
2114
 
2115
+ <xsl:if test=".//*[local-name() = 'table']">
2116
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2117
+ </xsl:if>
2022
2118
  <xsl:if test="@colspan">
2023
2119
  <xsl:attribute name="number-columns-spanned">
2024
2120
  <xsl:value-of select="@colspan"/>
@@ -2146,13 +2242,13 @@
2146
2242
  </xsl:choose>
2147
2243
  </xsl:variable>
2148
2244
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2149
- <xsl:element name="{$ns}:table">
2245
+ <!-- <xsl:element name="{$ns}:table"> -->
2150
2246
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2151
2247
  <tbody>
2152
2248
  <xsl:apply-templates mode="dl"/>
2153
2249
  </tbody>
2154
2250
  </xsl:for-each>
2155
- </xsl:element>
2251
+ <!-- </xsl:element> -->
2156
2252
  </xsl:variable>
2157
2253
 
2158
2254
  <xsl:call-template name="calculate-column-widths">
@@ -2243,6 +2339,8 @@
2243
2339
  <xsl:apply-templates/>
2244
2340
  </fo:inline>
2245
2341
  </xsl:template><xsl:template match="*[local-name()='dl']">
2342
+ <xsl:variable name="isAdded" select="@added"/>
2343
+ <xsl:variable name="isDeleted" select="@deleted"/>
2246
2344
  <fo:block-container>
2247
2345
 
2248
2346
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2259,6 +2357,12 @@
2259
2357
  </xsl:attribute>
2260
2358
 
2261
2359
  </xsl:if>
2360
+
2361
+ <xsl:call-template name="setTrackChangesStyles">
2362
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2363
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2364
+ </xsl:call-template>
2365
+
2262
2366
  <fo:block-container>
2263
2367
 
2264
2368
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2314,6 +2418,7 @@
2314
2418
 
2315
2419
 
2316
2420
 
2421
+
2317
2422
  <xsl:variable name="title-key">
2318
2423
 
2319
2424
 
@@ -2366,11 +2471,11 @@
2366
2471
  </xsl:choose>
2367
2472
  </xsl:variable>
2368
2473
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2369
- <xsl:element name="{$ns}:table">
2474
+ <!-- <xsl:element name="{$ns}:table"> -->
2370
2475
  <tbody>
2371
2476
  <xsl:apply-templates mode="dl"/>
2372
2477
  </tbody>
2373
- </xsl:element>
2478
+ <!-- </xsl:element> -->
2374
2479
  </xsl:variable>
2375
2480
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2376
2481
  <xsl:variable name="colwidths">
@@ -2597,6 +2702,8 @@
2597
2702
 
2598
2703
  <xsl:apply-templates/>
2599
2704
  </fo:inline>
2705
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2706
+ <fo:inline padding-right="{@value}"> </fo:inline>
2600
2707
  </xsl:template><xsl:template match="*[local-name()='sup']">
2601
2708
  <fo:inline font-size="80%" vertical-align="super">
2602
2709
  <xsl:apply-templates/>
@@ -2622,6 +2729,7 @@
2622
2729
 
2623
2730
 
2624
2731
 
2732
+
2625
2733
 
2626
2734
  </xsl:variable>
2627
2735
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2639,8 +2747,74 @@
2639
2747
  <fo:inline text-decoration="underline">
2640
2748
  <xsl:apply-templates/>
2641
2749
  </fo:inline>
2750
+ </xsl:template><xsl:template match="*[local-name()='add']">
2751
+ <xsl:choose>
2752
+ <xsl:when test="@amendment">
2753
+ <fo:inline>
2754
+ <xsl:call-template name="insertTag">
2755
+ <xsl:with-param name="kind">A</xsl:with-param>
2756
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2757
+ </xsl:call-template>
2758
+ <xsl:apply-templates/>
2759
+ <xsl:call-template name="insertTag">
2760
+ <xsl:with-param name="type">closing</xsl:with-param>
2761
+ <xsl:with-param name="kind">A</xsl:with-param>
2762
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2763
+ </xsl:call-template>
2764
+ </fo:inline>
2765
+ </xsl:when>
2766
+ <xsl:when test="@corrigenda">
2767
+ <fo:inline>
2768
+ <xsl:call-template name="insertTag">
2769
+ <xsl:with-param name="kind">C</xsl:with-param>
2770
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2771
+ </xsl:call-template>
2772
+ <xsl:apply-templates/>
2773
+ <xsl:call-template name="insertTag">
2774
+ <xsl:with-param name="type">closing</xsl:with-param>
2775
+ <xsl:with-param name="kind">C</xsl:with-param>
2776
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2777
+ </xsl:call-template>
2778
+ </fo:inline>
2779
+ </xsl:when>
2780
+ <xsl:otherwise>
2781
+ <fo:inline xsl:use-attribute-sets="add-style">
2782
+ <xsl:apply-templates/>
2783
+ </fo:inline>
2784
+ </xsl:otherwise>
2785
+ </xsl:choose>
2786
+
2787
+ </xsl:template><xsl:template name="insertTag">
2788
+ <xsl:param name="type"/>
2789
+ <xsl:param name="kind"/>
2790
+ <xsl:param name="value"/>
2791
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2792
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2793
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2794
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2795
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2796
+ <xsl:attribute name="height">5mm</xsl:attribute>
2797
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2798
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2799
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2800
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2801
+ <g>
2802
+ <xsl:if test="$type = 'closing'">
2803
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2804
+ </xsl:if>
2805
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2806
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2807
+ </g>
2808
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2809
+ <xsl:if test="$type = 'closing'">
2810
+ <xsl:attribute name="x">25</xsl:attribute>
2811
+ </xsl:if>
2812
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2813
+ </text>
2814
+ </svg>
2815
+ </fo:instream-foreign-object>
2642
2816
  </xsl:template><xsl:template match="*[local-name()='del']">
2643
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2817
+ <fo:inline xsl:use-attribute-sets="del-style">
2644
2818
  <xsl:apply-templates/>
2645
2819
  </fo:inline>
2646
2820
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -2937,11 +3111,15 @@
2937
3111
  </xsl:apply-templates>
2938
3112
  </xsl:template><xsl:template name="getLang">
2939
3113
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3114
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2940
3115
  <xsl:variable name="language">
2941
3116
  <xsl:choose>
2942
3117
  <xsl:when test="$language_current != ''">
2943
3118
  <xsl:value-of select="$language_current"/>
2944
3119
  </xsl:when>
3120
+ <xsl:when test="$language_current_2 != ''">
3121
+ <xsl:value-of select="$language_current_2"/>
3122
+ </xsl:when>
2945
3123
  <xsl:otherwise>
2946
3124
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2947
3125
  </xsl:otherwise>
@@ -2981,13 +3159,23 @@
2981
3159
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2982
3160
  <xsl:value-of select="substring($str, 2)"/>
2983
3161
  </xsl:template><xsl:template match="mathml:math">
2984
- <fo:inline font-family="STIX Two Math"> <!-- -->
3162
+ <xsl:variable name="isAdded" select="@added"/>
3163
+ <xsl:variable name="isDeleted" select="@deleted"/>
3164
+
3165
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3166
+
3167
+
3168
+ <xsl:call-template name="setTrackChangesStyles">
3169
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3170
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3171
+ </xsl:call-template>
2985
3172
 
2986
3173
  <xsl:variable name="mathml">
2987
3174
  <xsl:apply-templates select="." mode="mathml"/>
2988
3175
  </xsl:variable>
2989
3176
  <fo:instream-foreign-object fox:alt-text="Math">
2990
3177
 
3178
+
2991
3179
  <!-- <xsl:copy-of select="."/> -->
2992
3180
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2993
3181
  </fo:instream-foreign-object>
@@ -3008,6 +3196,16 @@
3008
3196
  <mathml:mspace width="0.5ex"/>
3009
3197
  </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">
3010
3198
  <xsl:variable name="target">
3199
+ <xsl:choose>
3200
+ <xsl:when test="@updatetype = 'true'">
3201
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3202
+ </xsl:when>
3203
+ <xsl:otherwise>
3204
+ <xsl:value-of select="normalize-space(@target)"/>
3205
+ </xsl:otherwise>
3206
+ </xsl:choose>
3207
+ </xsl:variable>
3208
+ <xsl:variable name="target_text">
3011
3209
  <xsl:choose>
3012
3210
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3013
3211
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3020,19 +3218,19 @@
3020
3218
  <fo:inline xsl:use-attribute-sets="link-style">
3021
3219
 
3022
3220
  <xsl:choose>
3023
- <xsl:when test="$target = ''">
3221
+ <xsl:when test="$target_text = ''">
3024
3222
  <xsl:apply-templates/>
3025
3223
  </xsl:when>
3026
3224
  <xsl:otherwise>
3027
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3225
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3028
3226
  <xsl:choose>
3029
3227
  <xsl:when test="normalize-space(.) = ''">
3030
- <!-- <xsl:value-of select="$target"/> -->
3031
3228
  <xsl:call-template name="add-zero-spaces-link-java">
3032
- <xsl:with-param name="text" select="$target"/>
3229
+ <xsl:with-param name="text" select="$target_text"/>
3033
3230
  </xsl:call-template>
3034
3231
  </xsl:when>
3035
3232
  <xsl:otherwise>
3233
+ <!-- output text from <link>text</link> -->
3036
3234
  <xsl:apply-templates/>
3037
3235
  </xsl:otherwise>
3038
3236
  </xsl:choose>
@@ -3144,6 +3342,7 @@
3144
3342
 
3145
3343
 
3146
3344
  <fo:inline xsl:use-attribute-sets="note-name-style">
3345
+
3147
3346
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3148
3347
  </fo:inline>
3149
3348
  <xsl:apply-templates/>
@@ -3170,6 +3369,7 @@
3170
3369
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3171
3370
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3172
3371
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3372
+
3173
3373
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3174
3374
  </fo:inline>
3175
3375
  <xsl:apply-templates/>
@@ -3231,8 +3431,15 @@
3231
3431
  </fo:inline>
3232
3432
  </xsl:if>
3233
3433
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3434
+ <xsl:variable name="isAdded" select="@added"/>
3435
+ <xsl:variable name="isDeleted" select="@deleted"/>
3234
3436
  <fo:block-container id="{@id}">
3235
3437
 
3438
+ <xsl:call-template name="setTrackChangesStyles">
3439
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3440
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3441
+ </xsl:call-template>
3442
+
3236
3443
  <fo:block>
3237
3444
  <xsl:apply-templates/>
3238
3445
  </fo:block>
@@ -3240,7 +3447,10 @@
3240
3447
  <xsl:for-each select="*[local-name() = 'note']">
3241
3448
  <xsl:call-template name="note"/>
3242
3449
  </xsl:for-each>
3243
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3450
+
3451
+
3452
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3453
+
3244
3454
  </fo:block-container>
3245
3455
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3246
3456
  <fo:block id="{@id}">
@@ -3252,37 +3462,122 @@
3252
3462
  <xsl:apply-templates/>
3253
3463
  </fo:block>
3254
3464
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3255
- <fo:block xsl:use-attribute-sets="image-style">
3256
-
3257
-
3258
- <xsl:variable name="src">
3259
- <xsl:choose>
3260
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3261
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3262
- </xsl:when>
3263
- <xsl:otherwise>
3264
- <xsl:value-of select="@src"/>
3265
- </xsl:otherwise>
3266
- </xsl:choose>
3267
- </xsl:variable>
3268
-
3269
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3270
- </fo:block>
3465
+ <xsl:variable name="isAdded" select="../@added"/>
3466
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3467
+ <xsl:choose>
3468
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3469
+ <fo:inline padding-left="1mm" padding-right="1mm">
3470
+ <xsl:variable name="src">
3471
+ <xsl:call-template name="image_src"/>
3472
+ </xsl:variable>
3473
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3474
+ </fo:inline>
3475
+ </xsl:when>
3476
+ <xsl:otherwise>
3477
+ <fo:block xsl:use-attribute-sets="image-style">
3478
+
3479
+ <xsl:variable name="src">
3480
+ <xsl:call-template name="image_src"/>
3481
+ </xsl:variable>
3482
+
3483
+ <xsl:choose>
3484
+ <xsl:when test="$isDeleted = 'true'">
3485
+ <!-- enclose in svg -->
3486
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3487
+ <xsl:attribute name="width">100%</xsl:attribute>
3488
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3489
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3490
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3491
+
3492
+
3493
+ <xsl:apply-templates select="." mode="cross_image"/>
3494
+
3495
+ </fo:instream-foreign-object>
3496
+ </xsl:when>
3497
+ <xsl:otherwise>
3498
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3499
+ </xsl:otherwise>
3500
+ </xsl:choose>
3501
+
3502
+ </fo:block>
3503
+ </xsl:otherwise>
3504
+ </xsl:choose>
3505
+ </xsl:template><xsl:template name="image_src">
3506
+ <xsl:choose>
3507
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3508
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3509
+ </xsl:when>
3510
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3511
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3512
+ </xsl:when>
3513
+ <xsl:otherwise>
3514
+ <xsl:value-of select="@src"/>
3515
+ </xsl:otherwise>
3516
+ </xsl:choose>
3517
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3518
+ <xsl:choose>
3519
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3520
+ <xsl:variable name="src">
3521
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3522
+ </xsl:variable>
3523
+ <xsl:variable name="width" select="document($src)/@width"/>
3524
+ <xsl:variable name="height" select="document($src)/@height"/>
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:when test="not(starts-with(@src, 'data:'))">
3530
+ <xsl:variable name="src">
3531
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3532
+ </xsl:variable>
3533
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3534
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3535
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3536
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3537
+ <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">
3538
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3539
+ </svg>
3540
+ </xsl:when>
3541
+ <xsl:otherwise>
3542
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3543
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3544
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3545
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3546
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3547
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3548
+ <!-- width=<xsl:value-of select="$width"/> -->
3549
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3550
+ <!-- height=<xsl:value-of select="$height"/> -->
3551
+ <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">
3552
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3553
+ <xsl:call-template name="svg_cross">
3554
+ <xsl:with-param name="width" select="$width"/>
3555
+ <xsl:with-param name="height" select="$height"/>
3556
+ </xsl:call-template>
3557
+ </svg>
3558
+ </xsl:otherwise>
3559
+ </xsl:choose>
3560
+
3561
+ </xsl:template><xsl:template name="svg_cross">
3562
+ <xsl:param name="width"/>
3563
+ <xsl:param name="height"/>
3564
+ <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; "/>
3565
+ <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; "/>
3271
3566
  </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">
3272
3567
  <xsl:apply-templates mode="contents"/>
3273
3568
  <xsl:text> </xsl:text>
3274
3569
  </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">
3275
3570
  <xsl:apply-templates mode="bookmarks"/>
3276
3571
  <xsl:text> </xsl:text>
3277
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3572
+ </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">
3278
3573
  <xsl:value-of select="."/>
3279
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3574
+ </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">
3280
3575
  <xsl:value-of select="."/>
3281
3576
  </xsl:template><xsl:template match="node()" mode="contents">
3282
3577
  <xsl:apply-templates mode="contents"/>
3283
3578
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3284
3579
  <xsl:apply-templates mode="bookmarks"/>
3285
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3580
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3286
3581
  <xsl:apply-templates select="."/>
3287
3582
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3288
3583
  <xsl:apply-templates mode="bookmarks"/>
@@ -3481,6 +3776,8 @@
3481
3776
  </fo:list-item-body>
3482
3777
  </fo:list-item>
3483
3778
  </fo:list-block>
3779
+ </xsl:template><xsl:template name="extractSection">
3780
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3484
3781
  </xsl:template><xsl:template name="extractTitle">
3485
3782
  <xsl:choose>
3486
3783
  <xsl:when test="*[local-name() = 'tab']">
@@ -3507,6 +3804,7 @@
3507
3804
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3508
3805
 
3509
3806
  <fo:block-container margin-left="0mm">
3807
+ <xsl:copy-of select="@id"/>
3510
3808
  <xsl:if test="parent::*[local-name() = 'note']">
3511
3809
  <xsl:attribute name="margin-left">
3512
3810
  <xsl:choose>
@@ -3528,6 +3826,7 @@
3528
3826
 
3529
3827
 
3530
3828
 
3829
+
3531
3830
 
3532
3831
 
3533
3832
 
@@ -3783,6 +4082,7 @@
3783
4082
  </xsl:template><xsl:template match="*[local-name() = 'example']">
3784
4083
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
3785
4084
 
4085
+
3786
4086
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3787
4087
 
3788
4088
  <xsl:variable name="element">
@@ -3810,6 +4110,7 @@
3810
4110
  <xsl:variable name="element">
3811
4111
  block
3812
4112
 
4113
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3813
4114
  </xsl:variable>
3814
4115
  <xsl:choose>
3815
4116
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3817,7 +4118,7 @@
3817
4118
  <xsl:apply-templates/>
3818
4119
  </fo:inline>
3819
4120
  </xsl:when>
3820
- <xsl:when test="normalize-space($element) = 'block'">
4121
+ <xsl:when test="contains(normalize-space($element), 'block')">
3821
4122
  <fo:block xsl:use-attribute-sets="example-name-style">
3822
4123
  <xsl:apply-templates/>
3823
4124
  </fo:block>
@@ -3849,7 +4150,7 @@
3849
4150
  </fo:inline>
3850
4151
  </xsl:otherwise>
3851
4152
  </xsl:choose>
3852
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4153
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
3853
4154
  <fo:block xsl:use-attribute-sets="termsource-style">
3854
4155
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
3855
4156
  <xsl:variable name="termsource_text">
@@ -3858,13 +4159,15 @@
3858
4159
 
3859
4160
  <xsl:choose>
3860
4161
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
3861
- <xsl:apply-templates/>
4162
+ <!-- <xsl:apply-templates /> -->
4163
+ <xsl:copy-of select="$termsource_text"/>
3862
4164
  </xsl:when>
3863
4165
  <xsl:otherwise>
3864
4166
 
3865
4167
  <xsl:text>[</xsl:text>
3866
4168
 
3867
- <xsl:apply-templates/>
4169
+ <!-- <xsl:apply-templates /> -->
4170
+ <xsl:copy-of select="$termsource_text"/>
3868
4171
 
3869
4172
  <xsl:text>]</xsl:text>
3870
4173
 
@@ -3875,8 +4178,15 @@
3875
4178
  <xsl:if test="normalize-space() != ''">
3876
4179
  <xsl:value-of select="."/>
3877
4180
  </xsl:if>
3878
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4181
+ </xsl:template><xsl:variable name="localized.source">
4182
+ <xsl:call-template name="getLocalizedString">
4183
+ <xsl:with-param name="key">source</xsl:with-param>
4184
+ </xsl:call-template>
4185
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
3879
4186
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4187
+ <xsl:if test="normalize-space(@citeas) = ''">
4188
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4189
+ </xsl:if>
3880
4190
 
3881
4191
  <fo:inline>
3882
4192
 
@@ -3886,9 +4196,9 @@
3886
4196
  <xsl:call-template name="getTitle">
3887
4197
  <xsl:with-param name="name" select="'title-source'"/>
3888
4198
  </xsl:call-template>
4199
+ <xsl:text>: </xsl:text>
3889
4200
 
3890
4201
 
3891
- <xsl:text>: </xsl:text>
3892
4202
  </fo:inline>
3893
4203
 
3894
4204
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -4015,6 +4325,7 @@
4015
4325
 
4016
4326
 
4017
4327
 
4328
+
4018
4329
  </xsl:variable>
4019
4330
 
4020
4331
  <xsl:variable name="padding-right">
@@ -4040,7 +4351,8 @@
4040
4351
  </fo:inline>
4041
4352
  </xsl:when>
4042
4353
  <xsl:otherwise>
4043
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4354
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4355
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4044
4356
  </xsl:otherwise>
4045
4357
  </xsl:choose>
4046
4358
 
@@ -4099,7 +4411,6 @@
4099
4411
 
4100
4412
 
4101
4413
 
4102
-
4103
4414
  <xsl:apply-templates/>
4104
4415
  </fo:block>
4105
4416
 
@@ -4142,7 +4453,7 @@
4142
4453
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4143
4454
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4144
4455
  <xsl:choose>
4145
- <xsl:when test="parent::*[local-name() = 'note']">
4456
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4146
4457
  <fo:block-container>
4147
4458
  <xsl:attribute name="margin-left">
4148
4459
  <xsl:choose>
@@ -4152,6 +4463,7 @@
4152
4463
  </xsl:attribute>
4153
4464
 
4154
4465
 
4466
+
4155
4467
  <fo:block-container margin-left="0mm">
4156
4468
  <fo:block>
4157
4469
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4353,6 +4665,10 @@
4353
4665
 
4354
4666
 
4355
4667
 
4668
+
4669
+
4670
+
4671
+
4356
4672
  </xsl:template><xsl:template name="processBibitemDocId">
4357
4673
  <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')]"/>
4358
4674
  <xsl:choose>
@@ -4409,6 +4725,70 @@
4409
4725
  <xsl:value-of select="substring(.,1,1)"/>
4410
4726
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4411
4727
  <fo:inline><xsl:apply-templates/></fo:inline>
4728
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
4729
+ <fo:block>
4730
+ <xsl:apply-templates/>
4731
+ </fo:block>
4732
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
4733
+ <fo:inline><xsl:apply-templates/></fo:inline>
4734
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
4735
+ <fo:inline>
4736
+ <xsl:call-template name="text_input"/>
4737
+ </fo:inline>
4738
+ </xsl:template><xsl:template name="text_input">
4739
+ <xsl:variable name="count">
4740
+ <xsl:choose>
4741
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
4742
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
4743
+ <xsl:otherwise>10</xsl:otherwise>
4744
+ </xsl:choose>
4745
+ </xsl:variable>
4746
+ <xsl:call-template name="repeat">
4747
+ <xsl:with-param name="char" select="'_'"/>
4748
+ <xsl:with-param name="count" select="$count"/>
4749
+ </xsl:call-template>
4750
+ <xsl:text> </xsl:text>
4751
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
4752
+ <xsl:variable name="caption">
4753
+ <xsl:choose>
4754
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
4755
+ <xsl:otherwise>BUTTON</xsl:otherwise>
4756
+ </xsl:choose>
4757
+ </xsl:variable>
4758
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
4759
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
4760
+ <fo:inline padding-right="1mm">
4761
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4762
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4763
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4764
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4765
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4766
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4767
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
4768
+ </svg>
4769
+ </fo:instream-foreign-object>
4770
+ </fo:inline>
4771
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
4772
+ <fo:inline padding-right="1mm">
4773
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
4774
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
4775
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4776
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4777
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4778
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
4779
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
4780
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
4781
+ </svg>
4782
+ </fo:instream-foreign-object>
4783
+ </fo:inline>
4784
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
4785
+ <fo:inline>
4786
+ <xsl:call-template name="text_input"/>
4787
+ </fo:inline>
4788
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
4789
+ <fo:block-container border="1pt solid black" width="50%">
4790
+ <fo:block> </fo:block>
4791
+ </fo:block-container>
4412
4792
  </xsl:template><xsl:template name="convertDate">
4413
4793
  <xsl:param name="date"/>
4414
4794
  <xsl:param name="format" select="'short'"/>
@@ -4616,6 +4996,9 @@
4616
4996
  <xsl:when test="parent::*[local-name() = 'preface']">
4617
4997
  <xsl:value-of select="$level_total - 1"/>
4618
4998
  </xsl:when>
4999
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5000
+ <xsl:value-of select="$level_total - 1"/>
5001
+ </xsl:when>
4619
5002
  <xsl:when test="ancestor::*[local-name() = 'preface']">
4620
5003
  <xsl:value-of select="$level_total - 2"/>
4621
5004
  </xsl:when>
@@ -4679,6 +5062,7 @@
4679
5062
 
4680
5063
 
4681
5064
 
5065
+
4682
5066
  <xsl:value-of select="document('')//*/namespace::csd"/>
4683
5067
 
4684
5068
 
@@ -4740,17 +5124,69 @@
4740
5124
  </xsl:call-template>
4741
5125
  </xsl:if>
4742
5126
  </xsl:template><xsl:template name="getLocalizedString">
4743
- <xsl:param name="key"/>
5127
+ <xsl:param name="key"/>
4744
5128
 
4745
5129
  <xsl:variable name="curr_lang">
4746
5130
  <xsl:call-template name="getLang"/>
4747
5131
  </xsl:variable>
4748
5132
 
5133
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5134
+
4749
5135
  <xsl:choose>
5136
+ <xsl:when test="$data_value != ''">
5137
+ <xsl:value-of select="$data_value"/>
5138
+ </xsl:when>
4750
5139
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4751
5140
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4752
5141
  </xsl:when>
4753
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5142
+ <xsl:otherwise>
5143
+ <xsl:variable name="key_">
5144
+ <xsl:call-template name="capitalize">
5145
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5146
+ </xsl:call-template>
5147
+ </xsl:variable>
5148
+ <xsl:value-of select="$key_"/>
5149
+ </xsl:otherwise>
4754
5150
  </xsl:choose>
4755
5151
 
5152
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5153
+ <xsl:param name="isAdded"/>
5154
+ <xsl:param name="isDeleted"/>
5155
+ <xsl:choose>
5156
+ <xsl:when test="local-name() = 'math'">
5157
+ <xsl:if test="$isAdded = 'true'">
5158
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5159
+ </xsl:if>
5160
+ <xsl:if test="$isDeleted = 'true'">
5161
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5162
+ </xsl:if>
5163
+ </xsl:when>
5164
+ <xsl:otherwise>
5165
+ <xsl:if test="$isAdded = 'true'">
5166
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5167
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5168
+ </xsl:if>
5169
+ <xsl:if test="$isDeleted = 'true'">
5170
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5171
+ <xsl:if test="local-name() = 'table'">
5172
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5173
+ </xsl:if>
5174
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5175
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5176
+ </xsl:if>
5177
+ </xsl:otherwise>
5178
+ </xsl:choose>
5179
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5180
+ <xsl:if test="$lang = 'ar'">
5181
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5182
+ </xsl:if>
5183
+ </xsl:template><xsl:template name="setAlignment">
5184
+ <xsl:param name="align" select="normalize-space(@align)"/>
5185
+ <xsl:choose>
5186
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5187
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5188
+ <xsl:when test="$align != ''">
5189
+ <xsl:value-of select="$align"/>
5190
+ </xsl:when>
5191
+ </xsl:choose>
4756
5192
  </xsl:template></xsl:stylesheet>