metanorma-csa 1.8.6 → 1.8.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: 6a2e03feb739aabfc961bd51cc96d8a53e8674f3eb38bbac70454589af496b1d
4
- data.tar.gz: 2c45447a23dabcdc9d576f639b9cdd33917ff50735a9ece2fe1e05fb3fb21d7d
3
+ metadata.gz: 535e26923fac74da1e84685f312a1fb35b1a3fedd763f26cb2297b0c37a834ec
4
+ data.tar.gz: fdf62f0bf68fd064ba5b71fc13765c6bc7e49a3c3c6298771c85554c7f39eab0
5
5
  SHA512:
6
- metadata.gz: cd7fd0308056d12550c14d34d26d0c8edf28ba858a01c68bb3309cf3f0c4ea3783f209b99c4febf06b2273671bc6cbbf62588829fc5e1d15f611f7567cbfd933
7
- data.tar.gz: f7d7afb0d291654e4d175199741f74477c2ed6ab0a9dc3f56907699562a48e1b0bb2e7b44f231430d098ff109c4f7844fdb51ec6afc3b6201e33bcbf07480b52
6
+ metadata.gz: '075165019c0f2e2a7b76c81b219058c92a16d4f2b225982d2c5eccf74d2f27881e6cacef7e69ede64ec3c51584ae12e658e7e81b3f54b11aadb5081367d04fa4'
7
+ data.tar.gz: e280c5fd4fc6a77fc1e4210d4e0670a3736ee6aecea82d3cc44cc828aef2902bcf9f516735779e524afb27db052fc396b5e278cf3aae83633322a85568022e65
@@ -1,19 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'asciidoctor'
4
- require 'metanorma-generic'
5
- require 'isodoc/csa/html_convert'
6
- require 'isodoc/csa/pdf_convert'
7
- require 'isodoc/csa/word_convert'
8
- require 'isodoc/csa/presentation_xml_convert'
9
- require 'metanorma/csa'
10
- require 'fileutils'
3
+ require "asciidoctor"
4
+ require "metanorma-generic"
5
+ require "isodoc/csa/html_convert"
6
+ require "isodoc/csa/pdf_convert"
7
+ require "isodoc/csa/word_convert"
8
+ require "isodoc/csa/presentation_xml_convert"
9
+ require "metanorma/csa"
10
+ require "fileutils"
11
11
 
12
12
  module Asciidoctor
13
13
  module Csa
14
14
  class Converter < ::Asciidoctor::Generic::Converter
15
- XML_ROOT_TAG = "csa-standard".freeze
16
- XML_NAMESPACE = "https://www.metanorma.org/ns/csa".freeze
15
+ XML_ROOT_TAG = "csa-standard"
16
+ XML_NAMESPACE = "https://www.metanorma.org/ns/csa"
17
17
 
18
18
  register_for "csa"
19
19
 
@@ -21,46 +21,47 @@ module Asciidoctor
21
21
  Metanorma::Csa.configuration
22
22
  end
23
23
 
24
- def personal_role(node, c, suffix)
24
+ def personal_role(node, contrib, suffix)
25
25
  role = node.attr("role#{suffix}")&.downcase || "full author"
26
- c.role **{ type: role == "editor" ? "editor" : "author" } do |r|
26
+ contrib.role **{ type: role == "editor" ? "editor" : "author" } do |r|
27
27
  r.description role.strip.gsub(/\s/, "-")
28
28
  end
29
29
  end
30
30
 
31
31
  def metadata_committee(node, xml)
32
32
  return unless node.attr("technical-committee")
33
+
33
34
  xml.editorialgroup do |a|
34
35
  a.committee node.attr("technical-committee"),
35
- **attr_code(type: node.attr("technical-committee-type"))
36
+ **attr_code(type: node.attr("technical-committee-type"))
36
37
  i = 2
37
- while node.attr("technical-committee_#{i}") do
38
+ while node.attr("technical-committee_#{i}")
38
39
  a.committee node.attr("technical-committee_#{i}"),
39
- **attr_code(type: node.attr("technical-committee-type_#{i}"))
40
+ **attr_code(type: node.attr("technical-committee-type_#{i}"))
40
41
  i += 1
41
42
  end
42
43
  end
43
44
  end
44
45
 
45
- def title_validate(root)
46
+ def title_validate(_root)
46
47
  nil
47
48
  end
48
49
 
49
50
  def outputs(node, ret)
50
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
51
- presentation_xml_converter(node).convert(@filename + ".xml")
52
- html_converter(node).convert(@filename + ".presentation.xml",
53
- nil, false, "#{@filename}.html")
54
- doc_converter(node).convert(@filename + ".presentation.xml",
55
- nil, false, "#{@filename}.doc")
56
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
57
- nil, false, "#{@filename}.pdf")
51
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
52
+ presentation_xml_converter(node).convert("#{@filename}.xml")
53
+ html_converter(node).convert("#{@filename}.presentation.xml",
54
+ nil, false, "#{@filename}.html")
55
+ doc_converter(node).convert("#{@filename}.presentation.xml",
56
+ nil, false, "#{@filename}.doc")
57
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
58
+ nil, false, "#{@filename}.pdf")
58
59
  end
59
60
 
60
- def sections_cleanup(x)
61
+ def sections_cleanup(xml)
61
62
  super
62
- x.xpath("//*[@inline-header]").each do |h|
63
- h.delete('inline-header')
63
+ xml.xpath("//*[@inline-header]").each do |h|
64
+ h.delete("inline-header")
64
65
  end
65
66
  end
66
67
 
@@ -74,13 +75,13 @@ module Asciidoctor
74
75
  r["type"] == "author" or next
75
76
  role = r.at("./description").text
76
77
  %w{full-author contributor staff reviewer}.include?(role) or
77
- @log.add("Document Attributes", nil,
78
- "#{role} is not a recognised role")
78
+ @log.add("Document Attributes", nil,
79
+ "#{role} is not a recognised role")
79
80
  end
80
81
  end
81
82
 
82
- def style(n, t)
83
- return
83
+ def style(_node, _text)
84
+ nil
84
85
  end
85
86
 
86
87
  def html_converter(node)
@@ -89,6 +90,7 @@ module Asciidoctor
89
90
 
90
91
  def pdf_converter(node)
91
92
  return if node.attr("no-pdf")
93
+
92
94
  IsoDoc::Csa::PdfConvert.new(html_extract_attributes(node))
93
95
  end
94
96
 
@@ -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>
@@ -86,12 +86,12 @@
86
86
  <fo:flow flow-name="xsl-region-body">
87
87
 
88
88
  <fo:block-container width="136mm" margin-bottom="12pt">
89
- <fo:block font-size="36pt" font-weight="bold" color="rgb(54, 59, 74)">
89
+ <fo:block font-size="36pt" font-weight="bold" color="rgb(54, 59, 74)" role="H1">
90
90
  <xsl:value-of select="/csa:csa-standard/csa:bibdata/csa:title[@language = 'en']"/>
91
91
  </fo:block>
92
92
  </fo:block-container>
93
93
 
94
- <fo:block font-size="26pt" color="rgb(55, 60, 75)">
94
+ <fo:block font-size="26pt" color="rgb(55, 60, 75)" role="H2">
95
95
  <xsl:value-of select="/csa:csa-standard/csa:bibdata/csa:title[@language = 'en' and @type = 'subtitle']"/>
96
96
  </fo:block>
97
97
 
@@ -145,7 +145,7 @@
145
145
  <xsl:with-param name="name" select="'title-acknowledgements'"/>
146
146
  </xsl:call-template>
147
147
  </xsl:variable>
148
- <fo:block font-size="26pt" margin-bottom="18pt"><xsl:value-of select="$title-acknowledgements"/></fo:block>
148
+ <fo:block font-size="26pt" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-acknowledgements"/></fo:block>
149
149
 
150
150
  <xsl:variable name="persons">
151
151
  <xsl:for-each select="/csa:csa-standard/csa:bibdata/csa:contributor[csa:person]">
@@ -206,11 +206,11 @@
206
206
  <xsl:with-param name="name" select="'title-toc'"/>
207
207
  </xsl:call-template>
208
208
  </xsl:variable>
209
- <fo:block font-size="26pt" color="black" margin-top="2pt" margin-bottom="30pt"><xsl:value-of select="$title-toc"/></fo:block>
209
+ <fo:block font-size="26pt" color="black" margin-top="2pt" margin-bottom="30pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
210
210
 
211
- <fo:block margin-left="-3mm">
211
+ <fo:block margin-left="-3mm" role="TOC">
212
212
  <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
213
- <fo:block>
213
+ <fo:block role="TOCI">
214
214
  <fo:list-block>
215
215
  <xsl:attribute name="provisional-distance-between-starts">
216
216
  <xsl:choose>
@@ -315,7 +315,10 @@
315
315
 
316
316
 
317
317
  <xsl:template match="csa:license-statement//csa:title">
318
- <fo:block text-align="center" font-weight="bold" margin-top="4pt">
318
+ <xsl:variable name="level">
319
+ <xsl:call-template name="getLevel"/>
320
+ </xsl:variable>
321
+ <fo:block text-align="center" font-weight="bold" margin-top="4pt" role="H{$level}">
319
322
  <xsl:apply-templates/>
320
323
  </fo:block>
321
324
  </xsl:template>
@@ -336,7 +339,10 @@
336
339
  </xsl:template>
337
340
 
338
341
  <xsl:template match="csa:copyright-statement//csa:title">
339
- <fo:block font-weight="bold" text-align="center">
342
+ <xsl:variable name="level">
343
+ <xsl:call-template name="getLevel"/>
344
+ </xsl:variable>
345
+ <fo:block font-weight="bold" text-align="center" role="H{$level}">
340
346
  <xsl:apply-templates/>
341
347
  </fo:block>
342
348
  </xsl:template>
@@ -366,7 +372,10 @@
366
372
  </xsl:template>
367
373
 
368
374
  <xsl:template match="csa:legal-statement//csa:title">
369
- <fo:block text-align="center" font-weight="bold" padding-top="2mm" margin-bottom="6pt">
375
+ <xsl:variable name="level">
376
+ <xsl:call-template name="getLevel"/>
377
+ </xsl:variable>
378
+ <fo:block text-align="center" font-weight="bold" padding-top="2mm" margin-bottom="6pt" role="H{$level}">
370
379
  <xsl:apply-templates/>
371
380
  </fo:block>
372
381
  </xsl:template>
@@ -402,8 +411,9 @@
402
411
  <xsl:otherwise>black</xsl:otherwise>
403
412
  </xsl:choose>
404
413
  </xsl:variable>
405
- <fo:block font-size="12pt" text-align="center" margin-bottom="12pt" keep-with-next="always" color="{$color}">
414
+ <fo:block font-size="12pt" text-align="center" margin-bottom="12pt" keep-with-next="always" color="{$color}" role="H{$level}">
406
415
  <xsl:apply-templates/>
416
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
407
417
  </fo:block>
408
418
  </xsl:template>
409
419
 
@@ -454,6 +464,7 @@
454
464
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
455
465
  <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
456
466
  <xsl:attribute name="line-height">120%</xsl:attribute>
467
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
457
468
 
458
469
  <xsl:if test="$level = 2">
459
470
  <fo:inline padding-right="1mm">
@@ -462,7 +473,8 @@
462
473
  </xsl:if>
463
474
 
464
475
  <xsl:apply-templates/>
465
-
476
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
477
+
466
478
  </xsl:element>
467
479
 
468
480
  </xsl:template>
@@ -718,7 +730,10 @@
718
730
  <xsl:otherwise>12pt</xsl:otherwise>
719
731
  </xsl:choose>
720
732
  </xsl:variable>
721
- <fo:block font-size="{$font-size}">
733
+ <xsl:variable name="levelTerm">
734
+ <xsl:call-template name="getLevelTermName"/>
735
+ </xsl:variable>
736
+ <fo:block font-size="{$font-size}" role="H{$levelTerm}">
722
737
  <fo:block font-weight="bold" keep-with-next="always">
723
738
  <xsl:apply-templates select="ancestor::csa:term/csa:name" mode="presentation"/>
724
739
  </fo:block>
@@ -860,12 +875,12 @@
860
875
  </xsl:template>
861
876
 
862
877
  <xsl:template name="insertHeaderFooter">
863
- <fo:static-content flow-name="header">
878
+ <fo:static-content flow-name="header" role="artifact">
864
879
  <fo:block-container height="2.5mm" background-color="{$color-header-document}">
865
880
  <fo:block font-size="1pt"> </fo:block>
866
881
  </fo:block-container>
867
882
  </fo:static-content>
868
- <fo:static-content flow-name="footer">
883
+ <fo:static-content flow-name="footer" role="artifact">
869
884
  <fo:block-container font-family="Azo Sans Lt" font-size="10.1pt" height="100%" display-align="after"> <!-- 11.5pt -->
870
885
  <fo:block padding-bottom="13mm" text-align="right" color="rgb(144, 144, 144)">
871
886
  <fo:inline padding-right="7mm"><xsl:value-of select="$copyright"/></fo:inline>
@@ -1054,6 +1069,7 @@
1054
1069
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1055
1070
  <xsl:attribute name="white-space">pre</xsl:attribute>
1056
1071
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1072
+ <xsl:attribute name="role">Code</xsl:attribute>
1057
1073
 
1058
1074
 
1059
1075
  <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
@@ -1080,8 +1096,13 @@
1080
1096
 
1081
1097
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1082
1098
 
1083
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1084
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1099
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1100
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1101
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1102
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1103
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1104
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1105
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1085
1106
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1086
1107
 
1087
1108
 
@@ -1162,6 +1183,7 @@
1162
1183
 
1163
1184
 
1164
1185
 
1186
+
1165
1187
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1166
1188
 
1167
1189
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1170,7 +1192,9 @@
1170
1192
 
1171
1193
 
1172
1194
 
1173
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1195
+ </xsl:attribute-set><xsl:variable name="table-border_">
1196
+
1197
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1174
1198
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1175
1199
 
1176
1200
 
@@ -1285,7 +1309,8 @@
1285
1309
 
1286
1310
 
1287
1311
 
1288
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1312
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1313
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1289
1314
 
1290
1315
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1291
1316
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
@@ -1485,11 +1510,15 @@
1485
1510
  <fo:block>&#xA0;</fo:block>
1486
1511
  </xsl:if> -->
1487
1512
 
1513
+
1514
+ <!-- Display table's name before table as standalone block -->
1488
1515
  <!-- $namespace = 'iso' or -->
1489
1516
 
1490
1517
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1491
1518
 
1492
-
1519
+
1520
+
1521
+
1493
1522
 
1494
1523
 
1495
1524
 
@@ -1558,6 +1587,12 @@
1558
1587
 
1559
1588
 
1560
1589
 
1590
+
1591
+
1592
+
1593
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1594
+
1595
+
1561
1596
  <xsl:variable name="table_width">
1562
1597
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1563
1598
  100%
@@ -1576,6 +1611,7 @@
1576
1611
 
1577
1612
 
1578
1613
 
1614
+
1579
1615
 
1580
1616
 
1581
1617
 
@@ -1599,6 +1635,8 @@
1599
1635
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1600
1636
  </xsl:if>
1601
1637
 
1638
+
1639
+
1602
1640
  <xsl:choose>
1603
1641
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1604
1642
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1886,9 +1924,9 @@
1886
1924
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1887
1925
  <xsl:with-param name="continued">true</xsl:with-param>
1888
1926
  </xsl:apply-templates>
1889
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1890
- <xsl:call-template name="fn_name_display"/>
1891
- </xsl:for-each>
1927
+
1928
+
1929
+
1892
1930
 
1893
1931
  </fo:table-cell>
1894
1932
  </fo:table-row>
@@ -1970,7 +2008,11 @@
1970
2008
 
1971
2009
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1972
2010
 
1973
- <xsl:if test="$isNoteOrFnExist = 'true'">
2011
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2012
+
2013
+ </xsl:variable>
2014
+
2015
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
1974
2016
 
1975
2017
  <xsl:variable name="cols-count">
1976
2018
  <xsl:choose>
@@ -1999,6 +2041,8 @@
1999
2041
  </xsl:choose>
2000
2042
  </xsl:for-each>
2001
2043
 
2044
+
2045
+
2002
2046
  <xsl:choose>
2003
2047
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2004
2048
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2025,6 +2069,7 @@
2025
2069
 
2026
2070
 
2027
2071
 
2072
+
2028
2073
  <!-- fn will be processed inside 'note' processing -->
2029
2074
 
2030
2075
 
@@ -2033,6 +2078,11 @@
2033
2078
 
2034
2079
 
2035
2080
 
2081
+
2082
+
2083
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2084
+
2085
+
2036
2086
  <!-- except gb -->
2037
2087
 
2038
2088
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2058,6 +2108,10 @@
2058
2108
  <!-- fn processing -->
2059
2109
  <xsl:call-template name="fn_display"/>
2060
2110
 
2111
+
2112
+ <!-- for PAS display Notes after footnotes -->
2113
+
2114
+
2061
2115
  </fo:table-cell>
2062
2116
  </fo:table-row>
2063
2117
  </fo:table-body>
@@ -2099,6 +2153,19 @@
2099
2153
 
2100
2154
  </fo:table-body>
2101
2155
 
2156
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2157
+ <xsl:choose>
2158
+ <xsl:when test="substring-after(., '—') != ''">
2159
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2160
+ </xsl:when>
2161
+ <xsl:otherwise>
2162
+ <xsl:value-of select="."/>
2163
+ </xsl:otherwise>
2164
+ </xsl:choose>
2165
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2166
+ <xsl:apply-templates mode="presentation_name"/>
2167
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2168
+ <xsl:apply-templates select="."/>
2102
2169
  </xsl:template><xsl:template match="*[local-name()='tr']">
2103
2170
  <xsl:variable name="parent-name" select="local-name(..)"/>
2104
2171
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2111,10 +2178,13 @@
2111
2178
 
2112
2179
 
2113
2180
 
2181
+
2182
+
2114
2183
  </xsl:if>
2115
2184
  <xsl:if test="$parent-name = 'tfoot'">
2116
2185
 
2117
2186
 
2187
+
2118
2188
  </xsl:if>
2119
2189
 
2120
2190
 
@@ -2124,6 +2194,8 @@
2124
2194
 
2125
2195
 
2126
2196
 
2197
+
2198
+
2127
2199
  <!-- <xsl:if test="$namespace = 'bipm'">
2128
2200
  <xsl:attribute name="height">8mm</xsl:attribute>
2129
2201
  </xsl:if> -->
@@ -2243,8 +2315,13 @@
2243
2315
 
2244
2316
 
2245
2317
 
2318
+
2319
+ <!-- Table's note name (NOTE, for example) -->
2320
+
2246
2321
  <fo:inline padding-right="2mm">
2247
2322
 
2323
+
2324
+
2248
2325
 
2249
2326
 
2250
2327
 
@@ -2252,6 +2329,8 @@
2252
2329
 
2253
2330
  </fo:inline>
2254
2331
 
2332
+
2333
+
2255
2334
  <xsl:apply-templates mode="process"/>
2256
2335
  </fo:block>
2257
2336
 
@@ -2259,18 +2338,18 @@
2259
2338
  <xsl:apply-templates/>
2260
2339
  </xsl:template><xsl:template name="fn_display">
2261
2340
  <xsl:variable name="references">
2341
+
2262
2342
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2263
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2264
-
2265
-
2266
- <xsl:apply-templates/>
2267
- </fn>
2343
+ <xsl:call-template name="create_fn"/>
2268
2344
  </xsl:for-each>
2269
2345
  </xsl:variable>
2346
+
2270
2347
  <xsl:for-each select="xalan:nodeset($references)//fn">
2271
2348
  <xsl:variable name="reference" select="@reference"/>
2272
2349
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2273
2350
  <fo:block margin-bottom="12pt">
2351
+
2352
+
2274
2353
 
2275
2354
 
2276
2355
 
@@ -2288,6 +2367,7 @@
2288
2367
  <xsl:value-of select="@reference"/>
2289
2368
 
2290
2369
 
2370
+
2291
2371
  </fo:inline>
2292
2372
  <fo:inline>
2293
2373
 
@@ -2297,6 +2377,12 @@
2297
2377
  </fo:block>
2298
2378
  </xsl:if>
2299
2379
  </xsl:for-each>
2380
+ </xsl:template><xsl:template name="create_fn">
2381
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2382
+
2383
+
2384
+ <xsl:apply-templates/>
2385
+ </fn>
2300
2386
  </xsl:template><xsl:template name="fn_name_display">
2301
2387
  <!-- <xsl:variable name="references">
2302
2388
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2437,6 +2523,7 @@
2437
2523
 
2438
2524
  <xsl:value-of select="@reference"/>
2439
2525
 
2526
+
2440
2527
  </fo:basic-link>
2441
2528
  </fo:inline>
2442
2529
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3275,16 +3362,68 @@
3275
3362
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3276
3363
  </xsl:call-template>
3277
3364
 
3365
+
3366
+
3278
3367
  <xsl:variable name="mathml">
3279
3368
  <xsl:apply-templates select="." mode="mathml"/>
3280
3369
  </xsl:variable>
3281
3370
  <fo:instream-foreign-object fox:alt-text="Math">
3282
3371
 
3283
3372
 
3373
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3374
+ <xsl:variable name="comment_text_">
3375
+ <xsl:choose>
3376
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3377
+ <xsl:value-of select="$comment_text_following"/>
3378
+ </xsl:when>
3379
+ <xsl:otherwise>
3380
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3381
+ </xsl:otherwise>
3382
+ </xsl:choose>
3383
+ </xsl:variable>
3384
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3385
+
3386
+ <xsl:if test="normalize-space($comment_text) != ''">
3387
+ <!-- put Mathin Alternate Text -->
3388
+ <xsl:attribute name="fox:alt-text">
3389
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3390
+ </xsl:attribute>
3391
+ </xsl:if>
3392
+
3393
+ <xsl:variable name="mathml_content">
3394
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3395
+ </xsl:variable>
3396
+ <!-- put MathML in Actual Text -->
3397
+ <xsl:attribute name="fox:actual-text">
3398
+ <xsl:value-of select="$mathml_content"/>
3399
+ </xsl:attribute>
3400
+
3401
+
3284
3402
  <!-- <xsl:copy-of select="."/> -->
3285
3403
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3286
3404
  </fo:instream-foreign-object>
3287
3405
  </fo:inline>
3406
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3407
+ <!-- <xsl:text>a+b</xsl:text> -->
3408
+ <xsl:text>&lt;</xsl:text>
3409
+ <xsl:value-of select="local-name()"/>
3410
+ <xsl:if test="local-name() = 'math'">
3411
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3412
+ </xsl:if>
3413
+ <xsl:for-each select="@*">
3414
+ <xsl:text> </xsl:text>
3415
+ <xsl:value-of select="local-name()"/>
3416
+ <xsl:text>="</xsl:text>
3417
+ <xsl:value-of select="."/>
3418
+ <xsl:text>"</xsl:text>
3419
+ </xsl:for-each>
3420
+ <xsl:text>&gt;</xsl:text>
3421
+ <xsl:apply-templates mode="mathml_actual_text"/>
3422
+ <xsl:text>&lt;/</xsl:text>
3423
+ <xsl:value-of select="local-name()"/>
3424
+ <xsl:text>&gt;</xsl:text>
3425
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3426
+ <xsl:value-of select="normalize-space()"/>
3288
3427
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3289
3428
  <xsl:copy>
3290
3429
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3294,19 +3433,6 @@
3294
3433
  <!-- replace start and end spaces to non-break space -->
3295
3434
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3296
3435
  </xsl:copy>
3297
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3298
- <xsl:copy>
3299
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3300
- </xsl:copy>
3301
- <xsl:choose>
3302
- <!-- if in msub, then don't add space -->
3303
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3304
- <!-- if next char in digit, don't add space -->
3305
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3306
- <xsl:otherwise>
3307
- <mathml:mspace width="0.5ex"/>
3308
- </xsl:otherwise>
3309
- </xsl:choose>
3310
3436
  </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">
3311
3437
  <xsl:variable name="target">
3312
3438
  <xsl:choose>
@@ -3359,7 +3485,10 @@
3359
3485
  </fo:block>
3360
3486
  <xsl:apply-templates/>
3361
3487
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3362
- <fo:inline><xsl:apply-templates/></fo:inline>
3488
+ <xsl:variable name="level">
3489
+ <xsl:call-template name="getLevel"/>
3490
+ </xsl:variable>
3491
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3363
3492
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3364
3493
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3365
3494
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3394,9 +3523,10 @@
3394
3523
 
3395
3524
  </xsl:variable>
3396
3525
 
3526
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3397
3527
  <xsl:choose>
3398
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3399
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3528
+ <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>
3529
+ <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>
3400
3530
  </xsl:choose>
3401
3531
  <xsl:apply-templates/>
3402
3532
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3440,6 +3570,7 @@
3440
3570
 
3441
3571
 
3442
3572
 
3573
+
3443
3574
  <fo:block-container margin-left="0mm">
3444
3575
 
3445
3576
 
@@ -3543,7 +3674,10 @@
3543
3674
  </fo:block>
3544
3675
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3545
3676
  <xsl:if test="normalize-space() != ''">
3546
- <fo:inline>
3677
+ <xsl:variable name="level">
3678
+ <xsl:call-template name="getLevelTermName"/>
3679
+ </xsl:variable>
3680
+ <fo:inline role="H{$level}">
3547
3681
  <xsl:apply-templates/>
3548
3682
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3549
3683
  <xsl:text>.</xsl:text>
@@ -3616,7 +3750,24 @@
3616
3750
  </fo:instream-foreign-object>
3617
3751
  </xsl:when>
3618
3752
  <xsl:otherwise>
3619
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3753
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3754
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3755
+
3756
+ <xsl:variable name="img_src">
3757
+ <xsl:choose>
3758
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3759
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3760
+ </xsl:choose>
3761
+ </xsl:variable>
3762
+
3763
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3764
+ <xsl:if test="number($scale) &lt; 100">
3765
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3766
+ </xsl:if>
3767
+
3768
+ </xsl:if>
3769
+
3770
+ </fo:external-graphic>
3620
3771
  </xsl:otherwise>
3621
3772
  </xsl:choose>
3622
3773
 
@@ -3787,11 +3938,13 @@
3787
3938
  <xsl:attribute name="width">100%</xsl:attribute>
3788
3939
  <xsl:attribute name="content-height">100%</xsl:attribute>
3789
3940
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3941
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
3942
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3790
3943
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3791
3944
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3792
3945
  <!-- effective height / width = 1.48, 1.4 - with title -->
3793
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3794
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3946
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
3947
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3795
3948
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3796
3949
  </xsl:if>
3797
3950
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3808,6 +3961,23 @@
3808
3961
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3809
3962
  <xsl:value-of select="."/>
3810
3963
  </xsl:attribute>
3964
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
3965
+ <xsl:copy>
3966
+ <xsl:apply-templates select="@*" mode="svg_update"/>
3967
+ <xsl:variable name="viewbox">
3968
+ <xsl:call-template name="split">
3969
+ <xsl:with-param name="pText" select="@viewBox"/>
3970
+ <xsl:with-param name="sep" select="' '"/>
3971
+ </xsl:call-template>
3972
+ </xsl:variable>
3973
+ <xsl:attribute name="width">
3974
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
3975
+ </xsl:attribute>
3976
+ <xsl:attribute name="height">
3977
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
3978
+ </xsl:attribute>
3979
+ <xsl:apply-templates mode="svg_update"/>
3980
+ </xsl:copy>
3811
3981
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3812
3982
  <xsl:variable name="svg_content" select="document(@src)"/>
3813
3983
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4138,6 +4308,7 @@
4138
4308
  </xsl:when>
4139
4309
  <xsl:otherwise>
4140
4310
  <xsl:apply-templates/>
4311
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4141
4312
  </xsl:otherwise>
4142
4313
  </xsl:choose>
4143
4314
  </fo:block>
@@ -4278,14 +4449,6 @@
4278
4449
  <fo:block>
4279
4450
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4280
4451
  </fo:block>
4281
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4282
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4283
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4284
- </fo:block>
4285
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4286
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4287
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4288
- </fo:block>
4289
4452
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4290
4453
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4291
4454
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4302,6 +4465,38 @@
4302
4465
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4303
4466
  <xsl:apply-templates/>
4304
4467
  </fo:block>
4468
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4469
+ <fo:block xsl:use-attribute-sets="subject-style">
4470
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4471
+ </fo:block>
4472
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4473
+ <fo:block xsl:use-attribute-sets="subject-style">
4474
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4475
+ </fo:block>
4476
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4477
+ <fo:block xsl:use-attribute-sets="inherit-style">
4478
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4479
+ </fo:block>
4480
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4481
+ <fo:block xsl:use-attribute-sets="description-style">
4482
+ <xsl:apply-templates/>
4483
+ </fo:block>
4484
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4485
+ <fo:block xsl:use-attribute-sets="specification-style">
4486
+ <xsl:apply-templates/>
4487
+ </fo:block>
4488
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4489
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4490
+ <xsl:apply-templates/>
4491
+ </fo:block>
4492
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4493
+ <fo:block xsl:use-attribute-sets="verification-style">
4494
+ <xsl:apply-templates/>
4495
+ </fo:block>
4496
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4497
+ <fo:block xsl:use-attribute-sets="import-style">
4498
+ <xsl:apply-templates/>
4499
+ </fo:block>
4305
4500
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4306
4501
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4307
4502
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4453,7 +4648,19 @@
4453
4648
  </fo:inline>
4454
4649
  </xsl:if>
4455
4650
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4456
- <fo:inline><xsl:apply-templates/></fo:inline>
4651
+ <xsl:variable name="element">inline
4652
+
4653
+ </xsl:variable>
4654
+ <xsl:choose>
4655
+ <xsl:when test="contains($element, 'block')">
4656
+ <fo:block xsl:use-attribute-sets="example-p-style">
4657
+ <xsl:apply-templates/>
4658
+ </fo:block>
4659
+ </xsl:when>
4660
+ <xsl:otherwise>
4661
+ <fo:inline><xsl:apply-templates/></fo:inline>
4662
+ </xsl:otherwise>
4663
+ </xsl:choose>
4457
4664
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4458
4665
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4459
4666
 
@@ -4646,9 +4853,10 @@
4646
4853
 
4647
4854
 
4648
4855
  </xsl:if>
4649
-
4856
+
4857
+
4858
+
4650
4859
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4651
-
4652
4860
  <xsl:if test="normalize-space(@citeas) = ''">
4653
4861
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4654
4862
  </xsl:if>
@@ -4656,6 +4864,7 @@
4656
4864
 
4657
4865
 
4658
4866
 
4867
+
4659
4868
  </xsl:if>
4660
4869
 
4661
4870
  <xsl:apply-templates/>
@@ -5029,7 +5238,6 @@
5029
5238
  </xsl:template><xsl:template name="processBibitem">
5030
5239
 
5031
5240
 
5032
- <!-- end BIPM bibitem processing-->
5033
5241
 
5034
5242
 
5035
5243
 
@@ -5159,6 +5367,9 @@
5159
5367
  <fo:block-container border="1pt solid black" width="50%">
5160
5368
  <fo:block> </fo:block>
5161
5369
  </fo:block-container>
5370
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5371
+ <fo:inline padding-right="5mm"> </fo:inline>
5372
+ <fo:inline><xsl:apply-templates/></fo:inline>
5162
5373
  </xsl:template><xsl:template name="convertDate">
5163
5374
  <xsl:param name="date"/>
5164
5375
  <xsl:param name="format" select="'short'"/>
@@ -5397,6 +5608,26 @@
5397
5608
  <xsl:value-of select="$level"/>
5398
5609
  </xsl:otherwise>
5399
5610
  </xsl:choose>
5611
+ </xsl:template><xsl:template name="getLevelTermName">
5612
+ <xsl:choose>
5613
+ <xsl:when test="normalize-space(../@depth) != ''">
5614
+ <xsl:value-of select="../@depth"/>
5615
+ </xsl:when>
5616
+ <xsl:otherwise>
5617
+ <xsl:variable name="title_level_">
5618
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5619
+ <xsl:call-template name="getLevel"/>
5620
+ </xsl:for-each>
5621
+ </xsl:variable>
5622
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5623
+ <xsl:choose>
5624
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5625
+ <xsl:otherwise>
5626
+ <xsl:call-template name="getLevel"/>
5627
+ </xsl:otherwise>
5628
+ </xsl:choose>
5629
+ </xsl:otherwise>
5630
+ </xsl:choose>
5400
5631
  </xsl:template><xsl:template name="split">
5401
5632
  <xsl:param name="pText" select="."/>
5402
5633
  <xsl:param name="sep" select="','"/>
@@ -5494,20 +5725,40 @@
5494
5725
  </xsl:call-template>
5495
5726
  </xsl:if>
5496
5727
  </xsl:template><xsl:template name="getLocalizedString">
5497
- <xsl:param name="key"/>
5728
+ <xsl:param name="key"/>
5729
+ <xsl:param name="formatted">false</xsl:param>
5498
5730
 
5499
5731
  <xsl:variable name="curr_lang">
5500
5732
  <xsl:call-template name="getLang"/>
5501
5733
  </xsl:variable>
5502
5734
 
5503
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5735
+ <xsl:variable name="data_value">
5736
+ <xsl:choose>
5737
+ <xsl:when test="$formatted = 'true'">
5738
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5739
+ </xsl:when>
5740
+ <xsl:otherwise>
5741
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5742
+ </xsl:otherwise>
5743
+ </xsl:choose>
5744
+ </xsl:variable>
5504
5745
 
5505
5746
  <xsl:choose>
5506
- <xsl:when test="$data_value != ''">
5507
- <xsl:value-of select="$data_value"/>
5747
+ <xsl:when test="normalize-space($data_value) != ''">
5748
+ <xsl:choose>
5749
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5750
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5751
+ </xsl:choose>
5508
5752
  </xsl:when>
5509
5753
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5510
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5754
+ <xsl:choose>
5755
+ <xsl:when test="$formatted = 'true'">
5756
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5757
+ </xsl:when>
5758
+ <xsl:otherwise>
5759
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5760
+ </xsl:otherwise>
5761
+ </xsl:choose>
5511
5762
  </xsl:when>
5512
5763
  <xsl:otherwise>
5513
5764
  <xsl:variable name="key_">
@@ -5518,7 +5769,7 @@
5518
5769
  <xsl:value-of select="$key_"/>
5519
5770
  </xsl:otherwise>
5520
5771
  </xsl:choose>
5521
-
5772
+
5522
5773
  </xsl:template><xsl:template name="setTrackChangesStyles">
5523
5774
  <xsl:param name="isAdded"/>
5524
5775
  <xsl:param name="isDeleted"/>
@@ -5569,4 +5820,100 @@
5569
5820
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5570
5821
  </xsl:choose>
5571
5822
  </xsl:attribute>
5823
+ </xsl:template><xsl:template name="number-to-words">
5824
+ <xsl:param name="number"/>
5825
+ <xsl:param name="first"/>
5826
+ <xsl:if test="$number != ''">
5827
+ <xsl:variable name="words">
5828
+ <words>
5829
+ <word cardinal="1">One-</word>
5830
+ <word ordinal="1">First </word>
5831
+ <word cardinal="2">Two-</word>
5832
+ <word ordinal="2">Second </word>
5833
+ <word cardinal="3">Three-</word>
5834
+ <word ordinal="3">Third </word>
5835
+ <word cardinal="4">Four-</word>
5836
+ <word ordinal="4">Fourth </word>
5837
+ <word cardinal="5">Five-</word>
5838
+ <word ordinal="5">Fifth </word>
5839
+ <word cardinal="6">Six-</word>
5840
+ <word ordinal="6">Sixth </word>
5841
+ <word cardinal="7">Seven-</word>
5842
+ <word ordinal="7">Seventh </word>
5843
+ <word cardinal="8">Eight-</word>
5844
+ <word ordinal="8">Eighth </word>
5845
+ <word cardinal="9">Nine-</word>
5846
+ <word ordinal="9">Ninth </word>
5847
+ <word ordinal="10">Tenth </word>
5848
+ <word ordinal="11">Eleventh </word>
5849
+ <word ordinal="12">Twelfth </word>
5850
+ <word ordinal="13">Thirteenth </word>
5851
+ <word ordinal="14">Fourteenth </word>
5852
+ <word ordinal="15">Fifteenth </word>
5853
+ <word ordinal="16">Sixteenth </word>
5854
+ <word ordinal="17">Seventeenth </word>
5855
+ <word ordinal="18">Eighteenth </word>
5856
+ <word ordinal="19">Nineteenth </word>
5857
+ <word cardinal="20">Twenty-</word>
5858
+ <word ordinal="20">Twentieth </word>
5859
+ <word cardinal="30">Thirty-</word>
5860
+ <word ordinal="30">Thirtieth </word>
5861
+ <word cardinal="40">Forty-</word>
5862
+ <word ordinal="40">Fortieth </word>
5863
+ <word cardinal="50">Fifty-</word>
5864
+ <word ordinal="50">Fiftieth </word>
5865
+ <word cardinal="60">Sixty-</word>
5866
+ <word ordinal="60">Sixtieth </word>
5867
+ <word cardinal="70">Seventy-</word>
5868
+ <word ordinal="70">Seventieth </word>
5869
+ <word cardinal="80">Eighty-</word>
5870
+ <word ordinal="80">Eightieth </word>
5871
+ <word cardinal="90">Ninety-</word>
5872
+ <word ordinal="90">Ninetieth </word>
5873
+ <word cardinal="100">Hundred-</word>
5874
+ <word ordinal="100">Hundredth </word>
5875
+ </words>
5876
+ </xsl:variable>
5877
+
5878
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5879
+
5880
+ <xsl:variable name="value">
5881
+ <xsl:choose>
5882
+ <xsl:when test="$ordinal != ''">
5883
+ <xsl:value-of select="$ordinal"/>
5884
+ </xsl:when>
5885
+ <xsl:otherwise>
5886
+ <xsl:choose>
5887
+ <xsl:when test="$number &lt; 100">
5888
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5889
+ <xsl:variable name="digit" select="substring($number,2)"/>
5890
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5891
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5892
+ </xsl:when>
5893
+ <xsl:otherwise>
5894
+ <!-- more 100 -->
5895
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5896
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5897
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5898
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5899
+ <xsl:call-template name="number-to-words">
5900
+ <xsl:with-param name="number" select="$digits"/>
5901
+ </xsl:call-template>
5902
+ </xsl:otherwise>
5903
+ </xsl:choose>
5904
+ </xsl:otherwise>
5905
+ </xsl:choose>
5906
+ </xsl:variable>
5907
+ <xsl:choose>
5908
+ <xsl:when test="$first = 'true'">
5909
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5910
+ <xsl:call-template name="capitalize">
5911
+ <xsl:with-param name="str" select="$value_lc"/>
5912
+ </xsl:call-template>
5913
+ </xsl:when>
5914
+ <xsl:otherwise>
5915
+ <xsl:value-of select="$value"/>
5916
+ </xsl:otherwise>
5917
+ </xsl:choose>
5918
+ </xsl:if>
5572
5919
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "1.8.6".freeze
3
+ VERSION = "1.8.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
4
+ version: 1.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic