metanorma-ogc 1.0.4 → 1.0.5

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