Changed the illustration handling with the introduction of 'illref's.
[project-aon.git] / xml / xhtml.xsl
1 <?xml version="1.0"?>
2 <!DOCTYPE xsl:transform [
3  <!ENTITY % xhtml.characters SYSTEM "../../en/xml/htmlchar.mod">
4  %xhtml.characters;
5 ]>
6
7 <!--
8
9 $Id$
10
11 $Log$
12 Revision 1.9  2006/03/14 21:04:03  angantyr
13 Changed the illustration handling with the introduction of 'illref's.
14 Backwards compatible.
15
16 Revision 1.8  2006/03/13 18:38:49  jonathan.blake
17 Fixed minor Spanish translation issue
18
19 Revision 1.7  2006/03/09 18:56:33  jonathan.blake
20 Added a language parameter and coding to switch between languages when the output is hard-coded into the transformation.
21
22 Revision 1.5  2006/03/02 00:33:32  jonathan.blake
23 Removed the 'book-path' parameter to work with new gbtoxhtml.pl
24
25 Revision 1.4  2005/12/27 01:51:29  angantyr
26 Added templates for the "bookref" and "footref" elements.
27
28 Revision 1.3  2005/12/05 21:29:04  jonathan.blake
29 Added the facilities to properly handle character elements.
30
31 Revision 1.2  2005/04/09 19:51:50  angantyr
32 Added handling of open-ended quotes.
33
34 Revision 1.1  2005/01/30 01:32:52  jonathan.blake
35 Initial freepository revision of XML support documents.
36
37 Revision 1.12  2003/10/07 06:05:14  Jon
38 Added capability for "accent" illustrations.
39
40 Revision 1.11  2002/12/06 22:12:04  jblake
41 Added default namespace declaration to transformation element
42 and removed all the extraneous declarations in the template
43 elements.
44
45 Revision 1.10  2002/11/17 22:37:25  jblake
46 Removed the "medium" creator entry from the templates.
47 Will they be of any use?
48
49 Revision 1.9  2002/11/17 05:06:56  jblake
50 Rearranged the title page.
51
52 Revision 1.8  2002/11/15 19:35:25  jblake
53 Fixed "Content-type" of XHTML output.
54
55 Revision 1.7  2002/11/15 00:15:39  jblake
56 Fixed a problem with the client-side image map and fixed
57 the numbered section list generation so that it will work
58 for Shadow on the Sand.
59
60 Revision 1.6  2002/10/30 05:59:45  jblake
61 Added a value for the alt attribute of the ToC image on the navigation bar.
62
63 Revision 1.5  2002/10/24 15:53:41  jblake
64 Fixed a conflict with whitespace and paragraphed lists.
65
66 Revision 1.4  2002/10/24 15:06:51  jblake
67 Added xmlns attributes to all elements that are top level in
68 their templates. This was an adjustment required by Xalan-J 2.4.
69
70 Also reinstated the comment in each document since the new
71 version of Xalan redirects it properly.
72
73 Revision 1.3  2002/10/23 05:18:29  jblake
74 Added the capability to filter which illustrators' work is used.
75 This is accomplished by the "use-illustrators" parameter.
76
77 Revision 1.2  2002/10/20 06:25:35  jblake
78 Added support for CLOSE COMBAT SKILL for Freeway Warrior books.
79
80 Revision 1.1  2002/10/15 23:29:51  jblake
81 Initial revision
82
83
84 20020327 - repurposed to be used with Xalan Java 2
85
86 Todo:
87
88 * Add blank whitespace handling to the paragraphed list template
89
90 -->
91
92 <xsl:transform version="1.0"
93   xmlns="http://www.w3.org/1999/xhtml"
94   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
95   xmlns:lxslt="http://xml.apache.org/xslt"
96   xmlns:redirect="org.apache.xalan.lib.Redirect"
97   extension-element-prefixes="redirect">
98
99 <xsl:output method="xml"
100             encoding="ISO-8859-1"
101             omit-xml-declaration="yes"
102             doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
103             doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
104
105 <xsl:strip-space elements="section data ol ul dl li dd footnotes footnote" />
106 <xsl:preserve-space elements="p choice" />
107
108 <!-- ====================== parameters ========================== -->
109
110 <xsl:param name="use-illustrators" />
111 <xsl:param name="language"><xsl:text>en</xsl:text></xsl:param>
112  
113 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ colors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
114
115 <xsl:param name="link-color"><xsl:text>#ff0000</xsl:text></xsl:param>
116 <xsl:param name="alink-color"><xsl:value-of select="$link-color" /></xsl:param>
117 <xsl:param name="vlink-color"><xsl:value-of select="$link-color" /></xsl:param>
118
119 <xsl:param name="text-color"><xsl:text>#000000</xsl:text></xsl:param>
120 <xsl:param name="background-color"><xsl:text>#ffffe4</xsl:text></xsl:param>
121
122 <!-- ======================= variables ========================== -->
123
124 <xsl:variable name="newline">
125 <xsl:text>
126 </xsl:text>
127 </xsl:variable>
128
129 <!-- ======================== Templates ========================= -->
130
131 <!-- ================= hierarchical sections ==================== -->
132
133 <xsl:template match="meta" />
134 <xsl:template match="section" />
135
136 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
137
138 <xsl:template match="/gamebook/section[@id='title']">
139  <xsl:call-template name="xhtml-wrapper">
140   <xsl:with-param name="document-type">top-level</xsl:with-param>
141   <xsl:with-param name="filename">title</xsl:with-param>
142  </xsl:call-template>
143
144  <xsl:apply-templates />
145 </xsl:template>
146
147 <xsl:template match="/gamebook/section[@id='toc']">
148  <xsl:call-template name="xhtml-wrapper">
149   <xsl:with-param name="document-type">toc</xsl:with-param>
150   <xsl:with-param name="filename">toc</xsl:with-param>
151  </xsl:call-template>
152
153  <xsl:apply-templates />
154 </xsl:template>
155
156 <!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
157
158 <xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
159  <xsl:call-template name="xhtml-wrapper">
160   <xsl:with-param name="document-type">second-level-frontmatter</xsl:with-param>
161   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
162  </xsl:call-template>
163 </xsl:template>
164
165 <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
166
167 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
168  <h3><xsl:value-of select="meta/title[1]" /></h3>
169
170  <xsl:value-of select="$newline" />
171  <xsl:value-of select="$newline" />
172
173  <xsl:apply-templates />
174 </xsl:template>
175
176 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
177  <xsl:call-template name="xhtml-wrapper">
178   <xsl:with-param name="document-type">third-level-frontmatter-separate</xsl:with-param>
179   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
180  </xsl:call-template>
181 </xsl:template>
182
183 <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
184
185 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
186  <h4><xsl:value-of select="meta/title[1]" /></h4>
187
188  <xsl:value-of select="$newline" />
189  <xsl:value-of select="$newline" />
190
191  <xsl:apply-templates />
192 </xsl:template>
193
194 <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
195
196 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
197  <h5><xsl:value-of select="meta/title[1]" /></h5>
198
199  <xsl:value-of select="$newline" />
200  <xsl:value-of select="$newline" />
201
202  <xsl:apply-templates />
203 </xsl:template>
204
205 <!-- ::::::::::: second-level main matter sections :::::::::::::: -->
206
207 <xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
208  <xsl:call-template name="xhtml-wrapper">
209   <xsl:with-param name="document-type">second-level-mainmatter</xsl:with-param>
210   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
211  </xsl:call-template>
212 </xsl:template>
213
214 <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
215
216 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
217  <h3><xsl:value-of select="meta/title[1]" /></h3>
218
219  <xsl:value-of select="$newline" />
220  <xsl:value-of select="$newline" />
221
222  <xsl:apply-templates />
223 </xsl:template>
224
225 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
226  <xsl:call-template name="xhtml-wrapper">
227   <xsl:with-param name="document-type">third-level-mainmatter-separate</xsl:with-param>
228   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
229  </xsl:call-template>
230 </xsl:template>
231
232 <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
233
234 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
235  <h4><xsl:value-of select="meta/title[1]" /></h4>
236
237  <xsl:value-of select="$newline" />
238  <xsl:value-of select="$newline" />
239
240  <xsl:apply-templates />
241 </xsl:template>
242
243 <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
244
245 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
246  <h5><xsl:value-of select="meta/title[1]" /></h5>
247
248  <xsl:value-of select="$newline" />
249  <xsl:value-of select="$newline" />
250
251  <xsl:apply-templates />
252 </xsl:template>
253
254 <!-- :::::::::::: second-level glossary sections ::::::::::::: -->
255
256 <xsl:template match="/gamebook/section/data/section[@class='glossary']">
257  <xsl:call-template name="xhtml-wrapper">
258   <xsl:with-param name="document-type">second-level-glossary</xsl:with-param>
259   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
260   <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
261  </xsl:call-template>
262 </xsl:template>
263
264 <!-- :::::::::::: third-level glossary sections ::::::::::::: -->
265 <!-- glossary sections should be enclosed in a second level glossary section -->
266
267 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
268  <h3><xsl:value-of select="meta/title[1]" /></h3>
269
270  <xsl:value-of select="$newline" />
271  <xsl:value-of select="$newline" />
272
273  <xsl:apply-templates />
274 </xsl:template>
275
276 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
277  <xsl:call-template name="xhtml-wrapper">
278   <xsl:with-param name="document-type">third-level-glossary-separate</xsl:with-param>
279   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
280   <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
281  </xsl:call-template>
282 </xsl:template>
283
284 <!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
285
286 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
287  <xsl:call-template name="xhtml-wrapper">
288   <xsl:with-param name="document-type">second-level-numbered</xsl:with-param>
289   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
290  </xsl:call-template>
291
292  <xsl:apply-templates />
293 </xsl:template>
294
295 <xsl:template match="/gamebook/section/data/section/data/section[@class='numbered']">
296  <xsl:call-template name="xhtml-wrapper">
297   <xsl:with-param name="document-type">third-level-numbered</xsl:with-param>
298   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
299  </xsl:call-template>
300 </xsl:template>
301
302 <!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
303
304 <xsl:template match="/gamebook/section/data/section[@class='backmatter']">
305  <xsl:call-template name="xhtml-wrapper">
306   <xsl:with-param name="document-type">second-level-backmatter</xsl:with-param>
307   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
308  </xsl:call-template>
309 </xsl:template>
310
311 <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
312
313 <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
314  <h3><xsl:value-of select="meta/title[1]" /></h3>
315
316  <xsl:value-of select="$newline" />
317  <xsl:value-of select="$newline" />
318
319  <xsl:apply-templates />
320 </xsl:template>
321
322 <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
323
324 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
325  <h4><xsl:value-of select="meta/title[1]" /></h4>
326
327  <xsl:value-of select="$newline" />
328  <xsl:value-of select="$newline" />
329
330  <xsl:apply-templates />
331 </xsl:template>
332
333 <!-- ::::::::::::::::::::: map template ::::::::::::::::::::::::: -->
334
335 <xsl:template match="id( 'map' )">
336  <xsl:call-template name="xhtml-wrapper">
337   <xsl:with-param name="document-type">map-adjusted</xsl:with-param>
338   <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
339  </xsl:call-template>
340
341  <xsl:call-template name="xhtml-wrapper">
342   <xsl:with-param name="document-type">map</xsl:with-param>
343   <xsl:with-param name="filename"><xsl:value-of select="@id" /><xsl:text>large</xsl:text></xsl:with-param>
344  </xsl:call-template>
345 </xsl:template>
346
347 <!-- ==================== block elements ======================== -->
348
349 <xsl:template match="p">
350  <p><xsl:apply-templates /></p>
351  <xsl:value-of select="$newline" />
352 </xsl:template>
353
354 <xsl:template match="p[@class='dedication']">
355  <p class="dedication"><xsl:apply-templates /></p>
356  <xsl:value-of select="$newline" />
357 </xsl:template>
358
359 <xsl:template match="dl[@class='paragraphed']/dd/node() | ol[@class='paragraphed']/li/node() | ul[@class='paragraphed']/li/node()">
360  <xsl:choose>
361   <xsl:when test="self::p">
362    <xsl:apply-templates /><br /><br /><xsl:value-of select="$newline" />
363   </xsl:when>
364   <xsl:when test="self::dl">
365    <dl><xsl:value-of select="$newline" />
366     <xsl:apply-templates />
367    </dl><br /><br /><xsl:value-of select="$newline" />
368   </xsl:when>
369   <xsl:when test="self::ol">
370    <ol><xsl:value-of select="$newline" />
371     <xsl:apply-templates />
372    </ol><br /><br /><xsl:value-of select="$newline" />
373   </xsl:when>
374   <xsl:when test="self::ul">
375    <ul>
376     <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
377     <xsl:value-of select="$newline" />
378     <xsl:apply-templates />
379    </ul><br /><br /><xsl:value-of select="$newline" />
380   </xsl:when>
381   <xsl:when test="self::blockquote">
382    <blockquote><xsl:value-of select="$newline" />
383     <xsl:apply-templates />
384    </blockquote><xsl:value-of select="$newline" />
385   </xsl:when>
386   <xsl:when test="self::illustration">
387    <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
388    <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
389    <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
390
391    <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
392     <div class="illustration">
393      <div align="center"><xsl:value-of select="$newline" />
394      <xsl:call-template name="illustration-framed">
395       <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width" /></xsl:with-param>
396       <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height" /></xsl:with-param>
397       <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
398      </xsl:call-template>
399      <br /><xsl:value-of select="$newline" />
400     </div></div><xsl:value-of select="$newline" />
401    </xsl:if>
402   </xsl:when>
403   <xsl:otherwise>
404    <xsl:text>[error: paragraphed list template]</xsl:text>
405   </xsl:otherwise>
406  </xsl:choose>
407 </xsl:template>
408
409 <xsl:template match="ol">
410  <ol><xsl:value-of select="$newline" />
411   <xsl:apply-templates />
412  </ol><xsl:value-of select="$newline" />
413 </xsl:template>
414
415 <xsl:template match="ul">
416  <ul>
417   <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
418   <xsl:value-of select="$newline" />
419   <xsl:apply-templates />
420  </ul><xsl:value-of select="$newline" />
421 </xsl:template>
422
423 <xsl:template match="dl">
424  <dl><xsl:value-of select="$newline" />
425   <xsl:apply-templates />
426  </dl><xsl:value-of select="$newline" />
427 </xsl:template>
428
429 <xsl:template match="dt">
430  <dt><xsl:apply-templates /></dt>
431  <xsl:value-of select="$newline" />
432 </xsl:template>
433
434 <xsl:template match="dd">
435  <dd><xsl:apply-templates /></dd>
436  <xsl:value-of select="$newline" />
437 </xsl:template>
438
439 <xsl:template match="li">
440  <li><xsl:apply-templates /></li>
441  <xsl:value-of select="$newline" />
442 </xsl:template>
443
444 <xsl:template match="table">
445  <table border="1" cellspacing="0" cellpadding="2">
446   <xsl:apply-templates />
447  </table>
448  <xsl:value-of select="$newline" />
449 </xsl:template>
450
451 <xsl:template match="tr">
452  <tr>
453   <xsl:apply-templates />
454  </tr>
455 </xsl:template>
456
457 <xsl:template match="th">
458  <th>
459   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
460   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
461   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
462   <xsl:apply-templates />
463  </th>
464 </xsl:template>
465
466 <xsl:template match="td">
467  <td>
468   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
469   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
470   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
471   <xsl:apply-templates />
472  </td>
473 </xsl:template>
474
475 <xsl:template match="combat">
476  <p class="combat">
477   <xsl:apply-templates select="enemy" />
478   <xsl:text>: </xsl:text>
479   <xsl:choose>
480    <xsl:when test="enemy-attribute[@class='combatskill']">
481     <span class="smallcaps">
482      <xsl:choose>
483       <xsl:when test="$language='es'">
484        <xsl:text>DESTREZA&nbsp;EN&nbsp;EL&nbsp;COMBATE</xsl:text>
485       </xsl:when>
486       <xsl:otherwise>
487        <xsl:text>COMBAT&nbsp;SKILL</xsl:text>
488       </xsl:otherwise>
489      </xsl:choose>
490     </span>
491     <xsl:text>&nbsp;</xsl:text>
492     <xsl:value-of select="enemy-attribute[@class='combatskill']" />
493    </xsl:when>
494    <xsl:when test="enemy-attribute[@class='closecombatskill']">
495     <span class="smallcaps">
496      <xsl:choose>
497       <xsl:when test="$language='es'">
498        <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL</xsl:text>
499       </xsl:when>
500       <xsl:otherwise>
501        <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL</xsl:text>
502       </xsl:otherwise>
503      </xsl:choose>
504     </span>
505     <xsl:text>&nbsp;</xsl:text>
506     <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
507    </xsl:when>
508   </xsl:choose>
509   <xsl:text> &nbsp;&nbsp;</xsl:text>
510   <span class="smallcaps">
511     <xsl:choose>
512      <xsl:when test="$language='es'">
513       <xsl:text>RESISTENCIA</xsl:text>
514      </xsl:when>
515      <xsl:otherwise>
516       <xsl:text>ENDURANCE</xsl:text>
517     </xsl:otherwise>
518    </xsl:choose>
519   </span>
520   <xsl:choose>
521    <xsl:when test="enemy-attribute[@class='target']">
522     <xsl:choose>
523      <xsl:when test="$language='es'">
524       <xsl:text> (o </xsl:text><span class="smallcaps">BLANCOS</span><xsl:text>)</xsl:text>
525      </xsl:when>
526      <xsl:otherwise>
527       <xsl:text> (</xsl:text><span class="smallcaps">TARGET</span><xsl:text> points)</xsl:text>
528      </xsl:otherwise>
529     </xsl:choose>
530     <xsl:text>&nbsp;</xsl:text>
531     <xsl:value-of select="enemy-attribute[@class='target']" />
532    </xsl:when>
533    <xsl:when test="enemy-attribute[@class='resistance']">
534     <xsl:choose>
535      <xsl:when test="$language='es'"></xsl:when>
536      <xsl:otherwise>
537       <xsl:text> (</xsl:text><span class="smallcaps">RESISTANCE</span><xsl:text> points)</xsl:text>
538      </xsl:otherwise>
539     </xsl:choose>
540     <xsl:text>&nbsp;</xsl:text>
541     <xsl:value-of select="enemy-attribute[@class='resistance']" />
542    </xsl:when>
543    <xsl:otherwise>
544     <xsl:text>&nbsp;</xsl:text>
545     <xsl:value-of select="enemy-attribute[@class='endurance']" />
546    </xsl:otherwise>
547   </xsl:choose>
548  </p>
549  <xsl:value-of select="$newline" />
550 </xsl:template>
551
552 <xsl:template match="choice">
553  <xsl:variable name="link">
554   <xsl:value-of select="@idref" />
555  </xsl:variable>
556
557  <p class="choice">
558   <xsl:for-each select="* | text()">
559    <xsl:choose>
560     <xsl:when test="self::link-text">
561      <a href="{$link}.htm">
562       <xsl:apply-templates />
563      </a>
564     </xsl:when>
565     <xsl:otherwise>
566      <xsl:apply-templates select="." />
567     </xsl:otherwise>
568    </xsl:choose>
569   </xsl:for-each>
570  </p>
571  <xsl:value-of select="$newline" />
572 </xsl:template>
573
574 <xsl:template match="signpost">
575  <div class="signpost">
576   <xsl:apply-templates />
577  </div>
578  <xsl:value-of select="$newline" />
579 </xsl:template>
580
581 <xsl:template match="blockquote">
582  <blockquote><xsl:value-of select="$newline" />
583   <xsl:apply-templates /><xsl:value-of select="$newline" />
584  </blockquote><xsl:value-of select="$newline" />
585 </xsl:template>
586
587 <xsl:template match="illref[@class='html']">
588  <xsl:for-each select="id( @idref )">
589   <!-- This creates unneccessary regeneration of float illustration pages, but it is easiest to keep things this way as long as we have to be backwards compatible... -->
590   <!-- When backwards compatibility can be dropped, most of (all?) the <illustration> processing can happen here -->
591   <xsl:apply-templates select="." />
592  </xsl:for-each>
593 </xsl:template>
594
595 <xsl:template match="illustrations">
596  <ul class="unbulleted">
597   <xsl:for-each select="illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) )] | illgroup">
598    <xsl:choose>
599     <xsl:when test="self::illustration and @class='float'">
600      <!-- List item with illustration name as link -->
601      <li>
602       <a>
603        <xsl:attribute name="href"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" /><xsl:text>.htm</xsl:text></xsl:attribute>
604        <xsl:choose>
605         <xsl:when test="$language='es'">
606          <xsl:text>Ilustraci&oacute;n </xsl:text>
607         </xsl:when>
608         <xsl:otherwise>
609          <xsl:text>Illustration </xsl:text>
610         </xsl:otherwise>
611        </xsl:choose>
612        <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
613       </a>
614       <!-- List the sections that the illustration appears in -->
615       <xsl:text> (</xsl:text>
616       <xsl:for-each select="//illref[@class='html' and @idref=current()/@id]">
617        <!-- will the list always contain the closest ancestor first??? -->
618        <a>
619         <xsl:attribute name="href"><xsl:value-of select="ancestor::section[position()=1]/@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
620         <xsl:value-of select="ancestor::section[position()=1]/meta/title[1]" />
621        </a>
622        <xsl:if test="position()!=last()">
623         <xsl:text>,  </xsl:text>        
624        </xsl:if>
625       </xsl:for-each>
626       <xsl:text>)</xsl:text><xsl:value-of select="$newline" />
627      </li>
628      <!-- Call the backwards compatible template for generating the illustration page -->
629      <xsl:call-template name="xhtml-wrapper">
630       <xsl:with-param name="document-type">illustration</xsl:with-param>
631       <xsl:with-param name="filename"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]" from="/" level="any" format="1" /></xsl:with-param>
632      </xsl:call-template>
633     </xsl:when>
634
635     <xsl:when test="self::illustration"> <!-- inline and map -->
636      <!-- List the sections that the illustration appears in -->     
637      <li>
638       <xsl:for-each select="//illref[@class='html' and @idref=current()/@id]">
639        <!-- will the list always contain the closest ancestor first? -->
640        <a>
641         <!-- TODO: fix this so that sections that do not represent separate XHTML files are not linked to -->
642         <xsl:attribute name="href"><xsl:value-of select="ancestor::section[position()=1]/@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
643         <xsl:value-of select="ancestor::section[position()=1]/meta/title[1]" />
644        </a>
645        <xsl:if test="position()!=last()">
646         <xsl:text>,  </xsl:text>        
647        </xsl:if>
648       </xsl:for-each>
649      </li>
650     </xsl:when>
651
652     <xsl:when test="self::illgroup and @class!='hidden'">
653      <!-- Check if the group contains any illustrations being used, before creating the list item -->
654       <xsl:if test="count( illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) )] ) != 0">
655        <li>
656         <a>
657          <xsl:attribute name="href"><xsl:value-of select="@idref" /><xsl:text>.htm</xsl:text></xsl:attribute>
658          <xsl:value-of select="id(@idref)/meta/title[1]" />
659         </a>
660        </li>
661       </xsl:if>
662     </xsl:when>
663    </xsl:choose>
664   </xsl:for-each>
665  </ul><xsl:value-of select="$newline" />
666 </xsl:template>
667
668 <xsl:template match="illustration">
669  <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
670  <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
671  <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
672
673  <xsl:variable name="illustration-width-adjusted"><xsl:number value="$illustration-width div 2" /></xsl:variable>
674  <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height div 2" /></xsl:variable>
675
676  <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
677   <xsl:choose>
678    <xsl:when test="@class='float'">
679     <div class="illustration">
680      <div align="center"><xsl:value-of select="$newline" />
681      <xsl:call-template name="illustration-framed">
682       <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width-adjusted" /></xsl:with-param>
683       <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height-adjusted" /></xsl:with-param>
684       <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
685       <xsl:with-param name="illustration-href">
686        <xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" /><xsl:text>.htm</xsl:text>
687       </xsl:with-param>
688      </xsl:call-template>
689      <br /><xsl:value-of select="$newline" />
690     </div></div><xsl:value-of select="$newline" />
691
692     <xsl:call-template name="xhtml-wrapper">
693      <xsl:with-param name="document-type">illustration</xsl:with-param>
694      <xsl:with-param name="filename"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]" from="/" level="any" format="1" /></xsl:with-param>
695     </xsl:call-template>
696    </xsl:when>
697
698    <xsl:when test="@class='accent'" />
699
700    <xsl:otherwise>
701     <div class="illustration">
702      <div align="center"><xsl:value-of select="$newline" />
703      <xsl:call-template name="illustration-framed">
704       <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width" /></xsl:with-param>
705       <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height" /></xsl:with-param>
706       <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
707      </xsl:call-template>
708      <br /><xsl:value-of select="$newline" />
709     </div></div><xsl:value-of select="$newline" />
710    </xsl:otherwise>
711   </xsl:choose>
712  </xsl:if>
713 </xsl:template>
714
715 <xsl:template match="instance" />
716
717 <xsl:template match="footnotes" />
718
719 <xsl:template match="footnote" />
720
721 <xsl:template match="hr">
722  <hr />
723  <xsl:value-of select="$newline" />
724 </xsl:template>
725
726 <!-- ==================== inline elements ======================= -->
727
728 <xsl:template match="a">
729  <xsl:choose>
730   <xsl:when test="@href">
731    <a>
732     <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
733     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
734     <xsl:apply-templates />
735    </a>
736   </xsl:when>
737   <xsl:otherwise>
738    <a>
739     <xsl:if test="@idref">
740      <xsl:variable name="my-idref" select="@idref" />
741      <xsl:attribute name="href">
742       <xsl:choose>
743        <!-- The order of these tests is deliberate. They are ordered roughly from most to least specific. -->
744        <xsl:when test="/gamebook/section[@id=$my-idref] | /gamebook/section/data/section[@id=$my-idref]">
745         <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
746        </xsl:when>
747        <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and @id=$my-idref]">
748         <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
749        </xsl:when>
750        <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and @id=$my-idref]">
751         <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
752        </xsl:when>
753        <xsl:when test="/gamebook/section/data/section/data/section[@class='numbered' and @id=$my-idref]">
754         <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
755        </xsl:when>
756        <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and @id=$my-idref]">
757         <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
758        </xsl:when>
759        <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]">
760         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
761        </xsl:when>
762        <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]">
763         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
764        </xsl:when>
765        <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]">
766         <xsl:value-of select="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
767        </xsl:when>
768        <xsl:when test="/gamebook/section/data/section[descendant::*[@id=$my-idref]]">
769         <xsl:value-of select="/gamebook/section/data/section[descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
770        </xsl:when>
771        <xsl:otherwise>
772         <xsl:text>[error: a template]</xsl:text>
773        </xsl:otherwise>
774       </xsl:choose>
775      </xsl:attribute>
776     </xsl:if>
777     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
778     <xsl:apply-templates />
779    </a>
780   </xsl:otherwise>
781  </xsl:choose>
782 </xsl:template>
783
784 <!-- This template is obsolete, the "footref" element should be used instead -->
785 <xsl:template match="a[@class='footnote']">
786  <xsl:apply-templates />
787  <sup>
788   <a>
789    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
790    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
791    <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
792   </a>
793  </sup>
794 </xsl:template>
795
796 <!-- TODO: can this be made more uniform with illrefs? -->
797 <xsl:template match="a[@class='accent-illustration']">
798  <xsl:for-each select="id( @idref )">
799   <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
800   <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
801   <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
802   <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
803    <img src="{$illustration-src}" class="accent" width="{$illustration-width}" height="{$illustration-height}" alt="" border="" align="left" />
804   </xsl:if>
805  </xsl:for-each>
806 </xsl:template>
807
808 <xsl:template match="bookref">
809  <a>
810   <xsl:attribute name="href">
811    <xsl:variable name="my-section">
812     <xsl:choose>
813      <xsl:when test="@section">
814       <xsl:value-of select="@section" />
815      </xsl:when>
816      <xsl:otherwise>
817       <xsl:text>title</xsl:text>
818      </xsl:otherwise>
819     </xsl:choose>
820    </xsl:variable>
821    <xsl:variable name="my-series">
822     <!-- If series is specified, go one directory back and then to series. Otherwise, add nothing. -->
823     <xsl:choose>
824      <xsl:when test="@series">
825       <xsl:text>/../</xsl:text><xsl:value-of select="@series" />
826      </xsl:when>
827      <xsl:otherwise>
828       <xsl:text></xsl:text>
829      </xsl:otherwise>
830     </xsl:choose>
831    </xsl:variable>
832    <xsl:text>..</xsl:text><xsl:value-of select="$my-series" /><xsl:text>/</xsl:text><xsl:value-of select="@book" /><xsl:text>/</xsl:text><xsl:value-of select="$my-section" /><xsl:text>.htm</xsl:text>
833   </xsl:attribute>
834   <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
835   <xsl:apply-templates />
836  </a>
837 </xsl:template>
838
839 <xsl:template match="footref">
840  <xsl:apply-templates />
841  <sup>
842   <a>
843    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
844    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
845    <xsl:number count="footref" from="/" level="any" format="1" />
846   </a>
847  </sup>
848 </xsl:template>
849
850 <xsl:template match="em">
851  <em><xsl:apply-templates /></em>
852 </xsl:template>
853
854 <xsl:template match="strong">
855  <strong><xsl:apply-templates /></strong>
856 </xsl:template>
857
858 <xsl:template match="thought">
859  <i><xsl:apply-templates /></i>
860 </xsl:template>
861
862 <xsl:template match="onomatopoeia">
863  <i><xsl:apply-templates /></i>
864 </xsl:template>
865
866 <xsl:template match="spell">
867  <i><xsl:apply-templates /></i>
868 </xsl:template>
869
870 <xsl:template match="item">
871  <xsl:apply-templates />
872 </xsl:template>
873
874 <xsl:template match="foreign">
875  <i><xsl:apply-templates /></i>
876 </xsl:template>
877
878 <xsl:template match="quote">
879  <xsl:text>&apos;</xsl:text>
880   <xsl:apply-templates />
881  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&apos;</xsl:text></xsl:if>
882 </xsl:template>
883
884 <xsl:template match="quote//quote">
885  <xsl:text>&quot;</xsl:text>
886   <xsl:apply-templates />
887  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&quot;</xsl:text></xsl:if>
888 </xsl:template>
889
890 <xsl:template match="cite">
891  <cite><xsl:apply-templates /></cite>
892 </xsl:template>
893
894 <xsl:template match="code">
895  <tt><xsl:apply-templates /></tt>
896 </xsl:template>
897
898 <xsl:template match="br">
899  <br />
900 </xsl:template>
901
902 <xsl:template match="typ[@class='attribute']">
903  <span class="smallcaps"><xsl:apply-templates /></span>
904 </xsl:template>
905
906 <!-- ==================== character elements ==================== -->
907 <!--
908
909 These templates define the mapping between the character elements used in
910 the Project Aon instances of Gamebook XML and the ISO-8859-1
911 characters.
912
913 Portions Copyright International Organization for Standardization 1986 
914 Permission to copy in any form is granted for use with conforming SGML 
915 systems and applications as defined in ISO 8879, provided this notice 
916 is included in all copies.
917
918 -->
919
920 <xsl:template match="ch.apos"><xsl:text>&#39;</xsl:text></xsl:template><!-- apostrophe = single quotation mark -->
921 <xsl:template match="ch.nbsp"><xsl:text>&#160;</xsl:text></xsl:template><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
922 <xsl:template match="ch.iexcl"><xsl:text>&#161;</xsl:text></xsl:template><!-- inverted exclamation mark, U+00A1 ISOnum -->
923 <xsl:template match="ch.cent"><xsl:text>&#162;</xsl:text></xsl:template><!-- cent sign, U+00A2 ISOnum -->
924 <xsl:template match="ch.pound"><xsl:text>&#163;</xsl:text></xsl:template><!-- pound sign, U+00A3 ISOnum -->
925 <xsl:template match="ch.curren"><xsl:text>&#164;</xsl:text></xsl:template><!-- currency sign, U+00A4 ISOnum -->
926 <xsl:template match="ch.yen"><xsl:text>&#165;</xsl:text></xsl:template><!-- yen sign = yuan sign, U+00A5 ISOnum -->
927 <xsl:template match="ch.brvbar"><xsl:text>&#166;</xsl:text></xsl:template><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
928 <xsl:template match="ch.sect"><xsl:text>&#167;</xsl:text></xsl:template><!-- section sign, U+00A7 ISOnum -->
929 <xsl:template match="ch.uml"><xsl:text>&#168;</xsl:text></xsl:template><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
930 <xsl:template match="ch.copy"><xsl:text>&#169;</xsl:text></xsl:template><!-- copyright sign, U+00A9 ISOnum -->
931 <xsl:template match="ch.ordf"><xsl:text>&#170;</xsl:text></xsl:template><!-- feminine ordinal indicator, U+00AA ISOnum -->
932 <xsl:template match="ch.laquo"><xsl:text>&#171;</xsl:text></xsl:template><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
933 <xsl:template match="ch.not"><xsl:text>&#172;</xsl:text></xsl:template><!-- not sign, U+00AC ISOnum -->
934 <xsl:template match="ch.shy"><xsl:text>&#173;</xsl:text></xsl:template><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
935 <xsl:template match="ch.reg"><xsl:text>&#174;</xsl:text></xsl:template><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
936 <xsl:template match="ch.macr"><xsl:text>&#175;</xsl:text></xsl:template><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
937 <xsl:template match="ch.deg"><xsl:text>&#176;</xsl:text></xsl:template><!-- degree sign, U+00B0 ISOnum -->
938 <xsl:template match="ch.plusmn"><xsl:text>&#177;</xsl:text></xsl:template><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
939 <xsl:template match="ch.sup2"><xsl:text>&#178;</xsl:text></xsl:template><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
940 <xsl:template match="ch.sup3"><xsl:text>&#179;</xsl:text></xsl:template><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
941 <xsl:template match="ch.acute"><xsl:text>&#180;</xsl:text></xsl:template><!-- acute accent = spacing acute, U+00B4 ISOdia -->
942 <xsl:template match="ch.micro"><xsl:text>&#181;</xsl:text></xsl:template><!-- micro sign, U+00B5 ISOnum -->
943 <xsl:template match="ch.para"><xsl:text>&#182;</xsl:text></xsl:template><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
944 <xsl:template match="ch.middot"><xsl:text>&#183;</xsl:text></xsl:template><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
945 <xsl:template match="ch.cedil"><xsl:text>&#184;</xsl:text></xsl:template><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
946 <xsl:template match="ch.sup1"><xsl:text>&#185;</xsl:text></xsl:template><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
947 <xsl:template match="ch.ordm"><xsl:text>&#186;</xsl:text></xsl:template><!-- masculine ordinal indicator, U+00BA ISOnum -->
948 <xsl:template match="ch.raquo"><xsl:text>&#187;</xsl:text></xsl:template><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
949 <xsl:template match="ch.frac14"><xsl:text>&#188;</xsl:text></xsl:template><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
950 <xsl:template match="ch.frac12"><xsl:text>&#189;</xsl:text></xsl:template><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
951 <xsl:template match="ch.frac34"><xsl:text>&#190;</xsl:text></xsl:template><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
952 <xsl:template match="ch.iquest"><xsl:text>&#191;</xsl:text></xsl:template><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
953 <xsl:template match="ch.Agrave"><xsl:text>&#192;</xsl:text></xsl:template><!-- latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 -->
954 <xsl:template match="ch.Aacute"><xsl:text>&#193;</xsl:text></xsl:template><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
955 <xsl:template match="ch.Acirc"><xsl:text>&#194;</xsl:text></xsl:template><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
956 <xsl:template match="ch.Atilde"><xsl:text>&#195;</xsl:text></xsl:template><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
957 <xsl:template match="ch.Auml"><xsl:text>&#196;</xsl:text></xsl:template><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
958 <xsl:template match="ch.Aring"><xsl:text>&#197;</xsl:text></xsl:template><!-- latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 -->
959 <xsl:template match="ch.AElig"><xsl:text>&#198;</xsl:text></xsl:template><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
960 <xsl:template match="ch.Ccedil"><xsl:text>&#199;</xsl:text></xsl:template><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
961 <xsl:template match="ch.Egrave"><xsl:text>&#200;</xsl:text></xsl:template><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
962 <xsl:template match="ch.Eacute"><xsl:text>&#201;</xsl:text></xsl:template><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
963 <xsl:template match="ch.Ecirc"><xsl:text>&#202;</xsl:text></xsl:template><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
964 <xsl:template match="ch.Euml"><xsl:text>&#203;</xsl:text></xsl:template><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
965 <xsl:template match="ch.Igrave"><xsl:text>&#204;</xsl:text></xsl:template><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
966 <xsl:template match="ch.Iacute"><xsl:text>&#205;</xsl:text></xsl:template><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
967 <xsl:template match="ch.Icirc"><xsl:text>&#206;</xsl:text></xsl:template><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
968 <xsl:template match="ch.Iuml"><xsl:text>&#207;</xsl:text></xsl:template><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
969 <xsl:template match="ch.ETH"><xsl:text>&#208;</xsl:text></xsl:template><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
970 <xsl:template match="ch.Ntilde"><xsl:text>&#209;</xsl:text></xsl:template><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
971 <xsl:template match="ch.Ograve"><xsl:text>&#210;</xsl:text></xsl:template><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
972 <xsl:template match="ch.Oacute"><xsl:text>&#211;</xsl:text></xsl:template><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
973 <xsl:template match="ch.Ocirc"><xsl:text>&#212;</xsl:text></xsl:template><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
974 <xsl:template match="ch.Otilde"><xsl:text>&#213;</xsl:text></xsl:template><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
975 <xsl:template match="ch.Ouml"><xsl:text>&#214;</xsl:text></xsl:template><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
976 <xsl:template match="ch.times"><xsl:text>&#215;</xsl:text></xsl:template><!-- multiplication sign, U+00D7 ISOnum -->
977 <xsl:template match="ch.Oslash"><xsl:text>&#216;</xsl:text></xsl:template><!-- latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 -->
978 <xsl:template match="ch.Ugrave"><xsl:text>&#217;</xsl:text></xsl:template><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
979 <xsl:template match="ch.Uacute"><xsl:text>&#218;</xsl:text></xsl:template><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
980 <xsl:template match="ch.Ucirc"><xsl:text>&#219;</xsl:text></xsl:template><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
981 <xsl:template match="ch.Uuml"><xsl:text>&#220;</xsl:text></xsl:template><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
982 <xsl:template match="ch.Yacute"><xsl:text>&#221;</xsl:text></xsl:template><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
983 <xsl:template match="ch.THORN"><xsl:text>&#222;</xsl:text></xsl:template><!-- latin capital letter THORN, U+00DE ISOlat1 -->
984 <xsl:template match="ch.szlig"><xsl:text>&#223;</xsl:text></xsl:template><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
985 <xsl:template match="ch.agrave"><xsl:text>&#224;</xsl:text></xsl:template><!-- latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 -->
986 <xsl:template match="ch.aacute"><xsl:text>&#225;</xsl:text></xsl:template><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
987 <xsl:template match="ch.acirc"><xsl:text>&#226;</xsl:text></xsl:template><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
988 <xsl:template match="ch.atilde"><xsl:text>&#227;</xsl:text></xsl:template><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
989 <xsl:template match="ch.auml"><xsl:text>&#228;</xsl:text></xsl:template><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
990 <xsl:template match="ch.aring"><xsl:text>&#229;</xsl:text></xsl:template><!-- latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 -->
991 <xsl:template match="ch.aelig"><xsl:text>&#230;</xsl:text></xsl:template><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
992 <xsl:template match="ch.ccedil"><xsl:text>&#231;</xsl:text></xsl:template><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
993 <xsl:template match="ch.egrave"><xsl:text>&#232;</xsl:text></xsl:template><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
994 <xsl:template match="ch.eacute"><xsl:text>&#233;</xsl:text></xsl:template><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
995 <xsl:template match="ch.ecirc"><xsl:text>&#234;</xsl:text></xsl:template><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
996 <xsl:template match="ch.euml"><xsl:text>&#235;</xsl:text></xsl:template><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
997 <xsl:template match="ch.igrave"><xsl:text>&#236;</xsl:text></xsl:template><!-- latin small letter i with grave, U+00EC ISOlat1 -->
998 <xsl:template match="ch.iacute"><xsl:text>&#237;</xsl:text></xsl:template><!-- latin small letter i with acute, U+00ED ISOlat1 -->
999 <xsl:template match="ch.icirc"><xsl:text>&#238;</xsl:text></xsl:template><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
1000 <xsl:template match="ch.iuml"><xsl:text>&#239;</xsl:text></xsl:template><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
1001 <xsl:template match="ch.eth"><xsl:text>&#240;</xsl:text></xsl:template><!-- latin small letter eth, U+00F0 ISOlat1 -->
1002 <xsl:template match="ch.ntilde"><xsl:text>&#241;</xsl:text></xsl:template><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
1003 <xsl:template match="ch.ograve"><xsl:text>&#242;</xsl:text></xsl:template><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
1004 <xsl:template match="ch.oacute"><xsl:text>&#243;</xsl:text></xsl:template><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
1005 <xsl:template match="ch.ocirc"><xsl:text>&#244;</xsl:text></xsl:template><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
1006 <xsl:template match="ch.otilde"><xsl:text>&#245;</xsl:text></xsl:template><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
1007 <xsl:template match="ch.ouml"><xsl:text>&#246;</xsl:text></xsl:template><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
1008 <xsl:template match="ch.divide"><xsl:text>&#247;</xsl:text></xsl:template><!-- division sign, U+00F7 ISOnum -->
1009 <xsl:template match="ch.oslash"><xsl:text>&#248;</xsl:text></xsl:template><!-- latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 -->
1010 <xsl:template match="ch.ugrave"><xsl:text>&#249;</xsl:text></xsl:template><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
1011 <xsl:template match="ch.uacute"><xsl:text>&#250;</xsl:text></xsl:template><!-- latin small letter u with acute, U+00FA ISOlat1 -->
1012 <xsl:template match="ch.ucirc"><xsl:text>&#251;</xsl:text></xsl:template><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
1013 <xsl:template match="ch.uuml"><xsl:text>&#252;</xsl:text></xsl:template><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
1014 <xsl:template match="ch.yacute"><xsl:text>&#253;</xsl:text></xsl:template><!-- latin small letter y with acute, U+00FD ISOlat1 -->
1015 <xsl:template match="ch.thorn"><xsl:text>&#254;</xsl:text></xsl:template><!-- latin small letter thorn, U+00FE ISOlat1 -->
1016 <xsl:template match="ch.yuml"><xsl:text>&#255;</xsl:text></xsl:template><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
1017
1018 <!-- ~~~~~~~~~~~~~~~~~~~~~ Special Characters ~~~~~~~~~~~~~~~~~~~~ -->
1019
1020 <xsl:template match="ch.ampersand">&amp;</xsl:template><!-- ampersand -->
1021 <xsl:template match="ch.lsquot">&apos;</xsl:template><!-- opening left quotation mark -->
1022 <xsl:template match="ch.rsquot">&apos;</xsl:template><!-- closing right quotation mark -->
1023 <xsl:template match="ch.ldquot">&quot;</xsl:template><!-- opening left double quotation mark -->
1024 <xsl:template match="ch.rdquot">&quot;</xsl:template><!-- closing right double quotation mark -->
1025 <xsl:template match="ch.minus">-</xsl:template><!-- mathematical minus -->
1026 <xsl:template match="ch.endash">-</xsl:template><!-- endash -->
1027 <xsl:template match="ch.emdash">--</xsl:template><!-- emdash -->
1028 <xsl:template match="ch.ellips">&nbsp;.&nbsp;.&nbsp;.</xsl:template><!-- ellipsis -->
1029 <xsl:template match="ch.lellips">.&nbsp;.&nbsp;.&nbsp;</xsl:template><!-- left ellipsis, used at the beginning of edited material -->
1030 <xsl:template match="ch.blankline">_______</xsl:template><!-- blank line to be filled in -->
1031 <xsl:template match="ch.percent"><xsl:text>&#37;</xsl:text></xsl:template><!-- percent sign -->
1032 <xsl:template match="ch.thinspace"><xsl:text></xsl:text></xsl:template><!-- small horizontal space for use between adjacent quotation marks - added mainly for LaTeX's sake -->
1033 <xsl:template match="ch.frac116"><xsl:text>1/16</xsl:text></xsl:template><!-- vulgar fraction one sixteenth = fraction on sixteenth -->
1034 <xsl:template match="ch.plus"><xsl:text>+</xsl:text></xsl:template><!-- mathematical plus -->
1035
1036 <!-- ==================== named templates ======================= -->
1037
1038 <xsl:template name="xhtml-wrapper">
1039  <xsl:param name="document-type">undefined</xsl:param>
1040  <xsl:param name="filename">undefined</xsl:param>
1041  <xsl:param name="glossary-id-prefix"></xsl:param>
1042
1043 <!-- <redirect:write file="{$filename}.htm">-->
1044  <redirect:write file="{$filename}.htm">
1045   <xsl:fallback>
1046    <xsl:text>xhtml-wrapper: Cannot write to filename: "</xsl:text>
1047    <xsl:value-of select="$filename" /><xsl:text>.htm"</xsl:text>
1048   </xsl:fallback>
1049
1050   <html xml:lang="en-UK" lang="en-UK">
1051
1052    <xsl:value-of select="$newline" />
1053    <xsl:value-of select="$newline" />
1054
1055    <head><xsl:value-of select="$newline" />
1056     <title>
1057      <xsl:value-of select="/gamebook/meta/title[1]" />
1058      <xsl:text>: </xsl:text>
1059      <xsl:choose>
1060       <xsl:when test="$document-type='illustration'">
1061        <xsl:choose>
1062         <xsl:when test="$language='es'">
1063          <xsl:text>Ilustraci&oacute;n </xsl:text>
1064         </xsl:when>
1065         <xsl:otherwise>
1066          <xsl:text>Illustration </xsl:text>
1067         </xsl:otherwise>
1068        </xsl:choose>
1069        <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
1070       </xsl:when>
1071       <xsl:otherwise><xsl:value-of select="meta/title[1]" /></xsl:otherwise>
1072      </xsl:choose>
1073     </title><xsl:value-of select="$newline" />
1074     <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" /><xsl:value-of select="$newline" />
1075     <meta name="robots" content="noindex,nofollow" /><xsl:value-of select="$newline" />
1076     <link rel="stylesheet" href="main.css" type="text/css" /><xsl:value-of select="$newline" />
1077    </head>
1078
1079    <xsl:value-of select="$newline" />
1080    <xsl:value-of select="$newline" />
1081
1082    <xsl:comment>
1083     <xsl:text> </xsl:text>
1084     <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
1085     <xsl:choose>
1086      <xsl:when test="$language='es'">
1087       <xsl:text> Publicado por </xsl:text>
1088      </xsl:when>
1089      <xsl:otherwise>
1090       <xsl:text> Published by </xsl:text>
1091      </xsl:otherwise>
1092     </xsl:choose>
1093     <xsl:apply-templates select="/gamebook/meta/publisher[1]" />
1094     <xsl:text>. </xsl:text>
1095    </xsl:comment>
1096
1097    <xsl:value-of select="$newline" />
1098    <xsl:value-of select="$newline" />
1099
1100    <body>
1101     <xsl:attribute name="text"><xsl:value-of select="$text-color" /></xsl:attribute>
1102     <xsl:attribute name="bgcolor"><xsl:value-of select="$background-color" /></xsl:attribute>
1103     <xsl:attribute name="background"><xsl:text>bckgrnd.gif</xsl:text></xsl:attribute>
1104     <xsl:attribute name="link"><xsl:value-of select="$link-color" /></xsl:attribute>
1105     <xsl:attribute name="alink"><xsl:value-of select="$alink-color" /></xsl:attribute>
1106     <xsl:attribute name="vlink"><xsl:value-of select="$vlink-color" /></xsl:attribute>
1107
1108     <xsl:value-of select="$newline" />
1109     <div id="title"><img src="title.gif" width="550" height="100" border="0" align="middle" usemap="#imagemap"><xsl:attribute name="alt"><xsl:value-of select="/gamebook/meta/title[1]" /></xsl:attribute></img></div><xsl:value-of select="$newline" />
1110     <div id="body"><xsl:value-of select="$newline" />
1111
1112      <xsl:choose>
1113
1114 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ top-level ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1115
1116       <xsl:when test="$document-type='top-level'">
1117        <div class="frontmatter"><xsl:value-of select="$newline" />
1118
1119         <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
1120         <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
1121
1122         <hr />
1123
1124         <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
1125
1126         <p>
1127          <xsl:choose>
1128           <xsl:when test="$language='es'">
1129            <xsl:text>Fecha de Publicaci&oacute;n: </xsl:text>
1130           </xsl:when>
1131           <xsl:otherwise>
1132            <xsl:text>Publication Date: </xsl:text>
1133           </xsl:otherwise>
1134          </xsl:choose>
1135          <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
1136          <xsl:text> </xsl:text>
1137          <xsl:choose>
1138           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
1139            <xsl:choose>
1140             <xsl:when test="$language='es'"><xsl:text>de enero de</xsl:text></xsl:when>
1141             <xsl:otherwise><xsl:text>January</xsl:text></xsl:otherwise>
1142            </xsl:choose>
1143           </xsl:when>
1144           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
1145            <xsl:choose>
1146             <xsl:when test="$language='es'"><xsl:text>de febrero de</xsl:text></xsl:when>
1147             <xsl:otherwise><xsl:text>February</xsl:text></xsl:otherwise>
1148            </xsl:choose>
1149           </xsl:when>
1150           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
1151            <xsl:choose>
1152             <xsl:when test="$language='es'"><xsl:text>de marzo de</xsl:text></xsl:when>
1153             <xsl:otherwise><xsl:text>March</xsl:text></xsl:otherwise>
1154            </xsl:choose>
1155           </xsl:when>
1156           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
1157            <xsl:choose>
1158             <xsl:when test="$language='es'"><xsl:text>de abril de</xsl:text></xsl:when>
1159             <xsl:otherwise><xsl:text>April</xsl:text></xsl:otherwise>
1160            </xsl:choose>
1161           </xsl:when>
1162           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
1163            <xsl:choose>
1164             <xsl:when test="$language='es'"><xsl:text>de mayo de</xsl:text></xsl:when>
1165             <xsl:otherwise><xsl:text>May</xsl:text></xsl:otherwise>
1166            </xsl:choose>
1167           </xsl:when>
1168           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
1169            <xsl:choose>
1170             <xsl:when test="$language='es'"><xsl:text>de junio de</xsl:text></xsl:when>
1171             <xsl:otherwise><xsl:text>June</xsl:text></xsl:otherwise>
1172            </xsl:choose>
1173           </xsl:when>
1174           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
1175            <xsl:choose>
1176             <xsl:when test="$language='es'"><xsl:text>de julio de</xsl:text></xsl:when>
1177             <xsl:otherwise><xsl:text>July</xsl:text></xsl:otherwise>
1178            </xsl:choose>
1179           </xsl:when>
1180           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
1181            <xsl:choose>
1182             <xsl:when test="$language='es'"><xsl:text>de agosto de</xsl:text></xsl:when>
1183             <xsl:otherwise><xsl:text>August</xsl:text></xsl:otherwise>
1184            </xsl:choose>
1185           </xsl:when>
1186           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
1187            <xsl:choose>
1188             <xsl:when test="$language='es'"><xsl:text>de septiembre de</xsl:text></xsl:when>
1189             <xsl:otherwise><xsl:text>September</xsl:text></xsl:otherwise>
1190            </xsl:choose>
1191           </xsl:when>
1192           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
1193            <xsl:choose>
1194             <xsl:when test="$language='es'"><xsl:text>de octubre de</xsl:text></xsl:when>
1195             <xsl:otherwise><xsl:text>October</xsl:text></xsl:otherwise>
1196            </xsl:choose>
1197           </xsl:when>
1198           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
1199            <xsl:choose>
1200             <xsl:when test="$language='es'"><xsl:text>de noviembre de</xsl:text></xsl:when>
1201             <xsl:otherwise><xsl:text>November</xsl:text></xsl:otherwise>
1202            </xsl:choose>
1203           </xsl:when>
1204           <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
1205            <xsl:choose>
1206             <xsl:when test="$language='es'"><xsl:text>de diciembre de</xsl:text></xsl:when>
1207             <xsl:otherwise><xsl:text>December</xsl:text></xsl:otherwise>
1208            </xsl:choose>
1209           </xsl:when>
1210           <xsl:otherwise>
1211            <xsl:text>Invalid Month</xsl:text>
1212           </xsl:otherwise>
1213          </xsl:choose>
1214          <xsl:text> </xsl:text>
1215          <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
1216         </p>
1217
1218         <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
1219
1220         <xsl:value-of select="$newline" />
1221
1222         <xsl:call-template name="navigation-bar" />
1223
1224         <xsl:value-of select="$newline" />
1225        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1226
1227       </xsl:when>
1228
1229 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ toc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1230
1231       <xsl:when test="$document-type='toc'">
1232        <div class="frontmatter"><xsl:value-of select="$newline" />
1233         <h2>
1234          <xsl:choose>
1235           <xsl:when test="$language='es'">
1236            <xsl:text>&Iacute;ndice de Contenidos</xsl:text>
1237           </xsl:when>
1238           <xsl:otherwise>
1239            <xsl:text>Table of Contents</xsl:text>
1240           </xsl:otherwise>
1241          </xsl:choose>
1242         </h2><xsl:value-of select="$newline" />
1243
1244         <xsl:value-of select="$newline" />
1245         <xsl:value-of select="$newline" />
1246
1247         <ul><xsl:value-of select="$newline" />
1248          <xsl:variable name="title-page">
1249           <xsl:choose>
1250            <xsl:when test="$language='es'">
1251             <xsl:text>P&aacute;gina Principal</xsl:text>
1252            </xsl:when>
1253            <xsl:otherwise>
1254             <xsl:text>Title Page</xsl:text>
1255            </xsl:otherwise>
1256           </xsl:choose>
1257          </xsl:variable>
1258
1259          <li><a href="title.htm"><xsl:value-of select="$title-page"/></a></li><xsl:value-of select="$newline" />
1260          <xsl:for-each select="/gamebook/section/data/section">
1261           <li>
1262            <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
1263             <xsl:value-of select="meta/title[1]" />
1264            </a>
1265            <xsl:if test="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
1266             <xsl:value-of select="$newline" />
1267             <ul><xsl:value-of select="$newline" />
1268              <xsl:for-each select="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
1269               <li>
1270                <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
1271                 <xsl:value-of select ="meta/title[1]" />
1272                </a>
1273               </li><xsl:value-of select="$newline" />
1274              </xsl:for-each>
1275             </ul><xsl:value-of select="$newline" />
1276            </xsl:if>
1277           </li><xsl:value-of select="$newline" />
1278          </xsl:for-each>
1279         </ul><xsl:value-of select="$newline" />
1280
1281         <xsl:value-of select="$newline" />
1282         <xsl:value-of select="$newline" />
1283         <xsl:call-template name="navigation-bar" />
1284        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1285       </xsl:when>
1286
1287 <!-- ~~~~~~~~~~~~~~~~ second-level-frontmatter ~~~~~~~~~~~~~~~~~~~ -->
1288
1289       <xsl:when test="$document-type='second-level-frontmatter'">
1290        <div class="frontmatter"><xsl:value-of select="$newline" />
1291         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1292
1293         <xsl:value-of select="$newline" />
1294
1295         <xsl:apply-templates />
1296
1297         <xsl:value-of select="$newline" />
1298
1299         <xsl:call-template name="navigation-bar" />
1300
1301        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1302       </xsl:when>
1303
1304 <!-- ~~~~~~~~~~~~~ third-level-frontmatter-separate ~~~~~~~~~~~~~~ -->
1305
1306       <xsl:when test="$document-type='third-level-frontmatter-separate'">
1307        <div class="frontmatter"><xsl:value-of select="$newline" />
1308         <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
1309         <xsl:value-of select="$newline" />
1310
1311         <xsl:apply-templates />
1312
1313         <xsl:value-of select="$newline" />
1314
1315         <xsl:call-template name="navigation-bar" />
1316
1317        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1318       </xsl:when>
1319
1320 <!-- ~~~~~~~~~~~~~~~~ second-level-mainmatter ~~~~~~~~~~~~~~~~~~~ -->
1321
1322       <xsl:when test="$document-type='second-level-mainmatter'">
1323        <div class="mainmatter"><xsl:value-of select="$newline" />
1324         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1325         <xsl:value-of select="$newline" />
1326
1327         <xsl:apply-templates />
1328
1329         <xsl:value-of select="$newline" />
1330
1331         <xsl:call-template name="navigation-bar" />
1332
1333        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1334       </xsl:when>
1335
1336 <!-- ~~~~~~~~~~~~~ third-level-mainmatter-separate ~~~~~~~~~~~~~~ -->
1337
1338       <xsl:when test="$document-type='third-level-mainmatter-separate'">
1339        <div class="mainmatter"><xsl:value-of select="$newline" />
1340         <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
1341         <xsl:value-of select="$newline" />
1342
1343         <xsl:apply-templates />
1344
1345         <xsl:value-of select="$newline" />
1346
1347         <xsl:call-template name="navigation-bar" />
1348
1349        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1350       </xsl:when>
1351
1352 <!-- ~~~~~~~~~~~~~~~~ second-level-glossary ~~~~~~~~~~~~~~~~~~~ -->
1353
1354       <xsl:when test="$document-type='second-level-glossary'">
1355        <div class="mainmatter"><xsl:value-of select="$newline" />
1356         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1357         <xsl:value-of select="$newline" />
1358
1359         <xsl:apply-templates />
1360
1361         <xsl:value-of select="$newline" />
1362
1363         <xsl:call-template name="alpha-bar">
1364          <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
1365         </xsl:call-template>
1366
1367         <xsl:call-template name="navigation-bar" />
1368
1369        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1370       </xsl:when>
1371
1372 <!-- ~~~~~~~~~~~~~ third-level-glossary-separate ~~~~~~~~~~~~~~ -->
1373
1374       <xsl:when test="$document-type='third-level-glossary-separate'">
1375        <div class="glossary"><xsl:value-of select="$newline" />
1376         <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
1377         <xsl:call-template name="alpha-bar">
1378          <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
1379         </xsl:call-template>
1380
1381         <xsl:value-of select="$newline" />
1382
1383         <xsl:apply-templates />
1384
1385         <xsl:value-of select="$newline" />
1386
1387         <xsl:call-template name="navigation-bar" />
1388         <xsl:value-of select="$newline" />
1389        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1390       </xsl:when>
1391
1392 <!-- ~~~~~~~~~~~~~~~~~~ second-level-numbered ~~~~~~~~~~~~~~~~~~~~ -->
1393 <!--
1394
1395 The following automatically generated section list requires that the
1396 title of each section be a simple number.
1397
1398 -->
1399       <xsl:when test="$document-type='second-level-numbered'">
1400        <div class="numbered"><xsl:value-of select="$newline" />
1401         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1402         <xsl:value-of select="$newline" />
1403
1404         <xsl:variable name="base-section-number" select="number( data/section[1]/meta/title ) - 1" />
1405         <p>
1406          <xsl:for-each select="data/section">
1407           <xsl:if test="position( ) mod 10 = 1">
1408            <b><a><xsl:attribute name="name"><xsl:value-of select="position( ) + $base-section-number" /></xsl:attribute>
1409             <xsl:value-of select="position( ) + $base-section-number" />
1410             <xsl:if test="not( position( ) = last( ) )">
1411              <xsl:text>-</xsl:text>
1412              <xsl:choose>
1413               <xsl:when test="position( ) + 9 &lt;= last( )">
1414                <xsl:value-of select="position( ) + 9 + $base-section-number" />
1415               </xsl:when>
1416               <xsl:otherwise>
1417                <xsl:value-of select="last( ) + $base-section-number" />
1418               </xsl:otherwise>
1419              </xsl:choose>
1420             </xsl:if>
1421            </a><xsl:text>: </xsl:text></b>
1422           </xsl:if>
1423           <a>
1424            <xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
1425            <xsl:value-of select="meta/title" />
1426           </a>
1427           <xsl:choose>
1428            <xsl:when test="position( ) mod 10 = 0">
1429             <br /><xsl:value-of select="$newline" />
1430            </xsl:when>
1431            <xsl:otherwise>
1432             <xsl:text> </xsl:text>
1433            </xsl:otherwise>
1434           </xsl:choose>
1435          </xsl:for-each>
1436         </p>
1437
1438         <xsl:value-of select="$newline" />
1439         <xsl:value-of select="$newline" />
1440
1441         <xsl:call-template name="navigation-bar" />
1442         <xsl:value-of select="$newline" />
1443        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1444       </xsl:when>
1445
1446 <!-- ~~~~~~~~~~~~~~~~~~ third-level-numbered ~~~~~~~~~~~~~~~~~~~~~ -->
1447
1448       <xsl:when test="$document-type='third-level-numbered'">
1449        <div class="numbered"><xsl:value-of select="$newline" />
1450         <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
1451         <xsl:value-of select="$newline" />
1452
1453         <xsl:apply-templates />
1454
1455         <xsl:value-of select="$newline" />
1456         <xsl:call-template name="navigation-bar" />
1457         <xsl:value-of select="$newline" />
1458        </div>
1459       </xsl:when>
1460
1461 <!-- ~~~~~~~~~~~~~~~~~ second-level-backmatter ~~~~~~~~~~~~~~~~~~~ -->
1462
1463       <xsl:when test="$document-type='second-level-backmatter'">
1464        <div class="frontmatter"><xsl:value-of select="$newline" />
1465         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1466
1467         <xsl:value-of select="$newline" />
1468         <xsl:value-of select="$newline" />
1469
1470         <xsl:apply-templates />
1471
1472         <xsl:value-of select="$newline" />
1473
1474         <xsl:call-template name="navigation-bar" />
1475         <xsl:value-of select="$newline" />
1476        </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1477       </xsl:when>
1478
1479 <!-- ~~~~~~~~~~~~~~~~~~~~~~~ map-adjusted ~~~~~~~~~~~~~~~~~~~~~~~~ -->
1480
1481       <xsl:when test="$document-type='map-adjusted'">
1482        <div class="frontmatter"><xsl:value-of select="$newline" />
1483         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1484
1485         <xsl:value-of select="$newline" />
1486         <xsl:value-of select="$newline" />
1487
1488         <xsl:for-each select="data/* | data/text()">
1489          <xsl:variable name="map-illustration-alt-text">
1490           <xsl:choose>
1491            <xsl:when test="$language='es'">
1492             <xsl:text>mapa</xsl:text>
1493            </xsl:when>
1494            <xsl:otherwise>
1495             <xsl:text>map</xsl:text>
1496            </xsl:otherwise>
1497           </xsl:choose>
1498          </xsl:variable>
1499
1500          <!-- duplicated stuff here, no good way to avoid this while retaining backwards compatibility -->         
1501          <xsl:choose>
1502           <xsl:when test="self::illustration and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1503            <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
1504            <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
1505            <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
1506
1507            <xsl:variable name="illustration-width-adjusted"><xsl:number value="386" /></xsl:variable>
1508            <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height * $illustration-width-adjusted div $illustration-width" /></xsl:variable>
1509
1510            <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
1511             <xsl:call-template name="illustration-framed">
1512              <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width-adjusted" /></xsl:with-param>
1513              <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height-adjusted" /></xsl:with-param>
1514              <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
1515              <xsl:with-param name="illustration-href">maplarge.htm</xsl:with-param>
1516              <xsl:with-param name="brdrl-width">31</xsl:with-param>
1517              <xsl:with-param name="brdrr-width">33</xsl:with-param>
1518              <xsl:with-param name="illustration-alt-text">[{$map-illustration-alt-text}]</xsl:with-param>
1519             </xsl:call-template>
1520             <br /><br />
1521            </div></div><xsl:value-of select="$newline" />
1522           </xsl:when>
1523
1524           <xsl:when test="self::illref and @class='html'">
1525            <xsl:for-each select="id( @idref )">
1526             <xsl:if test="contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1527              <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
1528              <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
1529              <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
1530
1531              <xsl:variable name="illustration-width-adjusted"><xsl:number value="386" /></xsl:variable>
1532              <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height * $illustration-width-adjusted div $illustration-width" /></xsl:variable>
1533
1534              <div class="illustration">
1535               <div align="center"><xsl:value-of select="$newline" />
1536               <xsl:call-template name="illustration-framed">
1537                <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width-adjusted" /></xsl:with-param>
1538                <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height-adjusted" /></xsl:with-param>
1539                <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
1540                <xsl:with-param name="illustration-href">maplarge.htm</xsl:with-param>
1541                <xsl:with-param name="brdrl-width">31</xsl:with-param>
1542                <xsl:with-param name="brdrr-width">33</xsl:with-param>
1543                <xsl:with-param name="illustration-alt-text">[{$map-illustration-alt-text}]</xsl:with-param>
1544               </xsl:call-template>
1545               <br /><br />
1546              </div></div><xsl:value-of select="$newline" />
1547             </xsl:if>
1548            </xsl:for-each>
1549           </xsl:when>
1550           <xsl:otherwise>
1551            <xsl:apply-templates select="." />
1552           </xsl:otherwise>
1553          </xsl:choose>
1554         </xsl:for-each>
1555
1556         <xsl:value-of select="$newline" />
1557
1558         <xsl:call-template name="navigation-bar" />
1559         <xsl:value-of select="$newline" />
1560        </div>
1561       </xsl:when>
1562
1563 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ map ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1564
1565       <xsl:when test="$document-type='map'">
1566        <div class="frontmatter"><xsl:value-of select="$newline" />
1567         <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
1568
1569         <xsl:value-of select="$newline" />
1570         <xsl:value-of select="$newline" />
1571
1572         <xsl:for-each select="data/* | data/text()">
1573          <xsl:variable name="map-illustration-alt-text">
1574           <xsl:choose>
1575            <xsl:when test="$language='es'">
1576             <xsl:text>mapa</xsl:text>
1577            </xsl:when>
1578            <xsl:otherwise>
1579             <xsl:text>map</xsl:text>
1580            </xsl:otherwise>
1581           </xsl:choose>
1582          </xsl:variable>
1583
1584          <!-- duplicated stuff here, no good way to avoid this while retaining backwards compatibility -->
1585          <xsl:choose>
1586           <xsl:when test="self::illustration and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1587            <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
1588            <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
1589            <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
1590
1591            <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
1592             <xsl:call-template name="illustration-framed">
1593              <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width" /></xsl:with-param>
1594              <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height" /></xsl:with-param>
1595              <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
1596              <xsl:with-param name="illustration-href">map.htm</xsl:with-param>
1597              <xsl:with-param name="brdrl-width">31</xsl:with-param>
1598              <xsl:with-param name="brdrr-width">33</xsl:with-param>
1599              <xsl:with-param name="illustration-alt-text">[{$map-illustration-alt-text}]</xsl:with-param>
1600             </xsl:call-template>
1601             <br /><xsl:value-of select="$newline" />
1602            </div></div><xsl:value-of select="$newline" />
1603           </xsl:when>
1604
1605           <xsl:when test="self::illref and @class='html'">
1606            <xsl:for-each select="id( @idref )">
1607             <xsl:if test="contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1608              <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
1609              <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
1610              <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
1611
1612              <div class="illustration">
1613               <div align="center"><xsl:value-of select="$newline" />
1614               <xsl:call-template name="illustration-framed">
1615                <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width" /></xsl:with-param>
1616                <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height" /></xsl:with-param>
1617                <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
1618                <xsl:with-param name="illustration-href">map.htm</xsl:with-param>
1619                <xsl:with-param name="brdrl-width">31</xsl:with-param>
1620                <xsl:with-param name="brdrr-width">33</xsl:with-param>
1621                <xsl:with-param name="illustration-alt-text">[{$map-illustration-alt-text}]</xsl:with-param>
1622               </xsl:call-template>
1623               <br /><xsl:value-of select="$newline" />
1624              </div></div><xsl:value-of select="$newline" />
1625             </xsl:if>
1626            </xsl:for-each>
1627           </xsl:when>
1628           <xsl:otherwise>
1629            <xsl:apply-templates select="." />
1630           </xsl:otherwise>
1631          </xsl:choose>
1632         </xsl:for-each>
1633
1634         <xsl:value-of select="$newline" />
1635
1636         <xsl:call-template name="navigation-bar" />
1637         <xsl:value-of select="$newline" />
1638        </div>
1639       </xsl:when>
1640
1641 <!-- ~~~~~~~~~~~~~~~~~~~~~~ illustration ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1642
1643       <xsl:when test="$document-type='illustration'">
1644        <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
1645        <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
1646        <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
1647
1648        <h3>
1649         <xsl:choose>
1650          <xsl:when test="$language='es'">
1651           <xsl:text>Ilustraci&oacute;n </xsl:text>
1652          </xsl:when>
1653          <xsl:otherwise>
1654           <xsl:text>Illustration </xsl:text>
1655          </xsl:otherwise>
1656         </xsl:choose>
1657         <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
1658        </h3><xsl:value-of select="$newline" />
1659
1660        <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
1661         <xsl:call-template name="illustration-framed">
1662          <xsl:with-param name="illustration-width"><xsl:value-of select="$illustration-width" /></xsl:with-param>
1663          <xsl:with-param name="illustration-height"><xsl:value-of select="$illustration-height" /></xsl:with-param>
1664          <xsl:with-param name="illustration-src"><xsl:value-of select="$illustration-src" /></xsl:with-param>
1665          <xsl:with-param name="brdrl-width">31</xsl:with-param>
1666          <xsl:with-param name="brdrr-width">33</xsl:with-param>
1667         </xsl:call-template>
1668         <br /><xsl:value-of select="$newline" />
1669        </div></div><xsl:value-of select="$newline" />
1670        <p class="caption"><strong><xsl:apply-templates select="meta/description" /></strong></p><xsl:value-of select="$newline" />
1671       </xsl:when>
1672
1673 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1674
1675       <xsl:otherwise>
1676        <xsl:message>
1677         <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
1678         <xsl:value-of select="$document-type" />
1679         <xsl:text>".</xsl:text>
1680        </xsl:message>
1681        <p>
1682         <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
1683         <xsl:value-of select="$document-type" />
1684         <xsl:text>".</xsl:text>
1685        </p>
1686       </xsl:otherwise>
1687
1688      </xsl:choose>
1689
1690 <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
1691
1692      <xsl:call-template name="process-footnotes" />
1693
1694      <p class="copyright"><xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" /></p><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
1695
1696     </div><xsl:value-of select="$newline" />
1697
1698     <map name="imagemap" id="imagemap">
1699      <area shape="rect" coords="0,0,99,99" href="http://www.projectaon.org/" alt="Project Aon" target="_top" />
1700      <area shape="default" href="title.htm">
1701       <xsl:attribute name="alt"><xsl:value-of select="/gamebook/meta/title[1]" /></xsl:attribute>
1702      </area>
1703     </map>
1704
1705    </body>
1706
1707    <xsl:value-of select="$newline" />
1708    <xsl:value-of select="$newline" />
1709
1710   </html>
1711  </redirect:write>
1712
1713 </xsl:template>
1714
1715 <xsl:template name="process-footnotes">
1716  <xsl:if test="footnotes/footnote">
1717   <div id="footnotes"><xsl:value-of select="$newline" />
1718    <xsl:for-each select="footnotes/footnote">
1719     <xsl:variable name="footnote-idref" select="@idref" />
1720     <xsl:variable name="footnote-id" select="@id" />
1721     <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
1722
1723     <xsl:for-each select="*[1]">
1724      <p>
1725       <xsl:text>[</xsl:text>
1726        <a href="#{$footnote-idref}" name="{$footnote-id}"><xsl:value-of select="$footnote-marker" /></a>
1727       <xsl:text>] </xsl:text>
1728       <xsl:apply-templates select="child::* | child::text()" />
1729      </p>
1730     </xsl:for-each>
1731
1732     <xsl:for-each select="*[position() != 1]">
1733       <xsl:apply-templates select="." />
1734     </xsl:for-each>
1735    </xsl:for-each>
1736   </div><xsl:value-of select="$newline" />
1737  </xsl:if>
1738 </xsl:template>
1739
1740 <xsl:template name="navigation-bar">
1741  <xsl:variable name="table-of-contents">
1742   <xsl:choose>
1743    <xsl:when test="$language='es'">
1744     <xsl:text>&Iacute;ndice de Contenidos</xsl:text>
1745    </xsl:when>
1746    <xsl:otherwise>
1747     <xsl:text>Table of Contents</xsl:text>      
1748    </xsl:otherwise>
1749   </xsl:choose>
1750  </xsl:variable>
1751  <div class="navigation">
1752   <table cellspacing="0" cellpadding="0" border="0">
1753    <tr>
1754     <td>
1755      <xsl:choose>
1756       <xsl:when test="meta/link[@class='prev']">
1757        <a>
1758         <xsl:attribute name="href">
1759          <xsl:value-of select="meta/link[@class='prev']/@idref" />
1760          <xsl:text>.htm</xsl:text>
1761         </xsl:attribute>
1762         <img src="back.gif" width="150" height="30" border="0">
1763          <xsl:attribute name="alt">
1764           <xsl:value-of select="id( meta/link[@class='prev']/@idref )/meta/title" />
1765          </xsl:attribute>
1766         </img>
1767        </a>
1768       </xsl:when>
1769       <xsl:otherwise>
1770        <img src="left.gif" width="150" height="30" border="0" alt="" />
1771       </xsl:otherwise>
1772      </xsl:choose>
1773     </td>
1774     <td><a href="toc.htm"><img src="toc.gif" width="150" height="30" border="0" alt="{$table-of-contents}" /></a></td>
1775     <td>
1776      <xsl:choose>
1777       <xsl:when test="meta/link[@class='next']">
1778        <a>
1779         <xsl:attribute name="href">
1780          <xsl:value-of select="meta/link[@class='next']/@idref" />
1781          <xsl:text>.htm</xsl:text>
1782         </xsl:attribute>
1783         <img src="forward.gif" width="150" height="30" border="0">
1784          <xsl:attribute name="alt">
1785           <xsl:choose>
1786            <xsl:when test="meta/link[@class='next']/@idref = 'sect1'">
1787             <xsl:choose>
1788              <xsl:when test="$language='es'">
1789               <xsl:text>Secci&oacute;n 1</xsl:text>
1790              </xsl:when>
1791              <xsl:otherwise>
1792               <xsl:text>Section 1</xsl:text>
1793              </xsl:otherwise>
1794             </xsl:choose>
1795            </xsl:when>
1796            <xsl:otherwise>
1797             <xsl:value-of select="id( meta/link[@class='next']/@idref )/meta/title" />
1798            </xsl:otherwise>
1799           </xsl:choose>
1800          </xsl:attribute>
1801         </img>
1802        </a>
1803       </xsl:when>
1804       <xsl:otherwise>
1805        <img src="right.gif" width="150" height="30" border="0" alt="" />
1806       </xsl:otherwise>
1807      </xsl:choose>
1808     </td>
1809    </tr>
1810   </table>
1811  </div>
1812 </xsl:template>
1813
1814 <xsl:template name="alpha-bar">
1815  <xsl:param name="alpha-bar-id-prefix"></xsl:param>
1816
1817   <p class="navigation">[<a href="{$alpha-bar-id-prefix}a.htm">A</a>&nbsp;<a href="{$alpha-bar-id-prefix}b.htm">B</a>&nbsp;<a href="{$alpha-bar-id-prefix}c.htm">C</a>&nbsp;<a href="{$alpha-bar-id-prefix}d.htm">D</a>&nbsp;<a href="{$alpha-bar-id-prefix}e.htm">E</a>&nbsp;<a href="{$alpha-bar-id-prefix}f.htm">F</a>&nbsp;<a href="{$alpha-bar-id-prefix}g.htm">G</a>&nbsp;<a href="{$alpha-bar-id-prefix}h.htm">H</a>&nbsp;<a href="{$alpha-bar-id-prefix}i.htm">I</a>&nbsp;<a href="{$alpha-bar-id-prefix}j.htm">J</a>&nbsp;<a href="{$alpha-bar-id-prefix}k.htm">K</a>&nbsp;<a href="{$alpha-bar-id-prefix}l.htm">L</a>&nbsp;<a href="{$alpha-bar-id-prefix}m.htm">M</a>&nbsp;<a href="{$alpha-bar-id-prefix}n.htm">N</a>&nbsp;<a href="{$alpha-bar-id-prefix}o.htm">O</a>&nbsp;<a href="{$alpha-bar-id-prefix}p.htm">P</a>&nbsp;<a href="{$alpha-bar-id-prefix}q.htm">Q</a>&nbsp;<a href="{$alpha-bar-id-prefix}r.htm">R</a>&nbsp;<a href="{$alpha-bar-id-prefix}s.htm">S</a>&nbsp;<a href="{$alpha-bar-id-prefix}t.htm">T</a>&nbsp;<a href="{$alpha-bar-id-prefix}u.htm">U</a>&nbsp;<a href="{$alpha-bar-id-prefix}v.htm">V</a>&nbsp;<a href="{$alpha-bar-id-prefix}w.htm">W</a>&nbsp;<a href="{$alpha-bar-id-prefix}x.htm">X</a>&nbsp;<a href="{$alpha-bar-id-prefix}y.htm">Y</a>&nbsp;<a href="{$alpha-bar-id-prefix}z.htm">Z</a>]</p><xsl:value-of select="$newline" />
1818
1819 </xsl:template>
1820
1821 <xsl:template name="illustration-framed">
1822  <xsl:param name="brdrl-width">32</xsl:param>
1823  <xsl:param name="brdr-height">32</xsl:param>
1824  <xsl:param name="brdrr-width">32</xsl:param>
1825  <xsl:param name="illustration-alt-text">
1826   <xsl:choose>
1827    <xsl:when test="$language='es'">
1828     <xsl:text>ilustraci&oacute;n</xsl:text>
1829    </xsl:when>
1830    <xsl:otherwise>
1831     <xsl:text>illustration</xsl:text>
1832    </xsl:otherwise>
1833   </xsl:choose>
1834  </xsl:param>
1835
1836  <xsl:param name="illustration-width"></xsl:param>
1837  <xsl:param name="illustration-height"></xsl:param>
1838  <xsl:param name="illustration-src"></xsl:param>
1839  <xsl:param name="illustration-href"></xsl:param>
1840
1841  <table border="0" cellpadding="0" cellspacing="0">
1842   <xsl:value-of select="$newline" />
1843   <tr>
1844    <xsl:value-of select="$newline" />
1845    <td><img src="brdrtpl.gif" width="{$brdrl-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1846    <td><img src="brdrtp.gif" width="{$illustration-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1847    <td><img src="brdrtpr.gif" width="{$brdrr-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1848   </tr><xsl:value-of select="$newline" />
1849   <tr>
1850    <xsl:value-of select="$newline" />
1851    <td><img src="brdrl.gif" width="{$brdrl-width}" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1852    <td>
1853     <xsl:choose>
1854      <xsl:when test="$illustration-href">
1855       <a href="{$illustration-href}">
1856        <img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="{$illustration-alt-text}" />
1857       </a>
1858      </xsl:when>
1859      <xsl:otherwise>
1860       <img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[{$illustration-alt-text}]" />
1861      </xsl:otherwise>
1862     </xsl:choose>
1863    </td><xsl:value-of select="$newline" />
1864    <td><img src="brdrr.gif" width="{$brdrr-width}" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1865   </tr><xsl:value-of select="$newline" />
1866   <tr>
1867    <xsl:value-of select="$newline" />
1868    <td><img src="brdrbtl.gif" width="{$brdrl-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1869    <td><img src="brdrbt.gif" width="{$illustration-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1870    <td><img src="brdrbtr.gif" width="{$brdrr-width}" height="{$brdr-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
1871   </tr><xsl:value-of select="$newline" />
1872  </table><xsl:value-of select="$newline" />
1873 </xsl:template>
1874
1875 </xsl:transform>