Initial freepository revision of XML support documents.
[project-aon.git] / xml / pml.xsl
1 <?xml version="1.0"?>
2 <!DOCTYPE xsl:transform [
3  <!ENTITY % pml.characters SYSTEM "pmlchar.mod">
4  %pml.characters;
5 ]>
6
7 <!--
8
9 $Id$
10
11 $Log$
12 Revision 1.1  2005/01/30 01:32:52  jonathan.blake
13 Initial freepository revision of XML support documents.
14
15 Revision 1.2  2003/01/07 16:55:28  jblake
16 Restarted work from base xhtml.xsl.
17
18
19 -->
20
21 <xsl:transform version="1.0"
22   xmlns="http://www.w3.org/1999/xhtml"
23   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
24   xmlns:lxslt="http://xml.apache.org/xslt">
25
26 <xsl:output method="text" encoding="ISO-8859-1" />
27
28 <xsl:strip-space elements="gamebook section meta data ol ul dl li dd footnotes footnote illustration instance" />
29 <xsl:preserve-space elements="p choice" />
30
31 <!-- ====================== parameters ========================== -->
32
33 <xsl:param name="use-illustrators" />
34
35 <!-- ======================= variables ========================== -->
36
37 <xsl:variable name="newline">
38 <xsl:text>
39 </xsl:text>
40 </xsl:variable>
41
42 <xsl:variable name="newparagraph">
43  <xsl:value-of select="$newline" />
44  <xsl:value-of select="$newline" />
45 </xsl:variable>
46
47 <xsl:variable name="newpage">
48  <xsl:value-of select="$newline" />
49  <xsl:text>\p</xsl:text>
50 </xsl:variable>
51
52 <!-- ======================== Templates ========================= -->
53
54 <!-- ================= hierarchical sections ==================== -->
55
56 <xsl:template match="meta" />
57
58 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
59
60 <xsl:template match="/gamebook/section[@id='title']">
61  <xsl:text>\vTITLE="</xsl:text><xsl:value-of select="/gamebook/meta/title" /><xsl:text>"\v</xsl:text>
62  <xsl:value-of select="$newline" />
63  <xsl:value-of select="$newline" />
64
65  <xsl:text>\X0\l\B</xsl:text>
66   <xsl:text>\c</xsl:text>
67    <xsl:value-of select="/gamebook/meta/title" />
68    <xsl:value-of select="$newline" />
69   <xsl:text>\c</xsl:text>
70  <xsl:text>\B\l\X0</xsl:text>
71  <xsl:value-of select="$newparagraph" />
72
73  <xsl:text>\c</xsl:text>
74   <xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" />
75   <xsl:value-of select="$newline" />
76  <xsl:text>\c</xsl:text>
77
78  <xsl:value-of select="$newpage" />
79  
80  <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
81
82  <xsl:value-of select="$newparagraph" />
83  <xsl:text>Publication Date: </xsl:text>
84  <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
85  <xsl:text> </xsl:text>
86  <xsl:choose>
87   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
88    <xsl:text>January</xsl:text>
89   </xsl:when>
90   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
91    <xsl:text>February</xsl:text>
92   </xsl:when>
93   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
94    <xsl:text>March</xsl:text>
95   </xsl:when>
96   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
97    <xsl:text>April</xsl:text>
98   </xsl:when>
99   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
100    <xsl:text>May</xsl:text>
101   </xsl:when>
102   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
103    <xsl:text>June</xsl:text>
104   </xsl:when>
105   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
106    <xsl:text>July</xsl:text>
107   </xsl:when>
108   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
109    <xsl:text>August</xsl:text>
110   </xsl:when>
111   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
112    <xsl:text>September</xsl:text>
113   </xsl:when>
114   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
115    <xsl:text>October</xsl:text>
116   </xsl:when>
117   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
118    <xsl:text>November</xsl:text>
119   </xsl:when>
120   <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
121    <xsl:text>December</xsl:text>
122   </xsl:when>
123   <xsl:otherwise>
124    <xsl:text>Invalid Month</xsl:text>
125   </xsl:otherwise>
126  </xsl:choose>
127  <xsl:text> </xsl:text>
128
129  <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
130
131  <xsl:value-of select="$newparagraph" />
132  <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
133
134  <xsl:if test="data/section[@class='frontmatter']">
135   <xsl:apply-templates select="data/section[@class='frontmatter']" />
136  </xsl:if>
137
138  <xsl:if test="data/section[@class='mainmatter']">
139   <xsl:apply-templates select="data/section[@class='mainmatter']" />
140  </xsl:if>
141
142  <xsl:if test="data/section[@class='numbered']">
143   <xsl:apply-templates select="data/section[@class='numbered']" />
144  </xsl:if>
145
146  <xsl:if test="data/section[@class='backmatter']">
147   <xsl:apply-templates select="data/section[@class='backmatter']" />
148  </xsl:if>
149
150  <xsl:for-each select="//footnote">
151   <xsl:value-of select="$newparagraph" />
152   <xsl:text>&lt;footnote id="</xsl:text><xsl:value-of select="@id" /><xsl:text>"&gt;</xsl:text>
153    <xsl:text>[</xsl:text><xsl:number count="footnote" from="/" level="any" format="1" /><xsl:text>]</xsl:text>
154    <xsl:apply-templates />
155   <xsl:text>&lt;/footnote&gt;</xsl:text>
156  </xsl:for-each>
157
158 </xsl:template>
159
160 <xsl:template match="/gamebook/section[@id='toc']" />
161
162 <xsl:template match="section" />
163
164 <!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
165
166 <xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
167  <xsl:value-of select="$newpage" />
168
169  <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
170   <xsl:value-of select="meta/title" />
171  <xsl:text>\B\l\X1</xsl:text>
172  <xsl:value-of select="$newparagraph" />
173
174  <xsl:apply-templates />
175 </xsl:template>
176
177 <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
178
179 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
180  <xsl:value-of select="$newpage" />
181  <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
182   <xsl:value-of select="meta/title" />
183  <xsl:text>\l\X2</xsl:text>
184  <xsl:value-of select="$newparagraph" />
185
186  <xsl:apply-templates />
187 </xsl:template>
188
189 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
190  <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
191   <xsl:value-of select="meta/title" />
192  <xsl:text>\l</xsl:text>
193  <xsl:value-of select="$newparagraph" />
194
195  <xsl:apply-templates />
196  <xsl:if test="following-sibling::node( )">
197   <xsl:value-of select="$newparagraph" />
198  </xsl:if>
199 </xsl:template>
200
201 <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
202
203 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
204  <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
205   <xsl:value-of select="meta/title" />
206  <xsl:text>\B</xsl:text>
207  <xsl:value-of select="$newparagraph" />
208
209  <xsl:apply-templates />
210  <xsl:if test="following-sibling::node( )">
211   <xsl:value-of select="$newparagraph" />
212  </xsl:if>
213 </xsl:template>
214
215 <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
216
217 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
218  <xsl:text>\Q{</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
219  <xsl:value-of select="meta/title" />
220  <xsl:value-of select="$newparagraph" />
221
222  <xsl:apply-templates />
223  <xsl:if test="following-sibling::node( )">
224   <xsl:value-of select="$newparagraph" />
225  </xsl:if>
226 </xsl:template>
227
228 <!-- ::::::::::: second-level main matter sections :::::::::::::: -->
229
230 <xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
231  <xsl:value-of select="$newpage" />
232  <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
233   <xsl:value-of select="meta/title" />
234  <xsl:text>\B\l\X1</xsl:text>
235  <xsl:value-of select="$newparagraph" />
236
237  <xsl:apply-templates />
238 </xsl:template>
239
240 <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
241
242 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
243  <xsl:value-of select="$newpage" />
244  <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
245   <xsl:value-of select="meta/title" />
246  <xsl:text>\l\X2</xsl:text>
247  <xsl:value-of select="$newparagraph" />
248
249  <xsl:apply-templates />
250 </xsl:template>
251
252 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
253  <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
254   <xsl:value-of select="meta/title" />
255  <xsl:text>\l</xsl:text>
256  <xsl:value-of select="$newparagraph" />
257
258  <xsl:apply-templates />
259  <xsl:if test="following-sibling::node( )">
260   <xsl:value-of select="$newparagraph" />
261  </xsl:if>
262 </xsl:template>
263
264 <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
265
266 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter-separate']">
267  <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
268   <xsl:value-of select="meta/title" />
269  <xsl:text>\B</xsl:text>
270  <xsl:value-of select="$newparagraph" />
271
272  <xsl:apply-templates />
273  <xsl:if test="following-sibling::node( )">
274   <xsl:value-of select="$newparagraph" />
275  </xsl:if>
276 </xsl:template>
277
278 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
279  <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
280   <xsl:value-of select="meta/title" />
281  <xsl:text>\B</xsl:text>
282  <xsl:value-of select="$newparagraph" />
283
284  <xsl:apply-templates />
285  <xsl:if test="following-sibling::node( )">
286   <xsl:value-of select="$newparagraph" />
287  </xsl:if>
288 </xsl:template>
289
290 <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
291
292 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
293  <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
294  <xsl:value-of select="meta/title" />
295  <xsl:value-of select="$newparagraph" />
296
297  <xsl:apply-templates />
298  <xsl:if test="following-sibling::node( )">
299   <xsl:value-of select="$newparagraph" />
300  </xsl:if>
301 </xsl:template>
302
303 <!-- :::::::::::: third-level glossary sections ::::::::::::: -->
304 <!-- Glossary sections should be contained in a second level section. -->
305
306 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
307  <xsl:value-of select="$newpage" />
308  <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
309   <xsl:value-of select="meta/title" />
310  <xsl:text>\l\X2</xsl:text>
311  <xsl:value-of select="$newparagraph" />
312
313  <xsl:apply-templates />
314 </xsl:template>
315
316 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
317  <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
318   <xsl:value-of select="meta/title" />
319  <xsl:text>\l</xsl:text>
320  <xsl:value-of select="$newparagraph" />
321
322  <xsl:apply-templates />
323  <xsl:if test="following-sibling::node( )">
324   <xsl:value-of select="$newparagraph" />
325  </xsl:if>
326 </xsl:template>
327
328 <!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
329
330 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
331  <xsl:value-of select="$newpage" />
332  <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
333   <xsl:value-of select="meta/title" />
334  <xsl:text>\B\l\X1</xsl:text>
335  <xsl:value-of select="$newparagraph" />
336
337  <xsl:apply-templates />
338 </xsl:template>
339
340 <xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']">
341  <xsl:value-of select="$newpage" />
342  <xsl:text>\c\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
343   <xsl:value-of select="meta/title" />
344  <xsl:text>\l</xsl:text>
345  <xsl:value-of select="$newline" />
346  <xsl:text>\c</xsl:text><xsl:value-of select="$newline" />
347
348  <xsl:apply-templates />
349  <xsl:value-of select="$newparagraph" />
350  <xsl:text>\w="50%"</xsl:text>
351 </xsl:template>
352
353 <!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
354
355 <xsl:template match="/gamebook/section/data/section[@class='backmatter']">
356  <xsl:value-of select="$newpage" />
357  <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
358   <xsl:value-of select="meta/title" />
359  <xsl:text>\B\l\X1</xsl:text>
360  <xsl:value-of select="$newparagraph" />
361
362  <xsl:apply-templates />
363 </xsl:template>
364
365 <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
366
367 <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
368  <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
369   <xsl:value-of select="meta/title" />
370  <xsl:text>\l</xsl:text>
371  <xsl:value-of select="$newparagraph" />
372
373  <xsl:apply-templates />
374  <xsl:if test="following-sibling::node( )">
375   <xsl:value-of select="$newparagraph" />
376  </xsl:if>
377 </xsl:template>
378
379 <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
380
381 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
382  <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
383   <xsl:value-of select="meta/title" />
384  <xsl:text>\B</xsl:text>
385  <xsl:value-of select="$newparagraph" />
386
387  <xsl:apply-templates />
388  <xsl:if test="following-sibling::node( )">
389   <xsl:value-of select="$newparagraph" />
390  </xsl:if>
391 </xsl:template>
392
393 <!-- :::::::::::::::::: dedication template ::::::::::::::::::::: -->
394
395 <xsl:template match="id( 'dedicate' )">
396  <!-- PML doesn't allow blank lines at the top of a page without a space -->
397  <xsl:value-of select="$newpage" />
398  <xsl:text>&nbsp;</xsl:text><xsl:value-of select="$newparagraph" />
399  <xsl:text>&nbsp;</xsl:text><xsl:value-of select="$newparagraph" />
400  <xsl:text>\c\i</xsl:text>
401   <xsl:apply-templates select="data/p" />
402  <xsl:text>\i</xsl:text>
403  <xsl:value-of select="$newline" />
404  <xsl:text>\c</xsl:text>
405  <xsl:value-of select="$newline" />
406 </xsl:template>
407
408 <!-- ==================== block elements ======================== -->
409
410 <xsl:template match="p">
411  <xsl:apply-templates />
412  <xsl:if test="following-sibling::node( )">
413   <xsl:value-of select="$newparagraph" />
414  </xsl:if>
415 </xsl:template>
416
417 <xsl:template match="dd/p | li/p">
418  <xsl:apply-templates />
419  <xsl:if test="following-sibling::node( )">
420   <xsl:choose>
421    <xsl:when test="following-sibling::illustration">
422     <xsl:if test="following-sibling::illustration/instance[@class='text']">
423      <xsl:value-of select="$newparagraph" />
424     </xsl:if>
425    </xsl:when>
426    <xsl:otherwise>
427     <xsl:value-of select="$newparagraph" />
428    </xsl:otherwise>
429   </xsl:choose>
430  </xsl:if>
431 </xsl:template>
432
433 <xsl:template match="ul | ol | dl">
434  <xsl:apply-templates />
435  <xsl:if test="following-sibling::node( )">
436   <xsl:value-of select="$newparagraph" />
437  </xsl:if>
438 </xsl:template>
439
440 <xsl:template match="li/ul | li/ol | li/dl | dd/ul | dd/ol | dd/dl">
441  <xsl:apply-templates />
442  <xsl:if test="following-sibling::node( )">
443   <xsl:value-of select="$newparagraph" />
444  </xsl:if>
445 </xsl:template>
446
447 <xsl:template match="table">
448  <xsl:apply-templates />
449  <xsl:if test="following-sibling::node( )">
450   <xsl:value-of select="$newparagraph" />
451  </xsl:if>
452 </xsl:template>
453
454 <xsl:template match="tr">
455  <xsl:apply-templates />
456  <xsl:if test="following-sibling::node( )">
457   <xsl:value-of select="$newline" />
458  </xsl:if>
459 </xsl:template>
460
461 <xsl:template match="th">
462  <xsl:variable name="indent-level" select="count( th | td )" />
463  <xsl:choose>
464   <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
465   <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
466  </xsl:choose>
467  <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
468 </xsl:template>
469
470 <xsl:template match="td">
471  <xsl:variable name="indent-level" select="count( th | td )" />
472  <xsl:choose>
473   <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
474   <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
475  </xsl:choose>
476  <xsl:apply-templates />
477 </xsl:template>
478
479 <xsl:template match="combat">
480  <xsl:text>\t</xsl:text>
481  <xsl:apply-templates select="enemy" />
482  <xsl:text>:</xsl:text>
483  <xsl:text>\t</xsl:text>
484
485  <xsl:value-of select="$newline" />
486  <xsl:text>\t&nbsp;&nbsp;</xsl:text>
487  <xsl:choose>
488   <xsl:when test="enemy-attribute[@class='combatskill']">
489    <xsl:text>COMBAT&nbsp;SKILL&nbsp;</xsl:text>
490    <xsl:value-of select="enemy-attribute[@class='combatskill']" />
491   </xsl:when>
492   <xsl:when test="enemy-attribute[@class='closecombatskill']">
493    <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL&nbsp;</xsl:text>
494    <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
495   </xsl:when>
496  </xsl:choose>
497  <xsl:text>\t</xsl:text>
498
499  <xsl:value-of select="$newline" />
500  <xsl:text>\t&nbsp;&nbsp;</xsl:text>
501  <xsl:text>ENDURANCE&nbsp;</xsl:text>
502  <xsl:choose>
503   <xsl:when test="enemy-attribute[@class='target']">
504    <xsl:text>(TARGET&nbsp;points)&nbsp;</xsl:text>
505    <xsl:value-of select="enemy-attribute[@class='target']" />
506   </xsl:when>
507   <xsl:when test="enemy-attribute[@class='resistance']">
508    <xsl:text>(RESISTANCE&nbsp;points)&nbsp;</xsl:text>
509    <xsl:value-of select="enemy-attribute[@class='resistance']" />
510   </xsl:when>
511   <xsl:otherwise>
512    <xsl:value-of select="enemy-attribute[@class='endurance']" />
513   </xsl:otherwise>
514  </xsl:choose>
515  <xsl:text>\t</xsl:text>
516
517  <xsl:if test="following-sibling::node( )">
518   <xsl:value-of select="$newparagraph" />
519  </xsl:if>
520 </xsl:template>
521
522 <xsl:template match="choice">
523  <xsl:variable name="link">
524   <xsl:value-of select="@idref" />
525  </xsl:variable>
526
527  <xsl:text>\t</xsl:text>
528  <xsl:for-each select="* | text()">
529   <xsl:choose>
530    <xsl:when test="self::link-text">
531     <xsl:text>\q="#</xsl:text><xsl:value-of select="$link" /><xsl:text>"</xsl:text>
532      <xsl:apply-templates />
533     <xsl:text>\q</xsl:text>
534    </xsl:when>
535    <xsl:otherwise>
536     <xsl:apply-templates select="." />
537    </xsl:otherwise>
538   </xsl:choose>
539  </xsl:for-each>
540  <xsl:text>\t</xsl:text>
541  <xsl:if test="following-sibling::node( )">
542   <xsl:value-of select="$newparagraph" />
543  </xsl:if>
544 </xsl:template>
545
546 <xsl:template match="signpost">
547  <xsl:text>\c</xsl:text>
548   <xsl:apply-templates />
549   <xsl:value-of select="$newline" />
550  <xsl:text>\c</xsl:text>
551  <xsl:if test="following-sibling::node( )">
552   <xsl:value-of select="$newparagraph" />
553  </xsl:if>
554 </xsl:template>
555
556 <xsl:template match="blockquote">
557  <xsl:text>\t</xsl:text>
558   <xsl:apply-templates />
559  <xsl:text>\t</xsl:text>
560  <xsl:if test="following-sibling::node( )">
561   <xsl:value-of select="$newparagraph" />
562  </xsl:if>
563 </xsl:template>
564
565 <xsl:template match="illustration">
566  <xsl:choose>
567   <xsl:when test="instance[@class='pml'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
568    <xsl:text>\c\m="</xsl:text><xsl:value-of select="instance[@class='pml']/@src" /><xsl:text>"</xsl:text>
569    <xsl:value-of select="$newline" />
570    <xsl:text>\c</xsl:text>
571    <xsl:if test="following-sibling::node( )">
572     <xsl:value-of select="$newparagraph" />
573    </xsl:if>
574   </xsl:when>
575   <xsl:when test="instance[@class='text'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
576    <xsl:apply-templates select="instance[@class='text']/*" />
577    <xsl:if test="following-sibling::node( )">
578     <xsl:value-of select="$newparagraph" />
579    </xsl:if>
580   </xsl:when>
581  </xsl:choose>
582 </xsl:template>
583
584 <xsl:template match="instance" />
585
586 <xsl:template match="footnotes" />
587
588 <xsl:template match="footnote">
589  <xsl:apply-templates />
590 </xsl:template>
591
592 <xsl:template match="hr">
593  <xsl:text>\w="80%"</xsl:text>
594  <xsl:value-of select="$newline" />
595 </xsl:template>
596
597 <xsl:template match="dt">
598  <xsl:apply-templates />
599  <xsl:if test="following-sibling::node( )">
600   <xsl:value-of select="$newline" />
601  </xsl:if>
602 </xsl:template>
603
604 <xsl:template match="dd">
605  <xsl:text>\t</xsl:text>
606  <xsl:apply-templates />
607  <xsl:text>\t</xsl:text>
608  <xsl:if test="following-sibling::node( )">
609   <xsl:value-of select="$newline" />
610  </xsl:if>
611 </xsl:template>
612
613 <xsl:template match="ol/li">
614  <xsl:number count="li" /><xsl:text>. </xsl:text>
615  <xsl:apply-templates />
616  <xsl:if test="following-sibling::node( )">
617   <xsl:value-of select="$newline" />
618  </xsl:if>
619 </xsl:template>
620
621 <xsl:template match="ul/li">
622  <xsl:text>&bullet; </xsl:text>
623  <xsl:apply-templates />
624  <xsl:if test="following-sibling::node( )">
625   <xsl:value-of select="$newline" />
626  </xsl:if>
627 </xsl:template>
628
629 <xsl:template match="ul[@class='unbulleted']/li">
630  <xsl:apply-templates />
631  <xsl:if test="following-sibling::node( )">
632   <xsl:value-of select="$newline" />
633  </xsl:if>
634 </xsl:template>
635
636 <!-- ==================== inline elements ======================= -->
637
638 <xsl:template match="a">
639  <xsl:if test="@id">
640   <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
641  </xsl:if>
642  <xsl:if test="@idref">
643   <xsl:text>\q="#</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
644  </xsl:if>
645
646  <xsl:apply-templates />
647
648  <xsl:if test="@idref">
649   <xsl:text>\q</xsl:text>
650  </xsl:if>
651 </xsl:template>
652
653 <xsl:template match="footnote//a">
654  <xsl:apply-templates />
655 </xsl:template>
656
657 <xsl:template match="a[@class='footnote']">
658  <xsl:apply-templates />
659  <xsl:text>\Sp\Fn="</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
660  <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
661  <xsl:text>\Fn\Sp</xsl:text>
662 </xsl:template>
663
664 <xsl:template match="em">
665  <xsl:text>\i{</xsl:text><xsl:apply-templates /><xsl:text>i</xsl:text>
666 </xsl:template>
667
668 <xsl:template match="strong">
669  <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
670 </xsl:template>
671
672 <xsl:template match="cite">
673  <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
674 </xsl:template>
675
676 <xsl:template match="thought">
677  <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
678 </xsl:template>
679
680 <xsl:template match="onomatopoeia">
681  <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
682 </xsl:template>
683
684 <xsl:template match="spell">
685  <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
686 </xsl:template>
687
688 <xsl:template match="item">
689  <xsl:apply-templates />
690 </xsl:template>
691
692 <xsl:template match="foreign">
693  <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
694 </xsl:template>
695
696 <xsl:template match="quote">
697  <xsl:text>&lsquot;</xsl:text>
698   <xsl:apply-templates />
699  <xsl:text>&rsquot;</xsl:text>
700 </xsl:template>
701
702 <xsl:template match="quote//quote">
703  <xsl:text>&ldquot;</xsl:text>
704   <xsl:apply-templates />
705  <xsl:text>&rdquot;</xsl:text>
706 </xsl:template>
707
708 <xsl:template match="code">
709  <xsl:apply-templates />
710 </xsl:template>
711
712 <xsl:template match="br">
713  <xsl:value-of select="$newline" />
714 </xsl:template>
715
716 </xsl:transform>
717