metanorma-csd 1.3.18 → 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd85f423cbaf23cf06f7a12824a9ac55820b5a2f4bc3ba147edcee0e742b196f
4
- data.tar.gz: 7e8d2efae6e2a35e82a6375f2eef419715775060dfcd3af39e4c9a78c440e6a4
3
+ metadata.gz: 881f43014e3a443f15676ec0b13eebdc423dfdbbc05593f49c8f655293036fd7
4
+ data.tar.gz: 1a91dc808a3a96f6693131d068bb98191ef1b4f14a88f0e6975e9c9cc1e18acd
5
5
  SHA512:
6
- metadata.gz: 8e3f9f1453851366fd2c562596f8f5cd9b617508cd267318b993589a3021037f68aeb8b129711abaf36cad408870a587862ec671710be7a1c26b5e99402bd57c
7
- data.tar.gz: 57e3820a858a744f2261a886a9128545fbbc888d4ed8c7139758dd3a78d65cddd2664d265bf2346295d2fa1ccea1c8fc6ab9a78d534e9c9be7bb1c7d9b9467fe
6
+ metadata.gz: f811ae3cc09e60957bd2d838036d2e11ed5edfa0cc6d6c35ece2443133e0d1015fc5a52fb4c31d4876c3eacf783858dc477b47460e6f3464ddbc76be952eeb9a
7
+ data.tar.gz: a72826aa9226cd914614e3636b9f2296d09c63cde81d520d4867df5de3cba7a2f691d72953c55b8339cbf1c2e42cfc911ae33d2d9d18431a85245c6cc0f91478
@@ -26,13 +26,6 @@ jobs:
26
26
  run: |
27
27
  sudo gem install bundler --force
28
28
  bundle install --jobs 4 --retry 3
29
- - name: Use Node
30
- uses: actions/setup-node@v1
31
- with:
32
- node-version: '8'
33
- - name: Install Puppeteer
34
- run: |
35
- npm install -g puppeteer
36
29
  - name: Run specs
37
30
  run: |
38
31
  bundle exec rake
@@ -26,18 +26,11 @@ jobs:
26
26
  run: |
27
27
  gem install bundler
28
28
  bundle install --jobs 4 --retry 3
29
- - name: Use Node
30
- uses: actions/setup-node@v1
31
- with:
32
- node-version: '8'
33
- - name: Install Puppeteer
34
- run: |
35
- npm install -g puppeteer
36
29
  - name: Run specs
37
30
  run: |
38
31
  bundle exec rake
39
32
  - name: Trigger dependent repositories
40
- if: github.ref == 'refs/heads/master'
33
+ if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
41
34
  env:
42
35
  GH_USERNAME: ${{ secrets.PAT_USERNAME }}
43
36
  GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
@@ -46,5 +39,5 @@ jobs:
46
39
  [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
47
40
  for repo in $DEPENDENT_REPOS
48
41
  do
49
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
42
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
50
43
  done
@@ -27,15 +27,7 @@ jobs:
27
27
  run: |
28
28
  gem install bundler
29
29
  bundle config --local path vendor/bundle
30
- bundle update
31
30
  bundle install --jobs 4 --retry 3
32
- - name: Use Node
33
- uses: actions/setup-node@v1
34
- with:
35
- node-version: '8'
36
- - name: Install Puppeteer
37
- run: |
38
- npm install -g puppeteer
39
31
  - name: Run specs
40
32
  run: |
41
33
  bundle exec rake
@@ -767,6 +767,8 @@
767
767
  <value>unchanged</value>
768
768
  <value>circulated</value>
769
769
  <value>adapted</value>
770
+ <value>vote-started</value>
771
+ <value>vote-ended</value>
770
772
  </choice>
771
773
  </define>
772
774
  <define name="bdate">
@@ -1019,38 +1021,63 @@
1019
1021
  </define>
1020
1022
  <define name="DocRelationType">
1021
1023
  <choice>
1022
- <value>obsoletes</value>
1023
- <value>obsoletedBy</value>
1024
- <value>supersedes</value>
1025
- <value>supersededBy</value>
1026
- <value>updates</value>
1027
- <value>updatedBy</value>
1028
- <value>complements</value>
1029
- <value>derivedFrom</value>
1030
- <value>translatedFrom</value>
1031
- <value>hasTranslation</value>
1032
- <value>adoptedFrom</value>
1033
- <value>equivalent</value>
1034
- <value>identical</value>
1035
- <value>nonequivalent</value>
1036
- <value>includedIn</value>
1037
1024
  <value>includes</value>
1038
- <value>instance</value>
1039
- <value>instanceOf</value>
1040
- <value>partOf</value>
1025
+ <value>includedIn</value>
1041
1026
  <value>hasPart</value>
1042
- <value>hasDraft</value>
1043
- <value>draftOf</value>
1027
+ <value>partOf</value>
1044
1028
  <value>merges</value>
1029
+ <value>mergedInto</value>
1045
1030
  <value>splits</value>
1046
- <value>amends</value>
1047
- <value>amendedBy</value>
1048
- <value>corrects</value>
1049
- <value>correctedBy</value>
1050
- <value>revises</value>
1051
- <value>revisedBy</value>
1031
+ <value>splitInto</value>
1032
+ <value>instance</value>
1033
+ <value>hasInstance</value>
1034
+ <value>exemplarOf</value>
1035
+ <value>hasExemplar</value>
1036
+ <value>manifestationOf</value>
1037
+ <value>hasManifestation</value>
1038
+ <value>reproductionOf</value>
1039
+ <value>hasReproduction</value>
1040
+ <value>reprintOf</value>
1041
+ <value>hasReprint</value>
1042
+ <value>expressionOf</value>
1043
+ <value>hasExpression</value>
1044
+ <value>translatedFrom</value>
1045
+ <value>hasTranslation</value>
1046
+ <value>arrangementOf</value>
1047
+ <value>hasArrangement</value>
1048
+ <value>abridgementOf</value>
1049
+ <value>hasAbridgement</value>
1050
+ <value>annotationOf</value>
1051
+ <value>hasAnnotation</value>
1052
+ <value>draftOf</value>
1053
+ <value>hasDraft</value>
1054
+ <value>editionOf</value>
1055
+ <value>hasEdition</value>
1056
+ <value>updates</value>
1057
+ <value>updatedBy</value>
1058
+ <value>derivedFrom</value>
1059
+ <value>derives</value>
1052
1060
  <value>describes</value>
1053
1061
  <value>describedBy</value>
1062
+ <value>catalogues</value>
1063
+ <value>cataloguedBy</value>
1064
+ <value>hasSuccessor</value>
1065
+ <value>successorOf</value>
1066
+ <value>adaptedFrom</value>
1067
+ <value>hasAdaptation</value>
1068
+ <value>adoptedFrom</value>
1069
+ <value>adoptedAs</value>
1070
+ <value>reviewOf</value>
1071
+ <value>hasReview</value>
1072
+ <value>commentaryOf</value>
1073
+ <value>hasCommentary</value>
1074
+ <value>related</value>
1075
+ <value>complements</value>
1076
+ <value>complementOf</value>
1077
+ <value>obsoletes</value>
1078
+ <value>obsoletedBy</value>
1079
+ <value>cited</value>
1080
+ <value>isCitedIn</value>
1054
1081
  </choice>
1055
1082
  </define>
1056
1083
  <define name="docrelation">
@@ -303,8 +303,23 @@
303
303
  <ref name="paragraph"/>
304
304
  </element>
305
305
  </define>
306
+ <define name="TextElement" combine="choice">
307
+ <ref name="concept"/>
308
+ </define>
306
309
  </include>
307
310
  <!-- end overrides -->
311
+ <define name="concept">
312
+ <element name="concept">
313
+ <optional>
314
+ <attribute name="term"/>
315
+ </optional>
316
+ <choice>
317
+ <ref name="eref"/>
318
+ <ref name="xref"/>
319
+ <ref name="termref"/>
320
+ </choice>
321
+ </element>
322
+ </define>
308
323
  <define name="BasicBlock" combine="choice">
309
324
  <choice>
310
325
  <ref name="requirement"/>
@@ -911,7 +926,10 @@
911
926
  </define>
912
927
  <define name="origin">
913
928
  <element name="origin">
914
- <ref name="erefType"/>
929
+ <choice>
930
+ <ref name="erefType"/>
931
+ <ref name="termref"/>
932
+ </choice>
915
933
  </element>
916
934
  </define>
917
935
  <define name="modification">
@@ -919,6 +937,15 @@
919
937
  <ref name="paragraph"/>
920
938
  </element>
921
939
  </define>
940
+ <define name="termref">
941
+ <element name="termref">
942
+ <attribute name="base"/>
943
+ <attribute name="target"/>
944
+ <optional>
945
+ <text/>
946
+ </optional>
947
+ </element>
948
+ </define>
922
949
  <define name="structuredidentifier">
923
950
  <element name="structuredidentifier">
924
951
  <optional>
@@ -0,0 +1,2593 @@
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:csd="https://www.metanorma.org/ns/csd" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
2
+
3
+ <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
+
5
+ <xsl:variable name="pageWidth" select="'210mm'"/>
6
+ <xsl:variable name="pageHeight" select="'297mm'"/>
7
+
8
+
9
+
10
+ <xsl:variable name="copyright">
11
+ <xsl:text>© The Calendaring and Scheduling Consortium, Inc. </xsl:text>
12
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
13
+ <xsl:text> – All rights reserved</xsl:text>
14
+ </xsl:variable>
15
+
16
+ <xsl:variable name="header">
17
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/>
18
+ <xsl:text>:</xsl:text>
19
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
20
+ </xsl:variable>
21
+
22
+ <xsl:variable name="contents">
23
+ <contents>
24
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()" mode="contents"/>
25
+ <!-- <xsl:with-param name="sectionNum" select="'0'"/>
26
+ </xsl:apply-templates> -->
27
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]" mode="contents"> <!-- [@id = '_scope'] -->
28
+ <xsl:with-param name="sectionNum" select="'1'"/>
29
+ </xsl:apply-templates>
30
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]" mode="contents"> <!-- [@id = '_normative_references'] -->
31
+ <xsl:with-param name="sectionNum" select="'2'"/>
32
+ </xsl:apply-templates>
33
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]" mode="contents"> <!-- @id != '_scope' -->
34
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
35
+ </xsl:apply-templates>
36
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex" mode="contents"/>
37
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
38
+
39
+ <xsl:apply-templates select="//csd:figure" mode="contents"/>
40
+
41
+ <xsl:apply-templates select="//csd:table" mode="contents"/>
42
+
43
+ </contents>
44
+ </xsl:variable>
45
+
46
+ <xsl:variable name="lang">
47
+ <xsl:call-template name="getLang"/>
48
+ </xsl:variable>
49
+
50
+ <xsl:template match="/">
51
+ <fo:root font-family="SourceSansPro, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
52
+ <fo:layout-master-set>
53
+ <!-- Cover page -->
54
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
55
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
56
+ <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
57
+ <fo:region-after extent="10mm"/>
58
+ <fo:region-start extent="19mm"/>
59
+ <fo:region-end extent="19mm"/>
60
+ </fo:simple-page-master>
61
+
62
+ <!-- Document pages -->
63
+ <!-- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
64
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
65
+ <fo:region-before extent="23.5mm"/>
66
+ <fo:region-after extent="10mm"/>
67
+ <fo:region-start extent="19mm"/>
68
+ <fo:region-end extent="19mm"/>
69
+ </fo:simple-page-master> -->
70
+
71
+ <!-- Preface odd pages -->
72
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
73
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
74
+ <fo:region-before region-name="header-odd" extent="17mm"/>
75
+ <fo:region-after region-name="footer-odd" extent="10mm"/>
76
+ <fo:region-start region-name="left-region" extent="19mm"/>
77
+ <fo:region-end region-name="right-region" extent="19mm"/>
78
+ </fo:simple-page-master>
79
+ <!-- Preface even pages -->
80
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
81
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
82
+ <fo:region-before region-name="header-even" extent="17mm"/>
83
+ <fo:region-after region-name="footer-even" extent="10mm"/>
84
+ <fo:region-start region-name="left-region" extent="19mm"/>
85
+ <fo:region-end region-name="right-region" extent="19mm"/>
86
+ </fo:simple-page-master>
87
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
88
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
89
+ <fo:region-before region-name="header" extent="17mm"/>
90
+ <fo:region-after region-name="footer" extent="10mm"/>
91
+ <fo:region-start region-name="left" extent="19mm"/>
92
+ <fo:region-end region-name="right" extent="19mm"/>
93
+ </fo:simple-page-master>
94
+ <fo:page-sequence-master master-name="preface">
95
+ <fo:repeatable-page-master-alternatives>
96
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
97
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-preface"/>
98
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-preface"/>
99
+ </fo:repeatable-page-master-alternatives>
100
+ </fo:page-sequence-master>
101
+
102
+ <!-- Document odd pages -->
103
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
104
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
105
+ <fo:region-before region-name="header-odd" extent="20.2mm"/>
106
+ <fo:region-after region-name="footer-odd" extent="20.3mm"/>
107
+ <fo:region-start region-name="left-region" extent="19mm"/>
108
+ <fo:region-end region-name="right-region" extent="19mm"/>
109
+ </fo:simple-page-master>
110
+ <!-- Preface even pages -->
111
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
112
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
113
+ <fo:region-before region-name="header-even" extent="20.2mm"/>
114
+ <fo:region-after region-name="footer-even" extent="20.3mm"/>
115
+ <fo:region-start region-name="left-region" extent="19mm"/>
116
+ <fo:region-end region-name="right-region" extent="19mm"/>
117
+ </fo:simple-page-master>
118
+ <fo:page-sequence-master master-name="document">
119
+ <fo:repeatable-page-master-alternatives>
120
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
121
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
122
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
123
+ </fo:repeatable-page-master-alternatives>
124
+ </fo:page-sequence-master>
125
+
126
+ </fo:layout-master-set>
127
+
128
+ <fo:declarations>
129
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
130
+ <pdf:dictionary type="normal" key="ViewerPreferences">
131
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
132
+ </pdf:dictionary>
133
+ </pdf:catalog>
134
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
135
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
136
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
137
+ <!-- Dublin Core properties go here -->
138
+ <dc:title><xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/></dc:title>
139
+ <dc:creator/>
140
+ <dc:description>
141
+ <xsl:variable name="abstract">
142
+ <xsl:copy-of select="/csd:csd-standard/csd:bibliography/csd:references/csd:bibitem/csd:abstract//text()"/>
143
+ </xsl:variable>
144
+ <xsl:value-of select="normalize-space($abstract)"/>
145
+ </dc:description>
146
+ <pdf:Keywords/>
147
+ </rdf:Description>
148
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
149
+ <!-- XMP properties go here -->
150
+ <xmp:CreatorTool/>
151
+ </rdf:Description>
152
+ </rdf:RDF>
153
+ </x:xmpmeta>
154
+ </fo:declarations>
155
+
156
+ <!-- Cover Page -->
157
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
158
+ <fo:static-content flow-name="xsl-footnote-separator">
159
+ <fo:block>
160
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
161
+ </fo:block>
162
+ </fo:static-content>
163
+ <fo:static-content flow-name="cover-page-header" font-size="10pt">
164
+ <fo:block-container height="23.5mm" display-align="before">
165
+ <fo:block padding-top="12.5mm">
166
+ <xsl:value-of select="$copyright"/>
167
+ </fo:block>
168
+ </fo:block-container>
169
+ </fo:static-content>
170
+
171
+ <fo:flow flow-name="xsl-region-body">
172
+
173
+ <fo:block text-align="right">
174
+ <!-- CC/FDS 18011:2018 -->
175
+ <fo:block font-size="14pt" font-weight="bold" margin-bottom="10pt">
176
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/><xsl:text> </xsl:text>
177
+ </fo:block>
178
+ <fo:block margin-bottom="12pt">
179
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:owner/csd:organization/csd:name"/>
180
+ <xsl:text> TC </xsl:text>
181
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:editorialgroup/csd:technical-committee"/>
182
+ <xsl:text> </xsl:text>
183
+ </fo:block>
184
+ </fo:block>
185
+ <fo:block font-size="24pt" font-weight="bold" text-align="center">
186
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
187
+ <xsl:value-of select="$linebreak"/>
188
+ </fo:block>
189
+ <fo:block> </fo:block>
190
+ <fo:block margin-bottom="12pt"> </fo:block>
191
+ <fo:block-container font-size="16pt" text-align="center" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
192
+ <fo:block-container margin-left="0mm" margin-right="0mm">
193
+ <fo:block padding-top="1mm">
194
+ <xsl:call-template name="capitalizeWords">
195
+ <!-- ex: final-draft -->
196
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:status/csd:stage"/>
197
+ </xsl:call-template>
198
+ <xsl:text> </xsl:text>
199
+ <xsl:call-template name="capitalizeWords">
200
+ <!-- ex: standard -->
201
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:ext/csd:doctype"/>
202
+ </xsl:call-template>
203
+ </fo:block>
204
+ </fo:block-container>
205
+ </fo:block-container>
206
+ <fo:block margin-bottom="10pt"> </fo:block>
207
+ <fo:block-container font-size="10pt" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
208
+ <fo:block-container margin-left="0mm" margin-right="0mm">
209
+ <fo:block text-align="center" font-weight="bold" padding-top="1mm" margin-bottom="6pt">Warning for drafts</fo:block>
210
+ <fo:block margin-left="2mm" margin-right="2mm">
211
+ <fo:block margin-bottom="6pt">This document is not a CalConnect Standard. It is distributed for review and comment, and is subject to change without notice and may not be referred to as a Standard. Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
212
+ <fo:block margin-bottom="10pt">Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
213
+ </fo:block>
214
+ </fo:block-container>
215
+ </fo:block-container>
216
+ <fo:block text-align="center">
217
+ <xsl:text>The Calendaring and Scheduling Consortium, Inc.  </xsl:text>
218
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
219
+ </fo:block>
220
+ </fo:flow>
221
+ </fo:page-sequence>
222
+ <!-- End Cover Page -->
223
+
224
+
225
+ <!-- Copyright, Content, Foreword, etc. pages -->
226
+ <fo:page-sequence master-reference="preface" initial-page-number="2" format="i" force-page-count="end-on-even">
227
+ <fo:static-content flow-name="xsl-footnote-separator">
228
+ <fo:block>
229
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
230
+ </fo:block>
231
+ </fo:static-content>
232
+ <xsl:call-template name="insertHeaderFooter"/>
233
+ <fo:flow flow-name="xsl-region-body">
234
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
235
+ DEBUG
236
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
237
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
238
+
239
+ <fo:block margin-bottom="15pt"> </fo:block>
240
+ <fo:block margin-bottom="14pt">
241
+ <xsl:text>© </xsl:text>
242
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
243
+ <xsl:text> The Calendaring and Scheduling Consortium, Inc.</xsl:text>
244
+ </fo:block>
245
+ <fo:block margin-bottom="12pt">
246
+ <xsl:text>All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from the address below. </xsl:text>
247
+ </fo:block>
248
+ <fo:block margin-bottom="12pt">
249
+ <xsl:text>The Calendaring and Scheduling Consortium, Inc.</xsl:text>
250
+ </fo:block>
251
+ <fo:block>
252
+ <xsl:text>4390 Chaffin Lane</xsl:text>
253
+ <xsl:value-of select="$linebreak"/>
254
+ <xsl:text>McKinleyville</xsl:text>
255
+ <xsl:value-of select="$linebreak"/>
256
+ <xsl:text>California 95519</xsl:text>
257
+ <xsl:value-of select="$linebreak"/>
258
+ <xsl:text>United States of America</xsl:text>
259
+ <xsl:value-of select="$linebreak"/>
260
+ <xsl:value-of select="$linebreak"/>
261
+ <fo:basic-link external-destination="copyright@calconnect.org" color="blue" text-decoration="underline" fox:alt-text="copyright@calconnect.org">copyright@calconnect.org</fo:basic-link>
262
+ <xsl:value-of select="$linebreak"/>
263
+ <fo:basic-link external-destination="www.calconnect.org" color="blue" text-decoration="underline" fox:alt-text="www.calconnect.org">www.calconnect.org</fo:basic-link>
264
+ </fo:block>
265
+
266
+ <fo:block break-after="page"/>
267
+
268
+ <fo:block-container font-weight="bold" line-height="115%">
269
+ <fo:block font-size="14pt" margin-bottom="15.5pt">Contents</fo:block>
270
+
271
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
272
+
273
+ <fo:block>
274
+ <xsl:if test="@level = 1">
275
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
276
+ </xsl:if>
277
+ <fo:list-block>
278
+ <xsl:attribute name="provisional-distance-between-starts">
279
+ <xsl:choose>
280
+ <!-- skip 0 section without subsections -->
281
+ <xsl:when test="@section != '' and not(@display-section = 'false')">8mm</xsl:when>
282
+ <xsl:otherwise>0mm</xsl:otherwise>
283
+ </xsl:choose>
284
+ </xsl:attribute>
285
+ <fo:list-item>
286
+ <fo:list-item-label end-indent="label-end()">
287
+ <fo:block>
288
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
289
+ <xsl:value-of select="@section"/><xsl:text>.</xsl:text>
290
+ </xsl:if>
291
+ </fo:block>
292
+ </fo:list-item-label>
293
+ <fo:list-item-body start-indent="body-start()">
294
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
295
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
296
+ <xsl:if test="@section and @display-section = 'false'">
297
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
298
+ </xsl:if>
299
+ <xsl:if test="@addon != ''">
300
+ <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
301
+ </xsl:if>
302
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
303
+ <fo:inline keep-together.within-line="always">
304
+ <fo:leader leader-pattern="dots"/>
305
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
306
+ </fo:inline>
307
+ </fo:basic-link>
308
+ </fo:block>
309
+ </fo:list-item-body>
310
+ </fo:list-item>
311
+ </fo:list-block>
312
+ </fo:block>
313
+ </xsl:for-each>
314
+ </fo:block-container>
315
+
316
+ <!-- Foreword, Introduction -->
317
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()"/>
318
+
319
+ </fo:flow>
320
+ </fo:page-sequence>
321
+
322
+
323
+ <!-- Document Pages -->
324
+ <fo:page-sequence master-reference="document" initial-page-number="1" format="1" force-page-count="no-force">
325
+ <fo:static-content flow-name="xsl-footnote-separator">
326
+ <fo:block>
327
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
328
+ </fo:block>
329
+ </fo:static-content>
330
+ <xsl:call-template name="insertHeaderFooter"/>
331
+ <fo:flow flow-name="xsl-region-body">
332
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt">
333
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
334
+ </fo:block>
335
+ <fo:block>
336
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]"> <!-- Scope -->
337
+ <xsl:with-param name="sectionNum" select="'1'"/>
338
+ </xsl:apply-templates>
339
+ <!-- Normative references -->
340
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]">
341
+ <xsl:with-param name="sectionNum" select="'2'"/>
342
+ </xsl:apply-templates>
343
+
344
+ <!-- Other Sections -->
345
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]">
346
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
347
+ </xsl:apply-templates>
348
+
349
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex"/>
350
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]"/>
351
+
352
+ </fo:block>
353
+ </fo:flow>
354
+ </fo:page-sequence>
355
+
356
+ <!-- End Document Pages -->
357
+
358
+ </fo:root>
359
+ </xsl:template>
360
+
361
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
362
+ <xsl:template match="node()">
363
+ <xsl:param name="sectionNum"/>
364
+ <xsl:param name="sectionNumSkew"/>
365
+ <xsl:apply-templates>
366
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
367
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
368
+ </xsl:apply-templates>
369
+ </xsl:template>
370
+
371
+ <!-- ============================= -->
372
+ <!-- CONTENTS -->
373
+ <!-- ============================= -->
374
+ <xsl:template match="node()" mode="contents">
375
+ <xsl:param name="sectionNum"/>
376
+ <xsl:param name="sectionNumSkew"/>
377
+ <xsl:apply-templates mode="contents">
378
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
379
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
380
+ </xsl:apply-templates>
381
+ </xsl:template>
382
+
383
+
384
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
385
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
386
+ <xsl:template match="csd:csd-standard/csd:sections/*" mode="contents">
387
+ <xsl:param name="sectionNum"/>
388
+ <xsl:param name="sectionNumSkew" select="0"/>
389
+ <xsl:variable name="sectionNum_">
390
+ <xsl:choose>
391
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
392
+ <xsl:when test="$sectionNumSkew != 0">
393
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- csd:sections/csd:clause | csd:sections/csd:terms -->
394
+ <xsl:value-of select="$number + $sectionNumSkew"/>
395
+ </xsl:when>
396
+ <xsl:otherwise>
397
+ <xsl:number count="*"/>
398
+ </xsl:otherwise>
399
+ </xsl:choose>
400
+ </xsl:variable>
401
+ <xsl:apply-templates mode="contents">
402
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
403
+ </xsl:apply-templates>
404
+ </xsl:template>
405
+
406
+ <!-- Any node with title element - clause, definition, annex,... -->
407
+ <xsl:template match="csd:title | csd:preferred" mode="contents">
408
+ <xsl:param name="sectionNum"/>
409
+ <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
410
+ <xsl:variable name="id">
411
+ <xsl:call-template name="getId"/>
412
+ </xsl:variable>
413
+
414
+ <xsl:variable name="level">
415
+ <xsl:call-template name="getLevel"/>
416
+ </xsl:variable>
417
+
418
+ <xsl:variable name="section">
419
+ <xsl:call-template name="getSection">
420
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
421
+ </xsl:call-template>
422
+ </xsl:variable>
423
+
424
+ <xsl:variable name="display">
425
+ <xsl:choose>
426
+ <xsl:when test="ancestor::csd:bibitem">false</xsl:when>
427
+ <xsl:when test="ancestor::csd:term">false</xsl:when>
428
+ <xsl:when test="ancestor::csd:annex and $level &gt;= 2">false</xsl:when>
429
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
430
+ <xsl:otherwise>false</xsl:otherwise>
431
+ </xsl:choose>
432
+ </xsl:variable>
433
+
434
+ <xsl:variable name="display-section">
435
+ <xsl:choose>
436
+ <xsl:when test="ancestor::csd:annex">false</xsl:when>
437
+ <xsl:otherwise>true</xsl:otherwise>
438
+ </xsl:choose>
439
+ </xsl:variable>
440
+
441
+ <xsl:variable name="type">
442
+ <xsl:value-of select="local-name(..)"/>
443
+ </xsl:variable>
444
+
445
+ <xsl:variable name="root">
446
+ <xsl:choose>
447
+ <xsl:when test="ancestor::csd:annex">annex</xsl:when>
448
+ <xsl:when test="ancestor::csd:clause">clause</xsl:when>
449
+ </xsl:choose>
450
+ </xsl:variable>
451
+
452
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
453
+ <xsl:attribute name="addon">
454
+ <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
455
+ </xsl:attribute>
456
+ <xsl:value-of select="."/>
457
+ </item>
458
+
459
+ <xsl:apply-templates mode="contents">
460
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
461
+ </xsl:apply-templates>
462
+
463
+ </xsl:template>
464
+
465
+
466
+ <xsl:template match="csd:figure" mode="contents">
467
+ <item level="" id="{@id}" display="false">
468
+ <xsl:attribute name="section">
469
+ <xsl:text>Figure </xsl:text><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
470
+ </xsl:attribute>
471
+ </item>
472
+ </xsl:template>
473
+
474
+
475
+ <xsl:template match="csd:table" mode="contents">
476
+ <xsl:param name="sectionNum"/>
477
+ <xsl:variable name="annex-id" select="ancestor::csd:annex/@id"/>
478
+ <item level="" id="{@id}" display="false" type="table">
479
+ <xsl:attribute name="section">
480
+ <xsl:text>Table </xsl:text>
481
+ <xsl:choose>
482
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
483
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
484
+ </xsl:when>
485
+ <xsl:when test="ancestor::*[local-name()='annex']">
486
+ <xsl:number format="A-" count="csd:annex"/>
487
+ <xsl:number format="1" level="any" count="csd:table[ancestor::csd:annex[@id = $annex-id]]"/>
488
+ </xsl:when>
489
+ <xsl:otherwise>
490
+ <!-- <xsl:number format="1"/> -->
491
+ <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
492
+ </xsl:otherwise>
493
+ </xsl:choose>
494
+ </xsl:attribute>
495
+ <xsl:value-of select="csd:name/text()"/>
496
+ </item>
497
+ </xsl:template>
498
+
499
+
500
+
501
+ <xsl:template match="csd:formula" mode="contents">
502
+ <item level="" id="{@id}" display="false">
503
+ <xsl:attribute name="section">
504
+ <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="csd:annex | csd:formula"/><xsl:text>)</xsl:text>
505
+ </xsl:attribute>
506
+ </item>
507
+ </xsl:template>
508
+ <!-- ============================= -->
509
+ <!-- ============================= -->
510
+
511
+
512
+ <xsl:template match="csd:license-statement//csd:title">
513
+ <fo:block text-align="center" font-weight="bold">
514
+ <xsl:apply-templates/>
515
+ </fo:block>
516
+ </xsl:template>
517
+
518
+ <xsl:template match="csd:license-statement//csd:p">
519
+ <fo:block margin-left="1.5mm" margin-right="1.5mm">
520
+ <xsl:if test="following-sibling::csd:p">
521
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
522
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
523
+ </xsl:if>
524
+ <xsl:apply-templates/>
525
+ </fo:block>
526
+ </xsl:template>
527
+
528
+ <!-- <fo:block margin-bottom="12pt">© ISO 2019, Published in Switzerland.</fo:block>
529
+ <fo:block font-size="10pt" margin-bottom="12pt">All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.</fo:block>
530
+ <fo:block font-size="10pt" text-indent="7.1mm">
531
+ <fo:block>ISO copyright office</fo:block>
532
+ <fo:block>Ch. de Blandonnet 8 • CP 401</fo:block>
533
+ <fo:block>CH-1214 Vernier, Geneva, Switzerland</fo:block>
534
+ <fo:block>Tel. + 41 22 749 01 11</fo:block>
535
+ <fo:block>Fax + 41 22 749 09 47</fo:block>
536
+ <fo:block>copyright@iso.org</fo:block>
537
+ <fo:block>www.iso.org</fo:block>
538
+ </fo:block> -->
539
+
540
+ <xsl:template match="csd:copyright-statement//csd:p">
541
+ <fo:block>
542
+ <xsl:if test="preceding-sibling::csd:p">
543
+ <!-- <xsl:attribute name="font-size">10pt</xsl:attribute> -->
544
+ </xsl:if>
545
+ <xsl:if test="following-sibling::csd:p">
546
+ <!-- <xsl:attribute name="margin-bottom">12pt</xsl:attribute> -->
547
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
548
+ </xsl:if>
549
+ <xsl:if test="not(following-sibling::csd:p)">
550
+ <!-- <xsl:attribute name="margin-left">7.1mm</xsl:attribute> -->
551
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
552
+ </xsl:if>
553
+ <xsl:apply-templates/>
554
+ </fo:block>
555
+ </xsl:template>
556
+
557
+ <!-- Foreword, Introduction -->
558
+ <xsl:template match="csd:csd-standard/csd:preface/*">
559
+ <fo:block break-after="page"/>
560
+ <!-- <fo:block> -->
561
+ <xsl:apply-templates/>
562
+ <!-- </fo:block> -->
563
+ </xsl:template>
564
+
565
+
566
+
567
+ <!-- clause, terms, clause, ...-->
568
+ <xsl:template match="csd:csd-standard/csd:sections/*">
569
+ <xsl:param name="sectionNum"/>
570
+ <xsl:param name="sectionNumSkew" select="0"/>
571
+ <fo:block>
572
+ <xsl:variable name="pos"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
573
+ <xsl:if test="$pos &gt;= 2">
574
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
575
+ </xsl:if>
576
+ <!-- pos=<xsl:value-of select="$pos" /> -->
577
+ <xsl:variable name="sectionNum_">
578
+ <xsl:choose>
579
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
580
+ <xsl:when test="$sectionNumSkew != 0">
581
+ <xsl:variable name="number"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
582
+ <xsl:value-of select="$number + $sectionNumSkew"/>
583
+ </xsl:when>
584
+ </xsl:choose>
585
+ </xsl:variable>
586
+ <xsl:if test="not(csd:title)">
587
+ <fo:block margin-top="3pt" margin-bottom="12pt">
588
+ <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="csd:clause"/>
589
+ </fo:block>
590
+ </xsl:if>
591
+ <xsl:apply-templates>
592
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
593
+ </xsl:apply-templates>
594
+ </fo:block>
595
+ </xsl:template>
596
+
597
+
598
+
599
+ <xsl:template match="csd:clause//csd:clause[not(csd:title)]">
600
+ <xsl:param name="sectionNum"/>
601
+ <xsl:variable name="section">
602
+ <xsl:call-template name="getSection">
603
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
604
+ </xsl:call-template>
605
+ </xsl:variable>
606
+
607
+ <fo:block margin-top="3pt"><!-- margin-bottom="6pt" -->
608
+ <fo:inline font-weight="bold" padding-right="3mm">
609
+ <xsl:value-of select="$section"/><!-- <xsl:number format=".1 " level="multiple" count="csd:clause/csd:clause" /> -->
610
+ </fo:inline>
611
+ <xsl:apply-templates>
612
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
613
+ <xsl:with-param name="inline" select="'true'"/>
614
+ </xsl:apply-templates>
615
+ </fo:block>
616
+ </xsl:template>
617
+
618
+
619
+ <xsl:template match="csd:title">
620
+ <xsl:param name="sectionNum"/>
621
+
622
+ <xsl:variable name="parent-name" select="local-name(..)"/>
623
+ <xsl:variable name="references_num_current">
624
+ <xsl:number level="any" count="csd:references"/>
625
+ </xsl:variable>
626
+
627
+ <xsl:variable name="id">
628
+ <xsl:call-template name="getId"/>
629
+ </xsl:variable>
630
+
631
+ <xsl:variable name="level">
632
+ <xsl:call-template name="getLevel"/>
633
+ </xsl:variable>
634
+
635
+ <xsl:variable name="section">
636
+ <xsl:call-template name="getSection">
637
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
638
+ </xsl:call-template>
639
+ </xsl:variable>
640
+
641
+ <xsl:variable name="font-size">
642
+ <xsl:choose>
643
+ <xsl:when test="ancestor::csd:preface">13pt</xsl:when>
644
+ <xsl:when test="$level = 1">13pt</xsl:when>
645
+ <xsl:when test="$level = 2">12pt</xsl:when>
646
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
647
+ <xsl:otherwise>16pt</xsl:otherwise>
648
+ </xsl:choose>
649
+ </xsl:variable>
650
+
651
+ <xsl:variable name="element-name">
652
+ <xsl:choose>
653
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
654
+ <xsl:otherwise>fo:block</xsl:otherwise>
655
+ </xsl:choose>
656
+ </xsl:variable>
657
+
658
+ <xsl:variable name="color" select="'rgb(14, 26, 133)'"/>
659
+
660
+ <xsl:element name="{$element-name}">
661
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
662
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
663
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
664
+ <!-- <xsl:attribute name="margin-top">
665
+ <xsl:choose>
666
+ <xsl:when test="$level = 2 and ancestor::annex">18pt</xsl:when>
667
+ <xsl:when test="$level = '' or $level = 1">6pt</xsl:when>
668
+ <xsl:otherwise>12pt</xsl:otherwise>
669
+ </xsl:choose>
670
+ </xsl:attribute> -->
671
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
672
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
673
+ <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
674
+ <xsl:if test="ancestor::csd:sections">
675
+ <xsl:attribute name="margin-top">13.5pt</xsl:attribute>
676
+ </xsl:if>
677
+ <!-- DEBUG level=<xsl:value-of select="$level"/>x -->
678
+ <!-- section=<xsl:value-of select="$sectionNum"/> -->
679
+ <!-- <xsl:if test="$sectionNum"> -->
680
+ <xsl:if test="$section != ''">
681
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
682
+ <xsl:choose>
683
+ <xsl:when test="$level &gt;= 3">
684
+ <fo:inline padding-right="2mm"> </fo:inline>
685
+ </xsl:when>
686
+ <xsl:when test="$level = 1">
687
+ <fo:inline padding-right="2mm"> </fo:inline>
688
+ </xsl:when>
689
+ <xsl:otherwise>
690
+ <fo:inline padding-right="1mm"> </fo:inline>
691
+ </xsl:otherwise>
692
+ </xsl:choose>
693
+ </xsl:if>
694
+ <xsl:apply-templates/>
695
+ </xsl:element>
696
+
697
+
698
+ <xsl:choose>
699
+ <xsl:when test="$parent-name = 'annex2'">
700
+ <fo:block id="{$id}" font-size="16pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
701
+ <xsl:value-of select="$section"/>
702
+ <xsl:if test=" ../@obligation">
703
+ <xsl:value-of select="$linebreak"/>
704
+ <fo:inline font-weight="normal">(<xsl:value-of select="../@obligation"/>)</fo:inline>
705
+ </xsl:if>
706
+ <fo:block margin-top="18pt" margin-bottom="48pt"><xsl:apply-templates/></fo:block>
707
+ </fo:block>
708
+ </xsl:when>
709
+ <xsl:when test="$parent-name = 'references2' and $references_num_current != 1"> <!-- Bibliography -->
710
+ <fo:block id="{$id}" font-size="16pt" font-weight="bold" color="{$color}" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always">
711
+ <xsl:apply-templates/>
712
+ </fo:block>
713
+ </xsl:when>
714
+
715
+ <xsl:otherwise>
716
+
717
+
718
+ <!-- <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::csd:p)">
719
+ <fo:block >
720
+ <xsl:value-of select="$linebreak"/>
721
+ </fo:block>
722
+ </xsl:if> -->
723
+ </xsl:otherwise>
724
+ </xsl:choose>
725
+
726
+ </xsl:template>
727
+
728
+
729
+
730
+ <xsl:template match="csd:p">
731
+ <xsl:param name="inline" select="'false'"/>
732
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
733
+ <xsl:variable name="element-name">
734
+ <xsl:choose>
735
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
736
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
737
+ <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when>
738
+ <xsl:otherwise>fo:block</xsl:otherwise>
739
+ </xsl:choose>
740
+ </xsl:variable>
741
+ <xsl:element name="{$element-name}">
742
+ <xsl:attribute name="text-align">
743
+ <xsl:choose>
744
+ <!-- <xsl:when test="ancestor::csd:preface">justify</xsl:when> -->
745
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
746
+ <xsl:otherwise>left</xsl:otherwise><!-- justify -->
747
+ </xsl:choose>
748
+ </xsl:attribute>
749
+ <xsl:attribute name="margin-bottom">
750
+ <xsl:choose>
751
+ <xsl:when test="ancestor::csd:li">0pt</xsl:when>
752
+ <xsl:otherwise>12pt</xsl:otherwise>
753
+ </xsl:choose>
754
+ </xsl:attribute>
755
+ <xsl:attribute name="line-height">115%</xsl:attribute>
756
+ <xsl:apply-templates/>
757
+ </xsl:element>
758
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
759
+ <fo:block margin-bottom="12pt">
760
+ <xsl:if test="ancestor::csd:annex">
761
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
762
+ </xsl:if>
763
+ <xsl:value-of select="$linebreak"/>
764
+ </fo:block>
765
+ </xsl:if>
766
+ <xsl:if test="$inline = 'true'">
767
+ <fo:block> </fo:block>
768
+ </xsl:if>
769
+ </xsl:template>
770
+
771
+ <!--
772
+ <fn reference="1">
773
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
774
+ </fn>
775
+ -->
776
+ <xsl:template match="csd:p/csd:fn">
777
+ <fo:footnote>
778
+ <xsl:variable name="number">
779
+ <xsl:number level="any" count="csd:p/csd:fn"/>
780
+ </xsl:variable>
781
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
782
+ <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
783
+ <!-- <xsl:value-of select="@reference"/> -->
784
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
785
+ </fo:basic-link>
786
+ </fo:inline>
787
+ <fo:footnote-body>
788
+ <fo:block font-size="10pt" margin-bottom="12pt">
789
+ <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
790
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
791
+ </fo:inline>
792
+ <xsl:for-each select="csd:p">
793
+ <xsl:apply-templates/>
794
+ </xsl:for-each>
795
+ </fo:block>
796
+ </fo:footnote-body>
797
+ </fo:footnote>
798
+ </xsl:template>
799
+
800
+ <xsl:template match="csd:p/csd:fn/csd:p">
801
+ <xsl:apply-templates/>
802
+ </xsl:template>
803
+
804
+ <xsl:template match="csd:review">
805
+ <!-- comment 2019-11-29 -->
806
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
807
+ <xsl:apply-templates /> -->
808
+ </xsl:template>
809
+
810
+ <xsl:template match="text()">
811
+ <xsl:value-of select="."/>
812
+ </xsl:template>
813
+
814
+
815
+
816
+ <xsl:template match="csd:image">
817
+ <fo:block-container text-align="center">
818
+ <fo:block>
819
+ <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
820
+ </fo:block>
821
+ <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">Figure <xsl:number format="1" level="any"/></fo:block>
822
+ </fo:block-container>
823
+
824
+ </xsl:template>
825
+
826
+ <xsl:template match="csd:figure">
827
+ <xsl:variable name="title">
828
+ <xsl:text>Figure </xsl:text>
829
+ </xsl:variable>
830
+
831
+ <fo:block-container id="{@id}">
832
+ <fo:block>
833
+ <xsl:apply-templates/>
834
+ </fo:block>
835
+ <xsl:call-template name="fn_display_figure"/>
836
+ <xsl:for-each select="csd:note//csd:p">
837
+ <xsl:call-template name="note"/>
838
+ </xsl:for-each>
839
+ <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
840
+
841
+ <xsl:choose>
842
+ <xsl:when test="ancestor::csd:annex">
843
+ <xsl:choose>
844
+ <xsl:when test="local-name(..) = 'figure'">
845
+ <xsl:number format="a) "/>
846
+ </xsl:when>
847
+ <xsl:otherwise>
848
+ <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
849
+ </xsl:otherwise>
850
+ </xsl:choose>
851
+
852
+ </xsl:when>
853
+ <xsl:otherwise>
854
+ <xsl:value-of select="$title"/><xsl:number format="1" level="any"/>
855
+ </xsl:otherwise>
856
+ </xsl:choose>
857
+ <xsl:if test="csd:name">
858
+ <xsl:if test="not(local-name(..) = 'figure')">
859
+ <xsl:text> — </xsl:text>
860
+ </xsl:if>
861
+ <xsl:value-of select="csd:name"/>
862
+ </xsl:if>
863
+ </fo:block>
864
+ </fo:block-container>
865
+ </xsl:template>
866
+
867
+ <xsl:template match="csd:figure/csd:name"/>
868
+ <xsl:template match="csd:figure/csd:fn"/>
869
+ <xsl:template match="csd:figure/csd:note"/>
870
+
871
+
872
+ <xsl:template match="csd:figure/csd:image">
873
+ <fo:block text-align="center">
874
+ <fo:external-graphic src="{@src}" content-width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
875
+ </fo:block>
876
+ </xsl:template>
877
+
878
+
879
+ <xsl:template match="csd:bibitem">
880
+ <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
881
+ <xsl:if test=".//csd:fn">
882
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
883
+ </xsl:if>
884
+ <!-- csd:docidentifier -->
885
+ <xsl:if test="csd:docidentifier">
886
+ <xsl:choose>
887
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
888
+ <xsl:otherwise>
889
+ <xsl:value-of select="csd:docidentifier"/>
890
+ </xsl:otherwise>
891
+ </xsl:choose>
892
+ </xsl:if>
893
+ <xsl:apply-templates select="csd:note"/>
894
+ <xsl:if test="csd:docidentifier">, </xsl:if>
895
+ <fo:inline font-style="italic">
896
+ <xsl:choose>
897
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
898
+ <xsl:value-of select="csd:title[@type = 'main' and @language = 'en']"/>
899
+ </xsl:when>
900
+ <xsl:otherwise>
901
+ <xsl:value-of select="csd:title"/>
902
+ </xsl:otherwise>
903
+ </xsl:choose>
904
+ </fo:inline>
905
+ </fo:block>
906
+ </xsl:template>
907
+
908
+
909
+ <xsl:template match="csd:bibitem/csd:note">
910
+ <fo:footnote>
911
+ <xsl:variable name="number">
912
+ <xsl:choose>
913
+ <xsl:when test="ancestor::csd:references[preceding-sibling::csd:references]">
914
+ <xsl:number level="any" count="csd:references[preceding-sibling::csd:references]//csd:bibitem/csd:note"/>
915
+ </xsl:when>
916
+ <xsl:otherwise>
917
+ <xsl:number level="any" count="csd:bibitem/csd:note"/>
918
+ </xsl:otherwise>
919
+ </xsl:choose>
920
+ </xsl:variable>
921
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
922
+ <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
923
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
924
+ </fo:basic-link>
925
+ </fo:inline>
926
+ <fo:footnote-body>
927
+ <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
928
+ <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
929
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
930
+ </fo:inline>
931
+ <xsl:apply-templates/>
932
+ </fo:block>
933
+ </fo:footnote-body>
934
+ </fo:footnote>
935
+ </xsl:template>
936
+
937
+
938
+
939
+ <xsl:template match="csd:ul | csd:ol">
940
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt">
941
+ <xsl:if test="ancestor::csd:ol">
942
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
943
+ </xsl:if>
944
+ <xsl:apply-templates/>
945
+ </fo:list-block>
946
+ </xsl:template>
947
+
948
+ <xsl:template match="csd:li">
949
+ <fo:list-item>
950
+ <fo:list-item-label end-indent="label-end()">
951
+ <fo:block>
952
+ <xsl:choose>
953
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
954
+ <xsl:otherwise> <!-- for ordered lists -->
955
+ <xsl:choose>
956
+ <xsl:when test="../@type = 'arabic'">
957
+ <xsl:number format="a)"/>
958
+ </xsl:when>
959
+ <xsl:when test="../@type = 'alphabet'">
960
+ <xsl:number format="1)"/>
961
+ </xsl:when>
962
+ <xsl:otherwise>
963
+ <xsl:number format="1."/>
964
+ </xsl:otherwise>
965
+ </xsl:choose>
966
+ </xsl:otherwise>
967
+ </xsl:choose>
968
+ </fo:block>
969
+ </fo:list-item-label>
970
+ <fo:list-item-body start-indent="body-start()">
971
+ <xsl:apply-templates/>
972
+ </fo:list-item-body>
973
+ </fo:list-item>
974
+ </xsl:template>
975
+
976
+ <xsl:template match="csd:link">
977
+ <fo:inline>
978
+ <fo:basic-link external-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
979
+ <xsl:choose>
980
+ <xsl:when test="normalize-space(.) = ''">
981
+ <xsl:value-of select="@target"/>
982
+ </xsl:when>
983
+ <xsl:otherwise>
984
+ <xsl:apply-templates/>
985
+ </xsl:otherwise>
986
+ </xsl:choose>
987
+ </fo:basic-link>
988
+ </fo:inline>
989
+ </xsl:template>
990
+
991
+ <xsl:template match="csd:preferred">
992
+ <xsl:param name="sectionNum"/>
993
+ <xsl:variable name="section">
994
+ <xsl:call-template name="getSection">
995
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
996
+ </xsl:call-template>
997
+ </xsl:variable>
998
+ <xsl:variable name="level">
999
+ <xsl:call-template name="getLevel"/>
1000
+ </xsl:variable>
1001
+ <xsl:variable name="font-size">
1002
+ <xsl:choose>
1003
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
1004
+ <xsl:otherwise>12pt</xsl:otherwise>
1005
+ </xsl:choose>
1006
+ </xsl:variable>
1007
+ <fo:block font-size="{$font-size}" line-height="1.1">
1008
+ <fo:block font-weight="bold" keep-with-next="always">
1009
+ <fo:inline id="{../@id}">
1010
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1011
+ <!-- <xsl:value-of select="$sectionNum"/>.<xsl:number count="csd:term"/> -->
1012
+ </fo:inline>
1013
+ </fo:block>
1014
+ <fo:block font-weight="bold" keep-with-next="always">
1015
+ <xsl:apply-templates/>
1016
+ </fo:block>
1017
+ </fo:block>
1018
+ </xsl:template>
1019
+
1020
+ <xsl:template match="csd:admitted">
1021
+ <fo:block>
1022
+ <xsl:apply-templates/>
1023
+ </fo:block>
1024
+ </xsl:template>
1025
+
1026
+ <xsl:template match="csd:deprecates">
1027
+ <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1028
+ </xsl:template>
1029
+
1030
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]">
1031
+ <xsl:apply-templates/>
1032
+ </xsl:template>
1033
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]/csd:p">
1034
+ <fo:inline> <xsl:apply-templates/></fo:inline>
1035
+ <fo:block> </fo:block>
1036
+ </xsl:template>
1037
+
1038
+ <xsl:template match="csd:definition">
1039
+ <fo:block margin-bottom="6pt">
1040
+ <xsl:apply-templates/>
1041
+ </fo:block>
1042
+ </xsl:template>
1043
+
1044
+ <xsl:template match="csd:termsource">
1045
+ <fo:block margin-bottom="8pt" keep-with-previous="always">
1046
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1047
+ <fo:basic-link internal-destination="{csd:origin/@bibitemid}" fox:alt-text="{csd:origin/@citeas}">
1048
+ <xsl:text>[SOURCE: </xsl:text>
1049
+ <xsl:value-of select="csd:origin/@citeas"/>
1050
+ <xsl:if test="csd:origin/csd:locality/csd:referenceFrom">
1051
+ <xsl:text>, </xsl:text><xsl:value-of select="csd:origin/csd:locality/csd:referenceFrom"/>
1052
+ </xsl:if>
1053
+ </fo:basic-link>
1054
+ <xsl:apply-templates select="csd:modification"/>
1055
+ <xsl:text>]</xsl:text>
1056
+ </fo:block>
1057
+ </xsl:template>
1058
+
1059
+ <xsl:template match="csd:modification">
1060
+ <xsl:text>, modified — </xsl:text>
1061
+ <xsl:apply-templates/>
1062
+ </xsl:template>
1063
+ <xsl:template match="csd:modification/csd:p">
1064
+ <fo:inline><xsl:apply-templates/></fo:inline>
1065
+ </xsl:template>
1066
+
1067
+ <xsl:template match="csd:termnote">
1068
+ <fo:block font-size="10pt" margin-bottom="12pt">
1069
+ <xsl:text>Note </xsl:text>
1070
+ <xsl:number/>
1071
+ <xsl:text> to entry: </xsl:text>
1072
+ <xsl:apply-templates/>
1073
+ </fo:block>
1074
+ </xsl:template>
1075
+
1076
+ <xsl:template match="csd:termnote/csd:p">
1077
+ <fo:inline><xsl:apply-templates/></fo:inline>
1078
+ </xsl:template>
1079
+
1080
+ <xsl:template match="csd:domain">
1081
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
1082
+ </xsl:template>
1083
+
1084
+
1085
+ <xsl:template match="csd:termexample">
1086
+ <fo:block font-size="10pt" margin-bottom="12pt">
1087
+ <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1088
+ <xsl:apply-templates/>
1089
+ </fo:block>
1090
+ </xsl:template>
1091
+
1092
+ <xsl:template match="csd:termexample/csd:p">
1093
+ <fo:inline><xsl:apply-templates/></fo:inline>
1094
+ </xsl:template>
1095
+
1096
+
1097
+ <xsl:template match="csd:annex">
1098
+ <fo:block break-after="page"/>
1099
+ <xsl:apply-templates/>
1100
+ </xsl:template>
1101
+
1102
+
1103
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']"> -->
1104
+ <xsl:template match="csd:references[position() &gt; 1]">
1105
+ <fo:block break-after="page"/>
1106
+ <xsl:apply-templates/>
1107
+ </xsl:template>
1108
+
1109
+
1110
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1111
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem"> -->
1112
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem">
1113
+ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1114
+ <fo:list-item>
1115
+ <fo:list-item-label end-indent="label-end()">
1116
+ <fo:block>
1117
+ <fo:inline id="{@id}">
1118
+ <xsl:number format="[1]"/>
1119
+ </fo:inline>
1120
+ </fo:block>
1121
+ </fo:list-item-label>
1122
+ <fo:list-item-body start-indent="body-start()">
1123
+ <fo:block>
1124
+ <xsl:if test="csd:docidentifier">
1125
+ <xsl:choose>
1126
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
1127
+ <xsl:otherwise><fo:inline><xsl:value-of select="csd:docidentifier"/><xsl:apply-templates select="csd:note"/>, </fo:inline></xsl:otherwise>
1128
+ </xsl:choose>
1129
+
1130
+ </xsl:if>
1131
+ <xsl:choose>
1132
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
1133
+ <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/>
1134
+ </xsl:when>
1135
+ <xsl:otherwise>
1136
+ <xsl:apply-templates select="csd:title"/>
1137
+ </xsl:otherwise>
1138
+ </xsl:choose>
1139
+ <xsl:apply-templates select="csd:formattedref"/>
1140
+ </fo:block>
1141
+ </fo:list-item-body>
1142
+ </fo:list-item>
1143
+ </fo:list-block>
1144
+ </xsl:template>
1145
+
1146
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> -->
1147
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem" mode="contents"/>
1148
+
1149
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> -->
1150
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem/csd:title">
1151
+ <fo:inline font-style="italic">
1152
+ <xsl:apply-templates/>
1153
+ </fo:inline>
1154
+ </xsl:template>
1155
+
1156
+ <xsl:template match="csd:quote">
1157
+ <fo:block margin-top="12pt" margin-left="12mm" margin-right="12mm">
1158
+ <xsl:apply-templates select=".//csd:p"/>
1159
+ </fo:block>
1160
+ <fo:block text-align="right">
1161
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1162
+ <xsl:text>— </xsl:text><xsl:value-of select="csd:author"/>
1163
+ <xsl:if test="csd:source">
1164
+ <xsl:text>, </xsl:text>
1165
+ <xsl:apply-templates select="csd:source"/>
1166
+ </xsl:if>
1167
+ </fo:block>
1168
+ </xsl:template>
1169
+
1170
+ <xsl:template match="csd:source">
1171
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1172
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1173
+ <xsl:if test="csd:locality">
1174
+ <xsl:text>, </xsl:text>
1175
+ <xsl:apply-templates select="csd:locality"/>
1176
+ </xsl:if>
1177
+ </fo:basic-link>
1178
+ </xsl:template>
1179
+
1180
+ <xsl:template match="csd:appendix">
1181
+ <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1182
+ <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
1183
+ <xsl:apply-templates select="csd:title" mode="process"/>
1184
+ </fo:block>
1185
+ <xsl:apply-templates/>
1186
+ </xsl:template>
1187
+
1188
+ <xsl:template match="csd:appendix//csd:example">
1189
+ <fo:block font-size="10pt" margin-bottom="12pt">
1190
+ <xsl:text>EXAMPLE</xsl:text>
1191
+ <xsl:if test="csd:name">
1192
+ <xsl:text> — </xsl:text><xsl:apply-templates select="csd:name" mode="process"/>
1193
+ </xsl:if>
1194
+ </fo:block>
1195
+ <xsl:apply-templates/>
1196
+ </xsl:template>
1197
+
1198
+ <xsl:template match="csd:appendix//csd:example/csd:name"/>
1199
+ <xsl:template match="csd:appendix//csd:example/csd:name" mode="process">
1200
+ <fo:inline><xsl:apply-templates/></fo:inline>
1201
+ </xsl:template>
1202
+
1203
+ <!-- <xsl:template match="csd:callout/text()">
1204
+ <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
1205
+ </xsl:template> -->
1206
+ <xsl:template match="csd:callout">
1207
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
1208
+ </xsl:template>
1209
+
1210
+ <xsl:template match="csd:annotation">
1211
+ <fo:block>
1212
+
1213
+ </fo:block>
1214
+ <xsl:apply-templates/>
1215
+ </xsl:template>
1216
+
1217
+ <xsl:template match="csd:annotation/text()"/>
1218
+
1219
+ <xsl:template match="csd:annotation/csd:p">
1220
+ <xsl:variable name="annotation-id" select="../@id"/>
1221
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
1222
+ <fo:block id="{$annotation-id}">
1223
+ <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
1224
+ <xsl:apply-templates/>
1225
+ </fo:block>
1226
+ </xsl:template>
1227
+
1228
+
1229
+ <xsl:template match="csd:appendix/csd:title"/>
1230
+ <xsl:template match="csd:appendix/csd:title" mode="process">
1231
+ <fo:inline><xsl:apply-templates/></fo:inline>
1232
+ </xsl:template>
1233
+
1234
+
1235
+ <xsl:template match="csd:xref">
1236
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
1237
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1238
+ <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))">
1239
+ <xsl:attribute name="color">blue</xsl:attribute>
1240
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1241
+ </xsl:if>
1242
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1243
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1244
+ <xsl:choose>
1245
+ <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1246
+ <xsl:when test="$type = 'term' and $root = 'clause'">Clause </xsl:when>
1247
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1248
+ </xsl:choose>
1249
+ <xsl:value-of select="$section"/>
1250
+ </fo:basic-link>
1251
+ </xsl:template>
1252
+
1253
+ <xsl:template match="csd:sourcecode">
1254
+ <fo:block font-family="SourceCodePro" font-size="10pt" margin-bottom="6pt" keep-with-next="always">
1255
+ <xsl:choose>
1256
+ <xsl:when test="@lang = 'en'"/>
1257
+ <xsl:otherwise>
1258
+ <xsl:attribute name="white-space">pre</xsl:attribute>
1259
+ </xsl:otherwise>
1260
+ </xsl:choose>
1261
+ <xsl:apply-templates/>
1262
+ </fo:block>
1263
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1264
+ <xsl:text>Figure </xsl:text>
1265
+ <xsl:number format="1" level="any"/>
1266
+ </fo:block>
1267
+ </xsl:template>
1268
+
1269
+ <xsl:template match="csd:tt" priority="2">
1270
+ <fo:inline font-family="SourceCodePro" font-size="10pt">
1271
+ <xsl:apply-templates/>
1272
+ </fo:inline>
1273
+ </xsl:template>
1274
+
1275
+ <xsl:template match="csd:example">
1276
+ <fo:block font-size="10pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1277
+ <xsl:text>EXAMPLE</xsl:text>
1278
+ <xsl:if test="following-sibling::csd:example or preceding-sibling::csd:example">
1279
+ <xsl:number format=" 1"/>
1280
+ </xsl:if>
1281
+ </fo:block>
1282
+ <fo:block font-size="10pt" margin-left="12.5mm">
1283
+ <xsl:apply-templates/>
1284
+ </fo:block>
1285
+ </xsl:template>
1286
+
1287
+ <xsl:template match="csd:example/csd:p">
1288
+ <fo:block margin-bottom="14pt">
1289
+ <xsl:apply-templates/>
1290
+ </fo:block>
1291
+ </xsl:template>
1292
+
1293
+ <xsl:template match="csd:note/csd:p" name="note">
1294
+ <fo:block font-size="10pt" margin-bottom="12pt">
1295
+ <fo:inline padding-right="6mm">NOTE <xsl:number count="csd:note"/></fo:inline>
1296
+ <xsl:apply-templates/>
1297
+ </fo:block>
1298
+ </xsl:template>
1299
+
1300
+ <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
1301
+ <xsl:template match="csd:eref">
1302
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}" color="blue" text-decoration="underline"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1303
+ <xsl:if test="@type = 'footnote'">
1304
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1305
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1306
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1307
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1308
+ </xsl:if>
1309
+ <xsl:if test="@type = 'inline'">
1310
+ <xsl:attribute name="color">blue</xsl:attribute>
1311
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1312
+ </xsl:if>
1313
+ <!-- <xsl:if test="@type = 'inline'">
1314
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1315
+ </xsl:if> -->
1316
+ <xsl:choose>
1317
+ <xsl:when test="@citeas">
1318
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1319
+ </xsl:when>
1320
+ <xsl:when test="@bibitemid">
1321
+ <xsl:value-of select="//csd:bibitem[@id = current()/@bibitemid]/csd:docidentifier"/>
1322
+ </xsl:when>
1323
+ <xsl:otherwise/>
1324
+ </xsl:choose>
1325
+ <xsl:if test="csd:locality">
1326
+ <xsl:text>, </xsl:text>
1327
+ <!-- <xsl:choose>
1328
+ <xsl:when test="csd:locality/@type = 'section'">Section </xsl:when>
1329
+ <xsl:when test="csd:locality/@type = 'clause'">Clause </xsl:when>
1330
+ <xsl:otherwise></xsl:otherwise>
1331
+ </xsl:choose> -->
1332
+ <xsl:apply-templates select="csd:locality"/>
1333
+ </xsl:if>
1334
+ </fo:basic-link>
1335
+ </xsl:template>
1336
+
1337
+ <xsl:template match="csd:locality">
1338
+ <xsl:choose>
1339
+ <xsl:when test="@type ='clause'">Clause </xsl:when>
1340
+ <xsl:when test="@type ='annex'">Annex </xsl:when>
1341
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1342
+ </xsl:choose>
1343
+ <xsl:text> </xsl:text><xsl:value-of select="csd:referenceFrom"/>
1344
+ </xsl:template>
1345
+
1346
+ <xsl:template match="csd:admonition">
1347
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1348
+ <xsl:value-of select="translate(@type, $lower, $upper)"/>
1349
+ <xsl:text> — </xsl:text>
1350
+ <xsl:apply-templates/>
1351
+ </fo:block>
1352
+ </xsl:template>
1353
+
1354
+ <xsl:template match="csd:formula/csd:dt/csd:stem">
1355
+ <fo:inline>
1356
+ <xsl:apply-templates/>
1357
+ </fo:inline>
1358
+ </xsl:template>
1359
+
1360
+ <xsl:template match="csd:formula/csd:stem">
1361
+ <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1362
+ <fo:table table-layout="fixed" width="100%">
1363
+ <fo:table-column column-width="95%"/>
1364
+ <fo:table-column column-width="5%"/>
1365
+ <fo:table-body>
1366
+ <fo:table-row>
1367
+ <fo:table-cell display-align="center">
1368
+ <fo:block text-align="left" margin-left="5mm">
1369
+ <xsl:apply-templates/>
1370
+ </fo:block>
1371
+ </fo:table-cell>
1372
+ <fo:table-cell display-align="center">
1373
+ <fo:block text-align="right">
1374
+ <xsl:choose>
1375
+ <xsl:when test="ancestor::csd:annex">
1376
+ <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="csd:annex | csd:formula"/><xsl:text>)</xsl:text>
1377
+ </xsl:when>
1378
+ <xsl:otherwise> <!-- not(ancestor::csd:annex) -->
1379
+ <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="csd:formula"/><xsl:text>)</xsl:text> -->
1380
+ </xsl:otherwise>
1381
+ </xsl:choose>
1382
+ </fo:block>
1383
+ </fo:table-cell>
1384
+ </fo:table-row>
1385
+ </fo:table-body>
1386
+ </fo:table>
1387
+ <fo:inline keep-together.within-line="always">
1388
+ </fo:inline>
1389
+ </fo:block>
1390
+ </xsl:template>
1391
+
1392
+
1393
+ <xsl:template match="csd:br" priority="2">
1394
+ <!-- <fo:block>&#xA0;</fo:block> -->
1395
+ <xsl:value-of select="$linebreak"/>
1396
+ </xsl:template>
1397
+
1398
+ <xsl:template name="insertHeaderFooter">
1399
+ <fo:static-content flow-name="header-even">
1400
+ <fo:block-container height="17mm" display-align="before">
1401
+ <fo:block padding-top="12.5mm">
1402
+ <xsl:value-of select="$header"/>
1403
+ </fo:block>
1404
+ </fo:block-container>
1405
+ </fo:static-content>
1406
+ <fo:static-content flow-name="footer-even">
1407
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1408
+ <fo:table table-layout="fixed" width="100%">
1409
+ <fo:table-column column-width="10%"/>
1410
+ <fo:table-column column-width="90%"/>
1411
+ <fo:table-body>
1412
+ <fo:table-row>
1413
+ <fo:table-cell>
1414
+ <fo:block padding-bottom="5mm"><fo:page-number/></fo:block>
1415
+ </fo:table-cell>
1416
+ <fo:table-cell padding-right="2mm">
1417
+ <fo:block padding-bottom="5mm" text-align="right"><xsl:value-of select="$copyright"/></fo:block>
1418
+ </fo:table-cell>
1419
+ </fo:table-row>
1420
+ </fo:table-body>
1421
+ </fo:table>
1422
+ </fo:block-container>
1423
+ </fo:static-content>
1424
+ <fo:static-content flow-name="header-odd">
1425
+ <fo:block-container height="17mm" display-align="before">
1426
+ <fo:block text-align="right" padding-top="12.5mm">
1427
+ <xsl:value-of select="$header"/>
1428
+ </fo:block>
1429
+ </fo:block-container>
1430
+ </fo:static-content>
1431
+ <fo:static-content flow-name="footer-odd">
1432
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1433
+ <fo:table table-layout="fixed" width="100%">
1434
+ <fo:table-column column-width="90%"/>
1435
+ <fo:table-column column-width="10%"/>
1436
+ <fo:table-body>
1437
+ <fo:table-row>
1438
+ <fo:table-cell>
1439
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
1440
+ </fo:table-cell>
1441
+ <fo:table-cell padding-right="2mm">
1442
+ <fo:block padding-bottom="5mm" text-align="right"><fo:page-number/></fo:block>
1443
+ </fo:table-cell>
1444
+ </fo:table-row>
1445
+ </fo:table-body>
1446
+ </fo:table>
1447
+ </fo:block-container>
1448
+ </fo:static-content>
1449
+ </xsl:template>
1450
+
1451
+ <xsl:template name="getId">
1452
+ <xsl:choose>
1453
+ <xsl:when test="../@id">
1454
+ <xsl:value-of select="../@id"/>
1455
+ </xsl:when>
1456
+ <xsl:otherwise>
1457
+ <xsl:value-of select="text()"/>
1458
+ </xsl:otherwise>
1459
+ </xsl:choose>
1460
+ </xsl:template>
1461
+
1462
+ <xsl:template name="getLevel">
1463
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
1464
+ <xsl:variable name="level">
1465
+ <xsl:choose>
1466
+ <xsl:when test="ancestor::csd:preface">
1467
+ <xsl:value-of select="$level_total - 2"/>
1468
+ </xsl:when>
1469
+ <xsl:when test="ancestor::csd:sections">
1470
+ <xsl:value-of select="$level_total - 2"/>
1471
+ </xsl:when>
1472
+ <xsl:when test="ancestor::csd:bibliography">
1473
+ <xsl:value-of select="$level_total - 2"/>
1474
+ </xsl:when>
1475
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1476
+ <xsl:otherwise>
1477
+ <xsl:value-of select="$level_total - 1"/>
1478
+ </xsl:otherwise>
1479
+ </xsl:choose>
1480
+ </xsl:variable>
1481
+ <xsl:value-of select="$level"/>
1482
+ </xsl:template>
1483
+
1484
+ <xsl:template name="getSection">
1485
+ <xsl:param name="sectionNum"/>
1486
+ <xsl:variable name="level">
1487
+ <xsl:call-template name="getLevel"/>
1488
+ </xsl:variable>
1489
+ <xsl:variable name="section">
1490
+ <xsl:choose>
1491
+ <xsl:when test="ancestor::csd:bibliography">
1492
+ <xsl:value-of select="$sectionNum"/>
1493
+ </xsl:when>
1494
+ <xsl:when test="ancestor::csd:sections">
1495
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1496
+ <xsl:choose>
1497
+ <xsl:when test="$level = 1">
1498
+ <xsl:value-of select="$sectionNum"/>
1499
+ </xsl:when>
1500
+ <xsl:when test="$level &gt;= 2">
1501
+ <xsl:variable name="num">
1502
+ <xsl:number format=".1" level="multiple" count="csd:clause/csd:clause | csd:clause/csd:terms | csd:terms/csd:term | csd:clause/csd:term | csd:clause/csd:definitions | csd:definitions/csd:definitions"/>
1503
+ </xsl:variable>
1504
+ <xsl:value-of select="concat($sectionNum, $num)"/>
1505
+ </xsl:when>
1506
+ <xsl:otherwise>
1507
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1508
+ </xsl:otherwise>
1509
+ </xsl:choose>
1510
+ <!-- <xsl:text>.</xsl:text> -->
1511
+ </xsl:when>
1512
+ <!-- <xsl:when test="ancestor::csd:annex[@obligation = 'informative']">
1513
+ <xsl:choose>
1514
+ <xsl:when test="$level = 1">
1515
+ <xsl:text>Annex </xsl:text>
1516
+ <xsl:number format="I" level="any" count="csd:annex[@obligation = 'informative']"/>
1517
+ </xsl:when>
1518
+ <xsl:otherwise>
1519
+ <xsl:number format="I.1" level="multiple" count="csd:annex[@obligation = 'informative'] | csd:clause"/>
1520
+ </xsl:otherwise>
1521
+ </xsl:choose>
1522
+ </xsl:when> -->
1523
+ <xsl:when test="ancestor::csd:annex">
1524
+ <xsl:choose>
1525
+ <xsl:when test="$level = 1">
1526
+ <xsl:text>Annex </xsl:text>
1527
+ <xsl:choose>
1528
+ <xsl:when test="count(//csd:annex) = 1">
1529
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/>
1530
+ </xsl:when>
1531
+ <xsl:otherwise>
1532
+ <xsl:number format="A." level="any" count="csd:annex"/>
1533
+ </xsl:otherwise>
1534
+ </xsl:choose>
1535
+ </xsl:when>
1536
+ <xsl:otherwise>
1537
+ <xsl:choose>
1538
+ <xsl:when test="count(//csd:annex) = 1">
1539
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/><xsl:number format=".1" level="multiple" count="csd:clause"/>
1540
+ </xsl:when>
1541
+ <xsl:otherwise>
1542
+ <xsl:number format="A.1." level="multiple" count="csd:annex | csd:clause"/>
1543
+ </xsl:otherwise>
1544
+ </xsl:choose>
1545
+ </xsl:otherwise>
1546
+ </xsl:choose>
1547
+ </xsl:when>
1548
+ <xsl:when test="ancestor::csd:preface"> <!-- if preface and there is clause(s) -->
1549
+ <xsl:choose>
1550
+ <xsl:when test="$level = 1 and ..//csd:clause">0</xsl:when>
1551
+ <xsl:when test="$level &gt;= 2">
1552
+ <xsl:variable name="num">
1553
+ <xsl:number format=".1." level="multiple" count="csd:clause"/>
1554
+ </xsl:variable>
1555
+ <xsl:value-of select="concat('0', $num)"/>
1556
+ </xsl:when>
1557
+ <xsl:otherwise>
1558
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1559
+ </xsl:otherwise>
1560
+ </xsl:choose>
1561
+ </xsl:when>
1562
+ <xsl:otherwise>
1563
+ </xsl:otherwise>
1564
+ </xsl:choose>
1565
+ </xsl:variable>
1566
+ <xsl:value-of select="$section"/>
1567
+ </xsl:template>
1568
+
1569
+ <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
1570
+ <xsl:value-of select="."/>
1571
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
1572
+ <xsl:value-of select="$linebreak"/>
1573
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1">
1574
+ <xsl:call-template name="add-zero-spaces"/>
1575
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
1576
+
1577
+ <xsl:variable name="simple-table">
1578
+ <!-- <xsl:copy> -->
1579
+ <xsl:call-template name="getSimpleTable"/>
1580
+ <!-- </xsl:copy> -->
1581
+ </xsl:variable>
1582
+
1583
+ <!-- DEBUG -->
1584
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
1585
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
1586
+
1587
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
1588
+
1589
+
1590
+
1591
+ <xsl:choose>
1592
+ <xsl:when test="@unnumbered = 'true'"/>
1593
+ <xsl:otherwise>
1594
+
1595
+
1596
+
1597
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+ <xsl:text>Table </xsl:text>
1604
+ <xsl:choose>
1605
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1606
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
1607
+ </xsl:when>
1608
+ <xsl:when test="ancestor::*[local-name()='annex']">
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+
1615
+ <xsl:number format="A-1" level="multiple" count="*[local-name()='annex'] | *[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'] "/>
1616
+
1617
+ </xsl:when>
1618
+ <xsl:otherwise>
1619
+
1620
+
1621
+ <xsl:number format="A." count="*[local-name()='annex']"/>
1622
+ <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']"/>
1623
+
1624
+ </xsl:otherwise>
1625
+ </xsl:choose>
1626
+ <xsl:if test="*[local-name()='name']">
1627
+
1628
+
1629
+
1630
+ <xsl:text> — </xsl:text>
1631
+
1632
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
1633
+ </xsl:if>
1634
+ </fo:block>
1635
+
1636
+
1637
+ <xsl:call-template name="fn_name_display"/>
1638
+
1639
+ </xsl:otherwise>
1640
+ </xsl:choose>
1641
+
1642
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1643
+
1644
+ <!-- <xsl:variable name="cols-count">
1645
+ <xsl:choose>
1646
+ <xsl:when test="*[local-name()='thead']">
1647
+ <xsl:call-template name="calculate-columns-numbers">
1648
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1649
+ </xsl:call-template>
1650
+ </xsl:when>
1651
+ <xsl:otherwise>
1652
+ <xsl:call-template name="calculate-columns-numbers">
1653
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1654
+ </xsl:call-template>
1655
+ </xsl:otherwise>
1656
+ </xsl:choose>
1657
+ </xsl:variable> -->
1658
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1659
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1660
+
1661
+
1662
+
1663
+ <xsl:variable name="colwidths">
1664
+ <xsl:call-template name="calculate-column-widths">
1665
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1666
+ <xsl:with-param name="table" select="$simple-table"/>
1667
+ </xsl:call-template>
1668
+ </xsl:variable>
1669
+
1670
+ <xsl:variable name="colwidths2">
1671
+ <xsl:call-template name="calculate-column-widths">
1672
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1673
+ </xsl:call-template>
1674
+ </xsl:variable>
1675
+
1676
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1677
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1678
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1679
+
1680
+ <xsl:variable name="margin-left">
1681
+ <xsl:choose>
1682
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1683
+ <xsl:otherwise>0</xsl:otherwise>
1684
+ </xsl:choose>
1685
+ </xsl:variable>
1686
+
1687
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1688
+
1689
+
1690
+
1691
+
1692
+
1693
+
1694
+ <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm">
1695
+
1696
+
1697
+
1698
+
1699
+
1700
+
1701
+
1702
+
1703
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1704
+
1705
+
1706
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1707
+ <xsl:choose>
1708
+ <xsl:when test=". = 1">
1709
+ <fo:table-column column-width="proportional-column-width(2)"/>
1710
+ </xsl:when>
1711
+ <xsl:otherwise>
1712
+ <fo:table-column column-width="proportional-column-width({.})"/>
1713
+ </xsl:otherwise>
1714
+ </xsl:choose>
1715
+ </xsl:for-each>
1716
+ <xsl:apply-templates/>
1717
+ </fo:table>
1718
+ </fo:block-container>
1719
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
1720
+ <xsl:apply-templates/>
1721
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
1722
+ <xsl:param name="table-row"/>
1723
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
1724
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
1725
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
1726
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
1727
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
1728
+ <xsl:param name="table"/>
1729
+ <xsl:param name="cols-count"/>
1730
+ <xsl:param name="curr-col" select="1"/>
1731
+ <xsl:param name="width" select="0"/>
1732
+
1733
+ <xsl:if test="$curr-col &lt;= $cols-count">
1734
+ <xsl:variable name="widths">
1735
+ <xsl:choose>
1736
+ <xsl:when test="not($table)">
1737
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
1738
+ <xsl:variable name="words">
1739
+ <xsl:call-template name="tokenize">
1740
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
1741
+ </xsl:call-template>
1742
+ </xsl:variable>
1743
+ <xsl:variable name="max_length">
1744
+ <xsl:call-template name="max_length">
1745
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1746
+ </xsl:call-template>
1747
+ </xsl:variable>
1748
+ <width>
1749
+ <xsl:value-of select="$max_length"/>
1750
+ </width>
1751
+ </xsl:for-each>
1752
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
1753
+ <xsl:variable name="words">
1754
+ <xsl:call-template name="tokenize">
1755
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
1756
+ </xsl:call-template>
1757
+ </xsl:variable>
1758
+ <xsl:variable name="max_length">
1759
+ <xsl:call-template name="max_length">
1760
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1761
+ </xsl:call-template>
1762
+ </xsl:variable>
1763
+ <width>
1764
+ <xsl:value-of select="$max_length"/>
1765
+ </width>
1766
+
1767
+ </xsl:for-each>
1768
+ </xsl:when>
1769
+ <xsl:otherwise>
1770
+ <xsl:for-each select="xalan:nodeset($table)//tr">
1771
+ <xsl:variable name="words">
1772
+ <xsl:call-template name="tokenize">
1773
+ <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
1774
+ </xsl:call-template>
1775
+ </xsl:variable>
1776
+ <xsl:variable name="max_length">
1777
+ <xsl:call-template name="max_length">
1778
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1779
+ </xsl:call-template>
1780
+ </xsl:variable>
1781
+ <width>
1782
+ <xsl:variable name="divider">
1783
+ <xsl:choose>
1784
+ <xsl:when test="td[$curr-col]/@divide">
1785
+ <xsl:value-of select="td[$curr-col]/@divide"/>
1786
+ </xsl:when>
1787
+ <xsl:otherwise>1</xsl:otherwise>
1788
+ </xsl:choose>
1789
+ </xsl:variable>
1790
+ <xsl:value-of select="$max_length div $divider"/>
1791
+ </width>
1792
+
1793
+ </xsl:for-each>
1794
+
1795
+ </xsl:otherwise>
1796
+ </xsl:choose>
1797
+ </xsl:variable>
1798
+
1799
+
1800
+ <column>
1801
+ <xsl:for-each select="xalan:nodeset($widths)//width">
1802
+ <xsl:sort select="." data-type="number" order="descending"/>
1803
+ <xsl:if test="position()=1">
1804
+ <xsl:value-of select="."/>
1805
+ </xsl:if>
1806
+ </xsl:for-each>
1807
+ </column>
1808
+ <xsl:call-template name="calculate-column-widths">
1809
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1810
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
1811
+ <xsl:with-param name="table" select="$table"/>
1812
+ </xsl:call-template>
1813
+ </xsl:if>
1814
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
1815
+ <!-- <fo:table-header font-weight="bold">
1816
+ <xsl:apply-templates />
1817
+ </fo:table-header> -->
1818
+ <xsl:apply-templates/>
1819
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
1820
+ <xsl:apply-templates/>
1821
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
1822
+ <xsl:variable name="cols-count">
1823
+ <xsl:choose>
1824
+ <xsl:when test="../*[local-name()='thead']">
1825
+ <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
1826
+ <xsl:call-template name="calculate-columns-numbers">
1827
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
1828
+ </xsl:call-template>
1829
+ </xsl:when>
1830
+ <xsl:otherwise>
1831
+ <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
1832
+ <xsl:call-template name="calculate-columns-numbers">
1833
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
1834
+ </xsl:call-template>
1835
+ </xsl:otherwise>
1836
+ </xsl:choose>
1837
+ </xsl:variable>
1838
+
1839
+ <fo:table-body>
1840
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
1841
+ <xsl:apply-templates/>
1842
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1843
+ <!-- if there are note(s) or fn(s) then create footer row -->
1844
+ <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
1845
+ <fo:table-row>
1846
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1847
+
1848
+
1849
+
1850
+ <!-- fn will be processed inside 'note' processing -->
1851
+
1852
+
1853
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1854
+
1855
+ <!-- horizontal row separator -->
1856
+
1857
+
1858
+ <!-- fn processing -->
1859
+ <xsl:call-template name="fn_display"/>
1860
+
1861
+ </fo:table-cell>
1862
+ </fo:table-row>
1863
+
1864
+ </xsl:if>
1865
+ </fo:table-body>
1866
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
1867
+ <xsl:variable name="parent-name" select="local-name(..)"/>
1868
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
1869
+ <fo:table-row min-height="4mm">
1870
+ <xsl:if test="$parent-name = 'thead'">
1871
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1872
+
1873
+
1874
+
1875
+
1876
+
1877
+ </xsl:if>
1878
+ <xsl:if test="$parent-name = 'tfoot'">
1879
+
1880
+
1881
+ </xsl:if>
1882
+
1883
+ <xsl:apply-templates/>
1884
+ </fo:table-row>
1885
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
1886
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
1887
+
1888
+
1889
+
1890
+
1891
+
1892
+
1893
+
1894
+ <xsl:if test="@colspan">
1895
+ <xsl:attribute name="number-columns-spanned">
1896
+ <xsl:value-of select="@colspan"/>
1897
+ </xsl:attribute>
1898
+ </xsl:if>
1899
+ <xsl:if test="@rowspan">
1900
+ <xsl:attribute name="number-rows-spanned">
1901
+ <xsl:value-of select="@rowspan"/>
1902
+ </xsl:attribute>
1903
+ </xsl:if>
1904
+ <fo:block>
1905
+ <xsl:apply-templates/>
1906
+ </fo:block>
1907
+ </fo:table-cell>
1908
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
1909
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
1910
+
1911
+
1912
+
1913
+
1914
+
1915
+
1916
+
1917
+ <xsl:if test="@colspan">
1918
+ <xsl:attribute name="number-columns-spanned">
1919
+ <xsl:value-of select="@colspan"/>
1920
+ </xsl:attribute>
1921
+ </xsl:if>
1922
+ <xsl:if test="@rowspan">
1923
+ <xsl:attribute name="number-rows-spanned">
1924
+ <xsl:value-of select="@rowspan"/>
1925
+ </xsl:attribute>
1926
+ </xsl:if>
1927
+ <fo:block>
1928
+ <xsl:apply-templates/>
1929
+ </fo:block>
1930
+ <!-- <xsl:choose>
1931
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
1932
+ <xsl:apply-templates />
1933
+ </xsl:when>
1934
+ <xsl:otherwise>
1935
+ <fo:block>
1936
+ <xsl:apply-templates />
1937
+ </fo:block>
1938
+ </xsl:otherwise>
1939
+ </xsl:choose> -->
1940
+
1941
+
1942
+ </fo:table-cell>
1943
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
1944
+
1945
+
1946
+ <fo:block font-size="10pt" margin-bottom="12pt">
1947
+
1948
+
1949
+ <fo:inline padding-right="2mm">
1950
+ <xsl:text>NOTE </xsl:text>
1951
+
1952
+
1953
+ <xsl:number format="1 "/>
1954
+
1955
+ </fo:inline>
1956
+ <xsl:apply-templates mode="process"/>
1957
+ </fo:block>
1958
+
1959
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
1960
+ <xsl:apply-templates/>
1961
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
1962
+ <xsl:variable name="references">
1963
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
1964
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
1965
+
1966
+
1967
+ <xsl:apply-templates/>
1968
+ </fn>
1969
+ </xsl:for-each>
1970
+ </xsl:variable>
1971
+ <xsl:for-each select="xalan:nodeset($references)//fn">
1972
+ <xsl:variable name="reference" select="@reference"/>
1973
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
1974
+ <fo:block margin-bottom="12pt">
1975
+
1976
+
1977
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1978
+
1979
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1980
+
1981
+
1982
+
1983
+
1984
+
1985
+ <xsl:value-of select="@reference"/>
1986
+
1987
+ </fo:inline>
1988
+ <fo:inline>
1989
+
1990
+ <xsl:apply-templates/>
1991
+ </fo:inline>
1992
+ </fo:block>
1993
+ </xsl:if>
1994
+ </xsl:for-each>
1995
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
1996
+ <!-- <xsl:variable name="references">
1997
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
1998
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
1999
+ <xsl:apply-templates />
2000
+ </fn>
2001
+ </xsl:for-each>
2002
+ </xsl:variable>
2003
+ $references=<xsl:copy-of select="$references"/> -->
2004
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2005
+ <xsl:variable name="reference" select="@reference"/>
2006
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2007
+ <fo:block margin-bottom="12pt">
2008
+ <xsl:apply-templates/>
2009
+ </fo:block>
2010
+ </xsl:for-each>
2011
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
2012
+ <xsl:variable name="key_iso">
2013
+ <!-- and (not(@class) or @class !='pseudocode') -->
2014
+ </xsl:variable>
2015
+ <xsl:variable name="references">
2016
+ <xsl:for-each select=".//*[local-name()='fn']">
2017
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2018
+ <xsl:apply-templates/>
2019
+ </fn>
2020
+ </xsl:for-each>
2021
+ </xsl:variable>
2022
+ <xsl:if test="xalan:nodeset($references)//fn">
2023
+ <fo:block>
2024
+ <fo:table width="95%" table-layout="fixed">
2025
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2026
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2027
+
2028
+ </xsl:if>
2029
+ <fo:table-column column-width="15%"/>
2030
+ <fo:table-column column-width="85%"/>
2031
+ <fo:table-body>
2032
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2033
+ <xsl:variable name="reference" select="@reference"/>
2034
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2035
+ <fo:table-row>
2036
+ <fo:table-cell>
2037
+ <fo:block>
2038
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2039
+
2040
+ <xsl:value-of select="@reference"/>
2041
+ </fo:inline>
2042
+ </fo:block>
2043
+ </fo:table-cell>
2044
+ <fo:table-cell>
2045
+ <fo:block text-align="justify" margin-bottom="12pt">
2046
+
2047
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2048
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2049
+ </xsl:if>
2050
+
2051
+ <xsl:apply-templates/>
2052
+ </fo:block>
2053
+ </fo:table-cell>
2054
+ </fo:table-row>
2055
+ </xsl:if>
2056
+ </xsl:for-each>
2057
+ </fo:table-body>
2058
+ </fo:table>
2059
+ </fo:block>
2060
+ </xsl:if>
2061
+
2062
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
2063
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2064
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2065
+
2066
+
2067
+
2068
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2069
+
2070
+ <xsl:value-of select="@reference"/>
2071
+ </fo:basic-link>
2072
+ </fo:inline>
2073
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
2074
+ <fo:inline>
2075
+ <xsl:apply-templates/>
2076
+ </fo:inline>
2077
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
2078
+ <xsl:variable name="parent" select="local-name(..)"/>
2079
+
2080
+ <xsl:variable name="key_iso">
2081
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2082
+ </xsl:variable>
2083
+
2084
+ <xsl:choose>
2085
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2086
+
2087
+
2088
+ <fo:block margin-bottom="12pt" text-align="left">
2089
+
2090
+ <xsl:text>where </xsl:text>
2091
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2092
+ <xsl:text/>
2093
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2094
+ </fo:block>
2095
+
2096
+ </xsl:when>
2097
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2098
+ <fo:block margin-bottom="12pt" text-align="left">
2099
+
2100
+
2101
+
2102
+ <xsl:text>where</xsl:text>
2103
+ </fo:block>
2104
+ </xsl:when>
2105
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2106
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
2107
+
2108
+
2109
+ <xsl:text>Key</xsl:text>
2110
+ </fo:block>
2111
+ </xsl:when>
2112
+ </xsl:choose>
2113
+
2114
+ <!-- a few components -->
2115
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2116
+ <fo:block>
2117
+
2118
+
2119
+
2120
+
2121
+ <fo:block>
2122
+
2123
+ <!-- create virtual html table for dl/[dt and dd] -->
2124
+ <xsl:variable name="html-table">
2125
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2126
+ <xsl:element name="{$ns}:table">
2127
+ <tbody>
2128
+ <xsl:apply-templates mode="dl"/>
2129
+ </tbody>
2130
+ </xsl:element>
2131
+ </xsl:variable>
2132
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2133
+ <xsl:variable name="colwidths">
2134
+ <xsl:call-template name="calculate-column-widths">
2135
+ <xsl:with-param name="cols-count" select="2"/>
2136
+ <xsl:with-param name="table" select="$html-table"/>
2137
+ </xsl:call-template>
2138
+ </xsl:variable>
2139
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2140
+
2141
+ <fo:table width="95%" table-layout="fixed">
2142
+ <xsl:choose>
2143
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2144
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2145
+ </xsl:when>
2146
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2147
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2148
+
2149
+ </xsl:when>
2150
+ </xsl:choose>
2151
+ <xsl:choose>
2152
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2153
+ <fo:table-column column-width="50%"/>
2154
+ <fo:table-column column-width="50%"/>
2155
+ </xsl:when>
2156
+ <xsl:otherwise>
2157
+ <xsl:choose>
2158
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2159
+ <fo:table-column column-width="60%"/>
2160
+ <fo:table-column column-width="40%"/>
2161
+ </xsl:when> -->
2162
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2163
+ <fo:table-column column-width="50%"/>
2164
+ <fo:table-column column-width="50%"/>
2165
+ </xsl:when>
2166
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2167
+ <fo:table-column column-width="40%"/>
2168
+ <fo:table-column column-width="60%"/>
2169
+ </xsl:when>
2170
+ <xsl:otherwise>
2171
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2172
+ <xsl:choose>
2173
+ <xsl:when test=". = 1">
2174
+ <fo:table-column column-width="proportional-column-width(2)"/>
2175
+ </xsl:when>
2176
+ <xsl:otherwise>
2177
+ <fo:table-column column-width="proportional-column-width({.})"/>
2178
+ </xsl:otherwise>
2179
+ </xsl:choose>
2180
+ </xsl:for-each>
2181
+ </xsl:otherwise>
2182
+ </xsl:choose>
2183
+ <!-- <fo:table-column column-width="15%"/>
2184
+ <fo:table-column column-width="85%"/> -->
2185
+ </xsl:otherwise>
2186
+ </xsl:choose>
2187
+ <fo:table-body>
2188
+ <xsl:apply-templates>
2189
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2190
+ </xsl:apply-templates>
2191
+ </fo:table-body>
2192
+ </fo:table>
2193
+ </fo:block>
2194
+ </fo:block>
2195
+ </xsl:if>
2196
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
2197
+ <xsl:param name="key_iso"/>
2198
+
2199
+ <!-- <tr>
2200
+ <td>NOTE</td>
2201
+ <td>
2202
+ <xsl:apply-templates />
2203
+ </td>
2204
+ </tr>
2205
+ -->
2206
+ <fo:table-row>
2207
+ <fo:table-cell>
2208
+ <fo:block margin-top="6pt">
2209
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2210
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2211
+ </xsl:if>
2212
+ NOTE
2213
+ </fo:block>
2214
+ </fo:table-cell>
2215
+ <fo:table-cell>
2216
+ <fo:block>
2217
+ <xsl:apply-templates/>
2218
+ </fo:block>
2219
+ </fo:table-cell>
2220
+ </fo:table-row>
2221
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
2222
+ <tr>
2223
+ <td>
2224
+ <xsl:apply-templates/>
2225
+ </td>
2226
+ <td>
2227
+
2228
+
2229
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2230
+
2231
+ </td>
2232
+ </tr>
2233
+
2234
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
2235
+ <xsl:param name="key_iso"/>
2236
+
2237
+ <fo:table-row>
2238
+ <fo:table-cell>
2239
+ <fo:block margin-top="6pt">
2240
+
2241
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2242
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2243
+
2244
+ </xsl:if>
2245
+
2246
+
2247
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2248
+
2249
+ <xsl:apply-templates/>
2250
+ </fo:block>
2251
+ </fo:table-cell>
2252
+ <fo:table-cell>
2253
+ <fo:block>
2254
+
2255
+
2256
+
2257
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2258
+
2259
+ </fo:block>
2260
+ </fo:table-cell>
2261
+ </fo:table-row>
2262
+
2263
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
2264
+ <xsl:apply-templates/>
2265
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
2266
+ <xsl:apply-templates/>
2267
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2268
+ <fo:inline><xsl:apply-templates/></fo:inline>
2269
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
2270
+ <fo:inline font-style="italic">
2271
+ <xsl:apply-templates/>
2272
+ </fo:inline>
2273
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
2274
+ <fo:inline font-weight="bold">
2275
+ <xsl:apply-templates/>
2276
+ </fo:inline>
2277
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
2278
+ <fo:inline font-size="80%" vertical-align="super">
2279
+ <xsl:apply-templates/>
2280
+ </fo:inline>
2281
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
2282
+ <fo:inline font-size="80%" vertical-align="sub">
2283
+ <xsl:apply-templates/>
2284
+ </fo:inline>
2285
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
2286
+ <fo:inline font-family="Courier" font-size="10pt">
2287
+ <xsl:apply-templates/>
2288
+ </fo:inline>
2289
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
2290
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2291
+ <xsl:apply-templates/>
2292
+ </fo:inline>
2293
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
2294
+ <xsl:variable name="text" select="normalize-space(.)"/>
2295
+ <fo:inline font-size="75%">
2296
+ <xsl:if test="string-length($text) &gt; 0">
2297
+ <xsl:call-template name="recursiveSmallCaps">
2298
+ <xsl:with-param name="text" select="$text"/>
2299
+ </xsl:call-template>
2300
+ </xsl:if>
2301
+ </fo:inline>
2302
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
2303
+ <xsl:param name="text"/>
2304
+ <xsl:variable name="char" select="substring($text,1,1)"/>
2305
+ <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2306
+ <xsl:choose>
2307
+ <xsl:when test="$char=$upperCase">
2308
+ <fo:inline font-size="{100 div 0.75}%">
2309
+ <xsl:value-of select="$upperCase"/>
2310
+ </fo:inline>
2311
+ </xsl:when>
2312
+ <xsl:otherwise>
2313
+ <xsl:value-of select="$upperCase"/>
2314
+ </xsl:otherwise>
2315
+ </xsl:choose>
2316
+ <xsl:if test="string-length($text) &gt; 1">
2317
+ <xsl:call-template name="recursiveSmallCaps">
2318
+ <xsl:with-param name="text" select="substring($text,2)"/>
2319
+ </xsl:call-template>
2320
+ </xsl:if>
2321
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
2322
+ <xsl:param name="text"/>
2323
+ <xsl:param name="separator" select="' '"/>
2324
+ <xsl:choose>
2325
+ <xsl:when test="not(contains($text, $separator))">
2326
+ <word>
2327
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
2328
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
2329
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
2330
+ <xsl:variable name="len_str">
2331
+ <xsl:choose>
2332
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
2333
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
2334
+ </xsl:when>
2335
+ <xsl:otherwise>
2336
+ <xsl:value-of select="$len_str_tmp"/>
2337
+ </xsl:otherwise>
2338
+ </xsl:choose>
2339
+ </xsl:variable>
2340
+
2341
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
2342
+ <xsl:message>
2343
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
2344
+ len_str=<xsl:value-of select="$len_str"/>
2345
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
2346
+ </xsl:message>
2347
+ </xsl:if> -->
2348
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
2349
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
2350
+ <xsl:choose>
2351
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
2352
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
2353
+ </xsl:when>
2354
+ <xsl:otherwise>
2355
+ <xsl:value-of select="$len_str"/>
2356
+ </xsl:otherwise>
2357
+ </xsl:choose>
2358
+ </word>
2359
+ </xsl:when>
2360
+ <xsl:otherwise>
2361
+ <word>
2362
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
2363
+ </word>
2364
+ <xsl:call-template name="tokenize">
2365
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
2366
+ </xsl:call-template>
2367
+ </xsl:otherwise>
2368
+ </xsl:choose>
2369
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
2370
+ <xsl:param name="words"/>
2371
+ <xsl:for-each select="$words//word">
2372
+ <xsl:sort select="." data-type="number" order="descending"/>
2373
+ <xsl:if test="position()=1">
2374
+ <xsl:value-of select="."/>
2375
+ </xsl:if>
2376
+ </xsl:for-each>
2377
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
2378
+ <xsl:param name="text" select="."/>
2379
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2380
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
2381
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
2382
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2383
+ <xsl:variable name="zero-space">​</xsl:variable>
2384
+ <xsl:choose>
2385
+ <xsl:when test="contains($text, $zero-space-after-chars)">
2386
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
2387
+ <xsl:value-of select="$zero-space-after-chars"/>
2388
+ <xsl:value-of select="$zero-space"/>
2389
+ <xsl:call-template name="add-zero-spaces">
2390
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
2391
+ </xsl:call-template>
2392
+ </xsl:when>
2393
+ <xsl:when test="contains($text, $zero-space-after-dot)">
2394
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
2395
+ <xsl:value-of select="$zero-space-after-dot"/>
2396
+ <xsl:value-of select="$zero-space"/>
2397
+ <xsl:call-template name="add-zero-spaces">
2398
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
2399
+ </xsl:call-template>
2400
+ </xsl:when>
2401
+ <xsl:when test="contains($text, $zero-space-after-colon)">
2402
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
2403
+ <xsl:value-of select="$zero-space-after-colon"/>
2404
+ <xsl:value-of select="$zero-space"/>
2405
+ <xsl:call-template name="add-zero-spaces">
2406
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
2407
+ </xsl:call-template>
2408
+ </xsl:when>
2409
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2410
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2411
+ <xsl:value-of select="$zero-space-after-equal"/>
2412
+ <xsl:value-of select="$zero-space"/>
2413
+ <xsl:call-template name="add-zero-spaces">
2414
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2415
+ </xsl:call-template>
2416
+ </xsl:when>
2417
+ <xsl:otherwise>
2418
+ <xsl:value-of select="$text"/>
2419
+ </xsl:otherwise>
2420
+ </xsl:choose>
2421
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
2422
+ <xsl:param name="text" select="."/>
2423
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
2424
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2425
+ <xsl:variable name="zero-space">​</xsl:variable>
2426
+ <xsl:choose>
2427
+ <xsl:when test="contains($text, $zero-space-after-equals)">
2428
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
2429
+ <xsl:value-of select="$zero-space-after-equals"/>
2430
+ <xsl:value-of select="$zero-space"/>
2431
+ <xsl:call-template name="add-zero-spaces-equal">
2432
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
2433
+ </xsl:call-template>
2434
+ </xsl:when>
2435
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2436
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2437
+ <xsl:value-of select="$zero-space-after-equal"/>
2438
+ <xsl:value-of select="$zero-space"/>
2439
+ <xsl:call-template name="add-zero-spaces-equal">
2440
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2441
+ </xsl:call-template>
2442
+ </xsl:when>
2443
+ <xsl:otherwise>
2444
+ <xsl:value-of select="$text"/>
2445
+ </xsl:otherwise>
2446
+ </xsl:choose>
2447
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
2448
+ <xsl:variable name="simple-table">
2449
+
2450
+ <!-- Step 1. colspan processing -->
2451
+ <xsl:variable name="simple-table-colspan">
2452
+ <tbody>
2453
+ <xsl:apply-templates mode="simple-table-colspan"/>
2454
+ </tbody>
2455
+ </xsl:variable>
2456
+
2457
+ <!-- Step 2. rowspan processing -->
2458
+ <xsl:variable name="simple-table-rowspan">
2459
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
2460
+ </xsl:variable>
2461
+
2462
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
2463
+
2464
+ <!-- <xsl:choose>
2465
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
2466
+
2467
+ </xsl:when>
2468
+ <xsl:otherwise>
2469
+ <xsl:copy-of select="current()"/>
2470
+ </xsl:otherwise>
2471
+ </xsl:choose> -->
2472
+ </xsl:variable>
2473
+ <xsl:copy-of select="$simple-table"/>
2474
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
2475
+ <xsl:apply-templates mode="simple-table-colspan"/>
2476
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
2477
+ <xsl:choose>
2478
+ <xsl:when test="@colspan">
2479
+ <xsl:variable name="td">
2480
+ <xsl:element name="td">
2481
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
2482
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2483
+ <xsl:apply-templates mode="simple-table-colspan"/>
2484
+ </xsl:element>
2485
+ </xsl:variable>
2486
+ <xsl:call-template name="repeatNode">
2487
+ <xsl:with-param name="count" select="@colspan"/>
2488
+ <xsl:with-param name="node" select="$td"/>
2489
+ </xsl:call-template>
2490
+ </xsl:when>
2491
+ <xsl:otherwise>
2492
+ <xsl:element name="td">
2493
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2494
+ <xsl:apply-templates mode="simple-table-colspan"/>
2495
+ </xsl:element>
2496
+ </xsl:otherwise>
2497
+ </xsl:choose>
2498
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
2499
+ <xsl:element name="tr">
2500
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2501
+ <xsl:apply-templates mode="simple-table-colspan"/>
2502
+ </xsl:element>
2503
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
2504
+ <xsl:copy>
2505
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
2506
+ </xsl:copy>
2507
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
2508
+ <xsl:param name="count"/>
2509
+ <xsl:param name="node"/>
2510
+
2511
+ <xsl:if test="$count &gt; 0">
2512
+ <xsl:call-template name="repeatNode">
2513
+ <xsl:with-param name="count" select="$count - 1"/>
2514
+ <xsl:with-param name="node" select="$node"/>
2515
+ </xsl:call-template>
2516
+ <xsl:copy-of select="$node"/>
2517
+ </xsl:if>
2518
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
2519
+ <xsl:copy>
2520
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
2521
+ </xsl:copy>
2522
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
2523
+ <xsl:copy>
2524
+ <xsl:copy-of select="tr[1]"/>
2525
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
2526
+ <xsl:with-param name="previousRow" select="tr[1]"/>
2527
+ </xsl:apply-templates>
2528
+ </xsl:copy>
2529
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
2530
+ <xsl:param name="previousRow"/>
2531
+ <xsl:variable name="currentRow" select="."/>
2532
+
2533
+ <xsl:variable name="normalizedTDs">
2534
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
2535
+ <xsl:choose>
2536
+ <xsl:when test="@rowspan &gt; 1">
2537
+ <xsl:copy>
2538
+ <xsl:attribute name="rowspan">
2539
+ <xsl:value-of select="@rowspan - 1"/>
2540
+ </xsl:attribute>
2541
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
2542
+ <xsl:copy-of select="node()"/>
2543
+ </xsl:copy>
2544
+ </xsl:when>
2545
+ <xsl:otherwise>
2546
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
2547
+ </xsl:otherwise>
2548
+ </xsl:choose>
2549
+ </xsl:for-each>
2550
+ </xsl:variable>
2551
+
2552
+ <xsl:variable name="newRow">
2553
+ <xsl:copy>
2554
+ <xsl:copy-of select="$currentRow/@*"/>
2555
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
2556
+ </xsl:copy>
2557
+ </xsl:variable>
2558
+ <xsl:copy-of select="$newRow"/>
2559
+
2560
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
2561
+ <xsl:with-param name="previousRow" select="$newRow"/>
2562
+ </xsl:apply-templates>
2563
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
2564
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2565
+ <xsl:choose>
2566
+ <xsl:when test="$language = 'English'">en</xsl:when>
2567
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
2568
+ </xsl:choose>
2569
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
2570
+ <xsl:param name="str"/>
2571
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
2572
+ <xsl:choose>
2573
+ <xsl:when test="contains($str2, ' ')">
2574
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
2575
+ <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
2576
+ <xsl:value-of select="substring($substr, 2)"/>
2577
+ <xsl:text> </xsl:text>
2578
+ <xsl:call-template name="capitalizeWords">
2579
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
2580
+ </xsl:call-template>
2581
+ </xsl:when>
2582
+ <xsl:otherwise>
2583
+ <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
2584
+ <xsl:value-of select="substring($str2, 2)"/>
2585
+ </xsl:otherwise>
2586
+ </xsl:choose>
2587
+ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
2588
+ <fo:inline font-family="STIX2Math">
2589
+ <fo:instream-foreign-object fox:alt-text="Math">
2590
+ <xsl:copy-of select="."/>
2591
+ </fo:instream-foreign-object>
2592
+ </fo:inline>
2593
+ </xsl:template></xsl:stylesheet>