metanorma-cc 1.6.6 → 1.6.7

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