reorganizing the repository
[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" />
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="data/signpost">
753  <div class="signpost">
754   <xsl:apply-templates />
755  </div>
756  <xsl:value-of select="$newline" />
757 </xsl:template>
758
759 <xsl:template match="signpost">
760  <span class="signpost"><xsl:apply-templates /></span>
761 </xsl:template>
762
763 <xsl:template match="blockquote">
764  <blockquote><xsl:value-of select="$newline" />
765   <xsl:apply-templates /><xsl:value-of select="$newline" />
766  </blockquote><xsl:value-of select="$newline" />
767 </xsl:template>
768
769 <xsl:template match="poetry">
770  <blockquote class="poetry"><p><xsl:value-of select="$newline" />
771   <xsl:apply-templates /><xsl:value-of select="$newline" />
772  </p></blockquote><xsl:value-of select="$newline" />
773 </xsl:template>
774
775 <xsl:template match="illref">
776  <!-- 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 --> 
777  <xsl:if test="@class='html'">
778   <xsl:for-each select="id( @idref )">
779    <!-- 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... -->
780    <!-- When backwards compatibility can be dropped, most of (all?) the <illustration> processing can happen here -->
781    <xsl:apply-templates select="." />
782   </xsl:for-each>
783  </xsl:if>
784 </xsl:template>
785
786 <xsl:template match="illustrations">
787  <ul class="unbulleted">
788   <xsl:for-each select="illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) )] | illgroup">
789    <xsl:choose>
790     <xsl:when test="self::illustration and @class='float'">
791      <!-- List item with illustration name as link -->
792      <li>
793       <xsl:choose>
794        <xsl:when test="$language='es'">
795         <xsl:text>Ilustraci&oacute;n </xsl:text>
796        </xsl:when>
797        <xsl:otherwise>
798         <xsl:text>Illustration </xsl:text>
799        </xsl:otherwise>
800       </xsl:choose>
801       <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
802       <!-- List the sections that the illustration appears in -->
803       <xsl:text> (</xsl:text>
804       <xsl:for-each select="//illref[@class='html' and @idref=current()/@id]">
805        <xsl:call-template name="section-title-link" />
806        <xsl:if test="position()!=last()">
807         <xsl:text>, </xsl:text>        
808        </xsl:if>
809       </xsl:for-each>
810       <xsl:text>)</xsl:text><xsl:value-of select="$newline" />
811      </li>
812     </xsl:when>
813
814     <xsl:when test="self::illustration"> <!-- inline and map -->
815      <!-- List the sections that the illustration appears in -->     
816      <li>
817       <!-- TODO: fix this so that sections that do not represent separate XHTML files are not linked to? -->
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      </li>
825     </xsl:when>
826
827     <xsl:when test="self::illgroup and @class!='hidden'">
828      <!-- Check if the group contains any illustrations being used, before creating the list item -->
829       <xsl:if test="count( illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) )] ) != 0">
830        <li>
831         <a>
832          <xsl:attribute name="href"><xsl:value-of select="@idref" /><xsl:text>.htm</xsl:text></xsl:attribute>
833          <xsl:value-of select="id(@idref)/meta/title[1]" />
834         </a>
835        </li>
836       </xsl:if>
837     </xsl:when>
838    </xsl:choose>
839   </xsl:for-each>
840  </ul><xsl:value-of select="$newline" />
841 </xsl:template>
842
843 <xsl:template match="illustration">
844  <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
845   <xsl:choose>
846    <xsl:when test="@class='accent'" />
847
848    <xsl:otherwise>
849     <xsl:call-template name="illustration-no-frame" />
850    </xsl:otherwise>
851   </xsl:choose>
852  </xsl:if>
853 </xsl:template>
854
855 <xsl:template match="instance" />
856
857 <xsl:template match="footnotes" />
858
859 <xsl:template match="footnote" />
860
861 <xsl:template match="hr">
862  <hr />
863  <xsl:value-of select="$newline" />
864 </xsl:template>
865
866 <xsl:template match="choose">
867  <xsl:choose>
868   <xsl:when test="@test='has-numbered-section-list'">
869    <xsl:choose>
870     <xsl:when test="when[@value='false']">
871      <xsl:apply-templates select="when[@value='false'][1]/node()" />
872     </xsl:when>
873     <xsl:when test="otherwise">
874      <!-- this should only be applied when there is no option for "false" -->
875      <xsl:apply-templates select="otherwise/node()" />
876     </xsl:when>
877    </xsl:choose>
878   </xsl:when>
879   <xsl:otherwise>
880    <xsl:message>
881     <xsl:text>choose: unrecognized test "</xsl:text>
882     <xsl:value-of select="@test" />
883     <xsl:text>" - element ignored.</xsl:text>
884    </xsl:message>
885   </xsl:otherwise>
886  </xsl:choose>
887 </xsl:template>
888
889 <!-- ==================== inline elements ======================= -->
890
891 <xsl:template match="a">
892  <xsl:choose>
893   <xsl:when test="@href">
894    <a>
895     <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
896     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
897     <xsl:apply-templates />
898    </a>
899   </xsl:when>
900   <xsl:otherwise>
901    <a>
902     <xsl:if test="@idref">
903      <xsl:attribute name="href">
904       <xsl:text>#</xsl:text><xsl:value-of select="@idref" />
905      </xsl:attribute>
906     </xsl:if>
907     <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
908     <xsl:apply-templates />
909    </a>
910   </xsl:otherwise>
911  </xsl:choose>
912 </xsl:template>
913
914 <!-- This template is obsolete, the "footref" element should be used instead -->
915 <xsl:template match="a[@class='footnote']">
916  <!-- <xsl:message><xsl:text>WARNING: Obsolete &lt;a idref='...' class='footnote' /&gt; usage</xsl:text></xsl:message> -->
917  <xsl:apply-templates />
918  <sup>
919   <a>
920    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
921    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
922    <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
923   </a>
924  </sup>
925 </xsl:template>
926
927 <!-- TODO: can this be made more uniform with illrefs? -->
928 <xsl:template match="a[@class='accent-illustration']">
929  <xsl:for-each select="id( @idref )">
930   <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
931   <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
932   <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
933   <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
934    <img src="{$illustration-src}" class="accent" width="{$illustration-width}" height="{$illustration-height}" alt="" border="" align="left" />
935   </xsl:if>
936  </xsl:for-each>
937 </xsl:template>
938
939 <xsl:template match="bookref">
940  <a>
941   <xsl:attribute name="href">
942    <xsl:variable name="my-section">
943     <xsl:choose>
944      <xsl:when test="@section">
945       <xsl:value-of select="@section" />
946      </xsl:when>
947      <xsl:otherwise>
948       <xsl:text>title</xsl:text>
949      </xsl:otherwise>
950     </xsl:choose>
951    </xsl:variable>
952    <xsl:variable name="my-series">
953     <!-- If series is specified, go one directory back and then to series. Otherwise, add nothing. -->
954     <xsl:choose>
955      <xsl:when test="@series">
956       <xsl:text>/../</xsl:text><xsl:value-of select="@series" />
957      </xsl:when>
958      <xsl:otherwise>
959       <xsl:text></xsl:text>
960      </xsl:otherwise>
961     </xsl:choose>
962    </xsl:variable>
963    <xsl:text>..</xsl:text>
964    <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" />
965   </xsl:attribute>
966   <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
967   <xsl:apply-templates />
968  </a>
969 </xsl:template>
970
971 <xsl:template match="footref">
972  <xsl:apply-templates />
973  <sup>
974   <a>
975    <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
976    <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
977    <xsl:number count="footref" from="/" level="any" format="1" />
978   </a>
979  </sup>
980 </xsl:template>
981
982 <xsl:template match="em">
983  <em><xsl:apply-templates /></em>
984 </xsl:template>
985
986 <xsl:template match="strong">
987  <strong><xsl:apply-templates /></strong>
988 </xsl:template>
989
990 <xsl:template match="thought">
991  <i><xsl:apply-templates /></i>
992 </xsl:template>
993
994 <xsl:template match="onomatopoeia">
995  <i><xsl:apply-templates /></i>
996 </xsl:template>
997
998 <xsl:template match="spell">
999  <i><xsl:apply-templates /></i>
1000 </xsl:template>
1001
1002 <xsl:template match="item">
1003  <strong><xsl:apply-templates /></strong>
1004 </xsl:template>
1005
1006 <xsl:template match="foreign">
1007  <i>
1008   <xsl:attribute name="xml:lang">
1009    <xsl:value-of select="@xml:lang"/>
1010   </xsl:attribute>
1011   <xsl:apply-templates />
1012  </i>
1013 </xsl:template>
1014
1015 <xsl:template match="quote">
1016  <xsl:text>&#8216;</xsl:text>
1017   <xsl:apply-templates />
1018  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&#8217;</xsl:text></xsl:if>
1019 </xsl:template>
1020
1021 <xsl:template match="quote//quote">
1022  <xsl:text>&#8220;</xsl:text>
1023   <xsl:apply-templates />
1024  <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&#8221;</xsl:text></xsl:if>
1025 </xsl:template>
1026
1027 <xsl:template match="cite">
1028  <cite><xsl:apply-templates /></cite>
1029 </xsl:template>
1030
1031 <xsl:template match="code">
1032  <tt><xsl:apply-templates /></tt>
1033 </xsl:template>
1034
1035 <xsl:template match="line">
1036  <xsl:apply-templates />
1037  <xsl:if test="position( ) != last( )"><br /></xsl:if>
1038 </xsl:template>
1039
1040 <xsl:template match="br">
1041  <br />
1042 </xsl:template>
1043
1044 <xsl:template match="typ[@class='attribute']">
1045  <small><xsl:apply-templates /></small>
1046 </xsl:template>
1047
1048 <!-- ==================== character elements ==================== -->
1049 <!--
1050
1051 These templates define the mapping between the character elements used in
1052 the Project Aon instances of Gamebook XML and the ISO-8859-1
1053 characters.
1054
1055 Portions Copyright International Organization for Standardization 1986 
1056 Permission to copy in any form is granted for use with conforming SGML 
1057 systems and applications as defined in ISO 8879, provided this notice 
1058 is included in all copies.
1059
1060 -->
1061
1062 <xsl:template match="ch.apos"><xsl:text>&#8217;</xsl:text></xsl:template><!-- apostrophe = single quotation mark -->
1063 <xsl:template match="ch.nbsp"><xsl:text>&#160;</xsl:text></xsl:template><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
1064 <xsl:template match="ch.iexcl"><xsl:text>&#161;</xsl:text></xsl:template><!-- inverted exclamation mark, U+00A1 ISOnum -->
1065 <xsl:template match="ch.cent"><xsl:text>&#162;</xsl:text></xsl:template><!-- cent sign, U+00A2 ISOnum -->
1066 <xsl:template match="ch.pound"><xsl:text>&#163;</xsl:text></xsl:template><!-- pound sign, U+00A3 ISOnum -->
1067 <xsl:template match="ch.curren"><xsl:text>&#164;</xsl:text></xsl:template><!-- currency sign, U+00A4 ISOnum -->
1068 <xsl:template match="ch.yen"><xsl:text>&#165;</xsl:text></xsl:template><!-- yen sign = yuan sign, U+00A5 ISOnum -->
1069 <xsl:template match="ch.brvbar"><xsl:text>&#166;</xsl:text></xsl:template><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
1070 <xsl:template match="ch.sect"><xsl:text>&#167;</xsl:text></xsl:template><!-- section sign, U+00A7 ISOnum -->
1071 <xsl:template match="ch.uml"><xsl:text>&#168;</xsl:text></xsl:template><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
1072 <xsl:template match="ch.copy"><xsl:text>&#169;</xsl:text></xsl:template><!-- copyright sign, U+00A9 ISOnum -->
1073 <xsl:template match="ch.ordf"><xsl:text>&#170;</xsl:text></xsl:template><!-- feminine ordinal indicator, U+00AA ISOnum -->
1074 <xsl:template match="ch.laquo"><xsl:text>&#171;</xsl:text></xsl:template><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
1075 <xsl:template match="ch.not"><xsl:text>&#172;</xsl:text></xsl:template><!-- not sign, U+00AC ISOnum -->
1076 <xsl:template match="ch.shy"><xsl:text>&#173;</xsl:text></xsl:template><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
1077 <xsl:template match="ch.reg"><xsl:text>&#174;</xsl:text></xsl:template><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
1078 <xsl:template match="ch.macr"><xsl:text>&#175;</xsl:text></xsl:template><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
1079 <xsl:template match="ch.deg"><xsl:text>&#176;</xsl:text></xsl:template><!-- degree sign, U+00B0 ISOnum -->
1080 <xsl:template match="ch.plusmn"><xsl:text>&#177;</xsl:text></xsl:template><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
1081 <xsl:template match="ch.sup2"><xsl:text>&#178;</xsl:text></xsl:template><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
1082 <xsl:template match="ch.sup3"><xsl:text>&#179;</xsl:text></xsl:template><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
1083 <xsl:template match="ch.acute"><xsl:text>&#180;</xsl:text></xsl:template><!-- acute accent = spacing acute, U+00B4 ISOdia -->
1084 <xsl:template match="ch.micro"><xsl:text>&#181;</xsl:text></xsl:template><!-- micro sign, U+00B5 ISOnum -->
1085 <xsl:template match="ch.para"><xsl:text>&#182;</xsl:text></xsl:template><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
1086 <xsl:template match="ch.middot"><xsl:text>&#183;</xsl:text></xsl:template><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
1087 <xsl:template match="ch.cedil"><xsl:text>&#184;</xsl:text></xsl:template><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
1088 <xsl:template match="ch.sup1"><xsl:text>&#185;</xsl:text></xsl:template><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
1089 <xsl:template match="ch.ordm"><xsl:text>&#186;</xsl:text></xsl:template><!-- masculine ordinal indicator, U+00BA ISOnum -->
1090 <xsl:template match="ch.raquo"><xsl:text>&#187;</xsl:text></xsl:template><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
1091 <xsl:template match="ch.frac14"><xsl:text>&#188;</xsl:text></xsl:template><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
1092 <xsl:template match="ch.frac12"><xsl:text>&#189;</xsl:text></xsl:template><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
1093 <xsl:template match="ch.frac34"><xsl:text>&#190;</xsl:text></xsl:template><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
1094 <xsl:template match="ch.iquest"><xsl:text>&#191;</xsl:text></xsl:template><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
1095 <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 -->
1096 <xsl:template match="ch.Aacute"><xsl:text>&#193;</xsl:text></xsl:template><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
1097 <xsl:template match="ch.Acirc"><xsl:text>&#194;</xsl:text></xsl:template><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
1098 <xsl:template match="ch.Atilde"><xsl:text>&#195;</xsl:text></xsl:template><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
1099 <xsl:template match="ch.Auml"><xsl:text>&#196;</xsl:text></xsl:template><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
1100 <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 -->
1101 <xsl:template match="ch.AElig"><xsl:text>&#198;</xsl:text></xsl:template><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
1102 <xsl:template match="ch.Ccedil"><xsl:text>&#199;</xsl:text></xsl:template><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
1103 <xsl:template match="ch.Egrave"><xsl:text>&#200;</xsl:text></xsl:template><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
1104 <xsl:template match="ch.Eacute"><xsl:text>&#201;</xsl:text></xsl:template><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
1105 <xsl:template match="ch.Ecirc"><xsl:text>&#202;</xsl:text></xsl:template><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
1106 <xsl:template match="ch.Euml"><xsl:text>&#203;</xsl:text></xsl:template><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
1107 <xsl:template match="ch.Igrave"><xsl:text>&#204;</xsl:text></xsl:template><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
1108 <xsl:template match="ch.Iacute"><xsl:text>&#205;</xsl:text></xsl:template><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
1109 <xsl:template match="ch.Icirc"><xsl:text>&#206;</xsl:text></xsl:template><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
1110 <xsl:template match="ch.Iuml"><xsl:text>&#207;</xsl:text></xsl:template><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
1111 <xsl:template match="ch.ETH"><xsl:text>&#208;</xsl:text></xsl:template><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
1112 <xsl:template match="ch.Ntilde"><xsl:text>&#209;</xsl:text></xsl:template><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
1113 <xsl:template match="ch.Ograve"><xsl:text>&#210;</xsl:text></xsl:template><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
1114 <xsl:template match="ch.Oacute"><xsl:text>&#211;</xsl:text></xsl:template><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
1115 <xsl:template match="ch.Ocirc"><xsl:text>&#212;</xsl:text></xsl:template><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
1116 <xsl:template match="ch.Otilde"><xsl:text>&#213;</xsl:text></xsl:template><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
1117 <xsl:template match="ch.Ouml"><xsl:text>&#214;</xsl:text></xsl:template><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
1118 <xsl:template match="ch.times"><xsl:text>&#215;</xsl:text></xsl:template><!-- multiplication sign, U+00D7 ISOnum -->
1119 <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 -->
1120 <xsl:template match="ch.Ugrave"><xsl:text>&#217;</xsl:text></xsl:template><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
1121 <xsl:template match="ch.Uacute"><xsl:text>&#218;</xsl:text></xsl:template><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
1122 <xsl:template match="ch.Ucirc"><xsl:text>&#219;</xsl:text></xsl:template><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
1123 <xsl:template match="ch.Uuml"><xsl:text>&#220;</xsl:text></xsl:template><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
1124 <xsl:template match="ch.Yacute"><xsl:text>&#221;</xsl:text></xsl:template><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
1125 <xsl:template match="ch.THORN"><xsl:text>&#222;</xsl:text></xsl:template><!-- latin capital letter THORN, U+00DE ISOlat1 -->
1126 <xsl:template match="ch.szlig"><xsl:text>&#223;</xsl:text></xsl:template><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
1127 <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 -->
1128 <xsl:template match="ch.aacute"><xsl:text>&#225;</xsl:text></xsl:template><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
1129 <xsl:template match="ch.acirc"><xsl:text>&#226;</xsl:text></xsl:template><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
1130 <xsl:template match="ch.atilde"><xsl:text>&#227;</xsl:text></xsl:template><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
1131 <xsl:template match="ch.auml"><xsl:text>&#228;</xsl:text></xsl:template><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
1132 <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 -->
1133 <xsl:template match="ch.aelig"><xsl:text>&#230;</xsl:text></xsl:template><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
1134 <xsl:template match="ch.ccedil"><xsl:text>&#231;</xsl:text></xsl:template><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
1135 <xsl:template match="ch.egrave"><xsl:text>&#232;</xsl:text></xsl:template><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
1136 <xsl:template match="ch.eacute"><xsl:text>&#233;</xsl:text></xsl:template><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
1137 <xsl:template match="ch.ecirc"><xsl:text>&#234;</xsl:text></xsl:template><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
1138 <xsl:template match="ch.euml"><xsl:text>&#235;</xsl:text></xsl:template><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
1139 <xsl:template match="ch.igrave"><xsl:text>&#236;</xsl:text></xsl:template><!-- latin small letter i with grave, U+00EC ISOlat1 -->
1140 <xsl:template match="ch.iacute"><xsl:text>&#237;</xsl:text></xsl:template><!-- latin small letter i with acute, U+00ED ISOlat1 -->
1141 <xsl:template match="ch.icirc"><xsl:text>&#238;</xsl:text></xsl:template><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
1142 <xsl:template match="ch.iuml"><xsl:text>&#239;</xsl:text></xsl:template><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
1143 <xsl:template match="ch.eth"><xsl:text>&#240;</xsl:text></xsl:template><!-- latin small letter eth, U+00F0 ISOlat1 -->
1144 <xsl:template match="ch.ntilde"><xsl:text>&#241;</xsl:text></xsl:template><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
1145 <xsl:template match="ch.ograve"><xsl:text>&#242;</xsl:text></xsl:template><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
1146 <xsl:template match="ch.oacute"><xsl:text>&#243;</xsl:text></xsl:template><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
1147 <xsl:template match="ch.ocirc"><xsl:text>&#244;</xsl:text></xsl:template><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
1148 <xsl:template match="ch.otilde"><xsl:text>&#245;</xsl:text></xsl:template><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
1149 <xsl:template match="ch.ouml"><xsl:text>&#246;</xsl:text></xsl:template><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
1150 <xsl:template match="ch.divide"><xsl:text>&#247;</xsl:text></xsl:template><!-- division sign, U+00F7 ISOnum -->
1151 <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 -->
1152 <xsl:template match="ch.ugrave"><xsl:text>&#249;</xsl:text></xsl:template><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
1153 <xsl:template match="ch.uacute"><xsl:text>&#250;</xsl:text></xsl:template><!-- latin small letter u with acute, U+00FA ISOlat1 -->
1154 <xsl:template match="ch.ucirc"><xsl:text>&#251;</xsl:text></xsl:template><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
1155 <xsl:template match="ch.uuml"><xsl:text>&#252;</xsl:text></xsl:template><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
1156 <xsl:template match="ch.yacute"><xsl:text>&#253;</xsl:text></xsl:template><!-- latin small letter y with acute, U+00FD ISOlat1 -->
1157 <xsl:template match="ch.thorn"><xsl:text>&#254;</xsl:text></xsl:template><!-- latin small letter thorn, U+00FE ISOlat1 -->
1158 <xsl:template match="ch.yuml"><xsl:text>&#255;</xsl:text></xsl:template><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
1159
1160 <!-- ~~~~~~~~~~~~~~~~~~~~~ Special Characters ~~~~~~~~~~~~~~~~~~~~ -->
1161
1162 <xsl:template match="ch.ampersand">&amp;</xsl:template><!-- ampersand -->
1163 <xsl:template match="ch.lsquot">&#8216;</xsl:template><!-- opening left quotation mark -->
1164 <xsl:template match="ch.rsquot">&#8217;</xsl:template><!-- closing right quotation mark -->
1165 <xsl:template match="ch.ldquot">&#8220;</xsl:template><!-- opening left double quotation mark -->
1166 <xsl:template match="ch.rdquot">&#8221;</xsl:template><!-- closing right double quotation mark -->
1167 <xsl:template match="ch.minus">&#8722;</xsl:template><!-- mathematical minus -->
1168 <xsl:template match="ch.endash">&#8211;</xsl:template><!-- endash -->
1169 <xsl:template match="ch.emdash">&#8212;</xsl:template><!-- emdash -->
1170 <xsl:template match="ch.ellips">&#8230;</xsl:template><!-- ellipsis -->
1171 <xsl:template match="ch.lellips">&#8230;</xsl:template><!-- left ellipsis, used at the beginning of edited material -->
1172 <xsl:template match="ch.blankline">_______</xsl:template><!-- blank line to be filled in -->
1173 <xsl:template match="ch.percent"><xsl:text>&#37;</xsl:text></xsl:template><!-- percent sign -->
1174 <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 -->
1175 <xsl:template match="ch.frac116"><xsl:text>1/16</xsl:text></xsl:template><!-- vulgar fraction one sixteenth = fraction on sixteenth -->
1176 <xsl:template match="ch.plus"><xsl:text>+</xsl:text></xsl:template><!-- mathematical plus -->
1177
1178 <!-- ==================== named templates ======================= -->
1179
1180 <xsl:template name="illustration-no-frame">
1181  <xsl:param name="illustration-width" select="instance[@class='html']/@width" />
1182  <xsl:param name="illustration-height" select="instance[@class='html']/@height" />
1183  <xsl:param name="illustration-src" select="instance[@class='html']/@src" />
1184  <xsl:param name="illustration-alt-text">
1185   <xsl:choose>
1186    <xsl:when test="$language='es'">
1187     <xsl:text>ilustraci&oacute;n</xsl:text>
1188    </xsl:when>
1189    <xsl:otherwise>
1190     <xsl:text>illustration</xsl:text>
1191    </xsl:otherwise>
1192   </xsl:choose>
1193  </xsl:param>
1194
1195  <div align="center">
1196   <img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[{$illustration-alt-text}]" />
1197   <xsl:if test="@class='float'">
1198    <br />
1199    <strong>
1200     <xsl:choose>
1201      <xsl:when test="$language='es'">
1202       <xsl:text>Ilustraci&oacute;n </xsl:text>
1203      </xsl:when>
1204      <xsl:otherwise>
1205       <xsl:text>Illustration </xsl:text>
1206      </xsl:otherwise>
1207     </xsl:choose>
1208     <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
1209    </strong>
1210    <xsl:text>&#8212;</xsl:text>
1211    <xsl:apply-templates select="meta/description" /><xsl:value-of select="$newline" />
1212   </xsl:if>
1213   <br /><br />
1214  </div>
1215 </xsl:template>
1216
1217 <!--
1218  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.
1219 -->
1220 <xsl:template name="section-title-link">
1221  <!-- will the list always contain the closest ancestor first? -->
1222  <xsl:variable name="section-title">
1223   <!-- numbered or not? -->
1224   <xsl:if test="ancestor::section[position()=1]/@class='numbered'">
1225    <xsl:choose>
1226     <xsl:when test="$language='es'">
1227      <xsl:text>Secci&oacute;n </xsl:text>
1228     </xsl:when>
1229     <xsl:otherwise>
1230      <xsl:text>Section </xsl:text>
1231     </xsl:otherwise>
1232    </xsl:choose>
1233   </xsl:if>
1234   <xsl:apply-templates select="ancestor::section[position()=1]/meta/title[1]" />
1235  </xsl:variable>
1236  
1237  <a>
1238   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="ancestor::section[position()=1]/@id" /></xsl:attribute>
1239   <xsl:value-of select="$section-title" />
1240  </a>
1241 </xsl:template>
1242
1243 </xsl:transform>