metanorma-m3aawg 1.4.0

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