metanorma-ogc 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +10 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/ogc/biblio.rng +36 -6
  6. data/lib/asciidoctor/ogc/boilerplate.xml +7 -22
  7. data/lib/asciidoctor/ogc/converter.rb +12 -24
  8. data/lib/asciidoctor/ogc/isodoc.rng +450 -4
  9. data/lib/asciidoctor/ogc/reqt.rng +23 -0
  10. data/lib/isodoc/ogc.rb +2 -0
  11. data/lib/isodoc/ogc/base_convert.rb +12 -60
  12. data/lib/isodoc/ogc/biblio.rb +6 -5
  13. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +0 -5
  14. data/lib/isodoc/ogc/html/scripts.html +10 -7
  15. data/lib/isodoc/ogc/html_convert.rb +0 -4
  16. data/lib/isodoc/ogc/metadata.rb +0 -8
  17. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +3843 -0
  18. data/lib/isodoc/ogc/ogc.best-practice.xsl +3843 -0
  19. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +3843 -0
  20. data/lib/isodoc/ogc/ogc.community-practice.xsl +3843 -0
  21. data/lib/isodoc/ogc/ogc.community-standard.xsl +1194 -491
  22. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +3843 -0
  23. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1194 -491
  24. data/lib/isodoc/ogc/ogc.other.xsl +1194 -491
  25. data/lib/isodoc/ogc/ogc.policy.xsl +1194 -491
  26. data/lib/isodoc/ogc/ogc.reference-model.xsl +1194 -491
  27. data/lib/isodoc/ogc/ogc.release-notes.xsl +1194 -491
  28. data/lib/isodoc/ogc/ogc.standard.xsl +1194 -491
  29. data/lib/isodoc/ogc/ogc.test-suite.xsl +1194 -491
  30. data/lib/isodoc/ogc/ogc.user-guide.xsl +1194 -491
  31. data/lib/isodoc/ogc/ogc.white-paper.xsl +3843 -0
  32. data/lib/isodoc/ogc/pdf_convert.rb +6 -15
  33. data/lib/isodoc/ogc/presentation_xml_convert.rb +10 -0
  34. data/lib/isodoc/ogc/reqt.rb +49 -125
  35. data/lib/isodoc/ogc/sections.rb +9 -8
  36. data/lib/isodoc/ogc/word_convert.rb +3 -12
  37. data/lib/isodoc/ogc/xref.rb +158 -0
  38. data/lib/metanorma/ogc/processor.rb +12 -6
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +2 -2
  41. metadata +18 -12
  42. data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -0,0 +1,3843 @@
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" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" 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
+ <xsl:call-template name="addPDFUAmeta"/>
165
+
166
+ <!-- Cover Page -->
167
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
168
+ <fo:static-content flow-name="xsl-footnote-separator">
169
+ <fo:block>
170
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
171
+ </fo:block>
172
+ </fo:static-content>
173
+ <fo:static-content flow-name="cover-page-header" font-size="10pt">
174
+ <fo:block-container height="23.5mm" display-align="before">
175
+ <fo:block padding-top="12.5mm">
176
+ <xsl:value-of select="$copyright"/>
177
+ </fo:block>
178
+ </fo:block-container>
179
+ </fo:static-content>
180
+
181
+ <fo:flow flow-name="xsl-region-body">
182
+
183
+ <fo:block text-align="right" font-size="10pt">
184
+ <!-- CC/FDS 18011:2018 -->
185
+ <fo:block font-size="18pt" font-weight="bold" margin-bottom="10pt">
186
+ <xsl:text>Open Geospatial Consortium </xsl:text>
187
+ </fo:block>
188
+ <fo:block line-height="115%">
189
+ <fo:block margin-bottom="12pt">
190
+ <xsl:text>Submission Date: </xsl:text>
191
+ <xsl:choose>
192
+ <xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on">
193
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on"/>
194
+ </xsl:when>
195
+ <xsl:otherwise>XXX</xsl:otherwise>
196
+ </xsl:choose>
197
+ <xsl:text> </xsl:text>
198
+ </fo:block>
199
+ <fo:block margin-bottom="12pt">
200
+ <xsl:text>Approval Date: </xsl:text>
201
+ <xsl:choose>
202
+ <xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on">
203
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on"/>
204
+ </xsl:when>
205
+ <xsl:otherwise>XXX</xsl:otherwise>
206
+ </xsl:choose>
207
+ <xsl:text> </xsl:text>
208
+ </fo:block>
209
+ <fo:block margin-bottom="12pt">
210
+ <xsl:text>Publication Date: </xsl:text>
211
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'published']/ogc:on"/><xsl:text> </xsl:text>
212
+ </fo:block>
213
+ <fo:block margin-bottom="12pt">
214
+ <xsl:text>External identifier of this OGC® document: </xsl:text>
215
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-external']"/><xsl:text> </xsl:text>
216
+ </fo:block>
217
+ <fo:block margin-bottom="12pt">
218
+ <xsl:text>Internal reference number of this OGC® document: </xsl:text>
219
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-internal']"/><xsl:text> </xsl:text>
220
+ </fo:block>
221
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:uri[not(@type)]"/>
222
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition"/>
223
+
224
+ <fo:block margin-bottom="12pt">
225
+ <xsl:text>Category: </xsl:text>
226
+ <xsl:value-of select="$doctype"/>
227
+ <xsl:text> </xsl:text>
228
+ </fo:block>
229
+ <fo:block margin-bottom="12pt">
230
+ <xsl:text>Editor: </xsl:text>
231
+ <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
232
+ <xsl:value-of select="."/>
233
+ <xsl:if test="position() != last()">, </xsl:if>
234
+ </xsl:for-each>
235
+ <xsl:text> </xsl:text>
236
+ </fo:block>
237
+ </fo:block>
238
+ </fo:block>
239
+ <fo:block font-size="24pt" font-weight="bold" text-align="center" margin-top="15pt" line-height="115%">
240
+ <xsl:text>OGC </xsl:text><xsl:value-of select="$doctitle"/>
241
+ </fo:block>
242
+ <fo:block margin-bottom="12pt"> </fo:block>
243
+ <!-- Copyright notice -->
244
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:copyright-statement"/>
245
+
246
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement"/>
247
+
248
+ <fo:block-container absolute-position="fixed" left="14mm" top="250mm" font-size="10pt">
249
+ <fo:table table-layout="fixed" width="100%">
250
+ <fo:table-column column-width="35mm"/>
251
+ <fo:table-column column-width="70mm"/>
252
+ <fo:table-body>
253
+ <fo:table-row height="9mm">
254
+ <fo:table-cell>
255
+ <fo:block>Document type: </fo:block>
256
+ </fo:table-cell>
257
+ <fo:table-cell>
258
+ <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>
259
+ </fo:table-cell>
260
+ </fo:table-row>
261
+ <fo:table-row height="9mm">
262
+ <fo:table-cell>
263
+ <fo:block>Document stage: </fo:block>
264
+ </fo:table-cell>
265
+ <fo:table-cell>
266
+ <fo:block>
267
+ <xsl:variable name="stage" select="/ogc:ogc-standard/ogc:bibdata/ogc:status/ogc:stage"/>
268
+ <xsl:call-template name="capitalize">
269
+ <xsl:with-param name="str" select="$stage"/>
270
+ </xsl:call-template>
271
+ </fo:block>
272
+ </fo:table-cell>
273
+ </fo:table-row>
274
+ <fo:table-row height="9mm">
275
+ <fo:table-cell>
276
+ <fo:block>Document language: </fo:block>
277
+ </fo:table-cell>
278
+ <fo:table-cell>
279
+ <fo:block><xsl:value-of select="$lang"/></fo:block>
280
+ </fo:table-cell>
281
+ </fo:table-row>
282
+ </fo:table-body>
283
+ </fo:table>
284
+ </fo:block-container>
285
+
286
+ </fo:flow>
287
+ </fo:page-sequence>
288
+ <!-- End Cover Page -->
289
+
290
+
291
+ <!-- Copyright, Content, Foreword, etc. pages -->
292
+ <fo:page-sequence master-reference="preface" initial-page-number="2" format="i" force-page-count="end-on-even"> <!-- -->
293
+ <fo:static-content flow-name="xsl-footnote-separator">
294
+ <fo:block>
295
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
296
+ </fo:block>
297
+ </fo:static-content>
298
+ <xsl:call-template name="insertHeaderFooter"/>
299
+ <fo:flow flow-name="xsl-region-body">
300
+
301
+ <xsl:if test="$debug = 'true'">
302
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
303
+ DEBUG
304
+ contents=<!-- <xsl:copy-of select="xalan:nodeset($contents)"/> -->
305
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
306
+ </xsl:if>
307
+
308
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:license-statement"/>
309
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:feedback-statement"/>
310
+
311
+ <fo:block break-after="page"/>
312
+ <fo:block> </fo:block>
313
+ <fo:block break-after="page"/>
314
+
315
+ <fo:block-container font-weight="bold" line-height="115%">
316
+ <xsl:variable name="title-toc">
317
+ <xsl:call-template name="getTitle">
318
+ <xsl:with-param name="name" select="'title-toc'"/>
319
+ </xsl:call-template>
320
+ </xsl:variable>
321
+ <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
322
+
323
+ <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'))] -->
324
+
325
+ <fo:block>
326
+ <xsl:if test="@level = 1">
327
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
328
+ </xsl:if>
329
+ <fo:list-block>
330
+ <xsl:attribute name="provisional-distance-between-starts">
331
+ <xsl:choose>
332
+ <!-- skip 0 section without subsections -->
333
+ <xsl:when test="@section != '' and not(@display-section = 'false')">8mm</xsl:when>
334
+ <xsl:otherwise>0mm</xsl:otherwise>
335
+ </xsl:choose>
336
+ </xsl:attribute>
337
+ <fo:list-item>
338
+ <fo:list-item-label end-indent="label-end()">
339
+ <fo:block>
340
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
341
+ <xsl:value-of select="@section"/><xsl:text>.</xsl:text>
342
+ </xsl:if>
343
+ </fo:block>
344
+ </fo:list-item-label>
345
+ <fo:list-item-body start-indent="body-start()">
346
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
347
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
348
+ <xsl:if test="@section and @display-section = 'false' and not(@section = '0')">
349
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
350
+ </xsl:if>
351
+ <xsl:if test="@addon != ''">
352
+ <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
353
+ </xsl:if>
354
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
355
+ <fo:inline keep-together.within-line="always">
356
+ <fo:leader leader-pattern="dots"/>
357
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
358
+ </fo:inline>
359
+ </fo:basic-link>
360
+ </fo:block>
361
+ </fo:list-item-body>
362
+ </fo:list-item>
363
+ </fo:list-block>
364
+ </fo:block>
365
+ </xsl:for-each>
366
+
367
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
368
+ <fo:block font-size="12pt"> </fo:block>
369
+ <fo:block font-size="12pt"> </fo:block>
370
+ <xsl:variable name="title-list-tables">
371
+ <xsl:call-template name="getTitle">
372
+ <xsl:with-param name="name" select="'title-list-tables'"/>
373
+ </xsl:call-template>
374
+ </xsl:variable>
375
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-tables"/></fo:block>
376
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
377
+ <fo:block text-align-last="justify" margin-top="6pt">
378
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
379
+ <xsl:value-of select="@section"/>
380
+ <xsl:if test="text() != ''">
381
+ <xsl:text> — </xsl:text>
382
+ <xsl:value-of select="text()"/>
383
+ </xsl:if>
384
+ <xsl:text> </xsl:text>
385
+ <fo:inline keep-together.within-line="always">
386
+ <fo:leader leader-pattern="dots"/>
387
+ <fo:page-number-citation ref-id="{@id}"/>
388
+ </fo:inline>
389
+ </fo:basic-link>
390
+ </fo:block>
391
+ </xsl:for-each>
392
+ </xsl:if>
393
+
394
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
395
+ <fo:block font-size="12pt"> </fo:block>
396
+ <fo:block font-size="12pt"> </fo:block>
397
+ <xsl:variable name="title-list-figures">
398
+ <xsl:call-template name="getTitle">
399
+ <xsl:with-param name="name" select="'title-list-figures'"/>
400
+ </xsl:call-template>
401
+ </xsl:variable>
402
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-figures"/></fo:block>
403
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
404
+ <fo:block text-align-last="justify" margin-top="6pt">
405
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
406
+ <xsl:value-of select="@section"/>
407
+ <xsl:if test="text() != ''">
408
+ <xsl:text> — </xsl:text>
409
+ <xsl:value-of select="text()"/>
410
+ </xsl:if>
411
+ <xsl:text> </xsl:text>
412
+ <fo:inline keep-together.within-line="always">
413
+ <fo:leader leader-pattern="dots"/>
414
+ <fo:page-number-citation ref-id="{@id}"/>
415
+ </fo:inline>
416
+ </fo:basic-link>
417
+ </fo:block>
418
+ </xsl:for-each>
419
+ </xsl:if>
420
+
421
+ </fo:block-container>
422
+
423
+
424
+ <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
425
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="abstract"/>
426
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1]">
427
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + 1"/>
428
+ </xsl:apply-templates>
429
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="preface">
430
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ 1"/>
431
+ </xsl:apply-templates>
432
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="introduction"/>
433
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name">
434
+ <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"/>
435
+ </xsl:apply-templates>
436
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters">
437
+ <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"/>
438
+ </xsl:apply-templates>
439
+
440
+
441
+ </fo:flow>
442
+ </fo:page-sequence>
443
+
444
+
445
+ <!-- Document Pages -->
446
+ <fo:page-sequence master-reference="document" initial-page-number="1" format="1" force-page-count="no-force">
447
+ <fo:static-content flow-name="xsl-footnote-separator">
448
+ <fo:block>
449
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
450
+ </fo:block>
451
+ </fo:static-content>
452
+ <xsl:call-template name="insertHeaderFooter">
453
+ <xsl:with-param name="pagenum-font-weight">bold</xsl:with-param>
454
+ </xsl:call-template>
455
+ <fo:flow flow-name="xsl-region-body">
456
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
457
+ <xsl:value-of select="$doctitle"/>
458
+ </fo:block>
459
+
460
+ <fo:block line-height="125%">
461
+
462
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']">
463
+ <xsl:with-param name="sectionNum" select="'1'"/>
464
+ </xsl:apply-templates>
465
+
466
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']">
467
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + 1"/>
468
+ </xsl:apply-templates>
469
+
470
+ <!-- Normative references -->
471
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']">
472
+ <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"/>
473
+ </xsl:apply-templates>
474
+
475
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms"> <!-- Terms and definitions -->
476
+ <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"/>
477
+ </xsl:apply-templates>
478
+
479
+
480
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/*[local-name() != 'terms' and not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]">
481
+ <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)"/>
482
+ </xsl:apply-templates>
483
+
484
+
485
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex"/>
486
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references']"/> <!-- [position() &gt; 1] -->
487
+
488
+ </fo:block>
489
+ </fo:flow>
490
+ </fo:page-sequence>
491
+
492
+ <!-- End Document Pages -->
493
+
494
+ </fo:root>
495
+ </xsl:template>
496
+
497
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
498
+ <xsl:template match="node()">
499
+ <xsl:param name="sectionNum"/>
500
+ <xsl:param name="sectionNumSkew"/>
501
+ <xsl:apply-templates>
502
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
503
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
504
+ </xsl:apply-templates>
505
+ </xsl:template>
506
+
507
+ <!-- ============================= -->
508
+ <!-- CONTENTS -->
509
+ <!-- ============================= -->
510
+ <xsl:template match="node()" mode="contents">
511
+ <xsl:param name="sectionNum"/>
512
+ <xsl:param name="sectionNumSkew"/>
513
+ <xsl:apply-templates mode="contents">
514
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
515
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
516
+ </xsl:apply-templates>
517
+ </xsl:template>
518
+
519
+
520
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
521
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
522
+ <xsl:template match="ogc:ogc-standard/ogc:sections/*" mode="contents">
523
+ <xsl:param name="sectionNum"/>
524
+ <xsl:param name="sectionNumSkew" select="0"/>
525
+ <xsl:variable name="sectionNum_">
526
+ <xsl:choose>
527
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
528
+ <xsl:when test="$sectionNumSkew != 0">
529
+ <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 -->
530
+ <xsl:value-of select="$number + $sectionNumSkew"/>
531
+ </xsl:when>
532
+ <xsl:otherwise>
533
+ <xsl:number count="*"/>
534
+ </xsl:otherwise>
535
+ </xsl:choose>
536
+ </xsl:variable>
537
+ <xsl:apply-templates mode="contents">
538
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
539
+ </xsl:apply-templates>
540
+ </xsl:template>
541
+ <xsl:template match="ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents">
542
+ <xsl:param name="sectionNum"/>
543
+ <xsl:param name="sectionNumSkew" select="0"/>
544
+ <xsl:variable name="sectionNum_">
545
+ <xsl:choose>
546
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
547
+ <xsl:when test="$sectionNumSkew != 0">
548
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- ogc:sections/ogc:clause | ogc:sections/ogc:terms -->
549
+ <xsl:value-of select="$number + $sectionNumSkew"/>
550
+ </xsl:when>
551
+ <xsl:otherwise>
552
+ <xsl:number count="*"/>
553
+ </xsl:otherwise>
554
+ </xsl:choose>
555
+ </xsl:variable>
556
+ <xsl:apply-templates mode="contents">
557
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
558
+ </xsl:apply-templates>
559
+ </xsl:template>
560
+
561
+
562
+ <!-- Any node with title element - clause, definition, annex,... -->
563
+ <xsl:template match="ogc:title | ogc:preferred" mode="contents">
564
+ <xsl:param name="sectionNum"/>
565
+ <xsl:variable name="id">
566
+ <xsl:call-template name="getId"/>
567
+ </xsl:variable>
568
+
569
+ <xsl:variable name="level">
570
+ <xsl:call-template name="getLevel"/>
571
+ </xsl:variable>
572
+
573
+ <xsl:variable name="section">
574
+ <xsl:call-template name="getSection">
575
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
576
+ </xsl:call-template>
577
+ </xsl:variable>
578
+
579
+ <xsl:variable name="display">
580
+ <xsl:choose>
581
+ <xsl:when test="ancestor::ogc:bibitem">false</xsl:when>
582
+ <xsl:when test="ancestor::ogc:term">false</xsl:when>
583
+ <xsl:when test="ancestor::ogc:annex and $level &gt;= 3">false</xsl:when>
584
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
585
+ <xsl:otherwise>false</xsl:otherwise>
586
+ </xsl:choose>
587
+ </xsl:variable>
588
+
589
+ <xsl:variable name="display-section">
590
+ <xsl:choose>
591
+ <xsl:when test="ancestor::ogc:annex and $level &gt;= 2">true</xsl:when>
592
+ <xsl:when test="ancestor::ogc:annex">false</xsl:when>
593
+ <xsl:when test="$section = '0'">false</xsl:when>
594
+ <xsl:otherwise>true</xsl:otherwise>
595
+ </xsl:choose>
596
+ </xsl:variable>
597
+
598
+ <xsl:variable name="type">
599
+ <xsl:value-of select="local-name(..)"/>
600
+ </xsl:variable>
601
+
602
+ <xsl:variable name="root">
603
+ <xsl:choose>
604
+ <xsl:when test="ancestor::ogc:annex">annex</xsl:when>
605
+ <xsl:when test="ancestor::ogc:clause">clause</xsl:when>
606
+ <xsl:when test="ancestor::ogc:terms">terms</xsl:when>
607
+ </xsl:choose>
608
+ </xsl:variable>
609
+
610
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
611
+ <xsl:attribute name="addon">
612
+ <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
613
+ </xsl:attribute>
614
+ <xsl:apply-templates/>
615
+ </item>
616
+
617
+ <xsl:apply-templates mode="contents">
618
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
619
+ </xsl:apply-templates>
620
+
621
+ </xsl:template>
622
+
623
+ <xsl:template match="ogc:ogc-standard/ogc:preface/*" mode="contents">
624
+ <xsl:param name="sectionNum" select="'1'"/>
625
+ <xsl:variable name="section">
626
+ <xsl:number format="i" value="$sectionNum"/>
627
+ </xsl:variable>
628
+ <xsl:variable name="id">
629
+ <xsl:choose>
630
+ <xsl:when test="@id">
631
+ <xsl:value-of select="@id"/>
632
+ </xsl:when>
633
+ <xsl:otherwise>
634
+ <xsl:value-of select="local-name()"/>
635
+ </xsl:otherwise>
636
+ </xsl:choose>
637
+ </xsl:variable>
638
+ <xsl:if test="not(ogc:title)">
639
+ <item id="{$id}" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
640
+ <xsl:if test="local-name() = 'foreword'">
641
+ <xsl:attribute name="display">false</xsl:attribute>
642
+ </xsl:if>
643
+ <xsl:choose>
644
+ <xsl:when test="not(ogc:title)">
645
+ <xsl:variable name="name" select="local-name()"/>
646
+ <xsl:call-template name="capitalize">
647
+ <xsl:with-param name="str" select="$name"/>
648
+ </xsl:call-template>
649
+ </xsl:when>
650
+ <xsl:otherwise>
651
+ <xsl:value-of select="ogc:title"/>
652
+ </xsl:otherwise>
653
+ </xsl:choose>
654
+ </item>
655
+ </xsl:if>
656
+ <xsl:apply-templates mode="contents">
657
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
658
+ </xsl:apply-templates>
659
+ </xsl:template>
660
+
661
+ <!-- Keywords -->
662
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:keyword" mode="contents">
663
+ <xsl:param name="sectionNum" select="'1'"/>
664
+ <xsl:variable name="section">
665
+ <xsl:number format="i" value="$sectionNum"/>
666
+ </xsl:variable>
667
+ <item id="keywords" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
668
+ <xsl:variable name="title-keywords">
669
+ <xsl:call-template name="getTitle">
670
+ <xsl:with-param name="name" select="'title-keywords'"/>
671
+ </xsl:call-template>
672
+ </xsl:variable>
673
+ <xsl:value-of select="$title-keywords"/>
674
+ </item>
675
+ </xsl:template>
676
+ <!-- Submitting Organizations -->
677
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name" mode="contents">
678
+ <xsl:param name="sectionNum" select="'1'"/>
679
+ <xsl:variable name="section">
680
+ <xsl:number format="i" value="$sectionNum"/>
681
+ </xsl:variable>
682
+ <item id="submitting_orgs" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
683
+ <xsl:variable name="title-submitting-organizations">
684
+ <xsl:call-template name="getTitle">
685
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
686
+ </xsl:call-template>
687
+ </xsl:variable>
688
+ <xsl:value-of select="$title-submitting-organizations"/>
689
+ </item>
690
+ </xsl:template>
691
+
692
+ <xsl:template match="ogc:figure" mode="contents">
693
+ <xsl:param name="sectionNum"/>
694
+ <item level="" id="{@id}" type="figure">
695
+ <xsl:attribute name="section">
696
+ <xsl:variable name="title-figure">
697
+ <xsl:call-template name="getTitle">
698
+ <xsl:with-param name="name" select="'title-figure'"/>
699
+ </xsl:call-template>
700
+ </xsl:variable>
701
+ <xsl:value-of select="$title-figure"/>
702
+ <xsl:choose>
703
+ <xsl:when test="ancestor::ogc:annex">
704
+ <xsl:choose>
705
+ <xsl:when test="count(//ogc:annex) = 1">
706
+ <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"/>
707
+ </xsl:when>
708
+ <xsl:otherwise>
709
+ <xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
710
+ </xsl:otherwise>
711
+ </xsl:choose>
712
+ </xsl:when>
713
+ <xsl:when test="ancestor::ogc:figure">
714
+ <xsl:for-each select="parent::*[1]">
715
+ <xsl:number format="1" level="any" count="ogc:figure[not(parent::ogc:figure)]"/>
716
+ </xsl:for-each>
717
+ <xsl:number format="-a" count="ogc:figure"/>
718
+ </xsl:when>
719
+ <xsl:otherwise>
720
+ <xsl:number format="1" level="any" count="ogc:figure[not(parent::ogc:figure)] | ogc:sourcecode[not(@unnumbered = 'true') and not(ancestor::ogc:example)]"/>
721
+ <!-- <xsl:number format="1.1-1" level="multiple" count="ogc:annex | ogc:figure"/> -->
722
+ </xsl:otherwise>
723
+ </xsl:choose>
724
+ </xsl:attribute>
725
+ <xsl:value-of select="ogc:name"/>
726
+ </item>
727
+ </xsl:template>
728
+
729
+
730
+
731
+ <xsl:template match="ogc:table[not(@unnumbered='true')]" mode="contents">
732
+ <xsl:param name="sectionNum"/>
733
+ <xsl:variable name="annex-id" select="ancestor::ogc:annex/@id"/>
734
+ <item level="" id="{@id}" display="false" type="table">
735
+ <xsl:attribute name="section">
736
+ <xsl:variable name="title-table">
737
+ <xsl:call-template name="getTitle">
738
+ <xsl:with-param name="name" select="'title-table'"/>
739
+ </xsl:call-template>
740
+ </xsl:variable>
741
+ <xsl:value-of select="$title-table"/>
742
+ <xsl:choose>
743
+ <xsl:when test="ancestor::*[local-name()='executivesummary']">
744
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered='true')]"/>
745
+ </xsl:when>
746
+ <xsl:when test="ancestor::*[local-name()='annex']">
747
+ <xsl:number format="A-" count="ogc:annex"/>
748
+ <xsl:number format="1" level="any" count="ogc:table[ancestor::ogc:annex[@id = $annex-id]][not(@unnumbered='true')]"/>
749
+ </xsl:when>
750
+ <xsl:otherwise>
751
+ <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')]"/>
752
+ </xsl:otherwise>
753
+ </xsl:choose>
754
+ </xsl:attribute>
755
+ <xsl:value-of select="ogc:name/text()"/>
756
+ </item>
757
+ </xsl:template>
758
+
759
+
760
+
761
+ <xsl:template match="ogc:formula" mode="contents">
762
+ <item level="" id="{@id}" display="false">
763
+ <xsl:attribute name="section">
764
+ <xsl:variable name="title-formula">
765
+ <xsl:call-template name="getTitle">
766
+ <xsl:with-param name="name" select="'title-formula'"/>
767
+ </xsl:call-template>
768
+ </xsl:variable>
769
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
770
+ </xsl:attribute>
771
+ </item>
772
+ </xsl:template>
773
+
774
+ <xsl:template match="ogc:fn" mode="contents"/>
775
+ <!-- ============================= -->
776
+ <!-- ============================= -->
777
+
778
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:uri[not(@type)]">
779
+ <fo:block margin-bottom="12pt">
780
+ <xsl:text>URL for this OGC® document: </xsl:text>
781
+ <xsl:value-of select="."/><xsl:text> </xsl:text>
782
+ </fo:block>
783
+ </xsl:template>
784
+
785
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
786
+ <fo:block margin-bottom="12pt">
787
+ <xsl:variable name="title-edition">
788
+ <xsl:call-template name="getTitle">
789
+ <xsl:with-param name="name" select="'title-edition'"/>
790
+ </xsl:call-template>
791
+ </xsl:variable>
792
+ <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
793
+ <xsl:value-of select="."/><xsl:text> </xsl:text>
794
+ </fo:block>
795
+ </xsl:template>
796
+
797
+ <xsl:template match="ogc:license-statement//ogc:title">
798
+ <fo:block text-align="center" font-weight="bold" margin-top="4pt">
799
+ <xsl:apply-templates/>
800
+ </fo:block>
801
+ </xsl:template>
802
+
803
+ <xsl:template match="ogc:license-statement//ogc:p">
804
+ <fo:block font-size="8pt" margin-top="14pt" line-height="115%">
805
+ <xsl:if test="following-sibling::ogc:p">
806
+ <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
807
+ </xsl:if>
808
+ <xsl:apply-templates/>
809
+ </fo:block>
810
+ </xsl:template>
811
+
812
+ <xsl:template match="ogc:feedback-statement">
813
+ <fo:block margin-top="12pt" margin-bottom="12pt">
814
+ <xsl:apply-templates select="ogc:clause[1]"/>
815
+ </fo:block>
816
+ </xsl:template>
817
+
818
+ <xsl:template match="ogc:copyright-statement//ogc:title">
819
+ <fo:block font-weight="bold" text-align="center">
820
+ <xsl:apply-templates/>
821
+ </fo:block>
822
+ </xsl:template>
823
+ <xsl:template match="ogc:copyright-statement//ogc:p">
824
+ <fo:block margin-bottom="12pt">
825
+ <xsl:if test="not(following-sibling::p)">
826
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
827
+ </xsl:if>
828
+ <xsl:attribute name="text-align">
829
+ <xsl:choose>
830
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
831
+ <xsl:otherwise>left</xsl:otherwise>
832
+ </xsl:choose>
833
+ </xsl:attribute>
834
+ <xsl:apply-templates/>
835
+ </fo:block>
836
+ </xsl:template>
837
+
838
+ <xsl:template match="ogc:legal-statement">
839
+ <fo:block-container border="0.5pt solid black" margin-bottom="12pt" margin-left="-2mm" margin-right="-2mm">
840
+ <fo:block-container margin-left="0mm" margin-right="0mm">
841
+ <fo:block margin-left="2mm" margin-right="2mm">
842
+ <xsl:apply-templates/>
843
+ </fo:block>
844
+ </fo:block-container>
845
+ </fo:block-container>
846
+ </xsl:template>
847
+
848
+
849
+ <xsl:template match="ogc:legal-statement//ogc:title">
850
+ <fo:block text-align="center" font-weight="bold" padding-top="2mm" margin-bottom="6pt">
851
+ <xsl:apply-templates/>
852
+ </fo:block>
853
+ </xsl:template>
854
+
855
+ <xsl:template match="ogc:legal-statement//ogc:p">
856
+ <fo:block margin-bottom="6pt">
857
+ <xsl:if test="not(following-sibling::ogc:p)">
858
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
859
+ </xsl:if>
860
+ <xsl:attribute name="text-align">
861
+ <xsl:choose>
862
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
863
+ <xsl:otherwise>left</xsl:otherwise>
864
+ </xsl:choose>
865
+ </xsl:attribute>
866
+ <xsl:apply-templates/>
867
+ </fo:block>
868
+ </xsl:template>
869
+
870
+
871
+ <!-- Introduction -->
872
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:introduction" mode="introduction">
873
+ <fo:block break-after="page"/>
874
+ <xsl:apply-templates select="current()"/>
875
+ </xsl:template>
876
+ <!-- Abstract -->
877
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:abstract" mode="abstract">
878
+ <fo:block break-after="page"/>
879
+ <xsl:apply-templates select="current()"/>
880
+ </xsl:template>
881
+ <!-- Preface -->
882
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:foreword" mode="preface">
883
+ <xsl:param name="sectionNum"/>
884
+ <fo:block break-after="page"/>
885
+ <xsl:apply-templates select="current()">
886
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
887
+ </xsl:apply-templates>
888
+ </xsl:template>
889
+ <!-- Abstract, Preface -->
890
+ <xsl:template match="ogc:ogc-standard/ogc:preface/*">
891
+ <xsl:param name="sectionNum" select="'1'"/>
892
+ <xsl:if test="not(ogc:title)">
893
+ <xsl:variable name="id">
894
+ <xsl:choose>
895
+ <xsl:when test="@id">
896
+ <xsl:value-of select="@id"/>
897
+ </xsl:when>
898
+ <xsl:otherwise>
899
+ <xsl:value-of select="local-name()"/>
900
+ </xsl:otherwise>
901
+ </xsl:choose>
902
+ </xsl:variable>
903
+ <fo:block id="{$id}" font-size="13pt" font-weight="bold" margin-bottom="12pt" color="rgb(14, 26, 133)">
904
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
905
+ <xsl:variable name="name" select="local-name()"/>
906
+ <xsl:call-template name="capitalize">
907
+ <xsl:with-param name="str" select="$name"/>
908
+ </xsl:call-template>
909
+ </fo:block>
910
+ </xsl:if>
911
+ <xsl:apply-templates/>
912
+ </xsl:template>
913
+ <!-- Keywords -->
914
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
915
+ <xsl:param name="sectionNum" select="'1'"/>
916
+ <fo:block id="keywords" font-size="13pt" font-weight="bold" margin-top="13.5pt" margin-bottom="12pt" color="rgb(14, 26, 133)">
917
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="2mm"> </fo:inline>
918
+ <xsl:variable name="title-keywords">
919
+ <xsl:call-template name="getTitle">
920
+ <xsl:with-param name="name" select="'title-keywords'"/>
921
+ </xsl:call-template>
922
+ </xsl:variable>
923
+ <xsl:value-of select="$title-keywords"/>
924
+ </fo:block>
925
+ <fo:block margin-bottom="12pt">The following are keywords to be used by search engines and document catalogues.</fo:block>
926
+ <fo:block margin-bottom="12pt">
927
+ <xsl:call-template name="insertKeywords">
928
+ <xsl:with-param name="sorting">no</xsl:with-param>
929
+ <xsl:with-param name="charAtEnd"/>
930
+ </xsl:call-template>
931
+ <!-- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
932
+ <xsl:value-of select="."/>
933
+ <xsl:if test="position() != last()">, </xsl:if>
934
+ </xsl:for-each> -->
935
+ </fo:block>
936
+ </xsl:template>
937
+ <!-- Submitting Organizations -->
938
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name">
939
+ <xsl:param name="sectionNum" select="'1'"/>
940
+ <fo:block id="submitting_orgs" font-size="13pt" font-weight="bold" color="rgb(14, 26, 133)" margin-top="13.5pt" margin-bottom="12pt">
941
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
942
+ <xsl:variable name="title-submitting-organizations">
943
+ <xsl:call-template name="getTitle">
944
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
945
+ </xsl:call-template>
946
+ </xsl:variable>
947
+ <xsl:value-of select="$title-submitting-organizations"/>
948
+ </fo:block>
949
+ <fo:block margin-bottom="12pt">The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</fo:block>
950
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
951
+ <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name">
952
+ <fo:list-item>
953
+ <fo:list-item-label end-indent="label-end()">
954
+ <fo:block>—</fo:block>
955
+ </fo:list-item-label>
956
+ <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
957
+ <fo:block>
958
+ <xsl:apply-templates/>
959
+ </fo:block>
960
+ </fo:list-item-body>
961
+ </fo:list-item>
962
+ </xsl:for-each>
963
+ </fo:list-block>
964
+ </xsl:template>
965
+
966
+
967
+ <!-- clause, terms, clause, ...-->
968
+ <xsl:template match="ogc:ogc-standard/ogc:sections/*">
969
+ <xsl:param name="sectionNum"/>
970
+ <xsl:param name="sectionNumSkew" select="0"/>
971
+ <fo:block>
972
+ <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 -->
973
+ <xsl:if test="$pos &gt;= 2">
974
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
975
+ </xsl:if>
976
+ <xsl:variable name="sectionNum_">
977
+ <xsl:choose>
978
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
979
+ <xsl:when test="$sectionNumSkew != 0">
980
+ <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 -->
981
+ <xsl:value-of select="$number + $sectionNumSkew"/>
982
+ </xsl:when>
983
+ <xsl:otherwise>
984
+ <xsl:number count="*"/>
985
+ </xsl:otherwise>
986
+ </xsl:choose>
987
+ </xsl:variable>
988
+ <xsl:if test="not(ogc:title)">
989
+ <fo:block margin-top="3pt" margin-bottom="12pt">
990
+ <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')]"/>
991
+ </fo:block>
992
+ </xsl:if>
993
+ <xsl:apply-templates>
994
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
995
+ </xsl:apply-templates>
996
+ </fo:block>
997
+ </xsl:template>
998
+
999
+
1000
+
1001
+ <xsl:template match="ogc:clause//ogc:clause[not(ogc:title)]">
1002
+ <xsl:param name="sectionNum"/>
1003
+ <xsl:variable name="section">
1004
+ <xsl:call-template name="getSection">
1005
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1006
+ </xsl:call-template>
1007
+ </xsl:variable>
1008
+
1009
+ <fo:block margin-top="3pt">
1010
+ <fo:inline font-weight="bold" padding-right="3mm">
1011
+ <xsl:value-of select="$section"/>
1012
+ </fo:inline>
1013
+ <xsl:apply-templates>
1014
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1015
+ <xsl:with-param name="inline" select="'true'"/>
1016
+ </xsl:apply-templates>
1017
+ </fo:block>
1018
+ </xsl:template>
1019
+
1020
+
1021
+ <xsl:template match="ogc:title">
1022
+ <xsl:param name="sectionNum"/>
1023
+
1024
+ <xsl:variable name="parent-name" select="local-name(..)"/>
1025
+ <xsl:variable name="references_num_current">
1026
+ <xsl:number level="any" count="ogc:references"/>
1027
+ </xsl:variable>
1028
+
1029
+ <xsl:variable name="id">
1030
+ <xsl:call-template name="getId"/>
1031
+ </xsl:variable>
1032
+
1033
+ <xsl:variable name="level">
1034
+ <xsl:call-template name="getLevel"/>
1035
+ </xsl:variable>
1036
+
1037
+ <xsl:variable name="section">
1038
+ <xsl:call-template name="getSection">
1039
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1040
+ </xsl:call-template>
1041
+ </xsl:variable>
1042
+
1043
+ <xsl:variable name="font-size">
1044
+ <xsl:choose>
1045
+ <xsl:when test="ancestor::ogc:preface and $level &gt;= 2">12pt</xsl:when>
1046
+ <xsl:when test="ancestor::ogc:preface">13pt</xsl:when>
1047
+ <xsl:when test="$level = 1">13pt</xsl:when>
1048
+ <xsl:when test="$level = 2 and ancestor::ogc:terms">11pt</xsl:when>
1049
+ <xsl:when test="$level = 2">12pt</xsl:when>
1050
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
1051
+ <xsl:otherwise>16pt</xsl:otherwise>
1052
+ </xsl:choose>
1053
+ </xsl:variable>
1054
+
1055
+ <xsl:variable name="element-name">
1056
+ <xsl:choose>
1057
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
1058
+ <xsl:otherwise>fo:block</xsl:otherwise>
1059
+ </xsl:choose>
1060
+ </xsl:variable>
1061
+
1062
+ <xsl:variable name="color" select="'rgb(14, 26, 133)'"/>
1063
+
1064
+ <xsl:choose>
1065
+ <xsl:when test="$parent-name = 'annex'">
1066
+ <fo:block id="{$id}" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always" color="{$color}">
1067
+ <xsl:value-of select="$section"/>
1068
+ <xsl:if test=" ../@obligation">
1069
+ <xsl:value-of select="$linebreak"/>
1070
+ <fo:inline font-weight="normal">(<xsl:value-of select="../@obligation"/>)</fo:inline>
1071
+ </xsl:if>
1072
+ <xsl:value-of select="$linebreak"/>
1073
+ <xsl:apply-templates/>
1074
+ </fo:block>
1075
+ </xsl:when>
1076
+ <xsl:otherwise>
1077
+ <xsl:element name="{$element-name}">
1078
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
1079
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
1080
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1081
+ <xsl:attribute name="space-before">13.5pt</xsl:attribute>
1082
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1083
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1084
+ <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
1085
+ <xsl:if test="$section != ''">
1086
+ <xsl:if test="$section != '0'">
1087
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1088
+ <xsl:choose>
1089
+ <xsl:when test="$level &gt;= 5"/>
1090
+ <xsl:when test="$level &gt;= 4">
1091
+ <fo:inline padding-right="4mm"> </fo:inline>
1092
+ </xsl:when>
1093
+ <xsl:when test="$level &gt;= 3 and ancestor::ogc:terms">
1094
+ <fo:inline padding-right="2mm"> </fo:inline>
1095
+ </xsl:when>
1096
+ <xsl:when test="$level &gt;= 2">
1097
+ <fo:inline padding-right="3mm"> </fo:inline>
1098
+ </xsl:when>
1099
+ <xsl:when test="$level = 1">
1100
+ <fo:inline padding-right="3mm"> </fo:inline>
1101
+ </xsl:when>
1102
+ <xsl:otherwise>
1103
+ <fo:inline padding-right="1mm"> </fo:inline>
1104
+ </xsl:otherwise>
1105
+ </xsl:choose>
1106
+ </xsl:if>
1107
+ </xsl:if>
1108
+ <xsl:apply-templates/>
1109
+ </xsl:element>
1110
+ </xsl:otherwise>
1111
+ </xsl:choose>
1112
+
1113
+ </xsl:template>
1114
+
1115
+
1116
+ <xsl:template match="ogc:p">
1117
+ <xsl:param name="inline" select="'false'"/>
1118
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1119
+ <xsl:variable name="element-name">
1120
+ <xsl:choose>
1121
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
1122
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
1123
+ <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when>
1124
+ <xsl:otherwise>fo:block</xsl:otherwise>
1125
+ </xsl:choose>
1126
+ </xsl:variable>
1127
+ <xsl:element name="{$element-name}">
1128
+ <xsl:attribute name="id">
1129
+ <xsl:value-of select="@id"/>
1130
+ </xsl:attribute>
1131
+ <xsl:attribute name="text-align">
1132
+ <xsl:choose>
1133
+ <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
1134
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1135
+ <xsl:otherwise>left</xsl:otherwise><!-- justify -->
1136
+ </xsl:choose>
1137
+ </xsl:attribute>
1138
+ <xsl:attribute name="space-after">
1139
+ <xsl:choose>
1140
+ <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1141
+ <xsl:otherwise>12pt</xsl:otherwise>
1142
+ </xsl:choose>
1143
+ </xsl:attribute>
1144
+ <xsl:if test="ancestor::ogc:dd and not(ancestor::ogc:table)">
1145
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1146
+ </xsl:if>
1147
+ <xsl:attribute name="line-height">115%</xsl:attribute>
1148
+ <xsl:apply-templates/>
1149
+ </xsl:element>
1150
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
1151
+ <fo:block margin-bottom="12pt">
1152
+ <xsl:if test="ancestor::ogc:annex">
1153
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
1154
+ </xsl:if>
1155
+ <xsl:value-of select="$linebreak"/>
1156
+ </fo:block>
1157
+ </xsl:if>
1158
+ <xsl:if test="$inline = 'true'">
1159
+ <fo:block> </fo:block>
1160
+ </xsl:if>
1161
+ </xsl:template>
1162
+
1163
+ <!--
1164
+ <fn reference="1">
1165
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1166
+ </fn>
1167
+ -->
1168
+ <xsl:template match="ogc:title/ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)] | ogc:p/*/ogc:fn[not(ancestor::ogc:table)] | ogc:sourcecode/ogc:fn[not(ancestor::ogc:table)]" priority="2">
1169
+ <fo:footnote keep-with-previous.within-line="always">
1170
+ <xsl:variable name="number" select="@reference"/>
1171
+
1172
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
1173
+ <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
1174
+ <xsl:value-of select="$number"/><!-- + count(//ogc:bibitem/ogc:note) -->
1175
+ </fo:basic-link>
1176
+ </fo:inline>
1177
+ <fo:footnote-body>
1178
+ <fo:block font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="black" text-align="justify">
1179
+ <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" -->
1180
+ <xsl:value-of select="$number "/><!-- + count(//ogc:bibitem/ogc:note) -->
1181
+ </fo:inline>
1182
+ <xsl:for-each select="ogc:p">
1183
+ <xsl:apply-templates/>
1184
+ </xsl:for-each>
1185
+ </fo:block>
1186
+ </fo:footnote-body>
1187
+ </fo:footnote>
1188
+ </xsl:template>
1189
+
1190
+ <xsl:template match="ogc:fn/ogc:p">
1191
+ <fo:block>
1192
+ <xsl:apply-templates/>
1193
+ </fo:block>
1194
+ </xsl:template>
1195
+
1196
+ <xsl:template match="ogc:review">
1197
+ <!-- comment 2019-11-29 -->
1198
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
1199
+ <xsl:apply-templates /> -->
1200
+ </xsl:template>
1201
+
1202
+ <xsl:template match="text()">
1203
+ <xsl:value-of select="."/>
1204
+ </xsl:template>
1205
+
1206
+
1207
+ <xsl:template match="ogc:image"> <!-- only for without outer figure -->
1208
+ <fo:block margin-top="12pt" margin-bottom="6pt">
1209
+ <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
1210
+ </fo:block>
1211
+ </xsl:template>
1212
+
1213
+ <xsl:template match="ogc:figure">
1214
+ <fo:block-container id="{@id}">
1215
+ <fo:block>
1216
+ <xsl:apply-templates/>
1217
+ </fo:block>
1218
+ <xsl:call-template name="fn_display_figure"/>
1219
+ <xsl:for-each select="ogc:note//ogc:p">
1220
+ <xsl:call-template name="note"/>
1221
+ </xsl:for-each>
1222
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="6pt" keep-with-previous="always">
1223
+ <xsl:variable name="title-figure">
1224
+ <xsl:call-template name="getTitle">
1225
+ <xsl:with-param name="name" select="'title-figure'"/>
1226
+ </xsl:call-template>
1227
+ </xsl:variable>
1228
+ <xsl:choose>
1229
+ <xsl:when test="ancestor::ogc:annex">
1230
+ <xsl:choose>
1231
+ <xsl:when test="local-name(..) = 'figure'">
1232
+ <xsl:number format="a) "/>
1233
+ </xsl:when>
1234
+ <xsl:otherwise>
1235
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1236
+ </xsl:otherwise>
1237
+ </xsl:choose>
1238
+
1239
+ </xsl:when>
1240
+ <xsl:otherwise>
1241
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1242
+ </xsl:otherwise>
1243
+ </xsl:choose>
1244
+ <xsl:if test="ogc:name">
1245
+ <xsl:if test="not(local-name(..) = 'figure')">
1246
+ <xsl:text> — </xsl:text>
1247
+ </xsl:if>
1248
+ <xsl:value-of select="ogc:name"/>
1249
+ </xsl:if>
1250
+ </fo:block>
1251
+ </fo:block-container>
1252
+ </xsl:template>
1253
+
1254
+ <xsl:template match="ogc:figure/ogc:name"/>
1255
+ <xsl:template match="ogc:figure/ogc:fn"/>
1256
+ <xsl:template match="ogc:figure/ogc:note"/>
1257
+
1258
+
1259
+ <xsl:template match="ogc:figure/ogc:image">
1260
+ <fo:block text-align="center">
1261
+ <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
1262
+ </fo:block>
1263
+ </xsl:template>
1264
+
1265
+
1266
+ <xsl:template match="ogc:bibitem">
1267
+ <fo:block id="{@id}" margin-bottom="12pt" start-indent="12mm" text-indent="-12mm" line-height="115%">
1268
+ <xsl:if test=".//ogc:fn">
1269
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
1270
+ </xsl:if>
1271
+ <xsl:choose>
1272
+ <xsl:when test="ogc:formattedref">
1273
+ <xsl:apply-templates select="ogc:formattedref"/>
1274
+ </xsl:when>
1275
+ <xsl:otherwise>
1276
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1277
+ <xsl:apply-templates/>
1278
+ <xsl:if test="position() != last()">, </xsl:if>
1279
+ <xsl:if test="position() = last()">: </xsl:if>
1280
+ </xsl:for-each>
1281
+ <!-- ogc:docidentifier -->
1282
+ <xsl:if test="ogc:docidentifier">
1283
+ <xsl:value-of select="ogc:docidentifier/@type"/><xsl:text> </xsl:text>
1284
+ <xsl:value-of select="ogc:docidentifier"/>
1285
+ </xsl:if>
1286
+ <xsl:apply-templates select="ogc:note"/>
1287
+ <xsl:if test="ogc:docidentifier">, </xsl:if>
1288
+ <fo:inline font-style="italic">
1289
+ <xsl:choose>
1290
+ <xsl:when test="ogc:title[@type = 'main' and @language = 'en']">
1291
+ <xsl:value-of select="ogc:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
1292
+ </xsl:when>
1293
+ <xsl:otherwise>
1294
+ <xsl:value-of select="ogc:title"/><xsl:text>. </xsl:text>
1295
+ </xsl:otherwise>
1296
+ </xsl:choose>
1297
+ </fo:inline>
1298
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1299
+ <xsl:apply-templates/>
1300
+ <xsl:if test="position() != last()">, </xsl:if>
1301
+ </xsl:for-each>
1302
+ <xsl:if test="ogc:date[@type='published']/ogc:on">
1303
+ <xsl:text>(</xsl:text><xsl:value-of select="ogc:date[@type='published']/ogc:on"/><xsl:text>)</xsl:text>
1304
+ </xsl:if>
1305
+ </xsl:otherwise>
1306
+ </xsl:choose>
1307
+ </fo:block>
1308
+ </xsl:template>
1309
+
1310
+
1311
+ <xsl:template match="ogc:bibitem/ogc:note">
1312
+ <fo:footnote>
1313
+ <xsl:variable name="number">
1314
+ <xsl:choose>
1315
+ <xsl:when test="ancestor::ogc:references[preceding-sibling::ogc:references]">
1316
+ <xsl:number level="any" count="ogc:references[preceding-sibling::ogc:references]//ogc:bibitem/ogc:note"/>
1317
+ </xsl:when>
1318
+ <xsl:otherwise>
1319
+ <xsl:number level="any" count="ogc:bibitem/ogc:note"/>
1320
+ </xsl:otherwise>
1321
+ </xsl:choose>
1322
+ </xsl:variable>
1323
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
1324
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1325
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1326
+ </fo:basic-link>
1327
+ </fo:inline>
1328
+ <fo:footnote-body>
1329
+ <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
1330
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
1331
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1332
+ </fo:inline>
1333
+ <xsl:apply-templates/>
1334
+ </fo:block>
1335
+ </fo:footnote-body>
1336
+ </fo:footnote>
1337
+ </xsl:template>
1338
+
1339
+
1340
+
1341
+ <xsl:template match="ogc:ul | ogc:ol">
1342
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
1343
+ <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
1344
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1345
+ </xsl:if>
1346
+ <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
1347
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1348
+ </xsl:if>
1349
+ <xsl:apply-templates/>
1350
+ </fo:list-block>
1351
+ </xsl:template>
1352
+
1353
+ <xsl:template match="ogc:li">
1354
+ <fo:list-item>
1355
+ <fo:list-item-label end-indent="label-end()">
1356
+ <fo:block>
1357
+ <xsl:choose>
1358
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1359
+ <xsl:otherwise> <!-- for ordered lists -->
1360
+ <xsl:choose>
1361
+ <xsl:when test="../@type = 'arabic'">
1362
+ <xsl:number format="a)"/>
1363
+ </xsl:when>
1364
+ <xsl:when test="../@type = 'alphabet'">
1365
+ <xsl:number format="1)"/>
1366
+ </xsl:when>
1367
+ <xsl:when test="../@type = 'alphabet_upper'">
1368
+ <xsl:number format="A)"/>
1369
+ </xsl:when>
1370
+
1371
+ <xsl:when test="../@type = 'roman'">
1372
+ <xsl:number format="i)"/>
1373
+ </xsl:when>
1374
+ <xsl:otherwise>
1375
+ <xsl:number format="1)"/>
1376
+ </xsl:otherwise>
1377
+ </xsl:choose>
1378
+ </xsl:otherwise>
1379
+ </xsl:choose>
1380
+ </fo:block>
1381
+ </fo:list-item-label>
1382
+ <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1383
+ <xsl:apply-templates/>
1384
+ </fo:list-item-body>
1385
+ </fo:list-item>
1386
+ </xsl:template>
1387
+
1388
+ <xsl:template match="ogc:ul/ogc:note | ogc:ol/ogc:note">
1389
+ <fo:list-item font-size="10pt">
1390
+ <fo:list-item-label><fo:block/></fo:list-item-label>
1391
+ <fo:list-item-body>
1392
+ <xsl:apply-templates/>
1393
+ </fo:list-item-body>
1394
+ </fo:list-item>
1395
+ </xsl:template>
1396
+
1397
+ <xsl:template match="ogc:term">
1398
+ <xsl:param name="sectionNum"/>
1399
+ <fo:block id="{@id}">
1400
+ <xsl:apply-templates>
1401
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1402
+ </xsl:apply-templates>
1403
+ </fo:block>
1404
+ </xsl:template>
1405
+
1406
+ <xsl:template match="ogc:preferred">
1407
+ <xsl:param name="sectionNum"/>
1408
+ <xsl:variable name="section">
1409
+ <xsl:call-template name="getSection">
1410
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1411
+ </xsl:call-template>
1412
+ </xsl:variable>
1413
+ <xsl:variable name="level">
1414
+ <xsl:call-template name="getLevel"/>
1415
+ </xsl:variable>
1416
+ <xsl:variable name="font-size">
1417
+ <xsl:choose>
1418
+ <xsl:when test="$level &gt;= 2">11pt</xsl:when>
1419
+ <xsl:otherwise>12pt</xsl:otherwise>
1420
+ </xsl:choose>
1421
+ </xsl:variable>
1422
+ <fo:block font-size="{$font-size}">
1423
+ <fo:block font-weight="bold" keep-with-next="always">
1424
+ <fo:inline>
1425
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1426
+ </fo:inline>
1427
+ </fo:block>
1428
+ <fo:block font-weight="bold" keep-with-next="always" line-height="1">
1429
+ <xsl:apply-templates/>
1430
+ </fo:block>
1431
+ </fo:block>
1432
+ </xsl:template>
1433
+
1434
+ <xsl:template match="ogc:admitted">
1435
+ <fo:block font-size="11pt">
1436
+ <xsl:apply-templates/>
1437
+ </fo:block>
1438
+ </xsl:template>
1439
+
1440
+ <xsl:template match="ogc:deprecates">
1441
+ <xsl:variable name="title-deprecated">
1442
+ <xsl:call-template name="getTitle">
1443
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1444
+ </xsl:call-template>
1445
+ </xsl:variable>
1446
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1447
+ </xsl:template>
1448
+
1449
+ <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]">
1450
+ <xsl:apply-templates/>
1451
+ </xsl:template>
1452
+ <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]/ogc:p">
1453
+ <fo:inline> <xsl:apply-templates/></fo:inline>
1454
+ <fo:block> </fo:block>
1455
+ </xsl:template>
1456
+
1457
+ <xsl:template match="ogc:definition">
1458
+ <fo:block space-after="6pt">
1459
+ <xsl:apply-templates/>
1460
+ </fo:block>
1461
+ </xsl:template>
1462
+
1463
+ <xsl:template match="ogc:termsource">
1464
+ <fo:block margin-bottom="12pt" keep-with-previous="always">
1465
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1466
+ <fo:basic-link internal-destination="{ogc:origin/@bibitemid}" fox:alt-text="{ogc:origin/@citeas}">
1467
+ <xsl:text>[</xsl:text>
1468
+ <xsl:variable name="title-source">
1469
+ <xsl:call-template name="getTitle">
1470
+ <xsl:with-param name="name" select="'title-source'"/>
1471
+ </xsl:call-template>
1472
+ </xsl:variable>
1473
+ <xsl:value-of select="$title-source"/>
1474
+ <xsl:text>: </xsl:text>
1475
+ <fo:inline color="blue" text-decoration="underline">
1476
+ <xsl:value-of select="ogc:origin/@citeas"/>
1477
+
1478
+ <xsl:apply-templates select="ogc:origin/ogc:localityStack"/>
1479
+
1480
+ </fo:inline>
1481
+ </fo:basic-link>
1482
+ <xsl:apply-templates select="ogc:modification"/>
1483
+ <xsl:text>]</xsl:text>
1484
+ </fo:block>
1485
+ </xsl:template>
1486
+
1487
+
1488
+ <xsl:template match="ogc:modification/ogc:p">
1489
+ <fo:inline><xsl:apply-templates/></fo:inline>
1490
+ </xsl:template>
1491
+
1492
+ <xsl:template match="ogc:termnote">
1493
+ <fo:block font-size="10pt" margin-bottom="12pt">
1494
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1495
+ <xsl:variable name="title-note-to-entry">
1496
+ <xsl:call-template name="getTitle">
1497
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1498
+ </xsl:call-template>
1499
+ </xsl:variable>
1500
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1501
+ <xsl:apply-templates/>
1502
+ </fo:block>
1503
+ </xsl:template>
1504
+
1505
+ <xsl:template match="ogc:termnote/ogc:p">
1506
+ <fo:inline><xsl:apply-templates/></fo:inline>
1507
+ </xsl:template>
1508
+
1509
+ <xsl:template match="ogc:domain">
1510
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
1511
+ </xsl:template>
1512
+
1513
+
1514
+ <xsl:template match="ogc:termexample">
1515
+ <fo:block font-size="10pt" margin-bottom="12pt">
1516
+ <xsl:variable name="title-example">
1517
+ <xsl:call-template name="getTitle">
1518
+ <xsl:with-param name="name" select="'title-example'"/>
1519
+ </xsl:call-template>
1520
+ </xsl:variable>
1521
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
1522
+ <xsl:apply-templates/>
1523
+ </fo:block>
1524
+ </xsl:template>
1525
+
1526
+ <xsl:template match="ogc:termexample/ogc:p">
1527
+ <fo:inline><xsl:apply-templates/></fo:inline>
1528
+ </xsl:template>
1529
+
1530
+
1531
+ <xsl:template match="ogc:annex">
1532
+ <fo:block break-after="page"/>
1533
+ <xsl:apply-templates/>
1534
+ </xsl:template>
1535
+
1536
+
1537
+ <!-- [position() &gt; 1] -->
1538
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']">
1539
+ <fo:block break-after="page"/>
1540
+ <fo:block line-height="120%">
1541
+ <xsl:apply-templates/>
1542
+ </fo:block>
1543
+ </xsl:template>
1544
+
1545
+
1546
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1547
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem"> [position() &gt; 1] -->
1548
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem">
1549
+ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1550
+ <fo:list-item>
1551
+ <fo:list-item-label end-indent="label-end()">
1552
+ <fo:block>
1553
+ <fo:inline id="{@id}">
1554
+ <xsl:number format="[1]"/>
1555
+ </fo:inline>
1556
+ </fo:block>
1557
+ </fo:list-item-label>
1558
+ <fo:list-item-body start-indent="body-start()">
1559
+ <fo:block>
1560
+
1561
+ <xsl:if test="not(ogc:formattedref)">
1562
+ <xsl:choose>
1563
+ <xsl:when test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:abbreviation">
1564
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:abbreviation">
1565
+ <xsl:value-of select="."/>
1566
+ <xsl:if test="position() != last()">/</xsl:if>
1567
+ </xsl:for-each>
1568
+ <xsl:text>: </xsl:text>
1569
+ </xsl:when>
1570
+ <xsl:when test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1571
+ <xsl:value-of select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name"/>
1572
+ <xsl:text>: </xsl:text>
1573
+ </xsl:when>
1574
+ </xsl:choose>
1575
+
1576
+ </xsl:if>
1577
+
1578
+ <xsl:if test="ogc:docidentifier">
1579
+ <xsl:choose>
1580
+ <xsl:when test="ogc:docidentifier/@type = 'ISO' and ogc:formattedref"/>
1581
+ <xsl:when test="ogc:docidentifier/@type = 'OGC' and ogc:formattedref"/>
1582
+ <xsl:otherwise><fo:inline>
1583
+ <xsl:if test="ogc:docidentifier/@type = 'OGC'">OGC </xsl:if>
1584
+ <xsl:value-of select="ogc:docidentifier"/><xsl:apply-templates select="ogc:note"/>, </fo:inline></xsl:otherwise>
1585
+ </xsl:choose>
1586
+ </xsl:if>
1587
+
1588
+
1589
+
1590
+ <xsl:choose>
1591
+ <xsl:when test="ogc:title[@type = 'main' and @language = 'en']">
1592
+ <xsl:apply-templates select="ogc:title[@type = 'main' and @language = 'en']"/>
1593
+ </xsl:when>
1594
+ <xsl:otherwise>
1595
+ <xsl:apply-templates select="ogc:title"/>
1596
+ </xsl:otherwise>
1597
+ </xsl:choose>
1598
+ <xsl:if test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1599
+ <xsl:text>, </xsl:text>
1600
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1601
+ <xsl:if test="position() != last()">and </xsl:if>
1602
+ <xsl:value-of select="."/>
1603
+ </xsl:for-each>
1604
+
1605
+ </xsl:if>
1606
+ <xsl:if test="ogc:place">
1607
+ <xsl:text>, </xsl:text>
1608
+ <xsl:value-of select="ogc:place"/>
1609
+ </xsl:if>
1610
+ <xsl:if test="ogc:date[@type='published']/ogc:on">
1611
+ <xsl:text> (</xsl:text><xsl:value-of select="ogc:date[@type='published']/ogc:on"/><xsl:text>).</xsl:text>
1612
+ </xsl:if>
1613
+ <xsl:apply-templates select="ogc:formattedref"/>
1614
+ </fo:block>
1615
+ </fo:list-item-body>
1616
+ </fo:list-item>
1617
+ </fo:list-block>
1618
+ </xsl:template>
1619
+
1620
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem" mode="contents"/> [position() &gt; 1] -->
1621
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem" mode="contents"/>
1622
+
1623
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem/ogc:title"> [position() &gt; 1]-->
1624
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem/ogc:title">
1625
+ <fo:inline font-style="italic">
1626
+ <xsl:apply-templates/>
1627
+ </fo:inline>
1628
+ </xsl:template>
1629
+
1630
+ <xsl:template match="ogc:quote">
1631
+ <fo:block margin-top="12pt" margin-left="13mm" margin-right="12mm">
1632
+ <xsl:apply-templates select=".//ogc:p"/>
1633
+ </fo:block>
1634
+ <xsl:if test="ogc:author or ogc:source">
1635
+ <fo:block text-align="right" margin-right="25mm">
1636
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1637
+ <xsl:if test="ogc:author">
1638
+ <xsl:text>— </xsl:text><xsl:value-of select="ogc:author"/>
1639
+ </xsl:if>
1640
+ <xsl:if test="ogc:source">
1641
+ <xsl:text>, </xsl:text>
1642
+ <xsl:apply-templates select="ogc:source"/>
1643
+ </xsl:if>
1644
+ </fo:block>
1645
+ </xsl:if>
1646
+ </xsl:template>
1647
+
1648
+ <xsl:template match="ogc:source">
1649
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1650
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1651
+ <xsl:apply-templates select="ogc:localityStack"/>
1652
+ </fo:basic-link>
1653
+ </xsl:template>
1654
+
1655
+
1656
+ <xsl:template match="ogc:xref">
1657
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
1658
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1659
+ <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
1660
+ <xsl:attribute name="color">blue</xsl:attribute>
1661
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1662
+ <!-- </xsl:if> -->
1663
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1664
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1665
+
1666
+ <xsl:variable name="title-clause">
1667
+ <xsl:call-template name="getTitle">
1668
+ <xsl:with-param name="name" select="'title-clause'"/>
1669
+ </xsl:call-template>
1670
+ </xsl:variable>
1671
+ <xsl:variable name="title-annex">
1672
+ <xsl:call-template name="getTitle">
1673
+ <xsl:with-param name="name" select="'title-annex'"/>
1674
+ </xsl:call-template>
1675
+ </xsl:variable>
1676
+
1677
+ <xsl:choose>
1678
+ <xsl:when test="normalize-space(.) != ''">
1679
+ <xsl:apply-templates/>
1680
+ </xsl:when>
1681
+ <xsl:otherwise>
1682
+ <xsl:choose>
1683
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1684
+ <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')"><xsl:value-of select="$title-clause"/></xsl:when>
1685
+ <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1686
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1687
+ </xsl:choose>
1688
+ <xsl:value-of select="$section"/>
1689
+ </xsl:otherwise>
1690
+ </xsl:choose>
1691
+ </fo:basic-link>
1692
+ </xsl:template>
1693
+
1694
+ <xsl:template match="ogc:sourcecode" priority="2">
1695
+ <xsl:call-template name="sourcecode"/>
1696
+ <xsl:variable name="title-figure">
1697
+ <xsl:call-template name="getTitle">
1698
+ <xsl:with-param name="name" select="'title-figure'"/>
1699
+ </xsl:call-template>
1700
+ </xsl:variable>
1701
+ <xsl:choose>
1702
+ <xsl:when test="@unnumbered='true'"/>
1703
+ <xsl:when test="ancestor::ogc:example"/>
1704
+ <xsl:when test="ancestor::ogc:td"/>
1705
+ <xsl:when test="ancestor::ogc:annex">
1706
+ <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1707
+ <xsl:choose>
1708
+ <xsl:when test="count(//ogc:annex) = 1">
1709
+ <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"/>
1710
+ </xsl:when>
1711
+ <xsl:otherwise>
1712
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1713
+ <xsl:value-of select="$title-figure"/>
1714
+ <xsl:number format="A." level="multiple" count="ogc:annex"/>
1715
+ <xsl:number format="1" level="any" count="ogc:sourcecode[ancestor::ogc:annex/@id = $id_annex and not(@unnumbered='true') and not(ancestor::ogc:example)]"/>
1716
+ <xsl:if test="ogc:name">
1717
+ <xsl:text> — </xsl:text>
1718
+ <xsl:apply-templates select="ogc:name/*"/>
1719
+ </xsl:if>
1720
+ </fo:block>
1721
+ </xsl:otherwise>
1722
+ </xsl:choose>
1723
+ </xsl:when>
1724
+ <xsl:otherwise>
1725
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1726
+ <xsl:value-of select="$title-figure"/>
1727
+ <xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1728
+ <xsl:if test="ogc:name">
1729
+ <xsl:text> — </xsl:text>
1730
+ <xsl:apply-templates select="ogc:name/*"/>
1731
+ </xsl:if>
1732
+ </fo:block>
1733
+ </xsl:otherwise>
1734
+ </xsl:choose>
1735
+ </xsl:template>
1736
+
1737
+ <xsl:template match="ogc:sourcecode/text()">
1738
+ <xsl:variable name="text">
1739
+ <xsl:call-template name="add-zero-spaces-equal"/>
1740
+ </xsl:variable>
1741
+ <xsl:call-template name="add-zero-spaces">
1742
+ <xsl:with-param name="text" select="$text"/>
1743
+ </xsl:call-template>
1744
+ </xsl:template>
1745
+
1746
+
1747
+ <xsl:template match="ogc:sourcecode/ogc:name"/>
1748
+
1749
+ <xsl:template match="ogc:example">
1750
+ <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1751
+ <xsl:variable name="title-example">
1752
+ <xsl:call-template name="getTitle">
1753
+ <xsl:with-param name="name" select="'title-example'"/>
1754
+ </xsl:call-template>
1755
+ </xsl:variable>
1756
+ <xsl:value-of select="normalize-space($title-example)"/>
1757
+ <xsl:if test="following-sibling::ogc:example or preceding-sibling::ogc:example">
1758
+ <xsl:number format=" 1"/>
1759
+ </xsl:if>
1760
+ <xsl:if test="ogc:name">
1761
+ <xsl:text> — </xsl:text>
1762
+ <xsl:apply-templates select="ogc:name/node()"/>
1763
+ </xsl:if>
1764
+ </fo:block>
1765
+ <fo:block font-size="10pt" margin-left="12.5mm" margin-right="12.5mm">
1766
+ <xsl:apply-templates/>
1767
+ </fo:block>
1768
+ </xsl:template>
1769
+
1770
+ <xsl:template match="ogc:example/ogc:name"/>
1771
+
1772
+ <xsl:template match="ogc:example/ogc:p">
1773
+ <fo:block margin-bottom="14pt">
1774
+ <xsl:apply-templates/>
1775
+ </fo:block>
1776
+ </xsl:template>
1777
+
1778
+
1779
+
1780
+ <xsl:template match="ogc:note/ogc:p" name="note">
1781
+ <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" line-height="115%">
1782
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol and not(ancestor::ogc:note[1]/following-sibling::*)">
1783
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1784
+ </xsl:if>
1785
+ <xsl:variable name="clauseid" select="ancestor::ogc:clause[1]/@id"/>
1786
+ <fo:inline padding-right="4mm">
1787
+ <xsl:variable name="title-note">
1788
+ <xsl:call-template name="getTitle">
1789
+ <xsl:with-param name="name" select="'title-note'"/>
1790
+ </xsl:call-template>
1791
+ </xsl:variable>
1792
+ <xsl:value-of select="$title-note"/>
1793
+ <xsl:if test="count(//ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]) &gt; 1">
1794
+ <xsl:number count="ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]" level="any"/>
1795
+ </xsl:if>
1796
+ </fo:inline>
1797
+ <xsl:apply-templates/>
1798
+ </fo:block>
1799
+ </xsl:template>
1800
+
1801
+ <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
1802
+ <xsl:template match="ogc:eref">
1803
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}" color="blue" text-decoration="underline"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1804
+ <xsl:if test="@type = 'footnote'">
1805
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1806
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1807
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1808
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1809
+ </xsl:if>
1810
+ <xsl:if test="@type = 'inline'">
1811
+ <xsl:attribute name="color">blue</xsl:attribute>
1812
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1813
+ </xsl:if>
1814
+ <!-- <xsl:if test="@type = 'inline'">
1815
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1816
+ </xsl:if> -->
1817
+ <xsl:choose>
1818
+ <xsl:when test="@citeas and normalize-space(text()) = ''">
1819
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1820
+ </xsl:when>
1821
+ <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1822
+ <xsl:value-of select="//ogc:bibitem[@id = current()/@bibitemid]/ogc:docidentifier"/>
1823
+ </xsl:when>
1824
+ <xsl:otherwise/>
1825
+ </xsl:choose>
1826
+ <xsl:apply-templates select="ogc:localityStack"/>
1827
+ <xsl:apply-templates select="text()"/>
1828
+ </fo:basic-link>
1829
+ </xsl:template>
1830
+
1831
+ <xsl:template match="ogc:locality">
1832
+ <xsl:variable name="title-clause">
1833
+ <xsl:call-template name="getTitle">
1834
+ <xsl:with-param name="name" select="'title-clause'"/>
1835
+ </xsl:call-template>
1836
+ </xsl:variable>
1837
+ <xsl:variable name="title-annex">
1838
+ <xsl:call-template name="getTitle">
1839
+ <xsl:with-param name="name" select="'title-annex'"/>
1840
+ </xsl:call-template>
1841
+ </xsl:variable>
1842
+ <xsl:choose>
1843
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1844
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1845
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1846
+ </xsl:choose>
1847
+ <xsl:text> </xsl:text><xsl:value-of select="ogc:referenceFrom"/>
1848
+ </xsl:template>
1849
+
1850
+ <xsl:template match="ogc:admonition">
1851
+ <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">
1852
+ <fo:block-container margin-left="0mm" margin-right="0mm" padding="2mm" padding-top="3mm">
1853
+ <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1854
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
1855
+ </fo:block>
1856
+ <fo:block font-style="italic">
1857
+ <xsl:apply-templates/>
1858
+ </fo:block>
1859
+ </fo:block-container>
1860
+ </fo:block-container>
1861
+
1862
+
1863
+ </xsl:template>
1864
+
1865
+ <xsl:template match="ogc:formula">
1866
+ <fo:block id="{@id}">
1867
+ <xsl:apply-templates/>
1868
+ </fo:block>
1869
+ </xsl:template>
1870
+
1871
+ <xsl:template match="ogc:formula/ogc:dt/ogc:stem">
1872
+ <fo:inline>
1873
+ <xsl:apply-templates/>
1874
+ </fo:inline>
1875
+ </xsl:template>
1876
+
1877
+ <xsl:template match="ogc:formula/ogc:stem">
1878
+ <fo:block margin-top="6pt" margin-bottom="12pt">
1879
+ <fo:table table-layout="fixed" width="100%">
1880
+ <fo:table-column column-width="95%"/>
1881
+ <fo:table-column column-width="5%"/>
1882
+ <fo:table-body>
1883
+ <fo:table-row>
1884
+ <fo:table-cell display-align="center">
1885
+ <fo:block text-align="left" margin-left="5mm">
1886
+ <xsl:apply-templates/>
1887
+ </fo:block>
1888
+ </fo:table-cell>
1889
+ <fo:table-cell display-align="center">
1890
+ <fo:block text-align="right">
1891
+ <xsl:choose>
1892
+ <xsl:when test="ancestor::ogc:annex">
1893
+ <xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
1894
+ </xsl:when>
1895
+ <xsl:otherwise> <!-- not(ancestor::ogc:annex) -->
1896
+ <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="ogc:formula"/><xsl:text>)</xsl:text> -->
1897
+ </xsl:otherwise>
1898
+ </xsl:choose>
1899
+ </fo:block>
1900
+ </fo:table-cell>
1901
+ </fo:table-row>
1902
+ </fo:table-body>
1903
+ </fo:table>
1904
+ <fo:inline keep-together.within-line="always">
1905
+ </fo:inline>
1906
+ </fo:block>
1907
+ </xsl:template>
1908
+
1909
+
1910
+ <xsl:template match="ogc:br" priority="2">
1911
+ <!-- <fo:block>&#xA0;</fo:block> -->
1912
+ <xsl:value-of select="$linebreak"/>
1913
+ </xsl:template>
1914
+
1915
+ <xsl:template match="ogc:pagebreak">
1916
+ <fo:block break-after="page"/>
1917
+ <fo:block> </fo:block>
1918
+ <fo:block break-after="page"/>
1919
+ </xsl:template>
1920
+
1921
+ <xsl:template name="insertHeaderFooter">
1922
+ <xsl:param name="pagenum-font-weight" select="'normal'"/>
1923
+ <fo:static-content flow-name="header-even">
1924
+ <fo:block-container height="17mm" display-align="before">
1925
+ <fo:block padding-top="12.5mm">
1926
+ <xsl:value-of select="$header"/>
1927
+ </fo:block>
1928
+ </fo:block-container>
1929
+ </fo:static-content>
1930
+ <fo:static-content flow-name="footer-even">
1931
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1932
+ <fo:table table-layout="fixed" width="100%">
1933
+ <fo:table-column column-width="10%"/>
1934
+ <fo:table-column column-width="90%"/>
1935
+ <fo:table-body>
1936
+ <fo:table-row>
1937
+ <fo:table-cell>
1938
+ <fo:block padding-bottom="5mm" font-weight="{$pagenum-font-weight}">
1939
+ <fo:page-number/>
1940
+ </fo:block>
1941
+ </fo:table-cell>
1942
+ <fo:table-cell padding-right="2mm">
1943
+ <fo:block padding-bottom="5mm" text-align="right">
1944
+ <xsl:value-of select="$copyright_short"/></fo:block>
1945
+ </fo:table-cell>
1946
+ </fo:table-row>
1947
+ </fo:table-body>
1948
+ </fo:table>
1949
+ </fo:block-container>
1950
+ </fo:static-content>
1951
+ <fo:static-content flow-name="header-odd">
1952
+ <fo:block-container height="17mm" display-align="before">
1953
+ <fo:block text-align="right" padding-top="12.5mm">
1954
+ <xsl:value-of select="$header"/>
1955
+ </fo:block>
1956
+ </fo:block-container>
1957
+ </fo:static-content>
1958
+ <fo:static-content flow-name="footer-odd">
1959
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1960
+ <fo:table table-layout="fixed" width="100%">
1961
+ <fo:table-column column-width="90%"/>
1962
+ <fo:table-column column-width="10%"/>
1963
+ <fo:table-body>
1964
+ <fo:table-row>
1965
+ <fo:table-cell>
1966
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
1967
+ </fo:table-cell>
1968
+ <fo:table-cell padding-right="2mm">
1969
+ <fo:block padding-bottom="5mm" text-align="right" font-weight="{$pagenum-font-weight}"><fo:page-number/></fo:block>
1970
+ </fo:table-cell>
1971
+ </fo:table-row>
1972
+ </fo:table-body>
1973
+ </fo:table>
1974
+ </fo:block-container>
1975
+ </fo:static-content>
1976
+ </xsl:template>
1977
+
1978
+
1979
+ <xsl:template name="getSection">
1980
+ <xsl:param name="sectionNum"/>
1981
+ <xsl:variable name="level">
1982
+ <xsl:call-template name="getLevel"/>
1983
+ </xsl:variable>
1984
+ <xsl:variable name="section">
1985
+ <xsl:choose>
1986
+ <xsl:when test="ancestor::ogc:bibliography">
1987
+ <xsl:value-of select="$sectionNum"/>
1988
+ </xsl:when>
1989
+ <xsl:when test="ancestor::ogc:sections">
1990
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1991
+ <xsl:choose>
1992
+ <xsl:when test="$level = 1">
1993
+ <xsl:value-of select="$sectionNum"/>
1994
+ </xsl:when>
1995
+ <xsl:when test="$level &gt;= 2">
1996
+ <xsl:variable name="num">
1997
+ <xsl:call-template name="getSubSection"/>
1998
+ </xsl:variable>
1999
+ <xsl:value-of select="concat($sectionNum, $num)"/>
2000
+ </xsl:when>
2001
+ <xsl:otherwise>
2002
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
2003
+ </xsl:otherwise>
2004
+ </xsl:choose>
2005
+ <!-- <xsl:text>.</xsl:text> -->
2006
+ </xsl:when>
2007
+ <!-- <xsl:when test="ancestor::ogc:annex[@obligation = 'informative']">
2008
+ <xsl:choose>
2009
+ <xsl:when test="$level = 1">
2010
+ <xsl:text>Annex </xsl:text>
2011
+ <xsl:number format="I" level="any" count="ogc:annex[@obligation = 'informative']"/>
2012
+ </xsl:when>
2013
+ <xsl:otherwise>
2014
+ <xsl:number format="I.1" level="multiple" count="ogc:annex[@obligation = 'informative'] | ogc:clause"/>
2015
+ </xsl:otherwise>
2016
+ </xsl:choose>
2017
+ </xsl:when> -->
2018
+ <xsl:when test="ancestor::ogc:annex">
2019
+ <xsl:choose>
2020
+ <xsl:when test="$level = 1">
2021
+ <xsl:variable name="title-annex">
2022
+ <xsl:call-template name="getTitle">
2023
+ <xsl:with-param name="name" select="'title-annex'"/>
2024
+ </xsl:call-template>
2025
+ </xsl:variable>
2026
+ <xsl:value-of select="$title-annex"/>
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 name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2070
+
2071
+ <title-table lang="en">Table </title-table>
2072
+ <title-table lang="fr">Tableau </title-table>
2073
+
2074
+ <title-table lang="zh">Table </title-table>
2075
+
2076
+
2077
+
2078
+ <title-note lang="en">NOTE </title-note>
2079
+ <title-note lang="fr">NOTE </title-note>
2080
+
2081
+ <title-note lang="zh">NOTE </title-note>
2082
+
2083
+
2084
+
2085
+ <title-figure lang="en">Figure </title-figure>
2086
+ <title-figure lang="fr">Figure </title-figure>
2087
+
2088
+ <title-figure lang="zh">Figure </title-figure>
2089
+
2090
+
2091
+
2092
+ <title-example lang="en">EXAMPLE </title-example>
2093
+ <title-example lang="fr">EXEMPLE </title-example>
2094
+
2095
+ <title-example lang="zh">EXAMPLE </title-example>
2096
+
2097
+
2098
+
2099
+ <title-example-xref lang="en">Example </title-example-xref>
2100
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2101
+
2102
+ <title-section lang="en">Section </title-section>
2103
+ <title-section lang="fr">Section </title-section>
2104
+
2105
+ <title-inequality lang="en">Inequality </title-inequality>
2106
+ <title-inequality lang="fr">Inequality </title-inequality>
2107
+
2108
+ <title-equation lang="en">Equation </title-equation>
2109
+ <title-equation lang="fr">Equation </title-equation>
2110
+
2111
+ <title-annex lang="en">Annex </title-annex>
2112
+ <title-annex lang="fr">Annexe </title-annex>
2113
+
2114
+ <title-annex lang="zh">Annex </title-annex>
2115
+
2116
+
2117
+
2118
+ <title-appendix lang="en">Appendix </title-appendix>
2119
+ <title-appendix lang="fr">Appendix </title-appendix>
2120
+
2121
+ <title-clause lang="en">Clause </title-clause>
2122
+ <title-clause lang="fr">Article </title-clause>
2123
+
2124
+ <title-clause lang="zh">Clause </title-clause>
2125
+
2126
+
2127
+
2128
+ <title-edition lang="en">
2129
+
2130
+
2131
+ <xsl:text>Version</xsl:text>
2132
+
2133
+ </title-edition>
2134
+
2135
+ <title-formula lang="en">Formula </title-formula>
2136
+ <title-formula lang="fr">Formula </title-formula>
2137
+
2138
+ <title-toc lang="en">
2139
+
2140
+ <xsl:text>Contents</xsl:text>
2141
+
2142
+
2143
+
2144
+ </title-toc>
2145
+ <title-toc lang="fr">Sommaire</title-toc>
2146
+
2147
+ <title-toc lang="zh">Contents</title-toc>
2148
+
2149
+
2150
+
2151
+ <title-page lang="en">Page</title-page>
2152
+ <title-page lang="fr">Page</title-page>
2153
+
2154
+ <title-key lang="en">Key</title-key>
2155
+ <title-key lang="fr">Légende</title-key>
2156
+
2157
+ <title-where lang="en">where</title-where>
2158
+ <title-where lang="fr">où</title-where>
2159
+
2160
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2161
+
2162
+ <title-part lang="en">
2163
+
2164
+
2165
+ </title-part>
2166
+ <title-part lang="fr">
2167
+
2168
+
2169
+ </title-part>
2170
+ <title-part lang="zh">第 # 部分:</title-part>
2171
+
2172
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2173
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2174
+
2175
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2176
+
2177
+
2178
+
2179
+ <title-modified lang="en">modified</title-modified>
2180
+ <title-modified lang="fr">modifiée</title-modified>
2181
+
2182
+ <title-modified lang="zh">modified</title-modified>
2183
+
2184
+
2185
+
2186
+ <title-source lang="en">SOURCE</title-source>
2187
+
2188
+ <title-keywords lang="en">Keywords</title-keywords>
2189
+
2190
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2191
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2192
+
2193
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2194
+
2195
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2196
+
2197
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2198
+
2199
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2200
+
2201
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2202
+
2203
+ <title-abstract lang="en">Abstract</title-abstract>
2204
+
2205
+ <title-summary lang="en">Summary</title-summary>
2206
+
2207
+ <title-in lang="en">in </title-in>
2208
+
2209
+ <title-box lang="en">Box </title-box>
2210
+
2211
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2212
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2213
+
2214
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2215
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2216
+
2217
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2218
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2219
+
2220
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2221
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2222
+
2223
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2224
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2225
+
2226
+ <title-caution lang="en">CAUTION</title-caution>
2227
+ <title-caution lang="zh">注意</title-caution>
2228
+
2229
+ <title-warning lang="en">WARNING</title-warning>
2230
+ <title-warning lang="zh">警告</title-warning>
2231
+
2232
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2233
+ </xsl:variable><xsl:template name="getTitle">
2234
+ <xsl:param name="name"/>
2235
+ <xsl:variable name="lang">
2236
+ <xsl:call-template name="getLang"/>
2237
+ </xsl:variable>
2238
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2239
+ <xsl:choose>
2240
+ <xsl:when test="normalize-space($title_) != ''">
2241
+ <xsl:value-of select="$title_"/>
2242
+ </xsl:when>
2243
+ <xsl:otherwise>
2244
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2245
+ </xsl:otherwise>
2246
+ </xsl:choose>
2247
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2248
+
2249
+ <xsl:attribute name="color">blue</xsl:attribute>
2250
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2251
+
2252
+
2253
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2254
+
2255
+
2256
+
2257
+
2258
+
2259
+
2260
+
2261
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2262
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2263
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2264
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2265
+ <xsl:attribute name="line-height">113%</xsl:attribute>
2266
+
2267
+
2268
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2269
+
2270
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2271
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2272
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2273
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2274
+
2275
+
2276
+
2277
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2278
+
2279
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2280
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2281
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2282
+
2283
+
2284
+
2285
+ </xsl:attribute-set><xsl:template match="text()">
2286
+ <xsl:value-of select="."/>
2287
+ </xsl:template><xsl:template match="*[local-name()='br']">
2288
+ <xsl:value-of select="$linebreak"/>
2289
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2290
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2291
+ <xsl:call-template name="add-zero-spaces-java"/>
2292
+ </xsl:template><xsl:template match="*[local-name()='table']">
2293
+
2294
+ <xsl:variable name="simple-table">
2295
+ <!-- <xsl:copy> -->
2296
+ <xsl:call-template name="getSimpleTable"/>
2297
+ <!-- </xsl:copy> -->
2298
+ </xsl:variable>
2299
+
2300
+ <!-- DEBUG -->
2301
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2302
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2303
+
2304
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2305
+
2306
+ <!-- <xsl:if test="$namespace = 'iso'">
2307
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2308
+ </xsl:if> -->
2309
+
2310
+ <xsl:choose>
2311
+ <xsl:when test="@unnumbered = 'true'"/>
2312
+ <xsl:otherwise>
2313
+
2314
+
2315
+
2316
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2317
+
2318
+
2319
+
2320
+
2321
+
2322
+
2323
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2324
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2325
+
2326
+
2327
+
2328
+ <xsl:variable name="title-table">
2329
+ <xsl:call-template name="getTitle">
2330
+ <xsl:with-param name="name" select="'title-table'"/>
2331
+ </xsl:call-template>
2332
+ </xsl:variable>
2333
+ <xsl:value-of select="$title-table"/>
2334
+
2335
+ <xsl:call-template name="getTableNumber"/>
2336
+
2337
+
2338
+ <xsl:if test="*[local-name()='name']">
2339
+
2340
+
2341
+
2342
+ <xsl:text> — </xsl:text>
2343
+
2344
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2345
+ </xsl:if>
2346
+ </fo:block>
2347
+
2348
+
2349
+ <xsl:call-template name="fn_name_display"/>
2350
+
2351
+ </xsl:otherwise>
2352
+ </xsl:choose>
2353
+
2354
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2355
+
2356
+ <!-- <xsl:variable name="cols-count">
2357
+ <xsl:choose>
2358
+ <xsl:when test="*[local-name()='thead']">
2359
+ <xsl:call-template name="calculate-columns-numbers">
2360
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2361
+ </xsl:call-template>
2362
+ </xsl:when>
2363
+ <xsl:otherwise>
2364
+ <xsl:call-template name="calculate-columns-numbers">
2365
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2366
+ </xsl:call-template>
2367
+ </xsl:otherwise>
2368
+ </xsl:choose>
2369
+ </xsl:variable> -->
2370
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2371
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2372
+
2373
+
2374
+
2375
+ <xsl:variable name="colwidths">
2376
+ <xsl:call-template name="calculate-column-widths">
2377
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2378
+ <xsl:with-param name="table" select="$simple-table"/>
2379
+ </xsl:call-template>
2380
+ </xsl:variable>
2381
+
2382
+ <!-- <xsl:variable name="colwidths2">
2383
+ <xsl:call-template name="calculate-column-widths">
2384
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2385
+ </xsl:call-template>
2386
+ </xsl:variable> -->
2387
+
2388
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2389
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2390
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2391
+
2392
+ <xsl:variable name="margin-left">
2393
+ <xsl:choose>
2394
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2395
+ <xsl:otherwise>0</xsl:otherwise>
2396
+ </xsl:choose>
2397
+ </xsl:variable>
2398
+
2399
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2400
+
2401
+
2402
+
2403
+
2404
+
2405
+
2406
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2407
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2408
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2409
+
2410
+
2411
+
2412
+ <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">
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2419
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2420
+
2421
+
2422
+
2423
+
2424
+
2425
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2426
+
2427
+
2428
+
2429
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2430
+ <xsl:choose>
2431
+ <xsl:when test=". = 1 or . = 0">
2432
+ <fo:table-column column-width="proportional-column-width(2)"/>
2433
+ </xsl:when>
2434
+ <xsl:otherwise>
2435
+ <fo:table-column column-width="proportional-column-width({.})"/>
2436
+ </xsl:otherwise>
2437
+ </xsl:choose>
2438
+ </xsl:for-each>
2439
+
2440
+ <xsl:choose>
2441
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2442
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2443
+ </xsl:when>
2444
+ <xsl:otherwise>
2445
+ <xsl:apply-templates/>
2446
+ </xsl:otherwise>
2447
+ </xsl:choose>
2448
+
2449
+ </fo:table>
2450
+
2451
+
2452
+
2453
+ </fo:block-container>
2454
+ </xsl:template><xsl:template name="getTableNumber">
2455
+ <xsl:choose>
2456
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2457
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2458
+ </xsl:when>
2459
+ <xsl:when test="ancestor::*[local-name()='annex']">
2460
+
2461
+
2462
+
2463
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2464
+
2465
+
2466
+
2467
+
2468
+
2469
+
2470
+ </xsl:when>
2471
+ <xsl:otherwise>
2472
+
2473
+
2474
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2475
+ <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']"/>
2476
+
2477
+ </xsl:otherwise>
2478
+ </xsl:choose>
2479
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2480
+ <xsl:apply-templates/>
2481
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2482
+ <xsl:param name="table-row"/>
2483
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
2484
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2485
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2486
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2487
+ </xsl:template><xsl:template name="calculate-column-widths">
2488
+ <xsl:param name="table"/>
2489
+ <xsl:param name="cols-count"/>
2490
+ <xsl:param name="curr-col" select="1"/>
2491
+ <xsl:param name="width" select="0"/>
2492
+
2493
+ <xsl:if test="$curr-col &lt;= $cols-count">
2494
+ <xsl:variable name="widths">
2495
+ <xsl:choose>
2496
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2497
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2498
+ <xsl:variable name="words">
2499
+ <xsl:call-template name="tokenize">
2500
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
2501
+ </xsl:call-template>
2502
+ </xsl:variable>
2503
+ <xsl:variable name="max_length">
2504
+ <xsl:call-template name="max_length">
2505
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2506
+ </xsl:call-template>
2507
+ </xsl:variable>
2508
+ <width>
2509
+ <xsl:value-of select="$max_length"/>
2510
+ </width>
2511
+ </xsl:for-each>
2512
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
2513
+ <xsl:variable name="words">
2514
+ <xsl:call-template name="tokenize">
2515
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
2516
+ </xsl:call-template>
2517
+ </xsl:variable>
2518
+ <xsl:variable name="max_length">
2519
+ <xsl:call-template name="max_length">
2520
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2521
+ </xsl:call-template>
2522
+ </xsl:variable>
2523
+ <width>
2524
+ <xsl:value-of select="$max_length"/>
2525
+ </width>
2526
+
2527
+ </xsl:for-each>
2528
+ </xsl:when>
2529
+ <xsl:otherwise>
2530
+ <xsl:for-each select="xalan:nodeset($table)//tr">
2531
+ <xsl:variable name="td_text">
2532
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2533
+ </xsl:variable>
2534
+ <xsl:variable name="words">
2535
+ <xsl:variable name="string_with_added_zerospaces">
2536
+ <xsl:call-template name="add-zero-spaces-java">
2537
+ <xsl:with-param name="text" select="$td_text"/>
2538
+ </xsl:call-template>
2539
+ </xsl:variable>
2540
+ <xsl:call-template name="tokenize">
2541
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2542
+ <!-- 2009 thinspace -->
2543
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2544
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2545
+ </xsl:call-template>
2546
+ </xsl:variable>
2547
+ <xsl:variable name="max_length">
2548
+ <xsl:call-template name="max_length">
2549
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2550
+ </xsl:call-template>
2551
+ </xsl:variable>
2552
+ <width>
2553
+ <xsl:variable name="divider">
2554
+ <xsl:choose>
2555
+ <xsl:when test="td[$curr-col]/@divide">
2556
+ <xsl:value-of select="td[$curr-col]/@divide"/>
2557
+ </xsl:when>
2558
+ <xsl:otherwise>1</xsl:otherwise>
2559
+ </xsl:choose>
2560
+ </xsl:variable>
2561
+ <xsl:value-of select="$max_length div $divider"/>
2562
+ </width>
2563
+
2564
+ </xsl:for-each>
2565
+
2566
+ </xsl:otherwise>
2567
+ </xsl:choose>
2568
+ </xsl:variable>
2569
+
2570
+
2571
+ <column>
2572
+ <xsl:for-each select="xalan:nodeset($widths)//width">
2573
+ <xsl:sort select="." data-type="number" order="descending"/>
2574
+ <xsl:if test="position()=1">
2575
+ <xsl:value-of select="."/>
2576
+ </xsl:if>
2577
+ </xsl:for-each>
2578
+ </column>
2579
+ <xsl:call-template name="calculate-column-widths">
2580
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2581
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
2582
+ <xsl:with-param name="table" select="$table"/>
2583
+ </xsl:call-template>
2584
+ </xsl:if>
2585
+ </xsl:template><xsl:template match="text()" mode="td_text">
2586
+ <xsl:variable name="zero-space">​</xsl:variable>
2587
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2588
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2589
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2590
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2591
+ <xsl:value-of select="@target"/>
2592
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2593
+ <xsl:param name="cols-count"/>
2594
+ <!-- font-weight="bold" -->
2595
+ <fo:table-header>
2596
+
2597
+ <xsl:apply-templates/>
2598
+ </fo:table-header>
2599
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2600
+ <fo:table-body>
2601
+ <xsl:apply-templates/>
2602
+ </fo:table-body>
2603
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2604
+ <xsl:apply-templates/>
2605
+ </xsl:template><xsl:template name="insertTableFooter">
2606
+ <xsl:param name="cols-count"/>
2607
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2608
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2609
+
2610
+ <fo:table-footer>
2611
+
2612
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2613
+
2614
+ <!-- if there are note(s) or fn(s) then create footer row -->
2615
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2616
+
2617
+
2618
+
2619
+ <fo:table-row>
2620
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2621
+
2622
+
2623
+
2624
+ <!-- fn will be processed inside 'note' processing -->
2625
+
2626
+
2627
+ <!-- except gb -->
2628
+
2629
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2630
+
2631
+
2632
+ <!-- horizontal row separator -->
2633
+
2634
+
2635
+ <!-- fn processing -->
2636
+ <xsl:call-template name="fn_display"/>
2637
+
2638
+ </fo:table-cell>
2639
+ </fo:table-row>
2640
+
2641
+ </xsl:if>
2642
+ </fo:table-footer>
2643
+
2644
+ </xsl:if>
2645
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2646
+
2647
+ <xsl:variable name="cols-count">
2648
+ <xsl:choose>
2649
+ <xsl:when test="../*[local-name()='thead']">
2650
+ <xsl:call-template name="calculate-columns-numbers">
2651
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2652
+ </xsl:call-template>
2653
+ </xsl:when>
2654
+ <xsl:otherwise>
2655
+ <xsl:call-template name="calculate-columns-numbers">
2656
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2657
+ </xsl:call-template>
2658
+ </xsl:otherwise>
2659
+ </xsl:choose>
2660
+ </xsl:variable>
2661
+
2662
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2663
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2664
+ </xsl:apply-templates>
2665
+
2666
+ <xsl:call-template name="insertTableFooter">
2667
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2668
+ </xsl:call-template>
2669
+
2670
+ <fo:table-body>
2671
+ <xsl:apply-templates/>
2672
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2673
+
2674
+ </fo:table-body>
2675
+
2676
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2677
+ <xsl:variable name="parent-name" select="local-name(..)"/>
2678
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2679
+ <fo:table-row min-height="4mm">
2680
+ <xsl:if test="$parent-name = 'thead'">
2681
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2682
+
2683
+
2684
+
2685
+
2686
+
2687
+ </xsl:if>
2688
+ <xsl:if test="$parent-name = 'tfoot'">
2689
+
2690
+
2691
+ </xsl:if>
2692
+
2693
+
2694
+ <xsl:apply-templates/>
2695
+ </fo:table-row>
2696
+ </xsl:template><xsl:template match="*[local-name()='th']">
2697
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2698
+
2699
+
2700
+
2701
+
2702
+
2703
+
2704
+
2705
+ <xsl:if test="@colspan">
2706
+ <xsl:attribute name="number-columns-spanned">
2707
+ <xsl:value-of select="@colspan"/>
2708
+ </xsl:attribute>
2709
+ </xsl:if>
2710
+ <xsl:if test="@rowspan">
2711
+ <xsl:attribute name="number-rows-spanned">
2712
+ <xsl:value-of select="@rowspan"/>
2713
+ </xsl:attribute>
2714
+ </xsl:if>
2715
+ <fo:block>
2716
+ <xsl:apply-templates/>
2717
+ </fo:block>
2718
+ </fo:table-cell>
2719
+ </xsl:template><xsl:template match="*[local-name()='td']">
2720
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2721
+
2722
+
2723
+
2724
+
2725
+
2726
+
2727
+
2728
+
2729
+
2730
+ <xsl:if test="@colspan">
2731
+ <xsl:attribute name="number-columns-spanned">
2732
+ <xsl:value-of select="@colspan"/>
2733
+ </xsl:attribute>
2734
+ </xsl:if>
2735
+ <xsl:if test="@rowspan">
2736
+ <xsl:attribute name="number-rows-spanned">
2737
+ <xsl:value-of select="@rowspan"/>
2738
+ </xsl:attribute>
2739
+ </xsl:if>
2740
+ <fo:block>
2741
+
2742
+ <xsl:apply-templates/>
2743
+ </fo:block>
2744
+ <!-- <xsl:choose>
2745
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
2746
+ <xsl:apply-templates />
2747
+ </xsl:when>
2748
+ <xsl:otherwise>
2749
+ <fo:block>
2750
+ <xsl:apply-templates />
2751
+ </fo:block>
2752
+ </xsl:otherwise>
2753
+ </xsl:choose> -->
2754
+
2755
+
2756
+ </fo:table-cell>
2757
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2758
+
2759
+
2760
+ <fo:block font-size="10pt" margin-bottom="12pt">
2761
+
2762
+
2763
+
2764
+
2765
+ <fo:inline padding-right="2mm">
2766
+
2767
+
2768
+ <xsl:variable name="title-note">
2769
+ <xsl:call-template name="getTitle">
2770
+ <xsl:with-param name="name" select="'title-note'"/>
2771
+ </xsl:call-template>
2772
+ </xsl:variable>
2773
+ <xsl:value-of select="$title-note"/>
2774
+
2775
+ <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2776
+ <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
2777
+ <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
2778
+ </xsl:if>
2779
+
2780
+
2781
+
2782
+
2783
+ </fo:inline>
2784
+ <xsl:apply-templates mode="process"/>
2785
+ </fo:block>
2786
+
2787
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2788
+ <xsl:apply-templates/>
2789
+ </xsl:template><xsl:template name="fn_display">
2790
+ <xsl:variable name="references">
2791
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2792
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2793
+
2794
+
2795
+ <xsl:attribute name="id">
2796
+ <xsl:value-of select="@reference"/>
2797
+ <xsl:text>_</xsl:text>
2798
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2799
+ </xsl:attribute>
2800
+
2801
+ <xsl:apply-templates/>
2802
+ </fn>
2803
+ </xsl:for-each>
2804
+ </xsl:variable>
2805
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2806
+ <xsl:variable name="reference" select="@reference"/>
2807
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2808
+ <fo:block margin-bottom="12pt">
2809
+
2810
+
2811
+
2812
+
2813
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2814
+
2815
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2816
+
2817
+
2818
+
2819
+
2820
+
2821
+
2822
+ <xsl:value-of select="@reference"/>
2823
+
2824
+ </fo:inline>
2825
+ <fo:inline>
2826
+
2827
+ <xsl:apply-templates/>
2828
+ </fo:inline>
2829
+ </fo:block>
2830
+ </xsl:if>
2831
+ </xsl:for-each>
2832
+ </xsl:template><xsl:template name="fn_name_display">
2833
+ <!-- <xsl:variable name="references">
2834
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2835
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2836
+ <xsl:apply-templates />
2837
+ </fn>
2838
+ </xsl:for-each>
2839
+ </xsl:variable>
2840
+ $references=<xsl:copy-of select="$references"/> -->
2841
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2842
+ <xsl:variable name="reference" select="@reference"/>
2843
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2844
+ <fo:block margin-bottom="12pt">
2845
+ <xsl:apply-templates/>
2846
+ </fo:block>
2847
+ </xsl:for-each>
2848
+ </xsl:template><xsl:template name="fn_display_figure">
2849
+ <xsl:variable name="key_iso">
2850
+ <!-- and (not(@class) or @class !='pseudocode') -->
2851
+ </xsl:variable>
2852
+ <xsl:variable name="references">
2853
+ <xsl:for-each select=".//*[local-name()='fn']">
2854
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2855
+ <xsl:apply-templates/>
2856
+ </fn>
2857
+ </xsl:for-each>
2858
+ </xsl:variable>
2859
+
2860
+ <!-- current hierarchy is 'figure' element -->
2861
+ <xsl:variable name="following_dl_colwidths">
2862
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2863
+ <xsl:variable name="html-table">
2864
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2865
+ <xsl:element name="{$ns}:table">
2866
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2867
+ <tbody>
2868
+ <xsl:apply-templates mode="dl"/>
2869
+ </tbody>
2870
+ </xsl:for-each>
2871
+ </xsl:element>
2872
+ </xsl:variable>
2873
+
2874
+ <xsl:call-template name="calculate-column-widths">
2875
+ <xsl:with-param name="cols-count" select="2"/>
2876
+ <xsl:with-param name="table" select="$html-table"/>
2877
+ </xsl:call-template>
2878
+
2879
+ </xsl:if>
2880
+ </xsl:variable>
2881
+
2882
+
2883
+ <xsl:variable name="maxlength_dt">
2884
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2885
+ <xsl:call-template name="getMaxLength_dt"/>
2886
+ </xsl:for-each>
2887
+ </xsl:variable>
2888
+
2889
+ <xsl:if test="xalan:nodeset($references)//fn">
2890
+ <fo:block>
2891
+ <fo:table width="95%" table-layout="fixed">
2892
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2893
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2894
+
2895
+ </xsl:if>
2896
+ <xsl:choose>
2897
+ <!-- if there 'dl', then set same columns width -->
2898
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2899
+ <xsl:call-template name="setColumnWidth_dl">
2900
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2901
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2902
+ </xsl:call-template>
2903
+ </xsl:when>
2904
+ <xsl:otherwise>
2905
+ <fo:table-column column-width="15%"/>
2906
+ <fo:table-column column-width="85%"/>
2907
+ </xsl:otherwise>
2908
+ </xsl:choose>
2909
+ <fo:table-body>
2910
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2911
+ <xsl:variable name="reference" select="@reference"/>
2912
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2913
+ <fo:table-row>
2914
+ <fo:table-cell>
2915
+ <fo:block>
2916
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2917
+
2918
+ <xsl:value-of select="@reference"/>
2919
+ </fo:inline>
2920
+ </fo:block>
2921
+ </fo:table-cell>
2922
+ <fo:table-cell>
2923
+ <fo:block text-align="justify" margin-bottom="12pt">
2924
+
2925
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2926
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2927
+ </xsl:if>
2928
+
2929
+ <xsl:apply-templates/>
2930
+ </fo:block>
2931
+ </fo:table-cell>
2932
+ </fo:table-row>
2933
+ </xsl:if>
2934
+ </xsl:for-each>
2935
+ </fo:table-body>
2936
+ </fo:table>
2937
+ </fo:block>
2938
+ </xsl:if>
2939
+
2940
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2941
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2942
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2943
+
2944
+
2945
+
2946
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2947
+ <xsl:attribute name="color">blue</xsl:attribute>
2948
+
2949
+
2950
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2951
+
2952
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2953
+
2954
+ <xsl:attribute name="internal-destination">
2955
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
2956
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2957
+ </xsl:attribute>
2958
+
2959
+ <xsl:value-of select="@reference"/>
2960
+ </fo:basic-link>
2961
+ </fo:inline>
2962
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2963
+ <fo:inline>
2964
+ <xsl:apply-templates/>
2965
+ </fo:inline>
2966
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2967
+ <xsl:variable name="parent" select="local-name(..)"/>
2968
+
2969
+ <xsl:variable name="key_iso">
2970
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2971
+ </xsl:variable>
2972
+
2973
+ <xsl:choose>
2974
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2975
+
2976
+
2977
+ <fo:block margin-bottom="12pt" text-align="left">
2978
+
2979
+ <xsl:variable name="title-where">
2980
+ <xsl:call-template name="getTitle">
2981
+ <xsl:with-param name="name" select="'title-where'"/>
2982
+ </xsl:call-template>
2983
+ </xsl:variable>
2984
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2985
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2986
+ <xsl:text/>
2987
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2988
+ </fo:block>
2989
+
2990
+ </xsl:when>
2991
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2992
+ <fo:block margin-bottom="12pt" text-align="left">
2993
+
2994
+
2995
+
2996
+
2997
+ <xsl:variable name="title-where">
2998
+ <xsl:call-template name="getTitle">
2999
+ <xsl:with-param name="name" select="'title-where'"/>
3000
+ </xsl:call-template>
3001
+ </xsl:variable>
3002
+ <xsl:value-of select="$title-where"/>
3003
+ </fo:block>
3004
+ </xsl:when>
3005
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3006
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3007
+
3008
+
3009
+
3010
+ <xsl:variable name="title-key">
3011
+ <xsl:call-template name="getTitle">
3012
+ <xsl:with-param name="name" select="'title-key'"/>
3013
+ </xsl:call-template>
3014
+ </xsl:variable>
3015
+ <xsl:value-of select="$title-key"/>
3016
+ </fo:block>
3017
+ </xsl:when>
3018
+ </xsl:choose>
3019
+
3020
+ <!-- a few components -->
3021
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
3022
+ <fo:block>
3023
+
3024
+
3025
+
3026
+
3027
+ <fo:block>
3028
+
3029
+
3030
+
3031
+
3032
+ <fo:table width="95%" table-layout="fixed">
3033
+
3034
+ <xsl:choose>
3035
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3036
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
3037
+ </xsl:when>
3038
+ <xsl:when test="normalize-space($key_iso) = 'true'">
3039
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3040
+
3041
+ </xsl:when>
3042
+ </xsl:choose>
3043
+ <!-- create virtual html table for dl/[dt and dd] -->
3044
+ <xsl:variable name="html-table">
3045
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3046
+ <xsl:element name="{$ns}:table">
3047
+ <tbody>
3048
+ <xsl:apply-templates mode="dl"/>
3049
+ </tbody>
3050
+ </xsl:element>
3051
+ </xsl:variable>
3052
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3053
+ <xsl:variable name="colwidths">
3054
+ <xsl:call-template name="calculate-column-widths">
3055
+ <xsl:with-param name="cols-count" select="2"/>
3056
+ <xsl:with-param name="table" select="$html-table"/>
3057
+ </xsl:call-template>
3058
+ </xsl:variable>
3059
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3060
+ <xsl:variable name="maxlength_dt">
3061
+ <xsl:call-template name="getMaxLength_dt"/>
3062
+ </xsl:variable>
3063
+ <xsl:call-template name="setColumnWidth_dl">
3064
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3065
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3066
+ </xsl:call-template>
3067
+ <fo:table-body>
3068
+ <xsl:apply-templates>
3069
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
3070
+ </xsl:apply-templates>
3071
+ </fo:table-body>
3072
+ </fo:table>
3073
+ </fo:block>
3074
+ </fo:block>
3075
+ </xsl:if>
3076
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3077
+ <xsl:param name="colwidths"/>
3078
+ <xsl:param name="maxlength_dt"/>
3079
+ <xsl:choose>
3080
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3081
+ <fo:table-column column-width="50%"/>
3082
+ <fo:table-column column-width="50%"/>
3083
+ </xsl:when>
3084
+ <xsl:otherwise>
3085
+ <xsl:choose>
3086
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3087
+ <fo:table-column column-width="5%"/>
3088
+ <fo:table-column column-width="95%"/>
3089
+ </xsl:when>
3090
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3091
+ <fo:table-column column-width="10%"/>
3092
+ <fo:table-column column-width="90%"/>
3093
+ </xsl:when>
3094
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3095
+ <fo:table-column column-width="60%"/>
3096
+ <fo:table-column column-width="40%"/>
3097
+ </xsl:when> -->
3098
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3099
+ <fo:table-column column-width="50%"/>
3100
+ <fo:table-column column-width="50%"/>
3101
+ </xsl:when>
3102
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3103
+ <fo:table-column column-width="40%"/>
3104
+ <fo:table-column column-width="60%"/>
3105
+ </xsl:when>
3106
+ <xsl:otherwise>
3107
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3108
+ <xsl:choose>
3109
+ <xsl:when test=". = 1 or . = 0">
3110
+ <fo:table-column column-width="proportional-column-width(2)"/>
3111
+ </xsl:when>
3112
+ <xsl:otherwise>
3113
+ <fo:table-column column-width="proportional-column-width({.})"/>
3114
+ </xsl:otherwise>
3115
+ </xsl:choose>
3116
+ </xsl:for-each>
3117
+ </xsl:otherwise>
3118
+ </xsl:choose>
3119
+ <!-- <fo:table-column column-width="15%"/>
3120
+ <fo:table-column column-width="85%"/> -->
3121
+ </xsl:otherwise>
3122
+ </xsl:choose>
3123
+ </xsl:template><xsl:template name="getMaxLength_dt">
3124
+ <xsl:for-each select="*[local-name()='dt']">
3125
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3126
+ <xsl:if test="position() = 1">
3127
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3128
+ </xsl:if>
3129
+ </xsl:for-each>
3130
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3131
+ <xsl:param name="key_iso"/>
3132
+
3133
+ <!-- <tr>
3134
+ <td>NOTE</td>
3135
+ <td>
3136
+ <xsl:apply-templates />
3137
+ </td>
3138
+ </tr>
3139
+ -->
3140
+ <fo:table-row>
3141
+ <fo:table-cell>
3142
+ <fo:block margin-top="6pt">
3143
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3144
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3145
+ </xsl:if>
3146
+ <xsl:variable name="title-note">
3147
+ <xsl:call-template name="getTitle">
3148
+ <xsl:with-param name="name" select="'title-note'"/>
3149
+ </xsl:call-template>
3150
+ </xsl:variable>
3151
+ <xsl:value-of select="$title-note"/>
3152
+ </fo:block>
3153
+ </fo:table-cell>
3154
+ <fo:table-cell>
3155
+ <fo:block>
3156
+ <xsl:apply-templates/>
3157
+ </fo:block>
3158
+ </fo:table-cell>
3159
+ </fo:table-row>
3160
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3161
+ <tr>
3162
+ <td>
3163
+ <xsl:apply-templates/>
3164
+ </td>
3165
+ <td>
3166
+
3167
+
3168
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
3169
+
3170
+ </td>
3171
+ </tr>
3172
+
3173
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3174
+ <xsl:param name="key_iso"/>
3175
+
3176
+ <fo:table-row>
3177
+ <fo:table-cell>
3178
+
3179
+ <fo:block margin-top="6pt">
3180
+
3181
+
3182
+ <xsl:if test="normalize-space($key_iso) = 'true'">
3183
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3184
+
3185
+ </xsl:if>
3186
+
3187
+
3188
+
3189
+
3190
+
3191
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
3192
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3193
+
3194
+ <xsl:apply-templates/>
3195
+ <!-- <xsl:if test="$namespace = 'gb'">
3196
+ <xsl:if test="ancestor::*[local-name()='formula']">
3197
+ <xsl:text>—</xsl:text>
3198
+ </xsl:if>
3199
+ </xsl:if> -->
3200
+ </fo:block>
3201
+ </fo:table-cell>
3202
+ <fo:table-cell>
3203
+ <fo:block>
3204
+
3205
+
3206
+
3207
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
3208
+
3209
+ </fo:block>
3210
+ </fo:table-cell>
3211
+ </fo:table-row>
3212
+
3213
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3214
+ <xsl:apply-templates/>
3215
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3216
+ <xsl:apply-templates/>
3217
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3218
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3219
+ </xsl:template><xsl:template match="*[local-name()='em']">
3220
+ <fo:inline font-style="italic">
3221
+ <xsl:apply-templates/>
3222
+ </fo:inline>
3223
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3224
+ <fo:inline font-weight="bold">
3225
+ <xsl:apply-templates/>
3226
+ </fo:inline>
3227
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3228
+ <fo:inline font-size="80%" vertical-align="super">
3229
+ <xsl:apply-templates/>
3230
+ </fo:inline>
3231
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3232
+ <fo:inline font-size="80%" vertical-align="sub">
3233
+ <xsl:apply-templates/>
3234
+ </fo:inline>
3235
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3236
+ <fo:inline font-family="Courier" font-size="10pt">
3237
+ <xsl:apply-templates/>
3238
+ </fo:inline>
3239
+ </xsl:template><xsl:template match="*[local-name()='del']">
3240
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3241
+ <xsl:apply-templates/>
3242
+ </fo:inline>
3243
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3244
+ <xsl:variable name="text" select="normalize-space(.)"/>
3245
+ <fo:inline font-size="75%">
3246
+ <xsl:if test="string-length($text) &gt; 0">
3247
+ <xsl:call-template name="recursiveSmallCaps">
3248
+ <xsl:with-param name="text" select="$text"/>
3249
+ </xsl:call-template>
3250
+ </xsl:if>
3251
+ </fo:inline>
3252
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3253
+ <xsl:param name="text"/>
3254
+ <xsl:variable name="char" select="substring($text,1,1)"/>
3255
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3256
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3257
+ <xsl:choose>
3258
+ <xsl:when test="$char=$upperCase">
3259
+ <fo:inline font-size="{100 div 0.75}%">
3260
+ <xsl:value-of select="$upperCase"/>
3261
+ </fo:inline>
3262
+ </xsl:when>
3263
+ <xsl:otherwise>
3264
+ <xsl:value-of select="$upperCase"/>
3265
+ </xsl:otherwise>
3266
+ </xsl:choose>
3267
+ <xsl:if test="string-length($text) &gt; 1">
3268
+ <xsl:call-template name="recursiveSmallCaps">
3269
+ <xsl:with-param name="text" select="substring($text,2)"/>
3270
+ </xsl:call-template>
3271
+ </xsl:if>
3272
+ </xsl:template><xsl:template name="tokenize">
3273
+ <xsl:param name="text"/>
3274
+ <xsl:param name="separator" select="' '"/>
3275
+ <xsl:choose>
3276
+ <xsl:when test="not(contains($text, $separator))">
3277
+ <word>
3278
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3279
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3280
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3281
+ <xsl:variable name="len_str">
3282
+ <xsl:choose>
3283
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3284
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
3285
+ </xsl:when>
3286
+ <xsl:otherwise>
3287
+ <xsl:value-of select="$len_str_tmp"/>
3288
+ </xsl:otherwise>
3289
+ </xsl:choose>
3290
+ </xsl:variable>
3291
+
3292
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3293
+ <xsl:message>
3294
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3295
+ len_str=<xsl:value-of select="$len_str"/>
3296
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3297
+ </xsl:message>
3298
+ </xsl:if> -->
3299
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3300
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
3301
+ <xsl:choose>
3302
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3303
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3304
+ </xsl:when>
3305
+ <xsl:otherwise>
3306
+ <xsl:value-of select="$len_str"/>
3307
+ </xsl:otherwise>
3308
+ </xsl:choose>
3309
+ </word>
3310
+ </xsl:when>
3311
+ <xsl:otherwise>
3312
+ <word>
3313
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
3314
+ </word>
3315
+ <xsl:call-template name="tokenize">
3316
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3317
+ </xsl:call-template>
3318
+ </xsl:otherwise>
3319
+ </xsl:choose>
3320
+ </xsl:template><xsl:template name="max_length">
3321
+ <xsl:param name="words"/>
3322
+ <xsl:for-each select="$words//word">
3323
+ <xsl:sort select="." data-type="number" order="descending"/>
3324
+ <xsl:if test="position()=1">
3325
+ <xsl:value-of select="."/>
3326
+ </xsl:if>
3327
+ </xsl:for-each>
3328
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3329
+ <xsl:param name="text" select="."/>
3330
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3331
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3332
+ </xsl:template><xsl:template name="add-zero-spaces">
3333
+ <xsl:param name="text" select="."/>
3334
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3335
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3336
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3337
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3338
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3339
+ <xsl:variable name="zero-space">​</xsl:variable>
3340
+ <xsl:choose>
3341
+ <xsl:when test="contains($text, $zero-space-after-chars)">
3342
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
3343
+ <xsl:value-of select="$zero-space-after-chars"/>
3344
+ <xsl:value-of select="$zero-space"/>
3345
+ <xsl:call-template name="add-zero-spaces">
3346
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
3347
+ </xsl:call-template>
3348
+ </xsl:when>
3349
+ <xsl:when test="contains($text, $zero-space-after-dot)">
3350
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
3351
+ <xsl:value-of select="$zero-space-after-dot"/>
3352
+ <xsl:value-of select="$zero-space"/>
3353
+ <xsl:call-template name="add-zero-spaces">
3354
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
3355
+ </xsl:call-template>
3356
+ </xsl:when>
3357
+ <xsl:when test="contains($text, $zero-space-after-colon)">
3358
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
3359
+ <xsl:value-of select="$zero-space-after-colon"/>
3360
+ <xsl:value-of select="$zero-space"/>
3361
+ <xsl:call-template name="add-zero-spaces">
3362
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
3363
+ </xsl:call-template>
3364
+ </xsl:when>
3365
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3366
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3367
+ <xsl:value-of select="$zero-space-after-equal"/>
3368
+ <xsl:value-of select="$zero-space"/>
3369
+ <xsl:call-template name="add-zero-spaces">
3370
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3371
+ </xsl:call-template>
3372
+ </xsl:when>
3373
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
3374
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
3375
+ <xsl:value-of select="$zero-space-after-underscore"/>
3376
+ <xsl:value-of select="$zero-space"/>
3377
+ <xsl:call-template name="add-zero-spaces">
3378
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
3379
+ </xsl:call-template>
3380
+ </xsl:when>
3381
+ <xsl:otherwise>
3382
+ <xsl:value-of select="$text"/>
3383
+ </xsl:otherwise>
3384
+ </xsl:choose>
3385
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3386
+ <xsl:param name="text" select="."/>
3387
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3388
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3389
+ <xsl:variable name="zero-space">​</xsl:variable>
3390
+ <xsl:choose>
3391
+ <xsl:when test="contains($text, $zero-space-after-equals)">
3392
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3393
+ <xsl:value-of select="$zero-space-after-equals"/>
3394
+ <xsl:value-of select="$zero-space"/>
3395
+ <xsl:call-template name="add-zero-spaces-equal">
3396
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3397
+ </xsl:call-template>
3398
+ </xsl:when>
3399
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3400
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3401
+ <xsl:value-of select="$zero-space-after-equal"/>
3402
+ <xsl:value-of select="$zero-space"/>
3403
+ <xsl:call-template name="add-zero-spaces-equal">
3404
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3405
+ </xsl:call-template>
3406
+ </xsl:when>
3407
+ <xsl:otherwise>
3408
+ <xsl:value-of select="$text"/>
3409
+ </xsl:otherwise>
3410
+ </xsl:choose>
3411
+ </xsl:template><xsl:template name="getSimpleTable">
3412
+ <xsl:variable name="simple-table">
3413
+
3414
+ <!-- Step 1. colspan processing -->
3415
+ <xsl:variable name="simple-table-colspan">
3416
+ <tbody>
3417
+ <xsl:apply-templates mode="simple-table-colspan"/>
3418
+ </tbody>
3419
+ </xsl:variable>
3420
+
3421
+ <!-- Step 2. rowspan processing -->
3422
+ <xsl:variable name="simple-table-rowspan">
3423
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3424
+ </xsl:variable>
3425
+
3426
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3427
+
3428
+ <!-- <xsl:choose>
3429
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
3430
+
3431
+ </xsl:when>
3432
+ <xsl:otherwise>
3433
+ <xsl:copy-of select="current()"/>
3434
+ </xsl:otherwise>
3435
+ </xsl:choose> -->
3436
+ </xsl:variable>
3437
+ <xsl:copy-of select="$simple-table"/>
3438
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3439
+ <xsl:apply-templates mode="simple-table-colspan"/>
3440
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3441
+ <xsl:choose>
3442
+ <xsl:when test="@colspan">
3443
+ <xsl:variable name="td">
3444
+ <xsl:element name="td">
3445
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
3446
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3447
+ <xsl:apply-templates mode="simple-table-colspan"/>
3448
+ </xsl:element>
3449
+ </xsl:variable>
3450
+ <xsl:call-template name="repeatNode">
3451
+ <xsl:with-param name="count" select="@colspan"/>
3452
+ <xsl:with-param name="node" select="$td"/>
3453
+ </xsl:call-template>
3454
+ </xsl:when>
3455
+ <xsl:otherwise>
3456
+ <xsl:element name="td">
3457
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3458
+ <xsl:apply-templates mode="simple-table-colspan"/>
3459
+ </xsl:element>
3460
+ </xsl:otherwise>
3461
+ </xsl:choose>
3462
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3463
+ <xsl:element name="tr">
3464
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3465
+ <xsl:apply-templates mode="simple-table-colspan"/>
3466
+ </xsl:element>
3467
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3468
+ <xsl:copy>
3469
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3470
+ </xsl:copy>
3471
+ </xsl:template><xsl:template name="repeatNode">
3472
+ <xsl:param name="count"/>
3473
+ <xsl:param name="node"/>
3474
+
3475
+ <xsl:if test="$count &gt; 0">
3476
+ <xsl:call-template name="repeatNode">
3477
+ <xsl:with-param name="count" select="$count - 1"/>
3478
+ <xsl:with-param name="node" select="$node"/>
3479
+ </xsl:call-template>
3480
+ <xsl:copy-of select="$node"/>
3481
+ </xsl:if>
3482
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3483
+ <xsl:copy>
3484
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3485
+ </xsl:copy>
3486
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3487
+ <xsl:copy>
3488
+ <xsl:copy-of select="tr[1]"/>
3489
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3490
+ <xsl:with-param name="previousRow" select="tr[1]"/>
3491
+ </xsl:apply-templates>
3492
+ </xsl:copy>
3493
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3494
+ <xsl:param name="previousRow"/>
3495
+ <xsl:variable name="currentRow" select="."/>
3496
+
3497
+ <xsl:variable name="normalizedTDs">
3498
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
3499
+ <xsl:choose>
3500
+ <xsl:when test="@rowspan &gt; 1">
3501
+ <xsl:copy>
3502
+ <xsl:attribute name="rowspan">
3503
+ <xsl:value-of select="@rowspan - 1"/>
3504
+ </xsl:attribute>
3505
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
3506
+ <xsl:copy-of select="node()"/>
3507
+ </xsl:copy>
3508
+ </xsl:when>
3509
+ <xsl:otherwise>
3510
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
3511
+ </xsl:otherwise>
3512
+ </xsl:choose>
3513
+ </xsl:for-each>
3514
+ </xsl:variable>
3515
+
3516
+ <xsl:variable name="newRow">
3517
+ <xsl:copy>
3518
+ <xsl:copy-of select="$currentRow/@*"/>
3519
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
3520
+ </xsl:copy>
3521
+ </xsl:variable>
3522
+ <xsl:copy-of select="$newRow"/>
3523
+
3524
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3525
+ <xsl:with-param name="previousRow" select="$newRow"/>
3526
+ </xsl:apply-templates>
3527
+ </xsl:template><xsl:template name="getLang">
3528
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3529
+ <xsl:choose>
3530
+ <xsl:when test="$language = 'English'">en</xsl:when>
3531
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3532
+ </xsl:choose>
3533
+ </xsl:template><xsl:template name="capitalizeWords">
3534
+ <xsl:param name="str"/>
3535
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3536
+ <xsl:choose>
3537
+ <xsl:when test="contains($str2, ' ')">
3538
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3539
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3540
+ <xsl:value-of select="substring($substr, 2)"/> -->
3541
+ <xsl:call-template name="capitalize">
3542
+ <xsl:with-param name="str" select="$substr"/>
3543
+ </xsl:call-template>
3544
+ <xsl:text> </xsl:text>
3545
+ <xsl:call-template name="capitalizeWords">
3546
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3547
+ </xsl:call-template>
3548
+ </xsl:when>
3549
+ <xsl:otherwise>
3550
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3551
+ <xsl:value-of select="substring($str2, 2)"/> -->
3552
+ <xsl:call-template name="capitalize">
3553
+ <xsl:with-param name="str" select="$str2"/>
3554
+ </xsl:call-template>
3555
+ </xsl:otherwise>
3556
+ </xsl:choose>
3557
+ </xsl:template><xsl:template name="capitalize">
3558
+ <xsl:param name="str"/>
3559
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3560
+ <xsl:value-of select="substring($str, 2)"/>
3561
+ </xsl:template><xsl:template match="mathml:math">
3562
+ <fo:inline font-family="STIX2Math">
3563
+ <fo:instream-foreign-object fox:alt-text="Math">
3564
+ <xsl:copy-of select="."/>
3565
+ </fo:instream-foreign-object>
3566
+ </fo:inline>
3567
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3568
+ <xsl:for-each select="*[local-name()='locality']">
3569
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3570
+ <xsl:apply-templates select="."/>
3571
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3572
+ </xsl:for-each>
3573
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3574
+ <xsl:variable name="target">
3575
+ <xsl:choose>
3576
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3577
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
3578
+ </xsl:when>
3579
+ <xsl:otherwise>
3580
+ <xsl:value-of select="normalize-space(@target)"/>
3581
+ </xsl:otherwise>
3582
+ </xsl:choose>
3583
+ </xsl:variable>
3584
+ <fo:inline xsl:use-attribute-sets="link-style">
3585
+ <xsl:choose>
3586
+ <xsl:when test="$target = ''">
3587
+ <xsl:apply-templates/>
3588
+ </xsl:when>
3589
+ <xsl:otherwise>
3590
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3591
+ <xsl:choose>
3592
+ <xsl:when test="normalize-space(.) = ''">
3593
+ <xsl:value-of select="$target"/>
3594
+ </xsl:when>
3595
+ <xsl:otherwise>
3596
+ <xsl:apply-templates/>
3597
+ </xsl:otherwise>
3598
+ </xsl:choose>
3599
+ </fo:basic-link>
3600
+ </xsl:otherwise>
3601
+ </xsl:choose>
3602
+ </fo:inline>
3603
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3604
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3605
+ <!-- <xsl:choose>
3606
+ <xsl:when test="@lang = 'en'"></xsl:when>
3607
+ <xsl:otherwise> -->
3608
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3609
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3610
+ <!-- </xsl:otherwise>
3611
+ </xsl:choose> -->
3612
+ <xsl:apply-templates/>
3613
+ </fo:block>
3614
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3615
+ <fo:inline id="{@id}"/>
3616
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3617
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3618
+ <xsl:variable name="title-appendix">
3619
+ <xsl:call-template name="getTitle">
3620
+ <xsl:with-param name="name" select="'title-appendix'"/>
3621
+ </xsl:call-template>
3622
+ </xsl:variable>
3623
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3624
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3625
+ </fo:block>
3626
+ <xsl:apply-templates/>
3627
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3628
+ <fo:inline><xsl:apply-templates/></fo:inline>
3629
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3630
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3631
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3632
+ <xsl:variable name="title-example">
3633
+ <xsl:call-template name="getTitle">
3634
+ <xsl:with-param name="name" select="'title-example'"/>
3635
+ </xsl:call-template>
3636
+ </xsl:variable>
3637
+ <xsl:value-of select="$title-example"/>
3638
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3639
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3640
+ </xsl:if>
3641
+ <xsl:if test="*[local-name()='name']">
3642
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3643
+ </xsl:if>
3644
+ </fo:block>
3645
+ <xsl:apply-templates/>
3646
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3647
+ <fo:inline><xsl:apply-templates/></fo:inline>
3648
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3649
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3650
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3651
+ <xsl:variable name="annotation-id" select="@id"/>
3652
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3653
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3654
+ <fo:inline>
3655
+ <xsl:apply-templates>
3656
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3657
+ </xsl:apply-templates>
3658
+ </fo:inline>
3659
+ </fo:block>
3660
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3661
+ <xsl:param name="callout"/>
3662
+ <fo:inline id="{@id}">
3663
+ <!-- for first p in annotation, put <x> -->
3664
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3665
+ <xsl:apply-templates/>
3666
+ </fo:inline>
3667
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3668
+ <xsl:variable name="title-modified">
3669
+ <xsl:call-template name="getTitle">
3670
+ <xsl:with-param name="name" select="'title-modified'"/>
3671
+ </xsl:call-template>
3672
+ </xsl:variable>
3673
+ <xsl:choose>
3674
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3675
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3676
+ </xsl:choose>
3677
+ <xsl:apply-templates/>
3678
+ </xsl:template><xsl:template name="convertDate">
3679
+ <xsl:param name="date"/>
3680
+ <xsl:param name="format" select="'short'"/>
3681
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3682
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3683
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3684
+ <xsl:variable name="monthStr">
3685
+ <xsl:choose>
3686
+ <xsl:when test="$month = '01'">January</xsl:when>
3687
+ <xsl:when test="$month = '02'">February</xsl:when>
3688
+ <xsl:when test="$month = '03'">March</xsl:when>
3689
+ <xsl:when test="$month = '04'">April</xsl:when>
3690
+ <xsl:when test="$month = '05'">May</xsl:when>
3691
+ <xsl:when test="$month = '06'">June</xsl:when>
3692
+ <xsl:when test="$month = '07'">July</xsl:when>
3693
+ <xsl:when test="$month = '08'">August</xsl:when>
3694
+ <xsl:when test="$month = '09'">September</xsl:when>
3695
+ <xsl:when test="$month = '10'">October</xsl:when>
3696
+ <xsl:when test="$month = '11'">November</xsl:when>
3697
+ <xsl:when test="$month = '12'">December</xsl:when>
3698
+ </xsl:choose>
3699
+ </xsl:variable>
3700
+ <xsl:variable name="result">
3701
+ <xsl:choose>
3702
+ <xsl:when test="$format = 'short' or $day = ''">
3703
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3704
+ </xsl:when>
3705
+ <xsl:otherwise>
3706
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3707
+ </xsl:otherwise>
3708
+ </xsl:choose>
3709
+ </xsl:variable>
3710
+ <xsl:value-of select="$result"/>
3711
+ </xsl:template><xsl:template name="insertKeywords">
3712
+ <xsl:param name="sorting" select="'true'"/>
3713
+ <xsl:param name="charAtEnd" select="'.'"/>
3714
+ <xsl:param name="charDelim" select="', '"/>
3715
+ <xsl:choose>
3716
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3717
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3718
+ <xsl:sort data-type="text" order="ascending"/>
3719
+ <xsl:call-template name="insertKeyword">
3720
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3721
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3722
+ </xsl:call-template>
3723
+ </xsl:for-each>
3724
+ </xsl:when>
3725
+ <xsl:otherwise>
3726
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3727
+ <xsl:call-template name="insertKeyword">
3728
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3729
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3730
+ </xsl:call-template>
3731
+ </xsl:for-each>
3732
+ </xsl:otherwise>
3733
+ </xsl:choose>
3734
+ </xsl:template><xsl:template name="insertKeyword">
3735
+ <xsl:param name="charAtEnd"/>
3736
+ <xsl:param name="charDelim"/>
3737
+ <xsl:apply-templates/>
3738
+ <xsl:choose>
3739
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3740
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3741
+ </xsl:choose>
3742
+ </xsl:template><xsl:template name="addPDFUAmeta">
3743
+ <fo:declarations>
3744
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3745
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3746
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3747
+ </pdf:dictionary>
3748
+ </pdf:catalog>
3749
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3750
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3751
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3752
+ <!-- Dublin Core properties go here -->
3753
+ <dc:title>
3754
+ <xsl:variable name="title">
3755
+
3756
+
3757
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3758
+
3759
+
3760
+
3761
+ </xsl:variable>
3762
+ <xsl:choose>
3763
+ <xsl:when test="normalize-space($title) != ''">
3764
+ <xsl:value-of select="$title"/>
3765
+ </xsl:when>
3766
+ <xsl:otherwise>
3767
+ <xsl:text> </xsl:text>
3768
+ </xsl:otherwise>
3769
+ </xsl:choose>
3770
+ </dc:title>
3771
+ <dc:creator>
3772
+
3773
+
3774
+ </dc:creator>
3775
+ <dc:description>
3776
+ <xsl:variable name="abstract">
3777
+
3778
+
3779
+
3780
+
3781
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
3782
+
3783
+ </xsl:variable>
3784
+ <xsl:value-of select="normalize-space($abstract)"/>
3785
+ </dc:description>
3786
+ <pdf:Keywords>
3787
+ <xsl:call-template name="insertKeywords"/>
3788
+ </pdf:Keywords>
3789
+ </rdf:Description>
3790
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3791
+ <!-- XMP properties go here -->
3792
+ <xmp:CreatorTool/>
3793
+ </rdf:Description>
3794
+ </rdf:RDF>
3795
+ </x:xmpmeta>
3796
+ </fo:declarations>
3797
+ </xsl:template><xsl:template name="getId">
3798
+ <xsl:choose>
3799
+ <xsl:when test="../@id">
3800
+ <xsl:value-of select="../@id"/>
3801
+ </xsl:when>
3802
+ <xsl:otherwise>
3803
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3804
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3805
+ </xsl:otherwise>
3806
+ </xsl:choose>
3807
+ </xsl:template><xsl:template name="getLevel">
3808
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3809
+ <xsl:variable name="level">
3810
+ <xsl:choose>
3811
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3812
+ <xsl:value-of select="$level_total - 2"/>
3813
+ </xsl:when>
3814
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3815
+ <xsl:value-of select="$level_total - 2"/>
3816
+ </xsl:when>
3817
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3818
+ <xsl:value-of select="$level_total - 2"/>
3819
+ </xsl:when>
3820
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3821
+ <xsl:otherwise>
3822
+ <xsl:value-of select="$level_total - 1"/>
3823
+ </xsl:otherwise>
3824
+ </xsl:choose>
3825
+ </xsl:variable>
3826
+ <xsl:value-of select="$level"/>
3827
+ </xsl:template><xsl:template name="getSubSection">
3828
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
3829
+ </xsl:template><xsl:template name="split">
3830
+ <xsl:param name="pText" select="."/>
3831
+ <xsl:param name="sep" select="','"/>
3832
+ <xsl:if test="string-length($pText) &gt;0">
3833
+ <item>
3834
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3835
+ </item>
3836
+ <xsl:call-template name="split">
3837
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3838
+ <xsl:with-param name="sep" select="$sep"/>
3839
+ </xsl:call-template>
3840
+ </xsl:if>
3841
+ </xsl:template><xsl:template name="getDocumentId">
3842
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3843
+ </xsl:template></xsl:stylesheet>