metanorma-un 0.6.6 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a5c20da9a001c0acd4087934cf4f9cbc82a2120c3d2f5b3e7a5d5d044faa5cb
4
- data.tar.gz: 4d454c978e7dd64bc99b623e7369f85c0217b77cca1e528de503fababdea145b
3
+ metadata.gz: 20d1e57f121c8608902a2faf38631a06035ddd820a11826977e2fc04bfbb36ca
4
+ data.tar.gz: 3991d1560ef4d9721da8033083e4b1f4e79323e2f382b80c6ba05c129d1aed24
5
5
  SHA512:
6
- metadata.gz: 83bff8b909f59c56c86e1d1a034a0e5d637e7897ebd9578fe7a9d9202a366f7b59607fea61cd297bdd7c8d63697ebbf0db3bd3de888b662a59a15fadf62ad6b9
7
- data.tar.gz: 8195c49d3f5ab27d550170f76f3047a0a48bc479f5f718a7482ca0a2c95f3e219b08463262be6c09056e0c7c6ba7e0d92975f4eb307797b1094ad8d06c5380fc
6
+ metadata.gz: 64f5c9d3de39a64d021a9afc081e6c9b931c0d9a5f707c102c86b2744949500a544386f7c99508d376cf76618a5ac942c720684075461e77f4d57929f353e85a
7
+ data.tar.gz: 0b5a23f6f9e0d88e255d24a5d3d597383106da1c8ef7f9b644ac3c893f57c8c33bae0ac022d9ddd312ac820a55c8227fe8980e8db574ead3ce6a8b8f08a2c581
data/Gemfile CHANGED
@@ -6,6 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
6
 
7
7
  gemspec
8
8
 
9
- if File.exist? 'Gemfile.devel'
10
- eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
9
+ if File.exist? "Gemfile.devel"
10
+ eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
11
11
  end
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
- require 'isodoc/gem_tasks'
3
+ require "isodoc/gem_tasks"
4
4
 
5
5
  IsoDoc::GemTasks.install
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default => :spec
8
+ task default: :spec
@@ -17,13 +17,14 @@ module Asciidoctor
17
17
 
18
18
  def metadata_committee(node, xml)
19
19
  return unless node.attr("committee")
20
+
20
21
  xml.editorialgroup do |a|
21
22
  a.committee node.attr("committee"),
22
- **attr_code(type: node.attr("committee-type"))
23
+ **attr_code(type: node.attr("committee-type"))
23
24
  i = 2
24
- while node.attr("committee_#{i}") do
25
+ while node.attr("committee_#{i}")
25
26
  a.committee node.attr("committee_#{i}"),
26
- **attr_code(type: node.attr("committee-type_#{i}"))
27
+ **attr_code(type: node.attr("committee-type_#{i}"))
27
28
  i += 1
28
29
  end
29
30
  end
@@ -66,13 +67,13 @@ module Asciidoctor
66
67
  xml.session do |session|
67
68
  session.number node.attr("session") if node.attr("session")
68
69
  session.date node.attr("session-date") if node.attr("session-date")
69
- node&.attr("item-number")&.split(/,[ ]*/)&.each do |i|
70
+ node&.attr("item-number")&.split(/, */)&.each do |i|
70
71
  session.item_number i
71
72
  end
72
- node&.attr("item-name")&.split(/,[ ]*/)&.each do |i|
73
+ node&.attr("item-name")&.split(/, */)&.each do |i|
73
74
  session.item_name i
74
75
  end
75
- node&.attr("subitem-name")&.split(/,[ ]*/)&.each do |i|
76
+ node&.attr("subitem-name")&.split(/, */)&.each do |i|
76
77
  session.subitem_name i
77
78
  end
78
79
  node.attr("collaborator") and
@@ -84,13 +85,13 @@ module Asciidoctor
84
85
  end
85
86
 
86
87
  def metadata_language(node, xml)
87
- languages = node&.attr("language")&.split(/,[ ]*/) ||
88
+ languages = node&.attr("language")&.split(/, */) ||
88
89
  %w(ar ru en fr zh es)
89
90
  languages.each { |l| xml.language l }
90
91
  end
91
92
 
92
93
  def metadata_submission_language(node, xml)
93
- languages = node&.attr("submissionlanguage")&.split(/,[ ]*/) || []
94
+ languages = node&.attr("submissionlanguage")&.split(/, */) || []
94
95
  languages.each { |l| xml.submissionlanguage l }
95
96
  end
96
97
 
@@ -101,7 +102,7 @@ module Asciidoctor
101
102
  metadata_submission_language(node, xml)
102
103
  end
103
104
 
104
- def title_validate(root)
105
+ def title_validate(_root)
105
106
  nil
106
107
  end
107
108
 
@@ -114,12 +115,11 @@ module Asciidoctor
114
115
 
115
116
  def doctype(node)
116
117
  d = super
117
- unless %w{plenary recommendation addendum communication corrigendum
118
- reissue agenda budgetary sec-gen-notes expert-report resolution
119
- plenary-attachment}.include? d
120
- @log.add(
121
- "Document Attributes", nil,
122
- "#{d} is not a legal document type: reverting to 'recommendation'")
118
+ unless %w{plenary recommendation addendum communication corrigendum
119
+ reissue agenda budgetary sec-gen-notes expert-report
120
+ resolution plenary-attachment}.include? d
121
+ @log.add("Document Attributes", nil,
122
+ "#{d} is not a legal document type: reverting to 'recommendation'")
123
123
  d = "recommendation"
124
124
  end
125
125
  d
@@ -128,11 +128,11 @@ module Asciidoctor
128
128
  def outputs(node, ret)
129
129
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
130
130
  presentation_xml_converter(node).convert(@filename + ".xml")
131
- html_converter(node).convert(@filename + ".presentation.xml",
131
+ html_converter(node).convert(@filename + ".presentation.xml",
132
132
  nil, false, "#{@filename}.html")
133
- doc_converter(node).convert(@filename + ".presentation.xml",
133
+ doc_converter(node).convert(@filename + ".presentation.xml",
134
134
  nil, false, "#{@filename}.doc")
135
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
135
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
136
136
  nil, false, "#{@filename}.pdf")
137
137
  end
138
138
 
@@ -142,8 +142,8 @@ module Asciidoctor
142
142
  File.join(File.dirname(__FILE__), "un.rng"))
143
143
  end
144
144
 
145
- def style(n, t)
146
- return
145
+ def style(_node, _text)
146
+ nil
147
147
  end
148
148
 
149
149
  def html_extract_attributes(node)
@@ -168,6 +168,7 @@ module Asciidoctor
168
168
 
169
169
  def pdf_converter(node)
170
170
  return nil if node.attr("no-pdf")
171
+
171
172
  IsoDoc::UN::PdfConvert.new(doc_extract_attributes(node))
172
173
  end
173
174
 
@@ -196,25 +197,24 @@ module Asciidoctor
196
197
  xmldoc.xpath("//clause/p | //annex/p").each do |p|
197
198
  cl = Nokogiri::XML::Node.new("clause", xmldoc)
198
199
  cl["id"] = p["id"]
199
- cl["inline-header"]="true"
200
- p["id"] = "_" + UUIDTools::UUID.random_create
200
+ cl["inline-header"] = "true"
201
+ p["id"] = "_#{UUIDTools::UUID.random_create}"
201
202
  p.replace(cl)
202
203
  p.parent = cl
203
- while n = cl.next_element and !%w(p clause).include? n.name
204
+ while (n = cl.next_element) && !%w(p clause).include?(n.name)
204
205
  n.parent = cl
205
206
  end
206
207
  end
207
208
  end
208
209
 
209
210
  def admonition_attrs(node)
210
- attr_code(super.merge("unnumbered": node.option?("unnumbered"),
211
- "subsequence": node.attr("subsequence")))
211
+ attr_code(super.merge(unnumbered: node.option?("unnumbered"),
212
+ subsequence: node.attr("subsequence")))
212
213
  end
213
214
 
214
215
  def sectiontype_streamline(ret)
215
216
  case ret
216
- when "foreword" then "donotrecognise-foreword"
217
- when "introduction" then "donotrecognise-foreword"
217
+ when "foreword", "introduction" then "donotrecognise-foreword"
218
218
  else
219
219
  super
220
220
  end
@@ -32,6 +32,18 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="section-title">
36
+ <element name="title">
37
+ <zeroOrMore>
38
+ <ref name="TextElement"/>
39
+ </zeroOrMore>
40
+ </element>
41
+ <zeroOrMore>
42
+ <element name="variant-title">
43
+ <ref name="TypedTitleString"/>
44
+ </element>
45
+ </zeroOrMore>
46
+ </define>
35
47
  <define name="hyperlink">
36
48
  <element name="link">
37
49
  <attribute name="target">
@@ -158,15 +170,17 @@
158
170
  <data type="boolean"/>
159
171
  </attribute>
160
172
  </optional>
161
- <attribute name="type">
162
- <choice>
163
- <value>roman</value>
164
- <value>alphabet</value>
165
- <value>arabic</value>
166
- <value>roman_upper</value>
167
- <value>alphabet_upper</value>
168
- </choice>
169
- </attribute>
173
+ <optional>
174
+ <attribute name="type">
175
+ <choice>
176
+ <value>roman</value>
177
+ <value>alphabet</value>
178
+ <value>arabic</value>
179
+ <value>roman_upper</value>
180
+ <value>alphabet_upper</value>
181
+ </choice>
182
+ </attribute>
183
+ </optional>
170
184
  <oneOrMore>
171
185
  <ref name="li"/>
172
186
  </oneOrMore>
@@ -204,6 +218,18 @@
204
218
  </zeroOrMore>
205
219
  </element>
206
220
  </define>
221
+ <define name="dt">
222
+ <element name="dt">
223
+ <optional>
224
+ <attribute name="id">
225
+ <data type="ID"/>
226
+ </attribute>
227
+ </optional>
228
+ <zeroOrMore>
229
+ <ref name="TextElement"/>
230
+ </zeroOrMore>
231
+ </element>
232
+ </define>
207
233
  <define name="example">
208
234
  <element name="example">
209
235
  <attribute name="id">
@@ -899,7 +925,7 @@
899
925
  </include>
900
926
  <!-- end overrides -->
901
927
  <define name="docsubtype">
902
- <element name="docsubtype">
928
+ <element name="subdoctype">
903
929
  <ref name="DocumentSubtype"/>
904
930
  </element>
905
931
  </define>
@@ -954,6 +980,16 @@
954
980
  </define>
955
981
  <define name="concept">
956
982
  <element name="concept">
983
+ <optional>
984
+ <attribute name="ital">
985
+ <data type="boolean"/>
986
+ </attribute>
987
+ </optional>
988
+ <optional>
989
+ <attribute name="ref">
990
+ <data type="boolean"/>
991
+ </attribute>
992
+ </optional>
957
993
  <optional>
958
994
  <element name="refterm">
959
995
  <zeroOrMore>
@@ -989,8 +1025,14 @@
989
1025
  <ref name="imagemap"/>
990
1026
  <ref name="svgmap"/>
991
1027
  <ref name="inputform"/>
1028
+ <ref name="toc"/>
992
1029
  </choice>
993
1030
  </define>
1031
+ <define name="toc">
1032
+ <element name="toc">
1033
+ <ref name="ul"/>
1034
+ </element>
1035
+ </define>
994
1036
  <define name="inputform">
995
1037
  <element name="form">
996
1038
  <attribute name="id">
@@ -998,6 +1040,9 @@
998
1040
  </attribute>
999
1041
  <attribute name="name"/>
1000
1042
  <attribute name="action"/>
1043
+ <optional>
1044
+ <attribute name="class"/>
1045
+ </optional>
1001
1046
  <zeroOrMore>
1002
1047
  <choice>
1003
1048
  <ref name="TextElement"/>
@@ -1229,6 +1274,12 @@
1229
1274
  <optional>
1230
1275
  <attribute name="type"/>
1231
1276
  </optional>
1277
+ <optional>
1278
+ <attribute name="identifier"/>
1279
+ </optional>
1280
+ <optional>
1281
+ <attribute name="prefix"/>
1282
+ </optional>
1232
1283
  <text/>
1233
1284
  </define>
1234
1285
  <define name="ics">
@@ -1490,26 +1541,26 @@
1490
1541
  <optional>
1491
1542
  <ref name="section-title"/>
1492
1543
  </optional>
1493
- <group>
1544
+ <choice>
1494
1545
  <choice>
1495
1546
  <group>
1496
- <zeroOrMore>
1547
+ <oneOrMore>
1497
1548
  <ref name="BasicBlock"/>
1498
- </zeroOrMore>
1549
+ </oneOrMore>
1499
1550
  <zeroOrMore>
1500
1551
  <ref name="note"/>
1501
1552
  </zeroOrMore>
1502
1553
  </group>
1503
1554
  <ref name="amend"/>
1504
1555
  </choice>
1505
- <zeroOrMore>
1556
+ <oneOrMore>
1506
1557
  <choice>
1507
1558
  <ref name="clause-subsection"/>
1508
1559
  <ref name="terms"/>
1509
1560
  <ref name="definitions"/>
1510
1561
  </choice>
1511
- </zeroOrMore>
1512
- </group>
1562
+ </oneOrMore>
1563
+ </choice>
1513
1564
  </define>
1514
1565
  <define name="Annex-Section">
1515
1566
  <optional>
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -13,11 +13,10 @@ module Asciidoctor
13
13
  def stage_validate(xmldoc)
14
14
  stage = xmldoc&.at("//bibdata/status/stage")&.text
15
15
  %w(proposal working-draft committee-draft draft-standard final-draft
16
- published withdrawn).include? stage or
17
- @log.add("Document Attributes", nil,
18
- "#{stage} is not a recognised status")
16
+ published withdrawn).include? stage or
17
+ @log.add("Document Attributes", nil,
18
+ "#{stage} is not a recognised status")
19
19
  end
20
20
  end
21
21
  end
22
22
  end
23
-
@@ -8,4 +8,3 @@ module IsoDoc
8
8
  end
9
9
  end
10
10
  end
11
-
@@ -11,7 +11,7 @@ module IsoDoc
11
11
  @meta.set(:toc, @toc)
12
12
  end
13
13
 
14
- def xref_init(lang, script, klass, labels, options)
14
+ def xref_init(lang, script, _klass, labels, options)
15
15
  html = HtmlConvert.new(language: lang, script: script)
16
16
  @xrefs = Xref.new(lang, script, html, labels, options)
17
17
  end
@@ -26,4 +26,3 @@ module IsoDoc
26
26
  end
27
27
  end
28
28
  end
29
-
@@ -160,7 +160,7 @@
160
160
  <fo:block>
161
161
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
162
162
  </fo:block>
163
- <fo:block><xsl:value-of select="$title"/></fo:block>
163
+ <fo:block role="H1"><xsl:value-of select="$title"/></fo:block>
164
164
  </fo:block>
165
165
  </fo:block-container>
166
166
 
@@ -485,7 +485,10 @@
485
485
  </xsl:template>
486
486
 
487
487
  <xsl:template match="un:title" mode="inline-header">
488
- <fo:inline>
488
+ <xsl:variable name="level">
489
+ <xsl:call-template name="getLevel"/>
490
+ </xsl:variable>
491
+ <fo:inline role="H{$level}">
489
492
  <xsl:apply-templates/>
490
493
  </fo:inline>
491
494
  </xsl:template>
@@ -715,8 +718,9 @@
715
718
  <xsl:otherwise>11pt</xsl:otherwise>
716
719
  </xsl:choose>
717
720
  </xsl:variable>
718
- <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always">
721
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}">
719
722
  <xsl:apply-templates/>
723
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
720
724
  </fo:block>
721
725
  </xsl:template>
722
726
 
@@ -734,15 +738,17 @@
734
738
  </xsl:variable>
735
739
  <xsl:choose>
736
740
  <xsl:when test="$level = 1">
737
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always">
741
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always" role="H{$level}">
738
742
  <fo:block margin-bottom="12pt">
739
743
  <xsl:apply-templates/>
744
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
740
745
  </fo:block>
741
746
  </fo:block>
742
747
  </xsl:when>
743
748
  <xsl:otherwise>
744
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always">
749
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always" role="H{$level}">
745
750
  <xsl:apply-templates/>
751
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
746
752
  </fo:block>
747
753
  </xsl:otherwise>
748
754
  </xsl:choose>
@@ -769,7 +775,7 @@
769
775
  <xsl:choose>
770
776
  <xsl:when test="ancestor::un:sections and $level = 1">
771
777
  <fo:block-container margin-left="-16mm">
772
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always">
778
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always" role="H{$level}">
773
779
  <fo:table table-layout="fixed" width="100%">
774
780
  <fo:table-column column-width="16mm"/>
775
781
  <fo:table-column column-width="130mm"/>
@@ -788,6 +794,7 @@
788
794
  <fo:table-cell>
789
795
  <fo:block>
790
796
  <xsl:call-template name="extractTitle"/>
797
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
791
798
  </fo:block>
792
799
  </fo:table-cell>
793
800
  </fo:table-row>
@@ -797,7 +804,7 @@
797
804
  </fo:block-container>
798
805
  </xsl:when>
799
806
  <xsl:when test="ancestor::un:sections">
800
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always">
807
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always" role="H{$level}">
801
808
  <xsl:if test="$level = 2">
802
809
  <xsl:attribute name="margin-left">1mm</xsl:attribute>
803
810
  <xsl:attribute name="space-before">12pt</xsl:attribute>
@@ -814,8 +821,9 @@
814
821
  </fo:block>
815
822
  </xsl:when>
816
823
  <xsl:otherwise>
817
- <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always">
824
+ <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always" role="H{$level}">
818
825
  <xsl:apply-templates/>
826
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
819
827
  </fo:block>
820
828
  </xsl:otherwise>
821
829
  </xsl:choose>
@@ -1046,26 +1054,26 @@
1046
1054
  <!-- ============================ -->
1047
1055
 
1048
1056
  <xsl:template name="insertHeaderFooter">
1049
- <fo:static-content flow-name="header-odd">
1057
+ <fo:static-content flow-name="header-odd" role="artifact">
1050
1058
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1051
1059
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1052
1060
  <xsl:value-of select="$id"/>
1053
1061
  </fo:block>
1054
1062
  </fo:block-container>
1055
1063
  </fo:static-content>
1056
- <fo:static-content flow-name="footer-odd">
1064
+ <fo:static-content flow-name="footer-odd" role="artifact">
1057
1065
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1058
1066
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1059
1067
  </fo:block-container>
1060
1068
  </fo:static-content>
1061
- <fo:static-content flow-name="header-even">
1069
+ <fo:static-content flow-name="header-even" role="artifact">
1062
1070
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1063
1071
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1064
1072
  <xsl:value-of select="$id"/>
1065
1073
  </fo:block>
1066
1074
  </fo:block-container>
1067
1075
  </fo:static-content>
1068
- <fo:static-content flow-name="footer-even">
1076
+ <fo:static-content flow-name="footer-even" role="artifact">
1069
1077
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1070
1078
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1071
1079
  </fo:block-container>
@@ -1073,103 +1081,6 @@
1073
1081
  </xsl:template>
1074
1082
 
1075
1083
 
1076
- <xsl:template name="number-to-words">
1077
- <xsl:param name="number"/>
1078
- <xsl:param name="first"/>
1079
- <xsl:if test="$number != ''">
1080
- <xsl:variable name="words">
1081
- <words>
1082
- <word cardinal="1">one-</word>
1083
- <word ordinal="1">first </word>
1084
- <word cardinal="2">two-</word>
1085
- <word ordinal="2">second </word>
1086
- <word cardinal="3">three-</word>
1087
- <word ordinal="3">third </word>
1088
- <word cardinal="4">four-</word>
1089
- <word ordinal="4">fourth </word>
1090
- <word cardinal="5">five-</word>
1091
- <word ordinal="5">fifth </word>
1092
- <word cardinal="6">six-</word>
1093
- <word ordinal="6">sixth </word>
1094
- <word cardinal="7">seven-</word>
1095
- <word ordinal="7">seventh </word>
1096
- <word cardinal="8">eight-</word>
1097
- <word ordinal="8">eighth </word>
1098
- <word cardinal="9">nine-</word>
1099
- <word ordinal="9">ninth </word>
1100
- <word ordinal="10">tenth </word>
1101
- <word ordinal="11">eleventh </word>
1102
- <word ordinal="12">twelfth </word>
1103
- <word ordinal="13">thirteenth </word>
1104
- <word ordinal="14">fourteenth </word>
1105
- <word ordinal="15">fifteenth </word>
1106
- <word ordinal="16">sixteenth </word>
1107
- <word ordinal="17">seventeenth </word>
1108
- <word ordinal="18">eighteenth </word>
1109
- <word ordinal="19">nineteenth </word>
1110
- <word cardinal="20">twenty-</word>
1111
- <word ordinal="20">twentieth </word>
1112
- <word cardinal="30">thirty-</word>
1113
- <word ordinal="30">thirtieth </word>
1114
- <word cardinal="40">forty-</word>
1115
- <word ordinal="40">fortieth </word>
1116
- <word cardinal="50">fifty-</word>
1117
- <word ordinal="50">fiftieth </word>
1118
- <word cardinal="60">sixty-</word>
1119
- <word ordinal="60">sixtieth </word>
1120
- <word cardinal="70">seventy-</word>
1121
- <word ordinal="70">seventieth </word>
1122
- <word cardinal="80">eighty-</word>
1123
- <word ordinal="80">eightieth </word>
1124
- <word cardinal="90">ninety-</word>
1125
- <word ordinal="90">ninetieth </word>
1126
- <word cardinal="100">hundred-</word>
1127
- <word ordinal="100">hundredth </word>
1128
- </words>
1129
- </xsl:variable>
1130
-
1131
- <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
1132
-
1133
- <xsl:variable name="value">
1134
- <xsl:choose>
1135
- <xsl:when test="$ordinal != ''">
1136
- <xsl:value-of select="$ordinal"/>
1137
- </xsl:when>
1138
- <xsl:otherwise>
1139
- <xsl:choose>
1140
- <xsl:when test="$number &lt; 100">
1141
- <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
1142
- <xsl:variable name="digit" select="substring($number,2)"/>
1143
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
1144
- <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
1145
- </xsl:when>
1146
- <xsl:otherwise>
1147
- <!-- more 100 -->
1148
- <xsl:variable name="hundred" select="substring($number,1,1)"/>
1149
- <xsl:variable name="digits" select="number(substring($number,2))"/>
1150
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
1151
- <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
1152
- <xsl:call-template name="number-to-words">
1153
- <xsl:with-param name="number" select="$digits"/>
1154
- </xsl:call-template>
1155
- </xsl:otherwise>
1156
- </xsl:choose>
1157
- </xsl:otherwise>
1158
- </xsl:choose>
1159
- </xsl:variable>
1160
- <xsl:choose>
1161
- <xsl:when test="$first = 'true'">
1162
- <xsl:call-template name="capitalize">
1163
- <xsl:with-param name="str" select="$value"/>
1164
- </xsl:call-template>
1165
- </xsl:when>
1166
- <xsl:otherwise>
1167
- <xsl:value-of select="$value"/>
1168
- </xsl:otherwise>
1169
- </xsl:choose>
1170
- </xsl:if>
1171
- </xsl:template>
1172
-
1173
1084
  <!-- convert YYYY-MM-DD to (Month YYYY) -->
1174
1085
  <xsl:template name="formatDate">
1175
1086
  <xsl:param name="date"/>
@@ -1368,12 +1279,13 @@
1368
1279
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1369
1280
  <xsl:attribute name="white-space">pre</xsl:attribute>
1370
1281
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1282
+ <xsl:attribute name="role">Code</xsl:attribute>
1371
1283
 
1372
1284
 
1373
1285
 
1374
1286
 
1375
1287
 
1376
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1288
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1377
1289
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1378
1290
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1379
1291
 
@@ -1393,8 +1305,13 @@
1393
1305
 
1394
1306
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1395
1307
 
1396
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1397
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1308
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1309
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1310
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1311
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1312
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1313
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1314
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1398
1315
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1399
1316
 
1400
1317
 
@@ -1462,6 +1379,7 @@
1462
1379
 
1463
1380
 
1464
1381
 
1382
+
1465
1383
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1466
1384
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1467
1385
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1476,7 +1394,9 @@
1476
1394
 
1477
1395
 
1478
1396
 
1479
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1397
+ </xsl:attribute-set><xsl:variable name="table-border_">
1398
+
1399
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1480
1400
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1481
1401
 
1482
1402
 
@@ -1591,7 +1511,8 @@
1591
1511
 
1592
1512
 
1593
1513
 
1594
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1514
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1515
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1595
1516
 
1596
1517
 
1597
1518
 
@@ -1776,11 +1697,15 @@
1776
1697
  <fo:block>&#xA0;</fo:block>
1777
1698
  </xsl:if> -->
1778
1699
 
1700
+
1701
+ <!-- Display table's name before table as standalone block -->
1779
1702
  <!-- $namespace = 'iso' or -->
1780
1703
 
1781
1704
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1782
1705
 
1783
-
1706
+
1707
+
1708
+
1784
1709
 
1785
1710
  <xsl:call-template name="fn_name_display"/>
1786
1711
 
@@ -1854,6 +1779,12 @@
1854
1779
 
1855
1780
 
1856
1781
 
1782
+
1783
+
1784
+
1785
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1786
+
1787
+
1857
1788
  <xsl:variable name="table_width">
1858
1789
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1859
1790
 
@@ -1877,6 +1808,7 @@
1877
1808
 
1878
1809
 
1879
1810
 
1811
+
1880
1812
 
1881
1813
 
1882
1814
 
@@ -1902,6 +1834,8 @@
1902
1834
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1903
1835
  </xsl:if>
1904
1836
 
1837
+
1838
+
1905
1839
  <xsl:choose>
1906
1840
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1907
1841
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2186,9 +2120,9 @@
2186
2120
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2187
2121
  <xsl:with-param name="continued">true</xsl:with-param>
2188
2122
  </xsl:apply-templates>
2189
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2190
- <xsl:call-template name="fn_name_display"/>
2191
- </xsl:for-each>
2123
+
2124
+
2125
+
2192
2126
 
2193
2127
  </fo:table-cell>
2194
2128
  </fo:table-row>
@@ -2270,7 +2204,11 @@
2270
2204
 
2271
2205
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2272
2206
 
2273
- <xsl:if test="$isNoteOrFnExist = 'true'">
2207
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2208
+
2209
+ </xsl:variable>
2210
+
2211
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2274
2212
 
2275
2213
  <xsl:variable name="cols-count">
2276
2214
  <xsl:choose>
@@ -2299,6 +2237,8 @@
2299
2237
  </xsl:choose>
2300
2238
  </xsl:for-each>
2301
2239
 
2240
+
2241
+
2302
2242
  <xsl:choose>
2303
2243
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2304
2244
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2325,6 +2265,7 @@
2325
2265
 
2326
2266
 
2327
2267
 
2268
+
2328
2269
  <!-- fn will be processed inside 'note' processing -->
2329
2270
 
2330
2271
 
@@ -2333,6 +2274,11 @@
2333
2274
 
2334
2275
 
2335
2276
 
2277
+
2278
+
2279
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2280
+
2281
+
2336
2282
  <!-- except gb -->
2337
2283
 
2338
2284
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2358,6 +2304,10 @@
2358
2304
  <!-- fn processing -->
2359
2305
  <xsl:call-template name="fn_display"/>
2360
2306
 
2307
+
2308
+ <!-- for PAS display Notes after footnotes -->
2309
+
2310
+
2361
2311
  </fo:table-cell>
2362
2312
  </fo:table-row>
2363
2313
  </fo:table-body>
@@ -2399,6 +2349,19 @@
2399
2349
 
2400
2350
  </fo:table-body>
2401
2351
 
2352
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2353
+ <xsl:choose>
2354
+ <xsl:when test="substring-after(., '—') != ''">
2355
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2356
+ </xsl:when>
2357
+ <xsl:otherwise>
2358
+ <xsl:value-of select="."/>
2359
+ </xsl:otherwise>
2360
+ </xsl:choose>
2361
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2362
+ <xsl:apply-templates mode="presentation_name"/>
2363
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2364
+ <xsl:apply-templates select="."/>
2402
2365
  </xsl:template><xsl:template match="*[local-name()='tr']">
2403
2366
  <xsl:variable name="parent-name" select="local-name(..)"/>
2404
2367
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2411,10 +2374,13 @@
2411
2374
 
2412
2375
 
2413
2376
 
2377
+
2378
+
2414
2379
  </xsl:if>
2415
2380
  <xsl:if test="$parent-name = 'tfoot'">
2416
2381
 
2417
2382
 
2383
+
2418
2384
  </xsl:if>
2419
2385
 
2420
2386
 
@@ -2428,6 +2394,8 @@
2428
2394
 
2429
2395
 
2430
2396
 
2397
+
2398
+
2431
2399
  <!-- <xsl:if test="$namespace = 'bipm'">
2432
2400
  <xsl:attribute name="height">8mm</xsl:attribute>
2433
2401
  </xsl:if> -->
@@ -2565,8 +2533,13 @@
2565
2533
 
2566
2534
 
2567
2535
 
2536
+
2537
+ <!-- Table's note name (NOTE, for example) -->
2538
+
2568
2539
  <fo:inline padding-right="2mm">
2569
2540
 
2541
+
2542
+
2570
2543
 
2571
2544
 
2572
2545
  <xsl:if test="@type = 'source' or @type = 'abbreviation'">
@@ -2584,6 +2557,8 @@
2584
2557
 
2585
2558
  </fo:inline>
2586
2559
 
2560
+
2561
+
2587
2562
  <xsl:apply-templates mode="process"/>
2588
2563
  </fo:block>
2589
2564
 
@@ -2591,18 +2566,18 @@
2591
2566
  <xsl:apply-templates/>
2592
2567
  </xsl:template><xsl:template name="fn_display">
2593
2568
  <xsl:variable name="references">
2569
+
2594
2570
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2595
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2596
-
2597
-
2598
- <xsl:apply-templates/>
2599
- </fn>
2571
+ <xsl:call-template name="create_fn"/>
2600
2572
  </xsl:for-each>
2601
2573
  </xsl:variable>
2574
+
2602
2575
  <xsl:for-each select="xalan:nodeset($references)//fn">
2603
2576
  <xsl:variable name="reference" select="@reference"/>
2604
2577
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2605
2578
  <fo:block margin-bottom="12pt">
2579
+
2580
+
2606
2581
 
2607
2582
 
2608
2583
 
@@ -2622,6 +2597,7 @@
2622
2597
  <xsl:value-of select="@reference"/>
2623
2598
 
2624
2599
 
2600
+
2625
2601
  </fo:inline>
2626
2602
  <fo:inline>
2627
2603
 
@@ -2631,6 +2607,12 @@
2631
2607
  </fo:block>
2632
2608
  </xsl:if>
2633
2609
  </xsl:for-each>
2610
+ </xsl:template><xsl:template name="create_fn">
2611
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2612
+
2613
+
2614
+ <xsl:apply-templates/>
2615
+ </fn>
2634
2616
  </xsl:template><xsl:template name="fn_name_display">
2635
2617
  <!-- <xsl:variable name="references">
2636
2618
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2771,6 +2753,7 @@
2771
2753
 
2772
2754
  <xsl:value-of select="@reference"/>
2773
2755
 
2756
+
2774
2757
  </fo:basic-link>
2775
2758
  </fo:inline>
2776
2759
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3609,16 +3592,68 @@
3609
3592
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3610
3593
  </xsl:call-template>
3611
3594
 
3595
+
3596
+
3612
3597
  <xsl:variable name="mathml">
3613
3598
  <xsl:apply-templates select="." mode="mathml"/>
3614
3599
  </xsl:variable>
3615
3600
  <fo:instream-foreign-object fox:alt-text="Math">
3616
3601
 
3617
3602
 
3603
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3604
+ <xsl:variable name="comment_text_">
3605
+ <xsl:choose>
3606
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3607
+ <xsl:value-of select="$comment_text_following"/>
3608
+ </xsl:when>
3609
+ <xsl:otherwise>
3610
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3611
+ </xsl:otherwise>
3612
+ </xsl:choose>
3613
+ </xsl:variable>
3614
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3615
+
3616
+ <xsl:if test="normalize-space($comment_text) != ''">
3617
+ <!-- put Mathin Alternate Text -->
3618
+ <xsl:attribute name="fox:alt-text">
3619
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3620
+ </xsl:attribute>
3621
+ </xsl:if>
3622
+
3623
+ <xsl:variable name="mathml_content">
3624
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3625
+ </xsl:variable>
3626
+ <!-- put MathML in Actual Text -->
3627
+ <xsl:attribute name="fox:actual-text">
3628
+ <xsl:value-of select="$mathml_content"/>
3629
+ </xsl:attribute>
3630
+
3631
+
3618
3632
  <!-- <xsl:copy-of select="."/> -->
3619
3633
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3620
3634
  </fo:instream-foreign-object>
3621
3635
  </fo:inline>
3636
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3637
+ <!-- <xsl:text>a+b</xsl:text> -->
3638
+ <xsl:text>&lt;</xsl:text>
3639
+ <xsl:value-of select="local-name()"/>
3640
+ <xsl:if test="local-name() = 'math'">
3641
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3642
+ </xsl:if>
3643
+ <xsl:for-each select="@*">
3644
+ <xsl:text> </xsl:text>
3645
+ <xsl:value-of select="local-name()"/>
3646
+ <xsl:text>="</xsl:text>
3647
+ <xsl:value-of select="."/>
3648
+ <xsl:text>"</xsl:text>
3649
+ </xsl:for-each>
3650
+ <xsl:text>&gt;</xsl:text>
3651
+ <xsl:apply-templates mode="mathml_actual_text"/>
3652
+ <xsl:text>&lt;/</xsl:text>
3653
+ <xsl:value-of select="local-name()"/>
3654
+ <xsl:text>&gt;</xsl:text>
3655
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3656
+ <xsl:value-of select="normalize-space()"/>
3622
3657
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3623
3658
  <xsl:copy>
3624
3659
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3628,19 +3663,6 @@
3628
3663
  <!-- replace start and end spaces to non-break space -->
3629
3664
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3630
3665
  </xsl:copy>
3631
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3632
- <xsl:copy>
3633
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3634
- </xsl:copy>
3635
- <xsl:choose>
3636
- <!-- if in msub, then don't add space -->
3637
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3638
- <!-- if next char in digit, don't add space -->
3639
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3640
- <xsl:otherwise>
3641
- <mathml:mspace width="0.5ex"/>
3642
- </xsl:otherwise>
3643
- </xsl:choose>
3644
3666
  </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">
3645
3667
  <xsl:variable name="target">
3646
3668
  <xsl:choose>
@@ -3693,7 +3715,10 @@
3693
3715
  </fo:block>
3694
3716
  <xsl:apply-templates/>
3695
3717
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3696
- <fo:inline><xsl:apply-templates/></fo:inline>
3718
+ <xsl:variable name="level">
3719
+ <xsl:call-template name="getLevel"/>
3720
+ </xsl:variable>
3721
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3697
3722
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3698
3723
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3699
3724
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3728,9 +3753,10 @@
3728
3753
 
3729
3754
  </xsl:variable>
3730
3755
 
3756
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3731
3757
  <xsl:choose>
3732
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3733
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3758
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3759
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3734
3760
  </xsl:choose>
3735
3761
  <xsl:apply-templates/>
3736
3762
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3774,6 +3800,7 @@
3774
3800
 
3775
3801
 
3776
3802
 
3803
+
3777
3804
  <fo:block-container margin-left="0mm">
3778
3805
 
3779
3806
 
@@ -3886,7 +3913,10 @@
3886
3913
  </fo:block>
3887
3914
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3888
3915
  <xsl:if test="normalize-space() != ''">
3889
- <fo:inline>
3916
+ <xsl:variable name="level">
3917
+ <xsl:call-template name="getLevelTermName"/>
3918
+ </xsl:variable>
3919
+ <fo:inline role="H{$level}">
3890
3920
  <xsl:apply-templates/>
3891
3921
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3892
3922
  <xsl:text>.</xsl:text>
@@ -3959,7 +3989,24 @@
3959
3989
  </fo:instream-foreign-object>
3960
3990
  </xsl:when>
3961
3991
  <xsl:otherwise>
3962
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3992
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3993
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3994
+
3995
+ <xsl:variable name="img_src">
3996
+ <xsl:choose>
3997
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3998
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3999
+ </xsl:choose>
4000
+ </xsl:variable>
4001
+
4002
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4003
+ <xsl:if test="number($scale) &lt; 100">
4004
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4005
+ </xsl:if>
4006
+
4007
+ </xsl:if>
4008
+
4009
+ </fo:external-graphic>
3963
4010
  </xsl:otherwise>
3964
4011
  </xsl:choose>
3965
4012
 
@@ -4130,11 +4177,13 @@
4130
4177
  <xsl:attribute name="width">100%</xsl:attribute>
4131
4178
  <xsl:attribute name="content-height">100%</xsl:attribute>
4132
4179
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4180
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4181
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4133
4182
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4134
4183
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4135
4184
  <!-- effective height / width = 1.48, 1.4 - with title -->
4136
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4137
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4185
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4186
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4138
4187
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4139
4188
  </xsl:if>
4140
4189
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4151,6 +4200,23 @@
4151
4200
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4152
4201
  <xsl:value-of select="."/>
4153
4202
  </xsl:attribute>
4203
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4204
+ <xsl:copy>
4205
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4206
+ <xsl:variable name="viewbox">
4207
+ <xsl:call-template name="split">
4208
+ <xsl:with-param name="pText" select="@viewBox"/>
4209
+ <xsl:with-param name="sep" select="' '"/>
4210
+ </xsl:call-template>
4211
+ </xsl:variable>
4212
+ <xsl:attribute name="width">
4213
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4214
+ </xsl:attribute>
4215
+ <xsl:attribute name="height">
4216
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4217
+ </xsl:attribute>
4218
+ <xsl:apply-templates mode="svg_update"/>
4219
+ </xsl:copy>
4154
4220
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4155
4221
  <xsl:variable name="svg_content" select="document(@src)"/>
4156
4222
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4481,6 +4547,7 @@
4481
4547
  </xsl:when>
4482
4548
  <xsl:otherwise>
4483
4549
  <xsl:apply-templates/>
4550
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4484
4551
  </xsl:otherwise>
4485
4552
  </xsl:choose>
4486
4553
  </fo:block>
@@ -4621,14 +4688,6 @@
4621
4688
  <fo:block>
4622
4689
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4623
4690
  </fo:block>
4624
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4625
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4626
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4627
- </fo:block>
4628
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4629
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4630
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4631
- </fo:block>
4632
4691
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4633
4692
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4634
4693
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4645,6 +4704,38 @@
4645
4704
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4646
4705
  <xsl:apply-templates/>
4647
4706
  </fo:block>
4707
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4708
+ <fo:block xsl:use-attribute-sets="subject-style">
4709
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4710
+ </fo:block>
4711
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4712
+ <fo:block xsl:use-attribute-sets="subject-style">
4713
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4714
+ </fo:block>
4715
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4716
+ <fo:block xsl:use-attribute-sets="inherit-style">
4717
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4718
+ </fo:block>
4719
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4720
+ <fo:block xsl:use-attribute-sets="description-style">
4721
+ <xsl:apply-templates/>
4722
+ </fo:block>
4723
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4724
+ <fo:block xsl:use-attribute-sets="specification-style">
4725
+ <xsl:apply-templates/>
4726
+ </fo:block>
4727
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4728
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4729
+ <xsl:apply-templates/>
4730
+ </fo:block>
4731
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4732
+ <fo:block xsl:use-attribute-sets="verification-style">
4733
+ <xsl:apply-templates/>
4734
+ </fo:block>
4735
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4736
+ <fo:block xsl:use-attribute-sets="import-style">
4737
+ <xsl:apply-templates/>
4738
+ </fo:block>
4648
4739
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4649
4740
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4650
4741
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4796,7 +4887,19 @@
4796
4887
  </fo:inline>
4797
4888
  </xsl:if>
4798
4889
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4799
- <fo:inline><xsl:apply-templates/></fo:inline>
4890
+ <xsl:variable name="element">inline
4891
+
4892
+ </xsl:variable>
4893
+ <xsl:choose>
4894
+ <xsl:when test="contains($element, 'block')">
4895
+ <fo:block xsl:use-attribute-sets="example-p-style">
4896
+ <xsl:apply-templates/>
4897
+ </fo:block>
4898
+ </xsl:when>
4899
+ <xsl:otherwise>
4900
+ <fo:inline><xsl:apply-templates/></fo:inline>
4901
+ </xsl:otherwise>
4902
+ </xsl:choose>
4800
4903
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4801
4904
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4802
4905
 
@@ -4979,9 +5082,10 @@
4979
5082
 
4980
5083
 
4981
5084
  </xsl:if>
4982
-
5085
+
5086
+
5087
+
4983
5088
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4984
-
4985
5089
  <xsl:if test="normalize-space(@citeas) = ''">
4986
5090
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4987
5091
  </xsl:if>
@@ -4989,6 +5093,7 @@
4989
5093
 
4990
5094
 
4991
5095
 
5096
+
4992
5097
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4993
5098
 
4994
5099
  </xsl:if>
@@ -5374,7 +5479,6 @@
5374
5479
  </xsl:template><xsl:template name="processBibitem">
5375
5480
 
5376
5481
 
5377
- <!-- end BIPM bibitem processing-->
5378
5482
 
5379
5483
 
5380
5484
 
@@ -5504,6 +5608,9 @@
5504
5608
  <fo:block-container border="1pt solid black" width="50%">
5505
5609
  <fo:block> </fo:block>
5506
5610
  </fo:block-container>
5611
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5612
+ <fo:inline padding-right="5mm"> </fo:inline>
5613
+ <fo:inline><xsl:apply-templates/></fo:inline>
5507
5614
  </xsl:template><xsl:template name="convertDate">
5508
5615
  <xsl:param name="date"/>
5509
5616
  <xsl:param name="format" select="'short'"/>
@@ -5742,6 +5849,26 @@
5742
5849
  <xsl:value-of select="$level"/>
5743
5850
  </xsl:otherwise>
5744
5851
  </xsl:choose>
5852
+ </xsl:template><xsl:template name="getLevelTermName">
5853
+ <xsl:choose>
5854
+ <xsl:when test="normalize-space(../@depth) != ''">
5855
+ <xsl:value-of select="../@depth"/>
5856
+ </xsl:when>
5857
+ <xsl:otherwise>
5858
+ <xsl:variable name="title_level_">
5859
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5860
+ <xsl:call-template name="getLevel"/>
5861
+ </xsl:for-each>
5862
+ </xsl:variable>
5863
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5864
+ <xsl:choose>
5865
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5866
+ <xsl:otherwise>
5867
+ <xsl:call-template name="getLevel"/>
5868
+ </xsl:otherwise>
5869
+ </xsl:choose>
5870
+ </xsl:otherwise>
5871
+ </xsl:choose>
5745
5872
  </xsl:template><xsl:template name="split">
5746
5873
  <xsl:param name="pText" select="."/>
5747
5874
  <xsl:param name="sep" select="','"/>
@@ -5839,20 +5966,40 @@
5839
5966
  </xsl:call-template>
5840
5967
  </xsl:if>
5841
5968
  </xsl:template><xsl:template name="getLocalizedString">
5842
- <xsl:param name="key"/>
5969
+ <xsl:param name="key"/>
5970
+ <xsl:param name="formatted">false</xsl:param>
5843
5971
 
5844
5972
  <xsl:variable name="curr_lang">
5845
5973
  <xsl:call-template name="getLang"/>
5846
5974
  </xsl:variable>
5847
5975
 
5848
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5976
+ <xsl:variable name="data_value">
5977
+ <xsl:choose>
5978
+ <xsl:when test="$formatted = 'true'">
5979
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5980
+ </xsl:when>
5981
+ <xsl:otherwise>
5982
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5983
+ </xsl:otherwise>
5984
+ </xsl:choose>
5985
+ </xsl:variable>
5849
5986
 
5850
5987
  <xsl:choose>
5851
- <xsl:when test="$data_value != ''">
5852
- <xsl:value-of select="$data_value"/>
5988
+ <xsl:when test="normalize-space($data_value) != ''">
5989
+ <xsl:choose>
5990
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5991
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5992
+ </xsl:choose>
5853
5993
  </xsl:when>
5854
5994
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5855
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5995
+ <xsl:choose>
5996
+ <xsl:when test="$formatted = 'true'">
5997
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5998
+ </xsl:when>
5999
+ <xsl:otherwise>
6000
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6001
+ </xsl:otherwise>
6002
+ </xsl:choose>
5856
6003
  </xsl:when>
5857
6004
  <xsl:otherwise>
5858
6005
  <xsl:variable name="key_">
@@ -5863,7 +6010,7 @@
5863
6010
  <xsl:value-of select="$key_"/>
5864
6011
  </xsl:otherwise>
5865
6012
  </xsl:choose>
5866
-
6013
+
5867
6014
  </xsl:template><xsl:template name="setTrackChangesStyles">
5868
6015
  <xsl:param name="isAdded"/>
5869
6016
  <xsl:param name="isDeleted"/>
@@ -5914,4 +6061,100 @@
5914
6061
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5915
6062
  </xsl:choose>
5916
6063
  </xsl:attribute>
6064
+ </xsl:template><xsl:template name="number-to-words">
6065
+ <xsl:param name="number"/>
6066
+ <xsl:param name="first"/>
6067
+ <xsl:if test="$number != ''">
6068
+ <xsl:variable name="words">
6069
+ <words>
6070
+ <word cardinal="1">One-</word>
6071
+ <word ordinal="1">First </word>
6072
+ <word cardinal="2">Two-</word>
6073
+ <word ordinal="2">Second </word>
6074
+ <word cardinal="3">Three-</word>
6075
+ <word ordinal="3">Third </word>
6076
+ <word cardinal="4">Four-</word>
6077
+ <word ordinal="4">Fourth </word>
6078
+ <word cardinal="5">Five-</word>
6079
+ <word ordinal="5">Fifth </word>
6080
+ <word cardinal="6">Six-</word>
6081
+ <word ordinal="6">Sixth </word>
6082
+ <word cardinal="7">Seven-</word>
6083
+ <word ordinal="7">Seventh </word>
6084
+ <word cardinal="8">Eight-</word>
6085
+ <word ordinal="8">Eighth </word>
6086
+ <word cardinal="9">Nine-</word>
6087
+ <word ordinal="9">Ninth </word>
6088
+ <word ordinal="10">Tenth </word>
6089
+ <word ordinal="11">Eleventh </word>
6090
+ <word ordinal="12">Twelfth </word>
6091
+ <word ordinal="13">Thirteenth </word>
6092
+ <word ordinal="14">Fourteenth </word>
6093
+ <word ordinal="15">Fifteenth </word>
6094
+ <word ordinal="16">Sixteenth </word>
6095
+ <word ordinal="17">Seventeenth </word>
6096
+ <word ordinal="18">Eighteenth </word>
6097
+ <word ordinal="19">Nineteenth </word>
6098
+ <word cardinal="20">Twenty-</word>
6099
+ <word ordinal="20">Twentieth </word>
6100
+ <word cardinal="30">Thirty-</word>
6101
+ <word ordinal="30">Thirtieth </word>
6102
+ <word cardinal="40">Forty-</word>
6103
+ <word ordinal="40">Fortieth </word>
6104
+ <word cardinal="50">Fifty-</word>
6105
+ <word ordinal="50">Fiftieth </word>
6106
+ <word cardinal="60">Sixty-</word>
6107
+ <word ordinal="60">Sixtieth </word>
6108
+ <word cardinal="70">Seventy-</word>
6109
+ <word ordinal="70">Seventieth </word>
6110
+ <word cardinal="80">Eighty-</word>
6111
+ <word ordinal="80">Eightieth </word>
6112
+ <word cardinal="90">Ninety-</word>
6113
+ <word ordinal="90">Ninetieth </word>
6114
+ <word cardinal="100">Hundred-</word>
6115
+ <word ordinal="100">Hundredth </word>
6116
+ </words>
6117
+ </xsl:variable>
6118
+
6119
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6120
+
6121
+ <xsl:variable name="value">
6122
+ <xsl:choose>
6123
+ <xsl:when test="$ordinal != ''">
6124
+ <xsl:value-of select="$ordinal"/>
6125
+ </xsl:when>
6126
+ <xsl:otherwise>
6127
+ <xsl:choose>
6128
+ <xsl:when test="$number &lt; 100">
6129
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6130
+ <xsl:variable name="digit" select="substring($number,2)"/>
6131
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6132
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6133
+ </xsl:when>
6134
+ <xsl:otherwise>
6135
+ <!-- more 100 -->
6136
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6137
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6138
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6139
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6140
+ <xsl:call-template name="number-to-words">
6141
+ <xsl:with-param name="number" select="$digits"/>
6142
+ </xsl:call-template>
6143
+ </xsl:otherwise>
6144
+ </xsl:choose>
6145
+ </xsl:otherwise>
6146
+ </xsl:choose>
6147
+ </xsl:variable>
6148
+ <xsl:choose>
6149
+ <xsl:when test="$first = 'true'">
6150
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6151
+ <xsl:call-template name="capitalize">
6152
+ <xsl:with-param name="str" select="$value_lc"/>
6153
+ </xsl:call-template>
6154
+ </xsl:when>
6155
+ <xsl:otherwise>
6156
+ <xsl:value-of select="$value"/>
6157
+ </xsl:otherwise>
6158
+ </xsl:choose>
6159
+ </xsl:if>
5917
6160
  </xsl:template></xsl:stylesheet>