metanorma-ogc 1.0.5 → 1.0.6

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