fabulator 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/History.txt +30 -1
  2. data/VERSION +1 -1
  3. data/features/functions.feature +7 -0
  4. data/features/primitives.feature +1 -1
  5. data/features/step_definitions/template_steps.rb +40 -3
  6. data/features/step_definitions/xml_steps.rb +3 -2
  7. data/features/templates.feature +49 -22
  8. data/features/types.feature +4 -4
  9. data/lib/fabulator.rb +4 -0
  10. data/lib/fabulator/compiler.rb +27 -0
  11. data/lib/fabulator/core.rb +3 -8
  12. data/lib/fabulator/core/actions/choose.rb +0 -18
  13. data/lib/fabulator/core/actions/for_each.rb +0 -48
  14. data/lib/fabulator/core/{actions.rb → lib.rb} +189 -117
  15. data/lib/fabulator/core/structurals.rb +7 -0
  16. data/lib/fabulator/core/{constraint.rb → structurals/constraint.rb} +2 -0
  17. data/lib/fabulator/core/{filter.rb → structurals/filter.rb} +2 -0
  18. data/lib/fabulator/core/{group.rb → structurals/group.rb} +2 -0
  19. data/lib/fabulator/core/{parameter.rb → structurals/parameter.rb} +2 -0
  20. data/lib/fabulator/core/{state.rb → structurals/state.rb} +2 -0
  21. data/lib/fabulator/core/{state_machine.rb → structurals/state_machine.rb} +2 -0
  22. data/lib/fabulator/core/{transition.rb → structurals/transition.rb} +2 -0
  23. data/lib/fabulator/expr.rb +6 -0
  24. data/lib/fabulator/expr/context.rb +65 -10
  25. data/lib/fabulator/expr/node_logic.rb +3 -2
  26. data/lib/fabulator/expr/parser.rb +787 -638
  27. data/lib/fabulator/expr/statement_list.rb +27 -0
  28. data/lib/fabulator/lib.rb +3 -0
  29. data/lib/fabulator/lib/action.rb +12 -9
  30. data/lib/fabulator/lib/lib.rb +85 -9
  31. data/lib/fabulator/structural.rb +24 -5
  32. data/lib/fabulator/tag_lib.rb +78 -124
  33. data/lib/fabulator/tag_lib/presentations.rb +39 -0
  34. data/lib/fabulator/tag_lib/transformations.rb +66 -0
  35. data/lib/fabulator/tag_lib/type.rb +176 -0
  36. data/lib/fabulator/template/parse_result.rb +125 -62
  37. data/lib/fabulator/template/parser.rb +17 -1
  38. data/xslt/form.xsl +163 -2083
  39. data/xsm_expression_parser.racc +35 -20
  40. metadata +17 -13
  41. data/lib/fabulator/context.rb +0 -39
@@ -11,8 +11,24 @@ module Fabulator::Template
11
11
  @parser = Radius::Parser.new(@context, :tag_prefix => 'r')
12
12
  end
13
13
  @context.globals.context = context
14
+
15
+ # N.B.: these substitutions work around a bug in Radius that shows
16
+ # up when working with XML+namespaces
17
+
18
+ text.gsub!(/&/, '&')
19
+ text.gsub!(/<\//, '&lt;/')
20
+ text.gsub!(/&lt;\/r:/, '</r:')
21
+
14
22
  r = @parser.parse(text)
15
- (Fabulator::Template::ParseResult.new(r) rescue r)
23
+
24
+ r.gsub!(/&lt;\//, '</')
25
+ r.gsub!(/&amp;/, '&')
26
+
27
+ begin
28
+ Fabulator::Template::ParseResult.new(r)
29
+ rescue => e
30
+ "<!-- unable to parse XML: #{e} -->" + r
31
+ end
16
32
  end
17
33
  end
18
34
  end
@@ -1,2160 +1,240 @@
1
1
  <?xml version="1.0" ?>
2
-
3
2
  <xsl:stylesheet
4
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
- version="1.0"
6
- >
7
-
8
- <xsl:output
9
- method="html"
10
- indent="yes"
11
- />
12
- <!--
13
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
14
- doctype-system="DTD/xhtml1-strict.dtd"
15
- / -->
16
-
17
- <xsl:variable name="admon.graphics" select="0"/>
18
- <xsl:variable name="admon.style" select="''"/>
19
- <xsl:variable name="admon.textlabel" select="0"/>
20
-
21
- <xsl:template match="/">
22
- <xsl:apply-templates select="view|error"/>
23
- </xsl:template>
24
-
25
- <xsl:template match="/view">
26
- <xsl:choose>
27
- <xsl:when test="count(//container[@id and not(ancestor::container[@id] | ancestor::form)] | //form[not(ancestor::container[@id] | ancestor::form)]) > 1">
28
- <form>
29
- <xsl:attribute name="method">
30
- <xsl:choose>
31
- <xsl:when test="@method = 'POST'">POST</xsl:when>
32
- <xsl:when test=".//asset">POST</xsl:when>
33
- <xsl:when test=".//textbox">POST</xsl:when>
34
- <xsl:when test=".//editbox">POST</xsl:when>
35
- <xsl:otherwise>POST</xsl:otherwise>
36
- </xsl:choose>
37
- </xsl:attribute>
38
- <xsl:if test=".//asset">
39
- <xsl:attribute name="type">application/x-multipart</xsl:attribute>
40
- </xsl:if>
41
- <xsl:call-template name="view-body"/>
42
- </form>
43
- </xsl:when>
44
- <xsl:otherwise>
45
- <xsl:call-template name="view-body"/>
46
- </xsl:otherwise>
47
- </xsl:choose>
48
- </xsl:template>
49
-
50
- <xsl:template name="view-body">
51
- <div class="fabulator-content">
52
- <xsl:apply-templates select="*"/>
53
- </div>
54
- </xsl:template>
55
-
56
- <xsl:template match="container">
57
- <xsl:choose>
58
- <xsl:when test="@id and count(//container[@id and not(ancestor::container[@id] | ancestor::form)] | //form[not(ancestor::container[@id] | ancestor::form)]) > 1">
59
- <xsl:call-template name="container"/>
60
- </xsl:when>
61
- <xsl:otherwise>
62
- <form>
63
- <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
64
- <xsl:attribute name="method">
65
- <xsl:choose>
66
- <xsl:when test="@method = 'POST'">POST</xsl:when>
67
- <xsl:when test=".//asset">POST</xsl:when>
68
- <xsl:when test=".//textbox">POST</xsl:when>
69
- <xsl:when test=".//editbox">POST</xsl:when>
70
- <xsl:otherwise>POST</xsl:otherwise>
71
- </xsl:choose>
72
- </xsl:attribute>
73
- <xsl:if test=".//asset">
74
- <xsl:attribute name="type">application/x-multipart</xsl:attribute>
75
- </xsl:if>
76
- <xsl:call-template name="container"/>
77
- </form>
78
- </xsl:otherwise>
79
- </xsl:choose>
80
- </xsl:template>
81
-
82
- <xsl:template name="container">
83
- <!-- allowed to have rows="" and cols="" -->
84
- <div class="container">
85
- <xsl:if test="not(@id = '_embedded')">
86
- <div class="container-title">
87
- <xsl:value-of select=".//title"/>
88
- </div>
89
- </xsl:if>
90
- <xsl:if test="navigation[@type='main']">
91
- <div class="container-main-navigation">
92
- <xsl:apply-templates select="navigation[@type='main']"/>
93
- </div>
94
- </xsl:if>
95
- <xsl:for-each select="navigation[@type='sub']">
96
- <div class="container-sub-navigation">
97
- <!--
98
- <td width="95%" valign="top" bgcolor="#3f3f7f" colspan="2" class="container-sub-navigation">
99
- -->
100
- <xsl:apply-templates/>
101
- </div>
102
- </xsl:for-each>
103
- <xsl:for-each select="head"> <!-- class="container-head"> -->
104
- <div class="container-head">
105
- <xsl:apply-templates/>
106
- </div>
107
- </xsl:for-each>
108
- <div class="container-content">
109
- <xsl:apply-templates select="content"/>
110
- </div>
111
- <xsl:for-each select="foot">
112
- <div class="container-foot">
113
- <xsl:apply-templates/>
114
- </div>
115
- </xsl:for-each>
116
- </div>
117
- </xsl:template>
118
-
119
- <!--
120
- ** Misc. structure elements
121
- -->
122
-
123
- <xsl:template match="content">
124
- <xsl:if test="not(.//container)">
125
- <xsl:if test=".//section">
126
- <a name="toc">
127
- <xsl:apply-templates select=".//section" mode="toc"/>
128
- </a>
129
- </xsl:if>
130
- </xsl:if>
131
- <xsl:apply-templates/>
132
- <xsl:if test=".//footnote">
133
- <h2 class="section">Endnotes</h2>
134
- <xsl:apply-templates select=".//footnote" mode="endnotes"/>
135
- </xsl:if>
136
- </xsl:template>
137
- <xsl:template match="content//error//title"/>
138
-
139
-
140
- <xsl:template match="containers">
141
- <!-- need to figure out how to stream -->
142
- <!-- stream="horizontal|vertical"
143
- cols="number of columns" -->
144
- <xsl:choose>
145
- <xsl:when test="0 and @cols > 1">
146
- <xsl:variable name="cols_available"><xsl:value-of select="@cols"/></xsl:variable>
147
- <table>
148
- <tr>
149
- <xsl:choose>
150
- <xsl:when test="@stream = 'vertical'">
151
- </xsl:when>
152
- <xsl:otherwise> <!-- horizontal -->
153
- <xsl:for-each select="container">
154
- <!-- need to have a tmp var holding current cols
155
- when we are going to exceed it, emit </tr><tr>
156
- -->
157
- <xsl:variable name="cur_pos"><xsl:value-of select="position()"/></xsl:variable>
158
- <xsl:variable name="prev_cols"><xsl:value-of select="../container[$cur_pos - 1]/@cols"/></xsl:variable>
159
- <xsl:variable name="full_width"><xsl:value-of select="sum(../container[$cur_pos >= position()]/@cols)"/></xsl:variable>
160
- <xsl:variable name="last_cols_width"><xsl:value-of select="sum(../container[$cur_pos >= position() and position() > $cur_pos - $cols_available]/@cols)"/></xsl:variable>
161
- <xsl:if test="position() > 1">
162
- <xsl:choose>
163
- <xsl:when test="@cols + $prev_cols >= $cols_available and $cols_available > $prev_cols">
164
- <![CDATA[</tr><tr>]]>
165
- </xsl:when>
166
- <!--
167
- <xsl:when test="(($full_width - @cols) mod $cols_available) > ($full_width mod $cols_available)">
168
- <![CDATA[</tr><tr>]]>
169
- </xsl:when>
170
- -->
171
- </xsl:choose>
172
- </xsl:if>
173
- <td valign="top">
174
- <xsl:attribute name="colspan"><xsl:value-of select="@cols"/></xsl:attribute>
175
- <xsl:call-template name="container"/>
176
- </td>
177
- <!-- we need better logic than this... maybe -->
178
- <xsl:if test="last() > position()">
179
- <xsl:choose>
180
- <xsl:when test="@cols >= $cols_available">
181
- <![CDATA[</tr><tr>]]>
182
- </xsl:when>
183
- <!-- -->
184
- <xsl:when test="(($full_width - @cols) mod $cols_available) > ($full_width mod $cols_available)">
185
- <![CDATA[</tr><tr>]]>
186
- </xsl:when>
187
- <!-- -->
188
- </xsl:choose>
189
- </xsl:if>
190
- </xsl:for-each>
191
- </xsl:otherwise>
192
- </xsl:choose>
193
- </tr>
194
- </table>
195
- </xsl:when>
196
-
197
- <xsl:otherwise> <!-- simple stream them out without an enclosing table -->
198
- <xsl:apply-templates/>
199
- </xsl:otherwise>
200
- </xsl:choose>
201
- </xsl:template>
202
-
203
- <!-- doc elements -->
204
-
205
- <xsl:template match="abbrev">
206
- <xsl:apply-templates/>
207
- </xsl:template>
208
-
209
- <xsl:template match="abstract">
210
- <div class="abstract">
211
- <xsl:apply-templates/>
212
- </div>
213
- </xsl:template>
214
-
215
- <xsl:template match="accel">
216
- <span style="text-decoration: underline"><xsl:apply-templates/></span>
217
- </xsl:template>
218
-
219
- <xsl:template match="akno">
220
- <div class="akno">
221
- <xsl:apply-templates/>
222
- </div>
223
- </xsl:template>
224
-
225
- <xsl:template match="acronym">
226
- <xsl:apply-templates/>
227
- </xsl:template>
228
-
229
- <xsl:template match="action">
230
- <span class="action">
231
- <xsl:apply-templates/>
232
- </span>
233
- </xsl:template>
234
-
235
- <xsl:template match="address">
236
- <div class="address">
237
- <xsl:apply-templates/>
238
- </div>
239
- </xsl:template>
240
-
241
- <xsl:template match="affiliation">
242
- <xsl:apply-templates/>
243
- </xsl:template>
244
-
245
- <xsl:template match="authorblurb">
246
- <xsl:apply-templates/>
247
- </xsl:template>
248
-
249
- <xsl:template match="blockquote">
250
- <blockquote><xsl:apply-templates/></blockquote>
251
- </xsl:template>
252
-
253
- <xsl:template match="city">
254
- <xsl:apply-templates/>
255
- </xsl:template>
256
-
257
- <xsl:template match="contrib">
258
- <xsl:apply-templates/>
259
- </xsl:template>
260
-
261
- <xsl:template match="country">
262
- <xsl:apply-templates/>
263
- </xsl:template>
264
-
265
- <xsl:template match="email">
266
- <a><xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute>&lt;<xsl:value-of select="."/>&gt;</a>
267
- </xsl:template>
268
-
269
- <xsl:template match="emphasis">
270
- <em class="emphasis">
271
- <xsl:apply-templates/>
272
- </em>
273
- </xsl:template>
274
-
275
- <xsl:template match="emphasis/emphasis">
276
- <span style="font-style: normal">
277
- <xsl:apply-templates/>
278
- </span>
279
- </xsl:template>
280
-
281
- <xsl:template match="fax">
282
- <xsl:apply-templates/>
283
- </xsl:template>
284
-
285
- <xsl:template match="figure">
286
- <xsl:variable name="place">
287
- <xsl:choose>
288
- <xsl:when test="count(preceding::figure) mod 2 = 0">left</xsl:when>
289
- <xsl:otherwise>right</xsl:otherwise>
290
- </xsl:choose>
291
- </xsl:variable>
292
- <div class="figure-{$place}">
293
- <xsl:apply-templates/>
294
- <xsl:apply-templates select="caption" mode="caption"/>
295
- </div>
296
- </xsl:template>
297
-
298
- <xsl:template match="figure/caption"/>
299
-
300
- <xsl:template match="figure/caption" mode="caption">
301
- <p class="figure-caption">
302
- <span style="font-weight: bolder">Figure <xsl:value-of select="1 + count(preceding::figure)"/>. </span>
303
- <xsl:apply-templates/>
304
- </p>
305
- </xsl:template>
306
-
307
- <xsl:template match="firstname">
308
- <xsl:apply-templates/>
309
- </xsl:template>
310
-
311
- <xsl:template match="formalpara">
312
- <p>
313
- <xsl:apply-templates/>
314
- </p>
315
- </xsl:template>
316
-
317
- <xsl:template match="formalpara/title">
318
- <span style="font-weight: bolder"><xsl:apply-templates/>.</span>
319
- </xsl:template>
320
-
321
- <xsl:template match="formalpara/para">
322
- <xsl:apply-templates/>
323
- </xsl:template>
324
-
325
- <!-- theme based iconic element -->
326
- <xsl:template match="icon">
327
- <img border="0">
328
- <xsl:attribute name="src">
329
- <xsl:value-of select="concat('/images/', /view/@theme, '/icons/', @name)"/>
330
- </xsl:attribute>
331
- <xsl:if test="caption">
332
- <xsl:attribute name="alt">
333
- <xsl:value-of select="caption"/>
334
- </xsl:attribute>
335
- </xsl:if>
336
- </img>
337
- </xsl:template>
338
-
339
- <!-- need theme based window dressing -->
340
-
341
- <xsl:template match="graphic">
342
- <img border="0">
343
- <xsl:attribute name="src">
344
- <xsl:value-of select="@fileref"/>
345
- </xsl:attribute>
346
- <xsl:if test="caption">
347
- <xsl:attribute name="alt">
348
- <xsl:value-of select="caption"/>
349
- </xsl:attribute>
350
- </xsl:if>
351
- </img>
352
- </xsl:template>
353
-
354
- <xsl:template match="honorific">
355
- <xsl:apply-templates/>
356
- </xsl:template>
357
-
358
- <xsl:template name="admon.graphic.width">
359
- <xsl:param name="node" select="."/>
360
- <xsl:text>25</xsl:text>
361
- </xsl:template>
362
-
363
- <xsl:template match="note|important|warning|caution|tip">
364
- <xsl:choose>
365
- <xsl:when test="$admon.graphics != 0">
366
- <xsl:call-template name="graphical.admonition"/>
367
- </xsl:when>
368
- <xsl:otherwise>
369
- <xsl:call-template name="nongraphical.admonition"/>
370
- </xsl:otherwise>
371
- </xsl:choose>
372
- </xsl:template>
373
-
374
- <xsl:template name="admon.graphic">
375
- <xsl:param name="node" select="."/>
376
- <xsl:value-of select="$admon.graphics.path"/>
377
- <xsl:choose>
378
- <xsl:when test="local-name($node)='note'">note</xsl:when>
379
- <xsl:when test="local-name($node)='warning'">warning</xsl:when>
380
- <xsl:when test="local-name($node)='caution'">caution</xsl:when>
381
- <xsl:when test="local-name($node)='tip'">tip</xsl:when>
382
- <xsl:when test="local-name($node)='important'">important</xsl:when>
383
- <xsl:otherwise>note</xsl:otherwise>
384
- </xsl:choose>
385
- <xsl:value-of select="$admon.graphics.extension"/>
386
- </xsl:template>
387
-
388
- <xsl:template name="graphical.admonition">
389
- <xsl:variable name="admon.type">
390
- <xsl:choose>
391
- <xsl:when test="local-name(.)='note'">Note</xsl:when>
392
- <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
393
- <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
394
- <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
395
- <xsl:when test="local-name(.)='important'">Important</xsl:when>
396
- <xsl:otherwise>Note</xsl:otherwise>
397
- </xsl:choose>
398
- </xsl:variable>
399
-
400
- <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
401
- <xsl:if test="$admon.style != ''">
402
- <xsl:attribute name="style">
403
- <xsl:value-of select="$admon.style"/>
404
- </xsl:attribute>
405
- </xsl:if>
406
-
407
- <table border="0">
408
- <xsl:attribute name="summary">
409
- <xsl:value-of select="$admon.type"/>
410
- <xsl:if test="title">
411
- <xsl:text>: </xsl:text>
412
- <xsl:value-of select="title"/>
413
- </xsl:if>
414
- </xsl:attribute>
415
- <tr>
416
- <td rowspan="2" align="center" valign="top">
417
- <xsl:attribute name="width">
418
- <xsl:call-template name="admon.graphic.width"/>
419
- </xsl:attribute>
420
- <img alt="[{$admon.type}]">
421
- <xsl:attribute name="src">
422
- <xsl:call-template name="admon.graphic"/>
423
- </xsl:attribute>
424
- </img>
425
- </td>
426
- <th align="left">
427
- <xsl:call-template name="anchor"/>
428
- <!-- xsl:if test="$admon.textlabel != 0 or title" -->
429
- <xsl:apply-templates select="title" mode="object.title.markup"/>
430
- <!-- /xsl:if -->
431
- </th>
432
- </tr>
433
- <tr>
434
- <td colspan="2" align="left" valign="top">
435
- <xsl:apply-templates/>
436
- </td>
437
- </tr>
438
- </table>
439
- </div>
440
- </xsl:template>
441
-
442
- <xsl:template name="nongraphical.admonition">
443
- <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
444
- <xsl:if test="$admon.style">
445
- <xsl:attribute name="style">
446
- <xsl:value-of select="$admon.style"/>
447
- </xsl:attribute>
448
- </xsl:if>
449
-
450
- <h3 class="title">
451
- <!-- xsl:call-template name="anchor"/ -->
452
- <!-- xsl:if test="$admon.textlabel != 0 or title" -->
453
- <xsl:apply-templates select="title" mode="object.title.markup"/>
454
- <!-- /xsl:if -->
455
- </h3>
456
-
457
- <xsl:apply-templates/>
458
- </div>
459
- </xsl:template>
460
-
461
- <xsl:template match="note/title"/>
462
- <xsl:template match="important/title"/>
463
- <xsl:template match="warning/title"/>
464
- <xsl:template match="caution/title"/>
465
- <xsl:template match="tip/title"/>
466
-
467
-
468
- <xsl:template match="itemizedlist">
469
- <ul>
470
- <xsl:apply-templates select="listitem"/>
471
- </ul>
472
- </xsl:template>
473
-
474
- <xsl:template match="lineage">
475
- <xsl:apply-templates/>
476
- </xsl:template>
477
-
478
- <xsl:template match="link">
479
- <a>
480
- <xsl:attribute name="href"><xsl:call-template name="format-url"><xsl:with-param name="url"><xsl:value-of select="@url"/></xsl:with-param></xsl:call-template></xsl:attribute>
481
- <xsl:apply-templates/>
482
- </a>
483
- </xsl:template>
484
-
485
- <xsl:template match="listitem">
486
- <li>
487
- <xsl:apply-templates/>
488
- </li>
489
- </xsl:template>
490
-
491
- <xsl:template match="newline">
492
- <br />
493
- </xsl:template>
494
-
495
- <xsl:template match="orderedlist">
496
- <ol>
497
- <xsl:apply-templates select="listitem"/>
498
- </ol>
499
- </xsl:template>
500
-
501
- <xsl:template match="otheraddr">
502
- <xsl:apply-templates/>
503
- </xsl:template>
504
-
505
- <xsl:template match="othername">
506
- <xsl:apply-templates/>
507
- </xsl:template>
508
-
509
- <xsl:template match="para">
510
- <p><xsl:apply-templates/></p>
511
- </xsl:template>
512
-
513
- <xsl:template match="phone">
514
- <xsl:apply-templates/>
515
- </xsl:template>
516
-
517
- <xsl:template match="pob">
518
- <xsl:apply-templates/>
519
- </xsl:template>
520
-
521
- <xsl:template match="postcode">
522
- <xsl:apply-templates/>
523
- </xsl:template>
524
-
525
- <xsl:template match="quote">
526
- ``<xsl:apply-templates/>''
527
- </xsl:template>
528
-
529
- <xsl:template match="quote//quote">
530
- `<xsl:apply-templates/>'
531
- </xsl:template>
532
-
533
- <xsl:template match="quote//quote//quote">
534
- ``<xsl:apply-templates/>''
535
- </xsl:template>
536
-
537
- <xsl:template match="quote//quote//quote//quote">
538
- `<xsl:apply-templates/>'
539
- </xsl:template>
540
-
541
- <xsl:template match="screen">
542
- <pre style="white-space: pre; font-weight: bolder; font-family: monospace;">
543
- <xsl:apply-templates/>
544
- </pre>
545
- </xsl:template>
546
-
547
- <xsl:template match="state">
548
- <xsl:apply-templates/>
549
- </xsl:template>
550
-
551
- <xsl:template match="street">
552
- <xsl:apply-templates/>
553
- </xsl:template>
554
-
555
- <xsl:template match="surname">
556
- <xsl:apply-templates/>
557
- </xsl:template>
558
-
559
- <xsl:template match="table">
560
- <div class="table">
561
- <xsl:apply-templates/>
562
- <xsl:apply-templates select="title" mode="caption"/>
563
- </div>
564
- </xsl:template>
565
-
566
- <xsl:template match="table/title"/>
567
-
568
- <xsl:template match="table/title" mode="caption">
569
- <xsl:variable name="num">
570
- <xsl:value-of select="1 + count(preceding::table)"/>
571
- </xsl:variable>
572
- <p class="table-caption">
573
- <span style="font-weight: bolder">Table <xsl:value-of select="$num"/>. </span>
574
- <xsl:apply-templates/>
575
- </p>
576
- </xsl:template>
577
-
578
- <xsl:template match="tgroup">
579
- <table cellpadding="1" cellspacing="1">
580
- <xsl:apply-templates select="thead"/>
581
- <xsl:apply-templates select="row"/>
582
- </table>
583
- </xsl:template>
584
-
585
- <xsl:template match="thead">
586
- <tr cellpadding="1" style="border: solid black 1px;">
587
- <xsl:apply-templates select="column"/>
588
- </tr>
589
- </xsl:template>
590
-
591
- <xsl:template match="row">
592
- <tr>
593
- <xsl:if test="@class">
594
- <xsl:attribute name="class"><xsl:text>row-</xsl:text><xsl:value-of select="@class"/></xsl:attribute>
595
- </xsl:if>
596
- <xsl:apply-templates select="column"/>
597
- </tr>
598
- </xsl:template>
599
-
600
- <xsl:template match="column">
601
- <td>
602
- <xsl:if test="@class">
603
- <xsl:attribute name="class"><xsl:text>row-</xsl:text><xsl:value-of select="@class"/></xsl:attribute>
604
- </xsl:if>
605
- <xsl:apply-templates/>
606
- </td>
607
- </xsl:template>
608
-
609
- <xsl:template match="variable">
610
- <em><xsl:apply-templates/></em>
611
- </xsl:template>
612
-
613
- <xsl:template match="variablelist">
614
- <dl class="variablelist">
615
- <xsl:if test="@style = 'compact'">
616
- <xsl:attribute name="compact"/>
617
- </xsl:if>
618
- <xsl:apply-templates select="varlistentry"/>
619
- </dl>
620
- </xsl:template>
621
-
622
- <xsl:template match="varlistentry">
623
- <dt>
624
- <xsl:for-each select="term">
625
- <xsl:apply-templates select="."/>
626
- <xsl:if test="position() != last()">
627
- <xsl:text>, </xsl:text>
628
- </xsl:if>
629
- </xsl:for-each>
630
- </dt>
631
- <xsl:apply-templates select="listitem"/>
632
- </xsl:template>
633
-
634
- <xsl:template match="varlistentry/listitem">
635
- <dd><xsl:apply-templates/></dd>
636
- </xsl:template>
637
-
638
- <xsl:template match="footnote">
639
- <xsl:variable name="num">
640
- <xsl:value-of select="1 + count(preceding::footnote)"/>
641
- </xsl:variable>
642
- <a name="fnref{$num}">
643
- <a href="#fn{$num}">
644
- <xsl:text>[</xsl:text>
645
- <xsl:value-of select="$num"/>
646
- <xsl:text>]</xsl:text>
647
- </a>
648
- </a>
649
- </xsl:template>
650
-
651
- <xsl:template match="footnote" mode="endnotes">
652
- <p class="endnote">
653
- <xsl:variable name="num">
654
- <xsl:value-of select="1 + count(preceding::footnote)"/>
655
- </xsl:variable>
656
- <a name="fn{$num}">
657
- <a href="#fnref{$num}">
658
- <xsl:text>[</xsl:text>
659
- <xsl:value-of select="$num"/>
660
- <xsl:text>]</xsl:text>
661
- </a>
662
- </a>
663
- <xsl:apply-templates/>
664
- </p>
665
- </xsl:template>
666
-
667
- <xsl:template match="bibliography|section">
668
- <xsl:apply-templates/>
669
- </xsl:template>
670
-
671
- <xsl:template match="bibliography/title|section/title">
672
- <xsl:variable name="myid">
673
- <xsl:value-of select="generate-id()"/>
674
- </xsl:variable>
675
- <a name="{$myid}">
676
- <a href="#toc">
677
- <xsl:variable name="level">
678
- <xsl:value-of select="concat('h', 1 + count(ancestor::section|ancestor::bibliography))"/>
679
- </xsl:variable>
680
- <xsl:element name="{$level}">
681
- <xsl:attribute name="class">section</xsl:attribute>
682
- <xsl:apply-templates/>
683
- </xsl:element>
684
- </a>
685
- </a>
686
- </xsl:template>
687
-
688
- <xsl:template match="bibliography/title|section/title" mode="toc">
689
- <xsl:variable name="myid">
690
- <xsl:value-of select="generate-id()"/>
691
- </xsl:variable>
692
- <a href="#{$myid}">
693
- <xsl:variable name="level">
694
- <xsl:value-of select="concat('h', 1 + count(ancestor::section|ancestor::bibliography))"/>
695
- </xsl:variable>
696
- <xsl:element name="{$level}">
697
- <xsl:attribute name="class">toc</xsl:attribute>
698
- <xsl:apply-templates/>
699
- </xsl:element>
700
- </a>
701
- </xsl:template>
702
-
703
- <xsl:template match="bibliography|section" mode="toc">
704
- <a>
705
- <xsl:apply-templates select="title" mode="toc"/>
706
- </a>
707
- </xsl:template>
708
-
709
- <xsl:template match="biblioentry">
710
- <p class="biblioentry">
711
- <xsl:apply-templates/>
712
- </p>
713
- </xsl:template>
714
-
715
-
716
- <!-- forms in the content -->
717
-
718
- <xsl:template match="form" mode="body">
719
- <xsl:param name="form_level"/>
720
- <xsl:call-template name="form-body">
721
- <xsl:with-param name="form_level" select="$form_level"/>
722
- </xsl:call-template>
723
- </xsl:template>
724
-
725
- <xsl:template name="form-body">
726
- <xsl:param name="form_level"/>
727
- <xsl:choose>
728
- <xsl:when test="ancestor::option">
729
- <span class="sub-form">
730
- <xsl:attribute name="relation">
731
- <xsl:text>rel:</xsl:text><xsl:apply-templates select="ancestor::option[1]" mode="id"/>
732
- </xsl:attribute>
733
- <xsl:apply-templates select="text|textline|textbox|editbox|asset|grid|password|selection|form|group|textreader|list">
734
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
735
- <xsl:with-param name="form_level"><value-of select="$form_level"/></xsl:with-param>
736
- </xsl:apply-templates>
737
- <xsl:if test="submit|reset">
738
- <span class="form-buttons">
739
- <xsl:apply-templates select="submit|reset">
740
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
741
- </xsl:apply-templates>
742
- </span>
743
- </xsl:if>
744
- <xsl:apply-templates select="stored">
745
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
746
- </xsl:apply-templates>
747
- </span>
748
- </xsl:when>
749
- <xsl:otherwise>
750
- <xsl:apply-templates select="text|textline|textbox|editbox|asset|grid|password|selection|form|group|textreader|list">
751
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
752
- <xsl:with-param name="form_level"><value-of select="$form_level"/></xsl:with-param>
753
- </xsl:apply-templates>
754
- <xsl:if test="submit|reset">
755
- <span class="form-buttons">
756
- <xsl:apply-templates select="submit|reset">
757
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
758
- </xsl:apply-templates>
759
- </span>
760
- </xsl:if>
761
- <xsl:apply-templates select="stored">
762
- <!-- xsl:with-param name="form_id"><xsl:value-of select="@id"/></xsl:with-param -->
763
- </xsl:apply-templates>
764
- </xsl:otherwise>
765
- </xsl:choose>
766
- </xsl:template>
767
-
768
- <xsl:template match="form">
769
- <!-- <div align="center"> -->
770
- <xsl:choose>
771
- <xsl:when test="count(//container[@id and not(ancestor::container[@id] | ancestor::form)] | //form[not(ancestor::container[@id] | ancestor::form)]) > 1">
772
- <xsl:if test="./caption">
773
- <h2 class="form-caption">
774
- <xsl:apply-templates select="caption"/>
775
- </h2>
776
- </xsl:if>
777
- <span class="form-body">
778
- <xsl:call-template name="form-body">
779
- <xsl:with-param name="form_level">3</xsl:with-param>
780
- </xsl:call-template>
781
- </span>
782
- </xsl:when>
783
- <xsl:otherwise>
784
- <form>
785
- <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
786
- <xsl:attribute name="method">
787
- <xsl:choose>
788
- <xsl:when test="@method = 'POST'">POST</xsl:when>
789
- <xsl:when test=".//asset">POST</xsl:when>
790
- <xsl:when test=".//textbox">POST</xsl:when>
791
- <xsl:when test=".//editbox">POST</xsl:when>
792
- <xsl:otherwise>POST</xsl:otherwise>
793
- </xsl:choose>
794
- </xsl:attribute>
795
- <xsl:if test=".//asset">
796
- <xsl:attribute name="type">application/x-multipart</xsl:attribute>
797
- </xsl:if>
798
- <xsl:if test="./caption">
799
- <h2 class="form-caption">
800
- <xsl:apply-templates select="caption"/>
801
- </h2>
802
- </xsl:if>
803
- <span class="form-body">
804
- <xsl:call-template name="form-body"/>
805
- </span>
806
- </form>
807
- </xsl:otherwise>
808
- </xsl:choose>
809
- <!-- </div> -->
810
- </xsl:template>
811
-
812
- <xsl:template match="form//caption">
813
- <span class="form-element-label">
814
- <xsl:if test="../@required = 1">
815
- <span class="form-entry-required-marker">*</span>
816
- </xsl:if>
817
- <xsl:choose>
818
- <xsl:when test="../@missing = 1">
819
- <span class="form-entry-missing"><xsl:apply-templates/></span>
820
- </xsl:when>
821
- <xsl:otherwise>
822
- <xsl:apply-templates/>
823
- </xsl:otherwise>
824
- </xsl:choose>
825
- </span>
826
- </xsl:template>
827
-
828
- <xsl:template match="form/list">
829
- <xsl:param name="form_level"/>
830
- <xsl:choose>
831
- <xsl:when test="./caption|./help">
832
- <fieldset>
833
- <legend>
834
- <xsl:attribute name="class">
835
- <xsl:text>form-list-legend</xsl:text>
836
- <xsl:value-of select="$form_level"/>
837
- </xsl:attribute>
838
- <xsl:apply-templates select="caption"/>
839
- <xsl:apply-templates select="help"/>
840
- </legend>
841
- <xsl:call-template name="form-list">
842
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
843
- </xsl:call-template>
844
- </fieldset>
845
- </xsl:when>
846
- <xsl:otherwise>
847
- <xsl:call-template name="form-list">
848
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
849
- </xsl:call-template>
850
- </xsl:otherwise>
851
- </xsl:choose>
852
- </xsl:template>
853
-
854
- <xsl:template match="form/form | option/form | option/caption/form">
855
- <!-- xsl:param name="form_id"/ -->
856
- <xsl:param name="form_level"/>
857
- <xsl:choose>
858
- <xsl:when test="./caption|./help">
859
- <fieldset>
860
- <legend>
861
- <xsl:attribute name="class">
862
- <xsl:text>form-legend-</xsl:text>
863
- <xsl:value-of select="$form_level"/>
864
- </xsl:attribute>
865
- <xsl:apply-templates select="caption"/>
866
- <xsl:apply-templates select="help"/>
867
- </legend>
868
- <xsl:call-template name="form-body">
869
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
870
- </xsl:call-template>
871
- </fieldset>
872
- </xsl:when>
873
- <xsl:otherwise>
874
- <xsl:call-template name="form-body">
875
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
876
- </xsl:call-template>
877
- </xsl:otherwise>
878
- </xsl:choose>
879
- </xsl:template>
880
-
881
- <xsl:template match="form/group">
882
- <!-- xsl:param name="form_id"/ -->
883
- <xsl:param name="form_level"/>
884
- <span class="form-group">
885
- <span class="form-group-caption">
886
- <xsl:apply-templates select="caption"/>
887
- <xsl:apply-templates select="help"/>
888
- </span>
889
- <span class="form-group-elements">
890
- <xsl:call-template name="form-body">
891
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
892
- </xsl:call-template>
893
- <!--
894
- <xsl:apply-templates>
895
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
896
- </xsl:apply-templates>
897
- -->
898
- </span>
899
- </span>
900
- </xsl:template>
901
-
902
- <xsl:template match="form/password | form//group/password">
903
- <!-- xsl:param name="form_id"/ -->
904
- <span class="form-element">
905
- <!-- label class="form-element-label">
906
- <xsl:attribute name="for">
907
- <xsl:apply-templates select="." mode="id"/>
908
- </xsl:attribute -->
909
- <xsl:apply-templates select="caption"/>
910
- <xsl:apply-templates select="help"/>
911
- <!-- /label -->
912
- <xsl:call-template name="field-password"/>
913
- </span>
914
- </xsl:template>
915
-
916
- <xsl:template match="form/textline">
917
- <!-- xsl:param name="form_id"/ -->
918
- <span class="form-element">
919
- <!-- label class="form-element-label">
920
- <xsl:attribute name="for">
921
- <xsl:apply-templates select="." mode="id"/>
922
- </xsl:attribute -->
923
- <xsl:apply-templates select="caption"/>
924
- <xsl:apply-templates select="help"/>
925
- <!-- /label -->
926
- <xsl:call-template name="field-textline"/>
927
- </span>
928
- </xsl:template>
929
-
930
- <xsl:template match="form//group/textline">
931
- <!-- xsl:param name="form_id"/ -->
932
- <xsl:call-template name="field-textline">
933
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
934
- </xsl:call-template>
935
- </xsl:template>
936
-
937
- <xsl:template match="form/textbox|form/editbox">
938
- <!-- xsl:param name="form_id"/ -->
939
- <xsl:choose>
940
- <xsl:when test="caption">
941
- <fieldset>
942
- <legend>
943
- <xsl:apply-templates select="caption"/>
944
- <xsl:apply-templates select="help"/>
945
- </legend>
946
- <xsl:call-template name="field-textbox">
947
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
948
- </xsl:call-template>
949
- </fieldset>
950
- </xsl:when>
951
- <xsl:otherwise>
952
- <span class="form-element">
953
- <xsl:call-template name="field-textbox">
954
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
955
- <xsl:with-param name="size">2</xsl:with-param>
956
- </xsl:call-template>
957
- </span>
958
- </xsl:otherwise>
959
- </xsl:choose>
960
- </xsl:template>
961
-
962
- <xsl:template match="form//group/textbox | form//group/editbox">
963
- <!-- xsl:param name="form_id"/ -->
964
- <xsl:call-template name="field-textbox">
965
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
966
- </xsl:call-template>
967
- </xsl:template>
968
-
969
- <xsl:template match="form/textreader">
970
- <!-- xsl:param name="form_id"/ -->
971
- <xsl:choose>
972
- <xsl:when test="caption">
973
- <fieldset>
974
- <legend>
975
- <xsl:apply-templates select="caption"/>
976
- <xsl:apply-templates select="help"/>
977
- </legend>
978
- <xsl:call-template name="field-textreader">
979
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
980
- </xsl:call-template>
981
- </fieldset>
982
- </xsl:when>
983
- <xsl:otherwise>
984
- <span class="form-element">
985
- <xsl:call-template name="field-textreader">
986
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
987
- <xsl:with-param name="size">2</xsl:with-param>
988
- </xsl:call-template>
989
- </span>
990
- </xsl:otherwise>
991
- </xsl:choose>
992
- </xsl:template>
993
-
994
- <xsl:template match="form//group/textreader">
995
- <!-- xsl:param name="form_id"/ -->
996
- <xsl:call-template name="field-textreader">
997
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
998
- </xsl:call-template>
3
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
+ xmlns:f="http://dh.tamu.edu/ns/fabulator/1.0#"
5
+ exclude-result-prefixes="f"
6
+ version="1.0"
7
+ >
8
+ <xsl:output
9
+ method="html"
10
+ indent="yes"
11
+ />
12
+
13
+ <xsl:template match="@*|node()">
14
+ <xsl:copy>
15
+ <xsl:apply-templates select="@*|node()"/>
16
+ </xsl:copy>
999
17
  </xsl:template>
1000
18
 
1001
- <xsl:template match="form/selection">
1002
- <!-- xsl:param name="form_id"/ -->
1003
- <xsl:param name="form_level"/>
19
+ <xsl:template match="//f:form">
1004
20
  <xsl:choose>
1005
- <xsl:when test="./option//form//selection">
1006
- <span class="form-element">
1007
- <xsl:apply-templates select="caption"/>
1008
- <xsl:apply-templates select="help"/>
1009
- <xsl:call-template name="field-selection">
1010
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1011
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
1012
- </xsl:call-template>
1013
- </span>
1014
- </xsl:when>
1015
- <xsl:when test="./option//help|./option//form">
1016
- <span class="form-element">
1017
- <xsl:apply-templates select="caption"/>
1018
- <xsl:apply-templates select="help"/>
1019
- <xsl:call-template name="field-selection">
1020
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1021
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
1022
- </xsl:call-template>
1023
- </span>
21
+ <xsl:when test="''">
22
+ <xsl:call-template name="form-content" />
1024
23
  </xsl:when>
1025
24
  <xsl:otherwise>
1026
- <span class="form-element">
1027
- <!-- label class="form-element-label">
1028
- <xsl:attribute name="for">
1029
- <xsl:apply-templates select="." mode="id"/>
1030
- </xsl:attribute -->
1031
- <xsl:apply-templates select="caption"/>
1032
- <xsl:apply-templates select="help"/>
1033
- <!-- /label -->
1034
- <xsl:call-template name="field-selection">
1035
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
1036
- </xsl:call-template>
1037
- </span>
25
+ <form>
26
+ <xsl:attribute name="type">application/x-multipart</xsl:attribute>
27
+ <xsl:attribute name="method">POST</xsl:attribute>
28
+ <xsl:attribute name="class">fabulator-form</xsl:attribute>
29
+ <xsl:call-template name="form-content" />
30
+ </form>
1038
31
  </xsl:otherwise>
1039
32
  </xsl:choose>
1040
33
  </xsl:template>
1041
34
 
1042
- <xsl:template match="form//group/selection">
1043
- <!-- xsl:param name="form_id"/ -->
1044
- <xsl:param name="form_level"/>
1045
- <xsl:apply-templates select="caption"/>
1046
- <xsl:apply-templates select="help"/>
1047
- <xsl:call-template name="field-selection">
1048
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1049
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
1050
- </xsl:call-template>
1051
- </xsl:template>
1052
-
1053
- <xsl:template match="form//grid">
1054
- <xsl:call-template name="field-grid"/>
35
+ <xsl:template name="form-content">
36
+ <xsl:param name="form_level">1</xsl:param>
37
+ <table class="form-content" border="0" cellspacing="0" cellpadding="0">
38
+ <xsl:apply-templates select="f:text|f:asset|f:password|f:selection|f:form|f:group">
39
+ <xsl:with-param name="form_level"><xsl:value-of select="$form_level" /></xsl:with-param>
40
+ </xsl:apply-templates>
41
+ <xsl:if test="f:submission|f:reset">
42
+ <tr><td colspan="2" align="center">
43
+ <xsl:apply-templates select="f:submission|f:reset" />
44
+ </td></tr>
45
+ </xsl:if>
46
+ </table>
47
+ <xsl:apply-templates select="f:value" />
1055
48
  </xsl:template>
1056
49
 
1057
- <xsl:template match="form/selection/option|form//group/selection/option">
1058
- <xsl:param name="style"/>
1059
- <!-- xsl:param name="form_id"/ -->
1060
- <xsl:param name="form_level"/>
50
+ <xsl:template match="f:form/f:form | f:option/f:form">
51
+ <xsl:param name="form_level" />
1061
52
  <xsl:choose>
1062
- <xsl:when test="$style = 'radio'">
1063
- <span class="form-selection-option">
1064
- <input>
1065
- <xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
1066
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
1067
- <xsl:attribute name="name"><xsl:apply-templates select="parent::selection[1]" mode="id"/></xsl:attribute>
1068
- <xsl:attribute name="show">
1069
- <xsl:choose>
1070
- <xsl:when test=".//form">
1071
- <xsl:text>rel:</xsl:text>
1072
- <xsl:apply-templates select="." mode="id"/>
1073
- </xsl:when>
1074
- <xsl:otherwise>
1075
- <xsl:text>none</xsl:text>
1076
- </xsl:otherwise>
1077
- </xsl:choose>
1078
- </xsl:attribute>
1079
- <xsl:variable name="myid">
1080
- <xsl:choose>
1081
- <xsl:when test="@id">
1082
- <xsl:value-of select="@id"/>
1083
- </xsl:when>
1084
- <xsl:otherwise>
1085
- <xsl:value-of select="."/>
1086
- </xsl:otherwise>
1087
- </xsl:choose>
1088
- </xsl:variable>
1089
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1090
- <xsl:for-each select="../default">
1091
- <xsl:if test=". = $myid">
1092
- <xsl:attribute name="checked"/>
1093
- </xsl:if>
1094
- </xsl:for-each>
1095
- </input>
1096
- <xsl:choose>
1097
- <xsl:when test="caption">
1098
- <xsl:choose>
1099
- <xsl:when test="caption"><xsl:apply-templates select="caption"/></xsl:when>
1100
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1101
- </xsl:choose>
1102
- <xsl:apply-templates select="help"/>
1103
- <xsl:if test="./form">
1104
- <xsl:apply-templates select="form" mode="body">
1105
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
1106
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1107
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1108
- </xsl:apply-templates>
1109
- </xsl:if>
1110
- </xsl:when>
1111
- <xsl:when test="form">
1112
- <xsl:if test="form/caption">
1113
- <xsl:apply-templates select="form/caption"/>
1114
- <xsl:apply-templates select="form/help"/>
1115
- </xsl:if>
1116
- <xsl:apply-templates select="form" mode="body">
1117
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
1118
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1119
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1120
- </xsl:apply-templates>
1121
- </xsl:when>
1122
- </xsl:choose>
1123
- </span>
1124
- </xsl:when>
1125
- <xsl:when test="$style = 'checkbox'">
1126
- <span class="form-selection-option">
1127
- <input>
1128
- <xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
1129
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
1130
- <xsl:attribute name="name"><xsl:apply-templates select="parent::selection[1]" mode="id"/></xsl:attribute>
1131
- <xsl:attribute name="show">
1132
- <xsl:choose>
1133
- <xsl:when test=".//form">
1134
- <xsl:text>rel:</xsl:text>
1135
- <xsl:apply-templates select="." mode="id"/>
1136
- </xsl:when>
1137
- <xsl:otherwise>
1138
- <xsl:text>none</xsl:text>
1139
- </xsl:otherwise>
1140
- </xsl:choose>
1141
- </xsl:attribute>
1142
- <xsl:variable name="myid">
1143
- <xsl:choose>
1144
- <xsl:when test="@id">
1145
- <xsl:value-of select="@id"/>
1146
- </xsl:when>
1147
- <xsl:otherwise>
1148
- <xsl:value-of select="."/>
1149
- </xsl:otherwise>
1150
- </xsl:choose>
1151
- </xsl:variable>
1152
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1153
- <xsl:for-each select="../default">
1154
- <xsl:if test=". = $myid">
1155
- <xsl:attribute name="checked"/>
1156
- </xsl:if>
1157
- </xsl:for-each>
1158
- </input>
1159
- <xsl:choose>
1160
- <xsl:when test="caption">
1161
- <xsl:choose>
1162
- <xsl:when test="caption"><xsl:apply-templates select="caption"/></xsl:when>
1163
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1164
- </xsl:choose>
1165
- <xsl:apply-templates select="help"/>
1166
- <xsl:if test="./form">
1167
- <xsl:apply-templates select="form" mode="body">
1168
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
1169
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1170
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1171
- </xsl:apply-templates>
1172
- </xsl:if>
1173
- </xsl:when>
1174
- <xsl:when test="form">
1175
- <xsl:if test="form/caption">
1176
- <xsl:apply-templates select="form/caption"/>
1177
- <xsl:apply-templates select="form/help"/>
1178
- </xsl:if>
1179
- <xsl:apply-templates select="form" mode="body">
1180
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:with-param -->
1181
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1182
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1183
- </xsl:apply-templates>
1184
- </xsl:when>
1185
- </xsl:choose>
1186
- </span>
53
+ <xsl:when test="frame:caption">
54
+ <tr><td colspan="2">
55
+ <fieldset>
56
+ <legend><xsl:apply-templates select="caption" /></legend>
57
+ <xsl:call-template name="form-content">
58
+ <xsl:with-param name="form_level"><xsl:value-of select="$form_level + 1"/></xsl:with-param>
59
+ </xsl:call-template>
60
+ </fieldset>
61
+ </td></tr>
1187
62
  </xsl:when>
1188
63
  <xsl:otherwise>
1189
- <option>
1190
- <xsl:variable name="myid">
1191
- <xsl:choose>
1192
- <xsl:when test="@id">
1193
- <xsl:value-of select="@id"/>
1194
- </xsl:when>
1195
- <xsl:otherwise>
1196
- <xsl:value-of select="."/>
1197
- </xsl:otherwise>
1198
- </xsl:choose>
1199
- </xsl:variable>
1200
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1201
- <xsl:for-each select="../default">
1202
- <xsl:if test=". = $myid">
1203
- <xsl:attribute name="selected"/>
1204
- </xsl:if>
1205
- </xsl:for-each>
1206
- <xsl:choose>
1207
- <xsl:when test="caption">
1208
- <xsl:value-of select="caption"/>
1209
- </xsl:when>
1210
- <xsl:otherwise>
1211
- <xsl:value-of select="$myid"/>
1212
- </xsl:otherwise>
1213
- </xsl:choose>
1214
- </option>
64
+ <tr><td colspan="2">
65
+ <xsl:call-template name="form-content">
66
+ <xsl:with-param name="form_level"><xsl:value-of select="$form_level + 1" /></xsl:with-param>
67
+ </xsl:call-template>
68
+ </td></tr>
1215
69
  </xsl:otherwise>
1216
70
  </xsl:choose>
1217
71
  </xsl:template>
1218
72
 
1219
- <xsl:template match="form/text">
1220
- <div class="form-text">
1221
- <xsl:choose>
1222
- <xsl:when test="caption">
1223
- <xsl:value-of select="caption"/>
1224
- <xsl:apply-templates />
1225
- </xsl:when>
1226
- <xsl:otherwise>
1227
- <xsl:apply-templates />
1228
- </xsl:otherwise>
1229
- </xsl:choose>
73
+ <xsl:template match="f:text">
74
+ <tr><td class="form-caption" valign="top">
75
+ <xsl:apply-templates select="f:caption" />
76
+ </td><td class="form-element" valign="top">
77
+ <xsl:choose>
78
+ <xsl:when test="@f:rows > 1 or @rows > 1">
79
+ <textarea>
80
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
81
+ <xsl:attribute name="rows"><xsl:choose>
82
+ <xsl:when test="@f:rows"><xsl:value-of select="@f:rows"/></xsl:when>
83
+ <xsl:when test="@rows"><xsl:value-of select="@rows"/></xsl:when>
84
+ </xsl:choose></xsl:attribute>
85
+ <xsl:attribute name="cols">
86
+ <xsl:choose>
87
+ <xsl:when test="@f:cols > 132 or @cols > 132">132</xsl:when>
88
+ <xsl:when test="@f:cols"><xsl:value-of select="@f:cols" /></xsl:when>
89
+ <xsl:when test="@cols"><xsl:value-of select="@cols" /></xsl:when>
90
+ <xsl:otherwise>60</xsl:otherwise>
91
+ </xsl:choose>
92
+ </xsl:attribute>
93
+ <xsl:apply-templates select="f:default" />
94
+ <xsl:text> </xsl:text>
95
+ </textarea>
96
+ </xsl:when>
97
+ <xsl:otherwise>
98
+ <input>
99
+ <xsl:attribute name="type">text</xsl:attribute>
100
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
101
+ <xsl:attribute name="size">
102
+ <xsl:choose>
103
+ <xsl:when test="@f:cols > 40 or @cols > 40">40</xsl:when>
104
+ <xsl:when test="@f:cols"><xsl:value-of select="@f:cols" /></xsl:when>
105
+ <xsl:when test="@cols"><xsl:value-of select="@cols" /></xsl:when>
106
+ <xsl:otherwise>12</xsl:otherwise>
107
+ </xsl:choose>
108
+ </xsl:attribute>
109
+ <xsl:attribute name="value"><xsl:apply-templates select="f:default" /></xsl:attribute>
110
+ </input>
111
+ </xsl:otherwise>
112
+ </xsl:choose>
113
+ </td></tr>
114
+ </xsl:template>
115
+
116
+ <xsl:template match="f:password">
117
+ <tr><td class="form-caption" valign="top">
118
+ <xsl:apply-templates select="f:caption" />
119
+ </td><td class="form-element" valign="top">
120
+ <input>
121
+ <xsl:attribute name="type">password</xsl:attribute>
122
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
123
+ </input>
124
+ </td></tr>
125
+ </xsl:template>
126
+
127
+ <xsl:template match="f:asset">
128
+ <div class="form-element">
129
+ <xsl:apply-templates select="f:caption" />
130
+ <span class="form-fluid-asset"></span>
131
+ <input>
132
+ <xsl:attribute name="class">form-asset</xsl:attribute>
133
+ <xsl:attribute name="type">file</xsl:attribute>
134
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
135
+ <xsl:if test="@f:accept">
136
+ <xsl:attribute name="accept"><xsl:value-of select="@f:accept" /></xsl:attribute>
137
+ </xsl:if>
138
+ </input>
1230
139
  </div>
1231
140
  </xsl:template>
1232
141
 
1233
- <xsl:template match="text/caption"/>
1234
-
1235
- <xsl:template match="form/asset">
1236
- <!-- xsl:param name="form_id"/ -->
1237
- <span class="form-element">
1238
- <span class="form-element-label">
1239
- <xsl:apply-templates select="caption"/>
1240
- <xsl:apply-templates select="help"/>
1241
- </span>
1242
- <input type="file">
1243
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:attribute -->
1244
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1245
- <xsl:if test="@accept">
1246
- <xsl:attribute name="accept"><xsl:value-of select="@accept"/></xsl:attribute>
1247
- </xsl:if>
1248
- </input>
1249
- </span>
142
+ <xsl:template match="f:selection">
1250
143
  </xsl:template>
1251
144
 
1252
- <xsl:template match="form//stored">
1253
- <!-- xsl:param name="form_id"/ -->
1254
- <input type="hidden">
1255
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:attribute -->
1256
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1257
- <xsl:attribute name="value"><xsl:apply-templates/></xsl:attribute>
1258
- </input>
145
+ <xsl:template match="f:group">
146
+ <xsl:param name="form_level" />
147
+ <xsl:apply-templates select="f:caption" />
148
+ <xsl:call-template name="form-content">
149
+ <xsl:with-param name="form_level"><xsl:value-of select="$form_level" /></xsl:with-param>
150
+ </xsl:call-template>
1259
151
  </xsl:template>
1260
152
 
1261
- <xsl:template match="form//submit">
1262
- <!-- xsl:param name="form_id"/ -->
153
+ <xsl:template match="f:submission">
1263
154
  <xsl:choose>
1264
- <xsl:when test="caption/* or (default and caption)">
1265
- <!-- input type="submit" -->
1266
- <button type="submit"> <!-- onClick="submit()" -->
1267
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:attribute -->
1268
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
155
+ <xsl:when test="f:caption or f:default">
156
+ <button>
157
+ <xsl:attribute name="type">submit</xsl:attribute>
158
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
1269
159
  <xsl:attribute name="value">
1270
160
  <xsl:choose>
1271
- <xsl:when test="default">
1272
- <xsl:value-of select="default"/>
161
+ <xsl:when test="f:default">
162
+ <xsl:value-of select="f:default" />
1273
163
  </xsl:when>
1274
164
  <xsl:otherwise>
1275
- <xsl:value-of select="caption"/>
165
+ <xsl:value-of select="f:caption" />
1276
166
  </xsl:otherwise>
1277
167
  </xsl:choose>
1278
168
  </xsl:attribute>
1279
- <xsl:if test="ancestor::head">
1280
- <xsl:attribute name="class">head</xsl:attribute>
1281
- </xsl:if>
1282
- <xsl:apply-templates select="caption"/>
169
+ <xsl:apply-templates select="f:caption" />
1283
170
  </button>
1284
- <!-- /input -->
1285
171
  </xsl:when>
1286
172
  <xsl:otherwise>
1287
- <input type="submit">
1288
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:attribute -->
1289
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
173
+ <input>
174
+ <xsl:attribute name="type">submit</xsl:attribute>
175
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
1290
176
  <xsl:attribute name="value">
1291
177
  <xsl:choose>
1292
- <xsl:when test="default">
1293
- <xsl:value-of select="default"/>
178
+ <xsl:when test="f:default">
179
+ <xsl:value-of select="f:default" />
1294
180
  </xsl:when>
1295
181
  <xsl:otherwise>
1296
- <xsl:value-of select="caption"/>
182
+ <xsl:value-of select="f:caption" />
1297
183
  </xsl:otherwise>
1298
184
  </xsl:choose>
1299
185
  </xsl:attribute>
1300
- <xsl:if test="ancestor::head">
1301
- <xsl:attribute name="class">head</xsl:attribute>
1302
- </xsl:if>
1303
186
  </input>
1304
187
  </xsl:otherwise>
1305
188
  </xsl:choose>
1306
189
  </xsl:template>
1307
190
 
1308
- <xsl:template match="form//reset">
1309
- <!-- xsl:param name="form_id"/ -->
191
+ <xsl:template match="f:reset">
1310
192
  <xsl:choose>
1311
- <xsl:when test="caption/*">
1312
- <button type="reset">
1313
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1314
- <xsl:apply-templates select="caption"/>
193
+ <xsl:when test="f:caption">
194
+ <button>
195
+ <xsl:attribute name="type">reset</xsl:attribute>
196
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
197
+ <xsl:apply-templates select="f:caption" />
1315
198
  </button>
1316
199
  </xsl:when>
1317
200
  <xsl:otherwise>
1318
- <input type="reset">
1319
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/>.<xsl:value-of select="@id"/></xsl:attribute -->
1320
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1321
- </input>
1322
- </xsl:otherwise>
1323
- </xsl:choose>
1324
- </xsl:template>
1325
-
1326
- <!-- forms in head or foot elements -->
1327
-
1328
- <xsl:template match="head//form|foot//form">
1329
- <xsl:choose>
1330
- <xsl:when test="count(//container[@id and not(ancestor::container[@id] | ancestor::form)] | //form[not(ancestor::container[@id] | ancestor::form)]) > 1">
1331
- <xsl:if test="./caption">
1332
- <xsl:apply-templates select="caption"/>
1333
- <xsl:text>: </xsl:text>
1334
- </xsl:if>
1335
- <xsl:apply-templates select="text|grid|textline|textbox|editbox|asset|password|selection|form|group|textreader">
1336
- <!-- xsl:with-param name="form_id">
1337
- <xsl:if test="@id">
1338
- <xsl:value-of select="@id"/>
1339
- </xsl:if>
1340
- </xsl:with-param -->
1341
- <xsl:with-param name="form_level">3</xsl:with-param>
1342
- </xsl:apply-templates>
1343
- <xsl:if test="submit|reset">
1344
- <xsl:apply-templates select="submit|reset">
1345
- <!-- xsl:with-param name="form_id">
1346
- <xsl:if test="@id">
1347
- <xsl:value-of select="@id"/>
1348
- </xsl:if>
1349
- </xsl:with-param -->
1350
- </xsl:apply-templates>
1351
- </xsl:if>
1352
- <xsl:apply-templates select="stored">
1353
- <!-- xsl:with-param name="form_id">
1354
- <xsl:if test="@id">
1355
- <xsl:value-of select="@id"/>
1356
- </xsl:if>
1357
- </xsl:with-param -->
1358
- </xsl:apply-templates>
1359
- </xsl:when>
1360
- <xsl:otherwise>
1361
- <form>
1362
- <xsl:if test="@id">
1363
- <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
1364
- </xsl:if>
1365
- <xsl:attribute name="method">
1366
- <xsl:choose>
1367
- <xsl:when test="@method = 'POST'">POST</xsl:when>
1368
- <xsl:when test=".//asset">POST</xsl:when>
1369
- <xsl:when test=".//textbox">POST</xsl:when>
1370
- <xsl:when test=".//editbox">POST</xsl:when>
1371
- <xsl:otherwise>POST</xsl:otherwise>
1372
- </xsl:choose>
1373
- </xsl:attribute>
1374
- <xsl:if test="@target">
1375
- <xsl:attribute name="action"><xsl:value-of select="@target"/></xsl:attribute>
1376
- </xsl:if>
1377
- <xsl:if test=".//asset">
1378
- <xsl:attribute name="type">application/x-multipart</xsl:attribute>
1379
- </xsl:if>
1380
- <xsl:if test="./caption">
1381
- <xsl:apply-templates select="caption"/>
1382
- <xsl:text>: </xsl:text>
1383
- </xsl:if>
1384
- <xsl:apply-templates select="text|grid|textline|textbox|editbox|asset|password|selection|form|group|textreader">
1385
- <!-- xsl:with-param name="form_id">
1386
- <xsl:if test="@id">
1387
- <xsl:value-of select="@id"/>
1388
- </xsl:if>
1389
- </xsl:with-param -->
1390
- <xsl:with-param name="form_level">3</xsl:with-param>
1391
- </xsl:apply-templates>
1392
- <xsl:if test="submit|reset">
1393
- <xsl:apply-templates select="submit|reset">
1394
- <!-- xsl:with-param name="form_id">
1395
- <xsl:if test="@id">
1396
- <xsl:value-of select="@id"/>
1397
- </xsl:if>
1398
- </xsl:with-param -->
1399
- </xsl:apply-templates>
1400
- </xsl:if>
1401
- <xsl:apply-templates select="stored">
1402
- <!-- xsl:with-param name="form_id">
1403
- <xsl:if test="@id">
1404
- <xsl:value-of select="@id"/>
1405
- </xsl:if>
1406
- </xsl:with-param -->
1407
- </xsl:apply-templates>
1408
- </form>
1409
- </xsl:otherwise>
1410
- </xsl:choose>
1411
- </xsl:template>
1412
-
1413
- <xsl:template match="head/form/text|foot/form/text">
1414
- <xsl:apply-templates/>
1415
- </xsl:template>
1416
-
1417
- <!-- input fields -->
1418
-
1419
- <xsl:template match="head/form/password|foot/form/password">
1420
- <!-- xsl:param name="form_id"/ -->
1421
- <xsl:apply-templates select="caption"/>
1422
- <xsl:apply-templates select="help"/>
1423
- <xsl:call-template name="field-password">
1424
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1425
- </xsl:call-template>
1426
- </xsl:template>
1427
-
1428
- <xsl:template match="head/form/textline|foot/form/textline">
1429
- <!-- xsl:param name="form_id"/ -->
1430
- <xsl:apply-templates select="caption"/>
1431
- <xsl:apply-templates select="help"/>
1432
- <xsl:call-template name="field-textline">
1433
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1434
- </xsl:call-template>
1435
- </xsl:template>
1436
-
1437
- <xsl:template match="head/form/textbox|foot/form/textbox|head/form/editbox|foot/form/editbox">
1438
- <!-- xsl:param name="form_id"/ -->
1439
- <xsl:choose>
1440
- <xsl:when test="caption">
1441
- <xsl:apply-templates select="caption"/>
1442
- <xsl:apply-templates select="help"/>
1443
- <xsl:call-template name="field-textbox">
1444
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1445
- </xsl:call-template>
1446
- </xsl:when>
1447
- <xsl:otherwise>
1448
- <xsl:call-template name="field-textbox">
1449
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1450
- <xsl:with-param name="size">2</xsl:with-param>
1451
- </xsl:call-template>
1452
- </xsl:otherwise>
1453
- </xsl:choose>
1454
- </xsl:template>
1455
-
1456
- <xsl:template match="head/form/textreader|foot/form/textreader">
1457
- <!-- xsl:param name="form_id"/ -->
1458
- <xsl:apply-templates select="caption"/>
1459
- <xsl:apply-templates select="help"/>
1460
- <xsl:call-template name="field-textreader"/>
1461
- </xsl:template>
1462
-
1463
- <xsl:template match="head/form/selection|foot/form/selection">
1464
- <!-- xsl:param name="form_id"/ -->
1465
- <xsl:param name="form_level"/>
1466
- <xsl:apply-templates select="caption"/>
1467
- <xsl:apply-templates select="help"/>
1468
- <xsl:call-template name="field-selection">
1469
- <!-- xsl:with-param name="form_id"><xsl:value-of select="$form_id"/></xsl:with-param -->
1470
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level"/></xsl:with-param>
1471
- </xsl:call-template>
1472
- </xsl:template>
1473
-
1474
- <xsl:template match="head/form/selection/option|foot/form/selection/option">
1475
- <xsl:param name="style"/>
1476
- <!-- xsl:param name="form_id"/ -->
1477
- <xsl:param name="form_level"/>
1478
- <xsl:choose>
1479
- <xsl:when test="$style = 'radio'">
1480
- <input>
1481
- <xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
1482
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
1483
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1484
- <xsl:attribute name="show">
1485
- <xsl:choose>
1486
- <xsl:when test=".//form">
1487
- <xsl:text>rel:</xsl:text>
1488
- <xsl:apply-templates select="." mode="id"/>
1489
- </xsl:when>
1490
- <xsl:otherwise>
1491
- <xsl:text>none</xsl:text>
1492
- </xsl:otherwise>
1493
- </xsl:choose>
1494
- </xsl:attribute>
1495
- <xsl:variable name="myid">
1496
- <xsl:choose>
1497
- <xsl:when test="@id">
1498
- <xsl:value-of select="@id"/>
1499
- </xsl:when>
1500
- <xsl:otherwise>
1501
- <xsl:value-of select="."/>
1502
- </xsl:otherwise>
1503
- </xsl:choose>
1504
- </xsl:variable>
1505
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1506
- <xsl:for-each select="../default">
1507
- <xsl:if test=". = $myid">
1508
- <xsl:attribute name="checked"/>
1509
- </xsl:if>
1510
- </xsl:for-each>
1511
- </input>
1512
- <xsl:choose>
1513
- <xsl:when test="caption"><xsl:apply-templates select="caption"/></xsl:when>
1514
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1515
- </xsl:choose>
1516
- <xsl:apply-templates select="help"/>
1517
- <xsl:if test="./form">
1518
- <xsl:apply-templates select="form">
1519
- <!-- xsl:with-param name="form_id"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:with-param -->
1520
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1521
- </xsl:apply-templates>
1522
- </xsl:if>
1523
- </xsl:when>
1524
- <xsl:when test="$style = 'checkbox'">
1525
- <span class="form-element">
1526
201
  <input>
1527
- <xsl:attribute name="type"><xsl:value-of select="$style"/></xsl:attribute>
1528
- <!-- xsl:attribute name="name"><xsl:value-of select="$form_id"/></xsl:attribute -->
1529
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1530
- <xsl:attribute name="show">
1531
- <xsl:choose>
1532
- <xsl:when test=".//form">
1533
- <xsl:text>rel:</xsl:text>
1534
- <xsl:apply-templates select="." mode="id"/>
1535
- </xsl:when>
1536
- <xsl:otherwise>
1537
- <xsl:text>none</xsl:text>
1538
- </xsl:otherwise>
1539
- </xsl:choose>
1540
- </xsl:attribute>
1541
- <xsl:variable name="myid">
1542
- <xsl:choose>
1543
- <xsl:when test="@id">
1544
- <xsl:value-of select="@id"/>
1545
- </xsl:when>
1546
- <xsl:otherwise>
1547
- <xsl:value-of select="."/>
1548
- </xsl:otherwise>
1549
- </xsl:choose>
1550
- </xsl:variable>
1551
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1552
- <xsl:for-each select="../default">
1553
- <xsl:if test=". = $myid">
1554
- <xsl:attribute name="checked"/>
1555
- </xsl:if>
1556
- </xsl:for-each>
1557
- </input>
1558
- <xsl:choose>
1559
- <xsl:when test="caption"><xsl:apply-templates select="caption"/></xsl:when>
1560
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1561
- </xsl:choose>
1562
- <xsl:apply-templates select="help"/>
1563
- <xsl:if test="./form">
1564
- <xsl:apply-templates select="form">
1565
- <!-- xsl:with-param name="form_id"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:with-param -->
1566
- <xsl:with-param name="form_level"><xsl:value-of select="$form_level+1"/></xsl:with-param>
1567
- </xsl:apply-templates>
1568
- </xsl:if>
1569
- </span>
1570
- </xsl:when>
1571
- <xsl:otherwise>
1572
- <option>
1573
- <xsl:variable name="myid">
1574
- <xsl:choose>
1575
- <xsl:when test="@id">
1576
- <xsl:value-of select="@id"/>
1577
- </xsl:when>
1578
- <xsl:otherwise>
1579
- <xsl:value-of select="."/>
1580
- </xsl:otherwise>
1581
- </xsl:choose>
1582
- </xsl:variable>
1583
- <xsl:attribute name="value"><xsl:value-of select="$myid"/></xsl:attribute>
1584
- <xsl:for-each select="../default">
1585
- <xsl:if test=". = $myid">
1586
- <xsl:attribute name="selected"/>
1587
- </xsl:if>
1588
- </xsl:for-each>
1589
- <xsl:apply-templates/>
1590
- </option>
1591
- </xsl:otherwise>
1592
- </xsl:choose>
1593
- </xsl:template>
1594
-
1595
- <xsl:template match="head/form/asset|foot/form/asset">
1596
- <!-- xsl:param name="form_id"/ -->
1597
- <xsl:apply-templates select="caption"/>
1598
- <xsl:apply-templates select="help"/>
1599
- <input type="file">
1600
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1601
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1602
- <xsl:if test="@accept">
1603
- <xsl:attribute name="accept"><xsl:value-of select="@accept"/></xsl:attribute>
1604
- </xsl:if>
1605
- </input>
1606
- </xsl:template>
1607
-
1608
- <xsl:template match="head/form/stored|foot/form/stored">
1609
- <!-- xsl:param name="form_id"/ -->
1610
- <input type="hidden">
1611
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1612
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1613
- <xsl:attribute name="value"><xsl:apply-templates/></xsl:attribute>
1614
- </input>
1615
- </xsl:template>
1616
-
1617
- <xsl:template match="head/form/submit|foot/form/submit">
1618
- <!-- xsl:param name="form_id"/ -->
1619
- <xsl:choose>
1620
- <xsl:when test="caption/*">
1621
- <button type="submit"> <!-- onClick="submit()" -->
1622
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1623
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1624
- <xsl:attribute name="value"><xsl:value-of select="caption"/></xsl:attribute>
1625
- <xsl:if test="ancestor::head">
1626
- <xsl:attribute name="class">head</xsl:attribute>
1627
- </xsl:if>
1628
- <xsl:apply-templates select="caption"/>
1629
- </button>
1630
- </xsl:when>
1631
- <xsl:otherwise>
1632
- <input type="submit">
1633
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1634
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1635
- <xsl:attribute name="value"><xsl:value-of select="caption"/></xsl:attribute>
1636
- <xsl:if test="ancestor::head">
1637
- <xsl:attribute name="class">head</xsl:attribute>
1638
- </xsl:if>
202
+ <xsl:attribute name="type">reset</xsl:attribute>
203
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
204
+ <xsl:attribute name="value"><xsl:value-of select="f:caption" /></xsl:attribute>
1639
205
  </input>
1640
206
  </xsl:otherwise>
1641
207
  </xsl:choose>
1642
208
  </xsl:template>
1643
209
 
1644
- <xsl:template match="head/form/reset|foot/form/reset">
1645
- <!-- xsl:param name="form_id"/ -->
1646
- <xsl:choose>
1647
- <xsl:when test="caption/*">
1648
- <button type="reset">
1649
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1650
- <xsl:if test="ancestor::head">
1651
- <xsl:attribute name="class">head</xsl:attribute>
1652
- </xsl:if>
1653
- <xsl:apply-templates select="caption"/>
1654
- </button>
1655
- </xsl:when>
1656
- <xsl:otherwise>
1657
- <input type="reset">
1658
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1659
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1660
- <xsl:if test="ancestor::head">
1661
- <xsl:attribute name="class">head</xsl:attribute>
1662
- </xsl:if>
1663
- </input>
1664
- </xsl:otherwise>
1665
- </xsl:choose>
1666
- </xsl:template>
1667
-
1668
- <!-- generic methods for outputting actual input element -->
1669
-
1670
- <xsl:template name="field-password">
1671
- <!-- xsl:param name="form_id"/ -->
1672
- <input type="password">
1673
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1674
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1675
- <xsl:attribute name="value"><xsl:value-of select="default"/></xsl:attribute>
1676
- <xsl:attribute name="size">
1677
- <xsl:choose>
1678
- <xsl:when test="@length > 40">40</xsl:when>
1679
- <xsl:when test="@length"><xsl:value-of select="@length"/></xsl:when>
1680
- <xsl:otherwise>12</xsl:otherwise>
1681
- </xsl:choose>
1682
- </xsl:attribute>
1683
- <xsl:if test="ancestor::head">
1684
- <xsl:attribute name="class">head</xsl:attribute>
1685
- </xsl:if>
1686
- </input>
1687
- </xsl:template>
1688
-
1689
- <xsl:template name="field-textline">
1690
- <!-- xsl:param name="form_id"/ -->
1691
- <input type="text">
1692
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1693
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1694
- <xsl:attribute name="value"><xsl:value-of select="default"/></xsl:attribute>
1695
- <xsl:attribute name="size">
1696
- <xsl:choose>
1697
- <xsl:when test="@length > 40">40</xsl:when>
1698
- <xsl:when test="@length"><xsl:value-of select="@length"/></xsl:when>
1699
- <xsl:otherwise>12</xsl:otherwise>
1700
- </xsl:choose>
1701
- </xsl:attribute>
1702
- <xsl:if test="ancestor::head">
1703
- <xsl:attribute name="class">head</xsl:attribute>
1704
- </xsl:if>
210
+ <xsl:template match="f:value">
211
+ <input>
212
+ <xsl:attribute name="type">hidden</xsl:attribute>
213
+ <xsl:attribute name="name"><xsl:apply-templates select="." mode="id" /></xsl:attribute>
214
+ <xsl:attribute name="value"><xsl:apply-templates select="default" /></xsl:attribute>
1705
215
  </input>
1706
216
  </xsl:template>
1707
217
 
1708
- <xsl:template name="field-textbox">
1709
- <!-- xsl:param name="form_id"/ -->
1710
- <xsl:param name="size"/>
1711
- <textarea wrap="">
1712
- <xsl:choose>
1713
- <xsl:when test="name(.) = 'editbox'">
1714
- <xsl:attribute name="cols">80</xsl:attribute>
1715
- <xsl:attribute name="rows">30</xsl:attribute>
1716
- </xsl:when>
1717
- <xsl:when test="$size=2">
1718
- <xsl:attribute name="cols">40</xsl:attribute>
1719
- <xsl:attribute name="rows">10</xsl:attribute>
1720
- </xsl:when>
1721
- <xsl:otherwise>
1722
- <xsl:attribute name="cols">40</xsl:attribute>
1723
- <xsl:attribute name="rows">10</xsl:attribute>
1724
- </xsl:otherwise>
1725
- </xsl:choose>
1726
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1727
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1728
- <xsl:value-of select="default"/>
1729
- <xsl:value-of select="' '"/>
1730
- </textarea>
1731
- </xsl:template>
1732
-
1733
- <xsl:template name="field-textreader">
1734
- <!-- xsl:param name="form_id"/ -->
1735
- <textarea rows="20" cols="80" wrap="" readonly="">
1736
- <xsl:value-of select="."/>
1737
- </textarea>
1738
- </xsl:template>
1739
-
1740
- <xsl:template name="field-selection">
1741
- <!-- xsl:param name="form_id"/ -->
1742
- <xsl:param name="form_level"/>
1743
- <xsl:param name="style">
1744
- <xsl:if test="option//form">
1745
- <xsl:choose>
1746
- <xsl:when test="@count = 'multiple'">checkbox</xsl:when>
1747
- <xsl:otherwise>radio</xsl:otherwise>
1748
- </xsl:choose>
1749
- </xsl:if>
1750
- </xsl:param>
1751
- <xsl:choose>
1752
- <xsl:when test="not($style) or $style = ''">
1753
- <select>
1754
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1755
- <xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
1756
- <xsl:if test="@count = 'multiple'">
1757
- <xsl:attribute name="multiple"><xsl:text>1</xsl:text></xsl:attribute>
1758
- </xsl:if>
1759
- <xsl:apply-templates select="option">
1760
- </xsl:apply-templates>
1761
- </select>
1762
- </xsl:when>
1763
- <xsl:otherwise>
1764
- <!-- select -->
1765
- <!-- xsl:attribute name="name"><xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/>.</xsl:if><xsl:value-of select="@id"/></xsl:attribute -->
1766
- <!-- xsl:attribute name="name"><xsl:apply-templates select="." mode="id"/></xsl:attribute -->
1767
- <!-- xsl:if test="@count = 'multiple'">
1768
- <xsl:attribute name="multiple"/>
1769
- </xsl:if -->
1770
- <span class="form-selection-options">
1771
- <xsl:apply-templates select="option">
1772
- <xsl:with-param name="style" select="$style"/>
1773
- <xsl:with-param name="form_level" select="$form_level"/>
1774
- <!-- xsl:with-param name="form_id">
1775
- <xsl:if test="$form_id != ''"><xsl:value-of select="$form_id"/><xsl:text>.</xsl:text></xsl:if>
1776
- <xsl:value-of select="@id"/>
1777
- </xsl:with-param -->
1778
- </xsl:apply-templates>
1779
- </span>
1780
- <!-- /select -->
1781
- </xsl:otherwise>
1782
- </xsl:choose>
1783
- </xsl:template>
1784
-
1785
- <xsl:template name="field-grid">
1786
- <!-- have <column/>s and <row/>s -->
1787
- <xsl:variable name="inputtype">
1788
- <xsl:choose>
1789
- <xsl:when test="starts-with(@count, 'multiple-') or @count = 'multiple'">
1790
- <xsl:text>checkbox</xsl:text>
1791
- </xsl:when>
1792
- <xsl:otherwise>
1793
- <xsl:text>radio</xsl:text>
1794
- </xsl:otherwise>
1795
- </xsl:choose>
1796
- </xsl:variable>
1797
- <!-- naming determines which direction choices are constrained -->
1798
- <xsl:variable name="nametype">
1799
- <xsl:choose>
1800
- <xsl:when test="substring-before(@count, '-by-row')">
1801
- <xsl:text>row</xsl:text>
1802
- </xsl:when>
1803
- <xsl:when test="substring-before(@count, '-by-column')">
1804
- <xsl:text>col</xsl:text>
1805
- </xsl:when>
1806
- <xsl:otherwise>
1807
- <xsl:text>neither</xsl:text>
1808
- </xsl:otherwise>
1809
- </xsl:choose>
1810
- </xsl:variable>
1811
-
1812
- <xsl:variable name="grid-id">
1813
- <xsl:apply-templates select="." mode="id"/>
1814
- </xsl:variable>
1815
-
1816
- <table class="grid">
1817
- <tr>
1818
- <td/>
1819
- <xsl:for-each select="column">
1820
- <td class="grid-column-caption">
1821
- <xsl:choose>
1822
- <xsl:when test="caption">
1823
- <xsl:apply-templates select="caption"/>
1824
- </xsl:when>
1825
- <xsl:otherwise>
1826
- <xsl:value-of select="@id"/>
1827
- </xsl:otherwise>
1828
- </xsl:choose>
1829
- </td>
1830
- </xsl:for-each>
1831
- </tr>
1832
- <xsl:for-each select="row">
1833
- <xsl:variable name="row-id" select="@id"/>
1834
- <tr>
1835
- <td class="grid-row-caption">
1836
- <xsl:choose>
1837
- <xsl:when test="caption">
1838
- <xsl:apply-templates select="caption"/>
1839
- </xsl:when>
1840
- <xsl:otherwise>
1841
- <xsl:value-of select="@id"/>
1842
- </xsl:otherwise>
1843
- </xsl:choose>
1844
- </td>
1845
- <xsl:for-each select="../column">
1846
- <td class="grid-cell"><input>
1847
- <xsl:attribute name="type"><xsl:value-of select="$inputtype"/></xsl:attribute>
1848
- <xsl:attribute name="name">
1849
- <xsl:value-of select="$grid-id"/>
1850
- <xsl:if test="$nametype = 'row'">
1851
- <xsl:text>.</xsl:text><xsl:value-of select="$row-id"/>
1852
- </xsl:if>
1853
- <xsl:if test="$nametype = 'col'">
1854
- <xsl:text>.</xsl:text><xsl:value-of select="@id"/>
1855
- </xsl:if>
1856
- </xsl:attribute>
1857
- <xsl:attribute name="value">
1858
- <xsl:choose>
1859
- <xsl:when test="$nametype = 'row'">
1860
- <xsl:value-of select="@id"/>
1861
- </xsl:when>
1862
- <xsl:when test="$nametype = 'col'">
1863
- <xsl:value-of select="$row-id"/>
1864
- </xsl:when>
1865
- <xsl:otherwise>
1866
- <xsl:value-of select="$row-id"/><xsl:text>.</xsl:text><xsl:value-of select="@id"/>
1867
- </xsl:otherwise>
1868
- </xsl:choose>
1869
- </xsl:attribute>
1870
- <!-- need to handle defaults now -->
1871
- <xsl:if test="
1872
- ../row[@id = $row-id]/default/text() = @id
1873
- or ./default/text() = $row-id
1874
- or ../default/text() = concat($row-id, '.', @id)
1875
- ">
1876
- <xsl:attribute name="checked"/>
1877
- </xsl:if>
1878
- </input></td>
1879
- </xsl:for-each>
1880
- </tr>
1881
- </xsl:for-each>
1882
- </table>
1883
- </xsl:template>
1884
-
1885
- <!--
1886
- <list id="wf-id" numbering="yes">
1887
- <columns>
1888
- <caption>List Name</caption>
1889
- <caption>State</caption>
1890
- <caption>Last Update</caption>
1891
- </columns>
1892
- [% FOREACH result IN results %]
1893
- <listitem id="[% result.id %]">
1894
- <column>[% result.name | html %]</column>
1895
- <column>[% result.state | html %]</column>
1896
- <column>[% result.last_update | html %]</column>
1897
- </listitem>
1898
- [% END %]
1899
- </list>
1900
- -->
1901
-
1902
- <xsl:template name="form-list">
1903
- <xsl:variable name="id">
1904
- <xsl:apply-templates select="." mode="id"/>
1905
- </xsl:variable>
1906
- <table class="list">
1907
- <thead class="list">
1908
- <xsl:if test="@numbering">
1909
- <td><xsl:value-of select="@numbering"/></td>
1910
- </xsl:if>
1911
- <xsl:for-each select="columns/caption">
1912
- <td><xsl:apply-templates/></td>
1913
- </xsl:for-each>
1914
- </thead>
1915
- <tbody>
1916
- <xsl:variable name="numbering">
1917
- <xsl:choose>
1918
- <xsl:when test="@numbering">
1919
- <xsl:value-of select="1"/>
1920
- </xsl:when>
1921
- <xsl:otherwise>
1922
- <xsl:value-of select="''"/>
1923
- </xsl:otherwise>
1924
- </xsl:choose>
1925
- </xsl:variable>
1926
- <xsl:variable name="offset">
1927
- <xsl:choose>
1928
- <xsl:when test="@start">
1929
- <xsl:value-of select="@start - 1"/>
1930
- </xsl:when>
1931
- <xsl:otherwise>
1932
- <xsl:value-of select="0"/>
1933
- </xsl:otherwise>
1934
- </xsl:choose>
1935
- </xsl:variable>
1936
- <xsl:variable name="inputtype">
1937
- <xsl:choose>
1938
- <xsl:when test="@count = 'multiple'">
1939
- <xsl:value-of select="'checkbox'"/>
1940
- </xsl:when>
1941
- <xsl:otherwise>
1942
- <xsl:value-of select="'radio'"/>
1943
- </xsl:otherwise>
1944
- </xsl:choose>
1945
- </xsl:variable>
1946
- <xsl:for-each select="listitem">
1947
- <xsl:variable name="base-class">
1948
- <xsl:choose>
1949
- <xsl:when test="position() mod 2">
1950
- <xsl:value-of select="'odd'"/>
1951
- </xsl:when>
1952
- <xsl:otherwise>
1953
- <xsl:value-of select="'even'"/>
1954
- </xsl:otherwise>
1955
- </xsl:choose>
1956
- </xsl:variable>
1957
- <tr>
1958
- <xsl:attribute name="class">
1959
- <xsl:value-of select="concat('list-row-', $base-class)"/>
1960
- </xsl:attribute>
1961
- <xsl:if test="$numbering">
1962
- <td>
1963
- <xsl:attribute name="class">
1964
- <xsl:value-of select="concat('list-row-element-', $base-class)"/>
1965
- </xsl:attribute>
1966
- <xsl:value-of select="position() + $offset"/>
1967
- </td>
1968
- </xsl:if>
1969
- <xsl:variable name="pos" select="position()"/>
1970
- <xsl:for-each select="column">
1971
- <td>
1972
- <xsl:attribute name="class">
1973
- <xsl:value-of select="concat('list-row-element-', $base-class)"/>
1974
- </xsl:attribute>
1975
- <xsl:if test="position() = 1">
1976
- <input>
1977
- <xsl:attribute name="type"><xsl:value-of select="$inputtype"/></xsl:attribute>
1978
- <xsl:attribute name="name">
1979
- <xsl:value-of select="$id"/>
1980
- </xsl:attribute>
1981
- <xsl:variable name="value">
1982
- <xsl:choose>
1983
- <xsl:when test="../@id">
1984
- <xsl:value-of select="../@id"/>
1985
- </xsl:when>
1986
- <xsl:otherwise>
1987
- <xsl:value-of select="$pos + $offset"/>
1988
- </xsl:otherwise>
1989
- </xsl:choose>
1990
- </xsl:variable>
1991
- <xsl:attribute name="value">
1992
- <xsl:value-of select="$value"/>
1993
- </xsl:attribute>
1994
- <!-- need to handle defaults now -->
1995
- <xsl:if test="
1996
- ../default[text() = $value]
1997
- ">
1998
- <xsl:attribute name="checked"/>
1999
- </xsl:if>
2000
- </input>
2001
- </xsl:if>
2002
- <xsl:apply-templates/>
2003
- </td>
2004
- </xsl:for-each>
2005
- </tr>
2006
- </xsl:for-each>
2007
- <xsl:if test="1 > count(listitem)">
2008
- <tr class="list-row-odd">
2009
- <xsl:if test="@numbering">
2010
- <td class="list-row-element-odd">1</td>
2011
- </xsl:if>
2012
- <xsl:for-each select="columns/caption">
2013
- <td class="list-row-element-odd"/>
2014
- </xsl:for-each>
2015
- </tr>
2016
- </xsl:if>
2017
- <xsl:if test="2 > count(listitem)">
2018
- <tr class="list-row-even">
2019
- <xsl:if test="@numbering">
2020
- <td class="list-row-element-even">2</td>
2021
- </xsl:if>
2022
- <xsl:for-each select="columns/caption">
2023
- <td class="list-row-element-even"/>
2024
- </xsl:for-each>
2025
- </tr>
2026
- </xsl:if>
2027
- <xsl:if test="3 > count(listitem)">
2028
- <tr class="list-row-odd">
2029
- <xsl:if test="@numbering">
2030
- <td class="list-row-element-odd">3</td>
2031
- </xsl:if>
2032
- <xsl:for-each select="columns/caption">
2033
- <td class="list-row-element-odd"/>
2034
- </xsl:for-each>
2035
- </tr>
2036
- </xsl:if>
2037
- <xsl:if test="4 > count(listitem)">
2038
- <tr class="list-row-even">
2039
- <xsl:if test="@numbering">
2040
- <td class="list-row-element-even">4</td>
2041
- </xsl:if>
2042
- <xsl:for-each select="columns/caption">
2043
- <td class="list-row-element-even"/>
2044
- </xsl:for-each>
2045
- </tr>
2046
- </xsl:if>
2047
- <xsl:if test="5 > count(listitem)">
2048
- <tr class="list-row-odd">
2049
- <xsl:if test="@numbering">
2050
- <td class="list-row-element-odd">5</td>
2051
- </xsl:if>
2052
- <xsl:for-each select="columns/caption">
2053
- <td class="list-row-element-odd"/>
2054
- </xsl:for-each>
2055
- </tr>
2056
- </xsl:if>
2057
- </tbody>
2058
- </table>
218
+ <xsl:template match="f:caption">
219
+ <span class="caption"><xsl:apply-templates /></span>
2059
220
  </xsl:template>
2060
221
 
2061
- <!-- id generation templates -->
2062
-
2063
- <xsl:template match="container" mode="id">
2064
- <xsl:value-of select="@id"/>
222
+ <xsl:template match="f:default">
223
+ <xsl:apply-templates />
2065
224
  </xsl:template>
2066
225
 
2067
- <!-- xsl:template match="form" mode="id">
2068
- <xsl:choose>
2069
- <xsl:when test="ancestor::form[@id]">
2070
- <xsl:apply-templates select="ancestor::form[@id]"/>
2071
- <xsl:if test="@id">
2072
- <xsl:text>.</xsl:text><xsl:value-of select="@id"/>
2073
- </xsl:if>
2074
- </xsl:when>
2075
- <xsl:when test="ancestor::container[@id]">
2076
- <xsl:apply-templates select="ancestor::container[@id]"/>
2077
- <xsl:if test="@id">
2078
- <xsl:text>.</xsl:text><xsl:value-of select="@id"/>
2079
- </xsl:if>
2080
- </xsl:when>
2081
- <xsl:otherwise>
2082
- <xsl:if test="@id">
2083
- <xsl:value-of select="@id"/>
2084
- </xsl:if>
2085
- </xsl:otherwise>
2086
- </xsl:choose>
2087
- </xsl:template -->
2088
-
2089
- <xsl:template match="submit|grid|stored|text|textline|textbox|editbox|asset|password|selection|group|textreader|option|list" mode="id">
2090
- <!--
2091
- ancestor::text
2092
- | ancestor::textline
2093
- | ancestor::textbox
2094
- | ancestor::asset
2095
- | ancestor::password
2096
- | ancestor::textreader
2097
- | ancestor::submit
2098
- | ancestor::stored
2099
- | ancestor::grid
2100
- -->
2101
- <xsl:for-each select="
2102
- ancestor::option[@id != '']
2103
- | ancestor::selection[@id != '']
2104
- | ancestor::group[@id != '']
2105
- | ancestor::form[@id != '']
2106
- | ancestor::container[@id != '']
2107
- | ancestor::list[@id != '']
2108
- "
2109
- >
2110
- <xsl:value-of select="@id"/>
226
+ <xsl:template match="*" mode="id">
227
+ <xsl:for-each select="ancestor::*[@id != '']">
228
+ <xsl:value-of select="@id" />
2111
229
  <xsl:if test="position() != last()">
2112
230
  <xsl:text>.</xsl:text>
2113
231
  </xsl:if>
2114
232
  </xsl:for-each>
2115
233
  <xsl:if test="@id">
2116
- <xsl:if test="
2117
- ancestor::option[@id != '']
2118
- | ancestor::selection[@id != '']
2119
- | ancestor::group[@id != '']
2120
- | ancestor::form[@id != '']
2121
- | ancestor::container[@id != '']
2122
- | ancestor::list[@id != '']
2123
- "
2124
- >
234
+ <xsl:if test="ancestor::*[@id != '']">
2125
235
  <xsl:text>.</xsl:text>
2126
236
  </xsl:if>
2127
- <xsl:value-of select="@id"/>
237
+ <xsl:value-of select="@id" />
2128
238
  </xsl:if>
2129
- <xsl:if test="self::selection[@id != '']/option/form">
2130
- <xsl:text>.value</xsl:text>
2131
- </xsl:if>
2132
- </xsl:template>
2133
-
2134
- <xsl:template name="format-url">
2135
- <xsl:param name="url"/>
2136
-
2137
- <xsl:choose>
2138
- <xsl:when test="/view/@redirect-url and contains($url, '://')">
2139
- <xsl:value-of select="/view/@redirect-url"/>
2140
- <xsl:text>?</xsl:text>
2141
- <xsl:value-of select="$url"/>
2142
- </xsl:when>
2143
- <xsl:when test="/view/@redirect-url and /view/@session-id and starts-with($url, '/')">
2144
- <xsl:text>/</xsl:text>
2145
- <xsl:value-of select="/view/@session-id"/>
2146
- <xsl:value-of select="$url"/>
2147
- </xsl:when>
2148
- <xsl:otherwise>
2149
- <xsl:value-of select="$url"/>
2150
- </xsl:otherwise>
2151
- </xsl:choose>
2152
239
  </xsl:template>
2153
-
2154
- <!-- some useful entities -->
2155
-
2156
- <xsl:template match="nbsp">
2157
- <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
2158
- </xsl:template>
2159
-
2160
240
  </xsl:stylesheet>