metanorma-ogc 1.0.7 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/ogc/biblio.rng +14 -4
  7. data/lib/asciidoctor/ogc/boilerplate.xml +7 -22
  8. data/lib/asciidoctor/ogc/converter.rb +11 -16
  9. data/lib/asciidoctor/ogc/isodoc.rng +444 -1
  10. data/lib/asciidoctor/ogc/reqt.rng +23 -0
  11. data/lib/isodoc/ogc.rb +2 -0
  12. data/lib/isodoc/ogc/base_convert.rb +12 -60
  13. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +0 -5
  14. data/lib/isodoc/ogc/html/wordstyle.scss +0 -1
  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 +1156 -430
  18. data/lib/isodoc/ogc/ogc.best-practice.xsl +1156 -430
  19. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1156 -430
  20. data/lib/isodoc/ogc/ogc.community-practice.xsl +1156 -430
  21. data/lib/isodoc/ogc/ogc.community-standard.xsl +1156 -430
  22. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1156 -430
  23. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1156 -430
  24. data/lib/isodoc/ogc/ogc.other.xsl +1156 -430
  25. data/lib/isodoc/ogc/ogc.policy.xsl +1156 -430
  26. data/lib/isodoc/ogc/ogc.reference-model.xsl +1156 -430
  27. data/lib/isodoc/ogc/ogc.release-notes.xsl +1156 -430
  28. data/lib/isodoc/ogc/ogc.standard.xsl +1156 -430
  29. data/lib/isodoc/ogc/ogc.test-suite.xsl +1156 -430
  30. data/lib/isodoc/ogc/ogc.user-guide.xsl +1156 -430
  31. data/lib/isodoc/ogc/ogc.white-paper.xsl +1156 -430
  32. data/lib/isodoc/ogc/pdf_convert.rb +0 -13
  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 +7 -16
  37. data/lib/isodoc/ogc/xref.rb +158 -0
  38. data/lib/metanorma/ogc/processor.rb +6 -8
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +3 -2
  41. metadata +26 -11
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ogc="https://www.metanorma.org/ns/ogc" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
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
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -18,7 +18,7 @@
18
18
  <xsl:text>© </xsl:text>
19
19
  <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:copyright/ogc:from"/>
20
20
  <xsl:text> </xsl:text>
21
- <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor/ogc:organization/ogc:name"/>
21
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type = 'publisher']/ogc:organization/ogc:name"/>
22
22
  </xsl:variable>
23
23
 
24
24
  <xsl:variable name="doctitle" select="/ogc:ogc-standard/ogc:bibdata/ogc:title[@language = 'en']"/>
@@ -47,6 +47,7 @@
47
47
  </xsl:apply-templates>
48
48
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents">
49
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
+
50
51
  </xsl:apply-templates>
51
52
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
52
53
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name" mode="contents">
@@ -56,6 +57,12 @@
56
57
  <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
58
  </xsl:apply-templates>
58
59
 
60
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'submitters']" mode="contents">
61
+ <xsl:with-param name="sectionNumSkew" 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:preface/ogc:introduction) + count(/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name) + count(/ogc:ogc-standard/ogc:preface/ogc:submitters)"/>
62
+ </xsl:apply-templates>
63
+
64
+
65
+
59
66
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']" mode="contents">
60
67
  <xsl:with-param name="sectionNum" select="'1'"/>
61
68
  </xsl:apply-templates>
@@ -65,22 +72,22 @@
65
72
  </xsl:apply-templates>
66
73
 
67
74
  <!-- Normative references -->
68
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']" mode="contents">
75
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references' or @id = 'references']" mode="contents">
69
76
  <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
77
  </xsl:apply-templates>
71
78
 
72
79
  <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"/>
80
+ <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' or @id = 'references']) + 1"/>
74
81
  </xsl:apply-templates>
75
82
 
76
83
 
77
84
  <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)"/>
85
+ <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' or @id = 'references']) + count(/ogc:ogc-standard/ogc:sections/ogc:terms)"/>
79
86
  </xsl:apply-templates>
80
87
 
81
88
 
82
89
  <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] -->
90
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']" mode="contents"/> <!-- [position() &gt; 1] -->
84
91
 
85
92
 
86
93
  </contents>
@@ -91,7 +98,7 @@
91
98
  </xsl:variable>
92
99
 
93
100
  <xsl:template match="/">
94
- <xsl:message>INFO: Document namespace: '<xsl:value-of select="namespace-uri(/*)"/>'</xsl:message>
101
+ <xsl:call-template name="namespaceCheck"/>
95
102
  <fo:root font-family="Times New Roman, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
96
103
  <fo:layout-master-set>
97
104
  <!-- Cover page -->
@@ -161,51 +168,7 @@
161
168
 
162
169
  </fo:layout-master-set>
163
170
 
164
- <fo:declarations>
165
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
166
- <pdf:dictionary type="normal" key="ViewerPreferences">
167
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
168
- </pdf:dictionary>
169
- </pdf:catalog>
170
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
171
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
172
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
173
- <!-- Dublin Core properties go here -->
174
- <dc:title>
175
- <xsl:choose>
176
- <xsl:when test="$doctitle != ''">
177
- <xsl:value-of select="$doctitle"/>
178
- </xsl:when>
179
- <xsl:otherwise>
180
- <xsl:text> </xsl:text>
181
- </xsl:otherwise>
182
- </xsl:choose>
183
- </dc:title>
184
- <dc:creator/>
185
- <dc:description>
186
- <xsl:variable name="abstract">
187
- <xsl:copy-of select="/ogc:ogc-standard/ogc:bibdata/ogc:abstract//text()"/>
188
- </xsl:variable>
189
- <xsl:value-of select="normalize-space($abstract)"/>
190
- </dc:description>
191
- <pdf:Keywords>
192
- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata//ogc:keyword">
193
- <xsl:sort data-type="text" order="ascending"/>
194
- <xsl:apply-templates/>
195
- <xsl:choose>
196
- <xsl:when test="position() != last()">, </xsl:when>
197
- <xsl:otherwise>.</xsl:otherwise>
198
- </xsl:choose>
199
- </xsl:for-each>
200
- </pdf:Keywords>
201
- </rdf:Description>
202
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
203
- <!-- XMP properties go here -->
204
- <xmp:CreatorTool/>
205
- </rdf:Description>
206
- </rdf:RDF>
207
- </x:xmpmeta>
208
- </fo:declarations>
171
+ <xsl:call-template name="addPDFUAmeta"/>
209
172
 
210
173
  <!-- Cover Page -->
211
174
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
@@ -281,7 +244,7 @@
281
244
  </fo:block>
282
245
  </fo:block>
283
246
  <fo:block font-size="24pt" font-weight="bold" text-align="center" margin-top="15pt" line-height="115%">
284
- <xsl:text>OGC </xsl:text><xsl:value-of select="$doctitle"/>
247
+ <xsl:value-of select="$doctitle"/>
285
248
  </fo:block>
286
249
  <fo:block margin-bottom="12pt"> </fo:block>
287
250
  <!-- Copyright notice -->
@@ -294,6 +257,16 @@
294
257
  <fo:table-column column-width="35mm"/>
295
258
  <fo:table-column column-width="70mm"/>
296
259
  <fo:table-body>
260
+ <fo:table-row height="9mm">
261
+ <fo:table-cell>
262
+ <fo:block>Document number: </fo:block>
263
+ </fo:table-cell>
264
+ <fo:table-cell>
265
+ <fo:block>
266
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docnumber"/>
267
+ </fo:block>
268
+ </fo:table-cell>
269
+ </fo:table-row>
297
270
  <fo:table-row height="9mm">
298
271
  <fo:table-cell>
299
272
  <fo:block>Document type: </fo:block>
@@ -302,6 +275,18 @@
302
275
  <fo:block line-height-shift-adjustment="disregard-shifts">OGC<fo:inline font-size="65%" vertical-align="super">®</fo:inline><xsl:text> </xsl:text><xsl:value-of select="$doctype"/></fo:block>
303
276
  </fo:table-cell>
304
277
  </fo:table-row>
278
+ <fo:table-row height="9mm">
279
+ <fo:table-cell>
280
+ <fo:block>Document subtype: </fo:block>
281
+ </fo:table-cell>
282
+ <fo:table-cell>
283
+ <fo:block>
284
+ <xsl:call-template name="capitalizeWords">
285
+ <xsl:with-param name="str" select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:docsubtype"/>
286
+ </xsl:call-template>
287
+ </fo:block>
288
+ </fo:table-cell>
289
+ </fo:table-row>
305
290
  <fo:table-row height="9mm">
306
291
  <fo:table-cell>
307
292
  <fo:block>Document stage: </fo:block>
@@ -309,8 +294,9 @@
309
294
  <fo:table-cell>
310
295
  <fo:block>
311
296
  <xsl:variable name="stage" select="/ogc:ogc-standard/ogc:bibdata/ogc:status/ogc:stage"/>
312
- <xsl:value-of select="translate(substring($stage, 1, 1), $lower, $upper)"/>
313
- <xsl:value-of select="substring($stage, 2)"/>
297
+ <xsl:call-template name="capitalize">
298
+ <xsl:with-param name="str" select="$stage"/>
299
+ </xsl:call-template>
314
300
  </fo:block>
315
301
  </fo:table-cell>
316
302
  </fo:table-row>
@@ -319,7 +305,11 @@
319
305
  <fo:block>Document language: </fo:block>
320
306
  </fo:table-cell>
321
307
  <fo:table-cell>
322
- <fo:block><xsl:value-of select="$lang"/></fo:block>
308
+ <fo:block>
309
+ <xsl:call-template name="getLanguage">
310
+ <xsl:with-param name="lang" select="$lang"/>
311
+ </xsl:call-template>
312
+ </fo:block>
323
313
  </fo:table-cell>
324
314
  </fo:table-row>
325
315
  </fo:table-body>
@@ -355,8 +345,13 @@
355
345
  <fo:block> </fo:block>
356
346
  <fo:block break-after="page"/>
357
347
 
358
- <fo:block-container font-weight="bold" line-height="115%">
359
- <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt">Contents</fo:block>
348
+ <fo:block-container font-weight="bold" line-height="115%" margin-bottom="36pt">
349
+ <xsl:variable name="title-toc">
350
+ <xsl:call-template name="getTitle">
351
+ <xsl:with-param name="name" select="'title-toc'"/>
352
+ </xsl:call-template>
353
+ </xsl:variable>
354
+ <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
360
355
 
361
356
  <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2]"><!-- skip clause from preface [not(@level = 2 and starts-with(@section, '0'))] -->
362
357
 
@@ -405,7 +400,12 @@
405
400
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
406
401
  <fo:block font-size="12pt"> </fo:block>
407
402
  <fo:block font-size="12pt"> </fo:block>
408
- <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Tables</fo:block>
403
+ <xsl:variable name="title-list-tables">
404
+ <xsl:call-template name="getTitle">
405
+ <xsl:with-param name="name" select="'title-list-tables'"/>
406
+ </xsl:call-template>
407
+ </xsl:variable>
408
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-tables"/></fo:block>
409
409
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
410
410
  <fo:block text-align-last="justify" margin-top="6pt">
411
411
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -427,7 +427,12 @@
427
427
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
428
428
  <fo:block font-size="12pt"> </fo:block>
429
429
  <fo:block font-size="12pt"> </fo:block>
430
- <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Figures</fo:block>
430
+ <xsl:variable name="title-list-figures">
431
+ <xsl:call-template name="getTitle">
432
+ <xsl:with-param name="name" select="'title-list-figures'"/>
433
+ </xsl:call-template>
434
+ </xsl:variable>
435
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt"><xsl:value-of select="$title-list-figures"/></fo:block>
431
436
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
432
437
  <fo:block text-align-last="justify" margin-top="6pt">
433
438
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
@@ -465,6 +470,10 @@
465
470
  <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ count(/ogc:ogc-standard/ogc:preface/ogc:foreword) + count(/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name) + 1"/>
466
471
  </xsl:apply-templates>
467
472
 
473
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'submitters']">
474
+ <xsl:with-param name="sectionNumSkew" 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:preface/ogc:introduction) + count(/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name) + count(/ogc:ogc-standard/ogc:preface/ogc:submitters)"/>
475
+ </xsl:apply-templates>
476
+
468
477
 
469
478
  </fo:flow>
470
479
  </fo:page-sequence>
@@ -496,22 +505,22 @@
496
505
  </xsl:apply-templates>
497
506
 
498
507
  <!-- Normative references -->
499
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']">
508
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references' or @id = 'references']">
500
509
  <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + 1"/>
501
510
  </xsl:apply-templates>
502
511
 
503
512
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms"> <!-- Terms and definitions -->
504
- <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + 1"/>
513
+ <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' or @id = 'references']) + 1"/>
505
514
  </xsl:apply-templates>
506
515
 
507
516
 
508
517
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/*[local-name() != 'terms' and not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]">
509
- <xsl:with-param name="sectionNumSkew" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + count(/ogc:ogc-standard/ogc:sections/ogc:terms)"/>
518
+ <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' or @id = 'references']) + count(/ogc:ogc-standard/ogc:sections/ogc:terms)"/>
510
519
  </xsl:apply-templates>
511
520
 
512
521
 
513
522
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex"/>
514
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references']"/> <!-- [position() &gt; 1] -->
523
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']"/> <!-- [position() &gt; 1] -->
515
524
 
516
525
  </fo:block>
517
526
  </fo:flow>
@@ -586,6 +595,25 @@
586
595
  </xsl:apply-templates>
587
596
  </xsl:template>
588
597
 
598
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:clause" mode="contents">
599
+ <xsl:param name="sectionNum"/>
600
+ <xsl:param name="sectionNumSkew" select="0"/>
601
+ <xsl:variable name="sectionNum_">
602
+ <xsl:choose>
603
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
604
+ <xsl:when test="$sectionNumSkew != 0">
605
+ <xsl:variable name="number"><xsl:number count="ogc:clause"/></xsl:variable>
606
+ <xsl:value-of select="$number + $sectionNumSkew"/>
607
+ </xsl:when>
608
+ <xsl:otherwise>
609
+ <xsl:number count="*"/>
610
+ </xsl:otherwise>
611
+ </xsl:choose>
612
+ </xsl:variable>
613
+ <xsl:apply-templates mode="contents">
614
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
615
+ </xsl:apply-templates>
616
+ </xsl:template>
589
617
 
590
618
  <!-- Any node with title element - clause, definition, annex,... -->
591
619
  <xsl:template match="ogc:title | ogc:preferred" mode="contents">
@@ -648,7 +676,7 @@
648
676
 
649
677
  </xsl:template>
650
678
 
651
- <xsl:template match="ogc:ogc-standard/ogc:preface/*" mode="contents">
679
+ <xsl:template match="ogc:ogc-standard/ogc:preface/*[not(local-name() = 'clause')]" mode="contents">
652
680
  <xsl:param name="sectionNum" select="'1'"/>
653
681
  <xsl:variable name="section">
654
682
  <xsl:number format="i" value="$sectionNum"/>
@@ -671,7 +699,9 @@
671
699
  <xsl:choose>
672
700
  <xsl:when test="not(ogc:title)">
673
701
  <xsl:variable name="name" select="local-name()"/>
674
- <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
702
+ <xsl:call-template name="capitalize">
703
+ <xsl:with-param name="str" select="$name"/>
704
+ </xsl:call-template>
675
705
  </xsl:when>
676
706
  <xsl:otherwise>
677
707
  <xsl:value-of select="ogc:title"/>
@@ -691,7 +721,12 @@
691
721
  <xsl:number format="i" value="$sectionNum"/>
692
722
  </xsl:variable>
693
723
  <item id="keywords" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
694
- <xsl:text>Keywords</xsl:text>
724
+ <xsl:variable name="title-keywords">
725
+ <xsl:call-template name="getTitle">
726
+ <xsl:with-param name="name" select="'title-keywords'"/>
727
+ </xsl:call-template>
728
+ </xsl:variable>
729
+ <xsl:value-of select="$title-keywords"/>
695
730
  </item>
696
731
  </xsl:template>
697
732
  <!-- Submitting Organizations -->
@@ -701,7 +736,12 @@
701
736
  <xsl:number format="i" value="$sectionNum"/>
702
737
  </xsl:variable>
703
738
  <item id="submitting_orgs" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
704
- <xsl:text>Submitting Organizations</xsl:text>
739
+ <xsl:variable name="title-submitting-organizations">
740
+ <xsl:call-template name="getTitle">
741
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
742
+ </xsl:call-template>
743
+ </xsl:variable>
744
+ <xsl:value-of select="$title-submitting-organizations"/>
705
745
  </item>
706
746
  </xsl:template>
707
747
 
@@ -709,7 +749,12 @@
709
749
  <xsl:param name="sectionNum"/>
710
750
  <item level="" id="{@id}" type="figure">
711
751
  <xsl:attribute name="section">
712
- <xsl:text>Figure </xsl:text>
752
+ <xsl:variable name="title-figure">
753
+ <xsl:call-template name="getTitle">
754
+ <xsl:with-param name="name" select="'title-figure'"/>
755
+ </xsl:call-template>
756
+ </xsl:variable>
757
+ <xsl:value-of select="$title-figure"/>
713
758
  <xsl:choose>
714
759
  <xsl:when test="ancestor::ogc:annex">
715
760
  <xsl:choose>
@@ -738,13 +783,17 @@
738
783
  </xsl:template>
739
784
 
740
785
 
741
-
742
786
  <xsl:template match="ogc:table[not(@unnumbered='true')]" mode="contents">
743
787
  <xsl:param name="sectionNum"/>
744
788
  <xsl:variable name="annex-id" select="ancestor::ogc:annex/@id"/>
745
789
  <item level="" id="{@id}" display="false" type="table">
746
790
  <xsl:attribute name="section">
747
- <xsl:text>Table </xsl:text>
791
+ <xsl:variable name="title-table">
792
+ <xsl:call-template name="getTitle">
793
+ <xsl:with-param name="name" select="'title-table'"/>
794
+ </xsl:call-template>
795
+ </xsl:variable>
796
+ <xsl:value-of select="$title-table"/>
748
797
  <xsl:choose>
749
798
  <xsl:when test="ancestor::*[local-name()='executivesummary']">
750
799
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered='true')]"/>
@@ -767,7 +816,12 @@
767
816
  <xsl:template match="ogc:formula" mode="contents">
768
817
  <item level="" id="{@id}" display="false">
769
818
  <xsl:attribute name="section">
770
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
819
+ <xsl:variable name="title-formula">
820
+ <xsl:call-template name="getTitle">
821
+ <xsl:with-param name="name" select="'title-formula'"/>
822
+ </xsl:call-template>
823
+ </xsl:variable>
824
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
771
825
  </xsl:attribute>
772
826
  </item>
773
827
  </xsl:template>
@@ -785,7 +839,12 @@
785
839
 
786
840
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
787
841
  <fo:block margin-bottom="12pt">
788
- <xsl:text>Version: </xsl:text>
842
+ <xsl:variable name="title-edition">
843
+ <xsl:call-template name="getTitle">
844
+ <xsl:with-param name="name" select="'title-edition'"/>
845
+ </xsl:call-template>
846
+ </xsl:variable>
847
+ <xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text>
789
848
  <xsl:value-of select="."/><xsl:text> </xsl:text>
790
849
  </fo:block>
791
850
  </xsl:template>
@@ -824,7 +883,7 @@
824
883
  <xsl:attribute name="text-align">
825
884
  <xsl:choose>
826
885
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
827
- <xsl:otherwise>left</xsl:otherwise>
886
+ <xsl:otherwise>center</xsl:otherwise>
828
887
  </xsl:choose>
829
888
  </xsl:attribute>
830
889
  <xsl:apply-templates/>
@@ -899,24 +958,37 @@
899
958
  <fo:block id="{$id}" font-size="13pt" font-weight="bold" margin-bottom="12pt" color="rgb(14, 26, 133)">
900
959
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
901
960
  <xsl:variable name="name" select="local-name()"/>
902
- <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
961
+ <xsl:call-template name="capitalize">
962
+ <xsl:with-param name="str" select="$name"/>
963
+ </xsl:call-template>
903
964
  </fo:block>
904
965
  </xsl:if>
905
- <xsl:apply-templates/>
966
+ <xsl:apply-templates>
967
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
968
+ </xsl:apply-templates>
906
969
  </xsl:template>
907
970
  <!-- Keywords -->
908
971
  <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
909
972
  <xsl:param name="sectionNum" select="'1'"/>
910
973
  <fo:block id="keywords" font-size="13pt" font-weight="bold" margin-top="13.5pt" margin-bottom="12pt" color="rgb(14, 26, 133)">
911
974
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="2mm"> </fo:inline>
912
- <xsl:text>Keywords</xsl:text>
975
+ <xsl:variable name="title-keywords">
976
+ <xsl:call-template name="getTitle">
977
+ <xsl:with-param name="name" select="'title-keywords'"/>
978
+ </xsl:call-template>
979
+ </xsl:variable>
980
+ <xsl:value-of select="$title-keywords"/>
913
981
  </fo:block>
914
982
  <fo:block margin-bottom="12pt">The following are keywords to be used by search engines and document catalogues.</fo:block>
915
983
  <fo:block margin-bottom="12pt">
916
- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
984
+ <xsl:call-template name="insertKeywords">
985
+ <xsl:with-param name="sorting">no</xsl:with-param>
986
+ <xsl:with-param name="charAtEnd"/>
987
+ </xsl:call-template>
988
+ <!-- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
917
989
  <xsl:value-of select="."/>
918
990
  <xsl:if test="position() != last()">, </xsl:if>
919
- </xsl:for-each>
991
+ </xsl:for-each> -->
920
992
  </fo:block>
921
993
  </xsl:template>
922
994
  <!-- Submitting Organizations -->
@@ -924,7 +996,12 @@
924
996
  <xsl:param name="sectionNum" select="'1'"/>
925
997
  <fo:block id="submitting_orgs" font-size="13pt" font-weight="bold" color="rgb(14, 26, 133)" margin-top="13.5pt" margin-bottom="12pt">
926
998
  <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
927
- <xsl:text>Submitting Organizations</xsl:text>
999
+ <xsl:variable name="title-submitting-organizations">
1000
+ <xsl:call-template name="getTitle">
1001
+ <xsl:with-param name="name" select="'title-submitting-organizations'"/>
1002
+ </xsl:call-template>
1003
+ </xsl:variable>
1004
+ <xsl:value-of select="$title-submitting-organizations"/>
928
1005
  </fo:block>
929
1006
  <fo:block margin-bottom="12pt">The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</fo:block>
930
1007
  <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
@@ -976,6 +1053,25 @@
976
1053
  </fo:block>
977
1054
  </xsl:template>
978
1055
 
1056
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:clause">
1057
+ <xsl:param name="sectionNum"/>
1058
+ <xsl:param name="sectionNumSkew" select="0"/>
1059
+ <xsl:variable name="sectionNum_">
1060
+ <xsl:choose>
1061
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1062
+ <xsl:when test="$sectionNumSkew != 0">
1063
+ <xsl:variable name="number"><xsl:number count="ogc:clause"/></xsl:variable>
1064
+ <xsl:value-of select="$number + $sectionNumSkew"/>
1065
+ </xsl:when>
1066
+ <xsl:otherwise>
1067
+ <xsl:number count="*"/>
1068
+ </xsl:otherwise>
1069
+ </xsl:choose>
1070
+ </xsl:variable>
1071
+ <xsl:apply-templates>
1072
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
1073
+ </xsl:apply-templates>
1074
+ </xsl:template>
979
1075
 
980
1076
 
981
1077
  <xsl:template match="ogc:clause//ogc:clause[not(ogc:title)]">
@@ -1117,10 +1213,13 @@
1117
1213
  </xsl:attribute>
1118
1214
  <xsl:attribute name="space-after">
1119
1215
  <xsl:choose>
1120
- <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1216
+ <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1121
1217
  <xsl:otherwise>12pt</xsl:otherwise>
1122
1218
  </xsl:choose>
1123
1219
  </xsl:attribute>
1220
+ <xsl:if test="ancestor::ogc:dd and not(ancestor::ogc:table)">
1221
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1222
+ </xsl:if>
1124
1223
  <xsl:attribute name="line-height">115%</xsl:attribute>
1125
1224
  <xsl:apply-templates/>
1126
1225
  </xsl:element>
@@ -1142,7 +1241,7 @@
1142
1241
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1143
1242
  </fn>
1144
1243
  -->
1145
- <xsl:template match="ogc:title/ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)]" priority="2">
1244
+ <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">
1146
1245
  <fo:footnote keep-with-previous.within-line="always">
1147
1246
  <xsl:variable name="number" select="@reference"/>
1148
1247
 
@@ -1188,10 +1287,6 @@
1188
1287
  </xsl:template>
1189
1288
 
1190
1289
  <xsl:template match="ogc:figure">
1191
- <xsl:variable name="title">
1192
- <xsl:text>Figure </xsl:text>
1193
- </xsl:variable>
1194
-
1195
1290
  <fo:block-container id="{@id}">
1196
1291
  <fo:block>
1197
1292
  <xsl:apply-templates/>
@@ -1201,7 +1296,11 @@
1201
1296
  <xsl:call-template name="note"/>
1202
1297
  </xsl:for-each>
1203
1298
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="6pt" keep-with-previous="always">
1204
-
1299
+ <xsl:variable name="title-figure">
1300
+ <xsl:call-template name="getTitle">
1301
+ <xsl:with-param name="name" select="'title-figure'"/>
1302
+ </xsl:call-template>
1303
+ </xsl:variable>
1205
1304
  <xsl:choose>
1206
1305
  <xsl:when test="ancestor::ogc:annex">
1207
1306
  <xsl:choose>
@@ -1209,13 +1308,13 @@
1209
1308
  <xsl:number format="a) "/>
1210
1309
  </xsl:when>
1211
1310
  <xsl:otherwise>
1212
- <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1311
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1213
1312
  </xsl:otherwise>
1214
1313
  </xsl:choose>
1215
1314
 
1216
1315
  </xsl:when>
1217
1316
  <xsl:otherwise>
1218
- <xsl:value-of select="$title"/><xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1317
+ <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"/>
1219
1318
  </xsl:otherwise>
1220
1319
  </xsl:choose>
1221
1320
  <xsl:if test="ogc:name">
@@ -1298,13 +1397,13 @@
1298
1397
  </xsl:choose>
1299
1398
  </xsl:variable>
1300
1399
  <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
1301
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1400
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1302
1401
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1303
1402
  </fo:basic-link>
1304
1403
  </fo:inline>
1305
1404
  <fo:footnote-body>
1306
1405
  <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
1307
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
1406
+ <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" -->
1308
1407
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1309
1408
  </fo:inline>
1310
1409
  <xsl:apply-templates/>
@@ -1371,6 +1470,14 @@
1371
1470
  </fo:list-item>
1372
1471
  </xsl:template>
1373
1472
 
1473
+ <xsl:template match="ogc:term">
1474
+ <xsl:param name="sectionNum"/>
1475
+ <fo:block id="{@id}">
1476
+ <xsl:apply-templates>
1477
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1478
+ </xsl:apply-templates>
1479
+ </fo:block>
1480
+ </xsl:template>
1374
1481
 
1375
1482
  <xsl:template match="ogc:preferred">
1376
1483
  <xsl:param name="sectionNum"/>
@@ -1390,7 +1497,7 @@
1390
1497
  </xsl:variable>
1391
1498
  <fo:block font-size="{$font-size}">
1392
1499
  <fo:block font-weight="bold" keep-with-next="always">
1393
- <fo:inline id="{../@id}">
1500
+ <fo:inline>
1394
1501
  <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1395
1502
  </fo:inline>
1396
1503
  </fo:block>
@@ -1407,7 +1514,12 @@
1407
1514
  </xsl:template>
1408
1515
 
1409
1516
  <xsl:template match="ogc:deprecates">
1410
- <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1517
+ <xsl:variable name="title-deprecated">
1518
+ <xsl:call-template name="getTitle">
1519
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1520
+ </xsl:call-template>
1521
+ </xsl:variable>
1522
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1411
1523
  </xsl:template>
1412
1524
 
1413
1525
  <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]">
@@ -1428,7 +1540,14 @@
1428
1540
  <fo:block margin-bottom="12pt" keep-with-previous="always">
1429
1541
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1430
1542
  <fo:basic-link internal-destination="{ogc:origin/@bibitemid}" fox:alt-text="{ogc:origin/@citeas}">
1431
- <xsl:text>[SOURCE: </xsl:text>
1543
+ <xsl:text>[</xsl:text>
1544
+ <xsl:variable name="title-source">
1545
+ <xsl:call-template name="getTitle">
1546
+ <xsl:with-param name="name" select="'title-source'"/>
1547
+ </xsl:call-template>
1548
+ </xsl:variable>
1549
+ <xsl:value-of select="$title-source"/>
1550
+ <xsl:text>: </xsl:text>
1432
1551
  <fo:inline color="blue" text-decoration="underline">
1433
1552
  <xsl:value-of select="ogc:origin/@citeas"/>
1434
1553
 
@@ -1441,19 +1560,20 @@
1441
1560
  </fo:block>
1442
1561
  </xsl:template>
1443
1562
 
1444
- <xsl:template match="ogc:modification">
1445
- <xsl:text>, modified — </xsl:text>
1446
- <xsl:apply-templates/>
1447
- </xsl:template>
1563
+
1448
1564
  <xsl:template match="ogc:modification/ogc:p">
1449
1565
  <fo:inline><xsl:apply-templates/></fo:inline>
1450
1566
  </xsl:template>
1451
1567
 
1452
1568
  <xsl:template match="ogc:termnote">
1453
1569
  <fo:block font-size="10pt" margin-bottom="12pt">
1454
- <xsl:text>Note </xsl:text>
1455
- <xsl:number/>
1456
- <xsl:text> to entry: </xsl:text>
1570
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1571
+ <xsl:variable name="title-note-to-entry">
1572
+ <xsl:call-template name="getTitle">
1573
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1574
+ </xsl:call-template>
1575
+ </xsl:variable>
1576
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1457
1577
  <xsl:apply-templates/>
1458
1578
  </fo:block>
1459
1579
  </xsl:template>
@@ -1469,7 +1589,12 @@
1469
1589
 
1470
1590
  <xsl:template match="ogc:termexample">
1471
1591
  <fo:block font-size="10pt" margin-bottom="12pt">
1472
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1592
+ <xsl:variable name="title-example">
1593
+ <xsl:call-template name="getTitle">
1594
+ <xsl:with-param name="name" select="'title-example'"/>
1595
+ </xsl:call-template>
1596
+ </xsl:variable>
1597
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
1473
1598
  <xsl:apply-templates/>
1474
1599
  </fo:block>
1475
1600
  </xsl:template>
@@ -1486,7 +1611,7 @@
1486
1611
 
1487
1612
 
1488
1613
  <!-- [position() &gt; 1] -->
1489
- <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']">
1614
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']">
1490
1615
  <fo:block break-after="page"/>
1491
1616
  <fo:block line-height="120%">
1492
1617
  <xsl:apply-templates/>
@@ -1496,7 +1621,7 @@
1496
1621
 
1497
1622
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1498
1623
  <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem"> [position() &gt; 1] -->
1499
- <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem">
1624
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']/ogc:bibitem">
1500
1625
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1501
1626
  <fo:list-item>
1502
1627
  <fo:list-item-label end-indent="label-end()">
@@ -1569,10 +1694,10 @@
1569
1694
  </xsl:template>
1570
1695
 
1571
1696
  <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem" mode="contents"/> [position() &gt; 1] -->
1572
- <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem" mode="contents"/>
1697
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']/ogc:bibitem" mode="contents"/>
1573
1698
 
1574
1699
  <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem/ogc:title"> [position() &gt; 1]-->
1575
- <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem/ogc:title">
1700
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references' and @id != 'references']/ogc:bibitem/ogc:title">
1576
1701
  <fo:inline font-style="italic">
1577
1702
  <xsl:apply-templates/>
1578
1703
  </fo:inline>
@@ -1598,62 +1723,11 @@
1598
1723
 
1599
1724
  <xsl:template match="ogc:source">
1600
1725
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1601
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1726
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1602
1727
  <xsl:apply-templates select="ogc:localityStack"/>
1603
1728
  </fo:basic-link>
1604
1729
  </xsl:template>
1605
-
1606
- <xsl:template match="ogc:appendix">
1607
- <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1608
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1609
- <xsl:apply-templates select="ogc:title" mode="process"/>
1610
- </fo:block>
1611
- <xsl:apply-templates/>
1612
- </xsl:template>
1613
-
1614
- <xsl:template match="ogc:appendix//ogc:example">
1615
- <fo:block font-size="10pt" margin-bottom="12pt">
1616
- <xsl:text>EXAMPLE</xsl:text>
1617
- <xsl:if test="ogc:name">
1618
- <xsl:text> — </xsl:text><xsl:apply-templates select="ogc:name" mode="process"/>
1619
- </xsl:if>
1620
- </fo:block>
1621
- <xsl:apply-templates/>
1622
- </xsl:template>
1623
-
1624
- <xsl:template match="ogc:appendix//ogc:example/ogc:name"/>
1625
- <xsl:template match="ogc:appendix//ogc:example/ogc:name" mode="process">
1626
- <fo:inline><xsl:apply-templates/></fo:inline>
1627
- </xsl:template>
1628
-
1629
- <xsl:template match="ogc:callout">
1630
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1631
- </xsl:template>
1632
-
1633
- <xsl:template match="ogc:annotation">
1634
- <fo:block>
1635
-
1636
- </fo:block>
1637
- <xsl:apply-templates/>
1638
- </xsl:template>
1639
-
1640
- <xsl:template match="ogc:annotation/text()"/>
1641
-
1642
- <xsl:template match="ogc:annotation/ogc:p">
1643
- <xsl:variable name="annotation-id" select="../@id"/>
1644
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1645
- <fo:block id="{$annotation-id}">
1646
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1647
- <xsl:apply-templates/>
1648
- </fo:block>
1649
- </xsl:template>
1650
-
1651
-
1652
- <xsl:template match="ogc:appendix/ogc:title"/>
1653
- <xsl:template match="ogc:appendix/ogc:title" mode="process">
1654
- <fo:inline><xsl:apply-templates/></fo:inline>
1655
- </xsl:template>
1656
-
1730
+
1657
1731
 
1658
1732
  <xsl:template match="ogc:xref">
1659
1733
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
@@ -1664,6 +1738,17 @@
1664
1738
  <!-- </xsl:if> -->
1665
1739
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1666
1740
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1741
+
1742
+ <xsl:variable name="title-clause">
1743
+ <xsl:call-template name="getTitle">
1744
+ <xsl:with-param name="name" select="'title-clause'"/>
1745
+ </xsl:call-template>
1746
+ </xsl:variable>
1747
+ <xsl:variable name="title-annex">
1748
+ <xsl:call-template name="getTitle">
1749
+ <xsl:with-param name="name" select="'title-annex'"/>
1750
+ </xsl:call-template>
1751
+ </xsl:variable>
1667
1752
 
1668
1753
  <xsl:choose>
1669
1754
  <xsl:when test="normalize-space(.) != ''">
@@ -1671,9 +1756,9 @@
1671
1756
  </xsl:when>
1672
1757
  <xsl:otherwise>
1673
1758
  <xsl:choose>
1674
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1675
- <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')">Clause </xsl:when>
1676
- <xsl:when test="$type = 'clause' and $root = 'annex'">Annex </xsl:when>
1759
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1760
+ <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')"><xsl:value-of select="$title-clause"/></xsl:when>
1761
+ <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1677
1762
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1678
1763
  </xsl:choose>
1679
1764
  <xsl:value-of select="$section"/>
@@ -1682,30 +1767,26 @@
1682
1767
  </fo:basic-link>
1683
1768
  </xsl:template>
1684
1769
 
1685
- <xsl:template match="ogc:sourcecode">
1686
- <fo:block font-family="Courier" font-size="10pt" margin-bottom="6pt" keep-with-next="always" line-height="113%">
1687
- <xsl:choose>
1688
- <xsl:when test="@lang = 'en'"/>
1689
- <xsl:otherwise>
1690
- <xsl:attribute name="white-space">pre</xsl:attribute>
1691
- <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1692
- </xsl:otherwise>
1693
- </xsl:choose>
1694
- <xsl:apply-templates/>
1695
- </fo:block>
1770
+ <xsl:template match="ogc:sourcecode" priority="2">
1771
+ <xsl:call-template name="sourcecode"/>
1772
+ <xsl:variable name="title-figure">
1773
+ <xsl:call-template name="getTitle">
1774
+ <xsl:with-param name="name" select="'title-figure'"/>
1775
+ </xsl:call-template>
1776
+ </xsl:variable>
1696
1777
  <xsl:choose>
1697
1778
  <xsl:when test="@unnumbered='true'"/>
1698
1779
  <xsl:when test="ancestor::ogc:example"/>
1699
1780
  <xsl:when test="ancestor::ogc:td"/>
1700
1781
  <xsl:when test="ancestor::ogc:annex">
1701
- <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1782
+ <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1702
1783
  <xsl:choose>
1703
1784
  <xsl:when test="count(//ogc:annex) = 1">
1704
1785
  <xsl:value-of select="/ogc:nist-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/><xsl:number format="-1" level="any" count="ogc:annex//ogc:sourcecode"/>
1705
1786
  </xsl:when>
1706
1787
  <xsl:otherwise>
1707
1788
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1708
- <xsl:text>Figure </xsl:text>
1789
+ <xsl:value-of select="$title-figure"/>
1709
1790
  <xsl:number format="A." level="multiple" count="ogc:annex"/>
1710
1791
  <xsl:number format="1" level="any" count="ogc:sourcecode[ancestor::ogc:annex/@id = $id_annex and not(@unnumbered='true') and not(ancestor::ogc:example)]"/>
1711
1792
  <xsl:if test="ogc:name">
@@ -1718,7 +1799,7 @@
1718
1799
  </xsl:when>
1719
1800
  <xsl:otherwise>
1720
1801
  <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1721
- <xsl:text>Figure </xsl:text>
1802
+ <xsl:value-of select="$title-figure"/>
1722
1803
  <xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1723
1804
  <xsl:if test="ogc:name">
1724
1805
  <xsl:text> — </xsl:text>
@@ -1742,8 +1823,13 @@
1742
1823
  <xsl:template match="ogc:sourcecode/ogc:name"/>
1743
1824
 
1744
1825
  <xsl:template match="ogc:example">
1745
- <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1746
- <xsl:text>EXAMPLE</xsl:text>
1826
+ <fo:block font-size="10pt" text-align="center" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1827
+ <xsl:variable name="title-example">
1828
+ <xsl:call-template name="getTitle">
1829
+ <xsl:with-param name="name" select="'title-example'"/>
1830
+ </xsl:call-template>
1831
+ </xsl:variable>
1832
+ <xsl:value-of select="normalize-space($title-example)"/>
1747
1833
  <xsl:if test="following-sibling::ogc:example or preceding-sibling::ogc:example">
1748
1834
  <xsl:number format=" 1"/>
1749
1835
  </xsl:if>
@@ -1774,7 +1860,12 @@
1774
1860
  </xsl:if>
1775
1861
  <xsl:variable name="clauseid" select="ancestor::ogc:clause[1]/@id"/>
1776
1862
  <fo:inline padding-right="4mm">
1777
- <xsl:text>NOTE </xsl:text>
1863
+ <xsl:variable name="title-note">
1864
+ <xsl:call-template name="getTitle">
1865
+ <xsl:with-param name="name" select="'title-note'"/>
1866
+ </xsl:call-template>
1867
+ </xsl:variable>
1868
+ <xsl:value-of select="$title-note"/>
1778
1869
  <xsl:if test="count(//ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]) &gt; 1">
1779
1870
  <xsl:number count="ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]" level="any"/>
1780
1871
  </xsl:if>
@@ -1801,7 +1892,7 @@
1801
1892
  </xsl:if> -->
1802
1893
  <xsl:choose>
1803
1894
  <xsl:when test="@citeas and normalize-space(text()) = ''">
1804
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1895
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1805
1896
  </xsl:when>
1806
1897
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1807
1898
  <xsl:value-of select="//ogc:bibitem[@id = current()/@bibitemid]/ogc:docidentifier"/>
@@ -1814,9 +1905,19 @@
1814
1905
  </xsl:template>
1815
1906
 
1816
1907
  <xsl:template match="ogc:locality">
1908
+ <xsl:variable name="title-clause">
1909
+ <xsl:call-template name="getTitle">
1910
+ <xsl:with-param name="name" select="'title-clause'"/>
1911
+ </xsl:call-template>
1912
+ </xsl:variable>
1913
+ <xsl:variable name="title-annex">
1914
+ <xsl:call-template name="getTitle">
1915
+ <xsl:with-param name="name" select="'title-annex'"/>
1916
+ </xsl:call-template>
1917
+ </xsl:variable>
1817
1918
  <xsl:choose>
1818
- <xsl:when test="@type ='clause'">Clause </xsl:when>
1819
- <xsl:when test="@type ='annex'">Annex </xsl:when>
1919
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1920
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1820
1921
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1821
1922
  </xsl:choose>
1822
1923
  <xsl:text> </xsl:text><xsl:value-of select="ogc:referenceFrom"/>
@@ -1825,8 +1926,8 @@
1825
1926
  <xsl:template match="ogc:admonition">
1826
1927
  <fo:block-container border="0.5pt solid rgb(79, 129, 189)" color="rgb(79, 129, 189)" margin-left="16mm" margin-right="16mm" margin-bottom="12pt">
1827
1928
  <fo:block-container margin-left="0mm" margin-right="0mm" padding="2mm" padding-top="3mm">
1828
- <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1829
- <xsl:value-of select="translate(@type, $lower, $upper)"/>
1929
+ <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1930
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
1830
1931
  </fo:block>
1831
1932
  <fo:block font-style="italic">
1832
1933
  <xsl:apply-templates/>
@@ -1837,6 +1938,12 @@
1837
1938
 
1838
1939
  </xsl:template>
1839
1940
 
1941
+ <xsl:template match="ogc:formula">
1942
+ <fo:block id="{@id}">
1943
+ <xsl:apply-templates/>
1944
+ </fo:block>
1945
+ </xsl:template>
1946
+
1840
1947
  <xsl:template match="ogc:formula/ogc:dt/ogc:stem">
1841
1948
  <fo:inline>
1842
1949
  <xsl:apply-templates/>
@@ -1844,7 +1951,7 @@
1844
1951
  </xsl:template>
1845
1952
 
1846
1953
  <xsl:template match="ogc:formula/ogc:stem">
1847
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1954
+ <fo:block margin-top="6pt" margin-bottom="12pt">
1848
1955
  <fo:table table-layout="fixed" width="100%">
1849
1956
  <fo:table-column column-width="95%"/>
1850
1957
  <fo:table-column column-width="5%"/>
@@ -1859,7 +1966,7 @@
1859
1966
  <fo:block text-align="right">
1860
1967
  <xsl:choose>
1861
1968
  <xsl:when test="ancestor::ogc:annex">
1862
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
1969
+ <xsl:number format="(A.1)" level="multiple" count="ogc:annex | ogc:formula"/>
1863
1970
  </xsl:when>
1864
1971
  <xsl:otherwise> <!-- not(ancestor::ogc:annex) -->
1865
1972
  <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="ogc:formula"/><xsl:text>)</xsl:text> -->
@@ -1875,7 +1982,6 @@
1875
1982
  </fo:block>
1876
1983
  </xsl:template>
1877
1984
 
1878
-
1879
1985
  <xsl:template match="ogc:br" priority="2">
1880
1986
  <!-- <fo:block>&#xA0;</fo:block> -->
1881
1987
  <xsl:value-of select="$linebreak"/>
@@ -1886,11 +1992,7 @@
1886
1992
  <fo:block> </fo:block>
1887
1993
  <fo:block break-after="page"/>
1888
1994
  </xsl:template>
1889
-
1890
- <xsl:template match="ogc:bookmark">
1891
- <fo:inline id="{@id}"/>
1892
- </xsl:template>
1893
-
1995
+
1894
1996
  <xsl:template name="insertHeaderFooter">
1895
1997
  <xsl:param name="pagenum-font-weight" select="'normal'"/>
1896
1998
  <fo:static-content flow-name="header-even">
@@ -1948,38 +2050,6 @@
1948
2050
  </fo:static-content>
1949
2051
  </xsl:template>
1950
2052
 
1951
- <xsl:template name="getId">
1952
- <xsl:choose>
1953
- <xsl:when test="../@id">
1954
- <xsl:value-of select="../@id"/>
1955
- </xsl:when>
1956
- <xsl:otherwise>
1957
- <xsl:value-of select="text()"/>
1958
- </xsl:otherwise>
1959
- </xsl:choose>
1960
- </xsl:template>
1961
-
1962
- <xsl:template name="getLevel">
1963
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
1964
- <xsl:variable name="level">
1965
- <xsl:choose>
1966
- <xsl:when test="ancestor::ogc:preface">
1967
- <xsl:value-of select="$level_total - 2"/>
1968
- </xsl:when>
1969
- <xsl:when test="ancestor::ogc:sections">
1970
- <xsl:value-of select="$level_total - 2"/>
1971
- </xsl:when>
1972
- <xsl:when test="ancestor::ogc:bibliography">
1973
- <xsl:value-of select="$level_total - 2"/>
1974
- </xsl:when>
1975
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1976
- <xsl:otherwise>
1977
- <xsl:value-of select="$level_total - 1"/>
1978
- </xsl:otherwise>
1979
- </xsl:choose>
1980
- </xsl:variable>
1981
- <xsl:value-of select="$level"/>
1982
- </xsl:template>
1983
2053
 
1984
2054
  <xsl:template name="getSection">
1985
2055
  <xsl:param name="sectionNum"/>
@@ -1999,7 +2069,7 @@
1999
2069
  </xsl:when>
2000
2070
  <xsl:when test="$level &gt;= 2">
2001
2071
  <xsl:variable name="num">
2002
- <xsl:number format=".1" level="multiple" count="ogc:clause/ogc:clause | ogc:clause/ogc:terms | ogc:terms/ogc:term | ogc:clause/ogc:term | ogc:clause/ogc:definitions | ogc:definitions/ogc:definitions | ogc:terms/ogc:definitions"/>
2072
+ <xsl:call-template name="getSubSection"/>
2003
2073
  </xsl:variable>
2004
2074
  <xsl:value-of select="concat($sectionNum, $num)"/>
2005
2075
  </xsl:when>
@@ -2023,7 +2093,12 @@
2023
2093
  <xsl:when test="ancestor::ogc:annex">
2024
2094
  <xsl:choose>
2025
2095
  <xsl:when test="$level = 1">
2026
- <xsl:text>Annex </xsl:text>
2096
+ <xsl:variable name="title-annex">
2097
+ <xsl:call-template name="getTitle">
2098
+ <xsl:with-param name="name" select="'title-annex'"/>
2099
+ </xsl:call-template>
2100
+ </xsl:variable>
2101
+ <xsl:value-of select="$title-annex"/>
2027
2102
  <xsl:choose>
2028
2103
  <xsl:when test="count(//ogc:annex) = 1">
2029
2104
  <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/>
@@ -2047,12 +2122,13 @@
2047
2122
  </xsl:when>
2048
2123
  <xsl:when test="ancestor::ogc:preface"> <!-- if preface and there is clause(s) -->
2049
2124
  <xsl:choose>
2050
- <xsl:when test="$level = 1 and ..//ogc:clause">0</xsl:when>
2125
+ <xsl:when test="$level = 1"> <!-- and ancestor::ogc:foreword -->
2126
+ <xsl:number format="i" value="$sectionNum"/>
2127
+ </xsl:when>
2128
+ <!-- <xsl:when test="$level = 1 and ..//ogc:clause">0</xsl:when> -->
2051
2129
  <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)"/>
2130
+ <xsl:number format="i.1" level="multiple" count="ogc:clause"/>
2131
+ <!-- <xsl:value-of select="concat('0', $num)"/> -->
2056
2132
  </xsl:when>
2057
2133
  <xsl:otherwise>
2058
2134
  <!-- z<xsl:value-of select="$sectionNum"/>z -->
@@ -2066,44 +2142,255 @@
2066
2142
  <xsl:value-of select="$section"/>
2067
2143
  </xsl:template>
2068
2144
 
2069
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="link-style">
2145
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2070
2146
 
2071
- <xsl:attribute name="color">blue</xsl:attribute>
2072
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2147
+ <title-table lang="en">Table </title-table>
2148
+ <title-table lang="fr">Tableau </title-table>
2149
+
2150
+ <title-table lang="zh">Table </title-table>
2073
2151
 
2074
2152
 
2075
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()">
2076
- <xsl:value-of select="."/>
2077
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='br']">
2078
- <xsl:value-of select="$linebreak"/>
2079
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2080
- <xsl:call-template name="add-zero-spaces"/>
2081
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']">
2082
-
2083
- <xsl:variable name="simple-table">
2084
- <!-- <xsl:copy> -->
2085
- <xsl:call-template name="getSimpleTable"/>
2086
- <!-- </xsl:copy> -->
2087
- </xsl:variable>
2088
-
2089
- <!-- DEBUG -->
2090
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2091
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2092
2153
 
2093
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2154
+ <title-note lang="en">NOTE </title-note>
2155
+ <title-note lang="fr">NOTE </title-note>
2094
2156
 
2095
- <!-- <xsl:if test="$namespace = 'iso'">
2096
- <fo:block space-before="6pt">&#xA0;</fo:block>
2097
- </xsl:if> -->
2157
+ <title-note lang="zh">NOTE </title-note>
2098
2158
 
2099
- <xsl:choose>
2100
- <xsl:when test="@unnumbered = 'true'"/>
2101
- <xsl:otherwise>
2102
-
2103
-
2159
+
2160
+
2161
+ <title-figure lang="en">Figure </title-figure>
2162
+ <title-figure lang="fr">Figure </title-figure>
2163
+
2164
+ <title-figure lang="zh">Figure </title-figure>
2165
+
2166
+
2167
+
2168
+ <title-example lang="en">EXAMPLE </title-example>
2169
+ <title-example lang="fr">EXEMPLE </title-example>
2170
+
2171
+ <title-example lang="zh">EXAMPLE </title-example>
2172
+
2173
+
2174
+
2175
+ <title-example-xref lang="en">Example </title-example-xref>
2176
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2177
+
2178
+ <title-section lang="en">Section </title-section>
2179
+ <title-section lang="fr">Section </title-section>
2180
+
2181
+ <title-inequality lang="en">Inequality </title-inequality>
2182
+ <title-inequality lang="fr">Inequality </title-inequality>
2183
+
2184
+ <title-equation lang="en">Equation </title-equation>
2185
+ <title-equation lang="fr">Equation </title-equation>
2104
2186
 
2105
- <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2106
-
2187
+ <title-annex lang="en">Annex </title-annex>
2188
+ <title-annex lang="fr">Annexe </title-annex>
2189
+
2190
+ <title-annex lang="zh">Annex </title-annex>
2191
+
2192
+
2193
+
2194
+ <title-appendix lang="en">Appendix </title-appendix>
2195
+ <title-appendix lang="fr">Appendix </title-appendix>
2196
+
2197
+ <title-clause lang="en">Clause </title-clause>
2198
+ <title-clause lang="fr">Article </title-clause>
2199
+
2200
+ <title-clause lang="zh">Clause </title-clause>
2201
+
2202
+
2203
+
2204
+ <title-edition lang="en">
2205
+
2206
+
2207
+ <xsl:text>Version</xsl:text>
2208
+
2209
+ </title-edition>
2210
+
2211
+ <title-formula lang="en">Formula </title-formula>
2212
+ <title-formula lang="fr">Formula </title-formula>
2213
+
2214
+ <title-toc lang="en">
2215
+
2216
+ <xsl:text>Contents</xsl:text>
2217
+
2218
+
2219
+
2220
+ </title-toc>
2221
+ <title-toc lang="fr">Sommaire</title-toc>
2222
+
2223
+ <title-toc lang="zh">Contents</title-toc>
2224
+
2225
+
2226
+
2227
+ <title-page lang="en">Page</title-page>
2228
+ <title-page lang="fr">Page</title-page>
2229
+
2230
+ <title-key lang="en">Key</title-key>
2231
+ <title-key lang="fr">Légende</title-key>
2232
+
2233
+ <title-where lang="en">where</title-where>
2234
+ <title-where lang="fr">où</title-where>
2235
+
2236
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2237
+
2238
+ <title-part lang="en">
2239
+
2240
+
2241
+ </title-part>
2242
+ <title-part lang="fr">
2243
+
2244
+
2245
+ </title-part>
2246
+ <title-part lang="zh">第 # 部分:</title-part>
2247
+
2248
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2249
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2250
+
2251
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2252
+
2253
+
2254
+
2255
+ <title-modified lang="en">modified</title-modified>
2256
+ <title-modified lang="fr">modifiée</title-modified>
2257
+
2258
+ <title-modified lang="zh">modified</title-modified>
2259
+
2260
+
2261
+
2262
+ <title-source lang="en">SOURCE</title-source>
2263
+
2264
+ <title-keywords lang="en">Keywords</title-keywords>
2265
+
2266
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2267
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2268
+
2269
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2270
+
2271
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2272
+
2273
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2274
+
2275
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2276
+
2277
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2278
+
2279
+ <title-abstract lang="en">Abstract</title-abstract>
2280
+
2281
+ <title-summary lang="en">Summary</title-summary>
2282
+
2283
+ <title-in lang="en">in </title-in>
2284
+
2285
+ <title-box lang="en">Box </title-box>
2286
+
2287
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2288
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2289
+
2290
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2291
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2292
+
2293
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2294
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2295
+
2296
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2297
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
2298
+
2299
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
2300
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2301
+
2302
+ <title-caution lang="en">CAUTION</title-caution>
2303
+ <title-caution lang="zh">注意</title-caution>
2304
+
2305
+ <title-warning lang="en">WARNING</title-warning>
2306
+ <title-warning lang="zh">警告</title-warning>
2307
+
2308
+ <title-amendment lang="en">AMENDMENT</title-amendment>
2309
+ </xsl:variable><xsl:template name="getTitle">
2310
+ <xsl:param name="name"/>
2311
+ <xsl:variable name="lang">
2312
+ <xsl:call-template name="getLang"/>
2313
+ </xsl:variable>
2314
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2315
+ <xsl:choose>
2316
+ <xsl:when test="normalize-space($title_) != ''">
2317
+ <xsl:value-of select="$title_"/>
2318
+ </xsl:when>
2319
+ <xsl:otherwise>
2320
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2321
+ </xsl:otherwise>
2322
+ </xsl:choose>
2323
+ </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">
2324
+
2325
+ <xsl:attribute name="color">blue</xsl:attribute>
2326
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2327
+
2328
+
2329
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2330
+
2331
+
2332
+
2333
+
2334
+
2335
+
2336
+
2337
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2338
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2339
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2340
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2341
+ <xsl:attribute name="line-height">113%</xsl:attribute>
2342
+
2343
+
2344
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2345
+
2346
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2347
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2348
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2349
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2350
+
2351
+
2352
+
2353
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2354
+
2355
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2356
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2357
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2358
+
2359
+
2360
+
2361
+ </xsl:attribute-set><xsl:template match="text()">
2362
+ <xsl:value-of select="."/>
2363
+ </xsl:template><xsl:template match="*[local-name()='br']">
2364
+ <xsl:value-of select="$linebreak"/>
2365
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2366
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2367
+ <xsl:call-template name="add-zero-spaces-java"/>
2368
+ </xsl:template><xsl:template match="*[local-name()='table']">
2369
+
2370
+ <xsl:variable name="simple-table">
2371
+ <!-- <xsl:copy> -->
2372
+ <xsl:call-template name="getSimpleTable"/>
2373
+ <!-- </xsl:copy> -->
2374
+ </xsl:variable>
2375
+
2376
+ <!-- DEBUG -->
2377
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2378
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2379
+
2380
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2381
+
2382
+ <!-- <xsl:if test="$namespace = 'iso'">
2383
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2384
+ </xsl:if> -->
2385
+
2386
+ <xsl:choose>
2387
+ <xsl:when test="@unnumbered = 'true'"/>
2388
+ <xsl:otherwise>
2389
+
2390
+
2391
+
2392
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2393
+
2107
2394
 
2108
2395
 
2109
2396
 
@@ -2113,31 +2400,17 @@
2113
2400
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2114
2401
 
2115
2402
 
2116
- <xsl:text>Table </xsl:text>
2117
- <xsl:choose>
2118
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2119
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2120
- </xsl:when>
2121
- <xsl:when test="ancestor::*[local-name()='annex']">
2122
-
2123
-
2124
-
2125
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2126
-
2127
-
2128
-
2129
-
2130
-
2131
-
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
-
2135
-
2136
- <xsl:number format="A." count="*[local-name()='annex']"/>
2137
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2138
-
2139
- </xsl:otherwise>
2140
- </xsl:choose>
2403
+
2404
+ <xsl:variable name="title-table">
2405
+ <xsl:call-template name="getTitle">
2406
+ <xsl:with-param name="name" select="'title-table'"/>
2407
+ </xsl:call-template>
2408
+ </xsl:variable>
2409
+ <xsl:value-of select="$title-table"/>
2410
+
2411
+ <xsl:call-template name="getTableNumber"/>
2412
+
2413
+
2141
2414
  <xsl:if test="*[local-name()='name']">
2142
2415
 
2143
2416
 
@@ -2211,6 +2484,7 @@
2211
2484
  <xsl:attribute name="space-after">12pt</xsl:attribute>
2212
2485
 
2213
2486
 
2487
+
2214
2488
  <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2215
2489
 
2216
2490
 
@@ -2227,9 +2501,10 @@
2227
2501
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2228
2502
 
2229
2503
 
2504
+
2230
2505
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2231
2506
  <xsl:choose>
2232
- <xsl:when test=". = 1">
2507
+ <xsl:when test=". = 1 or . = 0">
2233
2508
  <fo:table-column column-width="proportional-column-width(2)"/>
2234
2509
  </xsl:when>
2235
2510
  <xsl:otherwise>
@@ -2237,21 +2512,55 @@
2237
2512
  </xsl:otherwise>
2238
2513
  </xsl:choose>
2239
2514
  </xsl:for-each>
2240
- <xsl:apply-templates/>
2515
+
2516
+ <xsl:choose>
2517
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2518
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2519
+ </xsl:when>
2520
+ <xsl:otherwise>
2521
+ <xsl:apply-templates/>
2522
+ </xsl:otherwise>
2523
+ </xsl:choose>
2524
+
2241
2525
  </fo:table>
2242
2526
 
2243
2527
 
2244
2528
 
2245
2529
  </fo:block-container>
2246
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2530
+ </xsl:template><xsl:template name="getTableNumber">
2531
+ <xsl:choose>
2532
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2533
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2534
+ </xsl:when>
2535
+ <xsl:when test="ancestor::*[local-name()='annex']">
2536
+
2537
+
2538
+
2539
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2540
+
2541
+
2542
+
2543
+
2544
+
2545
+
2546
+ </xsl:when>
2547
+ <xsl:otherwise>
2548
+
2549
+
2550
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2551
+ <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']"/>
2552
+
2553
+ </xsl:otherwise>
2554
+ </xsl:choose>
2555
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2247
2556
  <xsl:apply-templates/>
2248
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="calculate-columns-numbers">
2557
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2249
2558
  <xsl:param name="table-row"/>
2250
2559
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2251
2560
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2252
2561
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2253
2562
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2254
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="calculate-column-widths">
2563
+ </xsl:template><xsl:template name="calculate-column-widths">
2255
2564
  <xsl:param name="table"/>
2256
2565
  <xsl:param name="cols-count"/>
2257
2566
  <xsl:param name="curr-col" select="1"/>
@@ -2260,7 +2569,7 @@
2260
2569
  <xsl:if test="$curr-col &lt;= $cols-count">
2261
2570
  <xsl:variable name="widths">
2262
2571
  <xsl:choose>
2263
- <xsl:when test="not($table)">
2572
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2264
2573
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2265
2574
  <xsl:variable name="words">
2266
2575
  <xsl:call-template name="tokenize">
@@ -2299,9 +2608,16 @@
2299
2608
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2300
2609
  </xsl:variable>
2301
2610
  <xsl:variable name="words">
2611
+ <xsl:variable name="string_with_added_zerospaces">
2612
+ <xsl:call-template name="add-zero-spaces-java">
2613
+ <xsl:with-param name="text" select="$td_text"/>
2614
+ </xsl:call-template>
2615
+ </xsl:variable>
2302
2616
  <xsl:call-template name="tokenize">
2303
2617
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2304
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2618
+ <!-- 2009 thinspace -->
2619
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2620
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2305
2621
  </xsl:call-template>
2306
2622
  </xsl:variable>
2307
2623
  <xsl:variable name="max_length">
@@ -2342,17 +2658,28 @@
2342
2658
  <xsl:with-param name="table" select="$table"/>
2343
2659
  </xsl:call-template>
2344
2660
  </xsl:if>
2345
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()" mode="td_text">
2661
+ </xsl:template><xsl:template match="text()" mode="td_text">
2346
2662
  <xsl:variable name="zero-space">​</xsl:variable>
2347
2663
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2348
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='thead']" mode="process">
2664
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2665
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2666
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2667
+ <xsl:value-of select="@target"/>
2668
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2669
+ <xsl:param name="cols-count"/>
2349
2670
  <!-- font-weight="bold" -->
2350
- <fo:table-header>
2671
+ <fo:table-header>
2672
+
2351
2673
  <xsl:apply-templates/>
2352
2674
  </fo:table-header>
2353
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tfoot']" mode="process">
2675
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2676
+ <fo:table-body>
2677
+ <xsl:apply-templates/>
2678
+ </fo:table-body>
2679
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2354
2680
  <xsl:apply-templates/>
2355
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="insertTableFooter">
2681
+ </xsl:template><xsl:template name="insertTableFooter">
2682
+ <xsl:param name="cols-count"/>
2356
2683
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2357
2684
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2358
2685
 
@@ -2363,22 +2690,7 @@
2363
2690
  <!-- if there are note(s) or fn(s) then create footer row -->
2364
2691
  <xsl:if test="$isNoteOrFnExist = 'true'">
2365
2692
 
2366
- <xsl:variable name="cols-count">
2367
- <xsl:choose>
2368
- <xsl:when test="../*[local-name()='thead']">
2369
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2370
- <xsl:call-template name="calculate-columns-numbers">
2371
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2372
- </xsl:call-template>
2373
- </xsl:when>
2374
- <xsl:otherwise>
2375
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2376
- <xsl:call-template name="calculate-columns-numbers">
2377
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2378
- </xsl:call-template>
2379
- </xsl:otherwise>
2380
- </xsl:choose>
2381
- </xsl:variable>
2693
+
2382
2694
 
2383
2695
  <fo:table-row>
2384
2696
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2406,11 +2718,30 @@
2406
2718
  </fo:table-footer>
2407
2719
 
2408
2720
  </xsl:if>
2409
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tbody']">
2721
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2722
+
2723
+ <xsl:variable name="cols-count">
2724
+ <xsl:choose>
2725
+ <xsl:when test="../*[local-name()='thead']">
2726
+ <xsl:call-template name="calculate-columns-numbers">
2727
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2728
+ </xsl:call-template>
2729
+ </xsl:when>
2730
+ <xsl:otherwise>
2731
+ <xsl:call-template name="calculate-columns-numbers">
2732
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2733
+ </xsl:call-template>
2734
+ </xsl:otherwise>
2735
+ </xsl:choose>
2736
+ </xsl:variable>
2410
2737
 
2411
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2738
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2739
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2740
+ </xsl:apply-templates>
2412
2741
 
2413
- <xsl:call-template name="insertTableFooter"/>
2742
+ <xsl:call-template name="insertTableFooter">
2743
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2744
+ </xsl:call-template>
2414
2745
 
2415
2746
  <fo:table-body>
2416
2747
  <xsl:apply-templates/>
@@ -2418,7 +2749,7 @@
2418
2749
 
2419
2750
  </fo:table-body>
2420
2751
 
2421
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tr']">
2752
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2422
2753
  <xsl:variable name="parent-name" select="local-name(..)"/>
2423
2754
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2424
2755
  <fo:table-row min-height="4mm">
@@ -2438,7 +2769,7 @@
2438
2769
 
2439
2770
  <xsl:apply-templates/>
2440
2771
  </fo:table-row>
2441
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='th']">
2772
+ </xsl:template><xsl:template match="*[local-name()='th']">
2442
2773
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2443
2774
 
2444
2775
 
@@ -2461,7 +2792,7 @@
2461
2792
  <xsl:apply-templates/>
2462
2793
  </fo:block>
2463
2794
  </fo:table-cell>
2464
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='td']">
2795
+ </xsl:template><xsl:template match="*[local-name()='td']">
2465
2796
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2466
2797
 
2467
2798
 
@@ -2483,6 +2814,7 @@
2483
2814
  </xsl:attribute>
2484
2815
  </xsl:if>
2485
2816
  <fo:block>
2817
+
2486
2818
  <xsl:apply-templates/>
2487
2819
  </fo:block>
2488
2820
  <!-- <xsl:choose>
@@ -2498,16 +2830,24 @@
2498
2830
 
2499
2831
 
2500
2832
  </fo:table-cell>
2501
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='note']" mode="process">
2833
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2502
2834
 
2503
2835
 
2504
2836
  <fo:block font-size="10pt" margin-bottom="12pt">
2505
2837
 
2506
2838
 
2507
2839
 
2840
+
2508
2841
  <fo:inline padding-right="2mm">
2509
2842
 
2510
- <xsl:text>NOTE </xsl:text>
2843
+
2844
+
2845
+ <xsl:variable name="title-note">
2846
+ <xsl:call-template name="getTitle">
2847
+ <xsl:with-param name="name" select="'title-note'"/>
2848
+ </xsl:call-template>
2849
+ </xsl:variable>
2850
+ <xsl:value-of select="$title-note"/>
2511
2851
 
2512
2852
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2513
2853
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -2521,9 +2861,9 @@
2521
2861
  <xsl:apply-templates mode="process"/>
2522
2862
  </fo:block>
2523
2863
 
2524
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2864
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2525
2865
  <xsl:apply-templates/>
2526
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_display">
2866
+ </xsl:template><xsl:template name="fn_display">
2527
2867
  <xsl:variable name="references">
2528
2868
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2529
2869
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2546,6 +2886,7 @@
2546
2886
 
2547
2887
 
2548
2888
 
2889
+
2549
2890
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2550
2891
 
2551
2892
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2565,7 +2906,7 @@
2565
2906
  </fo:block>
2566
2907
  </xsl:if>
2567
2908
  </xsl:for-each>
2568
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_name_display">
2909
+ </xsl:template><xsl:template name="fn_name_display">
2569
2910
  <!-- <xsl:variable name="references">
2570
2911
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2571
2912
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2581,7 +2922,7 @@
2581
2922
  <xsl:apply-templates/>
2582
2923
  </fo:block>
2583
2924
  </xsl:for-each>
2584
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="fn_display_figure">
2925
+ </xsl:template><xsl:template name="fn_display_figure">
2585
2926
  <xsl:variable name="key_iso">
2586
2927
  <!-- and (not(@class) or @class !='pseudocode') -->
2587
2928
  </xsl:variable>
@@ -2592,6 +2933,36 @@
2592
2933
  </fn>
2593
2934
  </xsl:for-each>
2594
2935
  </xsl:variable>
2936
+
2937
+ <!-- current hierarchy is 'figure' element -->
2938
+ <xsl:variable name="following_dl_colwidths">
2939
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2940
+ <xsl:variable name="html-table">
2941
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2942
+ <xsl:element name="{$ns}:table">
2943
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2944
+ <tbody>
2945
+ <xsl:apply-templates mode="dl"/>
2946
+ </tbody>
2947
+ </xsl:for-each>
2948
+ </xsl:element>
2949
+ </xsl:variable>
2950
+
2951
+ <xsl:call-template name="calculate-column-widths">
2952
+ <xsl:with-param name="cols-count" select="2"/>
2953
+ <xsl:with-param name="table" select="$html-table"/>
2954
+ </xsl:call-template>
2955
+
2956
+ </xsl:if>
2957
+ </xsl:variable>
2958
+
2959
+
2960
+ <xsl:variable name="maxlength_dt">
2961
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2962
+ <xsl:call-template name="getMaxLength_dt"/>
2963
+ </xsl:for-each>
2964
+ </xsl:variable>
2965
+
2595
2966
  <xsl:if test="xalan:nodeset($references)//fn">
2596
2967
  <fo:block>
2597
2968
  <fo:table width="95%" table-layout="fixed">
@@ -2599,8 +2970,19 @@
2599
2970
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2600
2971
 
2601
2972
  </xsl:if>
2602
- <fo:table-column column-width="15%"/>
2603
- <fo:table-column column-width="85%"/>
2973
+ <xsl:choose>
2974
+ <!-- if there 'dl', then set same columns width -->
2975
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2976
+ <xsl:call-template name="setColumnWidth_dl">
2977
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2978
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2979
+ </xsl:call-template>
2980
+ </xsl:when>
2981
+ <xsl:otherwise>
2982
+ <fo:table-column column-width="15%"/>
2983
+ <fo:table-column column-width="85%"/>
2984
+ </xsl:otherwise>
2985
+ </xsl:choose>
2604
2986
  <fo:table-body>
2605
2987
  <xsl:for-each select="xalan:nodeset($references)//fn">
2606
2988
  <xsl:variable name="reference" select="@reference"/>
@@ -2632,7 +3014,7 @@
2632
3014
  </fo:block>
2633
3015
  </xsl:if>
2634
3016
 
2635
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='fn']">
3017
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2636
3018
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2637
3019
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
2638
3020
 
@@ -2654,11 +3036,11 @@
2654
3036
  <xsl:value-of select="@reference"/>
2655
3037
  </fo:basic-link>
2656
3038
  </fo:inline>
2657
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='fn']/*[local-name()='p']">
3039
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2658
3040
  <fo:inline>
2659
3041
  <xsl:apply-templates/>
2660
3042
  </fo:inline>
2661
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dl']">
3043
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2662
3044
  <xsl:variable name="parent" select="local-name(..)"/>
2663
3045
 
2664
3046
  <xsl:variable name="key_iso">
@@ -2670,8 +3052,13 @@
2670
3052
 
2671
3053
 
2672
3054
  <fo:block margin-bottom="12pt" text-align="left">
2673
-
2674
- <xsl:text>where </xsl:text>
3055
+
3056
+ <xsl:variable name="title-where">
3057
+ <xsl:call-template name="getTitle">
3058
+ <xsl:with-param name="name" select="'title-where'"/>
3059
+ </xsl:call-template>
3060
+ </xsl:variable>
3061
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2675
3062
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
2676
3063
  <xsl:text/>
2677
3064
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -2684,15 +3071,25 @@
2684
3071
 
2685
3072
 
2686
3073
 
2687
- <xsl:text>where</xsl:text>
3074
+ <xsl:variable name="title-where">
3075
+ <xsl:call-template name="getTitle">
3076
+ <xsl:with-param name="name" select="'title-where'"/>
3077
+ </xsl:call-template>
3078
+ </xsl:variable>
3079
+ <xsl:value-of select="$title-where"/>
2688
3080
  </fo:block>
2689
3081
  </xsl:when>
2690
3082
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2691
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3083
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2692
3084
 
2693
3085
 
2694
3086
 
2695
- <xsl:text>Key</xsl:text>
3087
+ <xsl:variable name="title-key">
3088
+ <xsl:call-template name="getTitle">
3089
+ <xsl:with-param name="name" select="'title-key'"/>
3090
+ </xsl:call-template>
3091
+ </xsl:variable>
3092
+ <xsl:value-of select="$title-key"/>
2696
3093
  </fo:block>
2697
3094
  </xsl:when>
2698
3095
  </xsl:choose>
@@ -2703,26 +3100,11 @@
2703
3100
 
2704
3101
 
2705
3102
 
3103
+
2706
3104
  <fo:block>
2707
3105
 
2708
3106
 
2709
- <!-- create virtual html table for dl/[dt and dd] -->
2710
- <xsl:variable name="html-table">
2711
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2712
- <xsl:element name="{$ns}:table">
2713
- <tbody>
2714
- <xsl:apply-templates mode="dl"/>
2715
- </tbody>
2716
- </xsl:element>
2717
- </xsl:variable>
2718
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2719
- <xsl:variable name="colwidths">
2720
- <xsl:call-template name="calculate-column-widths">
2721
- <xsl:with-param name="cols-count" select="2"/>
2722
- <xsl:with-param name="table" select="$html-table"/>
2723
- </xsl:call-template>
2724
- </xsl:variable>
2725
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3107
+
2726
3108
 
2727
3109
  <fo:table width="95%" table-layout="fixed">
2728
3110
 
@@ -2735,42 +3117,30 @@
2735
3117
 
2736
3118
  </xsl:when>
2737
3119
  </xsl:choose>
2738
- <xsl:choose>
2739
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2740
- <fo:table-column column-width="50%"/>
2741
- <fo:table-column column-width="50%"/>
2742
- </xsl:when>
2743
- <xsl:otherwise>
2744
- <xsl:choose>
2745
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2746
- <fo:table-column column-width="60%"/>
2747
- <fo:table-column column-width="40%"/>
2748
- </xsl:when> -->
2749
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2750
- <fo:table-column column-width="50%"/>
2751
- <fo:table-column column-width="50%"/>
2752
- </xsl:when>
2753
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2754
- <fo:table-column column-width="40%"/>
2755
- <fo:table-column column-width="60%"/>
2756
- </xsl:when>
2757
- <xsl:otherwise>
2758
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2759
- <xsl:choose>
2760
- <xsl:when test=". = 1">
2761
- <fo:table-column column-width="proportional-column-width(2)"/>
2762
- </xsl:when>
2763
- <xsl:otherwise>
2764
- <fo:table-column column-width="proportional-column-width({.})"/>
2765
- </xsl:otherwise>
2766
- </xsl:choose>
2767
- </xsl:for-each>
2768
- </xsl:otherwise>
2769
- </xsl:choose>
2770
- <!-- <fo:table-column column-width="15%"/>
2771
- <fo:table-column column-width="85%"/> -->
2772
- </xsl:otherwise>
2773
- </xsl:choose>
3120
+ <!-- create virtual html table for dl/[dt and dd] -->
3121
+ <xsl:variable name="html-table">
3122
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3123
+ <xsl:element name="{$ns}:table">
3124
+ <tbody>
3125
+ <xsl:apply-templates mode="dl"/>
3126
+ </tbody>
3127
+ </xsl:element>
3128
+ </xsl:variable>
3129
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3130
+ <xsl:variable name="colwidths">
3131
+ <xsl:call-template name="calculate-column-widths">
3132
+ <xsl:with-param name="cols-count" select="2"/>
3133
+ <xsl:with-param name="table" select="$html-table"/>
3134
+ </xsl:call-template>
3135
+ </xsl:variable>
3136
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3137
+ <xsl:variable name="maxlength_dt">
3138
+ <xsl:call-template name="getMaxLength_dt"/>
3139
+ </xsl:variable>
3140
+ <xsl:call-template name="setColumnWidth_dl">
3141
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3142
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3143
+ </xsl:call-template>
2774
3144
  <fo:table-body>
2775
3145
  <xsl:apply-templates>
2776
3146
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -2780,7 +3150,61 @@
2780
3150
  </fo:block>
2781
3151
  </fo:block>
2782
3152
  </xsl:if>
2783
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dl']/*[local-name()='note']">
3153
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3154
+ <xsl:param name="colwidths"/>
3155
+ <xsl:param name="maxlength_dt"/>
3156
+ <xsl:choose>
3157
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3158
+ <fo:table-column column-width="50%"/>
3159
+ <fo:table-column column-width="50%"/>
3160
+ </xsl:when>
3161
+ <xsl:otherwise>
3162
+ <xsl:choose>
3163
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3164
+ <fo:table-column column-width="5%"/>
3165
+ <fo:table-column column-width="95%"/>
3166
+ </xsl:when>
3167
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3168
+ <fo:table-column column-width="10%"/>
3169
+ <fo:table-column column-width="90%"/>
3170
+ </xsl:when>
3171
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3172
+ <fo:table-column column-width="60%"/>
3173
+ <fo:table-column column-width="40%"/>
3174
+ </xsl:when> -->
3175
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3176
+ <fo:table-column column-width="50%"/>
3177
+ <fo:table-column column-width="50%"/>
3178
+ </xsl:when>
3179
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3180
+ <fo:table-column column-width="40%"/>
3181
+ <fo:table-column column-width="60%"/>
3182
+ </xsl:when>
3183
+ <xsl:otherwise>
3184
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3185
+ <xsl:choose>
3186
+ <xsl:when test=". = 1 or . = 0">
3187
+ <fo:table-column column-width="proportional-column-width(2)"/>
3188
+ </xsl:when>
3189
+ <xsl:otherwise>
3190
+ <fo:table-column column-width="proportional-column-width({.})"/>
3191
+ </xsl:otherwise>
3192
+ </xsl:choose>
3193
+ </xsl:for-each>
3194
+ </xsl:otherwise>
3195
+ </xsl:choose>
3196
+ <!-- <fo:table-column column-width="15%"/>
3197
+ <fo:table-column column-width="85%"/> -->
3198
+ </xsl:otherwise>
3199
+ </xsl:choose>
3200
+ </xsl:template><xsl:template name="getMaxLength_dt">
3201
+ <xsl:for-each select="*[local-name()='dt']">
3202
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3203
+ <xsl:if test="position() = 1">
3204
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3205
+ </xsl:if>
3206
+ </xsl:for-each>
3207
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
2784
3208
  <xsl:param name="key_iso"/>
2785
3209
 
2786
3210
  <!-- <tr>
@@ -2796,7 +3220,12 @@
2796
3220
  <xsl:if test="normalize-space($key_iso) = 'true'">
2797
3221
  <xsl:attribute name="margin-top">0</xsl:attribute>
2798
3222
  </xsl:if>
2799
- NOTE
3223
+ <xsl:variable name="title-note">
3224
+ <xsl:call-template name="getTitle">
3225
+ <xsl:with-param name="name" select="'title-note'"/>
3226
+ </xsl:call-template>
3227
+ </xsl:variable>
3228
+ <xsl:value-of select="$title-note"/>
2800
3229
  </fo:block>
2801
3230
  </fo:table-cell>
2802
3231
  <fo:table-cell>
@@ -2805,7 +3234,7 @@
2805
3234
  </fo:block>
2806
3235
  </fo:table-cell>
2807
3236
  </fo:table-row>
2808
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dt']" mode="dl">
3237
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
2809
3238
  <tr>
2810
3239
  <td>
2811
3240
  <xsl:apply-templates/>
@@ -2818,11 +3247,12 @@
2818
3247
  </td>
2819
3248
  </tr>
2820
3249
 
2821
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dt']">
3250
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2822
3251
  <xsl:param name="key_iso"/>
2823
3252
 
2824
3253
  <fo:table-row>
2825
3254
  <fo:table-cell>
3255
+
2826
3256
  <fo:block margin-top="6pt">
2827
3257
 
2828
3258
 
@@ -2832,8 +3262,18 @@
2832
3262
  </xsl:if>
2833
3263
 
2834
3264
 
2835
- <xsl:apply-templates/>
2836
3265
 
3266
+
3267
+
3268
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
3269
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3270
+
3271
+ <xsl:apply-templates/>
3272
+ <!-- <xsl:if test="$namespace = 'gb'">
3273
+ <xsl:if test="ancestor::*[local-name()='formula']">
3274
+ <xsl:text>—</xsl:text>
3275
+ </xsl:if>
3276
+ </xsl:if> -->
2837
3277
  </fo:block>
2838
3278
  </fo:table-cell>
2839
3279
  <fo:table-cell>
@@ -2847,37 +3287,37 @@
2847
3287
  </fo:table-cell>
2848
3288
  </fo:table-row>
2849
3289
 
2850
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']" mode="dl_process">
3290
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2851
3291
  <xsl:apply-templates/>
2852
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']" mode="process">
3292
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2853
3293
  <xsl:apply-templates/>
2854
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3294
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2855
3295
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2856
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='em']">
3296
+ </xsl:template><xsl:template match="*[local-name()='em']">
2857
3297
  <fo:inline font-style="italic">
2858
3298
  <xsl:apply-templates/>
2859
3299
  </fo:inline>
2860
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='strong']">
3300
+ </xsl:template><xsl:template match="*[local-name()='strong']">
2861
3301
  <fo:inline font-weight="bold">
2862
3302
  <xsl:apply-templates/>
2863
3303
  </fo:inline>
2864
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='sup']">
3304
+ </xsl:template><xsl:template match="*[local-name()='sup']">
2865
3305
  <fo:inline font-size="80%" vertical-align="super">
2866
3306
  <xsl:apply-templates/>
2867
3307
  </fo:inline>
2868
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='sub']">
3308
+ </xsl:template><xsl:template match="*[local-name()='sub']">
2869
3309
  <fo:inline font-size="80%" vertical-align="sub">
2870
3310
  <xsl:apply-templates/>
2871
3311
  </fo:inline>
2872
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tt']">
2873
- <fo:inline font-family="Courier" font-size="10pt">
3312
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3313
+ <fo:inline font-family="Courier" font-size="10pt">
2874
3314
  <xsl:apply-templates/>
2875
3315
  </fo:inline>
2876
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='del']">
3316
+ </xsl:template><xsl:template match="*[local-name()='del']">
2877
3317
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2878
3318
  <xsl:apply-templates/>
2879
3319
  </fo:inline>
2880
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="text()[ancestor::*[local-name()='smallcap']]">
3320
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2881
3321
  <xsl:variable name="text" select="normalize-space(.)"/>
2882
3322
  <fo:inline font-size="75%">
2883
3323
  <xsl:if test="string-length($text) &gt; 0">
@@ -2886,10 +3326,11 @@
2886
3326
  </xsl:call-template>
2887
3327
  </xsl:if>
2888
3328
  </fo:inline>
2889
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="recursiveSmallCaps">
3329
+ </xsl:template><xsl:template name="recursiveSmallCaps">
2890
3330
  <xsl:param name="text"/>
2891
3331
  <xsl:variable name="char" select="substring($text,1,1)"/>
2892
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
3332
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3333
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2893
3334
  <xsl:choose>
2894
3335
  <xsl:when test="$char=$upperCase">
2895
3336
  <fo:inline font-size="{100 div 0.75}%">
@@ -2905,7 +3346,7 @@
2905
3346
  <xsl:with-param name="text" select="substring($text,2)"/>
2906
3347
  </xsl:call-template>
2907
3348
  </xsl:if>
2908
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="tokenize">
3349
+ </xsl:template><xsl:template name="tokenize">
2909
3350
  <xsl:param name="text"/>
2910
3351
  <xsl:param name="separator" select="' '"/>
2911
3352
  <xsl:choose>
@@ -2953,7 +3394,7 @@
2953
3394
  </xsl:call-template>
2954
3395
  </xsl:otherwise>
2955
3396
  </xsl:choose>
2956
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="max_length">
3397
+ </xsl:template><xsl:template name="max_length">
2957
3398
  <xsl:param name="words"/>
2958
3399
  <xsl:for-each select="$words//word">
2959
3400
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -2961,7 +3402,11 @@
2961
3402
  <xsl:value-of select="."/>
2962
3403
  </xsl:if>
2963
3404
  </xsl:for-each>
2964
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="add-zero-spaces">
3405
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3406
+ <xsl:param name="text" select="."/>
3407
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3408
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3409
+ </xsl:template><xsl:template name="add-zero-spaces">
2965
3410
  <xsl:param name="text" select="."/>
2966
3411
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2967
3412
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3014,7 +3459,7 @@
3014
3459
  <xsl:value-of select="$text"/>
3015
3460
  </xsl:otherwise>
3016
3461
  </xsl:choose>
3017
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="add-zero-spaces-equal">
3462
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3018
3463
  <xsl:param name="text" select="."/>
3019
3464
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3020
3465
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3040,7 +3485,7 @@
3040
3485
  <xsl:value-of select="$text"/>
3041
3486
  </xsl:otherwise>
3042
3487
  </xsl:choose>
3043
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="getSimpleTable">
3488
+ </xsl:template><xsl:template name="getSimpleTable">
3044
3489
  <xsl:variable name="simple-table">
3045
3490
 
3046
3491
  <!-- Step 1. colspan processing -->
@@ -3067,9 +3512,9 @@
3067
3512
  </xsl:choose> -->
3068
3513
  </xsl:variable>
3069
3514
  <xsl:copy-of select="$simple-table"/>
3070
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3515
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3071
3516
  <xsl:apply-templates mode="simple-table-colspan"/>
3072
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3517
+ </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">
3073
3518
  <xsl:choose>
3074
3519
  <xsl:when test="@colspan">
3075
3520
  <xsl:variable name="td">
@@ -3091,16 +3536,16 @@
3091
3536
  </xsl:element>
3092
3537
  </xsl:otherwise>
3093
3538
  </xsl:choose>
3094
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='tr']" mode="simple-table-colspan">
3539
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3095
3540
  <xsl:element name="tr">
3096
3541
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3097
3542
  <xsl:apply-templates mode="simple-table-colspan"/>
3098
3543
  </xsl:element>
3099
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="@*|node()" mode="simple-table-colspan">
3544
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3100
3545
  <xsl:copy>
3101
3546
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3102
3547
  </xsl:copy>
3103
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="repeatNode">
3548
+ </xsl:template><xsl:template name="repeatNode">
3104
3549
  <xsl:param name="count"/>
3105
3550
  <xsl:param name="node"/>
3106
3551
 
@@ -3111,18 +3556,18 @@
3111
3556
  </xsl:call-template>
3112
3557
  <xsl:copy-of select="$node"/>
3113
3558
  </xsl:if>
3114
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="@*|node()" mode="simple-table-rowspan">
3559
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3115
3560
  <xsl:copy>
3116
3561
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3117
3562
  </xsl:copy>
3118
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="tbody" mode="simple-table-rowspan">
3563
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3119
3564
  <xsl:copy>
3120
3565
  <xsl:copy-of select="tr[1]"/>
3121
3566
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3122
3567
  <xsl:with-param name="previousRow" select="tr[1]"/>
3123
3568
  </xsl:apply-templates>
3124
3569
  </xsl:copy>
3125
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="tr" mode="simple-table-rowspan">
3570
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3126
3571
  <xsl:param name="previousRow"/>
3127
3572
  <xsl:variable name="currentRow" select="."/>
3128
3573
 
@@ -3156,43 +3601,53 @@
3156
3601
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3157
3602
  <xsl:with-param name="previousRow" select="$newRow"/>
3158
3603
  </xsl:apply-templates>
3159
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="getLang">
3604
+ </xsl:template><xsl:template name="getLang">
3160
3605
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3161
3606
  <xsl:choose>
3162
3607
  <xsl:when test="$language = 'English'">en</xsl:when>
3163
3608
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3164
3609
  </xsl:choose>
3165
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" name="capitalizeWords">
3610
+ </xsl:template><xsl:template name="capitalizeWords">
3166
3611
  <xsl:param name="str"/>
3167
3612
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3168
3613
  <xsl:choose>
3169
3614
  <xsl:when test="contains($str2, ' ')">
3170
3615
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3171
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3172
- <xsl:value-of select="substring($substr, 2)"/>
3616
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3617
+ <xsl:value-of select="substring($substr, 2)"/> -->
3618
+ <xsl:call-template name="capitalize">
3619
+ <xsl:with-param name="str" select="$substr"/>
3620
+ </xsl:call-template>
3173
3621
  <xsl:text> </xsl:text>
3174
3622
  <xsl:call-template name="capitalizeWords">
3175
3623
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3176
3624
  </xsl:call-template>
3177
3625
  </xsl:when>
3178
3626
  <xsl:otherwise>
3179
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3180
- <xsl:value-of select="substring($str2, 2)"/>
3627
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3628
+ <xsl:value-of select="substring($str2, 2)"/> -->
3629
+ <xsl:call-template name="capitalize">
3630
+ <xsl:with-param name="str" select="$str2"/>
3631
+ </xsl:call-template>
3181
3632
  </xsl:otherwise>
3182
3633
  </xsl:choose>
3183
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="mathml:math">
3634
+ </xsl:template><xsl:template name="capitalize">
3635
+ <xsl:param name="str"/>
3636
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3637
+ <xsl:value-of select="substring($str, 2)"/>
3638
+ </xsl:template><xsl:template match="mathml:math">
3184
3639
  <fo:inline font-family="STIX2Math">
3185
3640
  <fo:instream-foreign-object fox:alt-text="Math">
3186
3641
  <xsl:copy-of select="."/>
3187
3642
  </fo:instream-foreign-object>
3188
3643
  </fo:inline>
3189
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='localityStack']">
3644
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3190
3645
  <xsl:for-each select="*[local-name()='locality']">
3191
3646
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3192
3647
  <xsl:apply-templates select="."/>
3193
3648
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3194
3649
  </xsl:for-each>
3195
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" match="*[local-name()='link']" name="link">
3650
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3196
3651
  <xsl:variable name="target">
3197
3652
  <xsl:choose>
3198
3653
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3222,4 +3677,275 @@
3222
3677
  </xsl:otherwise>
3223
3678
  </xsl:choose>
3224
3679
  </fo:inline>
3680
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3681
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3682
+ <!-- <xsl:choose>
3683
+ <xsl:when test="@lang = 'en'"></xsl:when>
3684
+ <xsl:otherwise> -->
3685
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3686
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3687
+ <!-- </xsl:otherwise>
3688
+ </xsl:choose> -->
3689
+ <xsl:apply-templates/>
3690
+ </fo:block>
3691
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3692
+ <fo:inline id="{@id}"/>
3693
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3694
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3695
+ <xsl:variable name="title-appendix">
3696
+ <xsl:call-template name="getTitle">
3697
+ <xsl:with-param name="name" select="'title-appendix'"/>
3698
+ </xsl:call-template>
3699
+ </xsl:variable>
3700
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3701
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3702
+ </fo:block>
3703
+ <xsl:apply-templates/>
3704
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3705
+ <fo:inline><xsl:apply-templates/></fo:inline>
3706
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3707
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3708
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3709
+ <xsl:variable name="title-example">
3710
+ <xsl:call-template name="getTitle">
3711
+ <xsl:with-param name="name" select="'title-example'"/>
3712
+ </xsl:call-template>
3713
+ </xsl:variable>
3714
+ <xsl:value-of select="$title-example"/>
3715
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3716
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3717
+ </xsl:if>
3718
+ <xsl:if test="*[local-name()='name']">
3719
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3720
+ </xsl:if>
3721
+ </fo:block>
3722
+ <xsl:apply-templates/>
3723
+ </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">
3724
+ <fo:inline><xsl:apply-templates/></fo:inline>
3725
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3726
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3727
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3728
+ <xsl:variable name="annotation-id" select="@id"/>
3729
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3730
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3731
+ <fo:inline>
3732
+ <xsl:apply-templates>
3733
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3734
+ </xsl:apply-templates>
3735
+ </fo:inline>
3736
+ </fo:block>
3737
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3738
+ <xsl:param name="callout"/>
3739
+ <fo:inline id="{@id}">
3740
+ <!-- for first p in annotation, put <x> -->
3741
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3742
+ <xsl:apply-templates/>
3743
+ </fo:inline>
3744
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3745
+ <xsl:variable name="title-modified">
3746
+ <xsl:call-template name="getTitle">
3747
+ <xsl:with-param name="name" select="'title-modified'"/>
3748
+ </xsl:call-template>
3749
+ </xsl:variable>
3750
+ <xsl:choose>
3751
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3752
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3753
+ </xsl:choose>
3754
+ <xsl:apply-templates/>
3755
+ </xsl:template><xsl:template name="convertDate">
3756
+ <xsl:param name="date"/>
3757
+ <xsl:param name="format" select="'short'"/>
3758
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3759
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3760
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3761
+ <xsl:variable name="monthStr">
3762
+ <xsl:choose>
3763
+ <xsl:when test="$month = '01'">January</xsl:when>
3764
+ <xsl:when test="$month = '02'">February</xsl:when>
3765
+ <xsl:when test="$month = '03'">March</xsl:when>
3766
+ <xsl:when test="$month = '04'">April</xsl:when>
3767
+ <xsl:when test="$month = '05'">May</xsl:when>
3768
+ <xsl:when test="$month = '06'">June</xsl:when>
3769
+ <xsl:when test="$month = '07'">July</xsl:when>
3770
+ <xsl:when test="$month = '08'">August</xsl:when>
3771
+ <xsl:when test="$month = '09'">September</xsl:when>
3772
+ <xsl:when test="$month = '10'">October</xsl:when>
3773
+ <xsl:when test="$month = '11'">November</xsl:when>
3774
+ <xsl:when test="$month = '12'">December</xsl:when>
3775
+ </xsl:choose>
3776
+ </xsl:variable>
3777
+ <xsl:variable name="result">
3778
+ <xsl:choose>
3779
+ <xsl:when test="$format = 'short' or $day = ''">
3780
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3781
+ </xsl:when>
3782
+ <xsl:otherwise>
3783
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3784
+ </xsl:otherwise>
3785
+ </xsl:choose>
3786
+ </xsl:variable>
3787
+ <xsl:value-of select="$result"/>
3788
+ </xsl:template><xsl:template name="insertKeywords">
3789
+ <xsl:param name="sorting" select="'true'"/>
3790
+ <xsl:param name="charAtEnd" select="'.'"/>
3791
+ <xsl:param name="charDelim" select="', '"/>
3792
+ <xsl:choose>
3793
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3794
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3795
+ <xsl:sort data-type="text" order="ascending"/>
3796
+ <xsl:call-template name="insertKeyword">
3797
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3798
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3799
+ </xsl:call-template>
3800
+ </xsl:for-each>
3801
+ </xsl:when>
3802
+ <xsl:otherwise>
3803
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3804
+ <xsl:call-template name="insertKeyword">
3805
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3806
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3807
+ </xsl:call-template>
3808
+ </xsl:for-each>
3809
+ </xsl:otherwise>
3810
+ </xsl:choose>
3811
+ </xsl:template><xsl:template name="insertKeyword">
3812
+ <xsl:param name="charAtEnd"/>
3813
+ <xsl:param name="charDelim"/>
3814
+ <xsl:apply-templates/>
3815
+ <xsl:choose>
3816
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3817
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3818
+ </xsl:choose>
3819
+ </xsl:template><xsl:template name="addPDFUAmeta">
3820
+ <fo:declarations>
3821
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3822
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3823
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3824
+ </pdf:dictionary>
3825
+ </pdf:catalog>
3826
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3827
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3828
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3829
+ <!-- Dublin Core properties go here -->
3830
+ <dc:title>
3831
+ <xsl:variable name="title">
3832
+
3833
+
3834
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3835
+
3836
+
3837
+
3838
+ </xsl:variable>
3839
+ <xsl:choose>
3840
+ <xsl:when test="normalize-space($title) != ''">
3841
+ <xsl:value-of select="$title"/>
3842
+ </xsl:when>
3843
+ <xsl:otherwise>
3844
+ <xsl:text> </xsl:text>
3845
+ </xsl:otherwise>
3846
+ </xsl:choose>
3847
+ </dc:title>
3848
+ <dc:creator>
3849
+
3850
+
3851
+ </dc:creator>
3852
+ <dc:description>
3853
+ <xsl:variable name="abstract">
3854
+
3855
+
3856
+
3857
+
3858
+ <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
3859
+
3860
+ </xsl:variable>
3861
+ <xsl:value-of select="normalize-space($abstract)"/>
3862
+ </dc:description>
3863
+ <pdf:Keywords>
3864
+ <xsl:call-template name="insertKeywords"/>
3865
+ </pdf:Keywords>
3866
+ </rdf:Description>
3867
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3868
+ <!-- XMP properties go here -->
3869
+ <xmp:CreatorTool/>
3870
+ </rdf:Description>
3871
+ </rdf:RDF>
3872
+ </x:xmpmeta>
3873
+ </fo:declarations>
3874
+ </xsl:template><xsl:template name="getId">
3875
+ <xsl:choose>
3876
+ <xsl:when test="../@id">
3877
+ <xsl:value-of select="../@id"/>
3878
+ </xsl:when>
3879
+ <xsl:otherwise>
3880
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3881
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3882
+ </xsl:otherwise>
3883
+ </xsl:choose>
3884
+ </xsl:template><xsl:template name="getLevel">
3885
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3886
+ <xsl:variable name="level">
3887
+ <xsl:choose>
3888
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3889
+ <xsl:value-of select="$level_total - 2"/>
3890
+ </xsl:when>
3891
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3892
+ <xsl:value-of select="$level_total - 2"/>
3893
+ </xsl:when>
3894
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3895
+ <xsl:value-of select="$level_total - 2"/>
3896
+ </xsl:when>
3897
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3898
+ <xsl:otherwise>
3899
+ <xsl:value-of select="$level_total - 1"/>
3900
+ </xsl:otherwise>
3901
+ </xsl:choose>
3902
+ </xsl:variable>
3903
+ <xsl:value-of select="$level"/>
3904
+ </xsl:template><xsl:template name="getSubSection">
3905
+ <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']"/>
3906
+ </xsl:template><xsl:template name="split">
3907
+ <xsl:param name="pText" select="."/>
3908
+ <xsl:param name="sep" select="','"/>
3909
+ <xsl:if test="string-length($pText) &gt;0">
3910
+ <item>
3911
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3912
+ </item>
3913
+ <xsl:call-template name="split">
3914
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3915
+ <xsl:with-param name="sep" select="$sep"/>
3916
+ </xsl:call-template>
3917
+ </xsl:if>
3918
+ </xsl:template><xsl:template name="getDocumentId">
3919
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3920
+ </xsl:template><xsl:template name="namespaceCheck">
3921
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
3922
+ <xsl:variable name="XSLNS">
3923
+
3924
+
3925
+
3926
+
3927
+
3928
+
3929
+ <xsl:value-of select="document('')//*/namespace::ogc"/>
3930
+
3931
+
3932
+
3933
+
3934
+
3935
+
3936
+
3937
+ </xsl:variable>
3938
+ <xsl:if test="$documentNS != $XSLNS">
3939
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
3940
+ </xsl:if>
3941
+ </xsl:template><xsl:template name="getLanguage">
3942
+ <xsl:param name="lang"/>
3943
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
3944
+ <xsl:choose>
3945
+ <xsl:when test="$language = 'en'">English</xsl:when>
3946
+ <xsl:when test="$language = 'fr'">French</xsl:when>
3947
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
3948
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
3949
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3950
+ </xsl:choose>
3225
3951
  </xsl:template></xsl:stylesheet>