metanorma-bipm 1.0.6 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,8 @@
35
35
  {% if partid_alt %}<span class="title-second">{{ partid_alt}}: {{ partsubtitle }}</span>{% endif %}
36
36
  {% if subparttitle %}<span class="title-first">{{ subparttitle }}</span><br/>{% endif %}
37
37
  {% if subpartsubtitle %}<span class="title-second">{{ subpartsubtitle }}</span><br/>{% endif %}
38
+ {% if provenancetitle %}<span class="title-first">{{ provenancetitle }}</span><br/>{% endif %}
39
+ {% if provenancesubtitle %}<span class="title-second">{{ provenancesubtitle }}</span><br/>{% endif %}
38
40
  {% if appendixid %}<span class="title-first">{{ appendixid}}: {{ appendixtitle }}</span><br/>{% endif %}
39
41
  {% if appendixid_alt %}<span class="title-second">{{ appendixid_alt}}: {{ appendixsubtitle }}</span>{% endif %}
40
42
  {% if annexid %}<span class="title-first">{{ annexid}}: {{ annextitle }}</span><br/>{% endif %}
@@ -116,6 +116,13 @@ a.FootnoteRef + a.FootnoteRef:before {
116
116
  content: ", ";
117
117
  vertical-align: super; }
118
118
 
119
+ .addition {
120
+ color: blue; }
121
+
122
+ .deletion {
123
+ color: red;
124
+ text-decoration: line-through; }
125
+
119
126
  #brochure-band {
120
127
  background-color: #0AC442; }
121
128
 
@@ -1,10 +1,21 @@
1
1
  annex: Appendix
2
2
  appendix: Annex
3
+ iso_annex: Annex
3
4
  see: see
4
5
  see_also: see also
5
6
  clause: Chapter
6
7
  subclause: Section
8
+ clause_jcgm: Clause
9
+ subclause_jcgm: Clause
7
10
  formula: Equation
8
11
  inequality: Inequality
9
12
  bibliography: References
10
13
  index: Index
14
+ norm_with_refs_pref:
15
+ The following referenced documents are indispensable for the application of this document.
16
+ For dated references, only the edition cited applies.
17
+ For undated references, the latest edition of the referenced
18
+ document (including any amendments) applies.
19
+ all_rights_reserved: All rights reserved
20
+ table_of_contents: Contents
21
+ source: Adapted from
@@ -1,9 +1,12 @@
1
1
  annex: Annexe
2
2
  appendix: Appendice
3
+ iso_annex: Annexe
3
4
  see: voir
4
5
  see_also: voir aussi
5
6
  clause: chapître
6
7
  subclause: section
8
+ clause_jcgm: Article
9
+ subclause_jcgm: Article
7
10
  formula: équation
8
11
  inequality: inégalité
9
12
  bibliography: Références
@@ -34,3 +37,8 @@ stage_dict:
34
37
  draft-development: projet-de-développement
35
38
  in-force: en-vigeur
36
39
  retired: retiré
40
+ norm_with_refs_pref:
41
+ Les documents suivants cités dans le texte sont indispensables pour l'application de ce document. Pour les références datées, seule l’édition citée s’applique. Pour les références non datées, la dernière édition du document de référence s’applique (y compris les éventuels amendements).
42
+ all_rights_reserved: Tous droits réservés
43
+ table_of_contents: Table des matières
44
+ source: Adapté de
@@ -4,19 +4,23 @@ require "sterile"
4
4
  module IsoDoc
5
5
  module BIPM
6
6
  class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
7
- def add_id
7
+ def add_id
8
8
  %(id="_#{UUIDTools::UUID.random_create}")
9
9
  end
10
10
 
11
11
  def index(docxml)
12
12
  unless docxml.at(ns("//index"))
13
- docxml.xpath(ns("//indexsect")).each { |i| i.remove }
13
+ docxml.xpath(ns("//indexsect")).each(&:remove)
14
14
  return
15
15
  end
16
16
  i = docxml.at(ns("//indexsect")) ||
17
- docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}</title></indexsect>").first
18
- index = sort_indexterms(docxml.xpath(ns("//index")), docxml.xpath(ns("//index-xref[@also = 'false']")),
19
- docxml.xpath(ns("//index-xref[@also = 'true']")))
17
+ docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
18
+ "</title></indexsect>").first
19
+ index = sort_indexterms(
20
+ docxml.xpath(ns("//index")),
21
+ docxml.xpath(ns("//index-xref[@also = 'false']")),
22
+ docxml.xpath(ns("//index-xref[@also = 'true']"))
23
+ )
20
24
  index1(docxml, i, index)
21
25
  end
22
26
 
@@ -28,11 +32,12 @@ module IsoDoc
28
32
  c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
29
33
  end
30
34
  end
31
- @xrefs.bookmark_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
35
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
36
+ @xrefs.bookmark_anchor_names(docxml)
32
37
  end
33
38
 
34
- def sortable(s)
35
- HTMLEntities.new.decode(Nokogiri::XML.fragment(s).text)
39
+ def sortable(str)
40
+ HTMLEntities.new.decode(Nokogiri::XML.fragment(str).text)
36
41
  end
37
42
 
38
43
  def index_entries_opt
@@ -40,8 +45,11 @@ module IsoDoc
40
45
  end
41
46
 
42
47
  def index_entries(words, index, primary)
43
- ret = index_entries_head(words[primary], index.dig(words[primary], nil, nil), index_entries_opt)
44
- words2 = index[words[primary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
48
+ ret = index_entries_head(words[primary],
49
+ index.dig(words[primary], nil, nil),
50
+ index_entries_opt)
51
+ words2 = index[words[primary]]&.keys&.compact
52
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
45
53
  unless words2.empty?
46
54
  ret += "<ul>"
47
55
  words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -49,12 +57,15 @@ module IsoDoc
49
57
  end
50
58
  ret += "</ul>"
51
59
  end
52
- ret + "</li>"
60
+ "#{ret}</li>"
53
61
  end
54
62
 
55
63
  def index_entries2(words, index, secondary)
56
- ret = index_entries_head(words[secondary], index.dig(words[secondary], nil), index_entries_opt)
57
- words3 = index[words[secondary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
64
+ ret = index_entries_head(words[secondary],
65
+ index.dig(words[secondary], nil),
66
+ index_entries_opt)
67
+ words3 = index[words[secondary]]&.keys&.reject { |k| k.nil? }
68
+ &.each_with_object({}) { |w, v| v[w.downcase] = w }
58
69
  unless words3.empty?
59
70
  ret += "<ul>"
60
71
  words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
@@ -62,7 +73,7 @@ module IsoDoc
62
73
  end
63
74
  ret += "</ul>"
64
75
  end
65
- ret + "</li>"
76
+ "#{ret}</li>"
66
77
  end
67
78
 
68
79
  def index_entries_head(head, entries, opt)
@@ -110,8 +121,9 @@ module IsoDoc
110
121
  end
111
122
  end
112
123
 
113
- def xml_encode_attr(s)
114
- HTMLEntities.new.encode(s, :basic, :hexadecimal).gsub(/\&#x([^;]+);/) { |x| "&#x#{$1.upcase};" }
124
+ def xml_encode_attr(str)
125
+ HTMLEntities.new.encode(str, :basic, :hexadecimal)
126
+ .gsub(/&#x([^;]+);/) { |_x| "&#x#{$1.upcase};" }
115
127
  end
116
128
 
117
129
  # attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
@@ -130,10 +142,10 @@ module IsoDoc
130
142
  end
131
143
  end
132
144
 
133
- def index2bookmark(t)
134
- t.name = "bookmark"
135
- t.children.each { |x| x.remove }
136
- t["id"] = "_#{UUIDTools::UUID.random_create}"
145
+ def index2bookmark(node)
146
+ node.name = "bookmark"
147
+ node.children.each(&:remove)
148
+ node["id"] = "_#{UUIDTools::UUID.random_create}"
137
149
  end
138
150
  end
139
151
  end
@@ -10,7 +10,7 @@ module IsoDoc
10
10
  @meta = Metadata.new(lang, script, labels)
11
11
  end
12
12
 
13
- def xref_init(lang, script, klass, labels, options)
13
+ def xref_init(lang, script, _klass, labels, options)
14
14
  html = HtmlConvert.new(language: lang, script: script)
15
15
  @xrefs = Xref.new(lang, script, html, labels, options)
16
16
  end
@@ -21,4 +21,3 @@ module IsoDoc
21
21
  end
22
22
  end
23
23
  end
24
-
@@ -4,6 +4,7 @@
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
6
  <xsl:variable name="images" select="document($svg_images)"/>
7
+ <xsl:param name="basepath"/>
7
8
 
8
9
  <!-- <item id="#">N_page</item> -->
9
10
  <!-- param for second pass -->
@@ -213,7 +214,7 @@
213
214
  <xsl:call-template name="printEdition"/>
214
215
  <xsl:text>  </xsl:text>
215
216
  <xsl:call-template name="convertDate">
216
- <xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:version/jcgm:revision-date"/>
217
+ <xsl:with-param name="date" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:date[@type = 'published']/jcgm:on"/>
217
218
  </xsl:call-template>
218
219
  </fo:block>
219
220
  <!-- Example © JCGM 2009 -->
@@ -227,13 +228,16 @@
227
228
  <fo:flow flow-name="xsl-region-body">
228
229
  <xsl:call-template name="insert_Logo-BIPM-Metro"/>
229
230
  <fo:block-container font-weight="bold">
230
- <fo:block font-size="16.5pt" space-after="24.5mm">
231
+ <fo:block font-size="16.5pt">
231
232
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:editorialgroup/jcgm:committee/@acronym"/>
232
233
  <xsl:text> </xsl:text>
233
234
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:docnumber"/>
234
235
  <fo:inline font-weight="normal">:</fo:inline>
235
236
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:copyright/jcgm:from"/>
236
237
  </fo:block>
238
+ <fo:block font-size="13pt" font-weight="normal" space-after="19.5mm">
239
+ <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
240
+ </fo:block>
237
241
  <fo:block border-bottom="1pt solid black"> </fo:block>
238
242
  <fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%">
239
243
  <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
@@ -597,7 +601,7 @@
597
601
 
598
602
  <xsl:template name="getListItemFormat">
599
603
  <xsl:choose>
600
- <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
604
+ <xsl:when test="local-name(..) = 'ul' and ../ancestor::jcgm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
601
605
  <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- &#x2014; dash -->
602
606
  <xsl:otherwise> <!-- for ordered lists -->
603
607
  <xsl:variable name="start_value">
@@ -807,6 +811,42 @@
807
811
  </fo:footnote>
808
812
  </xsl:template>
809
813
 
814
+
815
+ <!--
816
+ <fn reference="1">
817
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
818
+ </fn>
819
+ -->
820
+ <xsl:template match="jcgm:title//jcgm:fn | jcgm:name//jcgm:fn | jcgm:p/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:p/*/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:sourcecode/jcgm:fn[not(ancestor::jcgm:table)]" priority="2" name="fn">
821
+ <fo:footnote keep-with-previous.within-line="always">
822
+ <xsl:variable name="number">
823
+ <xsl:number count="jcgm:fn[not(ancestor::jcgm:table)]" level="any"/>
824
+ </xsl:variable>
825
+ <xsl:variable name="gen_id" select="generate-id()"/>
826
+ <xsl:variable name="lang" select="ancestor::jcgm:bipm-standard/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
827
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
828
+ <fo:basic-link internal-destination="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" fox:alt-text="footnote {@reference}">
829
+ <xsl:value-of select="$number"/>
830
+ </fo:basic-link>
831
+ </fo:inline>
832
+ <fo:footnote-body>
833
+ <fo:block font-size="9pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" line-height="124%" text-align="justify">
834
+ <fo:inline id="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super" padding-right="1mm"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
835
+ <xsl:value-of select="$number "/>
836
+ </fo:inline>
837
+ <xsl:for-each select="jcgm:p">
838
+ <xsl:apply-templates/>
839
+ </xsl:for-each>
840
+ </fo:block>
841
+ </fo:footnote-body>
842
+ </fo:footnote>
843
+ </xsl:template>
844
+
845
+ <xsl:template match="jcgm:fn/jcgm:p">
846
+ <fo:block>
847
+ <xsl:apply-templates/>
848
+ </fo:block>
849
+ </xsl:template>
810
850
 
811
851
 
812
852
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="ul_ol">
@@ -982,6 +1022,12 @@
982
1022
  <xsl:apply-templates select="." mode="mathml"/>
983
1023
  </xsl:variable>
984
1024
  <fo:instream-foreign-object fox:alt-text="Math">
1025
+ <xsl:if test="local-name(../..) = 'formula' or (local-name(../..) = 'td' and count(../../*) = 1)">
1026
+ <xsl:attribute name="width">95%</xsl:attribute>
1027
+ <xsl:attribute name="content-height">100%</xsl:attribute>
1028
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
1029
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1030
+ </xsl:if>
985
1031
  <!-- <xsl:copy-of select="."/> -->
986
1032
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
987
1033
  </fo:instream-foreign-object>
@@ -1082,6 +1128,17 @@
1082
1128
  </xsl:template>
1083
1129
 
1084
1130
 
1131
+ <xsl:template match="*[local-name()='td' or local-name()='th']/*[local-name()='formula']/*[local-name()='stem']" priority="2">
1132
+ <fo:block>
1133
+ <xsl:if test="ancestor::*[local-name()='td' or local-name()='th'][1][@align]">
1134
+ <xsl:attribute name="text-align">
1135
+ <xsl:value-of select="ancestor::*[local-name()='td' or local-name()='th'][1]/@align"/>
1136
+ </xsl:attribute>
1137
+ </xsl:if>
1138
+ <xsl:apply-templates/>
1139
+ </fo:block>
1140
+ </xsl:template>
1141
+
1085
1142
  <xsl:template match="*[local-name()='formula']/*[local-name()='stem']">
1086
1143
  <fo:block margin-top="6pt" margin-bottom="12pt">
1087
1144
  <fo:table table-layout="fixed" width="100%">
@@ -1320,6 +1377,7 @@
1320
1377
  <xsl:variable name="font-size">
1321
1378
  <xsl:choose>
1322
1379
  <xsl:when test="ancestor::jcgm:preface">15pt</xsl:when>
1380
+ <xsl:when test="parent::jcgm:annex">15pt</xsl:when>
1323
1381
  <xsl:when test="../@inline-header = 'true' or @inline-header = 'true'">10.5pt</xsl:when>
1324
1382
  <xsl:when test="$level = 2">11.5pt</xsl:when>
1325
1383
  <xsl:when test="$level &gt;= 3">10.5pt</xsl:when>
@@ -1351,6 +1409,8 @@
1351
1409
  <xsl:attribute name="space-after">
1352
1410
  <xsl:choose>
1353
1411
  <xsl:when test="ancestor::jcgm:preface">12pt</xsl:when>
1412
+ <xsl:when test="parent::jcgm:annex">30pt</xsl:when>
1413
+ <xsl:when test="following-sibling::*[1][local-name() = 'admitted']">0pt</xsl:when>
1354
1414
  <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1355
1415
  <xsl:otherwise>12pt</xsl:otherwise>
1356
1416
  </xsl:choose>
@@ -1364,6 +1424,10 @@
1364
1424
  </xsl:choose>
1365
1425
  </xsl:attribute>
1366
1426
  </xsl:if>
1427
+ <xsl:if test="parent::jcgm:annex">
1428
+ <xsl:attribute name="text-align">center</xsl:attribute>
1429
+ <xsl:attribute name="line-height">130%</xsl:attribute>
1430
+ </xsl:if>
1367
1431
  <xsl:apply-templates/>
1368
1432
  </xsl:element>
1369
1433
 
@@ -1380,41 +1444,43 @@
1380
1444
  <xsl:param name="font-size" select="'65%'"/>
1381
1445
  <xsl:param name="baseline-shift" select="'30%'"/>
1382
1446
  <xsl:param name="curr_lang" select="'fr'"/>
1383
- <fo:inline>
1384
- <xsl:variable name="title-edition">
1385
- <xsl:call-template name="getTitle">
1386
- <xsl:with-param name="name" select="'title-edition'"/>
1387
- <xsl:with-param name="lang" select="$curr_lang"/>
1388
- </xsl:call-template>
1389
- </xsl:variable>
1390
- <xsl:value-of select="."/>
1391
- <fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
1392
- <xsl:if test="$curr_lang = 'en'">
1393
- <xsl:attribute name="baseline-shift">0%</xsl:attribute>
1394
- <xsl:attribute name="font-size">100%</xsl:attribute>
1395
- </xsl:if>
1396
- <xsl:choose>
1397
- <xsl:when test="$curr_lang = 'fr'">
1398
- <xsl:choose>
1399
- <xsl:when test=". = '1'">re</xsl:when>
1400
- <xsl:otherwise>e</xsl:otherwise>
1401
- </xsl:choose>
1402
- </xsl:when>
1403
- <xsl:otherwise>
1404
- <xsl:choose>
1405
- <xsl:when test=". = '1'">st</xsl:when>
1406
- <xsl:when test=". = '2'">nd</xsl:when>
1407
- <xsl:when test=". = '3'">rd</xsl:when>
1408
- <xsl:otherwise>th</xsl:otherwise>
1409
- </xsl:choose>
1410
- </xsl:otherwise>
1411
- </xsl:choose>
1412
-
1447
+ <xsl:if test="normalize-space (.) != '1'">
1448
+ <fo:inline>
1449
+ <xsl:variable name="title-edition">
1450
+ <xsl:call-template name="getTitle">
1451
+ <xsl:with-param name="name" select="'title-edition'"/>
1452
+ <xsl:with-param name="lang" select="$curr_lang"/>
1453
+ </xsl:call-template>
1454
+ </xsl:variable>
1455
+ <xsl:value-of select="."/>
1456
+ <fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
1457
+ <xsl:if test="$curr_lang = 'en'">
1458
+ <xsl:attribute name="baseline-shift">0%</xsl:attribute>
1459
+ <xsl:attribute name="font-size">100%</xsl:attribute>
1460
+ </xsl:if>
1461
+ <xsl:choose>
1462
+ <xsl:when test="$curr_lang = 'fr'">
1463
+ <xsl:choose>
1464
+ <xsl:when test=". = '1'">re</xsl:when>
1465
+ <xsl:otherwise>e</xsl:otherwise>
1466
+ </xsl:choose>
1467
+ </xsl:when>
1468
+ <xsl:otherwise>
1469
+ <xsl:choose>
1470
+ <xsl:when test=". = '1'">st</xsl:when>
1471
+ <xsl:when test=". = '2'">nd</xsl:when>
1472
+ <xsl:when test=". = '3'">rd</xsl:when>
1473
+ <xsl:otherwise>th</xsl:otherwise>
1474
+ </xsl:choose>
1475
+ </xsl:otherwise>
1476
+ </xsl:choose>
1477
+
1478
+ </fo:inline>
1479
+ <xsl:text> </xsl:text>
1480
+ <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/>
1481
+ <xsl:text/>
1413
1482
  </fo:inline>
1414
- <xsl:text> </xsl:text>
1415
- <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/>
1416
- <xsl:text/>
1417
- </fo:inline>
1483
+ </xsl:if>
1418
1484
  </xsl:template>
1419
1485
 
1420
1486
 
@@ -1443,7 +1509,7 @@
1443
1509
 
1444
1510
  <fo:flow flow-name="xsl-region-body">
1445
1511
  <fo:block id="{@id}" span="all">
1446
- <xsl:apply-templates select="bipm:title"/>
1512
+ <xsl:apply-templates select="jcgm:title"/>
1447
1513
  </fo:block>
1448
1514
  <fo:block>
1449
1515
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
@@ -2145,6 +2211,9 @@
2145
2211
  <title-continued lang="en">(continued)</title-continued>
2146
2212
  <title-continued lang="fr">(continué)</title-continued>
2147
2213
 
2214
+ </xsl:variable><xsl:variable name="bibdata">
2215
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2216
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2148
2217
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2149
2218
  <xsl:param name="name"/>
2150
2219
  <xsl:param name="lang"/>
@@ -2173,13 +2242,16 @@
2173
2242
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
2174
2243
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
2175
2244
 
2245
+
2176
2246
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2177
2247
 
2248
+
2178
2249
  <xsl:attribute name="color">blue</xsl:attribute>
2179
2250
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2180
2251
 
2181
2252
 
2182
2253
 
2254
+
2183
2255
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2184
2256
  <xsl:attribute name="white-space">pre</xsl:attribute>
2185
2257
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2246,6 +2318,7 @@
2246
2318
 
2247
2319
 
2248
2320
 
2321
+
2249
2322
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2250
2323
 
2251
2324
 
@@ -2255,6 +2328,7 @@
2255
2328
 
2256
2329
 
2257
2330
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2331
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2258
2332
 
2259
2333
 
2260
2334
 
@@ -2264,9 +2338,7 @@
2264
2338
 
2265
2339
 
2266
2340
 
2267
-
2268
-
2269
-
2341
+
2270
2342
 
2271
2343
 
2272
2344
 
@@ -2299,6 +2371,7 @@
2299
2371
 
2300
2372
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2301
2373
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2374
+
2302
2375
 
2303
2376
 
2304
2377
 
@@ -2317,6 +2390,7 @@
2317
2390
 
2318
2391
 
2319
2392
 
2393
+
2320
2394
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2321
2395
 
2322
2396
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2337,19 +2411,23 @@
2337
2411
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2338
2412
 
2339
2413
 
2414
+
2340
2415
  <xsl:attribute name="color">blue</xsl:attribute>
2341
2416
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2342
2417
 
2343
2418
 
2419
+
2344
2420
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2345
2421
 
2346
2422
 
2347
2423
 
2348
2424
 
2425
+
2349
2426
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2350
2427
 
2351
2428
 
2352
2429
 
2430
+
2353
2431
 
2354
2432
 
2355
2433
 
@@ -2373,6 +2451,7 @@
2373
2451
 
2374
2452
 
2375
2453
 
2454
+
2376
2455
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2377
2456
 
2378
2457
 
@@ -2402,6 +2481,7 @@
2402
2481
 
2403
2482
 
2404
2483
 
2484
+
2405
2485
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2406
2486
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2407
2487
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2410,6 +2490,7 @@
2410
2490
 
2411
2491
 
2412
2492
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2493
+
2413
2494
 
2414
2495
 
2415
2496
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -2438,18 +2519,22 @@
2438
2519
 
2439
2520
 
2440
2521
 
2522
+
2441
2523
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2442
2524
 
2525
+
2443
2526
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2444
2527
 
2445
2528
 
2446
2529
 
2530
+
2447
2531
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2448
2532
 
2449
2533
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2450
2534
 
2451
2535
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2452
2536
 
2537
+
2453
2538
 
2454
2539
 
2455
2540
 
@@ -2482,10 +2567,12 @@
2482
2567
 
2483
2568
 
2484
2569
 
2570
+
2485
2571
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2486
2572
 
2487
2573
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2488
2574
 
2575
+
2489
2576
  <xsl:attribute name="width">100%</xsl:attribute>
2490
2577
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2491
2578
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -2511,15 +2598,38 @@
2511
2598
 
2512
2599
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2513
2600
 
2514
-
2601
+
2602
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2603
+
2604
+
2515
2605
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2516
2606
 
2607
+
2517
2608
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2518
2609
 
2519
2610
 
2520
2611
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2521
2612
 
2522
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2613
+
2614
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2615
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2616
+ </xsl:variable><xsl:attribute-set name="add-style">
2617
+ <xsl:attribute name="color">red</xsl:attribute>
2618
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2619
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2620
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2621
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2622
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2623
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2624
+ <xsl:text>red</xsl:text>
2625
+ </xsl:variable><xsl:attribute-set name="del-style">
2626
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2627
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2628
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2629
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2630
+
2631
+
2632
+ </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">
2523
2633
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2524
2634
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2525
2635
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2564,16 +2674,17 @@
2564
2674
  <xsl:call-template name="add-zero-spaces-java"/>
2565
2675
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2566
2676
 
2677
+ <xsl:variable name="table-preamble">
2678
+
2679
+
2680
+ </xsl:variable>
2681
+
2567
2682
  <xsl:variable name="table">
2568
2683
 
2569
2684
  <xsl:variable name="simple-table">
2570
2685
  <xsl:call-template name="getSimpleTable"/>
2571
2686
  </xsl:variable>
2572
2687
 
2573
-
2574
-
2575
-
2576
-
2577
2688
  <!-- <xsl:if test="$namespace = 'bipm'">
2578
2689
  <fo:block>&#xA0;</fo:block>
2579
2690
  </xsl:if> -->
@@ -2584,7 +2695,7 @@
2584
2695
 
2585
2696
 
2586
2697
 
2587
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2698
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2588
2699
 
2589
2700
  <!-- <xsl:variable name="cols-count">
2590
2701
  <xsl:choose>
@@ -2603,8 +2714,6 @@
2603
2714
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2604
2715
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2605
2716
 
2606
-
2607
-
2608
2717
  <xsl:variable name="colwidths">
2609
2718
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2610
2719
  <xsl:call-template name="calculate-column-widths">
@@ -2632,8 +2741,10 @@
2632
2741
  </xsl:choose>
2633
2742
  </xsl:variable>
2634
2743
 
2744
+
2635
2745
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2636
2746
 
2747
+
2637
2748
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2638
2749
 
2639
2750
 
@@ -2645,6 +2756,7 @@
2645
2756
 
2646
2757
 
2647
2758
 
2759
+
2648
2760
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2649
2761
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2650
2762
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2654,6 +2766,7 @@
2654
2766
 
2655
2767
 
2656
2768
 
2769
+
2657
2770
  <xsl:variable name="table_width">
2658
2771
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2659
2772
  100%
@@ -2667,6 +2780,7 @@
2667
2780
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2668
2781
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2669
2782
 
2783
+
2670
2784
  <attribute name="border">1.5pt solid black</attribute>
2671
2785
  <xsl:if test="*[local-name()='thead']">
2672
2786
  <attribute name="border-top">1pt solid black</attribute>
@@ -2675,6 +2789,7 @@
2675
2789
 
2676
2790
 
2677
2791
 
2792
+
2678
2793
  <attribute name="margin-left">0mm</attribute>
2679
2794
  <attribute name="margin-right">0mm</attribute>
2680
2795
 
@@ -2767,7 +2882,8 @@
2767
2882
  </fo:block-container>
2768
2883
  </xsl:variable>
2769
2884
 
2770
-
2885
+ <xsl:variable name="isAdded" select="@added"/>
2886
+ <xsl:variable name="isDeleted" select="@deleted"/>
2771
2887
 
2772
2888
  <xsl:choose>
2773
2889
  <xsl:when test="@width">
@@ -2781,7 +2897,14 @@
2781
2897
  <fo:table-body>
2782
2898
  <fo:table-row>
2783
2899
  <fo:table-cell column-number="2">
2784
- <fo:block><xsl:copy-of select="$table"/></fo:block>
2900
+ <xsl:copy-of select="$table-preamble"/>
2901
+ <fo:block>
2902
+ <xsl:call-template name="setTrackChangesStyles">
2903
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2904
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2905
+ </xsl:call-template>
2906
+ <xsl:copy-of select="$table"/>
2907
+ </fo:block>
2785
2908
  </fo:table-cell>
2786
2909
  </fo:table-row>
2787
2910
  </fo:table-body>
@@ -2792,18 +2915,46 @@
2792
2915
 
2793
2916
  </xsl:when>
2794
2917
  <xsl:otherwise>
2795
- <xsl:copy-of select="$table"/>
2918
+ <xsl:choose>
2919
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2920
+ <xsl:copy-of select="$table-preamble"/>
2921
+ <fo:block>
2922
+ <xsl:call-template name="setTrackChangesStyles">
2923
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2924
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2925
+ </xsl:call-template>
2926
+ <xsl:copy-of select="$table"/>
2927
+ </fo:block>
2928
+ </xsl:when>
2929
+ <xsl:otherwise>
2930
+ <xsl:copy-of select="$table-preamble"/>
2931
+ <xsl:copy-of select="$table"/>
2932
+ </xsl:otherwise>
2933
+ </xsl:choose>
2796
2934
  </xsl:otherwise>
2797
2935
  </xsl:choose>
2798
2936
 
2799
2937
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2938
+ <xsl:param name="continued"/>
2800
2939
  <xsl:if test="normalize-space() != ''">
2801
2940
  <fo:block xsl:use-attribute-sets="table-name-style">
2802
2941
 
2803
2942
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2804
2943
 
2805
2944
 
2806
- <xsl:apply-templates/>
2945
+ <xsl:choose>
2946
+ <xsl:when test="$continued = 'true'">
2947
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
2948
+
2949
+ <xsl:apply-templates/>
2950
+
2951
+ </xsl:when>
2952
+ <xsl:otherwise>
2953
+ <xsl:apply-templates/>
2954
+ </xsl:otherwise>
2955
+ </xsl:choose>
2956
+
2957
+
2807
2958
  </fo:block>
2808
2959
  </xsl:if>
2809
2960
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -2855,7 +3006,7 @@
2855
3006
  </xsl:for-each>
2856
3007
  </xsl:when>
2857
3008
  <xsl:otherwise>
2858
- <xsl:for-each select="xalan:nodeset($table)//tr">
3009
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2859
3010
  <xsl:variable name="td_text">
2860
3011
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2861
3012
 
@@ -2947,18 +3098,23 @@
2947
3098
  <xsl:apply-templates/>
2948
3099
  </fo:table-header>
2949
3100
  </xsl:template><xsl:template name="table-header-title">
2950
- <xsl:param name="cols-count"/>
3101
+ <xsl:param name="cols-count"/>
2951
3102
  <!-- row for title -->
2952
3103
  <fo:table-row>
2953
3104
  <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">
2954
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3105
+
3106
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3107
+ <xsl:with-param name="continued">true</xsl:with-param>
3108
+ </xsl:apply-templates>
2955
3109
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2956
3110
  <xsl:call-template name="fn_name_display"/>
2957
- </xsl:for-each>
2958
- <fo:block text-align="right" font-style="italic">
2959
- <xsl:text> </xsl:text>
2960
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
2961
- </fo:block>
3111
+ </xsl:for-each>
3112
+
3113
+ <fo:block text-align="right" font-style="italic">
3114
+ <xsl:text> </xsl:text>
3115
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3116
+ </fo:block>
3117
+
2962
3118
  </fo:table-cell>
2963
3119
  </fo:table-row>
2964
3120
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3179,19 +3335,25 @@
3179
3335
  <xsl:call-template name="getTitle">
3180
3336
  <xsl:with-param name="name" select="'title-continued'"/>
3181
3337
  </xsl:call-template>
3182
- </xsl:variable>
3338
+ </xsl:variable>
3339
+
3340
+ <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3341
+ <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3342
+
3183
3343
  <fo:table-row height="0" keep-with-next.within-page="always">
3184
3344
  <fo:table-cell>
3185
- <fo:marker marker-class-name="table_continued"/>
3345
+
3346
+
3347
+ <fo:marker marker-class-name="table_continued"/>
3348
+
3186
3349
  <fo:block/>
3187
3350
  </fo:table-cell>
3188
3351
  </fo:table-row>
3189
3352
  <fo:table-row height="0" keep-with-next.within-page="always">
3190
3353
  <fo:table-cell>
3191
- <fo:marker marker-class-name="table_continued">
3192
- <!-- <fo:inline font-style="italic" font-weight="normal"> -->
3193
- <xsl:value-of select="$title_continued"/>
3194
- <!-- </fo:inline> -->
3354
+
3355
+ <fo:marker marker-class-name="table_continued">
3356
+ <xsl:value-of select="$title_continued"/>
3195
3357
  </fo:marker>
3196
3358
  <fo:block/>
3197
3359
  </fo:table-cell>
@@ -3229,6 +3391,7 @@
3229
3391
 
3230
3392
 
3231
3393
 
3394
+
3232
3395
  </xsl:if>
3233
3396
  <xsl:if test="$parent-name = 'tfoot'">
3234
3397
 
@@ -3253,12 +3416,14 @@
3253
3416
  <xsl:attribute name="text-align">
3254
3417
  <xsl:choose>
3255
3418
  <xsl:when test="@align">
3256
- <xsl:value-of select="@align"/>
3419
+ <xsl:call-template name="setAlignment"/>
3420
+ <!-- <xsl:value-of select="@align"/> -->
3257
3421
  </xsl:when>
3258
3422
  <xsl:otherwise>center</xsl:otherwise>
3259
3423
  </xsl:choose>
3260
3424
  </xsl:attribute>
3261
3425
 
3426
+
3262
3427
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3263
3428
 
3264
3429
 
@@ -3271,6 +3436,10 @@
3271
3436
 
3272
3437
 
3273
3438
 
3439
+
3440
+ <xsl:if test="$lang = 'ar'">
3441
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3442
+ </xsl:if>
3274
3443
  <xsl:if test="@colspan">
3275
3444
  <xsl:attribute name="number-columns-spanned">
3276
3445
  <xsl:value-of select="@colspan"/>
@@ -3302,15 +3471,24 @@
3302
3471
  <xsl:attribute name="text-align">
3303
3472
  <xsl:choose>
3304
3473
  <xsl:when test="@align">
3305
- <xsl:value-of select="@align"/>
3474
+ <xsl:call-template name="setAlignment"/>
3475
+ <!-- <xsl:value-of select="@align"/> -->
3306
3476
  </xsl:when>
3307
3477
  <xsl:otherwise>left</xsl:otherwise>
3308
3478
  </xsl:choose>
3309
3479
  </xsl:attribute>
3480
+ <xsl:if test="$lang = 'ar'">
3481
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3482
+ </xsl:if>
3310
3483
  <!-- and ancestor::*[local-name() = 'thead'] -->
3311
3484
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3312
3485
 
3313
3486
 
3487
+ <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
3488
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
3489
+ </xsl:if>
3490
+
3491
+
3314
3492
 
3315
3493
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3316
3494
  <xsl:attribute name="border">solid black 0</xsl:attribute>
@@ -3324,6 +3502,9 @@
3324
3502
 
3325
3503
 
3326
3504
 
3505
+ <xsl:if test=".//*[local-name() = 'table']">
3506
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3507
+ </xsl:if>
3327
3508
  <xsl:if test="@colspan">
3328
3509
  <xsl:attribute name="number-columns-spanned">
3329
3510
  <xsl:value-of select="@colspan"/>
@@ -3457,13 +3638,13 @@
3457
3638
  </xsl:choose>
3458
3639
  </xsl:variable>
3459
3640
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3460
- <xsl:element name="{$ns}:table">
3641
+ <!-- <xsl:element name="{$ns}:table"> -->
3461
3642
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3462
3643
  <tbody>
3463
3644
  <xsl:apply-templates mode="dl"/>
3464
3645
  </tbody>
3465
3646
  </xsl:for-each>
3466
- </xsl:element>
3647
+ <!-- </xsl:element> -->
3467
3648
  </xsl:variable>
3468
3649
 
3469
3650
  <xsl:call-template name="calculate-column-widths">
@@ -3560,6 +3741,8 @@
3560
3741
  <xsl:apply-templates/>
3561
3742
  </fo:inline>
3562
3743
  </xsl:template><xsl:template match="*[local-name()='dl']">
3744
+ <xsl:variable name="isAdded" select="@added"/>
3745
+ <xsl:variable name="isDeleted" select="@deleted"/>
3563
3746
  <fo:block-container>
3564
3747
 
3565
3748
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3576,6 +3759,12 @@
3576
3759
  </xsl:attribute>
3577
3760
 
3578
3761
  </xsl:if>
3762
+
3763
+ <xsl:call-template name="setTrackChangesStyles">
3764
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3765
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3766
+ </xsl:call-template>
3767
+
3579
3768
  <fo:block-container>
3580
3769
 
3581
3770
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3640,6 +3829,7 @@
3640
3829
 
3641
3830
 
3642
3831
 
3832
+
3643
3833
  <xsl:variable name="title-key">
3644
3834
 
3645
3835
  <xsl:call-template name="getLocalizedString">
@@ -3697,11 +3887,11 @@
3697
3887
  </xsl:choose>
3698
3888
  </xsl:variable>
3699
3889
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3700
- <xsl:element name="{$ns}:table">
3890
+ <!-- <xsl:element name="{$ns}:table"> -->
3701
3891
  <tbody>
3702
3892
  <xsl:apply-templates mode="dl"/>
3703
3893
  </tbody>
3704
- </xsl:element>
3894
+ <!-- </xsl:element> -->
3705
3895
  </xsl:variable>
3706
3896
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3707
3897
  <xsl:variable name="colwidths">
@@ -3928,6 +4118,8 @@
3928
4118
 
3929
4119
  <xsl:apply-templates/>
3930
4120
  </fo:inline>
4121
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4122
+ <fo:inline padding-right="{@value}"> </fo:inline>
3931
4123
  </xsl:template><xsl:template match="*[local-name()='sup']">
3932
4124
  <fo:inline font-size="80%" vertical-align="super">
3933
4125
  <xsl:apply-templates/>
@@ -3945,6 +4137,7 @@
3945
4137
 
3946
4138
 
3947
4139
 
4140
+
3948
4141
  10
3949
4142
 
3950
4143
 
@@ -3970,8 +4163,74 @@
3970
4163
  <fo:inline text-decoration="underline">
3971
4164
  <xsl:apply-templates/>
3972
4165
  </fo:inline>
4166
+ </xsl:template><xsl:template match="*[local-name()='add']">
4167
+ <xsl:choose>
4168
+ <xsl:when test="@amendment">
4169
+ <fo:inline>
4170
+ <xsl:call-template name="insertTag">
4171
+ <xsl:with-param name="kind">A</xsl:with-param>
4172
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4173
+ </xsl:call-template>
4174
+ <xsl:apply-templates/>
4175
+ <xsl:call-template name="insertTag">
4176
+ <xsl:with-param name="type">closing</xsl:with-param>
4177
+ <xsl:with-param name="kind">A</xsl:with-param>
4178
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4179
+ </xsl:call-template>
4180
+ </fo:inline>
4181
+ </xsl:when>
4182
+ <xsl:when test="@corrigenda">
4183
+ <fo:inline>
4184
+ <xsl:call-template name="insertTag">
4185
+ <xsl:with-param name="kind">C</xsl:with-param>
4186
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4187
+ </xsl:call-template>
4188
+ <xsl:apply-templates/>
4189
+ <xsl:call-template name="insertTag">
4190
+ <xsl:with-param name="type">closing</xsl:with-param>
4191
+ <xsl:with-param name="kind">C</xsl:with-param>
4192
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4193
+ </xsl:call-template>
4194
+ </fo:inline>
4195
+ </xsl:when>
4196
+ <xsl:otherwise>
4197
+ <fo:inline xsl:use-attribute-sets="add-style">
4198
+ <xsl:apply-templates/>
4199
+ </fo:inline>
4200
+ </xsl:otherwise>
4201
+ </xsl:choose>
4202
+
4203
+ </xsl:template><xsl:template name="insertTag">
4204
+ <xsl:param name="type"/>
4205
+ <xsl:param name="kind"/>
4206
+ <xsl:param name="value"/>
4207
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4208
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4209
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4210
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4211
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4212
+ <xsl:attribute name="height">5mm</xsl:attribute>
4213
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4214
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4215
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4216
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4217
+ <g>
4218
+ <xsl:if test="$type = 'closing'">
4219
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4220
+ </xsl:if>
4221
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4222
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4223
+ </g>
4224
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4225
+ <xsl:if test="$type = 'closing'">
4226
+ <xsl:attribute name="x">25</xsl:attribute>
4227
+ </xsl:if>
4228
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4229
+ </text>
4230
+ </svg>
4231
+ </fo:instream-foreign-object>
3973
4232
  </xsl:template><xsl:template match="*[local-name()='del']">
3974
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4233
+ <fo:inline xsl:use-attribute-sets="del-style">
3975
4234
  <xsl:apply-templates/>
3976
4235
  </fo:inline>
3977
4236
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -4268,11 +4527,15 @@
4268
4527
  </xsl:apply-templates>
4269
4528
  </xsl:template><xsl:template name="getLang">
4270
4529
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4530
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4271
4531
  <xsl:variable name="language">
4272
4532
  <xsl:choose>
4273
4533
  <xsl:when test="$language_current != ''">
4274
4534
  <xsl:value-of select="$language_current"/>
4275
4535
  </xsl:when>
4536
+ <xsl:when test="$language_current_2 != ''">
4537
+ <xsl:value-of select="$language_current_2"/>
4538
+ </xsl:when>
4276
4539
  <xsl:otherwise>
4277
4540
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4278
4541
  </xsl:otherwise>
@@ -4312,13 +4575,23 @@
4312
4575
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4313
4576
  <xsl:value-of select="substring($str, 2)"/>
4314
4577
  </xsl:template><xsl:template match="mathml:math">
4315
- <fo:inline font-family="STIX Two Math"> <!-- -->
4578
+ <xsl:variable name="isAdded" select="@added"/>
4579
+ <xsl:variable name="isDeleted" select="@deleted"/>
4580
+
4581
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4582
+
4583
+
4584
+ <xsl:call-template name="setTrackChangesStyles">
4585
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4586
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4587
+ </xsl:call-template>
4316
4588
 
4317
4589
  <xsl:variable name="mathml">
4318
4590
  <xsl:apply-templates select="." mode="mathml"/>
4319
4591
  </xsl:variable>
4320
4592
  <fo:instream-foreign-object fox:alt-text="Math">
4321
4593
 
4594
+
4322
4595
  <!-- <xsl:copy-of select="."/> -->
4323
4596
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4324
4597
  </fo:instream-foreign-object>
@@ -4339,6 +4612,16 @@
4339
4612
  <mathml:mspace width="0.5ex"/>
4340
4613
  </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">
4341
4614
  <xsl:variable name="target">
4615
+ <xsl:choose>
4616
+ <xsl:when test="@updatetype = 'true'">
4617
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
4618
+ </xsl:when>
4619
+ <xsl:otherwise>
4620
+ <xsl:value-of select="normalize-space(@target)"/>
4621
+ </xsl:otherwise>
4622
+ </xsl:choose>
4623
+ </xsl:variable>
4624
+ <xsl:variable name="target_text">
4342
4625
  <xsl:choose>
4343
4626
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4344
4627
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4351,19 +4634,19 @@
4351
4634
  <fo:inline xsl:use-attribute-sets="link-style">
4352
4635
 
4353
4636
  <xsl:choose>
4354
- <xsl:when test="$target = ''">
4637
+ <xsl:when test="$target_text = ''">
4355
4638
  <xsl:apply-templates/>
4356
4639
  </xsl:when>
4357
4640
  <xsl:otherwise>
4358
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4641
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4359
4642
  <xsl:choose>
4360
4643
  <xsl:when test="normalize-space(.) = ''">
4361
- <!-- <xsl:value-of select="$target"/> -->
4362
4644
  <xsl:call-template name="add-zero-spaces-link-java">
4363
- <xsl:with-param name="text" select="$target"/>
4645
+ <xsl:with-param name="text" select="$target_text"/>
4364
4646
  </xsl:call-template>
4365
4647
  </xsl:when>
4366
4648
  <xsl:otherwise>
4649
+ <!-- output text from <link>text</link> -->
4367
4650
  <xsl:apply-templates/>
4368
4651
  </xsl:otherwise>
4369
4652
  </xsl:choose>
@@ -4475,6 +4758,7 @@
4475
4758
 
4476
4759
 
4477
4760
  <fo:inline xsl:use-attribute-sets="note-name-style">
4761
+
4478
4762
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4479
4763
  </fo:inline>
4480
4764
  <xsl:apply-templates/>
@@ -4501,6 +4785,7 @@
4501
4785
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4502
4786
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4503
4787
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4788
+
4504
4789
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4505
4790
  </fo:inline>
4506
4791
  <xsl:apply-templates/>
@@ -4564,8 +4849,15 @@
4564
4849
  </fo:inline>
4565
4850
  </xsl:if>
4566
4851
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4852
+ <xsl:variable name="isAdded" select="@added"/>
4853
+ <xsl:variable name="isDeleted" select="@deleted"/>
4567
4854
  <fo:block-container id="{@id}">
4568
4855
 
4856
+ <xsl:call-template name="setTrackChangesStyles">
4857
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4858
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4859
+ </xsl:call-template>
4860
+
4569
4861
  <fo:block>
4570
4862
  <xsl:apply-templates/>
4571
4863
  </fo:block>
@@ -4573,7 +4865,10 @@
4573
4865
  <xsl:for-each select="*[local-name() = 'note']">
4574
4866
  <xsl:call-template name="note"/>
4575
4867
  </xsl:for-each>
4576
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4868
+
4869
+
4870
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4871
+
4577
4872
  </fo:block-container>
4578
4873
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
4579
4874
  <fo:block id="{@id}">
@@ -4585,37 +4880,122 @@
4585
4880
  <xsl:apply-templates/>
4586
4881
  </fo:block>
4587
4882
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4588
- <fo:block xsl:use-attribute-sets="image-style">
4589
-
4590
-
4591
- <xsl:variable name="src">
4592
- <xsl:choose>
4593
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4594
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4595
- </xsl:when>
4596
- <xsl:otherwise>
4597
- <xsl:value-of select="@src"/>
4598
- </xsl:otherwise>
4599
- </xsl:choose>
4600
- </xsl:variable>
4601
-
4602
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4603
- </fo:block>
4883
+ <xsl:variable name="isAdded" select="../@added"/>
4884
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4885
+ <xsl:choose>
4886
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4887
+ <fo:inline padding-left="1mm" padding-right="1mm">
4888
+ <xsl:variable name="src">
4889
+ <xsl:call-template name="image_src"/>
4890
+ </xsl:variable>
4891
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4892
+ </fo:inline>
4893
+ </xsl:when>
4894
+ <xsl:otherwise>
4895
+ <fo:block xsl:use-attribute-sets="image-style">
4896
+
4897
+ <xsl:variable name="src">
4898
+ <xsl:call-template name="image_src"/>
4899
+ </xsl:variable>
4900
+
4901
+ <xsl:choose>
4902
+ <xsl:when test="$isDeleted = 'true'">
4903
+ <!-- enclose in svg -->
4904
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4905
+ <xsl:attribute name="width">100%</xsl:attribute>
4906
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4907
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4908
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4909
+
4910
+
4911
+ <xsl:apply-templates select="." mode="cross_image"/>
4912
+
4913
+ </fo:instream-foreign-object>
4914
+ </xsl:when>
4915
+ <xsl:otherwise>
4916
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4917
+ </xsl:otherwise>
4918
+ </xsl:choose>
4919
+
4920
+ </fo:block>
4921
+ </xsl:otherwise>
4922
+ </xsl:choose>
4923
+ </xsl:template><xsl:template name="image_src">
4924
+ <xsl:choose>
4925
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4926
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4927
+ </xsl:when>
4928
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4929
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4930
+ </xsl:when>
4931
+ <xsl:otherwise>
4932
+ <xsl:value-of select="@src"/>
4933
+ </xsl:otherwise>
4934
+ </xsl:choose>
4935
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4936
+ <xsl:choose>
4937
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4938
+ <xsl:variable name="src">
4939
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4940
+ </xsl:variable>
4941
+ <xsl:variable name="width" select="document($src)/@width"/>
4942
+ <xsl:variable name="height" select="document($src)/@height"/>
4943
+ <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">
4944
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4945
+ </svg>
4946
+ </xsl:when>
4947
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4948
+ <xsl:variable name="src">
4949
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4950
+ </xsl:variable>
4951
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4952
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4953
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4954
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4955
+ <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">
4956
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4957
+ </svg>
4958
+ </xsl:when>
4959
+ <xsl:otherwise>
4960
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4961
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4962
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4963
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4964
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4965
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4966
+ <!-- width=<xsl:value-of select="$width"/> -->
4967
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4968
+ <!-- height=<xsl:value-of select="$height"/> -->
4969
+ <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">
4970
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4971
+ <xsl:call-template name="svg_cross">
4972
+ <xsl:with-param name="width" select="$width"/>
4973
+ <xsl:with-param name="height" select="$height"/>
4974
+ </xsl:call-template>
4975
+ </svg>
4976
+ </xsl:otherwise>
4977
+ </xsl:choose>
4978
+
4979
+ </xsl:template><xsl:template name="svg_cross">
4980
+ <xsl:param name="width"/>
4981
+ <xsl:param name="height"/>
4982
+ <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; "/>
4983
+ <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; "/>
4604
4984
  </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">
4605
4985
  <xsl:apply-templates mode="contents"/>
4606
4986
  <xsl:text> </xsl:text>
4607
4987
  </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">
4608
4988
  <xsl:apply-templates mode="bookmarks"/>
4609
4989
  <xsl:text> </xsl:text>
4610
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
4990
+ </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">
4611
4991
  <xsl:value-of select="."/>
4612
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4992
+ </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">
4613
4993
  <xsl:value-of select="."/>
4614
4994
  </xsl:template><xsl:template match="node()" mode="contents">
4615
4995
  <xsl:apply-templates mode="contents"/>
4616
4996
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4617
4997
  <xsl:apply-templates mode="bookmarks"/>
4618
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
4998
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4619
4999
  <xsl:apply-templates select="."/>
4620
5000
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4621
5001
  <xsl:apply-templates mode="bookmarks"/>
@@ -4814,6 +5194,8 @@
4814
5194
  </fo:list-item-body>
4815
5195
  </fo:list-item>
4816
5196
  </fo:list-block>
5197
+ </xsl:template><xsl:template name="extractSection">
5198
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4817
5199
  </xsl:template><xsl:template name="extractTitle">
4818
5200
  <xsl:choose>
4819
5201
  <xsl:when test="*[local-name() = 'tab']">
@@ -4840,6 +5222,7 @@
4840
5222
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4841
5223
 
4842
5224
  <fo:block-container margin-left="0mm">
5225
+ <xsl:copy-of select="@id"/>
4843
5226
  <xsl:if test="parent::*[local-name() = 'note']">
4844
5227
  <xsl:attribute name="margin-left">
4845
5228
  <xsl:choose>
@@ -4859,6 +5242,7 @@
4859
5242
 
4860
5243
 
4861
5244
 
5245
+
4862
5246
  9
4863
5247
 
4864
5248
 
@@ -5116,11 +5500,12 @@
5116
5500
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5117
5501
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5118
5502
 
5503
+
5119
5504
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5120
5505
 
5121
5506
  <xsl:variable name="element">
5122
- block
5123
-
5507
+
5508
+ inline
5124
5509
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5125
5510
  </xsl:variable>
5126
5511
 
@@ -5143,6 +5528,7 @@
5143
5528
  <xsl:variable name="element">
5144
5529
 
5145
5530
  inline
5531
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5146
5532
  </xsl:variable>
5147
5533
  <xsl:choose>
5148
5534
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5150,7 +5536,7 @@
5150
5536
  <xsl:apply-templates/>
5151
5537
  </fo:inline>
5152
5538
  </xsl:when>
5153
- <xsl:when test="normalize-space($element) = 'block'">
5539
+ <xsl:when test="contains(normalize-space($element), 'block')">
5154
5540
  <fo:block xsl:use-attribute-sets="example-name-style">
5155
5541
  <xsl:apply-templates/>
5156
5542
  </fo:block>
@@ -5165,7 +5551,12 @@
5165
5551
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5166
5552
  <xsl:variable name="num"><xsl:number/></xsl:variable>
5167
5553
  <xsl:variable name="element">
5168
- block
5554
+
5555
+
5556
+ <xsl:choose>
5557
+ <xsl:when test="$num = 1">inline</xsl:when>
5558
+ <xsl:otherwise>block</xsl:otherwise>
5559
+ </xsl:choose>
5169
5560
 
5170
5561
 
5171
5562
  </xsl:variable>
@@ -5182,7 +5573,7 @@
5182
5573
  </fo:inline>
5183
5574
  </xsl:otherwise>
5184
5575
  </xsl:choose>
5185
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
5576
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5186
5577
  <fo:block xsl:use-attribute-sets="termsource-style">
5187
5578
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5188
5579
  <xsl:variable name="termsource_text">
@@ -5191,13 +5582,15 @@
5191
5582
 
5192
5583
  <xsl:choose>
5193
5584
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5194
- <xsl:apply-templates/>
5585
+ <!-- <xsl:apply-templates /> -->
5586
+ <xsl:copy-of select="$termsource_text"/>
5195
5587
  </xsl:when>
5196
5588
  <xsl:otherwise>
5197
5589
 
5198
5590
  <xsl:text>[</xsl:text>
5199
5591
 
5200
- <xsl:apply-templates/>
5592
+ <!-- <xsl:apply-templates /> -->
5593
+ <xsl:copy-of select="$termsource_text"/>
5201
5594
 
5202
5595
  <xsl:text>]</xsl:text>
5203
5596
 
@@ -5208,20 +5601,25 @@
5208
5601
  <xsl:if test="normalize-space() != ''">
5209
5602
  <xsl:value-of select="."/>
5210
5603
  </xsl:if>
5211
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
5604
+ </xsl:template><xsl:variable name="localized.source">
5605
+ <xsl:call-template name="getLocalizedString">
5606
+ <xsl:with-param name="key">source</xsl:with-param>
5607
+ </xsl:call-template>
5608
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5212
5609
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5610
+ <xsl:if test="normalize-space(@citeas) = ''">
5611
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5612
+ </xsl:if>
5213
5613
 
5214
5614
  <fo:inline>
5215
5615
 
5216
5616
 
5217
5617
 
5218
- <xsl:call-template name="getLocalizedString">
5219
- <xsl:with-param name="key">source</xsl:with-param>
5220
- </xsl:call-template>
5618
+ <xsl:value-of select="$localized.source"/>
5619
+ <xsl:text> </xsl:text>
5221
5620
 
5222
5621
 
5223
5622
 
5224
- <xsl:text>: </xsl:text>
5225
5623
  </fo:inline>
5226
5624
 
5227
5625
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5337,6 +5735,7 @@
5337
5735
 
5338
5736
 
5339
5737
 
5738
+
5340
5739
  <xsl:choose>
5341
5740
  <xsl:when test="$depth = 2">3</xsl:when>
5342
5741
  <xsl:otherwise>4</xsl:otherwise>
@@ -5379,7 +5778,8 @@
5379
5778
  </fo:inline>
5380
5779
  </xsl:when>
5381
5780
  <xsl:otherwise>
5382
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5781
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5782
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5383
5783
  </xsl:otherwise>
5384
5784
  </xsl:choose>
5385
5785
 
@@ -5438,7 +5838,6 @@
5438
5838
 
5439
5839
 
5440
5840
 
5441
-
5442
5841
  <xsl:apply-templates/>
5443
5842
  </fo:block>
5444
5843
 
@@ -5455,6 +5854,10 @@
5455
5854
  <xsl:call-template name="setId"/>
5456
5855
 
5457
5856
 
5857
+ <xsl:if test="@inline-header='true'">
5858
+ <xsl:attribute name="text-align">justify</xsl:attribute>
5859
+ </xsl:if>
5860
+
5458
5861
  <xsl:apply-templates/>
5459
5862
  </fo:block>
5460
5863
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5481,7 +5884,7 @@
5481
5884
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5482
5885
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5483
5886
  <xsl:choose>
5484
- <xsl:when test="parent::*[local-name() = 'note']">
5887
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
5485
5888
  <fo:block-container>
5486
5889
  <xsl:attribute name="margin-left">
5487
5890
  <xsl:choose>
@@ -5491,6 +5894,7 @@
5491
5894
  </xsl:attribute>
5492
5895
 
5493
5896
 
5897
+
5494
5898
  <fo:block-container margin-left="0mm">
5495
5899
  <fo:block>
5496
5900
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -5649,8 +6053,8 @@
5649
6053
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5650
6054
  <xsl:apply-templates/>
5651
6055
  </fo:block>
5652
- </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
5653
- <fo:inline id="{@id}"/>
6056
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6057
+ <fo:inline id="{@id}" font-size="1pt"/>
5654
6058
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5655
6059
  <!-- <row>
5656
6060
  <date>05-07-2013</date>
@@ -5692,6 +6096,10 @@
5692
6096
 
5693
6097
 
5694
6098
 
6099
+
6100
+
6101
+
6102
+
5695
6103
  </xsl:template><xsl:template name="processBibitemDocId">
5696
6104
  <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')]"/>
5697
6105
  <xsl:choose>
@@ -5748,6 +6156,70 @@
5748
6156
  <xsl:value-of select="substring(.,1,1)"/>
5749
6157
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5750
6158
  <fo:inline><xsl:apply-templates/></fo:inline>
6159
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6160
+ <fo:block>
6161
+ <xsl:apply-templates/>
6162
+ </fo:block>
6163
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6164
+ <fo:inline><xsl:apply-templates/></fo:inline>
6165
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6166
+ <fo:inline>
6167
+ <xsl:call-template name="text_input"/>
6168
+ </fo:inline>
6169
+ </xsl:template><xsl:template name="text_input">
6170
+ <xsl:variable name="count">
6171
+ <xsl:choose>
6172
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6173
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6174
+ <xsl:otherwise>10</xsl:otherwise>
6175
+ </xsl:choose>
6176
+ </xsl:variable>
6177
+ <xsl:call-template name="repeat">
6178
+ <xsl:with-param name="char" select="'_'"/>
6179
+ <xsl:with-param name="count" select="$count"/>
6180
+ </xsl:call-template>
6181
+ <xsl:text> </xsl:text>
6182
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6183
+ <xsl:variable name="caption">
6184
+ <xsl:choose>
6185
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6186
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6187
+ </xsl:choose>
6188
+ </xsl:variable>
6189
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6190
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6191
+ <fo:inline padding-right="1mm">
6192
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6193
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6194
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6195
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6196
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6197
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6198
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6199
+ </svg>
6200
+ </fo:instream-foreign-object>
6201
+ </fo:inline>
6202
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6203
+ <fo:inline padding-right="1mm">
6204
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6205
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6206
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6207
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6208
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6209
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6210
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6211
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6212
+ </svg>
6213
+ </fo:instream-foreign-object>
6214
+ </fo:inline>
6215
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6216
+ <fo:inline>
6217
+ <xsl:call-template name="text_input"/>
6218
+ </fo:inline>
6219
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6220
+ <fo:block-container border="1pt solid black" width="50%">
6221
+ <fo:block> </fo:block>
6222
+ </fo:block-container>
5751
6223
  </xsl:template><xsl:template name="convertDate">
5752
6224
  <xsl:param name="date"/>
5753
6225
  <xsl:param name="format" select="'short'"/>
@@ -5952,6 +6424,9 @@
5952
6424
  <xsl:when test="parent::*[local-name() = 'preface']">
5953
6425
  <xsl:value-of select="$level_total - 1"/>
5954
6426
  </xsl:when>
6427
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6428
+ <xsl:value-of select="$level_total - 1"/>
6429
+ </xsl:when>
5955
6430
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5956
6431
  <xsl:value-of select="$level_total - 2"/>
5957
6432
  </xsl:when>
@@ -6016,6 +6491,7 @@
6016
6491
 
6017
6492
 
6018
6493
 
6494
+
6019
6495
 
6020
6496
 
6021
6497
 
@@ -6076,17 +6552,69 @@
6076
6552
  </xsl:call-template>
6077
6553
  </xsl:if>
6078
6554
  </xsl:template><xsl:template name="getLocalizedString">
6079
- <xsl:param name="key"/>
6555
+ <xsl:param name="key"/>
6080
6556
 
6081
6557
  <xsl:variable name="curr_lang">
6082
6558
  <xsl:call-template name="getLang"/>
6083
6559
  </xsl:variable>
6084
6560
 
6561
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6562
+
6085
6563
  <xsl:choose>
6564
+ <xsl:when test="$data_value != ''">
6565
+ <xsl:value-of select="$data_value"/>
6566
+ </xsl:when>
6086
6567
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6087
6568
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6088
6569
  </xsl:when>
6089
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6570
+ <xsl:otherwise>
6571
+ <xsl:variable name="key_">
6572
+ <xsl:call-template name="capitalize">
6573
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
6574
+ </xsl:call-template>
6575
+ </xsl:variable>
6576
+ <xsl:value-of select="$key_"/>
6577
+ </xsl:otherwise>
6090
6578
  </xsl:choose>
6091
6579
 
6580
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6581
+ <xsl:param name="isAdded"/>
6582
+ <xsl:param name="isDeleted"/>
6583
+ <xsl:choose>
6584
+ <xsl:when test="local-name() = 'math'">
6585
+ <xsl:if test="$isAdded = 'true'">
6586
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6587
+ </xsl:if>
6588
+ <xsl:if test="$isDeleted = 'true'">
6589
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6590
+ </xsl:if>
6591
+ </xsl:when>
6592
+ <xsl:otherwise>
6593
+ <xsl:if test="$isAdded = 'true'">
6594
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6595
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6596
+ </xsl:if>
6597
+ <xsl:if test="$isDeleted = 'true'">
6598
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6599
+ <xsl:if test="local-name() = 'table'">
6600
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6601
+ </xsl:if>
6602
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6603
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6604
+ </xsl:if>
6605
+ </xsl:otherwise>
6606
+ </xsl:choose>
6607
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6608
+ <xsl:if test="$lang = 'ar'">
6609
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6610
+ </xsl:if>
6611
+ </xsl:template><xsl:template name="setAlignment">
6612
+ <xsl:param name="align" select="normalize-space(@align)"/>
6613
+ <xsl:choose>
6614
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6615
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6616
+ <xsl:when test="$align != ''">
6617
+ <xsl:value-of select="$align"/>
6618
+ </xsl:when>
6619
+ </xsl:choose>
6092
6620
  </xsl:template></xsl:stylesheet>