metanorma-iso 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/iso/base.rb +26 -13
  6. data/lib/asciidoctor/iso/biblio.rng +36 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +20 -3
  8. data/lib/asciidoctor/iso/front.rb +16 -107
  9. data/lib/asciidoctor/iso/front_id.rb +196 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +450 -4
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  13. data/lib/asciidoctor/iso/macros.rb +21 -0
  14. data/lib/asciidoctor/iso/reqt.rng +23 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -25
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  21. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  22. data/lib/isodoc/iso/base_convert.rb +67 -99
  23. data/lib/isodoc/iso/html/header.html +10 -6
  24. data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
  25. data/lib/isodoc/iso/html/isodoc.scss +25 -0
  26. data/lib/isodoc/iso/html/scripts.html +18 -0
  27. data/lib/isodoc/iso/html/style-human.scss +23 -0
  28. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  29. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  30. data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
  31. data/lib/isodoc/iso/html/wordstyle.scss +45 -4
  32. data/lib/isodoc/iso/html_convert.rb +7 -0
  33. data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
  34. data/lib/isodoc/iso/iso.international-standard.xsl +1899 -796
  35. data/lib/isodoc/iso/metadata.rb +69 -23
  36. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  37. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  38. data/lib/isodoc/iso/sections.rb +66 -0
  39. data/lib/isodoc/iso/sts_convert.rb +31 -0
  40. data/lib/isodoc/iso/xref.rb +111 -0
  41. data/lib/metanorma-iso.rb +2 -0
  42. data/lib/metanorma/iso/processor.rb +23 -8
  43. data/lib/metanorma/iso/version.rb +1 -1
  44. data/metanorma-iso.gemspec +5 -2
  45. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  46. data/spec/asciidoctor-iso/base_spec.rb +31 -21
  47. data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
  48. data/spec/asciidoctor-iso/cleanup_spec.rb +15 -15
  49. data/spec/asciidoctor-iso/inline_spec.rb +1 -1
  50. data/spec/asciidoctor-iso/macros_spec.rb +289 -0
  51. data/spec/asciidoctor-iso/refs_spec.rb +5 -5
  52. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  53. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  54. data/spec/isodoc/amd_spec.rb +652 -0
  55. data/spec/isodoc/blocks_spec.rb +112 -27
  56. data/spec/isodoc/i18n_spec.rb +8 -8
  57. data/spec/isodoc/inline_spec.rb +4 -4
  58. data/spec/isodoc/iso_spec.rb +1 -1
  59. data/spec/isodoc/metadata_spec.rb +90 -4
  60. data/spec/isodoc/postproc_spec.rb +11 -116
  61. data/spec/isodoc/ref_spec.rb +9 -9
  62. data/spec/isodoc/section_spec.rb +33 -6
  63. data/spec/isodoc/table_spec.rb +29 -29
  64. data/spec/isodoc/terms_spec.rb +4 -4
  65. data/spec/isodoc/xref_spec.rb +34 -28
  66. data/spec/metanorma/processor_spec.rb +2 -2
  67. data/spec/spec_helper.rb +11 -0
  68. metadata +63 -12
  69. data/asciidoctor-iso.gemspec.old +0 -50
@@ -1,9 +1,14 @@
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:iso="https://www.metanorma.org/ns/iso" 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:iso="https://www.metanorma.org/ns/iso" 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 method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
+ <xsl:param name="svg_images"/>
6
+ <xsl:variable name="images" select="document($svg_images)"/>
7
+
5
8
 
6
9
 
10
+ <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
+
7
12
 
8
13
 
9
14
  <xsl:variable name="debug">false</xsl:variable>
@@ -15,85 +20,95 @@
15
20
  <xsl:variable name="lang-1st-letter_tmp" select="substring-before(substring-after(/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-with-lang'], '('), ')')"/>
16
21
  <xsl:variable name="lang-1st-letter" select="concat('(', $lang-1st-letter_tmp , ')')"/>
17
22
 
18
- <xsl:variable name="ISOname" select="concat(/iso:iso-standard/iso:bibdata/iso:docidentifier, ':', /iso:iso-standard/iso:bibdata/iso:copyright/iso:from , $lang-1st-letter)"/>
19
-
23
+ <!-- <xsl:variable name="ISOname" select="concat(/iso:iso-standard/iso:bibdata/iso:docidentifier, ':', /iso:iso-standard/iso:bibdata/iso:copyright/iso:from , $lang-1st-letter)"/> -->
24
+ <xsl:variable name="ISOname" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-reference']"/>
25
+
20
26
  <!-- Information and documentation — Codes for transcription systems -->
21
- <xsl:variable name="title-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'main']"/>
22
- <xsl:variable name="title-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'main']"/>
23
27
  <xsl:variable name="title-intro" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-intro']"/>
24
28
  <xsl:variable name="title-intro-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-intro']"/>
25
29
  <xsl:variable name="title-main" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-main']"/>
26
30
  <xsl:variable name="title-main-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-main']"/>
27
31
  <xsl:variable name="part" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@part"/>
28
- <xsl:variable name="title-part" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
29
- <xsl:variable name="title-part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
30
-
31
- <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
32
- <xsl:variable name="doctype_uppercased" select="translate(translate($doctype,'-',' '), $lower,$upper)"/>
33
32
 
33
+ <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
34
+ <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate($doctype,'-',' ')))"/>
35
+
34
36
  <xsl:variable name="stage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:stage)"/>
35
- <xsl:variable name="stage-abbrev" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
36
- <xsl:variable name="stage-fullname" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
37
37
  <xsl:variable name="substage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:substage)"/>
38
- <xsl:variable name="iteration" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:iteration)"/>
39
- <xsl:variable name="stage-name">
38
+ <xsl:variable name="stagename" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
39
+ <xsl:variable name="abbreviation" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
40
+
41
+ <xsl:variable name="stage-abbreviation">
40
42
  <xsl:choose>
41
- <xsl:when test="$stage-abbrev != ''">
42
- <xsl:value-of select="$stage-abbrev"/>
43
+ <xsl:when test="$abbreviation != ''">
44
+ <xsl:value-of select="$abbreviation"/>
43
45
  </xsl:when>
44
- <!-- and $substage = 0 -->
45
- <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP, PWI) -->
46
+ <xsl:when test="$stage = 0 and $substage = 0">PWI</xsl:when>
47
+ <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP) -->
46
48
  <xsl:when test="$stage = 10">AWI</xsl:when>
47
49
  <xsl:when test="$stage = 20">WD</xsl:when>
48
50
  <xsl:when test="$stage = 30">CD</xsl:when>
49
51
  <xsl:when test="$stage = 40">DIS</xsl:when>
50
52
  <xsl:when test="$stage = 50">FDIS</xsl:when>
51
- <xsl:when test="$stage = 60 and $substage = 0">IS</xsl:when>
53
+ <xsl:when test="$stage = 60 and $substage = 0">PRF</xsl:when>
54
+ <xsl:when test="$stage = 60 and $substage = 60">IS</xsl:when>
52
55
  <xsl:when test="$stage &gt;=60">published</xsl:when>
53
56
  <xsl:otherwise/>
54
57
  </xsl:choose>
55
58
  </xsl:variable>
59
+
60
+ <xsl:variable name="stage-fullname-uppercased">
61
+ <xsl:choose>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
64
+ </xsl:when>
65
+ <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
66
+ <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
67
+ <xsl:when test="$stage-abbreviation = 'AWI'">APPROVED WORK ITEM</xsl:when>
68
+ <xsl:when test="$stage-abbreviation = 'WD'">WORKING DRAFT</xsl:when>
69
+ <xsl:when test="$stage-abbreviation = 'CD'">COMMITTEE DRAFT</xsl:when>
70
+ <xsl:when test="$stage-abbreviation = 'DIS'">DRAFT INTERNATIONAL STANDARD</xsl:when>
71
+ <xsl:when test="$stage-abbreviation = 'FDIS'">FINAL DRAFT INTERNATIONAL STANDARD</xsl:when>
72
+ <xsl:otherwise><xsl:value-of select="$doctype_uppercased"/></xsl:otherwise>
73
+ </xsl:choose>
74
+ </xsl:variable>
56
75
 
57
- <!-- UPPERCASED stage name -->
58
- <xsl:variable name="stage-name-uppercased">
59
- <xsl:if test="$stage-fullname != '' and $stage-abbrev != ''">
60
- <item name="{$stage-abbrev}">
61
- <xsl:if test="$stage-abbrev = 'NWIP'">
62
- <xsl:attribute name="show">true</xsl:attribute>
63
- <xsl:attribute name="header">PRELIMINARY WORK ITEM</xsl:attribute>
64
- </xsl:if>
65
- <xsl:if test="$stage-abbrev = 'AWI'">
66
- <xsl:attribute name="show">true</xsl:attribute>
67
- <xsl:attribute name="header">APPROVED WORK ITEM</xsl:attribute>
68
- </xsl:if>
69
- <xsl:if test="$stage-abbrev = 'WD'">
70
- <xsl:attribute name="show">true</xsl:attribute>
71
- <xsl:attribute name="header">WORKING DRAFT</xsl:attribute>
72
- </xsl:if>
73
- <xsl:if test="$stage-abbrev = 'CD'">
74
- <xsl:attribute name="show">true</xsl:attribute>
75
- <xsl:attribute name="header">COMMITTEE DRAFT</xsl:attribute>
76
- </xsl:if>
77
- <xsl:if test="$stage-abbrev = 'DIS'">
78
- <xsl:attribute name="show">true</xsl:attribute>
79
- <xsl:attribute name="header">DRAFT INTERNATIONAL STANDARD</xsl:attribute>
80
- </xsl:if>
81
- <xsl:if test="$stage-abbrev = 'FDIS'">
82
- <xsl:attribute name="show">true</xsl:attribute>
83
- <xsl:attribute name="header">FINAL DRAFT INTERNATIONAL STANDARD</xsl:attribute>
84
- </xsl:if>
85
- <xsl:value-of select="translate($stage-fullname, $lower, $upper)"/>
86
- </item>
87
- </xsl:if>
88
- <item name="NWIP" show="true" header="PRELIMINARY WORK ITEM">NEW WORK ITEM PROPOSAL DRAFT</item>
89
- <item name="AWI" show="true" header="APPROVED WORK ITEM">APPROVED WORK ITEM</item>
90
- <item name="WD" show="true" header="WORKING DRAFT">WORKING DRAFT</item>
91
- <item name="CD" show="true" header="COMMITTEE DRAFT">COMMITTEE DRAFT</item>
92
- <item name="DIS" show="true" header="DRAFT INTERNATIONAL STANDARD">DRAFT</item>
93
- <item name="FDIS" show="true" header="FINAL DRAFT INTERNATIONAL STANDARD">FINAL DRAFT</item>
94
- <item name="IS">PROOF</item>
76
+ <xsl:variable name="stagename-header-firstpage">
77
+ <xsl:choose>
78
+ <!-- <xsl:when test="$stage-abbreviation = 'PWI' or
79
+ $stage-abbreviation = 'NWIP' or
80
+ $stage-abbreviation = 'NP'">PRELIMINARY WORK ITEM</xsl:when> -->
81
+ <xsl:when test="$stage-abbreviation = 'PRF'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
82
+ <xsl:otherwise>
83
+ <xsl:value-of select="$stage-fullname-uppercased"/>
84
+ </xsl:otherwise>
85
+ </xsl:choose>
86
+ </xsl:variable>
87
+
88
+ <xsl:variable name="stagename-header-coverpage">
89
+ <xsl:choose>
90
+ <xsl:when test="$stage-abbreviation = 'DIS'">DRAFT</xsl:when>
91
+ <xsl:when test="$stage-abbreviation = 'FDIS'">FINAL DRAFT</xsl:when>
92
+ <xsl:when test="$stage-abbreviation = 'PRF'"/>
93
+ <xsl:when test="$stage-abbreviation = 'IS'"/>
94
+ <xsl:otherwise>
95
+ <xsl:value-of select="$stage-fullname-uppercased"/>
96
+ </xsl:otherwise>
97
+ </xsl:choose>
95
98
  </xsl:variable>
96
99
 
100
+ <!-- UPPERCASED stage name -->
101
+ <!-- <item name="NWIP" show="true" header="PRELIMINARY WORK ITEM" shortname="NEW WORK ITEM PROPOSAL">NEW WORK ITEM PROPOSAL</item>
102
+ <item name="PWI" show="true" header="PRELIMINARY WORK ITEM" shortname="PRELIMINARY WORK ITEM">PRELIMINARY WORK ITEM</item>
103
+ <item name="NP" show="true" header="PRELIMINARY WORK ITEM" shortname="NEW WORK ITEM PROPOSAL">NEW WORK ITEM PROPOSAL</item>
104
+ <item name="AWI" show="true" header="APPROVED WORK ITEM" shortname="APPROVED WORK ITEM">APPROVED WORK ITEM</item>
105
+ <item name="WD" show="true" header="WORKING DRAFT" shortname="WORKING DRAFT">WORKING DRAFT</item>
106
+ <item name="CD" show="true" header="COMMITTEE DRAFT" shortname="COMMITTEE DRAFT">COMMITTEE DRAFT</item>
107
+ <item name="DIS" show="true" header="DRAFT INTERNATIONAL STANDARD" shortname="DRAFT">DRAFT INTERNATIONAL STANDARD</item>
108
+ <item name="FDIS" show="true" header="FINAL DRAFT INTERNATIONAL STANDARD" shortname="FINAL DRAFT">FINAL DRAFT INTERNATIONAL STANDARD</item>
109
+ <item name="PRF">PROOF</item> -->
110
+
111
+
97
112
  <!--
98
113
  <status>
99
114
  <stage>30</stage>
@@ -106,24 +121,27 @@
106
121
  <xsl:choose>
107
122
  <xsl:when test="string($stage) = 'NaN'">false</xsl:when>
108
123
  <xsl:when test="$stage &gt;=60">true</xsl:when>
109
- <xsl:when test="normalize-space($stage-name) != ''">true</xsl:when>
124
+ <xsl:when test="normalize-space($stage-abbreviation) != ''">true</xsl:when>
110
125
  <xsl:otherwise>false</xsl:otherwise>
111
126
  </xsl:choose>
112
127
  </xsl:variable>
113
128
 
114
129
  <xsl:variable name="document-master-reference">
115
130
  <xsl:choose>
116
- <xsl:when test="$stage-name != ''">-publishedISO</xsl:when>
131
+ <xsl:when test="$stage-abbreviation != ''">-publishedISO</xsl:when>
117
132
  <xsl:otherwise/>
118
133
  </xsl:choose>
119
134
  </xsl:variable>
120
-
121
- <xsl:variable name="proof-text">PROOF/ÉPREUVE</xsl:variable>
122
135
 
123
- <xsl:variable name="title-figure">
124
- <xsl:text>Figure </xsl:text>
136
+ <xsl:variable name="force-page-count-preface">
137
+ <xsl:choose>
138
+ <xsl:when test="$document-master-reference != ''">end-on-even</xsl:when>
139
+ <xsl:otherwise>no-force</xsl:otherwise>
140
+ </xsl:choose>
125
141
  </xsl:variable>
126
142
 
143
+ <xsl:variable name="proof-text">PROOF/ÉPREUVE</xsl:variable>
144
+
127
145
  <!-- Example:
128
146
  <item level="1" id="Foreword" display="true">Foreword</item>
129
147
  <item id="term-script" display="false">3.2</item>
@@ -256,12 +274,22 @@
256
274
  <fo:region-start region-name="left-region" extent="12.5mm"/>
257
275
  <fo:region-end region-name="right-region" extent="25mm"/>
258
276
  </fo:simple-page-master>
277
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
278
+ <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
279
+ <fo:region-before region-name="header" extent="27.4mm"/>
280
+ <fo:region-after region-name="footer" extent="13mm"/>
281
+ <fo:region-start region-name="left" extent="12.5mm"/>
282
+ <fo:region-end region-name="right" extent="25mm"/>
283
+ </fo:simple-page-master>
259
284
  <fo:page-sequence-master master-name="preface-publishedISO">
260
285
  <fo:repeatable-page-master-alternatives>
286
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
261
287
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-publishedISO"/>
262
288
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-publishedISO"/>
263
289
  </fo:repeatable-page-master-alternatives>
264
290
  </fo:page-sequence-master>
291
+
292
+
265
293
  <fo:page-sequence-master master-name="document-publishedISO">
266
294
  <fo:repeatable-page-master-alternatives>
267
295
  <fo:conditional-page-master-reference master-reference="first-publishedISO" page-position="first"/>
@@ -280,37 +308,11 @@
280
308
 
281
309
  </fo:layout-master-set>
282
310
 
283
- <fo:declarations>
284
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
285
- <pdf:dictionary type="normal" key="ViewerPreferences">
286
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
287
- </pdf:dictionary>
288
- </pdf:catalog>
289
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
290
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
291
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
292
- <!-- Dublin Core properties go here -->
293
- <dc:title><xsl:value-of select="$title-en"/></dc:title>
294
- <dc:creator><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:contributor[iso:role/@type='author']/iso:organization/iso:name"/></dc:creator>
295
- <dc:description>
296
- <xsl:variable name="abstract">
297
- <xsl:copy-of select="/iso:iso-standard/iso:bibliography/iso:references/iso:bibitem/iso:abstract//text()"/>
298
- </xsl:variable>
299
- <xsl:value-of select="normalize-space($abstract)"/>
300
- </dc:description>
301
- <pdf:Keywords/>
302
- </rdf:Description>
303
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
304
- <!-- XMP properties go here -->
305
- <xmp:CreatorTool/>
306
- </rdf:Description>
307
- </rdf:RDF>
308
- </x:xmpmeta>
309
- </fo:declarations>
311
+ <xsl:call-template name="addPDFUAmeta"/>
310
312
 
311
313
  <!-- cover page -->
312
314
  <xsl:choose>
313
- <xsl:when test="$stage-name != ''">
315
+ <xsl:when test="$stage-abbreviation != ''">
314
316
  <fo:page-sequence master-reference="cover-page-publishedISO" force-page-count="no-force">
315
317
  <fo:static-content flow-name="cover-page-footer" font-size="10pt">
316
318
  <fo:table table-layout="fixed" width="100%">
@@ -322,12 +324,12 @@
322
324
  <fo:table-cell font-size="6.5pt" text-align="justify" display-align="after" padding-bottom="8mm"><!-- before -->
323
325
  <!-- margin-top="-30mm" -->
324
326
  <fo:block margin-top="-100mm">
325
- <xsl:if test="$stage-name = 'DIS' or $stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD'">
327
+ <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
326
328
  <fo:block margin-bottom="1.5mm">
327
329
  <xsl:text>THIS DOCUMENT IS A DRAFT CIRCULATED FOR COMMENT AND APPROVAL. IT IS THEREFORE SUBJECT TO CHANGE AND MAY NOT BE REFERRED TO AS AN INTERNATIONAL STANDARD UNTIL PUBLISHED AS SUCH.</xsl:text>
328
330
  </fo:block>
329
331
  </xsl:if>
330
- <xsl:if test="$stage-name = 'FDIS' or $stage-name = 'DIS' or $stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD'">
332
+ <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
331
333
  <fo:block margin-bottom="1.5mm">
332
334
  <xsl:text>RECIPIENTS OF THIS DRAFT ARE INVITED TO
333
335
  SUBMIT, WITH THEIR COMMENTS, NOTIFICATION
@@ -352,7 +354,7 @@
352
354
  <fo:block> </fo:block>
353
355
  </fo:table-cell>
354
356
  <fo:table-cell>
355
- <xsl:if test="$stage-name = 'DIS'">
357
+ <xsl:if test="$stage-abbreviation = 'DIS'">
356
358
  <fo:block-container margin-top="-15mm" margin-bottom="7mm" margin-left="1mm">
357
359
  <fo:block font-size="9pt" border="0.5pt solid black" fox:border-radius="5pt" padding-left="2mm" padding-top="2mm" padding-bottom="2mm">
358
360
  <xsl:text>This document is circulated as received from the committee secretariat.</xsl:text>
@@ -387,7 +389,9 @@
387
389
  <fo:table-cell display-align="center">
388
390
  <fo:block text-align="right">
389
391
  <fo:block>Reference number</fo:block>
390
- <fo:block><xsl:value-of select="$ISOname"/></fo:block>
392
+ <fo:block>
393
+ <xsl:value-of select="$ISOname"/>
394
+ </fo:block>
391
395
  <fo:block> </fo:block>
392
396
  <fo:block> </fo:block>
393
397
  <fo:block><fo:inline font-size="9pt">©</fo:inline><xsl:value-of select="concat(' ISO ', iso:iso-standard/iso:bibdata/iso:copyright/iso:from)"/></fo:block>
@@ -404,13 +408,12 @@
404
408
  </fo:static-content>
405
409
 
406
410
  <xsl:choose>
407
- <xsl:when test="$stage-name = 'DIS'">
411
+ <!-- COVER PAGE for DIS document only -->
412
+ <xsl:when test="$stage-abbreviation = 'DIS'">
408
413
  <fo:flow flow-name="xsl-region-body">
409
414
  <fo:block-container>
410
415
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
411
- <xsl:value-of select="xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()"/>
412
- <xsl:text> </xsl:text>
413
- <xsl:value-of select="$doctype_uppercased"/>
416
+ <xsl:value-of select="$stage-fullname-uppercased"/>
414
417
  </fo:block>
415
418
  <fo:block font-size="20pt" font-weight="bold" text-align="right">
416
419
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso']"/>
@@ -450,10 +453,24 @@
450
453
  <fo:block> </fo:block>
451
454
  </fo:table-cell>
452
455
  <fo:table-cell>
453
- <fo:block><fo:inline font-weight="bold">2018</fo:inline>-xx-xx</fo:block>
456
+ <fo:block font-weight="bold">
457
+ <xsl:choose>
458
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
459
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on"/>
460
+ </xsl:when>
461
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
462
+ </xsl:choose>
463
+ </fo:block>
454
464
  </fo:table-cell>
455
465
  <fo:table-cell>
456
- <fo:block><fo:inline font-weight="bold">2018</fo:inline>-xx-xx</fo:block>
466
+ <fo:block font-weight="bold">
467
+ <xsl:choose>
468
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
469
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on"/>
470
+ </xsl:when>
471
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
472
+ </xsl:choose>
473
+ </fo:block>
457
474
  </fo:table-cell>
458
475
  </fo:table-row>
459
476
  </fo:table-body>
@@ -468,8 +485,10 @@
468
485
  </xsl:if>
469
486
 
470
487
  <xsl:value-of select="$title-main"/>
488
+
489
+ <xsl:call-template name="printTitlePartEn"/>
471
490
 
472
- <xsl:if test="normalize-space($title-part) != ''">
491
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
473
492
  <xsl:if test="$part != ''">
474
493
  <xsl:text> — </xsl:text>
475
494
  <fo:block font-weight="normal" margin-top="6pt">
@@ -478,7 +497,7 @@
478
497
  </fo:block>
479
498
  </xsl:if>
480
499
  <xsl:value-of select="$title-part"/>
481
- </xsl:if>
500
+ </xsl:if> -->
482
501
  </fo:block>
483
502
 
484
503
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -490,19 +509,18 @@
490
509
  </xsl:if>
491
510
 
492
511
  <xsl:value-of select="$title-main-fr"/>
512
+
513
+ <xsl:call-template name="printTitlePartFr"/>
493
514
 
494
- <xsl:if test="normalize-space($title-part-fr) != ''">
495
- <xsl:if test="$part != ''">
496
- <xsl:text> — </xsl:text>
497
- <xsl:text>Partie </xsl:text>
498
- <xsl:value-of select="$part"/>
499
- <xsl:text>:</xsl:text>
500
- </xsl:if>
501
- <xsl:value-of select="$title-part-fr"/>
502
- </xsl:if>
503
515
  </fo:block>
504
516
  </fo:block>
505
- <fo:block margin-top="10mm">ICS: xx.xxx.xx; xx.xxx.xx</fo:block>
517
+ <fo:block margin-top="10mm">
518
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
519
+ <xsl:if test="position() = 1"><fo:inline>ICS: </fo:inline></xsl:if>
520
+ <xsl:value-of select="."/>
521
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
522
+ </xsl:for-each>
523
+ </fo:block>
506
524
  </fo:block-container>
507
525
 
508
526
 
@@ -512,6 +530,7 @@
512
530
  </xsl:when>
513
531
  <xsl:otherwise>
514
532
 
533
+ <!-- COVER PAGE for all documents except DIS -->
515
534
  <fo:flow flow-name="xsl-region-body">
516
535
  <fo:block-container>
517
536
  <fo:table table-layout="fixed" width="100%" font-size="24pt" line-height="1"> <!-- margin-bottom="35mm" -->
@@ -522,9 +541,13 @@
522
541
  <fo:table-row>
523
542
  <fo:table-cell>
524
543
  <fo:block font-size="18pt">
525
- <xsl:variable name="stgname" select="xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/text()"/>
526
- <xsl:value-of select="translate($stgname, ' ', $linebreak)"/>
527
- <xsl:if test="number($iteration) = $iteration and ($stage-name = 'NWIP' or $stage-name = 'AWI' or $stage-name = 'WD' or $stage-name = 'CD')"> <!-- not NaN -->
544
+
545
+ <xsl:value-of select="translate($stagename-header-coverpage, ' ', $linebreak)"/>
546
+
547
+ <!-- if there is iteration number, then print it -->
548
+ <xsl:variable name="iteration" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:iteration)"/>
549
+
550
+ <xsl:if test="number($iteration) = $iteration and ($stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD')">
528
551
  <xsl:text> </xsl:text><xsl:value-of select="$iteration"/>
529
552
  </xsl:if>
530
553
  <!-- <xsl:if test="$stage-name = 'draft'">DRAFT</xsl:if>
@@ -545,20 +568,19 @@
545
568
  <fo:table-row height="42mm">
546
569
  <fo:table-cell number-columns-spanned="3" font-size="10pt" line-height="1.2">
547
570
  <fo:block text-align="right">
548
- <xsl:variable name="edition" select="/iso:iso-standard/iso:bibdata/iso:edition"/>
549
- <xsl:if test="$stage-name = 'IS' or $stage-name = 'published'">
550
- <xsl:choose>
551
- <xsl:when test="$edition = 1">First</xsl:when>
552
- <xsl:when test="$edition = 2">Second</xsl:when>
553
- <xsl:when test="$edition = 3">Third</xsl:when>
554
- <xsl:otherwise><xsl:value-of select="$edition"/></xsl:otherwise>
555
- </xsl:choose>
556
- <xsl:text> edition</xsl:text>
557
- </xsl:if>
558
- <xsl:if test="$stage-name = 'published'">
559
- <xsl:value-of select="$linebreak"/>
560
- <xsl:value-of select="substring(/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date,1, 7)"/>
571
+ <xsl:if test="$stage-abbreviation = 'PRF' or $stage-abbreviation = 'IS' or $stage-abbreviation = 'published'">
572
+ <xsl:call-template name="printEdition"/>
561
573
  </xsl:if>
574
+ <xsl:choose>
575
+ <xsl:when test="$stage-abbreviation = 'IS'">
576
+ <xsl:value-of select="$linebreak"/>
577
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'published']"/>
578
+ </xsl:when>
579
+ <xsl:when test="$stage-abbreviation = 'published'">
580
+ <xsl:value-of select="$linebreak"/>
581
+ <xsl:value-of select="substring(/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date,1, 7)"/>
582
+ </xsl:when>
583
+ </xsl:choose>
562
584
  <!-- <xsl:value-of select="$linebreak"/>
563
585
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
564
586
  </fo:block>
@@ -576,16 +598,30 @@
576
598
  <fo:table-row> <!-- border="1pt solid black" height="150mm" -->
577
599
  <fo:table-cell font-size="11pt">
578
600
  <fo:block>
579
- <xsl:if test="$stage-name = 'FDIS'">
601
+ <xsl:if test="$stage-abbreviation = 'FDIS'">
580
602
  <fo:block-container border="0.5mm solid black" width="51mm">
581
603
  <fo:block margin="2mm">
582
604
  <fo:block margin-bottom="8pt">ISO/TC <fo:inline font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee/@number"/></fo:inline></fo:block>
583
605
  <fo:block margin-bottom="6pt">Secretariat: <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/></fo:block>
584
606
  <fo:block margin-bottom="6pt">Voting begins on:<xsl:value-of select="$linebreak"/>
585
- <fo:inline font-weight="bold">2018</fo:inline>-xx-xx
607
+ <fo:inline font-weight="bold">
608
+ <xsl:choose>
609
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on">
610
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-started']/iso:on"/>
611
+ </xsl:when>
612
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
613
+ </xsl:choose>
614
+ </fo:inline>
586
615
  </fo:block>
587
616
  <fo:block>Voting terminates on:<xsl:value-of select="$linebreak"/>
588
- <fo:inline font-weight="bold">2018</fo:inline>-xx-xx
617
+ <fo:inline font-weight="bold">
618
+ <xsl:choose>
619
+ <xsl:when test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on">
620
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'vote-ended']/iso:on"/>
621
+ </xsl:when>
622
+ <xsl:otherwise>YYYY-MM-DD</xsl:otherwise>
623
+ </xsl:choose>
624
+ </fo:inline>
589
625
  </fo:block>
590
626
  </fo:block>
591
627
  </fo:block-container>
@@ -607,7 +643,8 @@
607
643
 
608
644
  <xsl:value-of select="$title-main"/>
609
645
 
610
- <xsl:if test="normalize-space($title-part) != ''">
646
+ <xsl:call-template name="printTitlePartEn"/>
647
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
611
648
  <xsl:if test="$part != ''">
612
649
  <xsl:text> — </xsl:text>
613
650
  <fo:block font-weight="normal" margin-top="6pt">
@@ -616,7 +653,7 @@
616
653
  </fo:block>
617
654
  </xsl:if>
618
655
  <xsl:value-of select="$title-part"/>
619
- </xsl:if>
656
+ </xsl:if> -->
620
657
  </fo:block>
621
658
 
622
659
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -629,15 +666,8 @@
629
666
 
630
667
  <xsl:value-of select="$title-main-fr"/>
631
668
 
632
- <xsl:if test="normalize-space($title-part-fr) != ''">
633
- <xsl:if test="$part != ''">
634
- <xsl:text> — </xsl:text>
635
- <xsl:text>Partie </xsl:text>
636
- <xsl:value-of select="$part"/>
637
- <xsl:text>:</xsl:text>
638
- </xsl:if>
639
- <xsl:value-of select="$title-part-fr"/>
640
- </xsl:if>
669
+ <xsl:call-template name="printTitlePartFr"/>
670
+
641
671
  </fo:block>
642
672
  </fo:block>
643
673
  </fo:block-container>
@@ -648,7 +678,7 @@
648
678
  </fo:block-container>
649
679
  <fo:block-container position="absolute" left="60mm" top="222mm" height="25mm" display-align="after">
650
680
  <fo:block>
651
- <xsl:if test="$stage-name = 'IS'">
681
+ <xsl:if test="$stage-abbreviation = 'PRF'">
652
682
  <fo:block font-size="39pt" font-weight="bold"><xsl:value-of select="$proof-text"/></fo:block>
653
683
  </xsl:if>
654
684
  </fo:block>
@@ -708,14 +738,7 @@
708
738
  <fo:table-row>
709
739
  <fo:table-cell number-columns-spanned="2" font-size="10pt" line-height="1.2">
710
740
  <fo:block text-align="right">
711
- <xsl:variable name="edition" select="/iso:iso-standard/iso:bibdata/iso:edition"/>
712
- <xsl:choose>
713
- <xsl:when test="$edition = 1">First</xsl:when>
714
- <xsl:when test="$edition = 2">Second</xsl:when>
715
- <xsl:when test="$edition = 3">Third</xsl:when>
716
- <xsl:otherwise><xsl:value-of select="$edition"/></xsl:otherwise>
717
- </xsl:choose>
718
- <xsl:text> edition</xsl:text>
741
+ <xsl:call-template name="printEdition"/>
719
742
  <xsl:value-of select="$linebreak"/>
720
743
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/></fo:block>
721
744
  </fo:table-cell>
@@ -734,7 +757,8 @@
734
757
 
735
758
  <xsl:value-of select="$title-main"/>
736
759
 
737
- <xsl:if test="normalize-space($title-part) != ''">
760
+ <xsl:call-template name="printTitlePartEn"/>
761
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
738
762
  <xsl:if test="$part != ''">
739
763
  <xsl:text> — </xsl:text>
740
764
  <fo:block font-weight="normal" margin-top="6pt">
@@ -743,7 +767,7 @@
743
767
  </fo:block>
744
768
  </xsl:if>
745
769
  <xsl:value-of select="$title-part"/>
746
- </xsl:if>
770
+ </xsl:if> -->
747
771
  </fo:block>
748
772
 
749
773
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -756,15 +780,8 @@
756
780
 
757
781
  <xsl:value-of select="$title-main-fr"/>
758
782
 
759
- <xsl:if test="normalize-space($title-part-fr) != ''">
760
- <xsl:if test="$part != ''">
761
- <xsl:text> — </xsl:text>
762
- <xsl:text>Partie </xsl:text>
763
- <xsl:value-of select="$part"/>
764
- <xsl:text>:</xsl:text>
765
- </xsl:if>
766
- <xsl:value-of select="$title-part-fr"/>
767
- </xsl:if>
783
+ <xsl:call-template name="printTitlePartFr"/>
784
+
768
785
  </fo:block>
769
786
  </fo:block>
770
787
  </fo:block-container>
@@ -835,12 +852,8 @@
835
852
 
836
853
  <fo:block margin-bottom="100pt">
837
854
  <xsl:text>Secretariat: </xsl:text>
838
- <xsl:choose>
839
- <xsl:when test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat">
840
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/>
841
- </xsl:when>
842
- <xsl:otherwise>XXXX</xsl:otherwise>
843
- </xsl:choose>
855
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:secretariat"/>
856
+ <xsl:text> </xsl:text>
844
857
  </fo:block>
845
858
 
846
859
 
@@ -857,7 +870,8 @@
857
870
 
858
871
  <xsl:value-of select="$title-main"/>
859
872
 
860
- <xsl:if test="normalize-space($title-part) != ''">
873
+ <xsl:call-template name="printTitlePartEn"/>
874
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
861
875
  <xsl:if test="$part != ''">
862
876
  <xsl:text> — </xsl:text>
863
877
  <fo:block font-weight="normal" margin-top="6pt">
@@ -866,7 +880,7 @@
866
880
  </fo:block>
867
881
  </xsl:if>
868
882
  <xsl:value-of select="$title-part"/>
869
- </xsl:if>
883
+ </xsl:if> -->
870
884
  </fo:block>
871
885
 
872
886
  <fo:block font-size="12pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -878,15 +892,17 @@
878
892
 
879
893
  <xsl:value-of select="$title-main-fr"/>
880
894
 
881
- <xsl:if test="normalize-space($title-part-fr) != ''">
895
+ <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
896
+ <xsl:if test="normalize-space($part-fr) != ''">
882
897
  <xsl:if test="$part != ''">
883
898
  <xsl:text> — </xsl:text>
884
899
  <fo:block margin-top="6pt" font-weight="normal">
885
- <xsl:text>Partie </xsl:text><xsl:value-of select="$part"/>
886
- <xsl:text>:</xsl:text>
900
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
901
+ <!-- <xsl:value-of select="$title-part-fr"/><xsl:value-of select="$part"/>
902
+ <xsl:text>:</xsl:text> -->
887
903
  </fo:block>
888
904
  </xsl:if>
889
- <xsl:value-of select="$title-part-fr"/>
905
+ <xsl:value-of select="$part-fr"/>
890
906
  </xsl:if>
891
907
  </fo:block>
892
908
  </fo:block-container>
@@ -909,7 +925,7 @@
909
925
  </xsl:otherwise>
910
926
  </xsl:choose>
911
927
 
912
- <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="no-force">
928
+ <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
913
929
  <xsl:call-template name="insertHeaderFooter">
914
930
  <xsl:with-param name="font-weight">normal</xsl:with-param>
915
931
  </xsl:call-template>
@@ -926,78 +942,101 @@
926
942
  <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
927
943
  </fo:block>
928
944
  </fo:block>
929
- </fo:block-container>
930
- <fo:block break-after="page"/>
945
+ </fo:block-container>
931
946
  </xsl:if>
932
947
 
933
- <fo:block-container font-weight="bold">
934
-
935
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
936
- <fo:inline font-size="16pt" font-weight="bold">Contents</fo:inline>
937
- <fo:inline keep-together.within-line="always">
938
- <fo:leader leader-pattern="space"/>
939
- <fo:inline font-weight="normal" font-size="10pt">Page</fo:inline>
940
- </fo:inline>
941
- </fo:block>
942
-
943
- <xsl:if test="$debug = 'true'">
944
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
945
- DEBUG
946
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
947
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
948
- </xsl:if>
948
+
949
+ <xsl:choose>
950
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
949
951
 
950
- <xsl:variable name="margin-left">12</xsl:variable>
951
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
952
-
953
- <fo:block>
954
- <xsl:if test="@level = 1">
955
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
952
+ <xsl:otherwise>
953
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
954
+ <fo:block break-after="page"/>
955
+ </xsl:if>
956
+ <fo:block-container font-weight="bold">
957
+
958
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
959
+ <xsl:variable name="title-toc">
960
+ <xsl:call-template name="getTitle">
961
+ <xsl:with-param name="name" select="'title-toc'"/>
962
+ </xsl:call-template>
963
+ </xsl:variable>
964
+ <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
965
+ <fo:inline keep-together.within-line="always">
966
+ <fo:leader leader-pattern="space"/>
967
+ <xsl:variable name="title-page">
968
+ <xsl:call-template name="getTitle">
969
+ <xsl:with-param name="name" select="'title-page'"/>
970
+ </xsl:call-template>
971
+ </xsl:variable>
972
+ <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
973
+ </fo:inline>
974
+ </fo:block>
975
+
976
+ <xsl:if test="$debug = 'true'">
977
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
978
+ DEBUG
979
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
980
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
956
981
  </xsl:if>
957
- <fo:list-block>
958
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
959
- <xsl:if test="@level &gt;= 2">
960
- <xsl:attribute name="font-weight">normal</xsl:attribute>
961
- </xsl:if>
962
- <xsl:attribute name="provisional-distance-between-starts">
963
- <xsl:choose>
964
- <!-- skip 0 section without subsections -->
965
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
966
- <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
967
- <xsl:otherwise>0mm</xsl:otherwise>
968
- </xsl:choose>
969
- </xsl:attribute>
970
- <fo:list-item>
971
- <fo:list-item-label end-indent="label-end()">
972
- <fo:block>
973
- <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
974
- <xsl:value-of select="@section"/>
975
- </xsl:if>
976
- </fo:block>
977
- </fo:list-item-label>
978
- <fo:list-item-body start-indent="body-start()">
979
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
980
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
981
- <xsl:if test="@section and @display-section = 'false'">
982
- <xsl:value-of select="@section"/><xsl:text> </xsl:text>
983
- </xsl:if>
984
- <xsl:if test="@addon != ''">
985
- <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
982
+
983
+ <xsl:variable name="margin-left">12</xsl:variable>
984
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
985
+
986
+ <fo:block>
987
+ <xsl:if test="@level = 1">
988
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
989
+ </xsl:if>
990
+ <xsl:if test="@level = 3">
991
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
992
+ </xsl:if>
993
+ <fo:list-block>
994
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
995
+ <xsl:if test="@level &gt;= 2">
996
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
997
+ </xsl:if>
998
+ <xsl:attribute name="provisional-distance-between-starts">
999
+ <xsl:choose>
1000
+ <!-- skip 0 section without subsections -->
1001
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1002
+ <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1003
+ <xsl:otherwise>0mm</xsl:otherwise>
1004
+ </xsl:choose>
1005
+ </xsl:attribute>
1006
+ <fo:list-item>
1007
+ <fo:list-item-label end-indent="label-end()">
1008
+ <fo:block>
1009
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
1010
+ <xsl:value-of select="@section"/>
986
1011
  </xsl:if>
987
- <xsl:text> </xsl:text><xsl:value-of select="text()"/>
988
- <fo:inline keep-together.within-line="always">
989
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
990
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
991
- </fo:inline>
992
- </fo:basic-link>
993
- </fo:block>
994
- </fo:list-item-body>
995
- </fo:list-item>
996
- </fo:list-block>
997
- </fo:block>
998
-
999
- </xsl:for-each>
1000
- </fo:block-container>
1012
+ </fo:block>
1013
+ </fo:list-item-label>
1014
+ <fo:list-item-body start-indent="body-start()">
1015
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1016
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1017
+ <xsl:if test="@section and @display-section = 'false'">
1018
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
1019
+ </xsl:if>
1020
+ <xsl:if test="@addon != ''">
1021
+ <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
1022
+ </xsl:if>
1023
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
1024
+ <fo:inline keep-together.within-line="always">
1025
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1026
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1027
+ </fo:inline>
1028
+ </fo:basic-link>
1029
+ </fo:block>
1030
+ </fo:list-item-body>
1031
+ </fo:list-item>
1032
+ </fo:list-block>
1033
+ </fo:block>
1034
+
1035
+ </xsl:for-each>
1036
+ </fo:block-container>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
1039
+
1001
1040
  <!-- Foreword, Introduction -->
1002
1041
  <xsl:apply-templates select="/iso:iso-standard/iso:preface/node()"/>
1003
1042
 
@@ -1021,7 +1060,8 @@
1021
1060
  <xsl:value-of select="$title-en"/>
1022
1061
  </fo:block>
1023
1062
  -->
1024
- <fo:block font-size="18pt" font-weight="bold" margin-top="12pt" margin-bottom="18pt">
1063
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1064
+ <xsl:variable name="part-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
1025
1065
  <fo:block>
1026
1066
  <xsl:if test="normalize-space($title-intro) != ''">
1027
1067
  <xsl:value-of select="$title-intro"/>
@@ -1030,22 +1070,42 @@
1030
1070
 
1031
1071
  <xsl:value-of select="$title-main"/>
1032
1072
 
1033
- <xsl:if test="normalize-space($title-part) != ''">
1073
+ <xsl:if test="normalize-space($part-en) != ''">
1034
1074
  <xsl:if test="$part != ''">
1035
1075
  <xsl:text> — </xsl:text>
1036
- <fo:block font-weight="normal" margin-top="12pt">
1037
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1038
- <xsl:text>:</xsl:text>
1076
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1077
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1078
+ <!-- <xsl:value-of select="$title-part-en"/>
1079
+ <xsl:value-of select="$part"/>
1080
+ <xsl:text>:</xsl:text> -->
1039
1081
  </fo:block>
1040
1082
  </xsl:if>
1041
1083
  </xsl:if>
1042
1084
  </fo:block>
1043
1085
  <fo:block>
1044
- <xsl:value-of select="$title-part"/>
1086
+ <xsl:value-of select="$part-en"/>
1045
1087
  </fo:block>
1088
+
1089
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
1090
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1091
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1092
+ <xsl:variable name="title-amendment">
1093
+ <xsl:call-template name="getTitle">
1094
+ <xsl:with-param name="name" select="'title-amendment'"/>
1095
+ </xsl:call-template>
1096
+ </xsl:variable>
1097
+ <xsl:value-of select="$title-amendment"/>
1098
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1099
+ <xsl:if test="normalize-space($amendment-number) != ''">
1100
+ <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1101
+ </xsl:if>
1102
+ <xsl:text>: </xsl:text>
1103
+ <xsl:value-of select="$title-amd"/>
1104
+ </fo:block>
1105
+ </xsl:if>
1106
+
1046
1107
  </fo:block>
1047
1108
 
1048
-
1049
1109
  </fo:block-container>
1050
1110
  <!-- Clause(s) -->
1051
1111
  <fo:block>
@@ -1054,13 +1114,13 @@
1054
1114
  <xsl:with-param name="sectionNum" select="'1'"/>
1055
1115
  </xsl:apply-templates>
1056
1116
 
1057
- <fo:block space-before="27pt"> </fo:block>
1117
+ <!-- <fo:block space-before="27pt">&#xA0;</fo:block> -->
1058
1118
  <!-- Normative references -->
1059
1119
  <xsl:apply-templates select="/iso:iso-standard/iso:bibliography/iso:references[1]">
1060
1120
  <xsl:with-param name="sectionNum" select="'2'"/>
1061
1121
  </xsl:apply-templates>
1062
1122
 
1063
- <fo:block space-before="18pt"> </fo:block>
1123
+ <!-- <fo:block space-before="18pt">&#xA0;</fo:block> -->
1064
1124
  <!-- main sections -->
1065
1125
  <xsl:apply-templates select="/iso:iso-standard/iso:sections/*[position() &gt; 1]">
1066
1126
  <xsl:with-param name="sectionNumSkew" select="'1'"/>
@@ -1093,7 +1153,7 @@
1093
1153
  </fo:table-cell>
1094
1154
  <fo:table-cell>
1095
1155
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
1096
- <xsl:if test="$stage-name = 'IS'">
1156
+ <xsl:if test="$stage-abbreviation = 'PRF'">
1097
1157
  <xsl:value-of select="$proof-text"/>
1098
1158
  </xsl:if>
1099
1159
  </fo:block>
@@ -1109,13 +1169,31 @@
1109
1169
  <fo:block-container height="252mm" display-align="after">
1110
1170
  <fo:block-container border-top="1mm double black">
1111
1171
  <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1112
- <xsl:choose>
1113
- <xsl:when test="$stage-name = 'FDIS'">ICS  01.140.30</xsl:when>
1114
- <xsl:when test="$stage-name = 'IS'">ICS  35.240.63</xsl:when>
1115
- <xsl:when test="$stage-name = 'published'">ICS  35.240.30</xsl:when>
1116
- <xsl:otherwise>ICS  67.060</xsl:otherwise>
1117
- </xsl:choose>
1172
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1173
+ <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1174
+ <xsl:value-of select="."/>
1175
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1176
+ </xsl:for-each> 
1177
+ <!-- <xsl:choose>
1178
+ <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1179
+ <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1180
+ <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1181
+ <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1182
+ </xsl:choose> -->
1183
+ </fo:block>
1184
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1185
+ <fo:block font-size="9pt" margin-bottom="6pt">
1186
+ <xsl:variable name="title-descriptors">
1187
+ <xsl:call-template name="getTitle">
1188
+ <xsl:with-param name="name" select="'title-descriptors'"/>
1189
+ </xsl:call-template>
1190
+ </xsl:variable>
1191
+ <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1192
+ <xsl:call-template name="insertKeywords">
1193
+ <xsl:with-param name="sorting">no</xsl:with-param>
1194
+ </xsl:call-template>
1118
1195
  </fo:block>
1196
+ </xsl:if>
1119
1197
  <fo:block font-size="9pt">Price based on <fo:page-number-citation ref-id="lastBlock"/> pages</fo:block>
1120
1198
  </fo:block-container>
1121
1199
  </fo:block-container>
@@ -1232,8 +1310,7 @@
1232
1310
  <xsl:template match="iso:figure" mode="contents">
1233
1311
  <item level="" id="{@id}" display="false">
1234
1312
  <xsl:attribute name="section">
1235
- <xsl:call-template name="getFigureNumber"/>
1236
- <!-- <xsl:text>Figure </xsl:text><xsl:number format="A.1-1" level="multiple" count="iso:annex | iso:figure"/> -->
1313
+ <xsl:call-template name="getFigureNumber"/>
1237
1314
  </xsl:attribute>
1238
1315
  </item>
1239
1316
  </xsl:template>
@@ -1243,35 +1320,74 @@
1243
1320
  <xsl:param name="sectionNum"/>
1244
1321
  <xsl:variable name="annex-id" select="ancestor::iso:annex/@id"/>
1245
1322
  <item level="" id="{@id}" display="false" type="table">
1246
- <xsl:attribute name="section">
1247
- <xsl:text>Table </xsl:text>
1248
- <xsl:choose>
1249
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1250
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
1251
- </xsl:when>
1252
- <xsl:when test="ancestor::*[local-name()='annex']">
1253
- <xsl:number format="A-" count="iso:annex"/>
1254
- <xsl:number format="1" level="any" count="iso:table[ancestor::iso:annex[@id = $annex-id]]"/>
1255
- </xsl:when>
1256
- <xsl:otherwise>
1257
- <!-- <xsl:number format="1"/> -->
1258
- <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
1259
- </xsl:otherwise>
1260
- </xsl:choose>
1323
+ <xsl:attribute name="section">
1324
+ <xsl:variable name="title-table">
1325
+ <xsl:call-template name="getTitle">
1326
+ <xsl:with-param name="name" select="'title-table'"/>
1327
+ </xsl:call-template>
1328
+ </xsl:variable>
1329
+ <xsl:value-of select="$title-table"/>
1330
+ <xsl:call-template name="getTableNumber"/>
1261
1331
  </xsl:attribute>
1262
1332
  <xsl:value-of select="iso:name/text()"/>
1263
1333
  </item>
1264
1334
  </xsl:template>
1265
1335
 
1266
-
1267
-
1268
1336
  <xsl:template match="iso:formula" mode="contents">
1269
1337
  <item level="" id="{@id}" display="false">
1270
1338
  <xsl:attribute name="section">
1271
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
1339
+ <xsl:variable name="title-formula">
1340
+ <xsl:call-template name="getTitle">
1341
+ <xsl:with-param name="name" select="'title-formula'"/>
1342
+ </xsl:call-template>
1343
+ </xsl:variable>
1344
+ <xsl:value-of select="$title-formula"/>
1345
+ <xsl:call-template name="getFormulaNumber">
1346
+ <xsl:with-param name="display" select="not(@unnumbered = 'true')"/>
1347
+ </xsl:call-template>
1348
+ </xsl:attribute>
1349
+ </item>
1350
+ </xsl:template>
1351
+
1352
+ <xsl:template match="iso:li" mode="contents">
1353
+ <xsl:param name="sectionNum"/>
1354
+ <item level="" id="{@id}" display="false" type="li">
1355
+ <xsl:attribute name="section">
1356
+ <xsl:call-template name="getListItemFormat"/>
1357
+ </xsl:attribute>
1358
+ <xsl:attribute name="parent_section">
1359
+ <xsl:for-each select="ancestor::*[not(local-name() = 'p' or local-name() = 'ol')][1]">
1360
+ <xsl:call-template name="getSection">
1361
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1362
+ </xsl:call-template>
1363
+ </xsl:for-each>
1272
1364
  </xsl:attribute>
1273
1365
  </item>
1366
+ <xsl:apply-templates mode="contents">
1367
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1368
+ </xsl:apply-templates>
1369
+ </xsl:template>
1370
+
1371
+ <xsl:template name="getListItemFormat">
1372
+ <xsl:choose>
1373
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1374
+ <xsl:otherwise> <!-- for ordered lists -->
1375
+ <xsl:choose>
1376
+ <xsl:when test="../@type = 'arabic'">
1377
+ <xsl:number format="a)"/>
1378
+ </xsl:when>
1379
+ <xsl:when test="../@type = 'alphabet'">
1380
+ <xsl:number format="a)"/>
1381
+ </xsl:when>
1382
+ <xsl:otherwise>
1383
+ <xsl:number format="1."/>
1384
+ </xsl:otherwise>
1385
+ </xsl:choose>
1386
+ </xsl:otherwise>
1387
+ </xsl:choose>
1274
1388
  </xsl:template>
1389
+
1390
+
1275
1391
  <!-- ============================= -->
1276
1392
  <!-- ============================= -->
1277
1393
 
@@ -1334,7 +1450,7 @@
1334
1450
  <xsl:param name="sectionNum"/>
1335
1451
  <xsl:param name="sectionNumSkew" select="0"/>
1336
1452
  <fo:block>
1337
- <xsl:variable name="pos"><xsl:number count="iso:sections/iso:clause | iso:sections/iso:terms"/></xsl:variable>
1453
+ <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable> <!-- iso:sections/iso:clause | iso:sections/iso:terms | iso:sections/iso:definitions -->
1338
1454
  <xsl:if test="$pos &gt;= 2">
1339
1455
  <xsl:attribute name="space-before">18pt</xsl:attribute>
1340
1456
  </xsl:if>
@@ -1343,7 +1459,7 @@
1343
1459
  <xsl:choose>
1344
1460
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1345
1461
  <xsl:when test="$sectionNumSkew != 0">
1346
- <xsl:variable name="number"><xsl:number count="iso:sections/iso:clause | iso:sections/iso:terms"/></xsl:variable>
1462
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!--iso:sections/iso:clause | iso:sections/iso:terms | iso:sections/iso:definitions -->
1347
1463
  <xsl:value-of select="$number + $sectionNumSkew"/>
1348
1464
  </xsl:when>
1349
1465
  </xsl:choose>
@@ -1406,7 +1522,7 @@
1406
1522
  <xsl:variable name="font-size">
1407
1523
  <xsl:choose>
1408
1524
  <xsl:when test="ancestor::iso:annex and $level = 2">13pt</xsl:when>
1409
- <xsl:when test="ancestor::iso:annex and $level = 3">11pt</xsl:when>
1525
+ <xsl:when test="ancestor::iso:annex and $level = 3">12pt</xsl:when>
1410
1526
  <xsl:when test="ancestor::iso:preface">16pt</xsl:when>
1411
1527
  <xsl:when test="$level = 2">12pt</xsl:when>
1412
1528
  <xsl:when test="$level &gt;= 3">11pt</xsl:when>
@@ -1422,6 +1538,11 @@
1422
1538
  </xsl:variable>
1423
1539
 
1424
1540
  <xsl:choose>
1541
+ <xsl:when test="$doctype = 'amendment'">
1542
+ <fo:block id="{$id}" font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
1543
+ <xsl:apply-templates/>
1544
+ </fo:block>
1545
+ </xsl:when>
1425
1546
  <xsl:when test="$parent-name = 'annex'">
1426
1547
  <fo:block id="{$id}" font-size="16pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
1427
1548
  <xsl:value-of select="$section"/>
@@ -1446,15 +1567,17 @@
1446
1567
  <xsl:attribute name="margin-top"> <!-- margin-top -->
1447
1568
  <xsl:choose>
1448
1569
  <xsl:when test="ancestor::iso:preface">8pt</xsl:when>
1449
- <xsl:when test="$level = 2 and ancestor::annex">18pt</xsl:when>
1450
- <xsl:when test="$level = '' or $level = 1">6pt</xsl:when><!-- 13.5pt -->
1570
+ <xsl:when test="$level = 2 and ancestor::iso:annex">18pt</xsl:when>
1571
+ <xsl:when test="$level = 1">18pt</xsl:when>
1572
+ <xsl:when test="$level = ''">6pt</xsl:when><!-- 13.5pt -->
1451
1573
  <xsl:otherwise>12pt</xsl:otherwise>
1452
1574
  </xsl:choose>
1453
1575
  </xsl:attribute>
1454
1576
  <xsl:attribute name="margin-bottom">
1455
1577
  <xsl:choose>
1456
1578
  <xsl:when test="ancestor::iso:preface">18pt</xsl:when>
1457
- <xsl:otherwise>12pt</xsl:otherwise>
1579
+ <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1580
+ <xsl:otherwise>8pt</xsl:otherwise>
1458
1581
  </xsl:choose>
1459
1582
  </xsl:attribute>
1460
1583
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
@@ -1506,10 +1629,12 @@
1506
1629
  <xsl:choose>
1507
1630
  <!-- <xsl:when test="ancestor::iso:preface">justify</xsl:when> -->
1508
1631
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1632
+ <xsl:when test="ancestor::iso:td/@align"><xsl:value-of select="ancestor::iso:td/@align"/></xsl:when>
1633
+ <xsl:when test="ancestor::iso:th/@align"><xsl:value-of select="ancestor::iso:th/@align"/></xsl:when>
1509
1634
  <xsl:otherwise>justify</xsl:otherwise><!-- left -->
1510
1635
  </xsl:choose>
1511
1636
  </xsl:attribute>
1512
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1637
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1513
1638
  <xsl:apply-templates/>
1514
1639
  </xsl:element>
1515
1640
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1525,33 +1650,70 @@
1525
1650
  </xsl:if>
1526
1651
  </xsl:template>
1527
1652
 
1653
+ <xsl:template match="iso:li//iso:p//text()">
1654
+ <xsl:choose>
1655
+ <xsl:when test="contains(., '&#9;')">
1656
+ <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
1657
+ </xsl:when>
1658
+ <xsl:otherwise>
1659
+ <xsl:value-of select="."/>
1660
+ </xsl:otherwise>
1661
+ </xsl:choose>
1662
+
1663
+ </xsl:template>
1664
+
1528
1665
  <!--
1529
1666
  <fn reference="1">
1530
1667
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1531
1668
  </fn>
1532
1669
  -->
1670
+
1671
+ <xsl:variable name="p_fn">
1672
+ <xsl:for-each select="//iso:p/iso:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
1673
+ <!-- copy unique fn -->
1674
+ <fn gen_id="{generate-id(.)}">
1675
+ <xsl:copy-of select="@*"/>
1676
+ <xsl:copy-of select="node()"/>
1677
+ </fn>
1678
+ </xsl:for-each>
1679
+ </xsl:variable>
1680
+
1533
1681
  <xsl:template match="iso:p/iso:fn" priority="2">
1534
- <fo:footnote>
1535
- <xsl:variable name="number">
1536
- <xsl:number level="any" count="iso:p/iso:fn"/>
1537
- </xsl:variable>
1538
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1539
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
1540
- <!-- <xsl:value-of select="@reference"/> -->
1541
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/><xsl:text>)</xsl:text>
1542
- </fo:basic-link>
1543
- </fo:inline>
1544
- <fo:footnote-body>
1545
- <fo:block font-size="10pt" margin-bottom="12pt">
1546
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1547
- <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/><xsl:text>)</xsl:text>
1682
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
1683
+ <xsl:variable name="reference" select="@reference"/>
1684
+ <xsl:variable name="number">
1685
+ <!-- <xsl:number level="any" count="iso:p/iso:fn"/> -->
1686
+ <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
1687
+ </xsl:variable>
1688
+ <xsl:choose>
1689
+ <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
1690
+ <fo:footnote>
1691
+ <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
1692
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1693
+ <!-- <xsl:value-of select="@reference"/> -->
1694
+ <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@id='_normative_references']]/iso:note)"/><xsl:text>)</xsl:text>
1695
+ </fo:basic-link>
1548
1696
  </fo:inline>
1549
- <xsl:for-each select="iso:p">
1550
- <xsl:apply-templates/>
1551
- </xsl:for-each>
1552
- </fo:block>
1553
- </fo:footnote-body>
1554
- </fo:footnote>
1697
+ <fo:footnote-body>
1698
+ <fo:block font-size="10pt" margin-bottom="12pt">
1699
+ <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
1700
+ <xsl:value-of select="$number + count(//iso:bibitem[ancestor::iso:references[@id='_normative_references']]/iso:note)"/><xsl:text>)</xsl:text>
1701
+ </fo:inline>
1702
+ <xsl:for-each select="iso:p">
1703
+ <xsl:apply-templates/>
1704
+ </xsl:for-each>
1705
+ </fo:block>
1706
+ </fo:footnote-body>
1707
+ </fo:footnote>
1708
+ </xsl:when>
1709
+ <xsl:otherwise>
1710
+ <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1711
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1712
+ <xsl:value-of select="$number + count(//iso:bibitem/iso:note)"/>
1713
+ </fo:basic-link>
1714
+ </fo:inline>
1715
+ </xsl:otherwise>
1716
+ </xsl:choose>
1555
1717
  </xsl:template>
1556
1718
 
1557
1719
  <xsl:template match="iso:p/iso:fn/iso:p">
@@ -1574,7 +1736,7 @@
1574
1736
  <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
1575
1737
  </fo:block>
1576
1738
  <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1577
- <xsl:value-of select="$title-figure"/>
1739
+ <!-- <xsl:value-of select="$title-figure"/> -->
1578
1740
  <xsl:call-template name="getFigureNumber"/>
1579
1741
  </fo:block>
1580
1742
  </fo:block-container>
@@ -1590,9 +1752,12 @@
1590
1752
  <xsl:call-template name="note"/>
1591
1753
  </xsl:for-each>
1592
1754
  <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
1593
- <xsl:call-template name="getFigureNumber"/>
1755
+ <xsl:variable name="figureNumber">
1756
+ <xsl:call-template name="getFigureNumber"/>
1757
+ </xsl:variable>
1758
+ <xsl:value-of select="$figureNumber"/>
1594
1759
  <xsl:if test="iso:name">
1595
- <xsl:if test="not(local-name(..) = 'figure')">
1760
+ <xsl:if test="not(local-name(..) = 'figure') and normalize-space($figureNumber) != ''">
1596
1761
  <xsl:text> — </xsl:text>
1597
1762
  </xsl:if>
1598
1763
  <xsl:value-of select="iso:name"/>
@@ -1602,7 +1767,13 @@
1602
1767
  </xsl:template>
1603
1768
 
1604
1769
  <xsl:template name="getFigureNumber">
1770
+ <xsl:variable name="title-figure">
1771
+ <xsl:call-template name="getTitle">
1772
+ <xsl:with-param name="name" select="'title-figure'"/>
1773
+ </xsl:call-template>
1774
+ </xsl:variable>
1605
1775
  <xsl:choose>
1776
+ <xsl:when test="$doctype = 'amendment'"/>
1606
1777
  <xsl:when test="ancestor::iso:annex">
1607
1778
  <xsl:choose>
1608
1779
  <xsl:when test="local-name(..) = 'figure'">
@@ -1626,22 +1797,34 @@
1626
1797
 
1627
1798
  <xsl:template match="iso:figure/iso:image">
1628
1799
  <fo:block text-align="center">
1629
- <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1800
+ <xsl:variable name="src">
1801
+ <xsl:choose>
1802
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
1803
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
1804
+ </xsl:when>
1805
+ <xsl:otherwise>
1806
+ <xsl:value-of select="@src"/>
1807
+ </xsl:otherwise>
1808
+ </xsl:choose>
1809
+ </xsl:variable>
1810
+ <fo:external-graphic src="{$src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- src="{@src}" -->
1630
1811
  </fo:block>
1631
1812
  </xsl:template>
1632
1813
 
1633
1814
 
1634
1815
  <xsl:template match="iso:bibitem">
1635
1816
  <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
1636
- <!-- iso:docidentifier -->
1637
- <xsl:if test="iso:docidentifier">
1638
- <xsl:choose>
1639
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1640
- <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/></fo:inline></xsl:otherwise>
1641
- </xsl:choose>
1642
- </xsl:if>
1643
- <xsl:apply-templates select="iso:note"/>
1644
- <xsl:if test="iso:docidentifier">, </xsl:if>
1817
+ <xsl:variable name="docidentifier">
1818
+ <xsl:if test="iso:docidentifier">
1819
+ <xsl:choose>
1820
+ <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1821
+ <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1822
+ </xsl:choose>
1823
+ </xsl:if>
1824
+ </xsl:variable>
1825
+ <xsl:value-of select="$docidentifier"/>
1826
+ <xsl:apply-templates select="iso:note"/>
1827
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1645
1828
  <fo:inline font-style="italic">
1646
1829
  <xsl:choose>
1647
1830
  <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
@@ -1661,14 +1844,14 @@
1661
1844
  <xsl:variable name="number">
1662
1845
  <xsl:number level="any" count="iso:bibitem/iso:note"/>
1663
1846
  </xsl:variable>
1664
- <fo:inline font-size="85%" keep-with-previous.within-line="always" vertical-align="super"> <!--60% -->
1665
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1847
+ <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1848
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1666
1849
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1667
1850
  </fo:basic-link>
1668
1851
  </fo:inline>
1669
1852
  <fo:footnote-body>
1670
- <fo:block font-size="10pt" margin-bottom="12pt">
1671
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="9mm"><!-- font-size="60%" -->
1853
+ <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1854
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1672
1855
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1673
1856
  </fo:inline>
1674
1857
  <xsl:apply-templates/>
@@ -1680,7 +1863,7 @@
1680
1863
 
1681
1864
 
1682
1865
  <xsl:template match="iso:ul | iso:ol">
1683
- <fo:list-block provisional-distance-between-starts="7mm">
1866
+ <fo:list-block provisional-distance-between-starts="7mm" margin-top="8pt"> <!-- margin-bottom="8pt" -->
1684
1867
  <xsl:apply-templates/>
1685
1868
  </fo:list-block>
1686
1869
  <xsl:for-each select="./iso:note//iso:p">
@@ -1694,22 +1877,7 @@
1694
1877
  <fo:list-item id="{@id}">
1695
1878
  <fo:list-item-label end-indent="label-end()">
1696
1879
  <fo:block>
1697
- <xsl:choose>
1698
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1699
- <xsl:otherwise> <!-- for ordered lists -->
1700
- <xsl:choose>
1701
- <xsl:when test="../@type = 'arabic'">
1702
- <xsl:number format="a)"/>
1703
- </xsl:when>
1704
- <xsl:when test="../@type = 'alphabet'">
1705
- <xsl:number format="a)"/>
1706
- </xsl:when>
1707
- <xsl:otherwise>
1708
- <xsl:number format="1."/>
1709
- </xsl:otherwise>
1710
- </xsl:choose>
1711
- </xsl:otherwise>
1712
- </xsl:choose>
1880
+ <xsl:call-template name="getListItemFormat"/>
1713
1881
  </fo:block>
1714
1882
  </fo:list-item-label>
1715
1883
  <fo:list-item-body start-indent="body-start()">
@@ -1719,27 +1887,27 @@
1719
1887
  </fo:list-item>
1720
1888
  </xsl:template>
1721
1889
 
1722
- <xsl:template match="iso:link">
1723
- <fo:inline>
1724
- <fo:basic-link external-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1725
- <xsl:choose>
1726
- <xsl:when test="normalize-space(.) = ''">
1727
- <xsl:value-of select="@target"/>
1728
- </xsl:when>
1729
- <xsl:otherwise>
1730
- <xsl:apply-templates/>
1731
- </xsl:otherwise>
1732
- </xsl:choose>
1733
- </fo:basic-link>
1734
- </fo:inline>
1890
+ <xsl:template match="iso:term">
1891
+ <xsl:param name="sectionNum"/>
1892
+ <fo:block id="{@id}" margin-bottom="10pt">
1893
+ <xsl:apply-templates>
1894
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1895
+ </xsl:apply-templates>
1896
+ </fo:block>
1735
1897
  </xsl:template>
1736
1898
 
1737
1899
  <xsl:template match="iso:preferred">
1738
1900
  <xsl:param name="sectionNum"/>
1739
1901
  <fo:block line-height="1.1">
1740
1902
  <fo:block font-weight="bold" keep-with-next="always">
1741
- <fo:inline id="{../@id}">
1742
- <xsl:value-of select="$sectionNum"/>.<xsl:number count="iso:term"/>
1903
+ <fo:inline>
1904
+ <xsl:variable name="section">
1905
+ <xsl:call-template name="getSection">
1906
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1907
+ </xsl:call-template>
1908
+ </xsl:variable>
1909
+ <xsl:value-of select="$section"/>
1910
+ <!-- <xsl:value-of select="$sectionNum"/>.<xsl:number count="iso:term"/> -->
1743
1911
  </fo:inline>
1744
1912
  </fo:block>
1745
1913
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1755,7 +1923,12 @@
1755
1923
  </xsl:template>
1756
1924
 
1757
1925
  <xsl:template match="iso:deprecates">
1758
- <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1926
+ <xsl:variable name="title-deprecated">
1927
+ <xsl:call-template name="getTitle">
1928
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1929
+ </xsl:call-template>
1930
+ </xsl:variable>
1931
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1759
1932
  </xsl:template>
1760
1933
 
1761
1934
  <xsl:template match="iso:definition[preceding-sibling::iso:domain]">
@@ -1773,52 +1946,80 @@
1773
1946
  </xsl:template>
1774
1947
 
1775
1948
  <xsl:template match="iso:termsource">
1776
- <fo:block margin-bottom="8pt" keep-with-previous="always">
1949
+ <fo:block margin-bottom="8pt"> <!-- keep-with-previous="always" -->
1777
1950
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1778
1951
  <fo:basic-link internal-destination="{iso:origin/@bibitemid}" fox:alt-text="{iso:origin/@citeas}">
1779
- <xsl:text>[SOURCE: </xsl:text>
1952
+ <xsl:text>[</xsl:text>
1953
+ <xsl:variable name="title-source">
1954
+ <xsl:call-template name="getTitle">
1955
+ <xsl:with-param name="name" select="'title-source'"/>
1956
+ </xsl:call-template>
1957
+ </xsl:variable>
1958
+ <xsl:value-of select="$title-source"/>
1959
+ <xsl:text>: </xsl:text>
1780
1960
  <xsl:value-of select="iso:origin/@citeas"/>
1781
- <xsl:if test="iso:origin/iso:locality/iso:referenceFrom">
1961
+
1962
+ <xsl:apply-templates select="iso:origin/iso:localityStack"/>
1963
+
1964
+ <!-- <xsl:if test="iso:origin/iso:locality/iso:referenceFrom">
1782
1965
  <xsl:text>, </xsl:text><xsl:value-of select="iso:origin/iso:locality/iso:referenceFrom"/>
1783
- </xsl:if>
1966
+ </xsl:if> -->
1784
1967
  </fo:basic-link>
1785
1968
  <xsl:apply-templates select="iso:modification"/>
1786
1969
  <xsl:text>]</xsl:text>
1787
1970
  </fo:block>
1788
1971
  </xsl:template>
1789
1972
 
1790
- <xsl:template match="iso:modification">
1791
- <xsl:text>, modified — </xsl:text>
1792
- <xsl:apply-templates/>
1793
- </xsl:template>
1973
+
1794
1974
  <xsl:template match="iso:modification/iso:p">
1795
1975
  <fo:inline><xsl:apply-templates/></fo:inline>
1796
1976
  </xsl:template>
1797
1977
 
1798
1978
  <xsl:template match="iso:termnote">
1799
- <fo:block font-size="10pt" margin-bottom="12pt">
1800
- <xsl:text>Note </xsl:text>
1801
- <xsl:number/>
1802
- <xsl:text> to entry: </xsl:text>
1979
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1980
+ <!-- <xsl:text>Note </xsl:text>
1981
+ <xsl:number />
1982
+ <xsl:text> to entry: </xsl:text> -->
1983
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1984
+ <xsl:variable name="title-note-to-entry">
1985
+ <xsl:call-template name="getTitle">
1986
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1987
+ </xsl:call-template>
1988
+ </xsl:variable>
1989
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1803
1990
  <xsl:apply-templates/>
1804
1991
  </fo:block>
1805
1992
  </xsl:template>
1806
1993
 
1807
1994
  <xsl:template match="iso:termnote/iso:p">
1808
1995
  <fo:inline><xsl:apply-templates/></fo:inline>
1996
+ <!-- <xsl:if test="following-sibling::* and not(following-sibling::iso:p)">
1997
+ <xsl:value-of select="$linebreak"/>
1998
+ <xsl:value-of select="$linebreak"/>
1999
+ </xsl:if> -->
1809
2000
  </xsl:template>
1810
2001
 
1811
2002
  <xsl:template match="iso:domain">
1812
- <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
2003
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline><xsl:text> </xsl:text>
1813
2004
  </xsl:template>
1814
2005
 
1815
2006
 
1816
2007
  <xsl:template match="iso:termexample">
1817
- <fo:block font-size="10pt" margin-bottom="12pt">
1818
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1819
- <xsl:apply-templates/>
1820
- </fo:block>
1821
- </xsl:template>
2008
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
2009
+ <fo:inline padding-right="5mm">
2010
+ <xsl:variable name="title-example">
2011
+ <xsl:call-template name="getTitle">
2012
+ <xsl:with-param name="name" select="'title-example'"/>
2013
+ </xsl:call-template>
2014
+ </xsl:variable>
2015
+ <xsl:value-of select="$title-example"/>
2016
+ <xsl:if test="count(ancestor::iso:term[1]//iso:termexample) &gt; 1">
2017
+ <xsl:number/>
2018
+ </xsl:if>
2019
+ </fo:inline>
2020
+ <xsl:apply-templates/>
2021
+ </fo:block>
2022
+ </xsl:template>
1822
2023
 
1823
2024
  <xsl:template match="iso:termexample/iso:p">
1824
2025
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -1852,12 +2053,17 @@
1852
2053
  </fo:list-item-label>
1853
2054
  <fo:list-item-body start-indent="body-start()">
1854
2055
  <fo:block>
1855
- <xsl:if test="iso:docidentifier">
1856
- <xsl:choose>
1857
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1858
- <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/>, </fo:inline></xsl:otherwise>
1859
- </xsl:choose>
1860
- </xsl:if>
2056
+ <xsl:variable name="docidentifier">
2057
+ <xsl:if test="iso:docidentifier">
2058
+ <xsl:choose>
2059
+ <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
2060
+ <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
2061
+ </xsl:choose>
2062
+ </xsl:if>
2063
+ </xsl:variable>
2064
+ <xsl:value-of select="$docidentifier"/>
2065
+ <xsl:apply-templates select="iso:note"/>
2066
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1861
2067
  <xsl:choose>
1862
2068
  <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
1863
2069
  <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
@@ -1889,7 +2095,8 @@
1889
2095
  </fo:block>
1890
2096
  <fo:block text-align="right">
1891
2097
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
1892
- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/>
2098
+ <xsl:apply-templates select="iso:author"/>
2099
+ <!-- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/> -->
1893
2100
  <xsl:if test="iso:source">
1894
2101
  <xsl:text>, </xsl:text>
1895
2102
  <xsl:apply-templates select="iso:source"/>
@@ -1897,69 +2104,17 @@
1897
2104
  </fo:block>
1898
2105
  </xsl:template>
1899
2106
 
2107
+ <xsl:template match="iso:quote/iso:author">
2108
+ <xsl:text>— </xsl:text><xsl:apply-templates/>
2109
+ </xsl:template>
2110
+
1900
2111
  <xsl:template match="iso:source">
1901
2112
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1902
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1903
- <xsl:if test="iso:locality">
1904
- <xsl:text>, </xsl:text>
1905
- <xsl:apply-templates select="iso:locality"/>
1906
- </xsl:if>
2113
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2114
+ <xsl:apply-templates select="iso:localityStack"/>
1907
2115
  </fo:basic-link>
1908
2116
  </xsl:template>
1909
2117
 
1910
- <xsl:template match="iso:appendix">
1911
- <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1912
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1913
- <xsl:apply-templates select="iso:title" mode="process"/>
1914
- </fo:block>
1915
- <xsl:apply-templates/>
1916
- </xsl:template>
1917
-
1918
- <xsl:template match="iso:appendix//iso:example">
1919
- <fo:block font-size="10pt" margin-bottom="12pt">
1920
- <xsl:text>EXAMPLE</xsl:text>
1921
- <xsl:if test="iso:name">
1922
- <xsl:text> — </xsl:text><xsl:apply-templates select="iso:name" mode="process"/>
1923
- </xsl:if>
1924
- </fo:block>
1925
- <xsl:apply-templates/>
1926
- </xsl:template>
1927
-
1928
- <xsl:template match="iso:appendix//iso:example/iso:name"/>
1929
- <xsl:template match="iso:appendix//iso:example/iso:name" mode="process">
1930
- <fo:inline><xsl:apply-templates/></fo:inline>
1931
- </xsl:template>
1932
-
1933
- <!-- <xsl:template match="iso:callout/text()">
1934
- <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
1935
- </xsl:template> -->
1936
- <xsl:template match="iso:callout">
1937
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1938
- </xsl:template>
1939
-
1940
- <xsl:template match="iso:annotation">
1941
- <fo:block>
1942
-
1943
- </fo:block>
1944
- <xsl:apply-templates/>
1945
- </xsl:template>
1946
-
1947
- <xsl:template match="iso:annotation/text()"/>
1948
-
1949
- <xsl:template match="iso:annotation/iso:p">
1950
- <xsl:variable name="annotation-id" select="../@id"/>
1951
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1952
- <fo:block id="{$annotation-id}">
1953
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1954
- <xsl:apply-templates/>
1955
- </fo:block>
1956
- </xsl:template>
1957
-
1958
-
1959
- <xsl:template match="iso:appendix/iso:title"/>
1960
- <xsl:template match="iso:appendix/iso:title" mode="process">
1961
- <fo:inline><xsl:apply-templates/></fo:inline>
1962
- </xsl:template>
1963
2118
 
1964
2119
  <xsl:template match="mathml:math" priority="2">
1965
2120
  <fo:inline font-family="Cambria Math">
@@ -1970,50 +2125,88 @@
1970
2125
  </xsl:template>
1971
2126
 
1972
2127
  <xsl:template match="iso:xref">
2128
+ <xsl:param name="sectionNum"/>
2129
+
1973
2130
  <xsl:variable name="target" select="normalize-space(@target)"/>
1974
2131
  <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
1975
2132
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = $target]/@section"/>
1976
- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))">
2133
+ <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
1977
2134
  <xsl:attribute name="color">blue</xsl:attribute>
1978
2135
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1979
- </xsl:if>
2136
+ <!-- </xsl:if> -->
1980
2137
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
1981
2138
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
2139
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
2140
+
2141
+ <xsl:variable name="title-clause">
2142
+ <xsl:call-template name="getTitle">
2143
+ <xsl:with-param name="name" select="'title-clause'"/>
2144
+ </xsl:call-template>
2145
+ </xsl:variable>
2146
+
1982
2147
  <xsl:choose>
1983
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
2148
+ <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
2149
+ <xsl:when test="$type = 'li'">
2150
+ <xsl:attribute name="color">black</xsl:attribute>
2151
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
2152
+ <xsl:variable name="parent_section" select="xalan:nodeset($contents)//item[@id =$target]/@parent_section"/>
2153
+ <xsl:variable name="currentSection">
2154
+ <xsl:call-template name="getSection"/>
2155
+ </xsl:variable>
2156
+ <xsl:if test="not(contains($parent_section, $currentSection))">
2157
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2158
+ <xsl:attribute name="color">blue</xsl:attribute>
2159
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2160
+ <xsl:value-of select="$parent_section"/><xsl:text> </xsl:text>
2161
+ </fo:basic-link>
2162
+ </xsl:if>
2163
+ </xsl:when>
1984
2164
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1985
2165
  </xsl:choose>
1986
2166
  <xsl:value-of select="$section"/>
1987
2167
  </fo:basic-link>
1988
2168
  </xsl:template>
1989
-
1990
- <xsl:template match="iso:sourcecode">
1991
- <fo:block font-family="Courier" font-size="9pt" margin-bottom="12pt">
1992
- <xsl:choose>
1993
- <xsl:when test="@lang = 'en'"/>
1994
- <xsl:otherwise>
1995
- <xsl:attribute name="white-space">pre</xsl:attribute>
1996
- </xsl:otherwise>
1997
- </xsl:choose>
1998
- <xsl:apply-templates/>
1999
- </fo:block>
2000
- </xsl:template>
2001
2169
 
2002
2170
  <xsl:template match="iso:example/iso:p">
2003
- <fo:block font-size="10pt">
2004
- <fo:inline padding-right="9mm">EXAMPLE</fo:inline>
2171
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
2172
+ <!-- <xsl:if test="ancestor::iso:li">
2173
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2174
+ </xsl:if> -->
2175
+ <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2176
+ <fo:inline padding-right="5mm">
2177
+ <xsl:variable name="title-example">
2178
+ <xsl:call-template name="getTitle">
2179
+ <xsl:with-param name="name" select="'title-example'"/>
2180
+ </xsl:call-template>
2181
+ </xsl:variable>
2182
+ <xsl:value-of select="$title-example"/>
2183
+ <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2184
+ <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2185
+ </xsl:if>
2186
+ </fo:inline>
2005
2187
  <xsl:apply-templates/>
2006
2188
  </fo:block>
2007
2189
  </xsl:template>
2008
2190
 
2009
2191
  <xsl:template match="iso:note/iso:p" name="note">
2010
- <fo:block font-size="10pt" margin-bottom="12pt">
2011
- <fo:inline padding-right="6mm">NOTE</fo:inline>
2192
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="12pt" text-align="justify">
2193
+ <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2194
+ <fo:inline padding-right="6mm">
2195
+ <xsl:variable name="title-note">
2196
+ <xsl:call-template name="getTitle">
2197
+ <xsl:with-param name="name" select="'title-note'"/>
2198
+ </xsl:call-template>
2199
+ </xsl:variable>
2200
+ <xsl:value-of select="$title-note"/>
2201
+ <xsl:if test="count(ancestor::iso:clause[1]//iso:note) &gt; 1">
2202
+ <xsl:number count="iso:note[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2203
+ </xsl:if>
2204
+ </fo:inline>
2012
2205
  <xsl:apply-templates/>
2013
2206
  </fo:block>
2014
2207
  </xsl:template>
2015
2208
 
2016
- <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
2209
+ <!-- <eref type="inline" bibitemid="IEC60050-113" citeas="IEC 60050-113:2011"><localityStack><locality type="clause"><referenceFrom>113-01-12</referenceFrom></locality></localityStack></eref> -->
2017
2210
  <xsl:template match="iso:eref">
2018
2211
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
2019
2212
  <xsl:if test="@type = 'footnote'">
@@ -2022,43 +2215,66 @@
2022
2215
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2023
2216
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2024
2217
  </xsl:if>
2025
- <xsl:if test="@type = 'inline'">
2026
- <xsl:attribute name="color">blue</xsl:attribute>
2027
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
2028
- </xsl:if>
2029
2218
  <!-- <xsl:if test="@type = 'inline'">
2219
+ <xsl:attribute name="color">blue</xsl:attribute>
2030
2220
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2031
2221
  </xsl:if> -->
2032
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2033
- <xsl:if test="iso:locality">
2034
- <xsl:text>, </xsl:text>
2035
- <!-- <xsl:choose>
2036
- <xsl:when test="iso:locality/@type = 'section'">Section </xsl:when>
2037
- <xsl:when test="iso:locality/@type = 'clause'">Clause </xsl:when>
2038
- <xsl:otherwise></xsl:otherwise>
2039
- </xsl:choose> -->
2040
- <xsl:apply-templates select="iso:locality"/>
2041
- </xsl:if>
2222
+
2223
+ <xsl:choose>
2224
+ <xsl:when test="@citeas and normalize-space(text()) = ''">
2225
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2226
+ </xsl:when>
2227
+ <xsl:when test="@bibitemid and normalize-space(text()) = ''">
2228
+ <xsl:value-of select="//iso:bibitem[@id = current()/@bibitemid]/iso:docidentifier"/>
2229
+ </xsl:when>
2230
+ <xsl:otherwise/>
2231
+ </xsl:choose>
2232
+ <xsl:apply-templates select="iso:localityStack"/>
2233
+ <xsl:apply-templates select="text()"/>
2042
2234
  </fo:basic-link>
2043
2235
  </xsl:template>
2044
2236
 
2045
2237
  <xsl:template match="iso:locality">
2238
+ <xsl:variable name="title-clause">
2239
+ <xsl:call-template name="getTitle">
2240
+ <xsl:with-param name="name" select="'title-clause'"/>
2241
+ </xsl:call-template>
2242
+ </xsl:variable>
2243
+ <xsl:variable name="title-annex">
2244
+ <xsl:call-template name="getTitle">
2245
+ <xsl:with-param name="name" select="'title-annex'"/>
2246
+ </xsl:call-template>
2247
+ </xsl:variable>
2248
+ <xsl:variable name="title-table">
2249
+ <xsl:call-template name="getTitle">
2250
+ <xsl:with-param name="name" select="'title-table'"/>
2251
+ </xsl:call-template>
2252
+ </xsl:variable>
2046
2253
  <xsl:choose>
2047
- <xsl:when test="@type ='clause'">Clause </xsl:when>
2048
- <xsl:when test="@type ='annex'">Annex </xsl:when>
2254
+ <xsl:when test="ancestor::iso:termsource"/>
2255
+ <xsl:when test="@type ='clause' and ancestor::iso:eref"/>
2256
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
2257
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
2258
+ <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
2049
2259
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2050
2260
  </xsl:choose>
2051
2261
  <xsl:text> </xsl:text><xsl:value-of select="iso:referenceFrom"/>
2052
2262
  </xsl:template>
2053
2263
 
2054
2264
  <xsl:template match="iso:admonition">
2055
- <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2056
- <xsl:value-of select="translate(@type, $lower, $upper)"/>
2265
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2266
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
2057
2267
  <xsl:text> — </xsl:text>
2058
2268
  <xsl:apply-templates/>
2059
2269
  </fo:block>
2060
2270
  </xsl:template>
2061
2271
 
2272
+ <xsl:template match="iso:formula">
2273
+ <fo:block id="{@id}">
2274
+ <xsl:apply-templates/>
2275
+ </fo:block>
2276
+ </xsl:template>
2277
+
2062
2278
  <xsl:template match="iso:formula/iso:dt/iso:stem">
2063
2279
  <fo:inline>
2064
2280
  <xsl:apply-templates/>
@@ -2066,7 +2282,7 @@
2066
2282
  </xsl:template>
2067
2283
 
2068
2284
  <xsl:template match="iso:formula/iso:stem">
2069
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2285
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2070
2286
  <fo:table table-layout="fixed" width="100%">
2071
2287
  <fo:table-column column-width="95%"/>
2072
2288
  <fo:table-column column-width="5%"/>
@@ -2079,14 +2295,9 @@
2079
2295
  </fo:table-cell>
2080
2296
  <fo:table-cell display-align="center">
2081
2297
  <fo:block text-align="right">
2082
- <xsl:choose>
2083
- <xsl:when test="ancestor::iso:annex">
2084
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
2085
- </xsl:when>
2086
- <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
2087
- <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula"/><xsl:text>)</xsl:text> -->
2088
- </xsl:otherwise>
2089
- </xsl:choose>
2298
+ <xsl:call-template name="getFormulaNumber">
2299
+ <xsl:with-param name="display" select="not(../@unnumbered = 'true')"/>
2300
+ </xsl:call-template>
2090
2301
  </fo:block>
2091
2302
  </fo:table-cell>
2092
2303
  </fo:table-row>
@@ -2119,7 +2330,7 @@
2119
2330
  </fo:table-cell>
2120
2331
  <fo:table-cell display-align="center">
2121
2332
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
2122
- <xsl:if test="$stage-name = 'IS'">
2333
+ <xsl:if test="$stage-abbreviation = 'PRF'">
2123
2334
  <xsl:value-of select="$proof-text"/>
2124
2335
  </xsl:if>
2125
2336
  </fo:block>
@@ -2136,16 +2347,8 @@
2136
2347
  <fo:block-container margin-top="13mm" height="9mm" width="172mm" border-top="0.5mm solid black" border-bottom="0.5mm solid black" display-align="center" background-color="white">
2137
2348
  <fo:block text-align-last="justify" font-size="12pt" font-weight="bold">
2138
2349
 
2139
- <xsl:variable name="stgname" select="normalize-space(xalan:nodeset($stage-name-uppercased)/item[@name = $stage-name and @show = 'true']/@header)"/>
2140
- <xsl:if test="$stgname != ''">
2141
- <!-- <xsl:if test="$stage-name = 'final-draft' or $stage-name = 'draft'"> -->
2142
- <!-- <fo:inline><xsl:value-of select="translate(translate($stage-name,'-',' '), $lower,$upper)"/></fo:inline> -->
2143
- <fo:inline><xsl:value-of select="$stgname"/></fo:inline>
2144
- <!-- <xsl:text>&#xA0;</xsl:text> -->
2145
- </xsl:if>
2146
- <xsl:if test="$stgname = ''">
2147
- <fo:inline><xsl:value-of select="$doctype_uppercased"/></fo:inline>
2148
- </xsl:if>
2350
+ <xsl:value-of select="$stagename-header-firstpage"/>
2351
+
2149
2352
  <fo:inline keep-together.within-line="always">
2150
2353
  <fo:leader leader-pattern="space"/>
2151
2354
  <fo:inline><xsl:value-of select="$ISOname"/></fo:inline>
@@ -2171,7 +2374,7 @@
2171
2374
  </fo:table-cell>
2172
2375
  <fo:table-cell display-align="center">
2173
2376
  <fo:block font-size="11pt" font-weight="bold" text-align="center">
2174
- <xsl:if test="$stage-name = 'IS'">
2377
+ <xsl:if test="$stage-abbreviation = 'PRF'">
2175
2378
  <xsl:value-of select="$proof-text"/>
2176
2379
  </xsl:if>
2177
2380
  </fo:block>
@@ -2193,38 +2396,6 @@
2193
2396
  </fo:static-content>
2194
2397
  </xsl:template>
2195
2398
 
2196
- <xsl:template name="getId">
2197
- <xsl:choose>
2198
- <xsl:when test="../@id">
2199
- <xsl:value-of select="../@id"/>
2200
- </xsl:when>
2201
- <xsl:otherwise>
2202
- <xsl:value-of select="text()"/>
2203
- </xsl:otherwise>
2204
- </xsl:choose>
2205
- </xsl:template>
2206
-
2207
- <xsl:template name="getLevel">
2208
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2209
- <xsl:variable name="level">
2210
- <xsl:choose>
2211
- <xsl:when test="ancestor::iso:preface">
2212
- <xsl:value-of select="$level_total - 2"/>
2213
- </xsl:when>
2214
- <xsl:when test="ancestor::iso:sections">
2215
- <xsl:value-of select="$level_total - 2"/>
2216
- </xsl:when>
2217
- <xsl:when test="ancestor::iso:bibliography">
2218
- <xsl:value-of select="$level_total - 2"/>
2219
- </xsl:when>
2220
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2221
- <xsl:otherwise>
2222
- <xsl:value-of select="$level_total - 1"/>
2223
- </xsl:otherwise>
2224
- </xsl:choose>
2225
- </xsl:variable>
2226
- <xsl:value-of select="$level"/>
2227
- </xsl:template>
2228
2399
 
2229
2400
  <xsl:template name="getSection">
2230
2401
  <xsl:param name="sectionNum"/>
@@ -2244,7 +2415,7 @@
2244
2415
  </xsl:when>
2245
2416
  <xsl:when test="$level &gt;= 2">
2246
2417
  <xsl:variable name="num">
2247
- <xsl:number format=".1" level="multiple" count="iso:clause/iso:clause | iso:clause/iso:terms | iso:terms/iso:term | iso:clause/iso:term"/>
2418
+ <xsl:call-template name="getSubSection"/>
2248
2419
  </xsl:variable>
2249
2420
  <xsl:value-of select="concat($sectionNum, $num)"/>
2250
2421
  </xsl:when>
@@ -2265,22 +2436,28 @@
2265
2436
  </xsl:choose>
2266
2437
  </xsl:when> -->
2267
2438
  <xsl:when test="ancestor::iso:annex">
2439
+ <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2268
2440
  <xsl:choose>
2269
2441
  <xsl:when test="$level = 1">
2270
- <xsl:text>Annex </xsl:text>
2442
+ <xsl:variable name="title-annex">
2443
+ <xsl:call-template name="getTitle">
2444
+ <xsl:with-param name="name" select="'title-annex'"/>
2445
+ </xsl:call-template>
2446
+ </xsl:variable>
2447
+ <xsl:value-of select="$title-annex"/>
2271
2448
  <xsl:choose>
2272
- <xsl:when test="count(//iso:annex) = 1">
2273
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid"/>
2449
+ <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2450
+ <xsl:value-of select="$annexid"/>
2274
2451
  </xsl:when>
2275
2452
  <xsl:otherwise>
2276
2453
  <xsl:number format="A" level="any" count="iso:annex"/>
2277
2454
  </xsl:otherwise>
2278
2455
  </xsl:choose>
2279
2456
  </xsl:when>
2280
- <xsl:otherwise>
2457
+ <xsl:otherwise>
2281
2458
  <xsl:choose>
2282
- <xsl:when test="count(//iso:annex) = 1">
2283
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid"/><xsl:number format=".1" level="multiple" count="iso:clause"/>
2459
+ <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2460
+ <xsl:value-of select="$annexid"/><xsl:number format=".1" level="multiple" count="iso:clause"/>
2284
2461
  </xsl:when>
2285
2462
  <xsl:otherwise>
2286
2463
  <xsl:number format="A.1" level="multiple" count="iso:annex | iso:clause"/>
@@ -2896,124 +3073,483 @@
2896
3073
  ubYJPnswvSFSFVBu3ryZJ5fj+e+//wVuVmgt0lkFPgAAAABJRU5ErkJggg==
2897
3074
  </xsl:text>
2898
3075
  </xsl:variable>
2899
- <xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2900
- <xsl:value-of select="."/>
2901
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2902
- <xsl:value-of select="$linebreak"/>
2903
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1">
2904
- <xsl:call-template name="add-zero-spaces"/>
2905
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2906
3076
 
2907
- <xsl:variable name="simple-table">
2908
- <!-- <xsl:copy> -->
2909
- <xsl:call-template name="getSimpleTable"/>
2910
- <!-- </xsl:copy> -->
3077
+ <xsl:template name="number-to-words">
3078
+ <xsl:param name="number"/>
3079
+ <xsl:variable name="words">
3080
+ <words>
3081
+ <word cardinal="1">One-</word>
3082
+ <word ordinal="1">First </word>
3083
+ <word cardinal="2">Two-</word>
3084
+ <word ordinal="2">Second </word>
3085
+ <word cardinal="3">Three-</word>
3086
+ <word ordinal="3">Third </word>
3087
+ <word cardinal="4">Four-</word>
3088
+ <word ordinal="4">Fourth </word>
3089
+ <word cardinal="5">Five-</word>
3090
+ <word ordinal="5">Fifth </word>
3091
+ <word cardinal="6">Six-</word>
3092
+ <word ordinal="6">Sixth </word>
3093
+ <word cardinal="7">Seven-</word>
3094
+ <word ordinal="7">Seventh </word>
3095
+ <word cardinal="8">Eight-</word>
3096
+ <word ordinal="8">Eighth </word>
3097
+ <word cardinal="9">Nine-</word>
3098
+ <word ordinal="9">Ninth </word>
3099
+ <word ordinal="10">Tenth </word>
3100
+ <word ordinal="11">Eleventh </word>
3101
+ <word ordinal="12">Twelfth </word>
3102
+ <word ordinal="13">Thirteenth </word>
3103
+ <word ordinal="14">Fourteenth </word>
3104
+ <word ordinal="15">Fifteenth </word>
3105
+ <word ordinal="16">Sixteenth </word>
3106
+ <word ordinal="17">Seventeenth </word>
3107
+ <word ordinal="18">Eighteenth </word>
3108
+ <word ordinal="19">Nineteenth </word>
3109
+ <word cardinal="20">Twenty-</word>
3110
+ <word ordinal="20">Twentieth </word>
3111
+ <word cardinal="30">Thirty-</word>
3112
+ <word ordinal="30">Thirtieth </word>
3113
+ <word cardinal="40">Forty-</word>
3114
+ <word ordinal="40">Fortieth </word>
3115
+ <word cardinal="50">Fifty-</word>
3116
+ <word ordinal="50">Fiftieth </word>
3117
+ <word cardinal="60">Sixty-</word>
3118
+ <word ordinal="60">Sixtieth </word>
3119
+ <word cardinal="70">Seventy-</word>
3120
+ <word ordinal="70">Seventieth </word>
3121
+ <word cardinal="80">Eighty-</word>
3122
+ <word ordinal="80">Eightieth </word>
3123
+ <word cardinal="90">Ninety-</word>
3124
+ <word ordinal="90">Ninetieth </word>
3125
+ <word cardinal="100">Hundred-</word>
3126
+ <word ordinal="100">Hundredth </word>
3127
+ </words>
2911
3128
  </xsl:variable>
2912
-
2913
- <!-- DEBUG -->
2914
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2915
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2916
-
2917
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2918
-
2919
-
2920
- <fo:block space-before="6pt"> </fo:block>
2921
-
2922
-
3129
+
3130
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
3131
+
2923
3132
  <xsl:choose>
2924
- <xsl:when test="@unnumbered = 'true'"/>
3133
+ <xsl:when test="$ordinal != ''">
3134
+ <xsl:value-of select="$ordinal"/>
3135
+ </xsl:when>
2925
3136
  <xsl:otherwise>
2926
-
2927
-
2928
-
2929
- <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2930
-
2931
-
2932
-
2933
-
2934
-
2935
- <xsl:text>Table </xsl:text>
2936
- <xsl:choose>
2937
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2938
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2939
- </xsl:when>
2940
- <xsl:when test="ancestor::*[local-name()='annex']">
2941
-
2942
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2943
-
2944
-
2945
-
2946
-
2947
-
2948
-
2949
- </xsl:when>
2950
- <xsl:otherwise>
2951
-
2952
-
2953
- <xsl:number format="A." count="*[local-name()='annex']"/>
2954
- <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']"/>
2955
-
2956
- </xsl:otherwise>
2957
- </xsl:choose>
2958
- <xsl:if test="*[local-name()='name']">
2959
-
2960
-
2961
-
2962
- <xsl:text> — </xsl:text>
2963
-
2964
- <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2965
- </xsl:if>
2966
- </fo:block>
2967
-
2968
-
2969
- <xsl:call-template name="fn_name_display"/>
2970
-
3137
+ <xsl:choose>
3138
+ <xsl:when test="$number &lt; 100">
3139
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
3140
+ <xsl:variable name="digit" select="substring($number,2)"/>
3141
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
3142
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
3143
+ </xsl:when>
3144
+ <xsl:otherwise>
3145
+ <!-- more 100 -->
3146
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
3147
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
3148
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
3149
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
3150
+ <xsl:call-template name="number-to-words">
3151
+ <xsl:with-param name="number" select="$digits"/>
3152
+ </xsl:call-template>
3153
+ </xsl:otherwise>
3154
+ </xsl:choose>
2971
3155
  </xsl:otherwise>
2972
3156
  </xsl:choose>
2973
-
2974
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2975
-
2976
- <!-- <xsl:variable name="cols-count">
3157
+ </xsl:template>
3158
+
3159
+ <xsl:template name="printEdition">
3160
+ <xsl:variable name="edition" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:edition)"/>
3161
+ <xsl:text> </xsl:text>
3162
+ <xsl:choose>
3163
+ <xsl:when test="number($edition) = $edition">
3164
+ <xsl:call-template name="number-to-words">
3165
+ <xsl:with-param name="number" select="$edition"/>
3166
+ </xsl:call-template>
3167
+ </xsl:when>
3168
+ <xsl:when test="$edition != ''">
3169
+ <xsl:value-of select="$edition"/>
3170
+ </xsl:when>
3171
+ </xsl:choose>
3172
+ <xsl:variable name="title-edition">
3173
+ <xsl:call-template name="getTitle">
3174
+ <xsl:with-param name="name" select="'title-edition'"/>
3175
+ </xsl:call-template>
3176
+ </xsl:variable>
3177
+ <xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
3178
+ </xsl:template>
3179
+
3180
+ <xsl:template name="printTitlePartFr">
3181
+ <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
3182
+ <xsl:if test="normalize-space($part-fr) != ''">
3183
+ <xsl:if test="$part != ''">
3184
+ <xsl:text> — </xsl:text>
3185
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
3186
+ <!-- <xsl:value-of select="$title-part-fr"/>
3187
+ <xsl:value-of select="$part"/>
3188
+ <xsl:text>:</xsl:text> -->
3189
+ </xsl:if>
3190
+ <xsl:value-of select="$part-fr"/>
3191
+ </xsl:if>
3192
+ </xsl:template>
3193
+
3194
+ <xsl:template name="printTitlePartEn">
3195
+ <xsl:variable name="part-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
3196
+ <xsl:if test="normalize-space($part-en) != ''">
3197
+ <xsl:if test="$part != ''">
3198
+ <xsl:text> — </xsl:text>
3199
+ <fo:block font-weight="normal" margin-top="6pt">
3200
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
3201
+ <!-- <xsl:value-of select="$title-part-en"/>
3202
+ <xsl:value-of select="$part"/>
3203
+ <xsl:text>:</xsl:text> -->
3204
+ </fo:block>
3205
+ </xsl:if>
3206
+ <xsl:value-of select="$part-en"/>
3207
+ </xsl:if>
3208
+ </xsl:template>
3209
+
3210
+ <xsl:template name="getFormulaNumber">
3211
+ <xsl:param name="display" select="'true'"/>
3212
+ <xsl:if test="$display = 'true'">
2977
3213
  <xsl:choose>
2978
- <xsl:when test="*[local-name()='thead']">
2979
- <xsl:call-template name="calculate-columns-numbers">
2980
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2981
- </xsl:call-template>
3214
+ <xsl:when test="ancestor::iso:annex">
3215
+ <xsl:number format="(A.1)" level="multiple" count="iso:annex | iso:formula[not(@unnumbered='true')]"/>
2982
3216
  </xsl:when>
2983
- <xsl:otherwise>
2984
- <xsl:call-template name="calculate-columns-numbers">
2985
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2986
- </xsl:call-template>
3217
+ <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
3218
+ <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula[not(@unnumbered='true')]"/><xsl:text>)</xsl:text>
2987
3219
  </xsl:otherwise>
2988
3220
  </xsl:choose>
2989
- </xsl:variable> -->
2990
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2991
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3221
+ </xsl:if>
3222
+ </xsl:template>
3223
+
3224
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2992
3225
 
3226
+ <title-table lang="en">Table </title-table>
3227
+ <title-table lang="fr">Tableau </title-table>
3228
+
3229
+ <title-table lang="zh">Table </title-table>
2993
3230
 
2994
3231
 
2995
- <xsl:variable name="colwidths">
2996
- <xsl:call-template name="calculate-column-widths">
2997
- <xsl:with-param name="cols-count" select="$cols-count"/>
2998
- <xsl:with-param name="table" select="$simple-table"/>
2999
- </xsl:call-template>
3000
- </xsl:variable>
3232
+
3233
+ <title-note lang="en">NOTE </title-note>
3234
+ <title-note lang="fr">NOTE </title-note>
3001
3235
 
3002
- <xsl:variable name="colwidths2">
3003
- <xsl:call-template name="calculate-column-widths">
3004
- <xsl:with-param name="cols-count" select="$cols-count"/>
3005
- </xsl:call-template>
3006
- </xsl:variable>
3236
+ <title-note lang="zh">NOTE </title-note>
3007
3237
 
3008
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3009
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
3010
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3011
3238
 
3012
- <xsl:variable name="margin-left">
3013
- <xsl:choose>
3014
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3015
- <xsl:otherwise>0</xsl:otherwise>
3016
- </xsl:choose>
3239
+
3240
+ <title-figure lang="en">Figure </title-figure>
3241
+ <title-figure lang="fr">Figure </title-figure>
3242
+
3243
+ <title-figure lang="zh">Figure </title-figure>
3244
+
3245
+
3246
+
3247
+ <title-example lang="en">EXAMPLE </title-example>
3248
+ <title-example lang="fr">EXEMPLE </title-example>
3249
+
3250
+ <title-example lang="zh">EXAMPLE </title-example>
3251
+
3252
+
3253
+
3254
+ <title-example-xref lang="en">Example </title-example-xref>
3255
+ <title-example-xref lang="fr">Exemple </title-example-xref>
3256
+
3257
+ <title-section lang="en">Section </title-section>
3258
+ <title-section lang="fr">Section </title-section>
3259
+
3260
+ <title-inequality lang="en">Inequality </title-inequality>
3261
+ <title-inequality lang="fr">Inequality </title-inequality>
3262
+
3263
+ <title-equation lang="en">Equation </title-equation>
3264
+ <title-equation lang="fr">Equation </title-equation>
3265
+
3266
+ <title-annex lang="en">Annex </title-annex>
3267
+ <title-annex lang="fr">Annexe </title-annex>
3268
+
3269
+ <title-annex lang="zh">Annex </title-annex>
3270
+
3271
+
3272
+
3273
+ <title-appendix lang="en">Appendix </title-appendix>
3274
+ <title-appendix lang="fr">Appendix </title-appendix>
3275
+
3276
+ <title-clause lang="en">Clause </title-clause>
3277
+ <title-clause lang="fr">Article </title-clause>
3278
+
3279
+ <title-clause lang="zh">Clause </title-clause>
3280
+
3281
+
3282
+
3283
+ <title-edition lang="en">
3284
+
3285
+ <xsl:text>Edition </xsl:text>
3286
+
3287
+
3288
+ </title-edition>
3289
+
3290
+ <title-formula lang="en">Formula </title-formula>
3291
+ <title-formula lang="fr">Formula </title-formula>
3292
+
3293
+ <title-toc lang="en">
3294
+
3295
+ <xsl:text>Contents</xsl:text>
3296
+
3297
+
3298
+
3299
+ </title-toc>
3300
+ <title-toc lang="fr">Sommaire</title-toc>
3301
+
3302
+ <title-toc lang="zh">Contents</title-toc>
3303
+
3304
+
3305
+
3306
+ <title-page lang="en">Page</title-page>
3307
+ <title-page lang="fr">Page</title-page>
3308
+
3309
+ <title-key lang="en">Key</title-key>
3310
+ <title-key lang="fr">Légende</title-key>
3311
+
3312
+ <title-where lang="en">where</title-where>
3313
+ <title-where lang="fr">où</title-where>
3314
+
3315
+ <title-descriptors lang="en">Descriptors</title-descriptors>
3316
+
3317
+ <title-part lang="en">
3318
+
3319
+ <xsl:text>Part #:</xsl:text>
3320
+
3321
+
3322
+ </title-part>
3323
+ <title-part lang="fr">
3324
+
3325
+ <xsl:text>Partie #:</xsl:text>
3326
+
3327
+
3328
+ </title-part>
3329
+ <title-part lang="zh">第 # 部分:</title-part>
3330
+
3331
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
3332
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
3333
+
3334
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
3335
+
3336
+
3337
+
3338
+ <title-modified lang="en">modified</title-modified>
3339
+ <title-modified lang="fr">modifiée</title-modified>
3340
+
3341
+ <title-modified lang="zh">modified</title-modified>
3342
+
3343
+
3344
+
3345
+ <title-source lang="en">SOURCE</title-source>
3346
+
3347
+ <title-keywords lang="en">Keywords</title-keywords>
3348
+
3349
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
3350
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
3351
+
3352
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
3353
+
3354
+ <title-list-tables lang="en">List of Tables</title-list-tables>
3355
+
3356
+ <title-list-figures lang="en">List of Figures</title-list-figures>
3357
+
3358
+ <title-recommendation lang="en">Recommendation </title-recommendation>
3359
+
3360
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3361
+
3362
+ <title-abstract lang="en">Abstract</title-abstract>
3363
+
3364
+ <title-summary lang="en">Summary</title-summary>
3365
+
3366
+ <title-in lang="en">in </title-in>
3367
+
3368
+ <title-box lang="en">Box </title-box>
3369
+
3370
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3371
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3372
+
3373
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3374
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3375
+
3376
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3377
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3378
+
3379
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3380
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3381
+
3382
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3383
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3384
+
3385
+ <title-caution lang="en">CAUTION</title-caution>
3386
+ <title-caution lang="zh">注意</title-caution>
3387
+
3388
+ <title-warning lang="en">WARNING</title-warning>
3389
+ <title-warning lang="zh">警告</title-warning>
3390
+
3391
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3392
+ </xsl:variable><xsl:template name="getTitle">
3393
+ <xsl:param name="name"/>
3394
+ <xsl:variable name="lang">
3395
+ <xsl:call-template name="getLang"/>
3396
+ </xsl:variable>
3397
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3398
+ <xsl:choose>
3399
+ <xsl:when test="normalize-space($title_) != ''">
3400
+ <xsl:value-of select="$title_"/>
3401
+ </xsl:when>
3402
+ <xsl:otherwise>
3403
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3404
+ </xsl:otherwise>
3405
+ </xsl:choose>
3406
+ </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">
3407
+
3408
+ <xsl:attribute name="color">blue</xsl:attribute>
3409
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3410
+
3411
+
3412
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
3413
+
3414
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
3415
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
3416
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3417
+
3418
+
3419
+
3420
+
3421
+
3422
+
3423
+
3424
+
3425
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
3426
+
3427
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
3428
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3429
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3430
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3431
+
3432
+
3433
+
3434
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
3435
+
3436
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3437
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
3438
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3439
+
3440
+
3441
+
3442
+ </xsl:attribute-set><xsl:template match="text()">
3443
+ <xsl:value-of select="."/>
3444
+ </xsl:template><xsl:template match="*[local-name()='br']">
3445
+ <xsl:value-of select="$linebreak"/>
3446
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3447
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3448
+ <xsl:call-template name="add-zero-spaces-java"/>
3449
+ </xsl:template><xsl:template match="*[local-name()='table']">
3450
+
3451
+ <xsl:variable name="simple-table">
3452
+ <!-- <xsl:copy> -->
3453
+ <xsl:call-template name="getSimpleTable"/>
3454
+ <!-- </xsl:copy> -->
3455
+ </xsl:variable>
3456
+
3457
+ <!-- DEBUG -->
3458
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
3459
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
3460
+
3461
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3462
+
3463
+ <!-- <xsl:if test="$namespace = 'iso'">
3464
+ <fo:block space-before="6pt">&#xA0;</fo:block>
3465
+ </xsl:if> -->
3466
+
3467
+ <xsl:choose>
3468
+ <xsl:when test="@unnumbered = 'true'"/>
3469
+ <xsl:otherwise>
3470
+
3471
+
3472
+
3473
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
3474
+
3475
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3476
+
3477
+
3478
+
3479
+
3480
+
3481
+
3482
+
3483
+
3484
+ <xsl:variable name="title-table">
3485
+ <xsl:call-template name="getTitle">
3486
+ <xsl:with-param name="name" select="'title-table'"/>
3487
+ </xsl:call-template>
3488
+ </xsl:variable>
3489
+ <xsl:value-of select="$title-table"/>
3490
+
3491
+ <xsl:call-template name="getTableNumber"/>
3492
+
3493
+
3494
+ <xsl:if test="*[local-name()='name']">
3495
+
3496
+
3497
+
3498
+ <xsl:text> — </xsl:text>
3499
+
3500
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3501
+ </xsl:if>
3502
+ </fo:block>
3503
+
3504
+
3505
+ <xsl:call-template name="fn_name_display"/>
3506
+
3507
+ </xsl:otherwise>
3508
+ </xsl:choose>
3509
+
3510
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3511
+
3512
+ <!-- <xsl:variable name="cols-count">
3513
+ <xsl:choose>
3514
+ <xsl:when test="*[local-name()='thead']">
3515
+ <xsl:call-template name="calculate-columns-numbers">
3516
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3517
+ </xsl:call-template>
3518
+ </xsl:when>
3519
+ <xsl:otherwise>
3520
+ <xsl:call-template name="calculate-columns-numbers">
3521
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3522
+ </xsl:call-template>
3523
+ </xsl:otherwise>
3524
+ </xsl:choose>
3525
+ </xsl:variable> -->
3526
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3527
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3528
+
3529
+
3530
+
3531
+ <xsl:variable name="colwidths">
3532
+ <xsl:call-template name="calculate-column-widths">
3533
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3534
+ <xsl:with-param name="table" select="$simple-table"/>
3535
+ </xsl:call-template>
3536
+ </xsl:variable>
3537
+
3538
+ <!-- <xsl:variable name="colwidths2">
3539
+ <xsl:call-template name="calculate-column-widths">
3540
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3541
+ </xsl:call-template>
3542
+ </xsl:variable> -->
3543
+
3544
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3545
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
3546
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3547
+
3548
+ <xsl:variable name="margin-left">
3549
+ <xsl:choose>
3550
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3551
+ <xsl:otherwise>0</xsl:otherwise>
3552
+ </xsl:choose>
3017
3553
  </xsl:variable>
3018
3554
 
3019
3555
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
@@ -3023,11 +3559,24 @@
3023
3559
 
3024
3560
 
3025
3561
 
3026
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
3562
+
3563
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3564
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3565
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3566
+
3567
+
3568
+ <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">
3027
3569
 
3028
3570
  <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
3571
+ <xsl:if test="*[local-name()='thead']">
3572
+ <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
3573
+ </xsl:if>
3574
+
3575
+
3029
3576
 
3030
3577
 
3578
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3579
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3031
3580
 
3032
3581
 
3033
3582
 
@@ -3037,9 +3586,10 @@
3037
3586
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3038
3587
 
3039
3588
 
3589
+
3040
3590
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3041
3591
  <xsl:choose>
3042
- <xsl:when test=". = 1">
3592
+ <xsl:when test=". = 1 or . = 0">
3043
3593
  <fo:table-column column-width="proportional-column-width(2)"/>
3044
3594
  </xsl:when>
3045
3595
  <xsl:otherwise>
@@ -3047,18 +3597,56 @@
3047
3597
  </xsl:otherwise>
3048
3598
  </xsl:choose>
3049
3599
  </xsl:for-each>
3050
- <xsl:apply-templates/>
3600
+
3601
+ <xsl:choose>
3602
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3603
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3604
+ </xsl:when>
3605
+ <xsl:otherwise>
3606
+ <xsl:apply-templates/>
3607
+ </xsl:otherwise>
3608
+ </xsl:choose>
3609
+
3051
3610
  </fo:table>
3611
+
3612
+
3613
+
3052
3614
  </fo:block-container>
3053
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
3615
+ </xsl:template><xsl:template name="getTableNumber">
3616
+ <xsl:choose>
3617
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3618
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3619
+ </xsl:when>
3620
+ <xsl:when test="ancestor::*[local-name()='annex']">
3621
+
3622
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3623
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3624
+
3625
+
3626
+
3627
+
3628
+
3629
+
3630
+
3631
+
3632
+ </xsl:when>
3633
+ <xsl:otherwise>
3634
+
3635
+
3636
+ <xsl:number format="A." count="*[local-name()='annex']"/>
3637
+ <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']"/>
3638
+
3639
+ </xsl:otherwise>
3640
+ </xsl:choose>
3641
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
3054
3642
  <xsl:apply-templates/>
3055
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
3643
+ </xsl:template><xsl:template name="calculate-columns-numbers">
3056
3644
  <xsl:param name="table-row"/>
3057
3645
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
3058
3646
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
3059
3647
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3060
3648
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3061
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
3649
+ </xsl:template><xsl:template name="calculate-column-widths">
3062
3650
  <xsl:param name="table"/>
3063
3651
  <xsl:param name="cols-count"/>
3064
3652
  <xsl:param name="curr-col" select="1"/>
@@ -3067,7 +3655,7 @@
3067
3655
  <xsl:if test="$curr-col &lt;= $cols-count">
3068
3656
  <xsl:variable name="widths">
3069
3657
  <xsl:choose>
3070
- <xsl:when test="not($table)">
3658
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
3071
3659
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
3072
3660
  <xsl:variable name="words">
3073
3661
  <xsl:call-template name="tokenize">
@@ -3102,9 +3690,20 @@
3102
3690
  </xsl:when>
3103
3691
  <xsl:otherwise>
3104
3692
  <xsl:for-each select="xalan:nodeset($table)//tr">
3693
+ <xsl:variable name="td_text">
3694
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3695
+ </xsl:variable>
3105
3696
  <xsl:variable name="words">
3697
+ <xsl:variable name="string_with_added_zerospaces">
3698
+ <xsl:call-template name="add-zero-spaces-java">
3699
+ <xsl:with-param name="text" select="$td_text"/>
3700
+ </xsl:call-template>
3701
+ </xsl:variable>
3106
3702
  <xsl:call-template name="tokenize">
3107
- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
3703
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3704
+ <!-- 2009 thinspace -->
3705
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3706
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
3108
3707
  </xsl:call-template>
3109
3708
  </xsl:variable>
3110
3709
  <xsl:variable name="max_length">
@@ -3145,61 +3744,118 @@
3145
3744
  <xsl:with-param name="table" select="$table"/>
3146
3745
  </xsl:call-template>
3147
3746
  </xsl:if>
3148
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
3149
- <!-- <fo:table-header font-weight="bold">
3150
- <xsl:apply-templates />
3151
- </fo:table-header> -->
3152
- <xsl:apply-templates/>
3153
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
3154
- <xsl:apply-templates/>
3155
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3747
+ </xsl:template><xsl:template match="text()" mode="td_text">
3748
+ <xsl:variable name="zero-space">​</xsl:variable>
3749
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3750
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3751
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3752
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3753
+ <xsl:value-of select="@target"/>
3754
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3755
+ <xsl:param name="cols-count"/>
3756
+ <!-- font-weight="bold" -->
3757
+ <fo:table-header>
3758
+
3759
+ <fo:table-row>
3760
+ <fo:table-cell number-columns-spanned="{$cols-count}"> <!-- border-left="1pt solid white" border-right="1pt solid white" border-top="1pt solid white" -->
3761
+ <fo:block text-align="center" font-size="11pt" font-weight="bold">
3762
+ <!-- (continued) -->
3763
+ <fo:block-container position="absolute" top="-7mm">
3764
+ <fo:block>
3765
+ <fo:retrieve-table-marker retrieve-class-name="table_continued" retrieve-position-within-table="first-starting" retrieve-boundary-within-table="table-fragment"/>
3766
+ </fo:block>
3767
+ </fo:block-container>
3768
+
3769
+ </fo:block>
3770
+ <!-- <fo:block>fn_name_display
3771
+ <xsl:call-template name="fn_name_display"/>
3772
+ </fo:block> -->
3773
+
3774
+ </fo:table-cell>
3775
+ </fo:table-row>
3776
+
3777
+ <xsl:apply-templates/>
3778
+ </fo:table-header>
3779
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3780
+ <fo:table-body>
3781
+ <xsl:apply-templates/>
3782
+ </fo:table-body>
3783
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3784
+ <xsl:apply-templates/>
3785
+ </xsl:template><xsl:template name="insertTableFooter">
3786
+ <xsl:param name="cols-count"/>
3787
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3788
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3789
+
3790
+ <fo:table-footer>
3791
+
3792
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3793
+
3794
+ <!-- if there are note(s) or fn(s) then create footer row -->
3795
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3796
+
3797
+
3798
+
3799
+ <fo:table-row>
3800
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3801
+
3802
+ <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3803
+
3804
+
3805
+
3806
+ <!-- fn will be processed inside 'note' processing -->
3807
+
3808
+
3809
+ <!-- except gb -->
3810
+
3811
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3812
+
3813
+
3814
+ <!-- horizontal row separator -->
3815
+
3816
+
3817
+ <!-- fn processing -->
3818
+ <xsl:call-template name="fn_display"/>
3819
+
3820
+ </fo:table-cell>
3821
+ </fo:table-row>
3822
+
3823
+ </xsl:if>
3824
+ </fo:table-footer>
3825
+
3826
+ </xsl:if>
3827
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3828
+
3156
3829
  <xsl:variable name="cols-count">
3157
3830
  <xsl:choose>
3158
- <xsl:when test="../*[local-name()='thead']">
3159
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3831
+ <xsl:when test="../*[local-name()='thead']">
3160
3832
  <xsl:call-template name="calculate-columns-numbers">
3161
3833
  <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3162
3834
  </xsl:call-template>
3163
3835
  </xsl:when>
3164
- <xsl:otherwise>
3165
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3836
+ <xsl:otherwise>
3166
3837
  <xsl:call-template name="calculate-columns-numbers">
3167
3838
  <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3168
3839
  </xsl:call-template>
3169
3840
  </xsl:otherwise>
3170
3841
  </xsl:choose>
3171
3842
  </xsl:variable>
3172
-
3843
+
3844
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3845
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3846
+ </xsl:apply-templates>
3847
+
3848
+ <xsl:call-template name="insertTableFooter">
3849
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3850
+ </xsl:call-template>
3851
+
3173
3852
  <fo:table-body>
3174
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3175
3853
  <xsl:apply-templates/>
3176
- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
3177
- <!-- if there are note(s) or fn(s) then create footer row -->
3178
- <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
3179
- <fo:table-row>
3180
- <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3181
-
3182
- <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3183
-
3184
-
3185
-
3186
- <!-- fn will be processed inside 'note' processing -->
3187
-
3188
-
3189
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3190
-
3191
- <!-- horizontal row separator -->
3192
-
3193
-
3194
- <!-- fn processing -->
3195
- <xsl:call-template name="fn_display"/>
3196
-
3197
- </fo:table-cell>
3198
- </fo:table-row>
3199
-
3200
- </xsl:if>
3854
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
3855
+
3201
3856
  </fo:table-body>
3202
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3857
+
3858
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3203
3859
  <xsl:variable name="parent-name" select="local-name(..)"/>
3204
3860
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3205
3861
  <fo:table-row min-height="4mm">
@@ -3235,9 +3891,10 @@
3235
3891
 
3236
3892
  </xsl:if>
3237
3893
 
3894
+
3238
3895
  <xsl:apply-templates/>
3239
3896
  </fo:table-row>
3240
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3897
+ </xsl:template><xsl:template match="*[local-name()='th']">
3241
3898
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3242
3899
 
3243
3900
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3262,7 +3919,7 @@
3262
3919
  <xsl:apply-templates/>
3263
3920
  </fo:block>
3264
3921
  </fo:table-cell>
3265
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3922
+ </xsl:template><xsl:template match="*[local-name()='td']">
3266
3923
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3267
3924
  <!-- and ancestor::*[local-name() = 'thead'] -->
3268
3925
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3277,6 +3934,8 @@
3277
3934
 
3278
3935
 
3279
3936
 
3937
+
3938
+
3280
3939
  <xsl:if test="@colspan">
3281
3940
  <xsl:attribute name="number-columns-spanned">
3282
3941
  <xsl:value-of select="@colspan"/>
@@ -3288,6 +3947,26 @@
3288
3947
  </xsl:attribute>
3289
3948
  </xsl:if>
3290
3949
  <fo:block>
3950
+
3951
+ <xsl:variable name="row_number">
3952
+ <xsl:number format="1" count="*[local-name() = 'tr'] | *[local-name() = 'th']"/>
3953
+ </xsl:variable>
3954
+ <fo:marker marker-class-name="table_continued">
3955
+ <xsl:if test="$row_number &gt; 1">
3956
+ <fo:inline>
3957
+ <xsl:variable name="title-table">
3958
+ <xsl:call-template name="getTitle">
3959
+ <xsl:with-param name="name" select="'title-table'"/>
3960
+ </xsl:call-template>
3961
+ </xsl:variable>
3962
+ <xsl:value-of select="$title-table"/>
3963
+ <xsl:call-template name="getTableNumber"/>
3964
+ <xsl:text> </xsl:text>
3965
+ <fo:inline font-style="italic" font-weight="normal">(continued)</fo:inline>
3966
+ </fo:inline>
3967
+ </xsl:if>
3968
+ </fo:marker>
3969
+
3291
3970
  <xsl:apply-templates/>
3292
3971
  </fo:block>
3293
3972
  <!-- <xsl:choose>
@@ -3303,7 +3982,7 @@
3303
3982
 
3304
3983
 
3305
3984
  </fo:table-cell>
3306
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3985
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3307
3986
 
3308
3987
 
3309
3988
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3312,19 +3991,33 @@
3312
3991
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3313
3992
 
3314
3993
 
3994
+
3995
+
3315
3996
  <fo:inline padding-right="2mm">
3316
- <xsl:text>NOTE </xsl:text>
3317
3997
 
3318
3998
 
3319
- <xsl:number format="1 "/>
3999
+ <xsl:variable name="title-note">
4000
+ <xsl:call-template name="getTitle">
4001
+ <xsl:with-param name="name" select="'title-note'"/>
4002
+ </xsl:call-template>
4003
+ </xsl:variable>
4004
+ <xsl:value-of select="$title-note"/>
4005
+
4006
+ <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
4007
+ <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
4008
+ <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
4009
+ </xsl:if>
4010
+
4011
+
4012
+
3320
4013
 
3321
4014
  </fo:inline>
3322
4015
  <xsl:apply-templates mode="process"/>
3323
4016
  </fo:block>
3324
4017
 
3325
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
4018
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3326
4019
  <xsl:apply-templates/>
3327
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
4020
+ </xsl:template><xsl:template name="fn_display">
3328
4021
  <xsl:variable name="references">
3329
4022
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3330
4023
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3343,6 +4036,8 @@
3343
4036
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3344
4037
 
3345
4038
 
4039
+
4040
+
3346
4041
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3347
4042
 
3348
4043
 
@@ -3351,6 +4046,7 @@
3351
4046
 
3352
4047
 
3353
4048
 
4049
+
3354
4050
  <xsl:value-of select="@reference"/>
3355
4051
 
3356
4052
  </fo:inline>
@@ -3361,7 +4057,7 @@
3361
4057
  </fo:block>
3362
4058
  </xsl:if>
3363
4059
  </xsl:for-each>
3364
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
4060
+ </xsl:template><xsl:template name="fn_name_display">
3365
4061
  <!-- <xsl:variable name="references">
3366
4062
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3367
4063
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3377,7 +4073,7 @@
3377
4073
  <xsl:apply-templates/>
3378
4074
  </fo:block>
3379
4075
  </xsl:for-each>
3380
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
4076
+ </xsl:template><xsl:template name="fn_display_figure">
3381
4077
  <xsl:variable name="key_iso">
3382
4078
  true <!-- and (not(@class) or @class !='pseudocode') -->
3383
4079
  </xsl:variable>
@@ -3388,6 +4084,36 @@
3388
4084
  </fn>
3389
4085
  </xsl:for-each>
3390
4086
  </xsl:variable>
4087
+
4088
+ <!-- current hierarchy is 'figure' element -->
4089
+ <xsl:variable name="following_dl_colwidths">
4090
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4091
+ <xsl:variable name="html-table">
4092
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4093
+ <xsl:element name="{$ns}:table">
4094
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4095
+ <tbody>
4096
+ <xsl:apply-templates mode="dl"/>
4097
+ </tbody>
4098
+ </xsl:for-each>
4099
+ </xsl:element>
4100
+ </xsl:variable>
4101
+
4102
+ <xsl:call-template name="calculate-column-widths">
4103
+ <xsl:with-param name="cols-count" select="2"/>
4104
+ <xsl:with-param name="table" select="$html-table"/>
4105
+ </xsl:call-template>
4106
+
4107
+ </xsl:if>
4108
+ </xsl:variable>
4109
+
4110
+
4111
+ <xsl:variable name="maxlength_dt">
4112
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4113
+ <xsl:call-template name="getMaxLength_dt"/>
4114
+ </xsl:for-each>
4115
+ </xsl:variable>
4116
+
3391
4117
  <xsl:if test="xalan:nodeset($references)//fn">
3392
4118
  <fo:block>
3393
4119
  <fo:table width="95%" table-layout="fixed">
@@ -3395,8 +4121,19 @@
3395
4121
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3396
4122
 
3397
4123
  </xsl:if>
3398
- <fo:table-column column-width="15%"/>
3399
- <fo:table-column column-width="85%"/>
4124
+ <xsl:choose>
4125
+ <!-- if there 'dl', then set same columns width -->
4126
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4127
+ <xsl:call-template name="setColumnWidth_dl">
4128
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4129
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4130
+ </xsl:call-template>
4131
+ </xsl:when>
4132
+ <xsl:otherwise>
4133
+ <fo:table-column column-width="15%"/>
4134
+ <fo:table-column column-width="85%"/>
4135
+ </xsl:otherwise>
4136
+ </xsl:choose>
3400
4137
  <fo:table-body>
3401
4138
  <xsl:for-each select="xalan:nodeset($references)//fn">
3402
4139
  <xsl:variable name="reference" select="@reference"/>
@@ -3428,7 +4165,7 @@
3428
4165
  </fo:block>
3429
4166
  </xsl:if>
3430
4167
 
3431
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
4168
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3432
4169
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3433
4170
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3434
4171
 
@@ -3440,16 +4177,17 @@
3440
4177
 
3441
4178
 
3442
4179
 
4180
+
3443
4181
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3444
4182
 
3445
4183
  <xsl:value-of select="@reference"/>
3446
4184
  </fo:basic-link>
3447
4185
  </fo:inline>
3448
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
4186
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3449
4187
  <fo:inline>
3450
4188
  <xsl:apply-templates/>
3451
4189
  </fo:inline>
3452
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
4190
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3453
4191
  <xsl:variable name="parent" select="local-name(..)"/>
3454
4192
 
3455
4193
  <xsl:variable name="key_iso">
@@ -3466,7 +4204,12 @@
3466
4204
 
3467
4205
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3468
4206
 
3469
- <xsl:text>where </xsl:text>
4207
+ <xsl:variable name="title-where">
4208
+ <xsl:call-template name="getTitle">
4209
+ <xsl:with-param name="name" select="'title-where'"/>
4210
+ </xsl:call-template>
4211
+ </xsl:variable>
4212
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3470
4213
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3471
4214
  <xsl:text/>
3472
4215
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3480,17 +4223,29 @@
3480
4223
 
3481
4224
 
3482
4225
 
3483
- <xsl:text>where</xsl:text>
4226
+
4227
+ <xsl:variable name="title-where">
4228
+ <xsl:call-template name="getTitle">
4229
+ <xsl:with-param name="name" select="'title-where'"/>
4230
+ </xsl:call-template>
4231
+ </xsl:variable>
4232
+ <xsl:value-of select="$title-where"/>
3484
4233
  </fo:block>
3485
4234
  </xsl:when>
3486
4235
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3487
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
4236
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3488
4237
 
3489
4238
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3490
4239
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3491
4240
 
3492
4241
 
3493
- <xsl:text>Key</xsl:text>
4242
+
4243
+ <xsl:variable name="title-key">
4244
+ <xsl:call-template name="getTitle">
4245
+ <xsl:with-param name="name" select="'title-key'"/>
4246
+ </xsl:call-template>
4247
+ </xsl:variable>
4248
+ <xsl:value-of select="$title-key"/>
3494
4249
  </fo:block>
3495
4250
  </xsl:when>
3496
4251
  </xsl:choose>
@@ -3502,31 +4257,18 @@
3502
4257
  <xsl:if test="$parent = 'formula'">
3503
4258
  <xsl:attribute name="margin-left">4mm</xsl:attribute>
3504
4259
  </xsl:if>
4260
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3505
4261
 
3506
4262
 
3507
4263
 
3508
4264
 
3509
4265
  <fo:block>
3510
4266
 
3511
- <!-- create virtual html table for dl/[dt and dd] -->
3512
- <xsl:variable name="html-table">
3513
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3514
- <xsl:element name="{$ns}:table">
3515
- <tbody>
3516
- <xsl:apply-templates mode="dl"/>
3517
- </tbody>
3518
- </xsl:element>
3519
- </xsl:variable>
3520
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3521
- <xsl:variable name="colwidths">
3522
- <xsl:call-template name="calculate-column-widths">
3523
- <xsl:with-param name="cols-count" select="2"/>
3524
- <xsl:with-param name="table" select="$html-table"/>
3525
- </xsl:call-template>
3526
- </xsl:variable>
3527
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4267
+
4268
+
3528
4269
 
3529
4270
  <fo:table width="95%" table-layout="fixed">
4271
+
3530
4272
  <xsl:choose>
3531
4273
  <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
3532
4274
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -3536,42 +4278,30 @@
3536
4278
 
3537
4279
  </xsl:when>
3538
4280
  </xsl:choose>
3539
- <xsl:choose>
3540
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3541
- <fo:table-column column-width="50%"/>
3542
- <fo:table-column column-width="50%"/>
3543
- </xsl:when>
3544
- <xsl:otherwise>
3545
- <xsl:choose>
3546
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3547
- <fo:table-column column-width="60%"/>
3548
- <fo:table-column column-width="40%"/>
3549
- </xsl:when> -->
3550
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3551
- <fo:table-column column-width="50%"/>
3552
- <fo:table-column column-width="50%"/>
3553
- </xsl:when>
3554
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3555
- <fo:table-column column-width="40%"/>
3556
- <fo:table-column column-width="60%"/>
3557
- </xsl:when>
3558
- <xsl:otherwise>
3559
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3560
- <xsl:choose>
3561
- <xsl:when test=". = 1">
3562
- <fo:table-column column-width="proportional-column-width(2)"/>
3563
- </xsl:when>
3564
- <xsl:otherwise>
3565
- <fo:table-column column-width="proportional-column-width({.})"/>
3566
- </xsl:otherwise>
3567
- </xsl:choose>
3568
- </xsl:for-each>
3569
- </xsl:otherwise>
3570
- </xsl:choose>
3571
- <!-- <fo:table-column column-width="15%"/>
3572
- <fo:table-column column-width="85%"/> -->
3573
- </xsl:otherwise>
3574
- </xsl:choose>
4281
+ <!-- create virtual html table for dl/[dt and dd] -->
4282
+ <xsl:variable name="html-table">
4283
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4284
+ <xsl:element name="{$ns}:table">
4285
+ <tbody>
4286
+ <xsl:apply-templates mode="dl"/>
4287
+ </tbody>
4288
+ </xsl:element>
4289
+ </xsl:variable>
4290
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
4291
+ <xsl:variable name="colwidths">
4292
+ <xsl:call-template name="calculate-column-widths">
4293
+ <xsl:with-param name="cols-count" select="2"/>
4294
+ <xsl:with-param name="table" select="$html-table"/>
4295
+ </xsl:call-template>
4296
+ </xsl:variable>
4297
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4298
+ <xsl:variable name="maxlength_dt">
4299
+ <xsl:call-template name="getMaxLength_dt"/>
4300
+ </xsl:variable>
4301
+ <xsl:call-template name="setColumnWidth_dl">
4302
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4303
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4304
+ </xsl:call-template>
3575
4305
  <fo:table-body>
3576
4306
  <xsl:apply-templates>
3577
4307
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3581,7 +4311,61 @@
3581
4311
  </fo:block>
3582
4312
  </fo:block>
3583
4313
  </xsl:if>
3584
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
4314
+ </xsl:template><xsl:template name="setColumnWidth_dl">
4315
+ <xsl:param name="colwidths"/>
4316
+ <xsl:param name="maxlength_dt"/>
4317
+ <xsl:choose>
4318
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4319
+ <fo:table-column column-width="50%"/>
4320
+ <fo:table-column column-width="50%"/>
4321
+ </xsl:when>
4322
+ <xsl:otherwise>
4323
+ <xsl:choose>
4324
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4325
+ <fo:table-column column-width="5%"/>
4326
+ <fo:table-column column-width="95%"/>
4327
+ </xsl:when>
4328
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
4329
+ <fo:table-column column-width="10%"/>
4330
+ <fo:table-column column-width="90%"/>
4331
+ </xsl:when>
4332
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4333
+ <fo:table-column column-width="60%"/>
4334
+ <fo:table-column column-width="40%"/>
4335
+ </xsl:when> -->
4336
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4337
+ <fo:table-column column-width="50%"/>
4338
+ <fo:table-column column-width="50%"/>
4339
+ </xsl:when>
4340
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4341
+ <fo:table-column column-width="40%"/>
4342
+ <fo:table-column column-width="60%"/>
4343
+ </xsl:when>
4344
+ <xsl:otherwise>
4345
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4346
+ <xsl:choose>
4347
+ <xsl:when test=". = 1 or . = 0">
4348
+ <fo:table-column column-width="proportional-column-width(2)"/>
4349
+ </xsl:when>
4350
+ <xsl:otherwise>
4351
+ <fo:table-column column-width="proportional-column-width({.})"/>
4352
+ </xsl:otherwise>
4353
+ </xsl:choose>
4354
+ </xsl:for-each>
4355
+ </xsl:otherwise>
4356
+ </xsl:choose>
4357
+ <!-- <fo:table-column column-width="15%"/>
4358
+ <fo:table-column column-width="85%"/> -->
4359
+ </xsl:otherwise>
4360
+ </xsl:choose>
4361
+ </xsl:template><xsl:template name="getMaxLength_dt">
4362
+ <xsl:for-each select="*[local-name()='dt']">
4363
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
4364
+ <xsl:if test="position() = 1">
4365
+ <xsl:value-of select="string-length(normalize-space(.))"/>
4366
+ </xsl:if>
4367
+ </xsl:for-each>
4368
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3585
4369
  <xsl:param name="key_iso"/>
3586
4370
 
3587
4371
  <!-- <tr>
@@ -3597,7 +4381,12 @@
3597
4381
  <xsl:if test="normalize-space($key_iso) = 'true'">
3598
4382
  <xsl:attribute name="margin-top">0</xsl:attribute>
3599
4383
  </xsl:if>
3600
- NOTE
4384
+ <xsl:variable name="title-note">
4385
+ <xsl:call-template name="getTitle">
4386
+ <xsl:with-param name="name" select="'title-note'"/>
4387
+ </xsl:call-template>
4388
+ </xsl:variable>
4389
+ <xsl:value-of select="$title-note"/>
3601
4390
  </fo:block>
3602
4391
  </fo:table-cell>
3603
4392
  <fo:table-cell>
@@ -3606,7 +4395,7 @@
3606
4395
  </fo:block>
3607
4396
  </fo:table-cell>
3608
4397
  </fo:table-row>
3609
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
4398
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3610
4399
  <tr>
3611
4400
  <td>
3612
4401
  <xsl:apply-templates/>
@@ -3619,20 +4408,32 @@
3619
4408
  </td>
3620
4409
  </tr>
3621
4410
 
3622
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
4411
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3623
4412
  <xsl:param name="key_iso"/>
3624
4413
 
3625
4414
  <fo:table-row>
3626
4415
  <fo:table-cell>
4416
+
3627
4417
  <fo:block margin-top="6pt">
3628
4418
 
4419
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
4420
+
4421
+
3629
4422
  <xsl:if test="normalize-space($key_iso) = 'true'">
3630
4423
  <xsl:attribute name="margin-top">0</xsl:attribute>
3631
4424
 
3632
4425
  </xsl:if>
3633
4426
 
3634
4427
 
4428
+
4429
+
4430
+
3635
4431
  <xsl:apply-templates/>
4432
+ <!-- <xsl:if test="$namespace = 'gb'">
4433
+ <xsl:if test="ancestor::*[local-name()='formula']">
4434
+ <xsl:text>—</xsl:text>
4435
+ </xsl:if>
4436
+ </xsl:if> -->
3636
4437
  </fo:block>
3637
4438
  </fo:table-cell>
3638
4439
  <fo:table-cell>
@@ -3646,37 +4447,37 @@
3646
4447
  </fo:table-cell>
3647
4448
  </fo:table-row>
3648
4449
 
3649
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
4450
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3650
4451
  <xsl:apply-templates/>
3651
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
4452
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3652
4453
  <xsl:apply-templates/>
3653
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3654
- <fo:inline><xsl:apply-templates/></fo:inline>
3655
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
4454
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4455
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4456
+ </xsl:template><xsl:template match="*[local-name()='em']">
3656
4457
  <fo:inline font-style="italic">
3657
4458
  <xsl:apply-templates/>
3658
4459
  </fo:inline>
3659
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
4460
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3660
4461
  <fo:inline font-weight="bold">
3661
4462
  <xsl:apply-templates/>
3662
4463
  </fo:inline>
3663
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
4464
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3664
4465
  <fo:inline font-size="80%" vertical-align="super">
3665
4466
  <xsl:apply-templates/>
3666
4467
  </fo:inline>
3667
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
4468
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3668
4469
  <fo:inline font-size="80%" vertical-align="sub">
3669
4470
  <xsl:apply-templates/>
3670
4471
  </fo:inline>
3671
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3672
- <fo:inline font-family="Courier" font-size="10pt">
4472
+ </xsl:template><xsl:template match="*[local-name()='tt']">
4473
+ <fo:inline font-family="Courier" font-size="10pt">
3673
4474
  <xsl:apply-templates/>
3674
4475
  </fo:inline>
3675
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
4476
+ </xsl:template><xsl:template match="*[local-name()='del']">
3676
4477
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3677
4478
  <xsl:apply-templates/>
3678
4479
  </fo:inline>
3679
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
4480
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3680
4481
  <xsl:variable name="text" select="normalize-space(.)"/>
3681
4482
  <fo:inline font-size="75%">
3682
4483
  <xsl:if test="string-length($text) &gt; 0">
@@ -3685,10 +4486,11 @@
3685
4486
  </xsl:call-template>
3686
4487
  </xsl:if>
3687
4488
  </fo:inline>
3688
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
4489
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3689
4490
  <xsl:param name="text"/>
3690
4491
  <xsl:variable name="char" select="substring($text,1,1)"/>
3691
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4492
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4493
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3692
4494
  <xsl:choose>
3693
4495
  <xsl:when test="$char=$upperCase">
3694
4496
  <fo:inline font-size="{100 div 0.75}%">
@@ -3704,7 +4506,7 @@
3704
4506
  <xsl:with-param name="text" select="substring($text,2)"/>
3705
4507
  </xsl:call-template>
3706
4508
  </xsl:if>
3707
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
4509
+ </xsl:template><xsl:template name="tokenize">
3708
4510
  <xsl:param name="text"/>
3709
4511
  <xsl:param name="separator" select="' '"/>
3710
4512
  <xsl:choose>
@@ -3752,7 +4554,7 @@
3752
4554
  </xsl:call-template>
3753
4555
  </xsl:otherwise>
3754
4556
  </xsl:choose>
3755
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
4557
+ </xsl:template><xsl:template name="max_length">
3756
4558
  <xsl:param name="words"/>
3757
4559
  <xsl:for-each select="$words//word">
3758
4560
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3760,12 +4562,17 @@
3760
4562
  <xsl:value-of select="."/>
3761
4563
  </xsl:if>
3762
4564
  </xsl:for-each>
3763
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
4565
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4566
+ <xsl:param name="text" select="."/>
4567
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4568
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4569
+ </xsl:template><xsl:template name="add-zero-spaces">
3764
4570
  <xsl:param name="text" select="."/>
3765
4571
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3766
4572
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3767
4573
  <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3768
4574
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4575
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3769
4576
  <xsl:variable name="zero-space">​</xsl:variable>
3770
4577
  <xsl:choose>
3771
4578
  <xsl:when test="contains($text, $zero-space-after-chars)">
@@ -3800,11 +4607,19 @@
3800
4607
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3801
4608
  </xsl:call-template>
3802
4609
  </xsl:when>
4610
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
4611
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
4612
+ <xsl:value-of select="$zero-space-after-underscore"/>
4613
+ <xsl:value-of select="$zero-space"/>
4614
+ <xsl:call-template name="add-zero-spaces">
4615
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
4616
+ </xsl:call-template>
4617
+ </xsl:when>
3803
4618
  <xsl:otherwise>
3804
4619
  <xsl:value-of select="$text"/>
3805
4620
  </xsl:otherwise>
3806
4621
  </xsl:choose>
3807
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
4622
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3808
4623
  <xsl:param name="text" select="."/>
3809
4624
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3810
4625
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3830,7 +4645,7 @@
3830
4645
  <xsl:value-of select="$text"/>
3831
4646
  </xsl:otherwise>
3832
4647
  </xsl:choose>
3833
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
4648
+ </xsl:template><xsl:template name="getSimpleTable">
3834
4649
  <xsl:variable name="simple-table">
3835
4650
 
3836
4651
  <!-- Step 1. colspan processing -->
@@ -3857,9 +4672,9 @@
3857
4672
  </xsl:choose> -->
3858
4673
  </xsl:variable>
3859
4674
  <xsl:copy-of select="$simple-table"/>
3860
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4675
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3861
4676
  <xsl:apply-templates mode="simple-table-colspan"/>
3862
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4677
+ </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">
3863
4678
  <xsl:choose>
3864
4679
  <xsl:when test="@colspan">
3865
4680
  <xsl:variable name="td">
@@ -3881,16 +4696,16 @@
3881
4696
  </xsl:element>
3882
4697
  </xsl:otherwise>
3883
4698
  </xsl:choose>
3884
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
4699
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3885
4700
  <xsl:element name="tr">
3886
4701
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3887
4702
  <xsl:apply-templates mode="simple-table-colspan"/>
3888
4703
  </xsl:element>
3889
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
4704
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3890
4705
  <xsl:copy>
3891
4706
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3892
4707
  </xsl:copy>
3893
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
4708
+ </xsl:template><xsl:template name="repeatNode">
3894
4709
  <xsl:param name="count"/>
3895
4710
  <xsl:param name="node"/>
3896
4711
 
@@ -3901,18 +4716,18 @@
3901
4716
  </xsl:call-template>
3902
4717
  <xsl:copy-of select="$node"/>
3903
4718
  </xsl:if>
3904
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
4719
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3905
4720
  <xsl:copy>
3906
4721
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3907
4722
  </xsl:copy>
3908
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
4723
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3909
4724
  <xsl:copy>
3910
4725
  <xsl:copy-of select="tr[1]"/>
3911
4726
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3912
4727
  <xsl:with-param name="previousRow" select="tr[1]"/>
3913
4728
  </xsl:apply-templates>
3914
4729
  </xsl:copy>
3915
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4730
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3916
4731
  <xsl:param name="previousRow"/>
3917
4732
  <xsl:variable name="currentRow" select="."/>
3918
4733
 
@@ -3946,34 +4761,322 @@
3946
4761
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3947
4762
  <xsl:with-param name="previousRow" select="$newRow"/>
3948
4763
  </xsl:apply-templates>
3949
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4764
+ </xsl:template><xsl:template name="getLang">
3950
4765
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3951
4766
  <xsl:choose>
3952
4767
  <xsl:when test="$language = 'English'">en</xsl:when>
3953
4768
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3954
4769
  </xsl:choose>
3955
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4770
+ </xsl:template><xsl:template name="capitalizeWords">
3956
4771
  <xsl:param name="str"/>
3957
4772
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3958
4773
  <xsl:choose>
3959
4774
  <xsl:when test="contains($str2, ' ')">
3960
4775
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3961
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3962
- <xsl:value-of select="substring($substr, 2)"/>
4776
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4777
+ <xsl:value-of select="substring($substr, 2)"/> -->
4778
+ <xsl:call-template name="capitalize">
4779
+ <xsl:with-param name="str" select="$substr"/>
4780
+ </xsl:call-template>
3963
4781
  <xsl:text> </xsl:text>
3964
4782
  <xsl:call-template name="capitalizeWords">
3965
4783
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3966
4784
  </xsl:call-template>
3967
4785
  </xsl:when>
3968
4786
  <xsl:otherwise>
3969
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3970
- <xsl:value-of select="substring($str2, 2)"/>
4787
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4788
+ <xsl:value-of select="substring($str2, 2)"/> -->
4789
+ <xsl:call-template name="capitalize">
4790
+ <xsl:with-param name="str" select="$str2"/>
4791
+ </xsl:call-template>
3971
4792
  </xsl:otherwise>
3972
4793
  </xsl:choose>
3973
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns: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" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4794
+ </xsl:template><xsl:template name="capitalize">
4795
+ <xsl:param name="str"/>
4796
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4797
+ <xsl:value-of select="substring($str, 2)"/>
4798
+ </xsl:template><xsl:template match="mathml:math">
3974
4799
  <fo:inline font-family="STIX2Math">
3975
4800
  <fo:instream-foreign-object fox:alt-text="Math">
3976
4801
  <xsl:copy-of select="."/>
3977
4802
  </fo:instream-foreign-object>
3978
4803
  </fo:inline>
4804
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
4805
+ <xsl:for-each select="*[local-name()='locality']">
4806
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4807
+ <xsl:apply-templates select="."/>
4808
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4809
+ </xsl:for-each>
4810
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
4811
+ <xsl:variable name="target">
4812
+ <xsl:choose>
4813
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4814
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
4815
+ </xsl:when>
4816
+ <xsl:otherwise>
4817
+ <xsl:value-of select="normalize-space(@target)"/>
4818
+ </xsl:otherwise>
4819
+ </xsl:choose>
4820
+ </xsl:variable>
4821
+ <fo:inline xsl:use-attribute-sets="link-style">
4822
+ <xsl:choose>
4823
+ <xsl:when test="$target = ''">
4824
+ <xsl:apply-templates/>
4825
+ </xsl:when>
4826
+ <xsl:otherwise>
4827
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4828
+ <xsl:choose>
4829
+ <xsl:when test="normalize-space(.) = ''">
4830
+ <xsl:value-of select="$target"/>
4831
+ </xsl:when>
4832
+ <xsl:otherwise>
4833
+ <xsl:apply-templates/>
4834
+ </xsl:otherwise>
4835
+ </xsl:choose>
4836
+ </fo:basic-link>
4837
+ </xsl:otherwise>
4838
+ </xsl:choose>
4839
+ </fo:inline>
4840
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4841
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4842
+ <!-- <xsl:choose>
4843
+ <xsl:when test="@lang = 'en'"></xsl:when>
4844
+ <xsl:otherwise> -->
4845
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4846
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4847
+ <!-- </xsl:otherwise>
4848
+ </xsl:choose> -->
4849
+ <xsl:apply-templates/>
4850
+ </fo:block>
4851
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4852
+ <fo:inline id="{@id}"/>
4853
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4854
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4855
+ <xsl:variable name="title-appendix">
4856
+ <xsl:call-template name="getTitle">
4857
+ <xsl:with-param name="name" select="'title-appendix'"/>
4858
+ </xsl:call-template>
4859
+ </xsl:variable>
4860
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4861
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4862
+ </fo:block>
4863
+ <xsl:apply-templates/>
4864
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4865
+ <fo:inline><xsl:apply-templates/></fo:inline>
4866
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4867
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4868
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4869
+ <xsl:variable name="title-example">
4870
+ <xsl:call-template name="getTitle">
4871
+ <xsl:with-param name="name" select="'title-example'"/>
4872
+ </xsl:call-template>
4873
+ </xsl:variable>
4874
+ <xsl:value-of select="$title-example"/>
4875
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4876
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4877
+ </xsl:if>
4878
+ <xsl:if test="*[local-name()='name']">
4879
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4880
+ </xsl:if>
4881
+ </fo:block>
4882
+ <xsl:apply-templates/>
4883
+ </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">
4884
+ <fo:inline><xsl:apply-templates/></fo:inline>
4885
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4886
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4887
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4888
+ <xsl:variable name="annotation-id" select="@id"/>
4889
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4890
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4891
+ <fo:inline>
4892
+ <xsl:apply-templates>
4893
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4894
+ </xsl:apply-templates>
4895
+ </fo:inline>
4896
+ </fo:block>
4897
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4898
+ <xsl:param name="callout"/>
4899
+ <fo:inline id="{@id}">
4900
+ <!-- for first p in annotation, put <x> -->
4901
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4902
+ <xsl:apply-templates/>
4903
+ </fo:inline>
4904
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4905
+ <xsl:variable name="title-modified">
4906
+ <xsl:call-template name="getTitle">
4907
+ <xsl:with-param name="name" select="'title-modified'"/>
4908
+ </xsl:call-template>
4909
+ </xsl:variable>
4910
+ <xsl:choose>
4911
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4912
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4913
+ </xsl:choose>
4914
+ <xsl:apply-templates/>
4915
+ </xsl:template><xsl:template name="convertDate">
4916
+ <xsl:param name="date"/>
4917
+ <xsl:param name="format" select="'short'"/>
4918
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4919
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4920
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4921
+ <xsl:variable name="monthStr">
4922
+ <xsl:choose>
4923
+ <xsl:when test="$month = '01'">January</xsl:when>
4924
+ <xsl:when test="$month = '02'">February</xsl:when>
4925
+ <xsl:when test="$month = '03'">March</xsl:when>
4926
+ <xsl:when test="$month = '04'">April</xsl:when>
4927
+ <xsl:when test="$month = '05'">May</xsl:when>
4928
+ <xsl:when test="$month = '06'">June</xsl:when>
4929
+ <xsl:when test="$month = '07'">July</xsl:when>
4930
+ <xsl:when test="$month = '08'">August</xsl:when>
4931
+ <xsl:when test="$month = '09'">September</xsl:when>
4932
+ <xsl:when test="$month = '10'">October</xsl:when>
4933
+ <xsl:when test="$month = '11'">November</xsl:when>
4934
+ <xsl:when test="$month = '12'">December</xsl:when>
4935
+ </xsl:choose>
4936
+ </xsl:variable>
4937
+ <xsl:variable name="result">
4938
+ <xsl:choose>
4939
+ <xsl:when test="$format = 'short' or $day = ''">
4940
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4941
+ </xsl:when>
4942
+ <xsl:otherwise>
4943
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4944
+ </xsl:otherwise>
4945
+ </xsl:choose>
4946
+ </xsl:variable>
4947
+ <xsl:value-of select="$result"/>
4948
+ </xsl:template><xsl:template name="insertKeywords">
4949
+ <xsl:param name="sorting" select="'true'"/>
4950
+ <xsl:param name="charAtEnd" select="'.'"/>
4951
+ <xsl:param name="charDelim" select="', '"/>
4952
+ <xsl:choose>
4953
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4954
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4955
+ <xsl:sort data-type="text" order="ascending"/>
4956
+ <xsl:call-template name="insertKeyword">
4957
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4958
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4959
+ </xsl:call-template>
4960
+ </xsl:for-each>
4961
+ </xsl:when>
4962
+ <xsl:otherwise>
4963
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4964
+ <xsl:call-template name="insertKeyword">
4965
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4966
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4967
+ </xsl:call-template>
4968
+ </xsl:for-each>
4969
+ </xsl:otherwise>
4970
+ </xsl:choose>
4971
+ </xsl:template><xsl:template name="insertKeyword">
4972
+ <xsl:param name="charAtEnd"/>
4973
+ <xsl:param name="charDelim"/>
4974
+ <xsl:apply-templates/>
4975
+ <xsl:choose>
4976
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4977
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4978
+ </xsl:choose>
4979
+ </xsl:template><xsl:template name="addPDFUAmeta">
4980
+ <fo:declarations>
4981
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4982
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4983
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4984
+ </pdf:dictionary>
4985
+ </pdf:catalog>
4986
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4987
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4988
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4989
+ <!-- Dublin Core properties go here -->
4990
+ <dc:title>
4991
+ <xsl:variable name="title">
4992
+
4993
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4994
+
4995
+
4996
+
4997
+
4998
+ </xsl:variable>
4999
+ <xsl:choose>
5000
+ <xsl:when test="normalize-space($title) != ''">
5001
+ <xsl:value-of select="$title"/>
5002
+ </xsl:when>
5003
+ <xsl:otherwise>
5004
+ <xsl:text> </xsl:text>
5005
+ </xsl:otherwise>
5006
+ </xsl:choose>
5007
+ </dc:title>
5008
+ <dc:creator>
5009
+
5010
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5011
+
5012
+
5013
+ </dc:creator>
5014
+ <dc:description>
5015
+ <xsl:variable name="abstract">
5016
+
5017
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5018
+
5019
+
5020
+
5021
+
5022
+ </xsl:variable>
5023
+ <xsl:value-of select="normalize-space($abstract)"/>
5024
+ </dc:description>
5025
+ <pdf:Keywords>
5026
+ <xsl:call-template name="insertKeywords"/>
5027
+ </pdf:Keywords>
5028
+ </rdf:Description>
5029
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5030
+ <!-- XMP properties go here -->
5031
+ <xmp:CreatorTool/>
5032
+ </rdf:Description>
5033
+ </rdf:RDF>
5034
+ </x:xmpmeta>
5035
+ </fo:declarations>
5036
+ </xsl:template><xsl:template name="getId">
5037
+ <xsl:choose>
5038
+ <xsl:when test="../@id">
5039
+ <xsl:value-of select="../@id"/>
5040
+ </xsl:when>
5041
+ <xsl:otherwise>
5042
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
5043
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
5044
+ </xsl:otherwise>
5045
+ </xsl:choose>
5046
+ </xsl:template><xsl:template name="getLevel">
5047
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
5048
+ <xsl:variable name="level">
5049
+ <xsl:choose>
5050
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
5051
+ <xsl:value-of select="$level_total - 2"/>
5052
+ </xsl:when>
5053
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
5054
+ <xsl:value-of select="$level_total - 2"/>
5055
+ </xsl:when>
5056
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
5057
+ <xsl:value-of select="$level_total - 2"/>
5058
+ </xsl:when>
5059
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
5060
+ <xsl:otherwise>
5061
+ <xsl:value-of select="$level_total - 1"/>
5062
+ </xsl:otherwise>
5063
+ </xsl:choose>
5064
+ </xsl:variable>
5065
+ <xsl:value-of select="$level"/>
5066
+ </xsl:template><xsl:template name="getSubSection">
5067
+ <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']"/>
5068
+ </xsl:template><xsl:template name="split">
5069
+ <xsl:param name="pText" select="."/>
5070
+ <xsl:param name="sep" select="','"/>
5071
+ <xsl:if test="string-length($pText) &gt;0">
5072
+ <item>
5073
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
5074
+ </item>
5075
+ <xsl:call-template name="split">
5076
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
5077
+ <xsl:with-param name="sep" select="$sep"/>
5078
+ </xsl:call-template>
5079
+ </xsl:if>
5080
+ </xsl:template><xsl:template name="getDocumentId">
5081
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3979
5082
  </xsl:template></xsl:stylesheet>