Correcting title.
[project-aon.git] / xml / xhtml-mongoose.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.2  2006/11/25 18:57:16  jonathan.blake
13 Fixed links to footnotes
14
15 Revision 1.1  2006/11/25 04:48:52  jonathan.blake
16 Modified to generate a single unstyled, UTF-8, HTML file which lacks any illustrations
17
18
19 ///// xhtml.xsl used as source for xhtml-mongoose.xsl
20
21 Revision 1.12  2006/06/05 23:46:46  jonathan.blake
22 Fixing the handling of titles when <ch.*/> elements are used.
23
24 Revision 1.11  2006/04/04 18:48:52  angantyr
25 Fixed paragraphed list and illref template bug.
26
27 Revision 1.10  2006/04/02 19:14:37  angantyr
28 Introduced automatic footnotes list generation and changed the illustrations
29 list generation so that links to numbered sections are titled "Section ...".
30 Backwards compatible with old XML files.
31
32 Revision 1.9  2006/03/14 21:04:03  angantyr
33 Changed the illustration handling with the introduction of 'illref's.
34 Backwards compatible.
35
36 Revision 1.8  2006/03/13 18:38:49  jonathan.blake
37 Fixed minor Spanish translation issue
38
39 Revision 1.7  2006/03/09 18:56:33  jonathan.blake
40 Added a language parameter and coding to switch between languages when the output is hard-coded into the transformation.
41
42 Revision 1.5  2006/03/02 00:33:32  jonathan.blake
43 Removed the 'book-path' parameter to work with new gbtoxhtml.pl
44
45 Revision 1.4  2005/12/27 01:51:29  angantyr
46 Added templates for the "bookref" and "footref" elements.
47
48 Revision 1.3  2005/12/05 21:29:04  jonathan.blake
49 Added the facilities to properly handle character elements.
50
51 Revision 1.2  2005/04/09 19:51:50  angantyr
52 Added handling of open-ended quotes.
53
54 Revision 1.1  2005/01/30 01:32:52  jonathan.blake
55 Initial freepository revision of XML support documents.
56
57 Revision 1.12  2003/10/07 06:05:14  Jon
58 Added capability for "accent" illustrations.
59
60 Revision 1.11  2002/12/06 22:12:04  jblake
61 Added default namespace declaration to transformation element
62 and removed all the extraneous declarations in the template
63 elements.
64
65 Revision 1.10  2002/11/17 22:37:25  jblake
66 Removed the "medium" creator entry from the templates.
67 Will they be of any use?
68
69 Revision 1.9  2002/11/17 05:06:56  jblake
70 Rearranged the title page.
71
72 Revision 1.8  2002/11/15 19:35:25  jblake
73 Fixed "Content-type" of XHTML output.
74
75 Revision 1.7  2002/11/15 00:15:39  jblake
76 Fixed a problem with the client-side image map and fixed
77 the numbered section list generation so that it will work
78 for Shadow on the Sand.
79
80 Revision 1.6  2002/10/30 05:59:45  jblake
81 Added a value for the alt attribute of the ToC image on the navigation bar.
82
83 Revision 1.5  2002/10/24 15:53:41  jblake
84 Fixed a conflict with whitespace and paragraphed lists.
85
86 Revision 1.4  2002/10/24 15:06:51  jblake
87 Added xmlns attributes to all elements that are top level in
88 their templates. This was an adjustment required by Xalan-J 2.4.
89
90 Also reinstated the comment in each document since the new
91 version of Xalan redirects it properly.
92
93 Revision 1.3  2002/10/23 05:18:29  jblake
94 Added the capability to filter which illustrators' work is used.
95 This is accomplished by the "use-illustrators" parameter.
96
97 Revision 1.2  2002/10/20 06:25:35  jblake
98 Added support for CLOSE COMBAT SKILL for Freeway Warrior books.
99
100 Revision 1.1  2002/10/15 23:29:51  jblake
101 Initial revision
102
103
104 20020327 - repurposed to be used with Xalan Java 2
105
106 Todo:
107
108 * Add blank whitespace handling to the paragraphed list template
109
110 -->
111
112 <xsl:transform version="1.0"
113   xmlns="http://www.w3.org/1999/xhtml"
114   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
115   xmlns:redirect="org.apache.xalan.lib.Redirect"
116   extension-element-prefixes="redirect">
117
118 <xsl:output method="xml"
119             encoding="utf-8"
120             omit-xml-declaration="yes"
121             doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
122             doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
123
124 <xsl:strip-space elements="section data ol ul dl li dd footnotes footnote" />
125 <xsl:preserve-space elements="p choice" />
126
127 <!-- ====================== parameters ========================== -->
128
129 <xsl:param name="use-illustrators" />
130 <xsl:param name="language"><xsl:text>en</xsl:text></xsl:param>
131  
132 <!-- ======================= variables ========================== -->
133
134 <xsl:variable name="newline">
135 <xsl:text>
136 </xsl:text>
137 </xsl:variable>
138
139 <!-- ======================== Templates ========================= -->
140
141 <!-- ================= hierarchical sections ==================== -->
142
143 <xsl:template match="meta" />
144 <xsl:template match="section" />
145
146 <xsl:template match="/gamebook">
147  <html xml:lang="en-UK" lang="en-UK">
148
149   <xsl:value-of select="$newline" />
150   <xsl:value-of select="$newline" />
151
152   <head><xsl:value-of select="$newline" />
153    <title>
154     <xsl:apply-templates select="/gamebook/meta/title[1]" />
155    </title><xsl:value-of select="$newline" />
156    <meta http-equiv="Content-type" content="text/html; charset=utf-8" /><xsl:value-of select="$newline" />
157    <meta name="robots" content="noindex,nofollow" /><xsl:value-of select="$newline" />
158   </head>
159
160   <xsl:value-of select="$newline" />
161   <xsl:value-of select="$newline" />
162
163   <body>
164    <xsl:comment>
165     <xsl:text> </xsl:text>
166     <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
167     <xsl:choose>
168      <xsl:when test="$language='es'">
169       <xsl:text> Publicado por </xsl:text>
170      </xsl:when>
171      <xsl:otherwise>
172       <xsl:text> Published by </xsl:text>
173      </xsl:otherwise>
174     </xsl:choose>
175     <xsl:apply-templates select="/gamebook/meta/publisher[1]" />
176     <xsl:text>. </xsl:text>
177    </xsl:comment>
178
179    <xsl:value-of select="$newline" />
180    <xsl:value-of select="$newline" />
181
182    <h1>
183     <a name="title">
184      <xsl:apply-templates select="/gamebook/meta/title[1]" />
185     </a>
186    </h1><xsl:value-of select="$newline" />
187
188    <xsl:apply-templates/>
189
190   </body>
191  </html>
192 </xsl:template>
193
194 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
195
196 <xsl:template match="/gamebook/section[@id='title']">
197  <div class="frontmatter"><xsl:value-of select="$newline" />
198
199   <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
200   <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
201
202   <hr />
203
204   <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
205
206   <p>
207    <xsl:choose>
208     <xsl:when test="$language='es'">
209      <xsl:text>Fecha de Publicaci&oacute;n: </xsl:text>
210     </xsl:when>
211     <xsl:otherwise>
212      <xsl:text>Publication Date: </xsl:text>
213     </xsl:otherwise>
214    </xsl:choose>
215    <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
216    <xsl:text> </xsl:text>
217    <xsl:choose>
218     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
219      <xsl:choose>
220       <xsl:when test="$language='es'"><xsl:text>de enero de</xsl:text></xsl:when>
221       <xsl:otherwise><xsl:text>January</xsl:text></xsl:otherwise>
222      </xsl:choose>
223     </xsl:when>
224     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
225      <xsl:choose>
226       <xsl:when test="$language='es'"><xsl:text>de febrero de</xsl:text></xsl:when>
227       <xsl:otherwise><xsl:text>February</xsl:text></xsl:otherwise>
228      </xsl:choose>
229     </xsl:when>
230     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
231      <xsl:choose>
232       <xsl:when test="$language='es'"><xsl:text>de marzo de</xsl:text></xsl:when>
233       <xsl:otherwise><xsl:text>March</xsl:text></xsl:otherwise>
234      </xsl:choose>
235     </xsl:when>
236     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
237      <xsl:choose>
238       <xsl:when test="$language='es'"><xsl:text>de abril de</xsl:text></xsl:when>
239       <xsl:otherwise><xsl:text>April</xsl:text></xsl:otherwise>
240      </xsl:choose>
241     </xsl:when>
242     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
243      <xsl:choose>
244       <xsl:when test="$language='es'"><xsl:text>de mayo de</xsl:text></xsl:when>
245       <xsl:otherwise><xsl:text>May</xsl:text></xsl:otherwise>
246      </xsl:choose>
247     </xsl:when>
248     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
249      <xsl:choose>
250       <xsl:when test="$language='es'"><xsl:text>de junio de</xsl:text></xsl:when>
251       <xsl:otherwise><xsl:text>June</xsl:text></xsl:otherwise>
252      </xsl:choose>
253     </xsl:when>
254     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
255      <xsl:choose>
256       <xsl:when test="$language='es'"><xsl:text>de julio de</xsl:text></xsl:when>
257       <xsl:otherwise><xsl:text>July</xsl:text></xsl:otherwise>
258      </xsl:choose>
259     </xsl:when>
260     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
261      <xsl:choose>
262       <xsl:when test="$language='es'"><xsl:text>de agosto de</xsl:text></xsl:when>
263       <xsl:otherwise><xsl:text>August</xsl:text></xsl:otherwise>
264      </xsl:choose>
265     </xsl:when>
266     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
267      <xsl:choose>
268       <xsl:when test="$language='es'"><xsl:text>de septiembre de</xsl:text></xsl:when>
269       <xsl:otherwise><xsl:text>September</xsl:text></xsl:otherwise>
270      </xsl:choose>
271     </xsl:when>
272     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
273      <xsl:choose>
274       <xsl:when test="$language='es'"><xsl:text>de octubre de</xsl:text></xsl:when>
275       <xsl:otherwise><xsl:text>October</xsl:text></xsl:otherwise>
276      </xsl:choose>
277     </xsl:when>
278     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
279      <xsl:choose>
280       <xsl:when test="$language='es'"><xsl:text>de noviembre de</xsl:text></xsl:when>
281       <xsl:otherwise><xsl:text>November</xsl:text></xsl:otherwise>
282      </xsl:choose>
283     </xsl:when>
284     <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
285      <xsl:choose>
286       <xsl:when test="$language='es'"><xsl:text>de diciembre de</xsl:text></xsl:when>
287       <xsl:otherwise><xsl:text>December</xsl:text></xsl:otherwise>
288      </xsl:choose>
289     </xsl:when>
290     <xsl:otherwise>
291      <xsl:text>Invalid Month</xsl:text>
292     </xsl:otherwise>
293    </xsl:choose>
294    <xsl:text> </xsl:text>
295    <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
296   </p>
297
298   <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
299
300   <xsl:value-of select="$newline" />
301
302   <xsl:value-of select="$newline" />
303  </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
304
305  <xsl:apply-templates />
306 </xsl:template>
307
308 <xsl:template match="/gamebook/section[@id='toc']">
309  <div class="frontmatter"><xsl:value-of select="$newline" />
310   <h2>
311    <xsl:choose>
312     <xsl:when test="$language='es'">
313      <xsl:text>&Iacute;ndice de Contenidos</xsl:text>
314     </xsl:when>
315     <xsl:otherwise>
316      <xsl:text>Table of Contents</xsl:text>
317     </xsl:otherwise>
318    </xsl:choose>
319   </h2><xsl:value-of select="$newline" />
320
321   <xsl:value-of select="$newline" />
322   <xsl:value-of select="$newline" />
323
324   <ul><xsl:value-of select="$newline" />
325    <xsl:variable name="title-page">
326     <xsl:choose>
327      <xsl:when test="$language='es'">
328       <xsl:text>P&aacute;gina Principal</xsl:text>
329      </xsl:when>
330      <xsl:otherwise>
331       <xsl:text>Title Page</xsl:text>
332      </xsl:otherwise>
333     </xsl:choose>
334    </xsl:variable>
335
336    <xsl:for-each select="/gamebook/section/data/section">
337     <li>
338      <a><xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@id" /></xsl:attribute>
339       <xsl:apply-templates select="meta/title[1]" />
340      </a>
341      <xsl:if test="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
342       <xsl:value-of select="$newline" />
343       <ul><xsl:value-of select="$newline" />
344        <xsl:for-each select="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
345         <li>
346          <a><xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@id" /></xsl:attribute>
347           <xsl:value-of select ="meta/title[1]" />
348          </a>
349         </li><xsl:value-of select="$newline" />
350        </xsl:for-each>
351       </ul><xsl:value-of select="$newline" />
352      </xsl:if>
353     </li><xsl:value-of select="$newline" />
354    </xsl:for-each>
355   </ul><xsl:value-of select="$newline" />
356
357  </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
358 </xsl:template>
359
360 <!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
361
362 <xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
363  <div class="frontmatter"><xsl:value-of select="$newline" />
364   <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h2>
365
366   <xsl:value-of select="$newline" />
367   <xsl:value-of select="$newline" />
368
369   <xsl:apply-templates />
370  </div>
371 </xsl:template>
372
373 <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
374
375 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
376  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
377
378  <xsl:value-of select="$newline" />
379  <xsl:value-of select="$newline" />
380
381  <xsl:apply-templates />
382 </xsl:template>
383
384 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
385  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
386
387  <xsl:value-of select="$newline" />
388  <xsl:value-of select="$newline" />
389
390  <xsl:apply-templates />
391 </xsl:template>
392
393 <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
394
395 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
396  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
397
398  <xsl:value-of select="$newline" />
399  <xsl:value-of select="$newline" />
400
401  <xsl:apply-templates />
402 </xsl:template>
403
404 <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
405
406 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
407  <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h5>
408
409  <xsl:value-of select="$newline" />
410  <xsl:value-of select="$newline" />
411
412  <xsl:apply-templates />
413 </xsl:template>
414
415 <!-- ::::::::::: second-level main matter sections :::::::::::::: -->
416
417 <xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
418  <div class="mainmatter"><xsl:value-of select="$newline" />
419   <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h2>
420
421   <xsl:value-of select="$newline" />
422   <xsl:value-of select="$newline" />
423
424   <xsl:apply-templates />
425  </div>
426 </xsl:template>
427
428 <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
429
430 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
431  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
432
433  <xsl:value-of select="$newline" />
434  <xsl:value-of select="$newline" />
435
436  <xsl:apply-templates />
437 </xsl:template>
438
439 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
440  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
441
442  <xsl:value-of select="$newline" />
443  <xsl:value-of select="$newline" />
444
445  <xsl:apply-templates />
446 </xsl:template>
447
448 <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
449
450 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
451  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
452
453  <xsl:value-of select="$newline" />
454  <xsl:value-of select="$newline" />
455
456  <xsl:apply-templates />
457 </xsl:template>
458
459 <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
460
461 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
462  <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h5>
463
464  <xsl:value-of select="$newline" />
465  <xsl:value-of select="$newline" />
466
467  <xsl:apply-templates />
468 </xsl:template>
469
470 <!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
471
472 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
473  <div class="numbered"><xsl:value-of select="$newline" />
474   <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h2><xsl:value-of select="$newline" />
475   <xsl:value-of select="$newline" />
476
477   <xsl:apply-templates/>
478
479  </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
480 </xsl:template>
481
482 <xsl:template match="/gamebook/section/data/section/data/section[@class='numbered']">
483  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3><xsl:value-of select="$newline" />
484  <xsl:value-of select="$newline" />
485
486  <xsl:apply-templates />
487
488  <xsl:value-of select="$newline" />
489 </xsl:template>
490
491 <!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
492
493 <xsl:template match="/gamebook/section/data/section[@class='backmatter']">
494  <div class="frontmatter"><xsl:value-of select="$newline" />
495   <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h2><xsl:value-of select="$newline" />
496
497   <xsl:value-of select="$newline" />
498   <xsl:value-of select="$newline" />
499
500   <xsl:apply-templates />
501
502   <xsl:value-of select="$newline" />
503
504  </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
505 </xsl:template>
506
507 <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
508
509 <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
510  <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h3>
511
512  <xsl:value-of select="$newline" />
513  <xsl:value-of select="$newline" />
514
515  <xsl:apply-templates />
516 </xsl:template>
517
518 <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
519
520 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
521  <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h4>
522
523  <xsl:value-of select="$newline" />
524  <xsl:value-of select="$newline" />
525
526  <xsl:apply-templates />
527 </xsl:template>
528
529 <!-- ::::::::::::::::::::: footnotes template ::::::::::::::::::::::::: -->
530
531 <xsl:template match="id( 'footnotz' )">
532  <div class="backmatter">
533   <xsl:value-of select="$newline" />
534   <!-- No particular reason to code title here -->
535   <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:apply-templates select="meta/title[1]" /></a></h2><xsl:value-of select="$newline" />
536   <xsl:value-of select="$newline" />
537   <xsl:value-of select="$newline" />
538    
539   <!-- Generate list of footnotes -->
540   <div class="footnote">
541    <xsl:for-each select="//footnotes/footnote">
542     <!-- will the list always contain the closest ancestor first? -->
543     <xsl:variable name="footnote-section"><xsl:value-of select="ancestor::section[position()=1]/@id" /></xsl:variable>
544     <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
545     <xsl:variable name="footnote-id"><xsl:value-of select="@id" /></xsl:variable>
546     <xsl:variable name="footnote-idref"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:variable>
547      
548     <xsl:for-each select="*[1]">
549      <p>
550       <xsl:text>[</xsl:text>
551       <a>
552        <xsl:attribute name="name"><xsl:value-of select="$footnote-id" /></xsl:attribute>
553        <xsl:attribute name="href"><xsl:value-of select="$footnote-idref" /></xsl:attribute>
554        <xsl:value-of select="$footnote-marker" />
555       </a>
556       <xsl:text>] </xsl:text>
557
558       <xsl:text> (</xsl:text>
559       <xsl:call-template name="section-title-link" />
560       <xsl:text>) </xsl:text>
561
562       <xsl:apply-templates select="child::* | child::text()" />
563      </p>
564     </xsl:for-each>
565      
566     <xsl:for-each select="*[position() != 1]">
567      <xsl:apply-templates select="." />
568     </xsl:for-each>
569      
570    </xsl:for-each>
571   </div>
572    
573   <!-- Backwards compatibility... needed? Probably not. -->
574   <xsl:apply-templates />
575    
576   <xsl:value-of select="$newline" />
577   
578  </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
579 </xsl:template>
580
581 <!-- ==================== block elements ======================== -->
582
583 <xsl:template match="p">
584  <p><xsl:apply-templates /></p>
585  <xsl:value-of select="$newline" />
586 </xsl:template>
587
588 <xsl:template match="p[@class='dedication']">
589  <p class="dedication"><xsl:apply-templates /></p>
590  <xsl:value-of select="$newline" />
591 </xsl:template>
592
593 <xsl:template match="dl[@class='paragraphed']/dd/node() | ol[@class='paragraphed']/li/node() | ul[@class='paragraphed']/li/node()">
594  <xsl:choose>
595   <xsl:when test="self::p">
596    <xsl:apply-templates /><br /><br /><xsl:value-of select="$newline" />
597   </xsl:when>
598   <xsl:when test="self::dl">
599    <dl><xsl:value-of select="$newline" />
600     <xsl:apply-templates />
601    </dl><br /><br /><xsl:value-of select="$newline" />
602   </xsl:when>
603   <xsl:when test="self::ol">
604    <ol><xsl:value-of select="$newline" />
605     <xsl:apply-templates />
606    </ol><br /><br /><xsl:value-of select="$newline" />
607   </xsl:when>
608   <xsl:when test="self::ul">
609    <ul>
610     <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
611     <xsl:value-of select="$newline" />
612     <xsl:apply-templates />
613    </ul><br /><br /><xsl:value-of select="$newline" />
614   </xsl:when>
615   <xsl:when test="self::blockquote">
616    <blockquote><xsl:value-of select="$newline" />
617     <xsl:apply-templates />
618    </blockquote><xsl:value-of select="$newline" />
619   </xsl:when>
620   <xsl:when test="self::illustration"></xsl:when>
621   <xsl:when test="self::illref"></xsl:when>
622   <xsl:otherwise>
623    <xsl:text>[error: paragraphed list template]</xsl:text>
624    <xsl:message><xsl:text>error: paragraphed list template</xsl:text></xsl:message>
625   </xsl:otherwise>
626  </xsl:choose>
627 </xsl:template>
628
629 <xsl:template match="ol">
630  <ol><xsl:value-of select="$newline" />
631   <xsl:apply-templates />
632  </ol><xsl:value-of select="$newline" />
633 </xsl:template>
634
635 <xsl:template match="ul">
636  <ul>
637   <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
638   <xsl:value-of select="$newline" />
639   <xsl:apply-templates />
640  </ul><xsl:value-of select="$newline" />
641 </xsl:template>
642
643 <xsl:template match="dl">
644  <dl><xsl:value-of select="$newline" />
645   <xsl:apply-templates />
646  </dl><xsl:value-of select="$newline" />
647 </xsl:template>
648
649 <xsl:template match="dt">
650  <dt><xsl:apply-templates /></dt>
651  <xsl:value-of select="$newline" />
652 </xsl:template>
653
654 <xsl:template match="dd">
655  <dd><xsl:apply-templates /></dd>
656  <xsl:value-of select="$newline" />
657 </xsl:template>
658
659 <xsl:template match="li">
660  <li><xsl:apply-templates /></li>
661  <xsl:value-of select="$newline" />
662 </xsl:template>
663
664 <xsl:template match="table">
665  <table border="1" cellspacing="0" cellpadding="2">
666   <xsl:apply-templates />
667  </table>
668  <xsl:value-of select="$newline" />
669 </xsl:template>
670
671 <xsl:template match="tr">
672  <tr>
673   <xsl:apply-templates />
674  </tr>
675 </xsl:template>
676
677 <xsl:template match="th">
678  <th>
679   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
680   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
681   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
682   <xsl:apply-templates />
683  </th>
684 </xsl:template>
685
686 <xsl:template match="td">
687  <td>
688   <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
689   <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
690   <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
691   <xsl:apply-templates />
692  </td>
693 </xsl:template>
694
695 <xsl:template match="combat">
696  <p class="combat">
697   <xsl:apply-templates select="enemy" />
698   <xsl:text>: </xsl:text>
699   <xsl:choose>
700    <xsl:when test="enemy-attribute[@class='combatskill']">
701     <small>
702      <xsl:choose>
703       <xsl:when test="$language='es'">
704        <xsl:text>DESTREZA&nbsp;EN&nbsp;EL&nbsp;COMBATE</xsl:text>
705       </xsl:when>
706       <xsl:otherwise>
707        <xsl:text>COMBAT&nbsp;SKILL</xsl:text>
708       </xsl:otherwise>
709      </xsl:choose>
710     </small>
711     <xsl:text>&nbsp;</xsl:text>
712     <xsl:value-of select="enemy-attribute[@class='combatskill']" />
713    </xsl:when>
714    <xsl:when test="enemy-attribute[@class='closecombatskill']">
715     <small>
716      <xsl:choose>
717       <xsl:when test="$language='es'">
718        <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL</xsl:text>
719       </xsl:when>
720       <xsl:otherwise>
721        <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL</xsl:text>
722       </xsl:otherwise>
723      </xsl:choose>
724     </small>
725     <xsl:text>&nbsp;</xsl:text>
726     <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
727    </xsl:when>
728   </xsl:choose>
729   <xsl:text> &nbsp;&nbsp;</xsl:text>
730   <small>
731     <xsl:choose>
732      <xsl:when test="$language='es'">
733       <xsl:text>RESISTENCIA</xsl:text>
734      </xsl:when>
735      <xsl:otherwise>
736       <xsl:text>ENDURANCE</xsl:text>
737     </xsl:otherwise>
738    </xsl:choose>
739   </small>
740   <xsl:choose>
741    <xsl:when test="enemy-attribute[@class='target']">
742     <xsl:choose>
743      <xsl:when test="$language='es'">
744       <xsl:text> (o </xsl:text><small>BLANCOS</small><xsl:text>)</xsl:text>
745      </xsl:when>
746      <xsl:otherwise>
747       <xsl:text> (</xsl:text><small>TARGET</small><xsl:text> points)</xsl:text>
748      </xsl:otherwise>
749     </xsl:choose>
750     <xsl:text>&nbsp;</xsl:text>
751     <xsl:value-of select="enemy-attribute[@class='target']" />
752    </xsl:when>
753    <xsl:when test="enemy-attribute[@class='resistance']">
754     <xsl:choose>
755      <xsl:when test="$language='es'"></xsl:when>
756      <xsl:otherwise>
757       <xsl:text> (</xsl:text><small>RESISTANCE</small><xsl:text> points)</xsl:text>
758      </xsl:otherwise>
759     </xsl:choose>
760     <xsl:text>&nbsp;</xsl:text>
761     <xsl:value-of select="enemy-attribute[@class='resistance']" />
762    </xsl:when>
763    <xsl:otherwise>
764     <xsl:text>&nbsp;</xsl:text>
765     <xsl:value-of select="enemy-attribute[@class='endurance']" />
766    </xsl:otherwise>
767   </xsl:choose>
768  </p>
769  <xsl:value-of select="$newline" />
770 </xsl:template>
771
772 <xsl:template match="choice">
773  <xsl:variable name="link">
774   <xsl:value-of select="@idref" />
775  </xsl:variable>
776
777  <p class="choice">
778   <xsl:for-each select="* | text()">
779    <xsl:choose>
780     <xsl:when test="self::link-text">
781      <a href="#{$link}">
782       <xsl:apply-templates />
783      </a>
784     </xsl:when>
785     <xsl:otherwise>
786      <xsl:apply-templates select="." />
787     </xsl:otherwise>
788    </xsl:choose>
789   </xsl:for-each>
790  </p>
791  <xsl:value-of select="$newline" />
792 </xsl:template>
793
794 <xsl:template match="signpost">
795  <div class="signpost">
796   <xsl:apply-templates />
797  </div>
798  <xsl:value-of select="$newline" />
799 </xsl:template>
800
801 <xsl:template match="blockquote">
802  <blockquote><xsl:value-of select="$newline" />
803   <xsl:apply-templates /><xsl:value-of select="$newline" />
804  </blockquote><xsl:value-of select="$newline" />
805 </xsl:template>
806
807 <xsl:template match="illref">
808  <!-- It is important that the class is not checked right in the template - that would make this template match with higher priority, which will turn a few things upside down --> 
809  <xsl:if test="@class='html'">
810   <xsl:for-each select="id( @idref )">
811    <!-- 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... -->
812    <!-- When backwards compatibility can be dropped, most of (all?) the <illustration> processing can happen here -->
813    <xsl:apply-templates select="." />
814   </xsl:for-each>
815  </xsl:if>
816 </xsl:template>
817
818 <xsl:template match="illustrations">
819  <ul class="unbulleted">
820   <xsl:for-each select="illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) )] | illgroup">
821    <xsl:choose>
822     <xsl:when test="self::illustration and @class='float'">
823      <!-- List item with illustration name as link -->
824      <li>
825       <a>
826        <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>
827        <xsl:choose>
828         <xsl:when test="$language='es'">
829          <xsl:text>Ilustraci&oacute;n </xsl:text>
830         </xsl:when>
831         <xsl:otherwise>
832          <xsl:text>Illustration </xsl:text>
833         </xsl:otherwise>
834        </xsl:choose>
835        <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
836       </a>
837       <!-- List the sections that the illustration appears in -->
838       <xsl:text> (</xsl:text>
839       <xsl:for-each select="//illref[@class='html' and @idref=current()/@id]">
840        <xsl:call-template name="section-title-link" />
841        <xsl:if test="position()!=last()">
842         <xsl:text>, </xsl:text>        
843        </xsl:if>
844       </xsl:for-each>
845       <xsl:text>)</xsl:text><xsl:value-of select="$newline" />
846      </li>
847      <!-- Call the backwards compatible template for generating the illustration page -->
848     </xsl:when>
849    </xsl:choose>
850   </xsl:for-each>
851  </ul><xsl:value-of select="$newline" />
852 </xsl:template>
853
854 <xsl:template match="illustration">
855  <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
856   <xsl:choose>
857    <xsl:when test="@class='float'">
858     <div class="illustration">
859      <xsl:text>[[Illustration </xsl:text>
860      <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
861      <xsl:text>]]</xsl:text>
862     </div><xsl:value-of select="$newline" />
863    </xsl:when>
864
865    <xsl:otherwise></xsl:otherwise>
866   </xsl:choose>
867  </xsl:if>
868 </xsl:template>
869
870 <xsl:template match="instance" />
871
872 <xsl:template match="footnotes" />
873
874 <xsl:template match="footnote" />
875
876 <xsl:template match="hr">
877  <hr />
878  <xsl:value-of select="$newline" />
879 </xsl:template>
880
881 <!-- ==================== inline elements ======================= -->
882
883 <xsl:template match="a">
884  <xsl:choose>
885   <xsl:when test="@href">
886    <a>
887     <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
888     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
889     <xsl:apply-templates />
890    </a>
891   </xsl:when>
892   <xsl:otherwise>
893    <a>
894     <xsl:if test="@idref">
895      <xsl:attribute name="href">
896       <xsl:text>#</xsl:text><xsl:value-of select="@idref" />
897      </xsl:attribute>
898     </xsl:if>
899     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
900     <xsl:apply-templates />
901    </a>
902   </xsl:otherwise>
903  </xsl:choose>
904 </xsl:template>
905
906 <!-- This template is obsolete, the "footref" element should be used instead -->
907 <xsl:template match="a[@class='footnote']">
908  <!-- <xsl:message><xsl:text>WARNING: Obsolete &lt;a idref='...' class='footnote' /&gt; usage</xsl:text></xsl:message> -->
909  <xsl:apply-templates />
910  <sup>
911   <a>
912    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
913    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
914    <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
915   </a>
916  </sup>
917 </xsl:template>
918
919 <!-- TODO: can this be made more uniform with illrefs? -->
920 <xsl:template match="a[@class='accent-illustration']"></xsl:template>
921
922 <xsl:template match="bookref">
923  <a>
924   <xsl:attribute name="href">
925    <xsl:variable name="my-section">
926     <xsl:choose>
927      <xsl:when test="@section">
928       <xsl:value-of select="@section" />
929      </xsl:when>
930      <xsl:otherwise>
931       <xsl:text>title</xsl:text>
932      </xsl:otherwise>
933     </xsl:choose>
934    </xsl:variable>
935    <xsl:variable name="my-series">
936     <!-- If series is specified, go one directory back and then to series. Otherwise, add nothing. -->
937     <xsl:choose>
938      <xsl:when test="@series">
939       <xsl:text>/../</xsl:text><xsl:value-of select="@series" />
940      </xsl:when>
941      <xsl:otherwise>
942       <xsl:text></xsl:text>
943      </xsl:otherwise>
944     </xsl:choose>
945    </xsl:variable>
946    <xsl:text>..</xsl:text><xsl:value-of select="$my-series" /><xsl:text>/</xsl:text><xsl:value-of select="@book" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-section" />
947   </xsl:attribute>
948   <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
949   <xsl:apply-templates />
950  </a>
951 </xsl:template>
952
953 <xsl:template match="footref">
954  <xsl:apply-templates />
955  <sup>
956   <a>
957    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
958    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
959    <xsl:number count="footref" from="/" level="any" format="1" />
960   </a>
961  </sup>
962 </xsl:template>
963
964 <xsl:template match="em">
965  <em><xsl:apply-templates /></em>
966 </xsl:template>
967
968 <xsl:template match="strong">
969  <strong><xsl:apply-templates /></strong>
970 </xsl:template>
971
972 <xsl:template match="thought">
973  <i><xsl:apply-templates /></i>
974 </xsl:template>
975
976 <xsl:template match="onomatopoeia">
977  <i><xsl:apply-templates /></i>
978 </xsl:template>
979
980 <xsl:template match="spell">
981  <i><xsl:apply-templates /></i>
982 </xsl:template>
983
984 <xsl:template match="item">
985  <xsl:apply-templates />
986 </xsl:template>
987
988 <xsl:template match="foreign">
989  <i><xsl:apply-templates /></i>
990 </xsl:template>
991
992 <xsl:template match="quote">
993  <xsl:text>&#8216;</xsl:text>
994   <xsl:apply-templates />
995  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&#8217;</xsl:text></xsl:if>
996 </xsl:template>
997
998 <xsl:template match="quote//quote">
999  <xsl:text>&#8220;</xsl:text>
1000   <xsl:apply-templates />
1001  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&#8221;</xsl:text></xsl:if>
1002 </xsl:template>
1003
1004 <xsl:template match="cite">
1005  <cite><xsl:apply-templates /></cite>
1006 </xsl:template>
1007
1008 <xsl:template match="code">
1009  <tt><xsl:apply-templates /></tt>
1010 </xsl:template>
1011
1012 <xsl:template match="br">
1013  <br />
1014 </xsl:template>
1015
1016 <xsl:template match="typ[@class='attribute']">
1017  <small><xsl:apply-templates /></small>
1018 </xsl:template>
1019
1020 <!-- ==================== character elements ==================== -->
1021 <!--
1022
1023 These templates define the mapping between the character elements used in
1024 the Project Aon instances of Gamebook XML and the ISO-8859-1
1025 characters.
1026
1027 Portions Copyright International Organization for Standardization 1986 
1028 Permission to copy in any form is granted for use with conforming SGML 
1029 systems and applications as defined in ISO 8879, provided this notice 
1030 is included in all copies.
1031
1032 -->
1033
1034 <xsl:template match="ch.apos"><xsl:text>&#39;</xsl:text></xsl:template><!-- apostrophe = single quotation mark -->
1035 <xsl:template match="ch.nbsp"><xsl:text>&#160;</xsl:text></xsl:template><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
1036 <xsl:template match="ch.iexcl"><xsl:text>&#161;</xsl:text></xsl:template><!-- inverted exclamation mark, U+00A1 ISOnum -->
1037 <xsl:template match="ch.cent"><xsl:text>&#162;</xsl:text></xsl:template><!-- cent sign, U+00A2 ISOnum -->
1038 <xsl:template match="ch.pound"><xsl:text>&#163;</xsl:text></xsl:template><!-- pound sign, U+00A3 ISOnum -->
1039 <xsl:template match="ch.curren"><xsl:text>&#164;</xsl:text></xsl:template><!-- currency sign, U+00A4 ISOnum -->
1040 <xsl:template match="ch.yen"><xsl:text>&#165;</xsl:text></xsl:template><!-- yen sign = yuan sign, U+00A5 ISOnum -->
1041 <xsl:template match="ch.brvbar"><xsl:text>&#166;</xsl:text></xsl:template><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
1042 <xsl:template match="ch.sect"><xsl:text>&#167;</xsl:text></xsl:template><!-- section sign, U+00A7 ISOnum -->
1043 <xsl:template match="ch.uml"><xsl:text>&#168;</xsl:text></xsl:template><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
1044 <xsl:template match="ch.copy"><xsl:text>&#169;</xsl:text></xsl:template><!-- copyright sign, U+00A9 ISOnum -->
1045 <xsl:template match="ch.ordf"><xsl:text>&#170;</xsl:text></xsl:template><!-- feminine ordinal indicator, U+00AA ISOnum -->
1046 <xsl:template match="ch.laquo"><xsl:text>&#171;</xsl:text></xsl:template><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
1047 <xsl:template match="ch.not"><xsl:text>&#172;</xsl:text></xsl:template><!-- not sign, U+00AC ISOnum -->
1048 <xsl:template match="ch.shy"><xsl:text>&#173;</xsl:text></xsl:template><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
1049 <xsl:template match="ch.reg"><xsl:text>&#174;</xsl:text></xsl:template><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
1050 <xsl:template match="ch.macr"><xsl:text>&#175;</xsl:text></xsl:template><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
1051 <xsl:template match="ch.deg"><xsl:text>&#176;</xsl:text></xsl:template><!-- degree sign, U+00B0 ISOnum -->
1052 <xsl:template match="ch.plusmn"><xsl:text>&#177;</xsl:text></xsl:template><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
1053 <xsl:template match="ch.sup2"><xsl:text>&#178;</xsl:text></xsl:template><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
1054 <xsl:template match="ch.sup3"><xsl:text>&#179;</xsl:text></xsl:template><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
1055 <xsl:template match="ch.acute"><xsl:text>&#180;</xsl:text></xsl:template><!-- acute accent = spacing acute, U+00B4 ISOdia -->
1056 <xsl:template match="ch.micro"><xsl:text>&#181;</xsl:text></xsl:template><!-- micro sign, U+00B5 ISOnum -->
1057 <xsl:template match="ch.para"><xsl:text>&#182;</xsl:text></xsl:template><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
1058 <xsl:template match="ch.middot"><xsl:text>&#183;</xsl:text></xsl:template><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
1059 <xsl:template match="ch.cedil"><xsl:text>&#184;</xsl:text></xsl:template><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
1060 <xsl:template match="ch.sup1"><xsl:text>&#185;</xsl:text></xsl:template><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
1061 <xsl:template match="ch.ordm"><xsl:text>&#186;</xsl:text></xsl:template><!-- masculine ordinal indicator, U+00BA ISOnum -->
1062 <xsl:template match="ch.raquo"><xsl:text>&#187;</xsl:text></xsl:template><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
1063 <xsl:template match="ch.frac14"><xsl:text>&#188;</xsl:text></xsl:template><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
1064 <xsl:template match="ch.frac12"><xsl:text>&#189;</xsl:text></xsl:template><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
1065 <xsl:template match="ch.frac34"><xsl:text>&#190;</xsl:text></xsl:template><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
1066 <xsl:template match="ch.iquest"><xsl:text>&#191;</xsl:text></xsl:template><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
1067 <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 -->
1068 <xsl:template match="ch.Aacute"><xsl:text>&#193;</xsl:text></xsl:template><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
1069 <xsl:template match="ch.Acirc"><xsl:text>&#194;</xsl:text></xsl:template><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
1070 <xsl:template match="ch.Atilde"><xsl:text>&#195;</xsl:text></xsl:template><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
1071 <xsl:template match="ch.Auml"><xsl:text>&#196;</xsl:text></xsl:template><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
1072 <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 -->
1073 <xsl:template match="ch.AElig"><xsl:text>&#198;</xsl:text></xsl:template><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
1074 <xsl:template match="ch.Ccedil"><xsl:text>&#199;</xsl:text></xsl:template><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
1075 <xsl:template match="ch.Egrave"><xsl:text>&#200;</xsl:text></xsl:template><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
1076 <xsl:template match="ch.Eacute"><xsl:text>&#201;</xsl:text></xsl:template><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
1077 <xsl:template match="ch.Ecirc"><xsl:text>&#202;</xsl:text></xsl:template><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
1078 <xsl:template match="ch.Euml"><xsl:text>&#203;</xsl:text></xsl:template><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
1079 <xsl:template match="ch.Igrave"><xsl:text>&#204;</xsl:text></xsl:template><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
1080 <xsl:template match="ch.Iacute"><xsl:text>&#205;</xsl:text></xsl:template><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
1081 <xsl:template match="ch.Icirc"><xsl:text>&#206;</xsl:text></xsl:template><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
1082 <xsl:template match="ch.Iuml"><xsl:text>&#207;</xsl:text></xsl:template><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
1083 <xsl:template match="ch.ETH"><xsl:text>&#208;</xsl:text></xsl:template><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
1084 <xsl:template match="ch.Ntilde"><xsl:text>&#209;</xsl:text></xsl:template><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
1085 <xsl:template match="ch.Ograve"><xsl:text>&#210;</xsl:text></xsl:template><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
1086 <xsl:template match="ch.Oacute"><xsl:text>&#211;</xsl:text></xsl:template><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
1087 <xsl:template match="ch.Ocirc"><xsl:text>&#212;</xsl:text></xsl:template><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
1088 <xsl:template match="ch.Otilde"><xsl:text>&#213;</xsl:text></xsl:template><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
1089 <xsl:template match="ch.Ouml"><xsl:text>&#214;</xsl:text></xsl:template><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
1090 <xsl:template match="ch.times"><xsl:text>&#215;</xsl:text></xsl:template><!-- multiplication sign, U+00D7 ISOnum -->
1091 <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 -->
1092 <xsl:template match="ch.Ugrave"><xsl:text>&#217;</xsl:text></xsl:template><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
1093 <xsl:template match="ch.Uacute"><xsl:text>&#218;</xsl:text></xsl:template><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
1094 <xsl:template match="ch.Ucirc"><xsl:text>&#219;</xsl:text></xsl:template><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
1095 <xsl:template match="ch.Uuml"><xsl:text>&#220;</xsl:text></xsl:template><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
1096 <xsl:template match="ch.Yacute"><xsl:text>&#221;</xsl:text></xsl:template><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
1097 <xsl:template match="ch.THORN"><xsl:text>&#222;</xsl:text></xsl:template><!-- latin capital letter THORN, U+00DE ISOlat1 -->
1098 <xsl:template match="ch.szlig"><xsl:text>&#223;</xsl:text></xsl:template><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
1099 <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 -->
1100 <xsl:template match="ch.aacute"><xsl:text>&#225;</xsl:text></xsl:template><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
1101 <xsl:template match="ch.acirc"><xsl:text>&#226;</xsl:text></xsl:template><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
1102 <xsl:template match="ch.atilde"><xsl:text>&#227;</xsl:text></xsl:template><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
1103 <xsl:template match="ch.auml"><xsl:text>&#228;</xsl:text></xsl:template><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
1104 <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 -->
1105 <xsl:template match="ch.aelig"><xsl:text>&#230;</xsl:text></xsl:template><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
1106 <xsl:template match="ch.ccedil"><xsl:text>&#231;</xsl:text></xsl:template><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
1107 <xsl:template match="ch.egrave"><xsl:text>&#232;</xsl:text></xsl:template><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
1108 <xsl:template match="ch.eacute"><xsl:text>&#233;</xsl:text></xsl:template><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
1109 <xsl:template match="ch.ecirc"><xsl:text>&#234;</xsl:text></xsl:template><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
1110 <xsl:template match="ch.euml"><xsl:text>&#235;</xsl:text></xsl:template><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
1111 <xsl:template match="ch.igrave"><xsl:text>&#236;</xsl:text></xsl:template><!-- latin small letter i with grave, U+00EC ISOlat1 -->
1112 <xsl:template match="ch.iacute"><xsl:text>&#237;</xsl:text></xsl:template><!-- latin small letter i with acute, U+00ED ISOlat1 -->
1113 <xsl:template match="ch.icirc"><xsl:text>&#238;</xsl:text></xsl:template><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
1114 <xsl:template match="ch.iuml"><xsl:text>&#239;</xsl:text></xsl:template><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
1115 <xsl:template match="ch.eth"><xsl:text>&#240;</xsl:text></xsl:template><!-- latin small letter eth, U+00F0 ISOlat1 -->
1116 <xsl:template match="ch.ntilde"><xsl:text>&#241;</xsl:text></xsl:template><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
1117 <xsl:template match="ch.ograve"><xsl:text>&#242;</xsl:text></xsl:template><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
1118 <xsl:template match="ch.oacute"><xsl:text>&#243;</xsl:text></xsl:template><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
1119 <xsl:template match="ch.ocirc"><xsl:text>&#244;</xsl:text></xsl:template><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
1120 <xsl:template match="ch.otilde"><xsl:text>&#245;</xsl:text></xsl:template><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
1121 <xsl:template match="ch.ouml"><xsl:text>&#246;</xsl:text></xsl:template><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
1122 <xsl:template match="ch.divide"><xsl:text>&#247;</xsl:text></xsl:template><!-- division sign, U+00F7 ISOnum -->
1123 <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 -->
1124 <xsl:template match="ch.ugrave"><xsl:text>&#249;</xsl:text></xsl:template><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
1125 <xsl:template match="ch.uacute"><xsl:text>&#250;</xsl:text></xsl:template><!-- latin small letter u with acute, U+00FA ISOlat1 -->
1126 <xsl:template match="ch.ucirc"><xsl:text>&#251;</xsl:text></xsl:template><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
1127 <xsl:template match="ch.uuml"><xsl:text>&#252;</xsl:text></xsl:template><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
1128 <xsl:template match="ch.yacute"><xsl:text>&#253;</xsl:text></xsl:template><!-- latin small letter y with acute, U+00FD ISOlat1 -->
1129 <xsl:template match="ch.thorn"><xsl:text>&#254;</xsl:text></xsl:template><!-- latin small letter thorn, U+00FE ISOlat1 -->
1130 <xsl:template match="ch.yuml"><xsl:text>&#255;</xsl:text></xsl:template><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
1131
1132 <!-- ~~~~~~~~~~~~~~~~~~~~~ Special Characters ~~~~~~~~~~~~~~~~~~~~ -->
1133
1134 <xsl:template match="ch.ampersand">&amp;</xsl:template><!-- ampersand -->
1135 <xsl:template match="ch.lsquot">&#8216;</xsl:template><!-- opening left quotation mark -->
1136 <xsl:template match="ch.rsquot">&#8217;</xsl:template><!-- closing right quotation mark -->
1137 <xsl:template match="ch.ldquot">&#8220;</xsl:template><!-- opening left double quotation mark -->
1138 <xsl:template match="ch.rdquot">&#8221;</xsl:template><!-- closing right double quotation mark -->
1139 <xsl:template match="ch.minus">&#8722;</xsl:template><!-- mathematical minus -->
1140 <xsl:template match="ch.endash">&#8211;</xsl:template><!-- endash -->
1141 <xsl:template match="ch.emdash">&#8212;</xsl:template><!-- emdash -->
1142 <xsl:template match="ch.ellips">&nbsp;&#8230;</xsl:template><!-- ellipsis -->
1143 <xsl:template match="ch.lellips">&#8230;&nbsp;</xsl:template><!-- left ellipsis, used at the beginning of edited material -->
1144 <xsl:template match="ch.blankline">_______</xsl:template><!-- blank line to be filled in -->
1145 <xsl:template match="ch.percent"><xsl:text>&#37;</xsl:text></xsl:template><!-- percent sign -->
1146 <xsl:template match="ch.thinspace"><xsl:text>&#8201;</xsl:text></xsl:template><!-- small horizontal space for use between adjacent quotation marks - added mainly for LaTeX's sake -->
1147 <xsl:template match="ch.frac116"><xsl:text>1/16</xsl:text></xsl:template><!-- vulgar fraction one sixteenth = fraction on sixteenth -->
1148 <xsl:template match="ch.plus"><xsl:text>+</xsl:text></xsl:template><!-- mathematical plus -->
1149
1150 <!-- ==================== named templates ======================= -->
1151
1152 <!--
1153  A "subroutine" to generate a link to the current section, with the section title (expanded with "Section " in case of a numbered section) as link text.
1154 -->
1155 <xsl:template name="section-title-link">
1156  <!-- will the list always contain the closest ancestor first? -->
1157  <xsl:variable name="section-title">
1158   <!-- numbered or not? -->
1159   <xsl:if test="ancestor::section[position()=1]/@class='numbered'">
1160    <xsl:choose>
1161     <xsl:when test="$language='es'">
1162      <xsl:text>Secci&oacute;n </xsl:text>
1163     </xsl:when>
1164     <xsl:otherwise>
1165      <xsl:text>Section </xsl:text>
1166     </xsl:otherwise>
1167    </xsl:choose>
1168   </xsl:if>
1169   <xsl:apply-templates select="ancestor::section[position()=1]/meta/title[1]" />
1170  </xsl:variable>
1171  
1172  <a>
1173   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="ancestor::section[position()=1]/@id" /></xsl:attribute>
1174   <xsl:value-of select="$section-title" />
1175  </a>
1176 </xsl:template>
1177
1178 </xsl:transform>