metanorma-iho 0.2.16 → 0.3.4

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.
@@ -15,30 +15,32 @@ module IsoDoc
15
15
  super
16
16
  end
17
17
 
18
- def std_bibitem_entry(list, b, ordinal, biblio)
19
- list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
18
+ def std_bibitem_entry(list, bib, ordinal, biblio)
19
+ list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
20
20
  prefix_bracketed_ref(ref, "[#{ordinal}]")
21
- standard_citation(ref, b)
21
+ standard_citation(ref, bib)
22
22
  end
23
23
  end
24
24
 
25
- def nodes_to_span(n)
25
+ def nodes_to_span(node)
26
26
  noko do |xml|
27
27
  xml.span do |s|
28
- n&.children&.each { |x| parse(x, s) }
28
+ node&.children&.each { |x| parse(x, s) }
29
29
  end
30
30
  end.join("")
31
31
  end
32
32
 
33
33
  def multiplenames_and(names)
34
- return "" if names.length == 0
34
+ return "" if names.empty?
35
35
  return names[0] if names.length == 1
36
36
  return "#{names[0]} and #{names[1]}" if names.length == 2
37
+
37
38
  names[0..-2].join(", ") + " and #{names[-1]}"
38
39
  end
39
40
 
40
- def extract_publisher(b)
41
- c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
41
+ def extract_publisher(bib)
42
+ c = bib
43
+ .xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
42
44
  abbrs = []
43
45
  names = []
44
46
  c&.each do |c1|
@@ -47,63 +49,55 @@ module IsoDoc
47
49
  names << nodes_to_span(n)
48
50
  end
49
51
  return [nil, nil] if names.empty?
50
- return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
52
+
53
+ [multiplenames_and(names), abbrs.map(&:text).join("/")]
51
54
  end
52
55
 
53
- def inline_bibitem_ref_code(b)
54
- id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
55
- "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
56
- id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
56
+ def inline_bibitem_ref_code(bib)
57
+ id = bib.at(ns("./docidentifier[not(@type = 'DOI' or "\
58
+ "@type = 'metanorma' or @type = 'ISSN' or "\
59
+ "@type = 'ISBN' or @type = 'rfc-anchor')]"))
60
+ id ||= bib.at(ns("./docidentifier[not(@type = 'metanorma')]"))
57
61
  return [nil, id, nil] if id
58
- id = Nokogiri::XML::Node.new("docidentifier", b.document)
62
+
63
+ id = Nokogiri::XML::Node.new("docidentifier", bib.document)
59
64
  id << "(NO ID)"
60
65
  [nil, id, nil]
61
66
  end
62
67
 
63
- def extract_edition(b)
64
- b&.at(ns("./edition"))&.text
68
+ def extract_edition(bib)
69
+ bib&.at(ns("./edition"))&.text
65
70
  end
66
71
 
67
- def extract_uri(b)
68
- b.at(ns("./uri"))
72
+ def extract_uri(bib)
73
+ bib.at(ns("./uri"))
69
74
  end
70
75
 
71
76
  def omit_docid_prefix(prefix)
72
77
  return true if prefix == "IHO"
78
+
73
79
  super
74
80
  end
75
81
 
76
82
  def render_identifier(id)
77
- if !id[1].nil? and id[1]["type"] == "IHO"
83
+ if !id[1].nil? && (id[1]["type"] == "IHO")
78
84
  id[1].children = id[1].text.sub(/^IHO /, "")
79
85
  end
80
86
  super
81
87
  end
82
88
 
83
- def extract_publisher(b)
84
- c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
85
- abbrs = []
86
- names = []
87
- c&.each do |c1|
88
- n = c1.at(ns("./organization/name")) or next
89
- abbrs << (c1.at(ns("./organization/abbreviation")) || n)
90
- names << nodes_to_span(n)
91
- end
92
- return [nil, nil] if names.empty?
93
- return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
94
- end
89
+ def extract_author(bib)
90
+ c = bib.xpath(ns("./contributor[role/@type = 'author']"))
91
+ c = bib.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
92
+ return extract_publisher(bib)[0] if c.empty?
95
93
 
96
- def extract_author(b)
97
- c = b.xpath(ns("./contributor[role/@type = 'author']"))
98
- c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
99
- return extract_publisher(b)[0] if c.empty?
100
94
  c.map do |c1|
101
95
  c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
102
96
  end.reject { |e| e.nil? || e.empty? }.join(", ")
103
97
  end
104
98
 
105
- def extract_person_name(b)
106
- p = b.at(ns("./person/name")) or return
99
+ def extract_person_name(bib)
100
+ p = bib.at(ns("./person/name")) or return
107
101
  c = p.at(ns("./completename")) and return c.text
108
102
  s = p&.at(ns("./surname"))&.text or return
109
103
  i = p.xpath(ns("./initial")) and
@@ -113,25 +107,25 @@ module IsoDoc
113
107
  front ? "#{s} #{front}" : s
114
108
  end
115
109
 
116
- def is_iho?(b)
117
- extract_publisher(b)[1] == "IHO"
110
+ def iho?(bib)
111
+ extract_publisher(bib)[1] == "IHO"
118
112
  end
119
113
 
120
114
  # [{number}] {docID} edition {edition}: {title}, {author/organization}
121
- def standard_citation(out, b)
122
- if ftitle = b.at(ns("./formattedref"))
115
+ def standard_citation(out, bib)
116
+ if ftitle = bib.at(ns("./formattedref"))
123
117
  ftitle&.children&.each { |n| parse(n, out) }
124
118
  else
125
- id = render_identifier(inline_bibitem_ref_code(b))
119
+ id = render_identifier(inline_bibitem_ref_code(bib))
126
120
  out << id[1] if id[1]
127
- ed = extract_edition(b) if is_iho?(b)
121
+ ed = extract_edition(bib) if iho?(bib)
128
122
  out << " edition #{ed}" if ed
129
123
  out << ": " if id[1] || ed
130
- iso_title(b)&.children&.each { |n| parse(n, out) }
124
+ iso_title(bib)&.children&.each { |n| parse(n, out) }
131
125
  out << ", "
132
- author = extract_author(b)
126
+ author = extract_author(bib)
133
127
  out << author
134
- u = extract_uri(b)
128
+ u = extract_uri(bib)
135
129
  out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
136
130
  end
137
131
  end
@@ -115,6 +115,13 @@ a.FootnoteRef + a.FootnoteRef:before {
115
115
  content: ", ";
116
116
  vertical-align: super; }
117
117
 
118
+ .addition {
119
+ color: blue; }
120
+
121
+ .deletion {
122
+ color: red;
123
+ text-decoration: line-through; }
124
+
118
125
  #standard-band {
119
126
  background-color: #0AC442; }
120
127
 
@@ -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
 
10
11
 
@@ -1084,6 +1085,9 @@
1084
1085
  <title-continued lang="en">(continued)</title-continued>
1085
1086
  <title-continued lang="fr">(continué)</title-continued>
1086
1087
 
1088
+ </xsl:variable><xsl:variable name="bibdata">
1089
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1090
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1087
1091
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1088
1092
  <xsl:param name="name"/>
1089
1093
  <xsl:param name="lang"/>
@@ -1109,13 +1113,16 @@
1109
1113
  </xsl:choose>
1110
1114
  </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">
1111
1115
 
1116
+
1112
1117
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1113
1118
 
1119
+
1114
1120
  <xsl:attribute name="color">blue</xsl:attribute>
1115
1121
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1116
1122
 
1117
1123
 
1118
1124
 
1125
+
1119
1126
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1120
1127
  <xsl:attribute name="white-space">pre</xsl:attribute>
1121
1128
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1184,6 +1191,7 @@
1184
1191
 
1185
1192
 
1186
1193
 
1194
+
1187
1195
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1188
1196
 
1189
1197
 
@@ -1203,9 +1211,7 @@
1203
1211
 
1204
1212
 
1205
1213
 
1206
-
1207
-
1208
-
1214
+
1209
1215
 
1210
1216
 
1211
1217
 
@@ -1237,6 +1243,7 @@
1237
1243
 
1238
1244
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1239
1245
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1246
+
1240
1247
 
1241
1248
 
1242
1249
 
@@ -1254,6 +1261,7 @@
1254
1261
 
1255
1262
 
1256
1263
 
1264
+
1257
1265
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1258
1266
 
1259
1267
 
@@ -1265,19 +1273,23 @@
1265
1273
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
1266
1274
 
1267
1275
 
1276
+
1268
1277
  <xsl:attribute name="color">blue</xsl:attribute>
1269
1278
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1270
1279
 
1271
1280
 
1281
+
1272
1282
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1273
1283
 
1274
1284
 
1275
1285
 
1276
1286
 
1287
+
1277
1288
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1278
1289
 
1279
1290
 
1280
1291
 
1292
+
1281
1293
 
1282
1294
 
1283
1295
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1300,6 +1312,7 @@
1300
1312
 
1301
1313
 
1302
1314
 
1315
+
1303
1316
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1304
1317
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1305
1318
 
@@ -1331,6 +1344,7 @@
1331
1344
 
1332
1345
 
1333
1346
 
1347
+
1334
1348
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1335
1349
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1336
1350
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -1339,6 +1353,7 @@
1339
1353
 
1340
1354
 
1341
1355
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1356
+
1342
1357
 
1343
1358
 
1344
1359
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -1363,9 +1378,11 @@
1363
1378
 
1364
1379
 
1365
1380
 
1381
+
1366
1382
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1367
1383
 
1368
1384
 
1385
+
1369
1386
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1370
1387
 
1371
1388
 
@@ -1373,12 +1390,14 @@
1373
1390
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1374
1391
 
1375
1392
 
1393
+
1376
1394
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1377
1395
 
1378
1396
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
1379
1397
 
1380
1398
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1381
1399
 
1400
+
1382
1401
 
1383
1402
 
1384
1403
 
@@ -1412,10 +1431,12 @@
1412
1431
 
1413
1432
 
1414
1433
 
1434
+
1415
1435
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
1416
1436
 
1417
1437
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
1418
1438
 
1439
+
1419
1440
  <xsl:attribute name="width">100%</xsl:attribute>
1420
1441
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
1421
1442
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -1441,15 +1462,36 @@
1441
1462
 
1442
1463
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1443
1464
 
1444
-
1465
+
1466
+
1445
1467
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1446
1468
 
1469
+
1447
1470
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1448
1471
 
1449
1472
 
1450
1473
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1451
1474
 
1452
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1475
+
1476
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1477
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1478
+ </xsl:variable><xsl:attribute-set name="add-style">
1479
+ <xsl:attribute name="color">red</xsl:attribute>
1480
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1481
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1482
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1483
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1484
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1485
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1486
+ <xsl:text>red</xsl:text>
1487
+ </xsl:variable><xsl:attribute-set name="del-style">
1488
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1489
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1490
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1491
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1492
+
1493
+
1494
+ </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">
1453
1495
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1454
1496
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1455
1497
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1494,16 +1536,17 @@
1494
1536
  <xsl:call-template name="add-zero-spaces-java"/>
1495
1537
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1496
1538
 
1539
+ <xsl:variable name="table-preamble">
1540
+
1541
+
1542
+ </xsl:variable>
1543
+
1497
1544
  <xsl:variable name="table">
1498
1545
 
1499
1546
  <xsl:variable name="simple-table">
1500
1547
  <xsl:call-template name="getSimpleTable"/>
1501
1548
  </xsl:variable>
1502
1549
 
1503
-
1504
-
1505
-
1506
-
1507
1550
  <!-- <xsl:if test="$namespace = 'bipm'">
1508
1551
  <fo:block>&#xA0;</fo:block>
1509
1552
  </xsl:if> -->
@@ -1518,7 +1561,7 @@
1518
1561
 
1519
1562
 
1520
1563
 
1521
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1564
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1522
1565
 
1523
1566
  <!-- <xsl:variable name="cols-count">
1524
1567
  <xsl:choose>
@@ -1537,8 +1580,6 @@
1537
1580
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1538
1581
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1539
1582
 
1540
-
1541
-
1542
1583
  <xsl:variable name="colwidths">
1543
1584
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1544
1585
  <xsl:call-template name="calculate-column-widths">
@@ -1566,9 +1607,11 @@
1566
1607
  </xsl:choose>
1567
1608
  </xsl:variable>
1568
1609
 
1610
+
1569
1611
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1570
1612
 
1571
1613
 
1614
+
1572
1615
 
1573
1616
 
1574
1617
 
@@ -1578,6 +1621,8 @@
1578
1621
 
1579
1622
 
1580
1623
 
1624
+
1625
+
1581
1626
  <xsl:attribute name="space-after">18pt</xsl:attribute>
1582
1627
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1583
1628
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -1601,6 +1646,8 @@
1601
1646
 
1602
1647
 
1603
1648
 
1649
+
1650
+
1604
1651
 
1605
1652
 
1606
1653
 
@@ -1693,7 +1740,8 @@
1693
1740
  </fo:block-container>
1694
1741
  </xsl:variable>
1695
1742
 
1696
-
1743
+ <xsl:variable name="isAdded" select="@added"/>
1744
+ <xsl:variable name="isDeleted" select="@deleted"/>
1697
1745
 
1698
1746
  <xsl:choose>
1699
1747
  <xsl:when test="@width">
@@ -1707,7 +1755,14 @@
1707
1755
  <fo:table-body>
1708
1756
  <fo:table-row>
1709
1757
  <fo:table-cell column-number="2">
1710
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1758
+ <xsl:copy-of select="$table-preamble"/>
1759
+ <fo:block>
1760
+ <xsl:call-template name="setTrackChangesStyles">
1761
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1762
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1763
+ </xsl:call-template>
1764
+ <xsl:copy-of select="$table"/>
1765
+ </fo:block>
1711
1766
  </fo:table-cell>
1712
1767
  </fo:table-row>
1713
1768
  </fo:table-body>
@@ -1718,16 +1773,42 @@
1718
1773
 
1719
1774
  </xsl:when>
1720
1775
  <xsl:otherwise>
1721
- <xsl:copy-of select="$table"/>
1776
+ <xsl:choose>
1777
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1778
+ <xsl:copy-of select="$table-preamble"/>
1779
+ <fo:block>
1780
+ <xsl:call-template name="setTrackChangesStyles">
1781
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1782
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1783
+ </xsl:call-template>
1784
+ <xsl:copy-of select="$table"/>
1785
+ </fo:block>
1786
+ </xsl:when>
1787
+ <xsl:otherwise>
1788
+ <xsl:copy-of select="$table-preamble"/>
1789
+ <xsl:copy-of select="$table"/>
1790
+ </xsl:otherwise>
1791
+ </xsl:choose>
1722
1792
  </xsl:otherwise>
1723
1793
  </xsl:choose>
1724
1794
 
1725
1795
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1796
+ <xsl:param name="continued"/>
1726
1797
  <xsl:if test="normalize-space() != ''">
1727
1798
  <fo:block xsl:use-attribute-sets="table-name-style">
1728
1799
 
1729
1800
 
1730
- <xsl:apply-templates/>
1801
+ <xsl:choose>
1802
+ <xsl:when test="$continued = 'true'">
1803
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
1804
+
1805
+ </xsl:when>
1806
+ <xsl:otherwise>
1807
+ <xsl:apply-templates/>
1808
+ </xsl:otherwise>
1809
+ </xsl:choose>
1810
+
1811
+
1731
1812
  </fo:block>
1732
1813
  </xsl:if>
1733
1814
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -1779,7 +1860,7 @@
1779
1860
  </xsl:for-each>
1780
1861
  </xsl:when>
1781
1862
  <xsl:otherwise>
1782
- <xsl:for-each select="xalan:nodeset($table)//tr">
1863
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1783
1864
  <xsl:variable name="td_text">
1784
1865
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1785
1866
 
@@ -1867,18 +1948,18 @@
1867
1948
  <xsl:apply-templates/>
1868
1949
  </fo:table-header>
1869
1950
  </xsl:template><xsl:template name="table-header-title">
1870
- <xsl:param name="cols-count"/>
1951
+ <xsl:param name="cols-count"/>
1871
1952
  <!-- row for title -->
1872
1953
  <fo:table-row>
1873
1954
  <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">
1874
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1955
+
1956
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1957
+ <xsl:with-param name="continued">true</xsl:with-param>
1958
+ </xsl:apply-templates>
1875
1959
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1876
1960
  <xsl:call-template name="fn_name_display"/>
1877
- </xsl:for-each>
1878
- <fo:block text-align="right" font-style="italic">
1879
- <xsl:text> </xsl:text>
1880
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1881
- </fo:block>
1961
+ </xsl:for-each>
1962
+
1882
1963
  </fo:table-cell>
1883
1964
  </fo:table-row>
1884
1965
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -2099,6 +2180,7 @@
2099
2180
 
2100
2181
 
2101
2182
 
2183
+
2102
2184
  </xsl:if>
2103
2185
  <xsl:if test="$parent-name = 'tfoot'">
2104
2186
 
@@ -2119,7 +2201,8 @@
2119
2201
  <xsl:attribute name="text-align">
2120
2202
  <xsl:choose>
2121
2203
  <xsl:when test="@align">
2122
- <xsl:value-of select="@align"/>
2204
+ <xsl:call-template name="setAlignment"/>
2205
+ <!-- <xsl:value-of select="@align"/> -->
2123
2206
  </xsl:when>
2124
2207
  <xsl:otherwise>center</xsl:otherwise>
2125
2208
  </xsl:choose>
@@ -2135,6 +2218,11 @@
2135
2218
 
2136
2219
 
2137
2220
 
2221
+
2222
+
2223
+ <xsl:if test="$lang = 'ar'">
2224
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2225
+ </xsl:if>
2138
2226
  <xsl:if test="@colspan">
2139
2227
  <xsl:attribute name="number-columns-spanned">
2140
2228
  <xsl:value-of select="@colspan"/>
@@ -2166,11 +2254,15 @@
2166
2254
  <xsl:attribute name="text-align">
2167
2255
  <xsl:choose>
2168
2256
  <xsl:when test="@align">
2169
- <xsl:value-of select="@align"/>
2257
+ <xsl:call-template name="setAlignment"/>
2258
+ <!-- <xsl:value-of select="@align"/> -->
2170
2259
  </xsl:when>
2171
2260
  <xsl:otherwise>left</xsl:otherwise>
2172
2261
  </xsl:choose>
2173
2262
  </xsl:attribute>
2263
+ <xsl:if test="$lang = 'ar'">
2264
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2265
+ </xsl:if>
2174
2266
  <!-- and ancestor::*[local-name() = 'thead'] -->
2175
2267
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2176
2268
 
@@ -2184,6 +2276,10 @@
2184
2276
 
2185
2277
 
2186
2278
 
2279
+
2280
+ <xsl:if test=".//*[local-name() = 'table']">
2281
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2282
+ </xsl:if>
2187
2283
  <xsl:if test="@colspan">
2188
2284
  <xsl:attribute name="number-columns-spanned">
2189
2285
  <xsl:value-of select="@colspan"/>
@@ -2316,13 +2412,13 @@
2316
2412
  </xsl:choose>
2317
2413
  </xsl:variable>
2318
2414
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2319
- <xsl:element name="{$ns}:table">
2415
+ <!-- <xsl:element name="{$ns}:table"> -->
2320
2416
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2321
2417
  <tbody>
2322
2418
  <xsl:apply-templates mode="dl"/>
2323
2419
  </tbody>
2324
2420
  </xsl:for-each>
2325
- </xsl:element>
2421
+ <!-- </xsl:element> -->
2326
2422
  </xsl:variable>
2327
2423
 
2328
2424
  <xsl:call-template name="calculate-column-widths">
@@ -2413,6 +2509,8 @@
2413
2509
  <xsl:apply-templates/>
2414
2510
  </fo:inline>
2415
2511
  </xsl:template><xsl:template match="*[local-name()='dl']">
2512
+ <xsl:variable name="isAdded" select="@added"/>
2513
+ <xsl:variable name="isDeleted" select="@deleted"/>
2416
2514
  <fo:block-container>
2417
2515
 
2418
2516
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2429,6 +2527,12 @@
2429
2527
  </xsl:attribute>
2430
2528
 
2431
2529
  </xsl:if>
2530
+
2531
+ <xsl:call-template name="setTrackChangesStyles">
2532
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2533
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2534
+ </xsl:call-template>
2535
+
2432
2536
  <fo:block-container>
2433
2537
 
2434
2538
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2484,6 +2588,7 @@
2484
2588
 
2485
2589
 
2486
2590
 
2591
+
2487
2592
  <xsl:variable name="title-key">
2488
2593
 
2489
2594
 
@@ -2540,11 +2645,11 @@
2540
2645
  </xsl:choose>
2541
2646
  </xsl:variable>
2542
2647
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2543
- <xsl:element name="{$ns}:table">
2648
+ <!-- <xsl:element name="{$ns}:table"> -->
2544
2649
  <tbody>
2545
2650
  <xsl:apply-templates mode="dl"/>
2546
2651
  </tbody>
2547
- </xsl:element>
2652
+ <!-- </xsl:element> -->
2548
2653
  </xsl:variable>
2549
2654
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2550
2655
  <xsl:variable name="colwidths">
@@ -2772,6 +2877,8 @@
2772
2877
 
2773
2878
  <xsl:apply-templates/>
2774
2879
  </fo:inline>
2880
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2881
+ <fo:inline padding-right="{@value}"> </fo:inline>
2775
2882
  </xsl:template><xsl:template match="*[local-name()='sup']">
2776
2883
  <fo:inline font-size="80%" vertical-align="super">
2777
2884
  <xsl:apply-templates/>
@@ -2797,6 +2904,7 @@
2797
2904
 
2798
2905
 
2799
2906
 
2907
+
2800
2908
 
2801
2909
  </xsl:variable>
2802
2910
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2814,8 +2922,74 @@
2814
2922
  <fo:inline text-decoration="underline">
2815
2923
  <xsl:apply-templates/>
2816
2924
  </fo:inline>
2925
+ </xsl:template><xsl:template match="*[local-name()='add']">
2926
+ <xsl:choose>
2927
+ <xsl:when test="@amendment">
2928
+ <fo:inline>
2929
+ <xsl:call-template name="insertTag">
2930
+ <xsl:with-param name="kind">A</xsl:with-param>
2931
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2932
+ </xsl:call-template>
2933
+ <xsl:apply-templates/>
2934
+ <xsl:call-template name="insertTag">
2935
+ <xsl:with-param name="type">closing</xsl:with-param>
2936
+ <xsl:with-param name="kind">A</xsl:with-param>
2937
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2938
+ </xsl:call-template>
2939
+ </fo:inline>
2940
+ </xsl:when>
2941
+ <xsl:when test="@corrigenda">
2942
+ <fo:inline>
2943
+ <xsl:call-template name="insertTag">
2944
+ <xsl:with-param name="kind">C</xsl:with-param>
2945
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2946
+ </xsl:call-template>
2947
+ <xsl:apply-templates/>
2948
+ <xsl:call-template name="insertTag">
2949
+ <xsl:with-param name="type">closing</xsl:with-param>
2950
+ <xsl:with-param name="kind">C</xsl:with-param>
2951
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2952
+ </xsl:call-template>
2953
+ </fo:inline>
2954
+ </xsl:when>
2955
+ <xsl:otherwise>
2956
+ <fo:inline xsl:use-attribute-sets="add-style">
2957
+ <xsl:apply-templates/>
2958
+ </fo:inline>
2959
+ </xsl:otherwise>
2960
+ </xsl:choose>
2961
+
2962
+ </xsl:template><xsl:template name="insertTag">
2963
+ <xsl:param name="type"/>
2964
+ <xsl:param name="kind"/>
2965
+ <xsl:param name="value"/>
2966
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2967
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2968
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2969
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2970
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2971
+ <xsl:attribute name="height">5mm</xsl:attribute>
2972
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2973
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2974
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2975
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2976
+ <g>
2977
+ <xsl:if test="$type = 'closing'">
2978
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2979
+ </xsl:if>
2980
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2981
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2982
+ </g>
2983
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2984
+ <xsl:if test="$type = 'closing'">
2985
+ <xsl:attribute name="x">25</xsl:attribute>
2986
+ </xsl:if>
2987
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2988
+ </text>
2989
+ </svg>
2990
+ </fo:instream-foreign-object>
2817
2991
  </xsl:template><xsl:template match="*[local-name()='del']">
2818
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2992
+ <fo:inline xsl:use-attribute-sets="del-style">
2819
2993
  <xsl:apply-templates/>
2820
2994
  </fo:inline>
2821
2995
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -3112,11 +3286,15 @@
3112
3286
  </xsl:apply-templates>
3113
3287
  </xsl:template><xsl:template name="getLang">
3114
3288
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3289
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3115
3290
  <xsl:variable name="language">
3116
3291
  <xsl:choose>
3117
3292
  <xsl:when test="$language_current != ''">
3118
3293
  <xsl:value-of select="$language_current"/>
3119
3294
  </xsl:when>
3295
+ <xsl:when test="$language_current_2 != ''">
3296
+ <xsl:value-of select="$language_current_2"/>
3297
+ </xsl:when>
3120
3298
  <xsl:otherwise>
3121
3299
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3122
3300
  </xsl:otherwise>
@@ -3156,13 +3334,23 @@
3156
3334
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3157
3335
  <xsl:value-of select="substring($str, 2)"/>
3158
3336
  </xsl:template><xsl:template match="mathml:math">
3159
- <fo:inline font-family="STIX Two Math"> <!-- -->
3337
+ <xsl:variable name="isAdded" select="@added"/>
3338
+ <xsl:variable name="isDeleted" select="@deleted"/>
3339
+
3340
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3341
+
3342
+
3343
+ <xsl:call-template name="setTrackChangesStyles">
3344
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3345
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3346
+ </xsl:call-template>
3160
3347
 
3161
3348
  <xsl:variable name="mathml">
3162
3349
  <xsl:apply-templates select="." mode="mathml"/>
3163
3350
  </xsl:variable>
3164
3351
  <fo:instream-foreign-object fox:alt-text="Math">
3165
3352
 
3353
+
3166
3354
  <!-- <xsl:copy-of select="."/> -->
3167
3355
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3168
3356
  </fo:instream-foreign-object>
@@ -3183,6 +3371,16 @@
3183
3371
  <mathml:mspace width="0.5ex"/>
3184
3372
  </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">
3185
3373
  <xsl:variable name="target">
3374
+ <xsl:choose>
3375
+ <xsl:when test="@updatetype = 'true'">
3376
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3377
+ </xsl:when>
3378
+ <xsl:otherwise>
3379
+ <xsl:value-of select="normalize-space(@target)"/>
3380
+ </xsl:otherwise>
3381
+ </xsl:choose>
3382
+ </xsl:variable>
3383
+ <xsl:variable name="target_text">
3186
3384
  <xsl:choose>
3187
3385
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3188
3386
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3195,19 +3393,19 @@
3195
3393
  <fo:inline xsl:use-attribute-sets="link-style">
3196
3394
 
3197
3395
  <xsl:choose>
3198
- <xsl:when test="$target = ''">
3396
+ <xsl:when test="$target_text = ''">
3199
3397
  <xsl:apply-templates/>
3200
3398
  </xsl:when>
3201
3399
  <xsl:otherwise>
3202
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3400
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3203
3401
  <xsl:choose>
3204
3402
  <xsl:when test="normalize-space(.) = ''">
3205
- <!-- <xsl:value-of select="$target"/> -->
3206
3403
  <xsl:call-template name="add-zero-spaces-link-java">
3207
- <xsl:with-param name="text" select="$target"/>
3404
+ <xsl:with-param name="text" select="$target_text"/>
3208
3405
  </xsl:call-template>
3209
3406
  </xsl:when>
3210
3407
  <xsl:otherwise>
3408
+ <!-- output text from <link>text</link> -->
3211
3409
  <xsl:apply-templates/>
3212
3410
  </xsl:otherwise>
3213
3411
  </xsl:choose>
@@ -3323,6 +3521,7 @@
3323
3521
 
3324
3522
 
3325
3523
  <fo:inline xsl:use-attribute-sets="note-name-style">
3524
+
3326
3525
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3327
3526
  </fo:inline>
3328
3527
  <xsl:apply-templates/>
@@ -3349,6 +3548,7 @@
3349
3548
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3350
3549
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3351
3550
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3551
+
3352
3552
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3353
3553
  </fo:inline>
3354
3554
  <xsl:apply-templates/>
@@ -3410,8 +3610,15 @@
3410
3610
  </fo:inline>
3411
3611
  </xsl:if>
3412
3612
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3613
+ <xsl:variable name="isAdded" select="@added"/>
3614
+ <xsl:variable name="isDeleted" select="@deleted"/>
3413
3615
  <fo:block-container id="{@id}">
3414
3616
 
3617
+ <xsl:call-template name="setTrackChangesStyles">
3618
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3619
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3620
+ </xsl:call-template>
3621
+
3415
3622
  <fo:block>
3416
3623
  <xsl:apply-templates/>
3417
3624
  </fo:block>
@@ -3419,7 +3626,10 @@
3419
3626
  <xsl:for-each select="*[local-name() = 'note']">
3420
3627
  <xsl:call-template name="note"/>
3421
3628
  </xsl:for-each>
3422
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3629
+
3630
+
3631
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3632
+
3423
3633
  </fo:block-container>
3424
3634
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
3425
3635
  <fo:block id="{@id}">
@@ -3431,37 +3641,122 @@
3431
3641
  <xsl:apply-templates/>
3432
3642
  </fo:block>
3433
3643
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3434
- <fo:block xsl:use-attribute-sets="image-style">
3435
-
3436
-
3437
- <xsl:variable name="src">
3438
- <xsl:choose>
3439
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3440
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3441
- </xsl:when>
3442
- <xsl:otherwise>
3443
- <xsl:value-of select="@src"/>
3444
- </xsl:otherwise>
3445
- </xsl:choose>
3446
- </xsl:variable>
3447
-
3448
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3449
- </fo:block>
3644
+ <xsl:variable name="isAdded" select="../@added"/>
3645
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3646
+ <xsl:choose>
3647
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3648
+ <fo:inline padding-left="1mm" padding-right="1mm">
3649
+ <xsl:variable name="src">
3650
+ <xsl:call-template name="image_src"/>
3651
+ </xsl:variable>
3652
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3653
+ </fo:inline>
3654
+ </xsl:when>
3655
+ <xsl:otherwise>
3656
+ <fo:block xsl:use-attribute-sets="image-style">
3657
+
3658
+ <xsl:variable name="src">
3659
+ <xsl:call-template name="image_src"/>
3660
+ </xsl:variable>
3661
+
3662
+ <xsl:choose>
3663
+ <xsl:when test="$isDeleted = 'true'">
3664
+ <!-- enclose in svg -->
3665
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3666
+ <xsl:attribute name="width">100%</xsl:attribute>
3667
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3668
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3669
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3670
+
3671
+
3672
+ <xsl:apply-templates select="." mode="cross_image"/>
3673
+
3674
+ </fo:instream-foreign-object>
3675
+ </xsl:when>
3676
+ <xsl:otherwise>
3677
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3678
+ </xsl:otherwise>
3679
+ </xsl:choose>
3680
+
3681
+ </fo:block>
3682
+ </xsl:otherwise>
3683
+ </xsl:choose>
3684
+ </xsl:template><xsl:template name="image_src">
3685
+ <xsl:choose>
3686
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3687
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3688
+ </xsl:when>
3689
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3690
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3691
+ </xsl:when>
3692
+ <xsl:otherwise>
3693
+ <xsl:value-of select="@src"/>
3694
+ </xsl:otherwise>
3695
+ </xsl:choose>
3696
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3697
+ <xsl:choose>
3698
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3699
+ <xsl:variable name="src">
3700
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3701
+ </xsl:variable>
3702
+ <xsl:variable name="width" select="document($src)/@width"/>
3703
+ <xsl:variable name="height" select="document($src)/@height"/>
3704
+ <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">
3705
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3706
+ </svg>
3707
+ </xsl:when>
3708
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3709
+ <xsl:variable name="src">
3710
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3711
+ </xsl:variable>
3712
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3713
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3714
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3715
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3716
+ <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">
3717
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3718
+ </svg>
3719
+ </xsl:when>
3720
+ <xsl:otherwise>
3721
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3722
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3723
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3724
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3725
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3726
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3727
+ <!-- width=<xsl:value-of select="$width"/> -->
3728
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3729
+ <!-- height=<xsl:value-of select="$height"/> -->
3730
+ <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">
3731
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3732
+ <xsl:call-template name="svg_cross">
3733
+ <xsl:with-param name="width" select="$width"/>
3734
+ <xsl:with-param name="height" select="$height"/>
3735
+ </xsl:call-template>
3736
+ </svg>
3737
+ </xsl:otherwise>
3738
+ </xsl:choose>
3739
+
3740
+ </xsl:template><xsl:template name="svg_cross">
3741
+ <xsl:param name="width"/>
3742
+ <xsl:param name="height"/>
3743
+ <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; "/>
3744
+ <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; "/>
3450
3745
  </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">
3451
3746
  <xsl:apply-templates mode="contents"/>
3452
3747
  <xsl:text> </xsl:text>
3453
3748
  </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">
3454
3749
  <xsl:apply-templates mode="bookmarks"/>
3455
3750
  <xsl:text> </xsl:text>
3456
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3751
+ </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">
3457
3752
  <xsl:value-of select="."/>
3458
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3753
+ </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">
3459
3754
  <xsl:value-of select="."/>
3460
3755
  </xsl:template><xsl:template match="node()" mode="contents">
3461
3756
  <xsl:apply-templates mode="contents"/>
3462
3757
  </xsl:template><xsl:template match="node()" mode="bookmarks">
3463
3758
  <xsl:apply-templates mode="bookmarks"/>
3464
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3759
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
3465
3760
  <xsl:apply-templates select="."/>
3466
3761
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3467
3762
  <xsl:apply-templates mode="bookmarks"/>
@@ -3660,6 +3955,8 @@
3660
3955
  </fo:list-item-body>
3661
3956
  </fo:list-item>
3662
3957
  </fo:list-block>
3958
+ </xsl:template><xsl:template name="extractSection">
3959
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3663
3960
  </xsl:template><xsl:template name="extractTitle">
3664
3961
  <xsl:choose>
3665
3962
  <xsl:when test="*[local-name() = 'tab']">
@@ -3686,6 +3983,7 @@
3686
3983
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3687
3984
 
3688
3985
  <fo:block-container margin-left="0mm">
3986
+ <xsl:copy-of select="@id"/>
3689
3987
  <xsl:if test="parent::*[local-name() = 'note']">
3690
3988
  <xsl:attribute name="margin-left">
3691
3989
  <xsl:choose>
@@ -3707,6 +4005,7 @@
3707
4005
 
3708
4006
 
3709
4007
 
4008
+
3710
4009
 
3711
4010
 
3712
4011
 
@@ -3962,6 +4261,7 @@
3962
4261
  </xsl:template><xsl:template match="*[local-name() = 'example']">
3963
4262
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
3964
4263
 
4264
+
3965
4265
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3966
4266
 
3967
4267
  <xsl:variable name="element">
@@ -3989,6 +4289,7 @@
3989
4289
  <xsl:variable name="element">
3990
4290
  block
3991
4291
 
4292
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3992
4293
  </xsl:variable>
3993
4294
  <xsl:choose>
3994
4295
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3996,7 +4297,7 @@
3996
4297
  <xsl:apply-templates/>
3997
4298
  </fo:inline>
3998
4299
  </xsl:when>
3999
- <xsl:when test="normalize-space($element) = 'block'">
4300
+ <xsl:when test="contains(normalize-space($element), 'block')">
4000
4301
  <fo:block xsl:use-attribute-sets="example-name-style">
4001
4302
  <xsl:apply-templates/>
4002
4303
  </fo:block>
@@ -4028,7 +4329,7 @@
4028
4329
  </fo:inline>
4029
4330
  </xsl:otherwise>
4030
4331
  </xsl:choose>
4031
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
4332
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
4032
4333
  <fo:block xsl:use-attribute-sets="termsource-style">
4033
4334
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
4034
4335
  <xsl:variable name="termsource_text">
@@ -4037,13 +4338,15 @@
4037
4338
 
4038
4339
  <xsl:choose>
4039
4340
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
4040
- <xsl:apply-templates/>
4341
+ <!-- <xsl:apply-templates /> -->
4342
+ <xsl:copy-of select="$termsource_text"/>
4041
4343
  </xsl:when>
4042
4344
  <xsl:otherwise>
4043
4345
 
4044
4346
  <xsl:text>[</xsl:text>
4045
4347
 
4046
- <xsl:apply-templates/>
4348
+ <!-- <xsl:apply-templates /> -->
4349
+ <xsl:copy-of select="$termsource_text"/>
4047
4350
 
4048
4351
  <xsl:text>]</xsl:text>
4049
4352
 
@@ -4054,8 +4357,15 @@
4054
4357
  <xsl:if test="normalize-space() != ''">
4055
4358
  <xsl:value-of select="."/>
4056
4359
  </xsl:if>
4057
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
4360
+ </xsl:template><xsl:variable name="localized.source">
4361
+ <xsl:call-template name="getLocalizedString">
4362
+ <xsl:with-param name="key">source</xsl:with-param>
4363
+ </xsl:call-template>
4364
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4058
4365
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4366
+ <xsl:if test="normalize-space(@citeas) = ''">
4367
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4368
+ </xsl:if>
4059
4369
 
4060
4370
  <fo:inline>
4061
4371
 
@@ -4065,9 +4375,9 @@
4065
4375
  <xsl:call-template name="getTitle">
4066
4376
  <xsl:with-param name="name" select="'title-source'"/>
4067
4377
  </xsl:call-template>
4378
+ <xsl:text>: </xsl:text>
4068
4379
 
4069
4380
 
4070
- <xsl:text>: </xsl:text>
4071
4381
  </fo:inline>
4072
4382
 
4073
4383
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -4194,6 +4504,7 @@
4194
4504
 
4195
4505
 
4196
4506
 
4507
+
4197
4508
  </xsl:variable>
4198
4509
 
4199
4510
  <xsl:variable name="padding-right">
@@ -4219,7 +4530,8 @@
4219
4530
  </fo:inline>
4220
4531
  </xsl:when>
4221
4532
  <xsl:otherwise>
4222
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4533
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4534
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4223
4535
  </xsl:otherwise>
4224
4536
  </xsl:choose>
4225
4537
 
@@ -4273,7 +4585,6 @@
4273
4585
 
4274
4586
 
4275
4587
 
4276
-
4277
4588
  <xsl:apply-templates/>
4278
4589
  </fo:block>
4279
4590
 
@@ -4316,7 +4627,7 @@
4316
4627
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4317
4628
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4318
4629
  <xsl:choose>
4319
- <xsl:when test="parent::*[local-name() = 'note']">
4630
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
4320
4631
  <fo:block-container>
4321
4632
  <xsl:attribute name="margin-left">
4322
4633
  <xsl:choose>
@@ -4326,6 +4637,7 @@
4326
4637
  </xsl:attribute>
4327
4638
 
4328
4639
 
4640
+
4329
4641
  <fo:block-container margin-left="0mm">
4330
4642
  <fo:block>
4331
4643
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -4626,6 +4938,10 @@
4626
4938
  </xsl:choose>
4627
4939
  <!-- end IHO bibitem processing -->
4628
4940
 
4941
+
4942
+
4943
+
4944
+
4629
4945
  </xsl:template><xsl:template name="processBibitemDocId">
4630
4946
  <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')]"/>
4631
4947
  <xsl:choose>
@@ -4682,6 +4998,70 @@
4682
4998
  <xsl:value-of select="substring(.,1,1)"/>
4683
4999
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4684
5000
  <fo:inline><xsl:apply-templates/></fo:inline>
5001
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5002
+ <fo:block>
5003
+ <xsl:apply-templates/>
5004
+ </fo:block>
5005
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5006
+ <fo:inline><xsl:apply-templates/></fo:inline>
5007
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5008
+ <fo:inline>
5009
+ <xsl:call-template name="text_input"/>
5010
+ </fo:inline>
5011
+ </xsl:template><xsl:template name="text_input">
5012
+ <xsl:variable name="count">
5013
+ <xsl:choose>
5014
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5015
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5016
+ <xsl:otherwise>10</xsl:otherwise>
5017
+ </xsl:choose>
5018
+ </xsl:variable>
5019
+ <xsl:call-template name="repeat">
5020
+ <xsl:with-param name="char" select="'_'"/>
5021
+ <xsl:with-param name="count" select="$count"/>
5022
+ </xsl:call-template>
5023
+ <xsl:text> </xsl:text>
5024
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5025
+ <xsl:variable name="caption">
5026
+ <xsl:choose>
5027
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5028
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5029
+ </xsl:choose>
5030
+ </xsl:variable>
5031
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5032
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5033
+ <fo:inline padding-right="1mm">
5034
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5035
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5036
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5037
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5038
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5039
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5040
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5041
+ </svg>
5042
+ </fo:instream-foreign-object>
5043
+ </fo:inline>
5044
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5045
+ <fo:inline padding-right="1mm">
5046
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5047
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5048
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5049
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5050
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5051
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5052
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5053
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5054
+ </svg>
5055
+ </fo:instream-foreign-object>
5056
+ </fo:inline>
5057
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5058
+ <fo:inline>
5059
+ <xsl:call-template name="text_input"/>
5060
+ </fo:inline>
5061
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5062
+ <fo:block-container border="1pt solid black" width="50%">
5063
+ <fo:block> </fo:block>
5064
+ </fo:block-container>
4685
5065
  </xsl:template><xsl:template name="convertDate">
4686
5066
  <xsl:param name="date"/>
4687
5067
  <xsl:param name="format" select="'short'"/>
@@ -4889,6 +5269,9 @@
4889
5269
  <xsl:when test="parent::*[local-name() = 'preface']">
4890
5270
  <xsl:value-of select="$level_total - 1"/>
4891
5271
  </xsl:when>
5272
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5273
+ <xsl:value-of select="$level_total - 1"/>
5274
+ </xsl:when>
4892
5275
  <xsl:when test="ancestor::*[local-name() = 'preface']">
4893
5276
  <xsl:value-of select="$level_total - 2"/>
4894
5277
  </xsl:when>
@@ -4954,6 +5337,7 @@
4954
5337
 
4955
5338
 
4956
5339
 
5340
+
4957
5341
  <xsl:value-of select="document('')//*/namespace::iho"/>
4958
5342
 
4959
5343
 
@@ -5013,17 +5397,69 @@
5013
5397
  </xsl:call-template>
5014
5398
  </xsl:if>
5015
5399
  </xsl:template><xsl:template name="getLocalizedString">
5016
- <xsl:param name="key"/>
5400
+ <xsl:param name="key"/>
5017
5401
 
5018
5402
  <xsl:variable name="curr_lang">
5019
5403
  <xsl:call-template name="getLang"/>
5020
5404
  </xsl:variable>
5021
5405
 
5406
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5407
+
5022
5408
  <xsl:choose>
5409
+ <xsl:when test="$data_value != ''">
5410
+ <xsl:value-of select="$data_value"/>
5411
+ </xsl:when>
5023
5412
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5024
5413
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5025
5414
  </xsl:when>
5026
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5415
+ <xsl:otherwise>
5416
+ <xsl:variable name="key_">
5417
+ <xsl:call-template name="capitalize">
5418
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5419
+ </xsl:call-template>
5420
+ </xsl:variable>
5421
+ <xsl:value-of select="$key_"/>
5422
+ </xsl:otherwise>
5027
5423
  </xsl:choose>
5028
5424
 
5425
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5426
+ <xsl:param name="isAdded"/>
5427
+ <xsl:param name="isDeleted"/>
5428
+ <xsl:choose>
5429
+ <xsl:when test="local-name() = 'math'">
5430
+ <xsl:if test="$isAdded = 'true'">
5431
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5432
+ </xsl:if>
5433
+ <xsl:if test="$isDeleted = 'true'">
5434
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5435
+ </xsl:if>
5436
+ </xsl:when>
5437
+ <xsl:otherwise>
5438
+ <xsl:if test="$isAdded = 'true'">
5439
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5440
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5441
+ </xsl:if>
5442
+ <xsl:if test="$isDeleted = 'true'">
5443
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5444
+ <xsl:if test="local-name() = 'table'">
5445
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5446
+ </xsl:if>
5447
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5448
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5449
+ </xsl:if>
5450
+ </xsl:otherwise>
5451
+ </xsl:choose>
5452
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5453
+ <xsl:if test="$lang = 'ar'">
5454
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5455
+ </xsl:if>
5456
+ </xsl:template><xsl:template name="setAlignment">
5457
+ <xsl:param name="align" select="normalize-space(@align)"/>
5458
+ <xsl:choose>
5459
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5460
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5461
+ <xsl:when test="$align != ''">
5462
+ <xsl:value-of select="$align"/>
5463
+ </xsl:when>
5464
+ </xsl:choose>
5029
5465
  </xsl:template></xsl:stylesheet>