metanorma-iso 1.7.3 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +7 -1
  4. data/lib/asciidoctor/iso/base.rb +14 -11
  5. data/lib/asciidoctor/iso/biblio.rng +5 -6
  6. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  7. data/lib/asciidoctor/iso/front.rb +29 -17
  8. data/lib/asciidoctor/iso/front_id.rb +81 -60
  9. data/lib/asciidoctor/iso/isodoc.rng +305 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +1 -0
  11. data/lib/asciidoctor/iso/section.rb +2 -1
  12. data/lib/asciidoctor/iso/validate.rb +22 -110
  13. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  14. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  15. data/lib/asciidoctor/iso/validate_section.rb +55 -29
  16. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  17. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  18. data/lib/isodoc/iso/base_convert.rb +8 -2
  19. data/lib/isodoc/iso/html/style-human.css +7 -0
  20. data/lib/isodoc/iso/html/style-iso.css +7 -0
  21. data/lib/isodoc/iso/html_convert.rb +0 -1
  22. data/lib/isodoc/iso/index.rb +2 -1
  23. data/lib/isodoc/iso/iso.amendment.xsl +659 -194
  24. data/lib/isodoc/iso/iso.international-standard.xsl +659 -194
  25. data/lib/isodoc/iso/metadata.rb +1 -0
  26. data/lib/isodoc/iso/presentation_xml_convert.rb +44 -33
  27. data/lib/isodoc/iso/sts_convert.rb +10 -13
  28. data/lib/isodoc/iso/word_convert.rb +0 -1
  29. data/lib/isodoc/iso/xref.rb +43 -26
  30. data/lib/metanorma/iso/processor.rb +1 -0
  31. data/lib/metanorma/iso/version.rb +1 -1
  32. data/metanorma-iso.gemspec +8 -8
  33. data/spec/asciidoctor/amd_spec.rb +5 -5
  34. data/spec/asciidoctor/base_spec.rb +428 -307
  35. data/spec/asciidoctor/blocks_spec.rb +96 -34
  36. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  37. data/spec/asciidoctor/section_spec.rb +0 -14
  38. data/spec/asciidoctor/validate_spec.rb +235 -83
  39. data/spec/isodoc/postproc_spec.rb +481 -438
  40. data/spec/spec_helper.rb +16 -13
  41. metadata +50 -50
  42. data/lib/isodoc/iso/html/scripts.html +0 -178
@@ -3,9 +3,13 @@ require "metanorma-standoc"
3
3
  module Asciidoctor
4
4
  module ISO
5
5
  class Converter < Standoc::Converter
6
+ def title_lang_part(doc, part, lang)
7
+ doc.at("//bibdata/title[@type='title-#{part}' and @language='#{lang}']")
8
+ end
9
+
6
10
  def title_intro_validate(root)
7
- title_intro_en = root.at("//title[@type='title-intro' and @language='en']")
8
- title_intro_fr = root.at("//title[@type='title-intro' and @language='fr']")
11
+ title_intro_en = title_lang_part(root, "intro", "en")
12
+ title_intro_fr = title_lang_part(root, "intro", "fr")
9
13
  if title_intro_en.nil? && !title_intro_fr.nil?
10
14
  @log.add("Style", title_intro_fr, "No English Title Intro!")
11
15
  end
@@ -15,8 +19,8 @@ module Asciidoctor
15
19
  end
16
20
 
17
21
  def title_main_validate(root)
18
- title_main_en = root.at("//title[@type='title-main' and @language='en']")
19
- title_main_fr = root.at("//title[@type='title-main' and @language='fr']")
22
+ title_main_en = title_lang_part(root, "main", "en")
23
+ title_main_fr = title_lang_part(root, "main", "fr")
20
24
  if title_main_en.nil? && !title_main_fr.nil?
21
25
  @log.add("Style", title_main_fr, "No English Title!")
22
26
  end
@@ -26,8 +30,8 @@ module Asciidoctor
26
30
  end
27
31
 
28
32
  def title_part_validate(root)
29
- title_part_en = root.at("//title[@type='title-part' and @language='en']")
30
- title_part_fr = root.at("//title[@type='title-part' and @language='fr']")
33
+ title_part_en = title_lang_part(root, "part", "en")
34
+ title_part_fr = title_lang_part(root, "part", "fr")
31
35
  (title_part_en.nil? && !title_part_fr.nil?) &&
32
36
  @log.add("Style", title_part_fr, "No English Title Part!")
33
37
  (!title_part_en.nil? && title_part_fr.nil?) &&
@@ -41,21 +45,21 @@ module Asciidoctor
41
45
  iec = root.at("//bibdata/contributor[role/@type = 'publisher']/"\
42
46
  "organization[abbreviation = 'IEC' or "\
43
47
  "name = 'International Electrotechnical Commission']")
44
- @log.add("Style", docid, "Subpart defined on non-IEC document!") if subpart && !iec
48
+ subpart && !iec and
49
+ @log.add("Style", docid, "Subpart defined on non-IEC document!")
45
50
  end
46
51
 
47
52
  # ISO/IEC DIR 2, 11.5.2
48
53
  def title_names_type_validate(root)
49
54
  doctypes = /International\sStandard | Technical\sSpecification |
50
55
  Publicly\sAvailable\sSpecification | Technical\sReport | Guide /xi
51
- title_main_en = root.at("//title[@type='title-main' and @language='en']")
52
- if !title_main_en.nil? && doctypes.match(title_main_en.text)
56
+ title_main_en = title_lang_part(root, "main", "en")
57
+ !title_main_en.nil? && doctypes.match(title_main_en.text) and
53
58
  @log.add("Style", title_main_en, "Main Title may name document type")
54
- end
55
- title_intro_en = root.at("//title[@type='title-intro' and @language='en']")
56
- if !title_intro_en.nil? && doctypes.match(title_intro_en.text)
57
- @log.add("Style", title_intro_en, "Title Intro may name document type")
58
- end
59
+ title_intro_en = title_lang_part(root, "intro", "en")
60
+ !title_intro_en.nil? && doctypes.match(title_intro_en.text) and
61
+ @log.add("Style", title_intro_en,
62
+ "Title Intro may name document type")
59
63
  end
60
64
 
61
65
  # ISO/IEC DIR 2, 22.2
@@ -64,8 +68,9 @@ module Asciidoctor
64
68
  title = s&.at("./title")&.text || s.name
65
69
  s.xpath("./clause | ./terms | ./references").each do |ss|
66
70
  subtitle = ss.at("./title")
67
- !subtitle.nil? && !subtitle&.text&.empty? ||
68
- @log.add("Style", ss, "#{title}: each first-level subclause must have a title")
71
+ !subtitle.nil? && !subtitle&.text&.empty? or
72
+ @log.add("Style", ss,
73
+ "#{title}: each first-level subclause must have a title")
69
74
  end
70
75
  end
71
76
  end
@@ -82,7 +87,8 @@ module Asciidoctor
82
87
  withtitle = withtitle || (subtitle && !subtitle.text.empty?)
83
88
  end
84
89
  notitle && withtitle &&
85
- @log.add("Style", nil, "#{label}: all subclauses must have a title, or none")
90
+ @log.add("Style", nil,
91
+ "#{label}: all subclauses must have a title, or none")
86
92
  end
87
93
 
88
94
  def title_validate(root)
@@ -15,6 +15,7 @@ module IsoDoc
15
15
 
16
16
  def implicit_reference(b)
17
17
  return true if b&.at(ns("./docidentifier"))&.text == "IEV"
18
+
18
19
  super
19
20
  end
20
21
 
@@ -27,8 +28,9 @@ module IsoDoc
27
28
  end
28
29
  end
29
30
 
30
- def example_span_label(node, div, name)
31
+ def example_span_label(_node, div, name)
31
32
  return if name.nil?
33
+
32
34
  div.span **{ class: "example_label" } do |p|
33
35
  name.children.each { |n| parse(n, div) }
34
36
  end
@@ -56,6 +58,7 @@ module IsoDoc
56
58
  node.elements.each do |e|
57
59
  next if e.name == "name"
58
60
  return true if e.name == "p"
61
+
59
62
  return false
60
63
  end
61
64
  false
@@ -74,6 +77,7 @@ module IsoDoc
74
77
  def insertall_after_here(node, insert, name)
75
78
  node.children.each do |n|
76
79
  next unless n.name == name
80
+
77
81
  insert.next = n.remove
78
82
  insert = n
79
83
  end
@@ -83,6 +87,7 @@ module IsoDoc
83
87
  def termexamples_before_termnotes(node)
84
88
  return unless node.at(ns("./termnote")) && node.at(ns("./termexample"))
85
89
  return unless insert = node.at(ns("./definition"))
90
+
86
91
  insert = insertall_after_here(node, insert, "termexample")
87
92
  insert = insertall_after_here(node, insert, "termnote")
88
93
  end
@@ -110,6 +115,7 @@ module IsoDoc
110
115
  return super unless (dl&.xpath(ns("./dt"))&.size == 1 &&
111
116
  dl&.at(ns("./dd"))&.elements&.size == 1 &&
112
117
  dl&.at(ns("./dd/p")))
118
+
113
119
  out.span **{ class: "zzMoveToFollowing" } do |s|
114
120
  s << "#{@i18n.where} "
115
121
  dl.at(ns("./dt")).children.each { |n| parse(n, s) }
@@ -149,7 +155,7 @@ module IsoDoc
149
155
 
150
156
  def figure_name_parse(node, div, name)
151
157
  div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
152
- name and name.children.each { |n| parse(n, div) }
158
+ name&.children&.each { |n| parse(n, div) }
153
159
  end
154
160
  end
155
161
 
@@ -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
 
@@ -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
 
@@ -38,7 +38,6 @@ module IsoDoc
38
38
  html_doc_path("style-iso.scss")),
39
39
  htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
40
40
  htmlintropage: html_doc_path("html_iso_intro.html"),
41
- scripts: html_doc_path("scripts.html"),
42
41
  }
43
42
  end
44
43
 
@@ -27,7 +27,8 @@ module IsoDoc
27
27
  c.add_child index_entries(words, index[k], w)
28
28
  end
29
29
  end
30
- @xrefs.bookmark_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
30
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
31
+ @xrefs.bookmark_anchor_names(docxml)
31
32
  end
32
33
 
33
34
  def sortable(s)
@@ -1,10 +1,11 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
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
 
@@ -343,8 +344,8 @@
343
344
  <fo:declarations>
344
345
  <xsl:call-template name="addPDFUAmeta"/>
345
346
  <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments',@bibitemid)[1])]">
346
- <xsl:variable name="url" select="concat('url(', ., ')')"/>
347
- <pdf:embedded-file src="{$url}"/>
347
+ <xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
348
+ <pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
348
349
  </xsl:for-each>
349
350
  </fo:declarations>
350
351
 
@@ -947,22 +948,24 @@
947
948
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@type, ' ',
948
949
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@number)"/>
949
950
  -->
950
- <!-- ISO/TC 34/SC 4/WG 3 -->
951
- <fo:block margin-bottom="12pt">
952
- <xsl:text>ISO</xsl:text>
953
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[@number]">
954
- <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
955
- </xsl:for-each>
956
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[@number]">
957
- <xsl:text>/SC </xsl:text>
958
- <xsl:value-of select="@number"/>
959
- </xsl:for-each>
960
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[@number]">
961
- <xsl:text>/WG </xsl:text>
962
- <xsl:value-of select="@number"/>
963
- </xsl:for-each>
964
- </fo:block>
965
-
951
+
952
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
953
+ <!-- ISO/TC 34/SC 4/WG 3 -->
954
+ <fo:block margin-bottom="12pt">
955
+ <xsl:text>ISO</xsl:text>
956
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != '']">
957
+ <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
958
+ </xsl:for-each>
959
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != '']">
960
+ <xsl:text>/SC </xsl:text>
961
+ <xsl:value-of select="@number"/>
962
+ </xsl:for-each>
963
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
964
+ <xsl:text>/WG </xsl:text>
965
+ <xsl:value-of select="@number"/>
966
+ </xsl:for-each>
967
+ </fo:block>
968
+ </xsl:if>
966
969
  <!-- Secretariat: AFNOR -->
967
970
 
968
971
  <fo:block margin-bottom="100pt">
@@ -1024,7 +1027,15 @@
1024
1027
  <fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
1025
1028
  <fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
1026
1029
  <xsl:variable name="stage-title" select="substring-after(substring-before($docidentifierISO, ' '), '/')"/>
1027
- <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1030
+ <xsl:choose>
1031
+ <xsl:when test="normalize-space($stage-title) != ''">
1032
+ <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1033
+ </xsl:when>
1034
+ <xsl:otherwise>
1035
+ <xsl:attribute name="border">0pt solid white</xsl:attribute>
1036
+ <fo:block> </fo:block>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
1028
1039
  </fo:block-container>
1029
1040
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
1030
1041
 
@@ -1414,7 +1425,7 @@
1414
1425
  </xsl:if>
1415
1426
  </xsl:template>
1416
1427
 
1417
-
1428
+ <xsl:template match="iso:p | iso:termsource | iso:termnote" mode="contents"/>
1418
1429
 
1419
1430
  <xsl:template name="getListItemFormat">
1420
1431
  <xsl:choose>
@@ -1650,6 +1661,12 @@
1650
1661
  <xsl:if test="@id">
1651
1662
  <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1652
1663
  </xsl:if>
1664
+ <!-- bookmarks only in paragraph -->
1665
+ <xsl:if test="count(iso:bookmark) != 0 and count(*) = count(iso:bookmark) and normalize-space() = ''">
1666
+ <xsl:attribute name="font-size">0</xsl:attribute>
1667
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1668
+ <xsl:attribute name="line-height">0</xsl:attribute>
1669
+ </xsl:if>
1653
1670
  <xsl:apply-templates/>
1654
1671
  </xsl:element>
1655
1672
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1735,61 +1752,7 @@
1735
1752
  <xsl:apply-templates/>
1736
1753
  </xsl:template>
1737
1754
 
1738
-
1739
-
1740
- <xsl:template match="iso:bibitem">
1741
- <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
1742
- <xsl:variable name="docidentifier">
1743
- <xsl:if test="iso:docidentifier">
1744
- <xsl:choose>
1745
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1746
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1747
- </xsl:choose>
1748
- </xsl:if>
1749
- </xsl:variable>
1750
- <xsl:value-of select="$docidentifier"/>
1751
- <xsl:apply-templates select="iso:note"/>
1752
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1753
- <fo:inline font-style="italic">
1754
- <xsl:choose>
1755
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1756
- <xsl:value-of select="iso:title[@type = 'main' and @language = $lang]"/>
1757
- </xsl:when>
1758
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1759
- <xsl:value-of select="iso:title[@type = 'main' and @language = 'en']"/>
1760
- </xsl:when>
1761
- <xsl:otherwise>
1762
- <xsl:value-of select="iso:title"/>
1763
- </xsl:otherwise>
1764
- </xsl:choose>
1765
- </fo:inline>
1766
- </fo:block>
1767
- </xsl:template>
1768
-
1769
-
1770
- <xsl:template match="iso:bibitem/iso:note" priority="2">
1771
- <fo:footnote>
1772
- <xsl:variable name="number">
1773
- <xsl:number level="any" count="iso:bibitem/iso:note"/>
1774
- </xsl:variable>
1775
- <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1776
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1777
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1778
- </fo:basic-link>
1779
- </fo:inline>
1780
- <fo:footnote-body>
1781
- <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1782
- <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1783
- <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1784
- </fo:inline>
1785
- <xsl:apply-templates/>
1786
- </fo:block>
1787
- </fo:footnote-body>
1788
- </fo:footnote>
1789
- </xsl:template>
1790
-
1791
-
1792
-
1755
+
1793
1756
  <xsl:template match="iso:ul | iso:ol" mode="ul_ol">
1794
1757
  <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
1795
1758
  <xsl:apply-templates/>
@@ -1799,7 +1762,7 @@
1799
1762
  </xsl:for-each>
1800
1763
  </xsl:template>
1801
1764
 
1802
- <xsl:template match="iso:ul//iso:note | iso:ol//iso:note" priority="2"/>
1765
+ <xsl:template match="iso:ul/iso:note | iso:ol/iso:note | iso:ul/iso:li/iso:note | iso:ol/iso:li/iso:note" priority="2"/>
1803
1766
 
1804
1767
  <xsl:template match="iso:li">
1805
1768
  <fo:list-item id="{@id}">
@@ -1811,7 +1774,10 @@
1811
1774
  <fo:list-item-body start-indent="body-start()">
1812
1775
  <fo:block>
1813
1776
  <xsl:apply-templates/>
1814
- <xsl:apply-templates select=".//iso:note" mode="process"/>
1777
+ <!-- <xsl:apply-templates select=".//iso:note" mode="process"/> -->
1778
+ <xsl:for-each select="./iso:note">
1779
+ <xsl:call-template name="note"/>
1780
+ </xsl:for-each>
1815
1781
  </fo:block>
1816
1782
  </fo:list-item-body>
1817
1783
  </fo:list-item>
@@ -1821,6 +1787,10 @@
1821
1787
  <xsl:call-template name="note"/>
1822
1788
  </xsl:template>
1823
1789
 
1790
+ <xsl:template match="*" mode="process">
1791
+ <xsl:apply-templates select="."/>
1792
+ </xsl:template>
1793
+
1824
1794
  <xsl:template match="iso:preferred">
1825
1795
  <fo:block line-height="1.1">
1826
1796
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1848,6 +1818,34 @@
1848
1818
  </xsl:template>
1849
1819
 
1850
1820
 
1821
+ <xsl:template match="iso:bibitem">
1822
+ <fo:block id="{@id}" margin-bottom="6pt">
1823
+ <xsl:call-template name="processBibitem"/>
1824
+ </fo:block>
1825
+ </xsl:template>
1826
+
1827
+
1828
+ <xsl:template match="iso:bibitem/iso:note" priority="2">
1829
+ <fo:footnote>
1830
+ <xsl:variable name="number">
1831
+ <xsl:number level="any" count="iso:bibitem/iso:note"/>
1832
+ </xsl:variable>
1833
+ <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1834
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1835
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1836
+ </fo:basic-link>
1837
+ </fo:inline>
1838
+ <fo:footnote-body>
1839
+ <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1840
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1841
+ <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1842
+ </fo:inline>
1843
+ <xsl:apply-templates/>
1844
+ </fo:block>
1845
+ </fo:footnote-body>
1846
+ </fo:footnote>
1847
+ </xsl:template>
1848
+
1851
1849
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1852
1850
  <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem"> -->
1853
1851
  <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem">
@@ -1862,60 +1860,24 @@
1862
1860
  </fo:list-item-label>
1863
1861
  <fo:list-item-body start-indent="body-start()">
1864
1862
  <fo:block>
1865
- <xsl:variable name="docidentifier">
1866
- <xsl:if test="iso:docidentifier">
1867
- <xsl:choose>
1868
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1869
- <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1870
- </xsl:choose>
1871
- </xsl:if>
1872
- </xsl:variable>
1873
- <xsl:value-of select="$docidentifier"/>
1874
- <xsl:apply-templates select="iso:note"/>
1875
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1876
- <xsl:choose>
1877
- <xsl:when test="iso:title[@type = 'main' and @language = $lang]">
1878
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = $lang]"/>
1879
- </xsl:when>
1880
- <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1881
- <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
1882
- </xsl:when>
1883
- <xsl:otherwise>
1884
- <xsl:apply-templates select="iso:title"/>
1885
- </xsl:otherwise>
1886
- </xsl:choose>
1887
- <xsl:apply-templates select="iso:formattedref"/>
1863
+ <xsl:call-template name="processBibitem"/>
1888
1864
  </fo:block>
1889
1865
  </fo:list-item-body>
1890
1866
  </fo:list-item>
1891
1867
  </fo:list-block>
1892
1868
  </xsl:template>
1893
1869
 
1894
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> -->
1895
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem" mode="contents"/>
1870
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem" mode="contents"/> [not(@normative='true')] -->
1871
+ <xsl:template match="iso:references/iso:bibitem" mode="contents"/>
1896
1872
 
1897
- <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> -->
1898
- <xsl:template match="iso:references[not(@normative='true')]/iso:bibitem/iso:title">
1873
+ <!-- <xsl:template match="iso:references[@id = '_bibliography']/iso:bibitem/iso:title"> iso:references[not(@normative='true')]/ -->
1874
+ <xsl:template match="iso:bibitem/iso:title">
1899
1875
  <fo:inline font-style="italic">
1900
1876
  <xsl:apply-templates/>
1901
1877
  </fo:inline>
1902
1878
  </xsl:template>
1903
1879
 
1904
1880
 
1905
- <xsl:template match="mathml:math" priority="2">
1906
- <fo:inline font-family="Cambria Math">
1907
- <xsl:variable name="mathml">
1908
- <xsl:apply-templates select="." mode="mathml"/>
1909
- </xsl:variable>
1910
- <fo:instream-foreign-object fox:alt-text="Math">
1911
- <!-- <xsl:copy-of select="."/> -->
1912
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1913
- </fo:instream-foreign-object>
1914
- </fo:inline>
1915
- </xsl:template>
1916
-
1917
-
1918
-
1919
1881
  <xsl:template match="iso:admonition">
1920
1882
  <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1921
1883
  <xsl:variable name="type">
@@ -1956,7 +1918,25 @@
1956
1918
  <!-- =================== -->
1957
1919
  <!-- SVG images processing -->
1958
1920
  <!-- =================== -->
1959
- <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2">
1921
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1922
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
1923
+ <xsl:param name="name"/>
1924
+
1925
+ <xsl:variable name="svg_content">
1926
+ <xsl:apply-templates select="." mode="svg_update"/>
1927
+ </xsl:variable>
1928
+
1929
+ <xsl:variable name="alt-text">
1930
+ <xsl:choose>
1931
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1932
+ <xsl:value-of select="../*[local-name() = 'name']"/>
1933
+ </xsl:when>
1934
+ <xsl:when test="normalize-space($name) != ''">
1935
+ <xsl:value-of select="$name"/>
1936
+ </xsl:when>
1937
+ <xsl:otherwise>Figure</xsl:otherwise>
1938
+ </xsl:choose>
1939
+ </xsl:variable>
1960
1940
 
1961
1941
  <xsl:choose>
1962
1942
  <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
@@ -2005,14 +1985,22 @@
2005
1985
  <fo:table-cell column-number="2">
2006
1986
  <fo:block>
2007
1987
  <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
1988
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
1989
+ <fo:block line-height="0" font-size="0">
1990
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
1991
+ <xsl:call-template name="bookmark"/>
1992
+ </xsl:for-each>
1993
+ </fo:block>
1994
+ </xsl:if>
2008
1995
  <fo:block text-depth="0" line-height="0" font-size="0">
2009
- <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
1996
+
1997
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2010
1998
  <xsl:attribute name="width">100%</xsl:attribute>
2011
1999
  <xsl:attribute name="content-height">100%</xsl:attribute>
2012
2000
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2013
2001
  <xsl:attribute name="scaling">uniform</xsl:attribute>
2014
2002
 
2015
- <xsl:apply-templates select="." mode="svg_remove_a"/>
2003
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2016
2004
  </fo:instream-foreign-object>
2017
2005
  </fo:block>
2018
2006
 
@@ -2030,7 +2018,7 @@
2030
2018
  </xsl:when>
2031
2019
  <xsl:otherwise>
2032
2020
  <fo:block xsl:use-attribute-sets="image-style">
2033
- <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2021
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2034
2022
  <xsl:attribute name="width">100%</xsl:attribute>
2035
2023
  <xsl:attribute name="content-height">100%</xsl:attribute>
2036
2024
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
@@ -2042,13 +2030,35 @@
2042
2030
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2043
2031
  </xsl:if>
2044
2032
  <xsl:attribute name="scaling">uniform</xsl:attribute>
2045
- <xsl:copy-of select="."/>
2033
+ <xsl:copy-of select="$svg_content"/>
2046
2034
  </fo:instream-foreign-object>
2047
2035
  </fo:block>
2048
2036
  </xsl:otherwise>
2049
2037
  </xsl:choose>
2050
2038
  </xsl:template>
2051
2039
 
2040
+ <xsl:template match="@*|node()" mode="svg_update">
2041
+ <xsl:copy>
2042
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2043
+ </xsl:copy>
2044
+ </xsl:template>
2045
+
2046
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2047
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2048
+ <xsl:value-of select="."/>
2049
+ </xsl:attribute>
2050
+ </xsl:template>
2051
+
2052
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2053
+ <xsl:variable name="svg_content" select="document(@src)"/>
2054
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2055
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2056
+ <xsl:call-template name="image_svg">
2057
+ <xsl:with-param name="name" select="$name"/>
2058
+ </xsl:call-template>
2059
+ </xsl:for-each>
2060
+ </xsl:template>
2061
+
2052
2062
  <xsl:template match="@*|node()" mode="svg_remove_a">
2053
2063
  <xsl:copy>
2054
2064
  <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
@@ -2158,7 +2168,7 @@
2158
2168
  <!-- =================== -->
2159
2169
 
2160
2170
  <!-- For express listings PDF attachments -->
2161
- <xsl:template match="*[local-name() = 'eref'][contains(., '.exp')]" priority="2">
2171
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2162
2172
  <fo:inline xsl:use-attribute-sets="eref-style">
2163
2173
  <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2164
2174
  <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
@@ -2615,6 +2625,9 @@
2615
2625
  <title-continued lang="en">(continued)</title-continued>
2616
2626
  <title-continued lang="fr">(continué)</title-continued>
2617
2627
 
2628
+ </xsl:variable><xsl:variable name="bibdata">
2629
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2630
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2618
2631
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2619
2632
  <xsl:param name="name"/>
2620
2633
  <xsl:param name="lang"/>
@@ -2640,8 +2653,10 @@
2640
2653
  </xsl:choose>
2641
2654
  </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">
2642
2655
 
2656
+
2643
2657
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2644
2658
 
2659
+
2645
2660
  <xsl:attribute name="color">blue</xsl:attribute>
2646
2661
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2647
2662
 
@@ -2722,6 +2737,7 @@
2722
2737
 
2723
2738
 
2724
2739
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2740
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2725
2741
 
2726
2742
 
2727
2743
 
@@ -2768,6 +2784,7 @@
2768
2784
 
2769
2785
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2770
2786
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2787
+
2771
2788
 
2772
2789
 
2773
2790
 
@@ -2806,6 +2823,7 @@
2806
2823
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2807
2824
 
2808
2825
 
2826
+
2809
2827
  <xsl:attribute name="color">blue</xsl:attribute>
2810
2828
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2811
2829
 
@@ -2819,6 +2837,7 @@
2819
2837
 
2820
2838
 
2821
2839
 
2840
+
2822
2841
 
2823
2842
 
2824
2843
 
@@ -2842,6 +2861,7 @@
2842
2861
 
2843
2862
 
2844
2863
 
2864
+
2845
2865
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2846
2866
 
2847
2867
 
@@ -2871,6 +2891,7 @@
2871
2891
 
2872
2892
 
2873
2893
 
2894
+
2874
2895
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2875
2896
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
2876
2897
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -2879,6 +2900,7 @@
2879
2900
 
2880
2901
 
2881
2902
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2903
+
2882
2904
 
2883
2905
 
2884
2906
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -2905,6 +2927,7 @@
2905
2927
 
2906
2928
 
2907
2929
 
2930
+
2908
2931
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2909
2932
 
2910
2933
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
@@ -2917,6 +2940,7 @@
2917
2940
 
2918
2941
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2919
2942
 
2943
+
2920
2944
 
2921
2945
 
2922
2946
 
@@ -2949,10 +2973,12 @@
2949
2973
 
2950
2974
 
2951
2975
 
2976
+
2952
2977
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2953
2978
 
2954
2979
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2955
2980
 
2981
+
2956
2982
  <xsl:attribute name="width">100%</xsl:attribute>
2957
2983
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2958
2984
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -2978,7 +3004,7 @@
2978
3004
 
2979
3005
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2980
3006
 
2981
-
3007
+
2982
3008
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2983
3009
 
2984
3010
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2986,7 +3012,28 @@
2986
3012
 
2987
3013
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2988
3014
 
2989
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3015
+
3016
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3017
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3018
+ </xsl:variable><xsl:attribute-set name="add-style">
3019
+ <xsl:attribute name="color">red</xsl:attribute>
3020
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3021
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3022
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3023
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3024
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3025
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3026
+ <xsl:text>red</xsl:text>
3027
+ </xsl:variable><xsl:attribute-set name="del-style">
3028
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
3029
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3030
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3031
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3032
+
3033
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3034
+
3035
+
3036
+ </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">
2990
3037
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2991
3038
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2992
3039
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3031,16 +3078,17 @@
3031
3078
  <xsl:call-template name="add-zero-spaces-java"/>
3032
3079
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3033
3080
 
3081
+ <xsl:variable name="table-preamble">
3082
+
3083
+
3084
+ </xsl:variable>
3085
+
3034
3086
  <xsl:variable name="table">
3035
3087
 
3036
3088
  <xsl:variable name="simple-table">
3037
3089
  <xsl:call-template name="getSimpleTable"/>
3038
3090
  </xsl:variable>
3039
3091
 
3040
-
3041
-
3042
-
3043
-
3044
3092
  <!-- <xsl:if test="$namespace = 'bipm'">
3045
3093
  <fo:block>&#xA0;</fo:block>
3046
3094
  </xsl:if> -->
@@ -3051,7 +3099,7 @@
3051
3099
 
3052
3100
 
3053
3101
 
3054
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3102
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3055
3103
 
3056
3104
  <!-- <xsl:variable name="cols-count">
3057
3105
  <xsl:choose>
@@ -3070,8 +3118,6 @@
3070
3118
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3071
3119
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3072
3120
 
3073
-
3074
-
3075
3121
  <xsl:variable name="colwidths">
3076
3122
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3077
3123
  <xsl:call-template name="calculate-column-widths">
@@ -3099,8 +3145,10 @@
3099
3145
  </xsl:choose>
3100
3146
  </xsl:variable>
3101
3147
 
3148
+
3102
3149
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3103
3150
 
3151
+
3104
3152
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3105
3153
 
3106
3154
 
@@ -3112,6 +3160,7 @@
3112
3160
 
3113
3161
 
3114
3162
 
3163
+
3115
3164
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
3116
3165
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3117
3166
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -3121,6 +3170,7 @@
3121
3170
 
3122
3171
 
3123
3172
 
3173
+
3124
3174
  <xsl:variable name="table_width">
3125
3175
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3126
3176
  100%
@@ -3134,12 +3184,19 @@
3134
3184
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3135
3185
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3136
3186
 
3187
+
3137
3188
  <attribute name="border">1.5pt solid black</attribute>
3138
3189
  <xsl:if test="*[local-name()='thead']">
3139
3190
  <attribute name="border-top">1pt solid black</attribute>
3140
3191
  </xsl:if>
3141
3192
 
3142
3193
 
3194
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3195
+ <!-- for internal table in table cell -->
3196
+ <attribute name="border">0.5pt solid black</attribute>
3197
+ </xsl:if>
3198
+
3199
+
3143
3200
 
3144
3201
 
3145
3202
  <attribute name="margin-left">0mm</attribute>
@@ -3234,7 +3291,8 @@
3234
3291
  </fo:block-container>
3235
3292
  </xsl:variable>
3236
3293
 
3237
-
3294
+ <xsl:variable name="isAdded" select="@added"/>
3295
+ <xsl:variable name="isDeleted" select="@deleted"/>
3238
3296
 
3239
3297
  <xsl:choose>
3240
3298
  <xsl:when test="@width">
@@ -3248,7 +3306,14 @@
3248
3306
  <fo:table-body>
3249
3307
  <fo:table-row>
3250
3308
  <fo:table-cell column-number="2">
3251
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3309
+ <xsl:copy-of select="$table-preamble"/>
3310
+ <fo:block>
3311
+ <xsl:call-template name="setTrackChangesStyles">
3312
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3313
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3314
+ </xsl:call-template>
3315
+ <xsl:copy-of select="$table"/>
3316
+ </fo:block>
3252
3317
  </fo:table-cell>
3253
3318
  </fo:table-row>
3254
3319
  </fo:table-body>
@@ -3259,18 +3324,46 @@
3259
3324
 
3260
3325
  </xsl:when>
3261
3326
  <xsl:otherwise>
3262
- <xsl:copy-of select="$table"/>
3327
+ <xsl:choose>
3328
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3329
+ <xsl:copy-of select="$table-preamble"/>
3330
+ <fo:block>
3331
+ <xsl:call-template name="setTrackChangesStyles">
3332
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3333
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3334
+ </xsl:call-template>
3335
+ <xsl:copy-of select="$table"/>
3336
+ </fo:block>
3337
+ </xsl:when>
3338
+ <xsl:otherwise>
3339
+ <xsl:copy-of select="$table-preamble"/>
3340
+ <xsl:copy-of select="$table"/>
3341
+ </xsl:otherwise>
3342
+ </xsl:choose>
3263
3343
  </xsl:otherwise>
3264
3344
  </xsl:choose>
3265
3345
 
3266
3346
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3347
+ <xsl:param name="continued"/>
3267
3348
  <xsl:if test="normalize-space() != ''">
3268
3349
  <fo:block xsl:use-attribute-sets="table-name-style">
3269
3350
 
3270
3351
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3271
3352
 
3272
3353
 
3273
- <xsl:apply-templates/>
3354
+ <xsl:choose>
3355
+ <xsl:when test="$continued = 'true'">
3356
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3357
+
3358
+ <xsl:apply-templates/>
3359
+
3360
+ </xsl:when>
3361
+ <xsl:otherwise>
3362
+ <xsl:apply-templates/>
3363
+ </xsl:otherwise>
3364
+ </xsl:choose>
3365
+
3366
+
3274
3367
  </fo:block>
3275
3368
  </xsl:if>
3276
3369
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3322,7 +3415,7 @@
3322
3415
  </xsl:for-each>
3323
3416
  </xsl:when>
3324
3417
  <xsl:otherwise>
3325
- <xsl:for-each select="xalan:nodeset($table)//tr">
3418
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3326
3419
  <xsl:variable name="td_text">
3327
3420
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3328
3421
 
@@ -3414,18 +3507,23 @@
3414
3507
  <xsl:apply-templates/>
3415
3508
  </fo:table-header>
3416
3509
  </xsl:template><xsl:template name="table-header-title">
3417
- <xsl:param name="cols-count"/>
3510
+ <xsl:param name="cols-count"/>
3418
3511
  <!-- row for title -->
3419
3512
  <fo:table-row>
3420
3513
  <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">
3421
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3514
+
3515
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3516
+ <xsl:with-param name="continued">true</xsl:with-param>
3517
+ </xsl:apply-templates>
3422
3518
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3423
3519
  <xsl:call-template name="fn_name_display"/>
3424
- </xsl:for-each>
3425
- <fo:block text-align="right" font-style="italic">
3426
- <xsl:text> </xsl:text>
3427
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3428
- </fo:block>
3520
+ </xsl:for-each>
3521
+
3522
+ <fo:block text-align="right" font-style="italic">
3523
+ <xsl:text> </xsl:text>
3524
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3525
+ </fo:block>
3526
+
3429
3527
  </fo:table-cell>
3430
3528
  </fo:table-row>
3431
3529
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3646,19 +3744,25 @@
3646
3744
  <xsl:call-template name="getTitle">
3647
3745
  <xsl:with-param name="name" select="'title-continued'"/>
3648
3746
  </xsl:call-template>
3649
- </xsl:variable>
3747
+ </xsl:variable>
3748
+
3749
+ <xsl:variable name="title_start" select="ancestor::*[local-name()='table'][1]/*[local-name()='name']/node()[1][self::text()]"/>
3750
+ <xsl:variable name="table_number" select="substring-before($title_start, '—')"/>
3751
+
3650
3752
  <fo:table-row height="0" keep-with-next.within-page="always">
3651
3753
  <fo:table-cell>
3652
- <fo:marker marker-class-name="table_continued"/>
3754
+
3755
+
3756
+ <fo:marker marker-class-name="table_continued"/>
3757
+
3653
3758
  <fo:block/>
3654
3759
  </fo:table-cell>
3655
3760
  </fo:table-row>
3656
3761
  <fo:table-row height="0" keep-with-next.within-page="always">
3657
3762
  <fo:table-cell>
3658
- <fo:marker marker-class-name="table_continued">
3659
- <!-- <fo:inline font-style="italic" font-weight="normal"> -->
3660
- <xsl:value-of select="$title_continued"/>
3661
- <!-- </fo:inline> -->
3763
+
3764
+ <fo:marker marker-class-name="table_continued">
3765
+ <xsl:value-of select="$title_continued"/>
3662
3766
  </fo:marker>
3663
3767
  <fo:block/>
3664
3768
  </fo:table-cell>
@@ -3696,6 +3800,7 @@
3696
3800
 
3697
3801
 
3698
3802
 
3803
+
3699
3804
  </xsl:if>
3700
3805
  <xsl:if test="$parent-name = 'tfoot'">
3701
3806
 
@@ -3720,12 +3825,14 @@
3720
3825
  <xsl:attribute name="text-align">
3721
3826
  <xsl:choose>
3722
3827
  <xsl:when test="@align">
3723
- <xsl:value-of select="@align"/>
3828
+ <xsl:call-template name="setAlignment"/>
3829
+ <!-- <xsl:value-of select="@align"/> -->
3724
3830
  </xsl:when>
3725
3831
  <xsl:otherwise>center</xsl:otherwise>
3726
3832
  </xsl:choose>
3727
3833
  </xsl:attribute>
3728
3834
 
3835
+
3729
3836
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3730
3837
 
3731
3838
 
@@ -3738,6 +3845,9 @@
3738
3845
 
3739
3846
 
3740
3847
 
3848
+ <xsl:if test="$lang = 'ar'">
3849
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3850
+ </xsl:if>
3741
3851
  <xsl:if test="@colspan">
3742
3852
  <xsl:attribute name="number-columns-spanned">
3743
3853
  <xsl:value-of select="@colspan"/>
@@ -3769,16 +3879,21 @@
3769
3879
  <xsl:attribute name="text-align">
3770
3880
  <xsl:choose>
3771
3881
  <xsl:when test="@align">
3772
- <xsl:value-of select="@align"/>
3882
+ <xsl:call-template name="setAlignment"/>
3883
+ <!-- <xsl:value-of select="@align"/> -->
3773
3884
  </xsl:when>
3774
3885
  <xsl:otherwise>left</xsl:otherwise>
3775
3886
  </xsl:choose>
3776
3887
  </xsl:attribute>
3888
+ <xsl:if test="$lang = 'ar'">
3889
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3890
+ </xsl:if>
3777
3891
  <!-- and ancestor::*[local-name() = 'thead'] -->
3778
3892
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3779
3893
 
3780
3894
 
3781
3895
 
3896
+
3782
3897
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3783
3898
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3784
3899
  </xsl:if>
@@ -3791,6 +3906,9 @@
3791
3906
 
3792
3907
 
3793
3908
 
3909
+ <xsl:if test=".//*[local-name() = 'table']">
3910
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3911
+ </xsl:if>
3794
3912
  <xsl:if test="@colspan">
3795
3913
  <xsl:attribute name="number-columns-spanned">
3796
3914
  <xsl:value-of select="@colspan"/>
@@ -3924,13 +4042,13 @@
3924
4042
  </xsl:choose>
3925
4043
  </xsl:variable>
3926
4044
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3927
- <xsl:element name="{$ns}:table">
4045
+ <!-- <xsl:element name="{$ns}:table"> -->
3928
4046
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3929
4047
  <tbody>
3930
4048
  <xsl:apply-templates mode="dl"/>
3931
4049
  </tbody>
3932
4050
  </xsl:for-each>
3933
- </xsl:element>
4051
+ <!-- </xsl:element> -->
3934
4052
  </xsl:variable>
3935
4053
 
3936
4054
  <xsl:call-template name="calculate-column-widths">
@@ -4027,6 +4145,8 @@
4027
4145
  <xsl:apply-templates/>
4028
4146
  </fo:inline>
4029
4147
  </xsl:template><xsl:template match="*[local-name()='dl']">
4148
+ <xsl:variable name="isAdded" select="@added"/>
4149
+ <xsl:variable name="isDeleted" select="@deleted"/>
4030
4150
  <fo:block-container>
4031
4151
 
4032
4152
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4043,6 +4163,12 @@
4043
4163
  </xsl:attribute>
4044
4164
 
4045
4165
  </xsl:if>
4166
+
4167
+ <xsl:call-template name="setTrackChangesStyles">
4168
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4169
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4170
+ </xsl:call-template>
4171
+
4046
4172
  <fo:block-container>
4047
4173
 
4048
4174
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4164,11 +4290,11 @@
4164
4290
  </xsl:choose>
4165
4291
  </xsl:variable>
4166
4292
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4167
- <xsl:element name="{$ns}:table">
4293
+ <!-- <xsl:element name="{$ns}:table"> -->
4168
4294
  <tbody>
4169
4295
  <xsl:apply-templates mode="dl"/>
4170
4296
  </tbody>
4171
- </xsl:element>
4297
+ <!-- </xsl:element> -->
4172
4298
  </xsl:variable>
4173
4299
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4174
4300
  <xsl:variable name="colwidths">
@@ -4420,6 +4546,7 @@
4420
4546
 
4421
4547
 
4422
4548
 
4549
+
4423
4550
 
4424
4551
  </xsl:variable>
4425
4552
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4437,8 +4564,74 @@
4437
4564
  <fo:inline text-decoration="underline">
4438
4565
  <xsl:apply-templates/>
4439
4566
  </fo:inline>
4567
+ </xsl:template><xsl:template match="*[local-name()='add']">
4568
+ <xsl:choose>
4569
+ <xsl:when test="@amendment">
4570
+ <fo:inline>
4571
+ <xsl:call-template name="insertTag">
4572
+ <xsl:with-param name="kind">A</xsl:with-param>
4573
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4574
+ </xsl:call-template>
4575
+ <xsl:apply-templates/>
4576
+ <xsl:call-template name="insertTag">
4577
+ <xsl:with-param name="type">closing</xsl:with-param>
4578
+ <xsl:with-param name="kind">A</xsl:with-param>
4579
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4580
+ </xsl:call-template>
4581
+ </fo:inline>
4582
+ </xsl:when>
4583
+ <xsl:when test="@corrigenda">
4584
+ <fo:inline>
4585
+ <xsl:call-template name="insertTag">
4586
+ <xsl:with-param name="kind">C</xsl:with-param>
4587
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4588
+ </xsl:call-template>
4589
+ <xsl:apply-templates/>
4590
+ <xsl:call-template name="insertTag">
4591
+ <xsl:with-param name="type">closing</xsl:with-param>
4592
+ <xsl:with-param name="kind">C</xsl:with-param>
4593
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4594
+ </xsl:call-template>
4595
+ </fo:inline>
4596
+ </xsl:when>
4597
+ <xsl:otherwise>
4598
+ <fo:inline xsl:use-attribute-sets="add-style">
4599
+ <xsl:apply-templates/>
4600
+ </fo:inline>
4601
+ </xsl:otherwise>
4602
+ </xsl:choose>
4603
+
4604
+ </xsl:template><xsl:template name="insertTag">
4605
+ <xsl:param name="type"/>
4606
+ <xsl:param name="kind"/>
4607
+ <xsl:param name="value"/>
4608
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4609
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4610
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4611
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4612
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4613
+ <xsl:attribute name="height">5mm</xsl:attribute>
4614
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4615
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4616
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4617
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4618
+ <g>
4619
+ <xsl:if test="$type = 'closing'">
4620
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4621
+ </xsl:if>
4622
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4623
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4624
+ </g>
4625
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4626
+ <xsl:if test="$type = 'closing'">
4627
+ <xsl:attribute name="x">25</xsl:attribute>
4628
+ </xsl:if>
4629
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4630
+ </text>
4631
+ </svg>
4632
+ </fo:instream-foreign-object>
4440
4633
  </xsl:template><xsl:template match="*[local-name()='del']">
4441
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4634
+ <fo:inline xsl:use-attribute-sets="del-style">
4442
4635
  <xsl:apply-templates/>
4443
4636
  </fo:inline>
4444
4637
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -4735,11 +4928,15 @@
4735
4928
  </xsl:apply-templates>
4736
4929
  </xsl:template><xsl:template name="getLang">
4737
4930
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4931
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4738
4932
  <xsl:variable name="language">
4739
4933
  <xsl:choose>
4740
4934
  <xsl:when test="$language_current != ''">
4741
4935
  <xsl:value-of select="$language_current"/>
4742
4936
  </xsl:when>
4937
+ <xsl:when test="$language_current_2 != ''">
4938
+ <xsl:value-of select="$language_current_2"/>
4939
+ </xsl:when>
4743
4940
  <xsl:otherwise>
4744
4941
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4745
4942
  </xsl:otherwise>
@@ -4779,13 +4976,30 @@
4779
4976
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4780
4977
  <xsl:value-of select="substring($str, 2)"/>
4781
4978
  </xsl:template><xsl:template match="mathml:math">
4782
- <fo:inline font-family="STIX Two Math"> <!-- -->
4979
+ <xsl:variable name="isAdded" select="@added"/>
4980
+ <xsl:variable name="isDeleted" select="@deleted"/>
4981
+
4982
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4983
+
4984
+
4985
+ <xsl:call-template name="setTrackChangesStyles">
4986
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4987
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4988
+ </xsl:call-template>
4783
4989
 
4784
4990
  <xsl:variable name="mathml">
4785
4991
  <xsl:apply-templates select="." mode="mathml"/>
4786
4992
  </xsl:variable>
4787
4993
  <fo:instream-foreign-object fox:alt-text="Math">
4788
4994
 
4995
+
4996
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
4997
+ <xsl:attribute name="width">95%</xsl:attribute>
4998
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4999
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5000
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5001
+ </xsl:if>
5002
+
4789
5003
  <!-- <xsl:copy-of select="."/> -->
4790
5004
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4791
5005
  </fo:instream-foreign-object>
@@ -4942,6 +5156,7 @@
4942
5156
 
4943
5157
 
4944
5158
  <fo:inline xsl:use-attribute-sets="note-name-style">
5159
+
4945
5160
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4946
5161
  </fo:inline>
4947
5162
  <xsl:apply-templates/>
@@ -4968,6 +5183,7 @@
4968
5183
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4969
5184
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4970
5185
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5186
+
4971
5187
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4972
5188
  </fo:inline>
4973
5189
  <xsl:apply-templates/>
@@ -5031,8 +5247,15 @@
5031
5247
  </fo:inline>
5032
5248
  </xsl:if>
5033
5249
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5250
+ <xsl:variable name="isAdded" select="@added"/>
5251
+ <xsl:variable name="isDeleted" select="@deleted"/>
5034
5252
  <fo:block-container id="{@id}">
5035
5253
 
5254
+ <xsl:call-template name="setTrackChangesStyles">
5255
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5256
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5257
+ </xsl:call-template>
5258
+
5036
5259
  <fo:block>
5037
5260
  <xsl:apply-templates/>
5038
5261
  </fo:block>
@@ -5040,7 +5263,10 @@
5040
5263
  <xsl:for-each select="*[local-name() = 'note']">
5041
5264
  <xsl:call-template name="note"/>
5042
5265
  </xsl:for-each>
5043
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5266
+
5267
+
5268
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5269
+
5044
5270
  </fo:block-container>
5045
5271
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5046
5272
  <fo:block id="{@id}">
@@ -5052,37 +5278,122 @@
5052
5278
  <xsl:apply-templates/>
5053
5279
  </fo:block>
5054
5280
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5055
- <fo:block xsl:use-attribute-sets="image-style">
5056
-
5057
-
5058
- <xsl:variable name="src">
5059
- <xsl:choose>
5060
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5061
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5062
- </xsl:when>
5063
- <xsl:otherwise>
5064
- <xsl:value-of select="@src"/>
5065
- </xsl:otherwise>
5066
- </xsl:choose>
5067
- </xsl:variable>
5068
-
5069
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5070
- </fo:block>
5281
+ <xsl:variable name="isAdded" select="../@added"/>
5282
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5283
+ <xsl:choose>
5284
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5285
+ <fo:inline padding-left="1mm" padding-right="1mm">
5286
+ <xsl:variable name="src">
5287
+ <xsl:call-template name="image_src"/>
5288
+ </xsl:variable>
5289
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5290
+ </fo:inline>
5291
+ </xsl:when>
5292
+ <xsl:otherwise>
5293
+ <fo:block xsl:use-attribute-sets="image-style">
5294
+
5295
+ <xsl:variable name="src">
5296
+ <xsl:call-template name="image_src"/>
5297
+ </xsl:variable>
5298
+
5299
+ <xsl:choose>
5300
+ <xsl:when test="$isDeleted = 'true'">
5301
+ <!-- enclose in svg -->
5302
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5303
+ <xsl:attribute name="width">100%</xsl:attribute>
5304
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5305
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5306
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5307
+
5308
+
5309
+ <xsl:apply-templates select="." mode="cross_image"/>
5310
+
5311
+ </fo:instream-foreign-object>
5312
+ </xsl:when>
5313
+ <xsl:otherwise>
5314
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5315
+ </xsl:otherwise>
5316
+ </xsl:choose>
5317
+
5318
+ </fo:block>
5319
+ </xsl:otherwise>
5320
+ </xsl:choose>
5321
+ </xsl:template><xsl:template name="image_src">
5322
+ <xsl:choose>
5323
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5324
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5325
+ </xsl:when>
5326
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5327
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5328
+ </xsl:when>
5329
+ <xsl:otherwise>
5330
+ <xsl:value-of select="@src"/>
5331
+ </xsl:otherwise>
5332
+ </xsl:choose>
5333
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5334
+ <xsl:choose>
5335
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5336
+ <xsl:variable name="src">
5337
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5338
+ </xsl:variable>
5339
+ <xsl:variable name="width" select="document($src)/@width"/>
5340
+ <xsl:variable name="height" select="document($src)/@height"/>
5341
+ <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">
5342
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5343
+ </svg>
5344
+ </xsl:when>
5345
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5346
+ <xsl:variable name="src">
5347
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5348
+ </xsl:variable>
5349
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5350
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5351
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5352
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5353
+ <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">
5354
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5355
+ </svg>
5356
+ </xsl:when>
5357
+ <xsl:otherwise>
5358
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5359
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5360
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5361
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5362
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5363
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5364
+ <!-- width=<xsl:value-of select="$width"/> -->
5365
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5366
+ <!-- height=<xsl:value-of select="$height"/> -->
5367
+ <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">
5368
+ <image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5369
+ <xsl:call-template name="svg_cross">
5370
+ <xsl:with-param name="width" select="$width"/>
5371
+ <xsl:with-param name="height" select="$height"/>
5372
+ </xsl:call-template>
5373
+ </svg>
5374
+ </xsl:otherwise>
5375
+ </xsl:choose>
5376
+
5377
+ </xsl:template><xsl:template name="svg_cross">
5378
+ <xsl:param name="width"/>
5379
+ <xsl:param name="height"/>
5380
+ <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; "/>
5381
+ <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; "/>
5071
5382
  </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">
5072
5383
  <xsl:apply-templates mode="contents"/>
5073
5384
  <xsl:text> </xsl:text>
5074
5385
  </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">
5075
5386
  <xsl:apply-templates mode="bookmarks"/>
5076
5387
  <xsl:text> </xsl:text>
5077
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5388
+ </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">
5078
5389
  <xsl:value-of select="."/>
5079
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5390
+ </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">
5080
5391
  <xsl:value-of select="."/>
5081
5392
  </xsl:template><xsl:template match="node()" mode="contents">
5082
5393
  <xsl:apply-templates mode="contents"/>
5083
5394
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5084
5395
  <xsl:apply-templates mode="bookmarks"/>
5085
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5396
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5086
5397
  <xsl:apply-templates select="."/>
5087
5398
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5088
5399
  <xsl:apply-templates mode="bookmarks"/>
@@ -5281,6 +5592,8 @@
5281
5592
  </fo:list-item-body>
5282
5593
  </fo:list-item>
5283
5594
  </fo:list-block>
5595
+ </xsl:template><xsl:template name="extractSection">
5596
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5284
5597
  </xsl:template><xsl:template name="extractTitle">
5285
5598
  <xsl:choose>
5286
5599
  <xsl:when test="*[local-name() = 'tab']">
@@ -5328,6 +5641,7 @@
5328
5641
  9
5329
5642
 
5330
5643
 
5644
+
5331
5645
 
5332
5646
 
5333
5647
 
@@ -5610,6 +5924,7 @@
5610
5924
  <xsl:variable name="element">
5611
5925
 
5612
5926
  inline
5927
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5613
5928
  </xsl:variable>
5614
5929
  <xsl:choose>
5615
5930
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5617,7 +5932,7 @@
5617
5932
  <xsl:apply-templates/>
5618
5933
  </fo:inline>
5619
5934
  </xsl:when>
5620
- <xsl:when test="normalize-space($element) = 'block'">
5935
+ <xsl:when test="contains(normalize-space($element), 'block')">
5621
5936
  <fo:block xsl:use-attribute-sets="example-name-style">
5622
5937
  <xsl:apply-templates/>
5623
5938
  </fo:block>
@@ -5654,7 +5969,7 @@
5654
5969
  </fo:inline>
5655
5970
  </xsl:otherwise>
5656
5971
  </xsl:choose>
5657
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
5972
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5658
5973
  <fo:block xsl:use-attribute-sets="termsource-style">
5659
5974
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5660
5975
  <xsl:variable name="termsource_text">
@@ -5663,13 +5978,15 @@
5663
5978
 
5664
5979
  <xsl:choose>
5665
5980
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5666
- <xsl:apply-templates/>
5981
+ <!-- <xsl:apply-templates /> -->
5982
+ <xsl:copy-of select="$termsource_text"/>
5667
5983
  </xsl:when>
5668
5984
  <xsl:otherwise>
5669
5985
 
5670
5986
  <xsl:text>[</xsl:text>
5671
5987
 
5672
- <xsl:apply-templates/>
5988
+ <!-- <xsl:apply-templates /> -->
5989
+ <xsl:copy-of select="$termsource_text"/>
5673
5990
 
5674
5991
  <xsl:text>]</xsl:text>
5675
5992
 
@@ -5680,16 +5997,23 @@
5680
5997
  <xsl:if test="normalize-space() != ''">
5681
5998
  <xsl:value-of select="."/>
5682
5999
  </xsl:if>
5683
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6000
+ </xsl:template><xsl:variable name="localized.source">
6001
+ <xsl:call-template name="getLocalizedString">
6002
+ <xsl:with-param name="key">source</xsl:with-param>
6003
+ </xsl:call-template>
6004
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5684
6005
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6006
+ <xsl:if test="normalize-space(@citeas) = ''">
6007
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6008
+ </xsl:if>
5685
6009
 
5686
6010
  <fo:inline>
5687
6011
 
5688
6012
 
5689
-
5690
- <xsl:call-template name="getLocalizedString">
6013
+ <!-- <xsl:call-template name="getLocalizedString">
5691
6014
  <xsl:with-param name="key">source</xsl:with-param>
5692
- </xsl:call-template>
6015
+ </xsl:call-template> -->
6016
+ <xsl:value-of select="$localized.source"/>
5693
6017
 
5694
6018
 
5695
6019
 
@@ -5841,7 +6165,8 @@
5841
6165
  </fo:inline>
5842
6166
  </xsl:when>
5843
6167
  <xsl:otherwise>
5844
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6168
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6169
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5845
6170
  </xsl:otherwise>
5846
6171
  </xsl:choose>
5847
6172
 
@@ -5900,7 +6225,6 @@
5900
6225
 
5901
6226
 
5902
6227
 
5903
-
5904
6228
  <xsl:apply-templates/>
5905
6229
  </fo:block>
5906
6230
 
@@ -5943,7 +6267,7 @@
5943
6267
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5944
6268
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5945
6269
  <xsl:choose>
5946
- <xsl:when test="parent::*[local-name() = 'note']">
6270
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
5947
6271
  <fo:block-container>
5948
6272
  <xsl:attribute name="margin-left">
5949
6273
  <xsl:choose>
@@ -5953,6 +6277,7 @@
5953
6277
  </xsl:attribute>
5954
6278
 
5955
6279
 
6280
+
5956
6281
  <fo:block-container margin-left="0mm">
5957
6282
  <fo:block>
5958
6283
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6111,8 +6436,8 @@
6111
6436
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6112
6437
  <xsl:apply-templates/>
6113
6438
  </fo:block>
6114
- </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
6115
- <fo:inline id="{@id}"/>
6439
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6440
+ <fo:inline id="{@id}" font-size="1pt"/>
6116
6441
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
6117
6442
  <!-- <row>
6118
6443
  <date>05-07-2013</date>
@@ -6154,6 +6479,36 @@
6154
6479
 
6155
6480
 
6156
6481
 
6482
+
6483
+
6484
+ <!-- start ISO bibtem processing -->
6485
+ <xsl:variable name="docidentifier">
6486
+ <xsl:if test="*[local-name() = 'docidentifier']">
6487
+ <xsl:choose>
6488
+ <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
6489
+ <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier']"/></xsl:otherwise>
6490
+ </xsl:choose>
6491
+ </xsl:if>
6492
+ </xsl:variable>
6493
+ <xsl:value-of select="$docidentifier"/>
6494
+ <xsl:apply-templates select="*[local-name() = 'note']"/>
6495
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6496
+ <xsl:choose>
6497
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
6498
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
6499
+ </xsl:when>
6500
+ <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
6501
+ <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
6502
+ </xsl:when>
6503
+ <xsl:otherwise>
6504
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
6505
+ </xsl:otherwise>
6506
+ </xsl:choose>
6507
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
6508
+ <!-- end ISO bibitem processing -->
6509
+
6510
+
6511
+
6157
6512
  </xsl:template><xsl:template name="processBibitemDocId">
6158
6513
  <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')]"/>
6159
6514
  <xsl:choose>
@@ -6210,6 +6565,70 @@
6210
6565
  <xsl:value-of select="substring(.,1,1)"/>
6211
6566
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6212
6567
  <fo:inline><xsl:apply-templates/></fo:inline>
6568
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6569
+ <fo:block>
6570
+ <xsl:apply-templates/>
6571
+ </fo:block>
6572
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6573
+ <fo:inline><xsl:apply-templates/></fo:inline>
6574
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6575
+ <fo:inline>
6576
+ <xsl:call-template name="text_input"/>
6577
+ </fo:inline>
6578
+ </xsl:template><xsl:template name="text_input">
6579
+ <xsl:variable name="count">
6580
+ <xsl:choose>
6581
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6582
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6583
+ <xsl:otherwise>10</xsl:otherwise>
6584
+ </xsl:choose>
6585
+ </xsl:variable>
6586
+ <xsl:call-template name="repeat">
6587
+ <xsl:with-param name="char" select="'_'"/>
6588
+ <xsl:with-param name="count" select="$count"/>
6589
+ </xsl:call-template>
6590
+ <xsl:text> </xsl:text>
6591
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6592
+ <xsl:variable name="caption">
6593
+ <xsl:choose>
6594
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6595
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6596
+ </xsl:choose>
6597
+ </xsl:variable>
6598
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6599
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6600
+ <fo:inline padding-right="1mm">
6601
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6602
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6603
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6604
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6605
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6606
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6607
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6608
+ </svg>
6609
+ </fo:instream-foreign-object>
6610
+ </fo:inline>
6611
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6612
+ <fo:inline padding-right="1mm">
6613
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6614
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6615
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6616
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6617
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6618
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6619
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6620
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6621
+ </svg>
6622
+ </fo:instream-foreign-object>
6623
+ </fo:inline>
6624
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6625
+ <fo:inline>
6626
+ <xsl:call-template name="text_input"/>
6627
+ </fo:inline>
6628
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6629
+ <fo:block-container border="1pt solid black" width="50%">
6630
+ <fo:block> </fo:block>
6631
+ </fo:block-container>
6213
6632
  </xsl:template><xsl:template name="convertDate">
6214
6633
  <xsl:param name="date"/>
6215
6634
  <xsl:param name="format" select="'short'"/>
@@ -6472,6 +6891,7 @@
6472
6891
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
6473
6892
  <xsl:variable name="XSLNS">
6474
6893
 
6894
+
6475
6895
  <xsl:value-of select="document('')//*/namespace::iso"/>
6476
6896
 
6477
6897
 
@@ -6541,17 +6961,62 @@
6541
6961
  </xsl:call-template>
6542
6962
  </xsl:if>
6543
6963
  </xsl:template><xsl:template name="getLocalizedString">
6544
- <xsl:param name="key"/>
6964
+ <xsl:param name="key"/>
6545
6965
 
6546
6966
  <xsl:variable name="curr_lang">
6547
6967
  <xsl:call-template name="getLang"/>
6548
6968
  </xsl:variable>
6549
6969
 
6970
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6971
+
6550
6972
  <xsl:choose>
6973
+ <xsl:when test="$data_value != ''">
6974
+ <xsl:value-of select="$data_value"/>
6975
+ </xsl:when>
6551
6976
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6552
6977
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6553
6978
  </xsl:when>
6554
6979
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6555
6980
  </xsl:choose>
6556
6981
 
6982
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6983
+ <xsl:param name="isAdded"/>
6984
+ <xsl:param name="isDeleted"/>
6985
+ <xsl:choose>
6986
+ <xsl:when test="local-name() = 'math'">
6987
+ <xsl:if test="$isAdded = 'true'">
6988
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6989
+ </xsl:if>
6990
+ <xsl:if test="$isDeleted = 'true'">
6991
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6992
+ </xsl:if>
6993
+ </xsl:when>
6994
+ <xsl:otherwise>
6995
+ <xsl:if test="$isAdded = 'true'">
6996
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6997
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6998
+ </xsl:if>
6999
+ <xsl:if test="$isDeleted = 'true'">
7000
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
7001
+ <xsl:if test="local-name() = 'table'">
7002
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
7003
+ </xsl:if>
7004
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
7005
+ <xsl:attribute name="padding">2mm</xsl:attribute>
7006
+ </xsl:if>
7007
+ </xsl:otherwise>
7008
+ </xsl:choose>
7009
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
7010
+ <xsl:if test="$lang = 'ar'">
7011
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
7012
+ </xsl:if>
7013
+ </xsl:template><xsl:template name="setAlignment">
7014
+ <xsl:param name="align" select="normalize-space(@align)"/>
7015
+ <xsl:choose>
7016
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
7017
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
7018
+ <xsl:when test="$align != ''">
7019
+ <xsl:value-of select="$align"/>
7020
+ </xsl:when>
7021
+ </xsl:choose>
6557
7022
  </xsl:template></xsl:stylesheet>