metanorma-csd 1.3.16 → 1.3.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,7 +35,7 @@ module Asciidoctor
35
35
  word_converter(node).convert filename
36
36
  pdf_converter(node).convert filename
37
37
  end
38
- @log.write(@filename + ".err") unless @novalid
38
+ @log.write(@localdir + @filename + ".err") unless @novalid
39
39
  @files_to_delete.each { |f| FileUtils.rm f }
40
40
  ret
41
41
  end
@@ -101,9 +101,7 @@
101
101
  <ref name="structuredidentifier"/>
102
102
  </zeroOrMore>
103
103
  </define>
104
- <define name="TitleType">
105
- <text/>
106
- </define>
104
+ <!-- TitleType = text -->
107
105
  <define name="sections">
108
106
  <element name="sections">
109
107
  <oneOrMore>
@@ -131,6 +129,9 @@
131
129
  </choice>
132
130
  </attribute>
133
131
  </optional>
132
+ <attribute name="normative">
133
+ <data type="boolean"/>
134
+ </attribute>
134
135
  <optional>
135
136
  <ref name="section-title"/>
136
137
  </optional>
@@ -307,6 +308,21 @@
307
308
  </define>
308
309
  </include>
309
310
  <!-- end overrides -->
311
+ <define name="TextElement" combine="choice">
312
+ <ref name="concept"/>
313
+ </define>
314
+ <define name="concept">
315
+ <element name="concept">
316
+ <optional>
317
+ <attribute name="term"/>
318
+ </optional>
319
+ <choice>
320
+ <ref name="eref"/>
321
+ <ref name="xref"/>
322
+ <ref name="termref"/>
323
+ </choice>
324
+ </element>
325
+ </define>
310
326
  <define name="BasicBlock" combine="choice">
311
327
  <choice>
312
328
  <ref name="requirement"/>
@@ -913,7 +929,10 @@
913
929
  </define>
914
930
  <define name="origin">
915
931
  <element name="origin">
916
- <ref name="erefType"/>
932
+ <choice>
933
+ <ref name="erefType"/>
934
+ <ref name="termref"/>
935
+ </choice>
917
936
  </element>
918
937
  </define>
919
938
  <define name="modification">
@@ -921,6 +940,15 @@
921
940
  <ref name="paragraph"/>
922
941
  </element>
923
942
  </define>
943
+ <define name="termref">
944
+ <element name="termref">
945
+ <attribute name="base"/>
946
+ <attribute name="target"/>
947
+ <optional>
948
+ <text/>
949
+ </optional>
950
+ </element>
951
+ </define>
924
952
  <define name="structuredidentifier">
925
953
  <element name="structuredidentifier">
926
954
  <optional>
@@ -0,0 +1,2638 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
2
+
3
+ <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
+
5
+ <xsl:variable name="pageWidth" select="'210mm'"/>
6
+ <xsl:variable name="pageHeight" select="'297mm'"/>
7
+
8
+
9
+
10
+ <xsl:variable name="debug">false</xsl:variable>
11
+
12
+ <xsl:variable name="copyright">
13
+ <xsl:text>© The Calendaring and Scheduling Consortium, Inc. </xsl:text>
14
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
15
+ <xsl:text> – All rights reserved</xsl:text>
16
+ </xsl:variable>
17
+
18
+ <xsl:variable name="header">
19
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/>
20
+ <xsl:text>:</xsl:text>
21
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
22
+ </xsl:variable>
23
+
24
+ <xsl:variable name="contents">
25
+ <contents>
26
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()" mode="contents"/>
27
+ <!-- <xsl:with-param name="sectionNum" select="'0'"/>
28
+ </xsl:apply-templates> -->
29
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]" mode="contents"> <!-- [@id = '_scope'] -->
30
+ <xsl:with-param name="sectionNum" select="'1'"/>
31
+ </xsl:apply-templates>
32
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]" mode="contents"> <!-- [@id = '_normative_references'] -->
33
+ <xsl:with-param name="sectionNum" select="'2'"/>
34
+ </xsl:apply-templates>
35
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]" mode="contents"> <!-- @id != '_scope' -->
36
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
37
+ </xsl:apply-templates>
38
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex" mode="contents"/>
39
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
40
+
41
+ <xsl:apply-templates select="//csd:figure" mode="contents"/>
42
+
43
+ <xsl:apply-templates select="//csd:table" mode="contents"/>
44
+
45
+ </contents>
46
+ </xsl:variable>
47
+
48
+ <xsl:variable name="lang">
49
+ <xsl:call-template name="getLang"/>
50
+ </xsl:variable>
51
+
52
+ <xsl:template match="/">
53
+ <fo:root font-family="SourceSansPro, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
54
+ <fo:layout-master-set>
55
+ <!-- Cover page -->
56
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
57
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
58
+ <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
59
+ <fo:region-after extent="10mm"/>
60
+ <fo:region-start extent="19mm"/>
61
+ <fo:region-end extent="19mm"/>
62
+ </fo:simple-page-master>
63
+
64
+ <!-- Document pages -->
65
+ <!-- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
66
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
67
+ <fo:region-before extent="23.5mm"/>
68
+ <fo:region-after extent="10mm"/>
69
+ <fo:region-start extent="19mm"/>
70
+ <fo:region-end extent="19mm"/>
71
+ </fo:simple-page-master> -->
72
+
73
+ <!-- Preface odd pages -->
74
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
75
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
76
+ <fo:region-before region-name="header-odd" extent="17mm"/>
77
+ <fo:region-after region-name="footer-odd" extent="10mm"/>
78
+ <fo:region-start region-name="left-region" extent="19mm"/>
79
+ <fo:region-end region-name="right-region" extent="19mm"/>
80
+ </fo:simple-page-master>
81
+ <!-- Preface even pages -->
82
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
83
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
84
+ <fo:region-before region-name="header-even" extent="17mm"/>
85
+ <fo:region-after region-name="footer-even" extent="10mm"/>
86
+ <fo:region-start region-name="left-region" extent="19mm"/>
87
+ <fo:region-end region-name="right-region" extent="19mm"/>
88
+ </fo:simple-page-master>
89
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
90
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
91
+ <fo:region-before region-name="header" extent="17mm"/>
92
+ <fo:region-after region-name="footer" extent="10mm"/>
93
+ <fo:region-start region-name="left" extent="19mm"/>
94
+ <fo:region-end region-name="right" extent="19mm"/>
95
+ </fo:simple-page-master>
96
+ <fo:page-sequence-master master-name="preface">
97
+ <fo:repeatable-page-master-alternatives>
98
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
99
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-preface"/>
100
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-preface"/>
101
+ </fo:repeatable-page-master-alternatives>
102
+ </fo:page-sequence-master>
103
+
104
+ <!-- Document odd pages -->
105
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
106
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
107
+ <fo:region-before region-name="header-odd" extent="20.2mm"/>
108
+ <fo:region-after region-name="footer-odd" extent="20.3mm"/>
109
+ <fo:region-start region-name="left-region" extent="19mm"/>
110
+ <fo:region-end region-name="right-region" extent="19mm"/>
111
+ </fo:simple-page-master>
112
+ <!-- Preface even pages -->
113
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
114
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
115
+ <fo:region-before region-name="header-even" extent="20.2mm"/>
116
+ <fo:region-after region-name="footer-even" extent="20.3mm"/>
117
+ <fo:region-start region-name="left-region" extent="19mm"/>
118
+ <fo:region-end region-name="right-region" extent="19mm"/>
119
+ </fo:simple-page-master>
120
+ <fo:page-sequence-master master-name="document">
121
+ <fo:repeatable-page-master-alternatives>
122
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
123
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
124
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
125
+ </fo:repeatable-page-master-alternatives>
126
+ </fo:page-sequence-master>
127
+
128
+ </fo:layout-master-set>
129
+
130
+ <fo:declarations>
131
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
132
+ <pdf:dictionary type="normal" key="ViewerPreferences">
133
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
134
+ </pdf:dictionary>
135
+ </pdf:catalog>
136
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
137
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
138
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
139
+ <!-- Dublin Core properties go here -->
140
+ <dc:title><xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/></dc:title>
141
+ <dc:creator/>
142
+ <dc:description>
143
+ <xsl:variable name="abstract">
144
+ <xsl:copy-of select="/csd:csd-standard/csd:bibliography/csd:references/csd:bibitem/csd:abstract//text()"/>
145
+ </xsl:variable>
146
+ <xsl:value-of select="normalize-space($abstract)"/>
147
+ </dc:description>
148
+ <pdf:Keywords/>
149
+ </rdf:Description>
150
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
151
+ <!-- XMP properties go here -->
152
+ <xmp:CreatorTool/>
153
+ </rdf:Description>
154
+ </rdf:RDF>
155
+ </x:xmpmeta>
156
+ </fo:declarations>
157
+
158
+ <!-- Cover Page -->
159
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
160
+ <fo:static-content flow-name="xsl-footnote-separator">
161
+ <fo:block>
162
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
163
+ </fo:block>
164
+ </fo:static-content>
165
+ <fo:static-content flow-name="cover-page-header" font-size="10pt">
166
+ <fo:block-container height="23.5mm" display-align="before">
167
+ <fo:block padding-top="12.5mm">
168
+ <xsl:value-of select="$copyright"/>
169
+ </fo:block>
170
+ </fo:block-container>
171
+ </fo:static-content>
172
+
173
+ <fo:flow flow-name="xsl-region-body">
174
+
175
+ <fo:block text-align="right">
176
+ <!-- CC/FDS 18011:2018 -->
177
+ <fo:block font-size="14pt" font-weight="bold" margin-bottom="10pt">
178
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/><xsl:text> </xsl:text>
179
+ </fo:block>
180
+ <fo:block margin-bottom="12pt">
181
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:owner/csd:organization/csd:name"/>
182
+ <xsl:text> TC </xsl:text>
183
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:editorialgroup/csd:technical-committee"/>
184
+ <xsl:text> </xsl:text>
185
+ </fo:block>
186
+ </fo:block>
187
+ <fo:block font-size="24pt" font-weight="bold" text-align="center">
188
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
189
+ <xsl:value-of select="$linebreak"/>
190
+ </fo:block>
191
+ <fo:block> </fo:block>
192
+ <fo:block margin-bottom="12pt"> </fo:block>
193
+ <fo:block-container font-size="16pt" text-align="center" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
194
+ <fo:block-container margin-left="0mm" margin-right="0mm">
195
+ <fo:block padding-top="1mm">
196
+ <xsl:call-template name="capitalizeWords">
197
+ <!-- ex: final-draft -->
198
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:status/csd:stage"/>
199
+ </xsl:call-template>
200
+ <xsl:text> </xsl:text>
201
+ <xsl:call-template name="capitalizeWords">
202
+ <!-- ex: standard -->
203
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:ext/csd:doctype"/>
204
+ </xsl:call-template>
205
+ </fo:block>
206
+ </fo:block-container>
207
+ </fo:block-container>
208
+ <fo:block margin-bottom="10pt"> </fo:block>
209
+ <fo:block-container font-size="10pt" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
210
+ <fo:block-container margin-left="0mm" margin-right="0mm">
211
+ <fo:block text-align="center" font-weight="bold" padding-top="1mm" margin-bottom="6pt">Warning for drafts</fo:block>
212
+ <fo:block margin-left="2mm" margin-right="2mm">
213
+ <fo:block margin-bottom="6pt">This document is not a CalConnect Standard. It is distributed for review and comment, and is subject to change without notice and may not be referred to as a Standard. Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
214
+ <fo:block margin-bottom="10pt">Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
215
+ </fo:block>
216
+ </fo:block-container>
217
+ </fo:block-container>
218
+ <fo:block text-align="center">
219
+ <xsl:text>The Calendaring and Scheduling Consortium, Inc.  </xsl:text>
220
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
221
+ </fo:block>
222
+ </fo:flow>
223
+ </fo:page-sequence>
224
+ <!-- End Cover Page -->
225
+
226
+
227
+ <!-- Copyright, Content, Foreword, etc. pages -->
228
+ <fo:page-sequence master-reference="preface" initial-page-number="2" format="i" force-page-count="end-on-even">
229
+ <fo:static-content flow-name="xsl-footnote-separator">
230
+ <fo:block>
231
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
232
+ </fo:block>
233
+ </fo:static-content>
234
+ <xsl:call-template name="insertHeaderFooter"/>
235
+ <fo:flow flow-name="xsl-region-body">
236
+
237
+ <xsl:if test="$debug = 'true'">
238
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
239
+ DEBUG
240
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
241
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
242
+ </xsl:if>
243
+
244
+ <fo:block margin-bottom="15pt"> </fo:block>
245
+ <fo:block margin-bottom="14pt">
246
+ <xsl:text>© </xsl:text>
247
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
248
+ <xsl:text> </xsl:text>
249
+ <fo:inline>
250
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-name']"/>
251
+ </fo:inline>
252
+ </fo:block>
253
+ <fo:block margin-bottom="12pt">
254
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:legal-statement"/>
255
+ </fo:block>
256
+ <fo:block margin-bottom="12pt">
257
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-name']"/>
258
+ </fo:block>
259
+ <fo:block>
260
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-address']"/>
261
+ </fo:block>
262
+
263
+ <fo:block break-after="page"/>
264
+
265
+ <fo:block-container font-weight="bold" line-height="115%">
266
+ <fo:block font-size="14pt" margin-bottom="15.5pt">Contents</fo:block>
267
+
268
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
269
+
270
+ <fo:block>
271
+ <xsl:if test="@level = 1">
272
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
273
+ </xsl:if>
274
+ <fo:list-block>
275
+ <xsl:attribute name="provisional-distance-between-starts">
276
+ <xsl:choose>
277
+ <!-- skip 0 section without subsections -->
278
+ <xsl:when test="@section != '' and not(@display-section = 'false')">8mm</xsl:when>
279
+ <xsl:otherwise>0mm</xsl:otherwise>
280
+ </xsl:choose>
281
+ </xsl:attribute>
282
+ <fo:list-item>
283
+ <fo:list-item-label end-indent="label-end()">
284
+ <fo:block>
285
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
286
+ <xsl:value-of select="@section"/><xsl:text>.</xsl:text>
287
+ </xsl:if>
288
+ </fo:block>
289
+ </fo:list-item-label>
290
+ <fo:list-item-body start-indent="body-start()">
291
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
292
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
293
+ <xsl:if test="@section and @display-section = 'false'">
294
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
295
+ </xsl:if>
296
+ <xsl:if test="@addon != ''">
297
+ <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
298
+ </xsl:if>
299
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
300
+ <fo:inline keep-together.within-line="always">
301
+ <fo:leader leader-pattern="dots"/>
302
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
303
+ </fo:inline>
304
+ </fo:basic-link>
305
+ </fo:block>
306
+ </fo:list-item-body>
307
+ </fo:list-item>
308
+ </fo:list-block>
309
+ </fo:block>
310
+ </xsl:for-each>
311
+ </fo:block-container>
312
+
313
+ <!-- Foreword, Introduction -->
314
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()"/>
315
+
316
+ </fo:flow>
317
+ </fo:page-sequence>
318
+
319
+
320
+ <!-- Document Pages -->
321
+ <fo:page-sequence master-reference="document" initial-page-number="1" format="1" force-page-count="no-force">
322
+ <fo:static-content flow-name="xsl-footnote-separator">
323
+ <fo:block>
324
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
325
+ </fo:block>
326
+ </fo:static-content>
327
+ <xsl:call-template name="insertHeaderFooter"/>
328
+ <fo:flow flow-name="xsl-region-body">
329
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt">
330
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
331
+ </fo:block>
332
+ <fo:block>
333
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]"> <!-- Scope -->
334
+ <xsl:with-param name="sectionNum" select="'1'"/>
335
+ </xsl:apply-templates>
336
+ <!-- Normative references -->
337
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]">
338
+ <xsl:with-param name="sectionNum" select="'2'"/>
339
+ </xsl:apply-templates>
340
+
341
+ <!-- Other Sections -->
342
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]">
343
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
344
+ </xsl:apply-templates>
345
+
346
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex"/>
347
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]"/>
348
+
349
+ </fo:block>
350
+ </fo:flow>
351
+ </fo:page-sequence>
352
+
353
+ <!-- End Document Pages -->
354
+
355
+ </fo:root>
356
+ </xsl:template>
357
+
358
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
359
+ <xsl:template match="node()">
360
+ <xsl:param name="sectionNum"/>
361
+ <xsl:param name="sectionNumSkew"/>
362
+ <xsl:apply-templates>
363
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
364
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
365
+ </xsl:apply-templates>
366
+ </xsl:template>
367
+
368
+ <!-- ============================= -->
369
+ <!-- CONTENTS -->
370
+ <!-- ============================= -->
371
+ <xsl:template match="node()" mode="contents">
372
+ <xsl:param name="sectionNum"/>
373
+ <xsl:param name="sectionNumSkew"/>
374
+ <xsl:apply-templates mode="contents">
375
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
376
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
377
+ </xsl:apply-templates>
378
+ </xsl:template>
379
+
380
+
381
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
382
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
383
+ <xsl:template match="csd:csd-standard/csd:sections/*" mode="contents">
384
+ <xsl:param name="sectionNum"/>
385
+ <xsl:param name="sectionNumSkew" select="0"/>
386
+ <xsl:variable name="sectionNum_">
387
+ <xsl:choose>
388
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
389
+ <xsl:when test="$sectionNumSkew != 0">
390
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- csd:sections/csd:clause | csd:sections/csd:terms -->
391
+ <xsl:value-of select="$number + $sectionNumSkew"/>
392
+ </xsl:when>
393
+ <xsl:otherwise>
394
+ <xsl:number count="*"/>
395
+ </xsl:otherwise>
396
+ </xsl:choose>
397
+ </xsl:variable>
398
+ <xsl:apply-templates mode="contents">
399
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
400
+ </xsl:apply-templates>
401
+ </xsl:template>
402
+
403
+ <!-- Any node with title element - clause, definition, annex,... -->
404
+ <xsl:template match="csd:title | csd:preferred" mode="contents">
405
+ <xsl:param name="sectionNum"/>
406
+ <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
407
+ <xsl:variable name="id">
408
+ <xsl:call-template name="getId"/>
409
+ </xsl:variable>
410
+
411
+ <xsl:variable name="level">
412
+ <xsl:call-template name="getLevel"/>
413
+ </xsl:variable>
414
+
415
+ <xsl:variable name="section">
416
+ <xsl:call-template name="getSection">
417
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
418
+ </xsl:call-template>
419
+ </xsl:variable>
420
+
421
+ <xsl:variable name="display">
422
+ <xsl:choose>
423
+ <xsl:when test="ancestor::csd:bibitem">false</xsl:when>
424
+ <xsl:when test="ancestor::csd:term">false</xsl:when>
425
+ <xsl:when test="ancestor::csd:annex and $level &gt;= 2">false</xsl:when>
426
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
427
+ <xsl:otherwise>false</xsl:otherwise>
428
+ </xsl:choose>
429
+ </xsl:variable>
430
+
431
+ <xsl:variable name="display-section">
432
+ <xsl:choose>
433
+ <xsl:when test="ancestor::csd:annex">false</xsl:when>
434
+ <xsl:otherwise>true</xsl:otherwise>
435
+ </xsl:choose>
436
+ </xsl:variable>
437
+
438
+ <xsl:variable name="type">
439
+ <xsl:value-of select="local-name(..)"/>
440
+ </xsl:variable>
441
+
442
+ <xsl:variable name="root">
443
+ <xsl:choose>
444
+ <xsl:when test="ancestor::csd:annex">annex</xsl:when>
445
+ <xsl:when test="ancestor::csd:clause">clause</xsl:when>
446
+ </xsl:choose>
447
+ </xsl:variable>
448
+
449
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
450
+ <xsl:attribute name="addon">
451
+ <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
452
+ </xsl:attribute>
453
+ <xsl:value-of select="."/>
454
+ </item>
455
+
456
+ <xsl:apply-templates mode="contents">
457
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
458
+ </xsl:apply-templates>
459
+
460
+ </xsl:template>
461
+
462
+
463
+ <xsl:template match="csd:figure" mode="contents">
464
+ <item level="" id="{@id}" display="false">
465
+ <xsl:attribute name="section">
466
+ <xsl:text>Figure </xsl:text><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
467
+ </xsl:attribute>
468
+ </item>
469
+ </xsl:template>
470
+
471
+
472
+ <xsl:template match="csd:table" mode="contents">
473
+ <xsl:param name="sectionNum"/>
474
+ <xsl:variable name="annex-id" select="ancestor::csd:annex/@id"/>
475
+ <item level="" id="{@id}" display="false" type="table">
476
+ <xsl:attribute name="section">
477
+ <xsl:text>Table </xsl:text>
478
+ <xsl:choose>
479
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
480
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
481
+ </xsl:when>
482
+ <xsl:when test="ancestor::*[local-name()='annex']">
483
+ <xsl:number format="A-" count="csd:annex"/>
484
+ <xsl:number format="1" level="any" count="csd:table[ancestor::csd:annex[@id = $annex-id]]"/>
485
+ </xsl:when>
486
+ <xsl:otherwise>
487
+ <!-- <xsl:number format="1"/> -->
488
+ <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
489
+ </xsl:otherwise>
490
+ </xsl:choose>
491
+ </xsl:attribute>
492
+ <xsl:value-of select="csd:name/text()"/>
493
+ </item>
494
+ </xsl:template>
495
+
496
+
497
+
498
+ <xsl:template match="csd:formula" mode="contents">
499
+ <item level="" id="{@id}" display="false">
500
+ <xsl:attribute name="section">
501
+ <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="csd:annex | csd:formula"/><xsl:text>)</xsl:text>
502
+ </xsl:attribute>
503
+ </item>
504
+ </xsl:template>
505
+ <!-- ============================= -->
506
+ <!-- ============================= -->
507
+
508
+
509
+ <xsl:template match="csd:license-statement//csd:title">
510
+ <fo:block text-align="center" font-weight="bold">
511
+ <xsl:apply-templates/>
512
+ </fo:block>
513
+ </xsl:template>
514
+
515
+ <xsl:template match="csd:license-statement//csd:p">
516
+ <fo:block margin-left="1.5mm" margin-right="1.5mm">
517
+ <xsl:if test="following-sibling::csd:p">
518
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
519
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
520
+ </xsl:if>
521
+ <xsl:apply-templates/>
522
+ </fo:block>
523
+ </xsl:template>
524
+
525
+ <!-- <fo:block margin-bottom="12pt">© ISO 2019, Published in Switzerland.</fo:block>
526
+ <fo:block font-size="10pt" margin-bottom="12pt">All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.</fo:block>
527
+ <fo:block font-size="10pt" text-indent="7.1mm">
528
+ <fo:block>ISO copyright office</fo:block>
529
+ <fo:block>Ch. de Blandonnet 8 • CP 401</fo:block>
530
+ <fo:block>CH-1214 Vernier, Geneva, Switzerland</fo:block>
531
+ <fo:block>Tel. + 41 22 749 01 11</fo:block>
532
+ <fo:block>Fax + 41 22 749 09 47</fo:block>
533
+ <fo:block>copyright@iso.org</fo:block>
534
+ <fo:block>www.iso.org</fo:block>
535
+ </fo:block> -->
536
+
537
+ <xsl:template match="csd:copyright-statement//csd:p">
538
+ <fo:block>
539
+ <xsl:if test="preceding-sibling::csd:p">
540
+ <!-- <xsl:attribute name="font-size">10pt</xsl:attribute> -->
541
+ </xsl:if>
542
+ <xsl:if test="following-sibling::csd:p">
543
+ <!-- <xsl:attribute name="margin-bottom">12pt</xsl:attribute> -->
544
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
545
+ </xsl:if>
546
+ <xsl:if test="not(following-sibling::csd:p)">
547
+ <!-- <xsl:attribute name="margin-left">7.1mm</xsl:attribute> -->
548
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
549
+ </xsl:if>
550
+ <xsl:apply-templates/>
551
+ </fo:block>
552
+ </xsl:template>
553
+
554
+ <!-- Foreword, Introduction -->
555
+ <xsl:template match="csd:csd-standard/csd:preface/*">
556
+ <fo:block break-after="page"/>
557
+ <!-- <fo:block> -->
558
+ <xsl:apply-templates/>
559
+ <!-- </fo:block> -->
560
+ </xsl:template>
561
+
562
+
563
+
564
+ <!-- clause, terms, clause, ...-->
565
+ <xsl:template match="csd:csd-standard/csd:sections/*">
566
+ <xsl:param name="sectionNum"/>
567
+ <xsl:param name="sectionNumSkew" select="0"/>
568
+ <fo:block>
569
+ <xsl:variable name="pos"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
570
+ <xsl:if test="$pos &gt;= 2">
571
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
572
+ </xsl:if>
573
+ <!-- pos=<xsl:value-of select="$pos" /> -->
574
+ <xsl:variable name="sectionNum_">
575
+ <xsl:choose>
576
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
577
+ <xsl:when test="$sectionNumSkew != 0">
578
+ <xsl:variable name="number"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
579
+ <xsl:value-of select="$number + $sectionNumSkew"/>
580
+ </xsl:when>
581
+ </xsl:choose>
582
+ </xsl:variable>
583
+ <xsl:if test="not(csd:title)">
584
+ <fo:block margin-top="3pt" margin-bottom="12pt">
585
+ <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="csd:clause"/>
586
+ </fo:block>
587
+ </xsl:if>
588
+ <xsl:apply-templates>
589
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
590
+ </xsl:apply-templates>
591
+ </fo:block>
592
+ </xsl:template>
593
+
594
+
595
+
596
+ <xsl:template match="csd:clause//csd:clause[not(csd:title)]">
597
+ <xsl:param name="sectionNum"/>
598
+ <xsl:variable name="section">
599
+ <xsl:call-template name="getSection">
600
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
601
+ </xsl:call-template>
602
+ </xsl:variable>
603
+
604
+ <fo:block margin-top="3pt"><!-- margin-bottom="6pt" -->
605
+ <fo:inline font-weight="bold" padding-right="3mm">
606
+ <xsl:value-of select="$section"/><!-- <xsl:number format=".1 " level="multiple" count="csd:clause/csd:clause" /> -->
607
+ </fo:inline>
608
+ <xsl:apply-templates>
609
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
610
+ <xsl:with-param name="inline" select="'true'"/>
611
+ </xsl:apply-templates>
612
+ </fo:block>
613
+ </xsl:template>
614
+
615
+
616
+ <xsl:template match="csd:title">
617
+ <xsl:param name="sectionNum"/>
618
+
619
+ <xsl:variable name="parent-name" select="local-name(..)"/>
620
+ <xsl:variable name="references_num_current">
621
+ <xsl:number level="any" count="csd:references"/>
622
+ </xsl:variable>
623
+
624
+ <xsl:variable name="id">
625
+ <xsl:call-template name="getId"/>
626
+ </xsl:variable>
627
+
628
+ <xsl:variable name="level">
629
+ <xsl:call-template name="getLevel"/>
630
+ </xsl:variable>
631
+
632
+ <xsl:variable name="section">
633
+ <xsl:call-template name="getSection">
634
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
635
+ </xsl:call-template>
636
+ </xsl:variable>
637
+
638
+ <xsl:variable name="font-size">
639
+ <xsl:choose>
640
+ <xsl:when test="ancestor::csd:preface">13pt</xsl:when>
641
+ <xsl:when test="$level = 1">13pt</xsl:when>
642
+ <xsl:when test="$level = 2">12pt</xsl:when>
643
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
644
+ <xsl:otherwise>16pt</xsl:otherwise>
645
+ </xsl:choose>
646
+ </xsl:variable>
647
+
648
+ <xsl:variable name="element-name">
649
+ <xsl:choose>
650
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
651
+ <xsl:otherwise>fo:block</xsl:otherwise>
652
+ </xsl:choose>
653
+ </xsl:variable>
654
+
655
+ <xsl:variable name="color" select="'rgb(14, 26, 133)'"/>
656
+
657
+ <xsl:element name="{$element-name}">
658
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
659
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
660
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
661
+ <!-- <xsl:attribute name="margin-top">
662
+ <xsl:choose>
663
+ <xsl:when test="$level = 2 and ancestor::annex">18pt</xsl:when>
664
+ <xsl:when test="$level = '' or $level = 1">6pt</xsl:when>
665
+ <xsl:otherwise>12pt</xsl:otherwise>
666
+ </xsl:choose>
667
+ </xsl:attribute> -->
668
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
669
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
670
+ <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
671
+ <xsl:if test="ancestor::csd:sections">
672
+ <xsl:attribute name="margin-top">13.5pt</xsl:attribute>
673
+ </xsl:if>
674
+ <!-- DEBUG level=<xsl:value-of select="$level"/>x -->
675
+ <!-- section=<xsl:value-of select="$sectionNum"/> -->
676
+ <!-- <xsl:if test="$sectionNum"> -->
677
+ <xsl:if test="$section != ''">
678
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
679
+ <xsl:choose>
680
+ <xsl:when test="$level &gt;= 3">
681
+ <fo:inline padding-right="2mm"> </fo:inline>
682
+ </xsl:when>
683
+ <xsl:when test="$level = 1">
684
+ <fo:inline padding-right="2mm"> </fo:inline>
685
+ </xsl:when>
686
+ <xsl:otherwise>
687
+ <fo:inline padding-right="1mm"> </fo:inline>
688
+ </xsl:otherwise>
689
+ </xsl:choose>
690
+ </xsl:if>
691
+ <xsl:apply-templates/>
692
+ </xsl:element>
693
+ </xsl:template>
694
+
695
+
696
+ <xsl:template match="csd:p">
697
+ <xsl:param name="inline" select="'false'"/>
698
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
699
+ <xsl:variable name="element-name">
700
+ <xsl:choose>
701
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
702
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
703
+ <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when>
704
+ <xsl:when test="@id = 'boilerplate-name'">fo:inline</xsl:when>
705
+ <xsl:otherwise>fo:block</xsl:otherwise>
706
+ </xsl:choose>
707
+ </xsl:variable>
708
+ <xsl:element name="{$element-name}">
709
+ <xsl:attribute name="text-align">
710
+ <xsl:choose>
711
+ <!-- <xsl:when test="ancestor::csd:preface">justify</xsl:when> -->
712
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
713
+ <xsl:otherwise>left</xsl:otherwise><!-- justify -->
714
+ </xsl:choose>
715
+ </xsl:attribute>
716
+ <xsl:attribute name="margin-bottom">
717
+ <xsl:choose>
718
+ <xsl:when test="ancestor::csd:li">0pt</xsl:when>
719
+ <xsl:otherwise>12pt</xsl:otherwise>
720
+ </xsl:choose>
721
+ </xsl:attribute>
722
+ <xsl:attribute name="line-height">115%</xsl:attribute>
723
+ <xsl:apply-templates/>
724
+ </xsl:element>
725
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
726
+ <fo:block margin-bottom="12pt">
727
+ <xsl:if test="ancestor::csd:annex">
728
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
729
+ </xsl:if>
730
+ <xsl:value-of select="$linebreak"/>
731
+ </fo:block>
732
+ </xsl:if>
733
+ <xsl:if test="$inline = 'true'">
734
+ <fo:block> </fo:block>
735
+ </xsl:if>
736
+ </xsl:template>
737
+
738
+ <!--
739
+ <fn reference="1">
740
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
741
+ </fn>
742
+ -->
743
+ <xsl:template match="csd:p/csd:fn">
744
+ <fo:footnote>
745
+ <xsl:variable name="number">
746
+ <xsl:number level="any" count="csd:p/csd:fn"/>
747
+ </xsl:variable>
748
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
749
+ <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
750
+ <!-- <xsl:value-of select="@reference"/> -->
751
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
752
+ </fo:basic-link>
753
+ </fo:inline>
754
+ <fo:footnote-body>
755
+ <fo:block font-size="10pt" margin-bottom="12pt">
756
+ <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
757
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
758
+ </fo:inline>
759
+ <xsl:for-each select="csd:p">
760
+ <xsl:apply-templates/>
761
+ </xsl:for-each>
762
+ </fo:block>
763
+ </fo:footnote-body>
764
+ </fo:footnote>
765
+ </xsl:template>
766
+
767
+ <xsl:template match="csd:p/csd:fn/csd:p">
768
+ <xsl:apply-templates/>
769
+ </xsl:template>
770
+
771
+ <xsl:template match="csd:review">
772
+ <!-- comment 2019-11-29 -->
773
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
774
+ <xsl:apply-templates /> -->
775
+ </xsl:template>
776
+
777
+ <xsl:template match="text()">
778
+ <xsl:value-of select="."/>
779
+ </xsl:template>
780
+
781
+
782
+
783
+ <xsl:template match="csd:image">
784
+ <fo:block-container text-align="center">
785
+ <fo:block>
786
+ <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
787
+ </fo:block>
788
+ <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">Figure <xsl:number format="1" level="any"/></fo:block>
789
+ </fo:block-container>
790
+
791
+ </xsl:template>
792
+
793
+ <xsl:template match="csd:figure">
794
+ <xsl:variable name="title">
795
+ <xsl:text>Figure </xsl:text>
796
+ </xsl:variable>
797
+
798
+ <fo:block-container id="{@id}">
799
+ <fo:block>
800
+ <xsl:apply-templates/>
801
+ </fo:block>
802
+ <xsl:call-template name="fn_display_figure"/>
803
+ <xsl:for-each select="csd:note//csd:p">
804
+ <xsl:call-template name="note"/>
805
+ </xsl:for-each>
806
+ <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
807
+
808
+ <xsl:choose>
809
+ <xsl:when test="ancestor::csd:annex">
810
+ <xsl:choose>
811
+ <xsl:when test="local-name(..) = 'figure'">
812
+ <xsl:number format="a) "/>
813
+ </xsl:when>
814
+ <xsl:otherwise>
815
+ <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
816
+ </xsl:otherwise>
817
+ </xsl:choose>
818
+
819
+ </xsl:when>
820
+ <xsl:otherwise>
821
+ <xsl:value-of select="$title"/><xsl:number format="1" level="any"/>
822
+ </xsl:otherwise>
823
+ </xsl:choose>
824
+ <xsl:if test="csd:name">
825
+ <xsl:if test="not(local-name(..) = 'figure')">
826
+ <xsl:text> — </xsl:text>
827
+ </xsl:if>
828
+ <xsl:value-of select="csd:name"/>
829
+ </xsl:if>
830
+ </fo:block>
831
+ </fo:block-container>
832
+ </xsl:template>
833
+
834
+ <xsl:template match="csd:figure/csd:name"/>
835
+ <xsl:template match="csd:figure/csd:fn"/>
836
+ <xsl:template match="csd:figure/csd:note"/>
837
+
838
+
839
+ <xsl:template match="csd:figure/csd:image">
840
+ <fo:block text-align="center">
841
+ <fo:external-graphic src="{@src}" content-width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
842
+ </fo:block>
843
+ </xsl:template>
844
+
845
+
846
+ <xsl:template match="csd:bibitem">
847
+ <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
848
+ <xsl:if test=".//csd:fn">
849
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
850
+ </xsl:if>
851
+ <!-- csd:docidentifier -->
852
+ <xsl:if test="csd:docidentifier">
853
+ <xsl:choose>
854
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
855
+ <xsl:otherwise>
856
+ <xsl:value-of select="csd:docidentifier"/>
857
+ </xsl:otherwise>
858
+ </xsl:choose>
859
+ </xsl:if>
860
+ <xsl:apply-templates select="csd:note"/>
861
+ <xsl:if test="csd:docidentifier">, </xsl:if>
862
+ <fo:inline font-style="italic">
863
+ <xsl:choose>
864
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
865
+ <xsl:value-of select="csd:title[@type = 'main' and @language = 'en']"/>
866
+ </xsl:when>
867
+ <xsl:otherwise>
868
+ <xsl:value-of select="csd:title"/>
869
+ </xsl:otherwise>
870
+ </xsl:choose>
871
+ </fo:inline>
872
+ </fo:block>
873
+ </xsl:template>
874
+
875
+
876
+ <xsl:template match="csd:bibitem/csd:note">
877
+ <fo:footnote>
878
+ <xsl:variable name="number">
879
+ <xsl:choose>
880
+ <xsl:when test="ancestor::csd:references[preceding-sibling::csd:references]">
881
+ <xsl:number level="any" count="csd:references[preceding-sibling::csd:references]//csd:bibitem/csd:note"/>
882
+ </xsl:when>
883
+ <xsl:otherwise>
884
+ <xsl:number level="any" count="csd:bibitem/csd:note"/>
885
+ </xsl:otherwise>
886
+ </xsl:choose>
887
+ </xsl:variable>
888
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
889
+ <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
890
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
891
+ </fo:basic-link>
892
+ </fo:inline>
893
+ <fo:footnote-body>
894
+ <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
895
+ <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
896
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
897
+ </fo:inline>
898
+ <xsl:apply-templates/>
899
+ </fo:block>
900
+ </fo:footnote-body>
901
+ </fo:footnote>
902
+ </xsl:template>
903
+
904
+
905
+
906
+ <xsl:template match="csd:ul | csd:ol">
907
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt">
908
+ <xsl:if test="ancestor::csd:ol">
909
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
910
+ </xsl:if>
911
+ <xsl:apply-templates/>
912
+ </fo:list-block>
913
+ </xsl:template>
914
+
915
+ <xsl:template match="csd:li">
916
+ <fo:list-item>
917
+ <fo:list-item-label end-indent="label-end()">
918
+ <fo:block>
919
+ <xsl:choose>
920
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
921
+ <xsl:otherwise> <!-- for ordered lists -->
922
+ <xsl:choose>
923
+ <xsl:when test="../@type = 'arabic'">
924
+ <xsl:number format="a)"/>
925
+ </xsl:when>
926
+ <xsl:when test="../@type = 'alphabet'">
927
+ <xsl:number format="1)"/>
928
+ </xsl:when>
929
+ <xsl:otherwise>
930
+ <xsl:number format="1."/>
931
+ </xsl:otherwise>
932
+ </xsl:choose>
933
+ </xsl:otherwise>
934
+ </xsl:choose>
935
+ </fo:block>
936
+ </fo:list-item-label>
937
+ <fo:list-item-body start-indent="body-start()">
938
+ <xsl:apply-templates/>
939
+ </fo:list-item-body>
940
+ </fo:list-item>
941
+ </xsl:template>
942
+
943
+ <xsl:template match="csd:preferred">
944
+ <xsl:param name="sectionNum"/>
945
+ <xsl:variable name="section">
946
+ <xsl:call-template name="getSection">
947
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
948
+ </xsl:call-template>
949
+ </xsl:variable>
950
+ <xsl:variable name="level">
951
+ <xsl:call-template name="getLevel"/>
952
+ </xsl:variable>
953
+ <xsl:variable name="font-size">
954
+ <xsl:choose>
955
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
956
+ <xsl:otherwise>12pt</xsl:otherwise>
957
+ </xsl:choose>
958
+ </xsl:variable>
959
+ <fo:block font-size="{$font-size}" line-height="1.1">
960
+ <fo:block font-weight="bold" keep-with-next="always">
961
+ <fo:inline id="{../@id}">
962
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
963
+ <!-- <xsl:value-of select="$sectionNum"/>.<xsl:number count="csd:term"/> -->
964
+ </fo:inline>
965
+ </fo:block>
966
+ <fo:block font-weight="bold" keep-with-next="always">
967
+ <xsl:apply-templates/>
968
+ </fo:block>
969
+ </fo:block>
970
+ </xsl:template>
971
+
972
+ <xsl:template match="csd:admitted">
973
+ <fo:block>
974
+ <xsl:apply-templates/>
975
+ </fo:block>
976
+ </xsl:template>
977
+
978
+ <xsl:template match="csd:deprecates">
979
+ <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
980
+ </xsl:template>
981
+
982
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]">
983
+ <xsl:apply-templates/>
984
+ </xsl:template>
985
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]/csd:p">
986
+ <fo:inline> <xsl:apply-templates/></fo:inline>
987
+ <fo:block> </fo:block>
988
+ </xsl:template>
989
+
990
+ <xsl:template match="csd:definition">
991
+ <fo:block margin-bottom="6pt">
992
+ <xsl:apply-templates/>
993
+ </fo:block>
994
+ </xsl:template>
995
+
996
+ <xsl:template match="csd:termsource">
997
+ <fo:block margin-bottom="8pt" keep-with-previous="always">
998
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
999
+ <fo:basic-link internal-destination="{csd:origin/@bibitemid}" fox:alt-text="{csd:origin/@citeas}">
1000
+ <xsl:text>[SOURCE: </xsl:text>
1001
+ <xsl:value-of select="csd:origin/@citeas"/>
1002
+
1003
+ <xsl:apply-templates select="csd:origin/csd:localityStack"/>
1004
+
1005
+ </fo:basic-link>
1006
+ <xsl:apply-templates select="csd:modification"/>
1007
+ <xsl:text>]</xsl:text>
1008
+ </fo:block>
1009
+ </xsl:template>
1010
+
1011
+ <xsl:template match="csd:modification">
1012
+ <xsl:text>, modified — </xsl:text>
1013
+ <xsl:apply-templates/>
1014
+ </xsl:template>
1015
+ <xsl:template match="csd:modification/csd:p">
1016
+ <fo:inline><xsl:apply-templates/></fo:inline>
1017
+ </xsl:template>
1018
+
1019
+ <xsl:template match="csd:termnote">
1020
+ <fo:block font-size="10pt" margin-bottom="12pt">
1021
+ <xsl:text>Note </xsl:text>
1022
+ <xsl:number/>
1023
+ <xsl:text> to entry: </xsl:text>
1024
+ <xsl:apply-templates/>
1025
+ </fo:block>
1026
+ </xsl:template>
1027
+
1028
+ <xsl:template match="csd:termnote/csd:p">
1029
+ <fo:inline><xsl:apply-templates/></fo:inline>
1030
+ </xsl:template>
1031
+
1032
+ <xsl:template match="csd:domain">
1033
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
1034
+ </xsl:template>
1035
+
1036
+
1037
+ <xsl:template match="csd:termexample">
1038
+ <fo:block font-size="10pt" margin-bottom="12pt">
1039
+ <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1040
+ <xsl:apply-templates/>
1041
+ </fo:block>
1042
+ </xsl:template>
1043
+
1044
+ <xsl:template match="csd:termexample/csd:p">
1045
+ <fo:inline><xsl:apply-templates/></fo:inline>
1046
+ </xsl:template>
1047
+
1048
+
1049
+ <xsl:template match="csd:annex">
1050
+ <fo:block break-after="page"/>
1051
+ <xsl:apply-templates/>
1052
+ </xsl:template>
1053
+
1054
+
1055
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']"> -->
1056
+ <xsl:template match="csd:references[position() &gt; 1]">
1057
+ <fo:block break-after="page"/>
1058
+ <xsl:apply-templates/>
1059
+ </xsl:template>
1060
+
1061
+
1062
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1063
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem"> -->
1064
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem">
1065
+ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1066
+ <fo:list-item>
1067
+ <fo:list-item-label end-indent="label-end()">
1068
+ <fo:block>
1069
+ <fo:inline id="{@id}">
1070
+ <xsl:number format="[1]"/>
1071
+ </fo:inline>
1072
+ </fo:block>
1073
+ </fo:list-item-label>
1074
+ <fo:list-item-body start-indent="body-start()">
1075
+ <fo:block>
1076
+ <xsl:if test="csd:docidentifier">
1077
+ <xsl:choose>
1078
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
1079
+ <xsl:otherwise><fo:inline><xsl:value-of select="csd:docidentifier"/><xsl:apply-templates select="csd:note"/>, </fo:inline></xsl:otherwise>
1080
+ </xsl:choose>
1081
+
1082
+ </xsl:if>
1083
+ <xsl:choose>
1084
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
1085
+ <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/>
1086
+ </xsl:when>
1087
+ <xsl:otherwise>
1088
+ <xsl:apply-templates select="csd:title"/>
1089
+ </xsl:otherwise>
1090
+ </xsl:choose>
1091
+ <xsl:apply-templates select="csd:formattedref"/>
1092
+ </fo:block>
1093
+ </fo:list-item-body>
1094
+ </fo:list-item>
1095
+ </fo:list-block>
1096
+ </xsl:template>
1097
+
1098
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> -->
1099
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem" mode="contents"/>
1100
+
1101
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> -->
1102
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem/csd:title">
1103
+ <fo:inline font-style="italic">
1104
+ <xsl:apply-templates/>
1105
+ </fo:inline>
1106
+ </xsl:template>
1107
+
1108
+ <xsl:template match="csd:quote">
1109
+ <fo:block margin-top="12pt" margin-left="12mm" margin-right="12mm">
1110
+ <xsl:apply-templates select=".//csd:p"/>
1111
+ </fo:block>
1112
+ <fo:block text-align="right">
1113
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1114
+ <xsl:text>— </xsl:text><xsl:value-of select="csd:author"/>
1115
+ <xsl:if test="csd:source">
1116
+ <xsl:text>, </xsl:text>
1117
+ <xsl:apply-templates select="csd:source"/>
1118
+ </xsl:if>
1119
+ </fo:block>
1120
+ </xsl:template>
1121
+
1122
+ <xsl:template match="csd:source">
1123
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1124
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1125
+ <xsl:apply-templates select="csd:localityStack"/>
1126
+ </fo:basic-link>
1127
+ </xsl:template>
1128
+
1129
+ <xsl:template match="csd:appendix">
1130
+ <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1131
+ <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1132
+ <xsl:apply-templates select="csd:title" mode="process"/>
1133
+ </fo:block>
1134
+ <xsl:apply-templates/>
1135
+ </xsl:template>
1136
+
1137
+ <xsl:template match="csd:appendix//csd:example">
1138
+ <fo:block font-size="10pt" margin-bottom="12pt">
1139
+ <xsl:text>EXAMPLE</xsl:text>
1140
+ <xsl:if test="csd:name">
1141
+ <xsl:text> — </xsl:text><xsl:apply-templates select="csd:name" mode="process"/>
1142
+ </xsl:if>
1143
+ </fo:block>
1144
+ <xsl:apply-templates/>
1145
+ </xsl:template>
1146
+
1147
+ <xsl:template match="csd:appendix//csd:example/csd:name"/>
1148
+ <xsl:template match="csd:appendix//csd:example/csd:name" mode="process">
1149
+ <fo:inline><xsl:apply-templates/></fo:inline>
1150
+ </xsl:template>
1151
+
1152
+ <!-- <xsl:template match="csd:callout/text()">
1153
+ <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
1154
+ </xsl:template> -->
1155
+ <xsl:template match="csd:callout">
1156
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1157
+ </xsl:template>
1158
+
1159
+ <xsl:template match="csd:annotation">
1160
+ <fo:block>
1161
+
1162
+ </fo:block>
1163
+ <xsl:apply-templates/>
1164
+ </xsl:template>
1165
+
1166
+ <xsl:template match="csd:annotation/text()"/>
1167
+
1168
+ <xsl:template match="csd:annotation/csd:p">
1169
+ <xsl:variable name="annotation-id" select="../@id"/>
1170
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1171
+ <fo:block id="{$annotation-id}">
1172
+ <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1173
+ <xsl:apply-templates/>
1174
+ </fo:block>
1175
+ </xsl:template>
1176
+
1177
+
1178
+ <xsl:template match="csd:appendix/csd:title"/>
1179
+ <xsl:template match="csd:appendix/csd:title" mode="process">
1180
+ <fo:inline><xsl:apply-templates/></fo:inline>
1181
+ </xsl:template>
1182
+
1183
+
1184
+ <xsl:template match="csd:xref">
1185
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
1186
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1187
+ <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))">
1188
+ <xsl:attribute name="color">blue</xsl:attribute>
1189
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1190
+ </xsl:if>
1191
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1192
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1193
+ <xsl:choose>
1194
+ <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1195
+ <xsl:when test="$type = 'term' and $root = 'clause'">Clause </xsl:when>
1196
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1197
+ </xsl:choose>
1198
+ <xsl:value-of select="$section"/>
1199
+ </fo:basic-link>
1200
+ </xsl:template>
1201
+
1202
+ <xsl:template match="csd:sourcecode">
1203
+ <fo:block font-family="SourceCodePro" font-size="10pt" margin-bottom="6pt" keep-with-next="always">
1204
+ <xsl:choose>
1205
+ <xsl:when test="@lang = 'en'"/>
1206
+ <xsl:otherwise>
1207
+ <xsl:attribute name="white-space">pre</xsl:attribute>
1208
+ </xsl:otherwise>
1209
+ </xsl:choose>
1210
+ <xsl:apply-templates/>
1211
+ </fo:block>
1212
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1213
+ <xsl:text>Figure </xsl:text>
1214
+ <xsl:number format="1" level="any"/>
1215
+ </fo:block>
1216
+ </xsl:template>
1217
+
1218
+ <xsl:template match="csd:tt" priority="2">
1219
+ <fo:inline font-family="SourceCodePro" font-size="10pt">
1220
+ <xsl:apply-templates/>
1221
+ </fo:inline>
1222
+ </xsl:template>
1223
+
1224
+ <xsl:template match="csd:example">
1225
+ <fo:block font-size="10pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1226
+ <xsl:text>EXAMPLE</xsl:text>
1227
+ <xsl:if test="following-sibling::csd:example or preceding-sibling::csd:example">
1228
+ <xsl:number format=" 1"/>
1229
+ </xsl:if>
1230
+ </fo:block>
1231
+ <fo:block font-size="10pt" margin-left="12.5mm">
1232
+ <xsl:apply-templates/>
1233
+ </fo:block>
1234
+ </xsl:template>
1235
+
1236
+ <xsl:template match="csd:example/csd:p">
1237
+ <fo:block margin-bottom="14pt">
1238
+ <xsl:apply-templates/>
1239
+ </fo:block>
1240
+ </xsl:template>
1241
+
1242
+ <xsl:template match="csd:note/csd:p" name="note">
1243
+ <fo:block font-size="10pt" margin-bottom="12pt">
1244
+ <fo:inline padding-right="6mm">NOTE <xsl:number count="csd:note"/></fo:inline>
1245
+ <xsl:apply-templates/>
1246
+ </fo:block>
1247
+ </xsl:template>
1248
+
1249
+ <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
1250
+ <xsl:template match="csd:eref">
1251
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}" color="blue" text-decoration="underline"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1252
+ <xsl:if test="@type = 'footnote'">
1253
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1254
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1255
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1256
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1257
+ </xsl:if>
1258
+ <xsl:if test="@type = 'inline'">
1259
+ <xsl:attribute name="color">blue</xsl:attribute>
1260
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1261
+ </xsl:if>
1262
+ <!-- <xsl:if test="@type = 'inline'">
1263
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1264
+ </xsl:if> -->
1265
+ <xsl:choose>
1266
+ <xsl:when test="@citeas">
1267
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1268
+ </xsl:when>
1269
+ <xsl:when test="@bibitemid">
1270
+ <xsl:value-of select="//csd:bibitem[@id = current()/@bibitemid]/csd:docidentifier"/>
1271
+ </xsl:when>
1272
+ <xsl:otherwise/>
1273
+ </xsl:choose>
1274
+ <xsl:apply-templates select="csd:localityStack"/>
1275
+ </fo:basic-link>
1276
+ </xsl:template>
1277
+
1278
+ <xsl:template match="csd:locality">
1279
+ <xsl:choose>
1280
+ <xsl:when test="@type ='clause'">Clause </xsl:when>
1281
+ <xsl:when test="@type ='annex'">Annex </xsl:when>
1282
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1283
+ </xsl:choose>
1284
+ <xsl:text> </xsl:text><xsl:value-of select="csd:referenceFrom"/>
1285
+ </xsl:template>
1286
+
1287
+ <xsl:template match="csd:admonition">
1288
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1289
+ <xsl:value-of select="translate(@type, $lower, $upper)"/>
1290
+ <xsl:text> — </xsl:text>
1291
+ <xsl:apply-templates/>
1292
+ </fo:block>
1293
+ </xsl:template>
1294
+
1295
+ <xsl:template match="csd:formula/csd:dt/csd:stem">
1296
+ <fo:inline>
1297
+ <xsl:apply-templates/>
1298
+ </fo:inline>
1299
+ </xsl:template>
1300
+
1301
+ <xsl:template match="csd:formula/csd:stem">
1302
+ <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1303
+ <fo:table table-layout="fixed" width="100%">
1304
+ <fo:table-column column-width="95%"/>
1305
+ <fo:table-column column-width="5%"/>
1306
+ <fo:table-body>
1307
+ <fo:table-row>
1308
+ <fo:table-cell display-align="center">
1309
+ <fo:block text-align="left" margin-left="5mm">
1310
+ <xsl:apply-templates/>
1311
+ </fo:block>
1312
+ </fo:table-cell>
1313
+ <fo:table-cell display-align="center">
1314
+ <fo:block text-align="right">
1315
+ <xsl:choose>
1316
+ <xsl:when test="ancestor::csd:annex">
1317
+ <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="csd:annex | csd:formula"/><xsl:text>)</xsl:text>
1318
+ </xsl:when>
1319
+ <xsl:otherwise> <!-- not(ancestor::csd:annex) -->
1320
+ <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="csd:formula"/><xsl:text>)</xsl:text> -->
1321
+ </xsl:otherwise>
1322
+ </xsl:choose>
1323
+ </fo:block>
1324
+ </fo:table-cell>
1325
+ </fo:table-row>
1326
+ </fo:table-body>
1327
+ </fo:table>
1328
+ <fo:inline keep-together.within-line="always">
1329
+ </fo:inline>
1330
+ </fo:block>
1331
+ </xsl:template>
1332
+
1333
+
1334
+ <xsl:template match="csd:br" priority="2">
1335
+ <!-- <fo:block>&#xA0;</fo:block> -->
1336
+ <xsl:value-of select="$linebreak"/>
1337
+ </xsl:template>
1338
+
1339
+ <xsl:template name="insertHeaderFooter">
1340
+ <fo:static-content flow-name="header-even">
1341
+ <fo:block-container height="17mm" display-align="before">
1342
+ <fo:block padding-top="12.5mm">
1343
+ <xsl:value-of select="$header"/>
1344
+ </fo:block>
1345
+ </fo:block-container>
1346
+ </fo:static-content>
1347
+ <fo:static-content flow-name="footer-even">
1348
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1349
+ <fo:table table-layout="fixed" width="100%">
1350
+ <fo:table-column column-width="10%"/>
1351
+ <fo:table-column column-width="90%"/>
1352
+ <fo:table-body>
1353
+ <fo:table-row>
1354
+ <fo:table-cell>
1355
+ <fo:block padding-bottom="5mm"><fo:page-number/></fo:block>
1356
+ </fo:table-cell>
1357
+ <fo:table-cell padding-right="2mm">
1358
+ <fo:block padding-bottom="5mm" text-align="right"><xsl:value-of select="$copyright"/></fo:block>
1359
+ </fo:table-cell>
1360
+ </fo:table-row>
1361
+ </fo:table-body>
1362
+ </fo:table>
1363
+ </fo:block-container>
1364
+ </fo:static-content>
1365
+ <fo:static-content flow-name="header-odd">
1366
+ <fo:block-container height="17mm" display-align="before">
1367
+ <fo:block text-align="right" padding-top="12.5mm">
1368
+ <xsl:value-of select="$header"/>
1369
+ </fo:block>
1370
+ </fo:block-container>
1371
+ </fo:static-content>
1372
+ <fo:static-content flow-name="footer-odd">
1373
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1374
+ <fo:table table-layout="fixed" width="100%">
1375
+ <fo:table-column column-width="90%"/>
1376
+ <fo:table-column column-width="10%"/>
1377
+ <fo:table-body>
1378
+ <fo:table-row>
1379
+ <fo:table-cell>
1380
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
1381
+ </fo:table-cell>
1382
+ <fo:table-cell padding-right="2mm">
1383
+ <fo:block padding-bottom="5mm" text-align="right"><fo:page-number/></fo:block>
1384
+ </fo:table-cell>
1385
+ </fo:table-row>
1386
+ </fo:table-body>
1387
+ </fo:table>
1388
+ </fo:block-container>
1389
+ </fo:static-content>
1390
+ </xsl:template>
1391
+
1392
+ <xsl:template name="getId">
1393
+ <xsl:choose>
1394
+ <xsl:when test="../@id">
1395
+ <xsl:value-of select="../@id"/>
1396
+ </xsl:when>
1397
+ <xsl:otherwise>
1398
+ <xsl:value-of select="text()"/>
1399
+ </xsl:otherwise>
1400
+ </xsl:choose>
1401
+ </xsl:template>
1402
+
1403
+ <xsl:template name="getLevel">
1404
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
1405
+ <xsl:variable name="level">
1406
+ <xsl:choose>
1407
+ <xsl:when test="ancestor::csd:preface">
1408
+ <xsl:value-of select="$level_total - 2"/>
1409
+ </xsl:when>
1410
+ <xsl:when test="ancestor::csd:sections">
1411
+ <xsl:value-of select="$level_total - 2"/>
1412
+ </xsl:when>
1413
+ <xsl:when test="ancestor::csd:bibliography">
1414
+ <xsl:value-of select="$level_total - 2"/>
1415
+ </xsl:when>
1416
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1417
+ <xsl:otherwise>
1418
+ <xsl:value-of select="$level_total - 1"/>
1419
+ </xsl:otherwise>
1420
+ </xsl:choose>
1421
+ </xsl:variable>
1422
+ <xsl:value-of select="$level"/>
1423
+ </xsl:template>
1424
+
1425
+ <xsl:template name="getSection">
1426
+ <xsl:param name="sectionNum"/>
1427
+ <xsl:variable name="level">
1428
+ <xsl:call-template name="getLevel"/>
1429
+ </xsl:variable>
1430
+ <xsl:variable name="section">
1431
+ <xsl:choose>
1432
+ <xsl:when test="ancestor::csd:bibliography">
1433
+ <xsl:value-of select="$sectionNum"/>
1434
+ </xsl:when>
1435
+ <xsl:when test="ancestor::csd:sections">
1436
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1437
+ <xsl:choose>
1438
+ <xsl:when test="$level = 1">
1439
+ <xsl:value-of select="$sectionNum"/>
1440
+ </xsl:when>
1441
+ <xsl:when test="$level &gt;= 2">
1442
+ <xsl:variable name="num">
1443
+ <xsl:number format=".1" level="multiple" count="csd:clause/csd:clause | csd:clause/csd:terms | csd:terms/csd:term | csd:clause/csd:term | csd:clause/csd:definitions | csd:definitions/csd:definitions"/>
1444
+ </xsl:variable>
1445
+ <xsl:value-of select="concat($sectionNum, $num)"/>
1446
+ </xsl:when>
1447
+ <xsl:otherwise>
1448
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1449
+ </xsl:otherwise>
1450
+ </xsl:choose>
1451
+ <!-- <xsl:text>.</xsl:text> -->
1452
+ </xsl:when>
1453
+ <!-- <xsl:when test="ancestor::csd:annex[@obligation = 'informative']">
1454
+ <xsl:choose>
1455
+ <xsl:when test="$level = 1">
1456
+ <xsl:text>Annex </xsl:text>
1457
+ <xsl:number format="I" level="any" count="csd:annex[@obligation = 'informative']"/>
1458
+ </xsl:when>
1459
+ <xsl:otherwise>
1460
+ <xsl:number format="I.1" level="multiple" count="csd:annex[@obligation = 'informative'] | csd:clause"/>
1461
+ </xsl:otherwise>
1462
+ </xsl:choose>
1463
+ </xsl:when> -->
1464
+ <xsl:when test="ancestor::csd:annex">
1465
+ <xsl:choose>
1466
+ <xsl:when test="$level = 1">
1467
+ <xsl:text>Annex </xsl:text>
1468
+ <xsl:choose>
1469
+ <xsl:when test="count(//csd:annex) = 1">
1470
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/>
1471
+ </xsl:when>
1472
+ <xsl:otherwise>
1473
+ <xsl:number format="A." level="any" count="csd:annex"/>
1474
+ </xsl:otherwise>
1475
+ </xsl:choose>
1476
+ </xsl:when>
1477
+ <xsl:otherwise>
1478
+ <xsl:choose>
1479
+ <xsl:when test="count(//csd:annex) = 1">
1480
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/><xsl:number format=".1" level="multiple" count="csd:clause"/>
1481
+ </xsl:when>
1482
+ <xsl:otherwise>
1483
+ <xsl:number format="A.1." level="multiple" count="csd:annex | csd:clause"/>
1484
+ </xsl:otherwise>
1485
+ </xsl:choose>
1486
+ </xsl:otherwise>
1487
+ </xsl:choose>
1488
+ </xsl:when>
1489
+ <xsl:when test="ancestor::csd:preface"> <!-- if preface and there is clause(s) -->
1490
+ <xsl:choose>
1491
+ <xsl:when test="$level = 1 and ..//csd:clause">0</xsl:when>
1492
+ <xsl:when test="$level &gt;= 2">
1493
+ <xsl:variable name="num">
1494
+ <xsl:number format=".1." level="multiple" count="csd:clause"/>
1495
+ </xsl:variable>
1496
+ <xsl:value-of select="concat('0', $num)"/>
1497
+ </xsl:when>
1498
+ <xsl:otherwise>
1499
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1500
+ </xsl:otherwise>
1501
+ </xsl:choose>
1502
+ </xsl:when>
1503
+ <xsl:otherwise>
1504
+ </xsl:otherwise>
1505
+ </xsl:choose>
1506
+ </xsl:variable>
1507
+ <xsl:value-of select="$section"/>
1508
+ </xsl:template>
1509
+
1510
+ <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
1511
+
1512
+ <xsl:attribute name="color">blue</xsl:attribute>
1513
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1514
+
1515
+
1516
+ </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
1517
+ <xsl:value-of select="."/>
1518
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
1519
+ <xsl:value-of select="$linebreak"/>
1520
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1521
+ <xsl:call-template name="add-zero-spaces"/>
1522
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
1523
+
1524
+ <xsl:variable name="simple-table">
1525
+ <!-- <xsl:copy> -->
1526
+ <xsl:call-template name="getSimpleTable"/>
1527
+ <!-- </xsl:copy> -->
1528
+ </xsl:variable>
1529
+
1530
+ <!-- DEBUG -->
1531
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
1532
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
1533
+
1534
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
1535
+
1536
+ <!-- <xsl:if test="$namespace = 'iso'">
1537
+ <fo:block space-before="6pt">&#xA0;</fo:block>
1538
+ </xsl:if> -->
1539
+
1540
+ <xsl:choose>
1541
+ <xsl:when test="@unnumbered = 'true'"/>
1542
+ <xsl:otherwise>
1543
+
1544
+
1545
+
1546
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
1547
+
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+ <xsl:text>Table </xsl:text>
1555
+ <xsl:choose>
1556
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1557
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
1558
+ </xsl:when>
1559
+ <xsl:when test="ancestor::*[local-name()='annex']">
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+
1566
+
1567
+
1568
+ <xsl:number format="A-1" level="multiple" count="*[local-name()='annex'] | *[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'] "/>
1569
+
1570
+ </xsl:when>
1571
+ <xsl:otherwise>
1572
+
1573
+
1574
+ <xsl:number format="A." count="*[local-name()='annex']"/>
1575
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
1576
+
1577
+ </xsl:otherwise>
1578
+ </xsl:choose>
1579
+ <xsl:if test="*[local-name()='name']">
1580
+
1581
+
1582
+
1583
+ <xsl:text> — </xsl:text>
1584
+
1585
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
1586
+ </xsl:if>
1587
+ </fo:block>
1588
+
1589
+
1590
+ <xsl:call-template name="fn_name_display"/>
1591
+
1592
+ </xsl:otherwise>
1593
+ </xsl:choose>
1594
+
1595
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1596
+
1597
+ <!-- <xsl:variable name="cols-count">
1598
+ <xsl:choose>
1599
+ <xsl:when test="*[local-name()='thead']">
1600
+ <xsl:call-template name="calculate-columns-numbers">
1601
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1602
+ </xsl:call-template>
1603
+ </xsl:when>
1604
+ <xsl:otherwise>
1605
+ <xsl:call-template name="calculate-columns-numbers">
1606
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1607
+ </xsl:call-template>
1608
+ </xsl:otherwise>
1609
+ </xsl:choose>
1610
+ </xsl:variable> -->
1611
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1612
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1613
+
1614
+
1615
+
1616
+ <xsl:variable name="colwidths">
1617
+ <xsl:call-template name="calculate-column-widths">
1618
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1619
+ <xsl:with-param name="table" select="$simple-table"/>
1620
+ </xsl:call-template>
1621
+ </xsl:variable>
1622
+
1623
+ <!-- <xsl:variable name="colwidths2">
1624
+ <xsl:call-template name="calculate-column-widths">
1625
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1626
+ </xsl:call-template>
1627
+ </xsl:variable> -->
1628
+
1629
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1630
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1631
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1632
+
1633
+ <xsl:variable name="margin-left">
1634
+ <xsl:choose>
1635
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1636
+ <xsl:otherwise>0</xsl:otherwise>
1637
+ </xsl:choose>
1638
+ </xsl:variable>
1639
+
1640
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1641
+
1642
+
1643
+
1644
+
1645
+
1646
+
1647
+
1648
+ <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
1649
+
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1659
+
1660
+
1661
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1662
+ <xsl:choose>
1663
+ <xsl:when test=". = 1">
1664
+ <fo:table-column column-width="proportional-column-width(2)"/>
1665
+ </xsl:when>
1666
+ <xsl:otherwise>
1667
+ <fo:table-column column-width="proportional-column-width({.})"/>
1668
+ </xsl:otherwise>
1669
+ </xsl:choose>
1670
+ </xsl:for-each>
1671
+ <xsl:apply-templates/>
1672
+ </fo:table>
1673
+
1674
+
1675
+
1676
+ </fo:block-container>
1677
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
1678
+ <xsl:apply-templates/>
1679
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
1680
+ <xsl:param name="table-row"/>
1681
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
1682
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
1683
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
1684
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
1685
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
1686
+ <xsl:param name="table"/>
1687
+ <xsl:param name="cols-count"/>
1688
+ <xsl:param name="curr-col" select="1"/>
1689
+ <xsl:param name="width" select="0"/>
1690
+
1691
+ <xsl:if test="$curr-col &lt;= $cols-count">
1692
+ <xsl:variable name="widths">
1693
+ <xsl:choose>
1694
+ <xsl:when test="not($table)">
1695
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
1696
+ <xsl:variable name="words">
1697
+ <xsl:call-template name="tokenize">
1698
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
1699
+ </xsl:call-template>
1700
+ </xsl:variable>
1701
+ <xsl:variable name="max_length">
1702
+ <xsl:call-template name="max_length">
1703
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1704
+ </xsl:call-template>
1705
+ </xsl:variable>
1706
+ <width>
1707
+ <xsl:value-of select="$max_length"/>
1708
+ </width>
1709
+ </xsl:for-each>
1710
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
1711
+ <xsl:variable name="words">
1712
+ <xsl:call-template name="tokenize">
1713
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
1714
+ </xsl:call-template>
1715
+ </xsl:variable>
1716
+ <xsl:variable name="max_length">
1717
+ <xsl:call-template name="max_length">
1718
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1719
+ </xsl:call-template>
1720
+ </xsl:variable>
1721
+ <width>
1722
+ <xsl:value-of select="$max_length"/>
1723
+ </width>
1724
+
1725
+ </xsl:for-each>
1726
+ </xsl:when>
1727
+ <xsl:otherwise>
1728
+ <xsl:for-each select="xalan:nodeset($table)//tr">
1729
+ <xsl:variable name="td_text">
1730
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1731
+ </xsl:variable>
1732
+ <xsl:variable name="words">
1733
+ <xsl:call-template name="tokenize">
1734
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
1735
+ <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
1736
+ </xsl:call-template>
1737
+ </xsl:variable>
1738
+ <xsl:variable name="max_length">
1739
+ <xsl:call-template name="max_length">
1740
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1741
+ </xsl:call-template>
1742
+ </xsl:variable>
1743
+ <width>
1744
+ <xsl:variable name="divider">
1745
+ <xsl:choose>
1746
+ <xsl:when test="td[$curr-col]/@divide">
1747
+ <xsl:value-of select="td[$curr-col]/@divide"/>
1748
+ </xsl:when>
1749
+ <xsl:otherwise>1</xsl:otherwise>
1750
+ </xsl:choose>
1751
+ </xsl:variable>
1752
+ <xsl:value-of select="$max_length div $divider"/>
1753
+ </width>
1754
+
1755
+ </xsl:for-each>
1756
+
1757
+ </xsl:otherwise>
1758
+ </xsl:choose>
1759
+ </xsl:variable>
1760
+
1761
+
1762
+ <column>
1763
+ <xsl:for-each select="xalan:nodeset($widths)//width">
1764
+ <xsl:sort select="." data-type="number" order="descending"/>
1765
+ <xsl:if test="position()=1">
1766
+ <xsl:value-of select="."/>
1767
+ </xsl:if>
1768
+ </xsl:for-each>
1769
+ </column>
1770
+ <xsl:call-template name="calculate-column-widths">
1771
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1772
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
1773
+ <xsl:with-param name="table" select="$table"/>
1774
+ </xsl:call-template>
1775
+ </xsl:if>
1776
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
1777
+ <xsl:variable name="zero-space">​</xsl:variable>
1778
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
1779
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
1780
+ <!-- font-weight="bold" -->
1781
+ <fo:table-header>
1782
+ <xsl:apply-templates/>
1783
+ </fo:table-header>
1784
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
1785
+ <xsl:apply-templates/>
1786
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
1787
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1788
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
1789
+
1790
+ <fo:table-footer>
1791
+
1792
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1793
+
1794
+ <!-- if there are note(s) or fn(s) then create footer row -->
1795
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1796
+
1797
+ <xsl:variable name="cols-count">
1798
+ <xsl:choose>
1799
+ <xsl:when test="../*[local-name()='thead']">
1800
+ <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
1801
+ <xsl:call-template name="calculate-columns-numbers">
1802
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
1803
+ </xsl:call-template>
1804
+ </xsl:when>
1805
+ <xsl:otherwise>
1806
+ <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
1807
+ <xsl:call-template name="calculate-columns-numbers">
1808
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
1809
+ </xsl:call-template>
1810
+ </xsl:otherwise>
1811
+ </xsl:choose>
1812
+ </xsl:variable>
1813
+
1814
+ <fo:table-row>
1815
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1816
+
1817
+
1818
+
1819
+ <!-- fn will be processed inside 'note' processing -->
1820
+
1821
+
1822
+ <!-- except gb -->
1823
+
1824
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1825
+
1826
+
1827
+ <!-- horizontal row separator -->
1828
+
1829
+
1830
+ <!-- fn processing -->
1831
+ <xsl:call-template name="fn_display"/>
1832
+
1833
+ </fo:table-cell>
1834
+ </fo:table-row>
1835
+
1836
+ </xsl:if>
1837
+ </fo:table-footer>
1838
+
1839
+ </xsl:if>
1840
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
1841
+
1842
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
1843
+
1844
+ <xsl:call-template name="insertTableFooter"/>
1845
+
1846
+ <fo:table-body>
1847
+ <xsl:apply-templates/>
1848
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
1849
+
1850
+ </fo:table-body>
1851
+
1852
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
1853
+ <xsl:variable name="parent-name" select="local-name(..)"/>
1854
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
1855
+ <fo:table-row min-height="4mm">
1856
+ <xsl:if test="$parent-name = 'thead'">
1857
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1858
+
1859
+
1860
+
1861
+
1862
+
1863
+ </xsl:if>
1864
+ <xsl:if test="$parent-name = 'tfoot'">
1865
+
1866
+
1867
+ </xsl:if>
1868
+
1869
+
1870
+ <xsl:apply-templates/>
1871
+ </fo:table-row>
1872
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
1873
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
1874
+
1875
+
1876
+
1877
+
1878
+
1879
+
1880
+
1881
+ <xsl:if test="@colspan">
1882
+ <xsl:attribute name="number-columns-spanned">
1883
+ <xsl:value-of select="@colspan"/>
1884
+ </xsl:attribute>
1885
+ </xsl:if>
1886
+ <xsl:if test="@rowspan">
1887
+ <xsl:attribute name="number-rows-spanned">
1888
+ <xsl:value-of select="@rowspan"/>
1889
+ </xsl:attribute>
1890
+ </xsl:if>
1891
+ <fo:block>
1892
+ <xsl:apply-templates/>
1893
+ </fo:block>
1894
+ </fo:table-cell>
1895
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
1896
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
1897
+
1898
+
1899
+
1900
+
1901
+
1902
+
1903
+
1904
+
1905
+
1906
+ <xsl:if test="@colspan">
1907
+ <xsl:attribute name="number-columns-spanned">
1908
+ <xsl:value-of select="@colspan"/>
1909
+ </xsl:attribute>
1910
+ </xsl:if>
1911
+ <xsl:if test="@rowspan">
1912
+ <xsl:attribute name="number-rows-spanned">
1913
+ <xsl:value-of select="@rowspan"/>
1914
+ </xsl:attribute>
1915
+ </xsl:if>
1916
+ <fo:block>
1917
+ <xsl:apply-templates/>
1918
+ </fo:block>
1919
+ <!-- <xsl:choose>
1920
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
1921
+ <xsl:apply-templates />
1922
+ </xsl:when>
1923
+ <xsl:otherwise>
1924
+ <fo:block>
1925
+ <xsl:apply-templates />
1926
+ </fo:block>
1927
+ </xsl:otherwise>
1928
+ </xsl:choose> -->
1929
+
1930
+
1931
+ </fo:table-cell>
1932
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
1933
+
1934
+
1935
+ <fo:block font-size="10pt" margin-bottom="12pt">
1936
+
1937
+
1938
+
1939
+ <fo:inline padding-right="2mm">
1940
+
1941
+ <xsl:text>NOTE </xsl:text>
1942
+
1943
+
1944
+
1945
+ <xsl:number format="1 "/>
1946
+
1947
+ </fo:inline>
1948
+ <xsl:apply-templates mode="process"/>
1949
+ </fo:block>
1950
+
1951
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
1952
+ <xsl:apply-templates/>
1953
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
1954
+ <xsl:variable name="references">
1955
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
1956
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
1957
+
1958
+
1959
+ <xsl:apply-templates/>
1960
+ </fn>
1961
+ </xsl:for-each>
1962
+ </xsl:variable>
1963
+ <xsl:for-each select="xalan:nodeset($references)//fn">
1964
+ <xsl:variable name="reference" select="@reference"/>
1965
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
1966
+ <fo:block margin-bottom="12pt">
1967
+
1968
+
1969
+
1970
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1971
+
1972
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1973
+
1974
+
1975
+
1976
+
1977
+
1978
+
1979
+ <xsl:value-of select="@reference"/>
1980
+
1981
+ </fo:inline>
1982
+ <fo:inline>
1983
+
1984
+ <xsl:apply-templates/>
1985
+ </fo:inline>
1986
+ </fo:block>
1987
+ </xsl:if>
1988
+ </xsl:for-each>
1989
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
1990
+ <!-- <xsl:variable name="references">
1991
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
1992
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
1993
+ <xsl:apply-templates />
1994
+ </fn>
1995
+ </xsl:for-each>
1996
+ </xsl:variable>
1997
+ $references=<xsl:copy-of select="$references"/> -->
1998
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
1999
+ <xsl:variable name="reference" select="@reference"/>
2000
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2001
+ <fo:block margin-bottom="12pt">
2002
+ <xsl:apply-templates/>
2003
+ </fo:block>
2004
+ </xsl:for-each>
2005
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
2006
+ <xsl:variable name="key_iso">
2007
+ <!-- and (not(@class) or @class !='pseudocode') -->
2008
+ </xsl:variable>
2009
+ <xsl:variable name="references">
2010
+ <xsl:for-each select=".//*[local-name()='fn']">
2011
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2012
+ <xsl:apply-templates/>
2013
+ </fn>
2014
+ </xsl:for-each>
2015
+ </xsl:variable>
2016
+ <xsl:if test="xalan:nodeset($references)//fn">
2017
+ <fo:block>
2018
+ <fo:table width="95%" table-layout="fixed">
2019
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2020
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2021
+
2022
+ </xsl:if>
2023
+ <fo:table-column column-width="15%"/>
2024
+ <fo:table-column column-width="85%"/>
2025
+ <fo:table-body>
2026
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2027
+ <xsl:variable name="reference" select="@reference"/>
2028
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2029
+ <fo:table-row>
2030
+ <fo:table-cell>
2031
+ <fo:block>
2032
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2033
+
2034
+ <xsl:value-of select="@reference"/>
2035
+ </fo:inline>
2036
+ </fo:block>
2037
+ </fo:table-cell>
2038
+ <fo:table-cell>
2039
+ <fo:block text-align="justify" margin-bottom="12pt">
2040
+
2041
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2042
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2043
+ </xsl:if>
2044
+
2045
+ <xsl:apply-templates/>
2046
+ </fo:block>
2047
+ </fo:table-cell>
2048
+ </fo:table-row>
2049
+ </xsl:if>
2050
+ </xsl:for-each>
2051
+ </fo:table-body>
2052
+ </fo:table>
2053
+ </fo:block>
2054
+ </xsl:if>
2055
+
2056
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
2057
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2058
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2059
+
2060
+
2061
+
2062
+
2063
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2064
+
2065
+ <xsl:value-of select="@reference"/>
2066
+ </fo:basic-link>
2067
+ </fo:inline>
2068
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
2069
+ <fo:inline>
2070
+ <xsl:apply-templates/>
2071
+ </fo:inline>
2072
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
2073
+ <xsl:variable name="parent" select="local-name(..)"/>
2074
+
2075
+ <xsl:variable name="key_iso">
2076
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2077
+ </xsl:variable>
2078
+
2079
+ <xsl:choose>
2080
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2081
+
2082
+
2083
+ <fo:block margin-bottom="12pt" text-align="left">
2084
+
2085
+ <xsl:text>where </xsl:text>
2086
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2087
+ <xsl:text/>
2088
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2089
+ </fo:block>
2090
+
2091
+ </xsl:when>
2092
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2093
+ <fo:block margin-bottom="12pt" text-align="left">
2094
+
2095
+
2096
+
2097
+
2098
+ <xsl:text>where</xsl:text>
2099
+ </fo:block>
2100
+ </xsl:when>
2101
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2102
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
2103
+
2104
+
2105
+
2106
+ <xsl:text>Key</xsl:text>
2107
+ </fo:block>
2108
+ </xsl:when>
2109
+ </xsl:choose>
2110
+
2111
+ <!-- a few components -->
2112
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2113
+ <fo:block>
2114
+
2115
+
2116
+
2117
+ <fo:block>
2118
+
2119
+
2120
+ <!-- create virtual html table for dl/[dt and dd] -->
2121
+ <xsl:variable name="html-table">
2122
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2123
+ <xsl:element name="{$ns}:table">
2124
+ <tbody>
2125
+ <xsl:apply-templates mode="dl"/>
2126
+ </tbody>
2127
+ </xsl:element>
2128
+ </xsl:variable>
2129
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2130
+ <xsl:variable name="colwidths">
2131
+ <xsl:call-template name="calculate-column-widths">
2132
+ <xsl:with-param name="cols-count" select="2"/>
2133
+ <xsl:with-param name="table" select="$html-table"/>
2134
+ </xsl:call-template>
2135
+ </xsl:variable>
2136
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2137
+
2138
+ <fo:table width="95%" table-layout="fixed">
2139
+
2140
+ <xsl:choose>
2141
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2142
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2143
+ </xsl:when>
2144
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2145
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2146
+
2147
+ </xsl:when>
2148
+ </xsl:choose>
2149
+ <xsl:choose>
2150
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2151
+ <fo:table-column column-width="50%"/>
2152
+ <fo:table-column column-width="50%"/>
2153
+ </xsl:when>
2154
+ <xsl:otherwise>
2155
+ <xsl:choose>
2156
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2157
+ <fo:table-column column-width="60%"/>
2158
+ <fo:table-column column-width="40%"/>
2159
+ </xsl:when> -->
2160
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2161
+ <fo:table-column column-width="50%"/>
2162
+ <fo:table-column column-width="50%"/>
2163
+ </xsl:when>
2164
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2165
+ <fo:table-column column-width="40%"/>
2166
+ <fo:table-column column-width="60%"/>
2167
+ </xsl:when>
2168
+ <xsl:otherwise>
2169
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2170
+ <xsl:choose>
2171
+ <xsl:when test=". = 1">
2172
+ <fo:table-column column-width="proportional-column-width(2)"/>
2173
+ </xsl:when>
2174
+ <xsl:otherwise>
2175
+ <fo:table-column column-width="proportional-column-width({.})"/>
2176
+ </xsl:otherwise>
2177
+ </xsl:choose>
2178
+ </xsl:for-each>
2179
+ </xsl:otherwise>
2180
+ </xsl:choose>
2181
+ <!-- <fo:table-column column-width="15%"/>
2182
+ <fo:table-column column-width="85%"/> -->
2183
+ </xsl:otherwise>
2184
+ </xsl:choose>
2185
+ <fo:table-body>
2186
+ <xsl:apply-templates>
2187
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2188
+ </xsl:apply-templates>
2189
+ </fo:table-body>
2190
+ </fo:table>
2191
+ </fo:block>
2192
+ </fo:block>
2193
+ </xsl:if>
2194
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
2195
+ <xsl:param name="key_iso"/>
2196
+
2197
+ <!-- <tr>
2198
+ <td>NOTE</td>
2199
+ <td>
2200
+ <xsl:apply-templates />
2201
+ </td>
2202
+ </tr>
2203
+ -->
2204
+ <fo:table-row>
2205
+ <fo:table-cell>
2206
+ <fo:block margin-top="6pt">
2207
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2208
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2209
+ </xsl:if>
2210
+ NOTE
2211
+ </fo:block>
2212
+ </fo:table-cell>
2213
+ <fo:table-cell>
2214
+ <fo:block>
2215
+ <xsl:apply-templates/>
2216
+ </fo:block>
2217
+ </fo:table-cell>
2218
+ </fo:table-row>
2219
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
2220
+ <tr>
2221
+ <td>
2222
+ <xsl:apply-templates/>
2223
+ </td>
2224
+ <td>
2225
+
2226
+
2227
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2228
+
2229
+ </td>
2230
+ </tr>
2231
+
2232
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
2233
+ <xsl:param name="key_iso"/>
2234
+
2235
+ <fo:table-row>
2236
+ <fo:table-cell>
2237
+ <fo:block margin-top="6pt">
2238
+
2239
+
2240
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2241
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2242
+
2243
+ </xsl:if>
2244
+
2245
+
2246
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2247
+
2248
+ <xsl:apply-templates/>
2249
+
2250
+ </fo:block>
2251
+ </fo:table-cell>
2252
+ <fo:table-cell>
2253
+ <fo:block>
2254
+
2255
+
2256
+
2257
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2258
+
2259
+ </fo:block>
2260
+ </fo:table-cell>
2261
+ </fo:table-row>
2262
+
2263
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
2264
+ <xsl:apply-templates/>
2265
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
2266
+ <xsl:apply-templates/>
2267
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2268
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2269
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
2270
+ <fo:inline font-style="italic">
2271
+ <xsl:apply-templates/>
2272
+ </fo:inline>
2273
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
2274
+ <fo:inline font-weight="bold">
2275
+ <xsl:apply-templates/>
2276
+ </fo:inline>
2277
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
2278
+ <fo:inline font-size="80%" vertical-align="super">
2279
+ <xsl:apply-templates/>
2280
+ </fo:inline>
2281
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
2282
+ <fo:inline font-size="80%" vertical-align="sub">
2283
+ <xsl:apply-templates/>
2284
+ </fo:inline>
2285
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
2286
+ <fo:inline font-family="Courier" font-size="10pt">
2287
+ <xsl:apply-templates/>
2288
+ </fo:inline>
2289
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
2290
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2291
+ <xsl:apply-templates/>
2292
+ </fo:inline>
2293
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
2294
+ <xsl:variable name="text" select="normalize-space(.)"/>
2295
+ <fo:inline font-size="75%">
2296
+ <xsl:if test="string-length($text) &gt; 0">
2297
+ <xsl:call-template name="recursiveSmallCaps">
2298
+ <xsl:with-param name="text" select="$text"/>
2299
+ </xsl:call-template>
2300
+ </xsl:if>
2301
+ </fo:inline>
2302
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
2303
+ <xsl:param name="text"/>
2304
+ <xsl:variable name="char" select="substring($text,1,1)"/>
2305
+ <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2306
+ <xsl:choose>
2307
+ <xsl:when test="$char=$upperCase">
2308
+ <fo:inline font-size="{100 div 0.75}%">
2309
+ <xsl:value-of select="$upperCase"/>
2310
+ </fo:inline>
2311
+ </xsl:when>
2312
+ <xsl:otherwise>
2313
+ <xsl:value-of select="$upperCase"/>
2314
+ </xsl:otherwise>
2315
+ </xsl:choose>
2316
+ <xsl:if test="string-length($text) &gt; 1">
2317
+ <xsl:call-template name="recursiveSmallCaps">
2318
+ <xsl:with-param name="text" select="substring($text,2)"/>
2319
+ </xsl:call-template>
2320
+ </xsl:if>
2321
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
2322
+ <xsl:param name="text"/>
2323
+ <xsl:param name="separator" select="' '"/>
2324
+ <xsl:choose>
2325
+ <xsl:when test="not(contains($text, $separator))">
2326
+ <word>
2327
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
2328
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
2329
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
2330
+ <xsl:variable name="len_str">
2331
+ <xsl:choose>
2332
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
2333
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
2334
+ </xsl:when>
2335
+ <xsl:otherwise>
2336
+ <xsl:value-of select="$len_str_tmp"/>
2337
+ </xsl:otherwise>
2338
+ </xsl:choose>
2339
+ </xsl:variable>
2340
+
2341
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
2342
+ <xsl:message>
2343
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
2344
+ len_str=<xsl:value-of select="$len_str"/>
2345
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
2346
+ </xsl:message>
2347
+ </xsl:if> -->
2348
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
2349
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
2350
+ <xsl:choose>
2351
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
2352
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
2353
+ </xsl:when>
2354
+ <xsl:otherwise>
2355
+ <xsl:value-of select="$len_str"/>
2356
+ </xsl:otherwise>
2357
+ </xsl:choose>
2358
+ </word>
2359
+ </xsl:when>
2360
+ <xsl:otherwise>
2361
+ <word>
2362
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
2363
+ </word>
2364
+ <xsl:call-template name="tokenize">
2365
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
2366
+ </xsl:call-template>
2367
+ </xsl:otherwise>
2368
+ </xsl:choose>
2369
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
2370
+ <xsl:param name="words"/>
2371
+ <xsl:for-each select="$words//word">
2372
+ <xsl:sort select="." data-type="number" order="descending"/>
2373
+ <xsl:if test="position()=1">
2374
+ <xsl:value-of select="."/>
2375
+ </xsl:if>
2376
+ </xsl:for-each>
2377
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
2378
+ <xsl:param name="text" select="."/>
2379
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2380
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
2381
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
2382
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2383
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
2384
+ <xsl:variable name="zero-space">​</xsl:variable>
2385
+ <xsl:choose>
2386
+ <xsl:when test="contains($text, $zero-space-after-chars)">
2387
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
2388
+ <xsl:value-of select="$zero-space-after-chars"/>
2389
+ <xsl:value-of select="$zero-space"/>
2390
+ <xsl:call-template name="add-zero-spaces">
2391
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
2392
+ </xsl:call-template>
2393
+ </xsl:when>
2394
+ <xsl:when test="contains($text, $zero-space-after-dot)">
2395
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
2396
+ <xsl:value-of select="$zero-space-after-dot"/>
2397
+ <xsl:value-of select="$zero-space"/>
2398
+ <xsl:call-template name="add-zero-spaces">
2399
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
2400
+ </xsl:call-template>
2401
+ </xsl:when>
2402
+ <xsl:when test="contains($text, $zero-space-after-colon)">
2403
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
2404
+ <xsl:value-of select="$zero-space-after-colon"/>
2405
+ <xsl:value-of select="$zero-space"/>
2406
+ <xsl:call-template name="add-zero-spaces">
2407
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
2408
+ </xsl:call-template>
2409
+ </xsl:when>
2410
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2411
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2412
+ <xsl:value-of select="$zero-space-after-equal"/>
2413
+ <xsl:value-of select="$zero-space"/>
2414
+ <xsl:call-template name="add-zero-spaces">
2415
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2416
+ </xsl:call-template>
2417
+ </xsl:when>
2418
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
2419
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
2420
+ <xsl:value-of select="$zero-space-after-underscore"/>
2421
+ <xsl:value-of select="$zero-space"/>
2422
+ <xsl:call-template name="add-zero-spaces">
2423
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
2424
+ </xsl:call-template>
2425
+ </xsl:when>
2426
+ <xsl:otherwise>
2427
+ <xsl:value-of select="$text"/>
2428
+ </xsl:otherwise>
2429
+ </xsl:choose>
2430
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
2431
+ <xsl:param name="text" select="."/>
2432
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
2433
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2434
+ <xsl:variable name="zero-space">​</xsl:variable>
2435
+ <xsl:choose>
2436
+ <xsl:when test="contains($text, $zero-space-after-equals)">
2437
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
2438
+ <xsl:value-of select="$zero-space-after-equals"/>
2439
+ <xsl:value-of select="$zero-space"/>
2440
+ <xsl:call-template name="add-zero-spaces-equal">
2441
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
2442
+ </xsl:call-template>
2443
+ </xsl:when>
2444
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2445
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2446
+ <xsl:value-of select="$zero-space-after-equal"/>
2447
+ <xsl:value-of select="$zero-space"/>
2448
+ <xsl:call-template name="add-zero-spaces-equal">
2449
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2450
+ </xsl:call-template>
2451
+ </xsl:when>
2452
+ <xsl:otherwise>
2453
+ <xsl:value-of select="$text"/>
2454
+ </xsl:otherwise>
2455
+ </xsl:choose>
2456
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
2457
+ <xsl:variable name="simple-table">
2458
+
2459
+ <!-- Step 1. colspan processing -->
2460
+ <xsl:variable name="simple-table-colspan">
2461
+ <tbody>
2462
+ <xsl:apply-templates mode="simple-table-colspan"/>
2463
+ </tbody>
2464
+ </xsl:variable>
2465
+
2466
+ <!-- Step 2. rowspan processing -->
2467
+ <xsl:variable name="simple-table-rowspan">
2468
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
2469
+ </xsl:variable>
2470
+
2471
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
2472
+
2473
+ <!-- <xsl:choose>
2474
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
2475
+
2476
+ </xsl:when>
2477
+ <xsl:otherwise>
2478
+ <xsl:copy-of select="current()"/>
2479
+ </xsl:otherwise>
2480
+ </xsl:choose> -->
2481
+ </xsl:variable>
2482
+ <xsl:copy-of select="$simple-table"/>
2483
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
2484
+ <xsl:apply-templates mode="simple-table-colspan"/>
2485
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
2486
+ <xsl:choose>
2487
+ <xsl:when test="@colspan">
2488
+ <xsl:variable name="td">
2489
+ <xsl:element name="td">
2490
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
2491
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2492
+ <xsl:apply-templates mode="simple-table-colspan"/>
2493
+ </xsl:element>
2494
+ </xsl:variable>
2495
+ <xsl:call-template name="repeatNode">
2496
+ <xsl:with-param name="count" select="@colspan"/>
2497
+ <xsl:with-param name="node" select="$td"/>
2498
+ </xsl:call-template>
2499
+ </xsl:when>
2500
+ <xsl:otherwise>
2501
+ <xsl:element name="td">
2502
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2503
+ <xsl:apply-templates mode="simple-table-colspan"/>
2504
+ </xsl:element>
2505
+ </xsl:otherwise>
2506
+ </xsl:choose>
2507
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
2508
+ <xsl:element name="tr">
2509
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2510
+ <xsl:apply-templates mode="simple-table-colspan"/>
2511
+ </xsl:element>
2512
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
2513
+ <xsl:copy>
2514
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
2515
+ </xsl:copy>
2516
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
2517
+ <xsl:param name="count"/>
2518
+ <xsl:param name="node"/>
2519
+
2520
+ <xsl:if test="$count &gt; 0">
2521
+ <xsl:call-template name="repeatNode">
2522
+ <xsl:with-param name="count" select="$count - 1"/>
2523
+ <xsl:with-param name="node" select="$node"/>
2524
+ </xsl:call-template>
2525
+ <xsl:copy-of select="$node"/>
2526
+ </xsl:if>
2527
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
2528
+ <xsl:copy>
2529
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
2530
+ </xsl:copy>
2531
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
2532
+ <xsl:copy>
2533
+ <xsl:copy-of select="tr[1]"/>
2534
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
2535
+ <xsl:with-param name="previousRow" select="tr[1]"/>
2536
+ </xsl:apply-templates>
2537
+ </xsl:copy>
2538
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
2539
+ <xsl:param name="previousRow"/>
2540
+ <xsl:variable name="currentRow" select="."/>
2541
+
2542
+ <xsl:variable name="normalizedTDs">
2543
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
2544
+ <xsl:choose>
2545
+ <xsl:when test="@rowspan &gt; 1">
2546
+ <xsl:copy>
2547
+ <xsl:attribute name="rowspan">
2548
+ <xsl:value-of select="@rowspan - 1"/>
2549
+ </xsl:attribute>
2550
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
2551
+ <xsl:copy-of select="node()"/>
2552
+ </xsl:copy>
2553
+ </xsl:when>
2554
+ <xsl:otherwise>
2555
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
2556
+ </xsl:otherwise>
2557
+ </xsl:choose>
2558
+ </xsl:for-each>
2559
+ </xsl:variable>
2560
+
2561
+ <xsl:variable name="newRow">
2562
+ <xsl:copy>
2563
+ <xsl:copy-of select="$currentRow/@*"/>
2564
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
2565
+ </xsl:copy>
2566
+ </xsl:variable>
2567
+ <xsl:copy-of select="$newRow"/>
2568
+
2569
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
2570
+ <xsl:with-param name="previousRow" select="$newRow"/>
2571
+ </xsl:apply-templates>
2572
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
2573
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2574
+ <xsl:choose>
2575
+ <xsl:when test="$language = 'English'">en</xsl:when>
2576
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
2577
+ </xsl:choose>
2578
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
2579
+ <xsl:param name="str"/>
2580
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
2581
+ <xsl:choose>
2582
+ <xsl:when test="contains($str2, ' ')">
2583
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
2584
+ <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
2585
+ <xsl:value-of select="substring($substr, 2)"/>
2586
+ <xsl:text> </xsl:text>
2587
+ <xsl:call-template name="capitalizeWords">
2588
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
2589
+ </xsl:call-template>
2590
+ </xsl:when>
2591
+ <xsl:otherwise>
2592
+ <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
2593
+ <xsl:value-of select="substring($str2, 2)"/>
2594
+ </xsl:otherwise>
2595
+ </xsl:choose>
2596
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
2597
+ <fo:inline font-family="STIX2Math">
2598
+ <fo:instream-foreign-object fox:alt-text="Math">
2599
+ <xsl:copy-of select="."/>
2600
+ </fo:instream-foreign-object>
2601
+ </fo:inline>
2602
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
2603
+ <xsl:for-each select="*[local-name()='locality']">
2604
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
2605
+ <xsl:apply-templates select="."/>
2606
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
2607
+ </xsl:for-each>
2608
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
2609
+ <xsl:variable name="target">
2610
+ <xsl:choose>
2611
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
2612
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
2613
+ </xsl:when>
2614
+ <xsl:otherwise>
2615
+ <xsl:value-of select="normalize-space(@target)"/>
2616
+ </xsl:otherwise>
2617
+ </xsl:choose>
2618
+ </xsl:variable>
2619
+ <fo:inline xsl:use-attribute-sets="link-style">
2620
+ <xsl:choose>
2621
+ <xsl:when test="$target = ''">
2622
+ <xsl:apply-templates/>
2623
+ </xsl:when>
2624
+ <xsl:otherwise>
2625
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
2626
+ <xsl:choose>
2627
+ <xsl:when test="normalize-space(.) = ''">
2628
+ <xsl:value-of select="$target"/>
2629
+ </xsl:when>
2630
+ <xsl:otherwise>
2631
+ <xsl:apply-templates/>
2632
+ </xsl:otherwise>
2633
+ </xsl:choose>
2634
+ </fo:basic-link>
2635
+ </xsl:otherwise>
2636
+ </xsl:choose>
2637
+ </fo:inline>
2638
+ </xsl:template></xsl:stylesheet>