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