-
Notifications
You must be signed in to change notification settings - Fork 122
/
fo.xsl
387 lines (387 loc) · 15.6 KB
/
fo.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<root>
<layout-master-set>
<simple-page-master master-name="cover">
<region-body margin-left="1in" margin-right="1in" margin-top="2.5in" margin-bottom="1in"/>
</simple-page-master>
<!--<simple-page-master master-name="doc_info">
<region-body margin-left="1in" margin-top="1in" margin-right="1in" margin-bottom="1in"/>
</simple-page-master>
<simple-page-master master-name="toc_page">
<region-body margin-left="1in" margin-top="1in" margin-right="1in" margin-bottom="1in"/>
</simple-page-master>-->
<simple-page-master master-name="std_page">
<region-body margin-left="1in" margin-top="1in" margin-right="1in" margin-bottom="1in"/>
<region-before extent="1in" display-align="after"/>
<region-after extent="1in" display-align="before"/>
</simple-page-master>
<page-sequence-master master-name="jep_sequence">
<single-page-master-reference master-reference="cover"/>
<!--<single-page-master-reference master-reference="doc_info"/>
<single-page-master-reference master-reference="toc_page"/>-->
<repeatable-page-master-reference master-reference="std_page"/>
</page-sequence-master>
</layout-master-set>
<page-sequence master-reference="jep_sequence">
<flow flow-name="xsl-region-body" font-family="serif" color="black" font-size="10pt">
<block space-before="1.5in" text-align="right" font-family="sans-serif" font-size="18pt">
XEP-<xsl:value-of select="/jep/header/number"/>
</block>
<block text-align="right" font-family="sans-serif" font-size="18pt">
<xsl:value-of select="/jep/header/title"/>
</block>
<!--</flow>
</page-sequence>
<page-sequence master-reference="doc_info">
<flow flow-name="xsl-region-body" font-family="serif" font-size="10pt" color="black">-->
<block font-family="sans-serif" font-size="14pt" space-after=".5em" break-before="page">Document Information</block>
<block font-size="12pt" font-weight="bold">Document Author(s)</block>
<block>
<inline font-weight="bold">Name: </inline>
<inline>
<xsl:value-of select="/jep/header/author/firstname"/>
<xsl:value-of select="/jep/header/author/surname"/>
</inline>
</block>
<block>
<inline font-weight="bold">Email: </inline>
<inline>
<xsl:value-of select="/jep/header/author/email"/>
</inline>
</block>
<block space-after=".5em">
<inline font-weight="bold">JID: </inline>
<inline>
<xsl:value-of select="/jep/header/author/jid"/>
</inline>
</block>
<block font-size="12pt" font-weight="bold">Abstract</block>
<block space-after=".5em">
<xsl:value-of select="/jep/header/abstract"/>
</block>
<block font-size="12pt" font-weight="bold">Document Status</block>
<block space-after=".5em">
<xsl:value-of select="/jep/header/status"/>
</block>
<block font-size="12pt" font-weight="bold">Dependencies/References</block>
<block space-after=".5em">
<xsl:value-of select="/jep/header/dependencies"/>
</block>
<block font-size="12pt" font-weight="bold">Legal Notice</block>
<block space-after=".5em">
<xsl:value-of select="/jep/header/legal"/>
</block>
<block font-size="12pt" font-weight="bold" space-after=".5em">Revision History</block>
<table table-layout="fixed" border-width=".25pt" border-color="black" border-style="solid">
<table-column text-align="center" column-width=".625in" column-number="1"/>
<table-column text-align="center" column-width=".75in" column-number="2"/>
<table-column text-align="center" column-width=".5in" column-number="3"/>
<table-column column-width="4.125in" column-number="4"/>
<table-body>
<table-row background-color="black" color="white" font-weight="bold">
<table-cell padding="3pt">
<block>Version</block>
</table-cell>
<table-cell padding="3pt">
<block>Date</block>
</table-cell>
<table-cell padding="3pt">
<block>Initials</block>
</table-cell>
<table-cell padding="3pt">
<block>Comment</block>
</table-cell>
</table-row>
<xsl:apply-templates select="/jep/header"/>
</table-body>
</table>
<!--</flow>
</page-sequence>
<page-sequence master-reference="toc_page" force-page-count="no-force" format="i">
<flow flow-name="xsl-region-body" font-family="serif" font-size="10pt" color="black">-->
<xsl:call-template name="processTOC"/>
</flow>
</page-sequence>
<page-sequence master-reference="std_page" initial-page-number="1">
<static-content flow-name="xsl-region-after">
<block margin-left="1in" margin-right="1in" padding-top="10pt" border-before-color="black" border-before-width=".125pt" border-before-style="solid" text-align-last="justify" font-size="8pt" font-family="sans-serif" color="black">
XEP-<xsl:value-of select="/jep/header/number"/>:<xsl:text> </xsl:text>
<xsl:value-of select="/jep/header/title"/>
<leader leader-pattern="space"/>
Page <page-number/> of <page-number-citation ref-id="lastpage"/>
</block>
</static-content>
<flow flow-name="xsl-region-body" font-family="serif" font-size="10pt" color="black">
<xsl:apply-templates select="/jep/section1"/>
<block font-family="sans-serif" font-size="12pt" color="black" space-before=".5em" space-after=".5em">Notes:</block>
<xsl:apply-templates select="//note" mode="endlist"/>
<block id="lastpage"/>
</flow>
</page-sequence>
</root>
</xsl:template>
<!-- From the docbook XSL -->
<xsl:template name="object.id">
<xsl:param name="object" select="."/>
<xsl:choose>
<xsl:when test="$object/@id">
<xsl:value-of select="$object/@id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id($object)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="processTOC">
<block font-family="sans-serif" font-size="14pt" space-after=".5em" break-before="page">Table of Contents</block>
<xsl:apply-templates select="//section1" mode="toc"/>
</xsl:template>
<xsl:template match="/jep/header/revision">
<table-row>
<table-cell padding="3pt">
<block>
<xsl:value-of select="version"/>
</block>
</table-cell>
<table-cell padding="3pt">
<block>
<xsl:value-of select="date"/>
</block>
</table-cell>
<table-cell padding="3pt">
<block>
<xsl:value-of select="initials"/>
</block>
</table-cell>
<table-cell padding="3pt">
<block>
<xsl:value-of select="remark"/>
</block>
</table-cell>
</table-row>
</xsl:template>
<xsl:template match="section1" mode="toc">
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="num">
<xsl:number level="multiple" count="section1"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<xsl:variable name="sect2.count" select="count(section2)"/>
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<block text-align-last="justify" font-variant="small-caps">
<xsl:value-of select="$num"/>
<xsl:value-of select="@topic"/>
<xsl:text> </xsl:text>
<leader leader-pattern="rule" space-end=".125in"/>
<xsl:text> </xsl:text>
<page-number-citation ref-id="sect-{$oid}"/>
</block>
<xsl:if test="$sect2.count > 0">
<xsl:apply-templates select="section2" mode="toc">
<xsl:with-param name="prevnum" select="$num"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="section1">
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="num">
<xsl:number level="multiple" count="section1"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<!--<xsl:number level="single" count="section1"/>-->
<block id="sect-{$oid}" font-family="sans-serif" font-size="14pt" space-after="1em" space-before="1em" font-weight="bold">
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@topic"/>
</block>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="section2" mode="toc">
<xsl:param name="prevnum" select='""'/>
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="num">
<xsl:value-of select="$prevnum"/>
<xsl:number level="multiple" count="section2"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<xsl:variable name="sect3.count" select="count(section3)"/>
<block text-align-last="justify" margin-left="1em">
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@topic"/>
<xsl:text> </xsl:text>
<leader leader-pattern="rule" space-end=".125in"/>
<xsl:text> </xsl:text>
<page-number-citation ref-id="sect-{$oid}"/>
</block>
<xsl:if test="$sect3.count > 0">
<xsl:apply-templates select="section3" mode="toc">
<xsl:with-param name="prevnum" select="$num"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="section2">
<xsl:param name="prevnum" select='""'/>
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="num">
<xsl:number level="single" count="section1"/>.<xsl:number level="multiple" count="section2"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<xsl:variable name="sect3.count" select="count(section3)"/>
<block id="sect-{$oid}" font-weight="bold" font-family="sans-serif">
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@topic"/>
</block>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="section3" mode="toc">
<xsl:param name="prevnum" select='""'/>
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="num">
<xsl:value-of select="$prevnum"/>
<xsl:number level="multiple" count="section3"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<block text-align-last="justify" margin-left="1em">
<xsl:value-of select="$num"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@topic"/>
<xsl:text> </xsl:text>
<leader leader-pattern="rule" space-end=".125in"/>
<xsl:text> </xsl:text>
<page-number-citation ref-id="sect-{$oid}"/>
</block>
</xsl:template>
<xsl:template match="section3">
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<block id="sect-{$oid}" margin-left=".5em">
<xsl:if test="../../@type='functional-spec'">FR-<xsl:number level="single" count="section2"/>.<xsl:number level="single" count="section3"/>
</xsl:if>
<xsl:if test="../../@type='supp-spec'">SS-<xsl:number level="single" count="section2"/>.<xsl:number level="single" count="section3"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="@topic"/>
<xsl:apply-templates/>
</block>
</xsl:template>
<xsl:template match="p">
<block space-before=".5em" space-after=".5em">
<xsl:apply-templates/>
</block>
</xsl:template>
<xsl:template match="code">
<block space-after="1em" margin-bottom="1em" margin-left="1em" font-family="monospace" font-size="8pt" font-weight="normal" white-space-collapse="false" keep-together.within-page="always">
<xsl:value-of select="."/>
</block>
</xsl:template>
<xsl:template match="example">
<table table-layout="fixed" width="100%" space-after="1em">
<table-column column-width="proportional-column-width(1)"/>
<table-body>
<table-row keep-with-next="always">
<table-cell>
<block margin-left=".5em" space-after=".5em" space-before=".5em" font-weight="600" font-size="9pt">
Example <xsl:number level="any" count="example"/>.<xsl:text> </xsl:text>
<xsl:value-of select="@caption"/>
</block>
</table-cell>
</table-row>
<table-row>
<table-cell>
<block margin-left="1em" font-family="monospace" font-size="8pt" font-weight="normal" white-space-collapse="false" keep-together.within-page="always">
<xsl:value-of select="."/>
</block>
</table-cell>
</table-row>
</table-body>
</table>
</xsl:template>
<xsl:template match="note">
<xsl:variable name="notenum">
<xsl:number level="any" count="note"/>
</xsl:variable>
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<inline>[<basic-link color="blue" font-weight="bold" internal-destination="nt-{$oid}">
<xsl:value-of select="$notenum"/>
</basic-link>]</inline>
</xsl:template>
<xsl:template match="note" mode="endlist">
<xsl:variable name="oid">
<xsl:call-template name="object.id"/>
</xsl:variable>
<block id="nt-{$oid}" margin=".5em" font-size="8pt">
<xsl:value-of select="position()"/>. <xsl:apply-templates/>
</block>
</xsl:template>
<xsl:template match="link">
<basic-link external-destination="{@url}" text-decoration="underline" color="blue">
<xsl:apply-templates/>
</basic-link>
</xsl:template>
<xsl:template match="strong">
<inline font-weight="bold">
<xsl:apply-templates/>
</inline>
</xsl:template>
<xsl:template match="em">
<inline font-style="italic">
<xsl:apply-templates/>
</inline>
</xsl:template>
<xsl:template match="ul">
<list-block provisional-distance-between-starts="10pt" provisional-label-separation="3pt" space-after=".5em" space-start="1em" margin-left="1em">
<xsl:apply-templates select="li" mode="ul"/>
</list-block>
</xsl:template>
<xsl:template match="ol">
<list-block provisional-distance-between-starts="10pt" provisional-label-separation="3pt" space-after=".5em" space-start="1em" margin-left="1em">
<xsl:apply-templates select="li" mode="ol"/>
</list-block>
</xsl:template>
<xsl:template match="li" mode="ul">
<list-item>
<list-item-label end-indent="label-end()">
<block>•</block>
</list-item-label>
<list-item-body start-indent="body-start()">
<block>
<xsl:value-of select="."/>
</block>
</list-item-body>
</list-item>
</xsl:template>
<xsl:template match="li" mode="ol">
<xsl:variable name="num">
<xsl:number level="multiple" count="li"/>
</xsl:variable>
<list-item>
<list-item-label end-indent="label-end()">
<block>
<xsl:value-of select="$num"/>.</block>
</list-item-label>
<list-item-body start-indent="body-start()">
<block>
<xsl:value-of select="."/>
</block>
</list-item-body>
</list-item>
</xsl:template>
</xsl:stylesheet>