2 <!DOCTYPE xsl:transform [
3 <!ENTITY % pml.characters SYSTEM "pmlchar.mod">
12 Revision 1.2 2005/04/09 19:51:50 angantyr
13 Added handling of open-ended quotes.
15 Revision 1.1 2005/01/30 01:32:52 jonathan.blake
16 Initial freepository revision of XML support documents.
18 Revision 1.2 2003/01/07 16:55:28 jblake
19 Restarted work from base xhtml.xsl.
24 <xsl:transform version="1.0"
25 xmlns="http://www.w3.org/1999/xhtml"
26 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
27 xmlns:lxslt="http://xml.apache.org/xslt">
29 <xsl:output method="text" encoding="ISO-8859-1" />
31 <xsl:strip-space elements="gamebook section meta data ol ul dl li dd footnotes footnote illustration instance" />
32 <xsl:preserve-space elements="p choice" />
34 <!-- ====================== parameters ========================== -->
36 <xsl:param name="use-illustrators" />
38 <!-- ======================= variables ========================== -->
40 <xsl:variable name="newline">
45 <xsl:variable name="newparagraph">
46 <xsl:value-of select="$newline" />
47 <xsl:value-of select="$newline" />
50 <xsl:variable name="newpage">
51 <xsl:value-of select="$newline" />
52 <xsl:text>\p</xsl:text>
55 <!-- ======================== Templates ========================= -->
57 <!-- ================= hierarchical sections ==================== -->
59 <xsl:template match="meta" />
61 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
63 <xsl:template match="/gamebook/section[@id='title']">
64 <xsl:text>\vTITLE="</xsl:text><xsl:value-of select="/gamebook/meta/title" /><xsl:text>"\v</xsl:text>
65 <xsl:value-of select="$newline" />
66 <xsl:value-of select="$newline" />
68 <xsl:text>\X0\l\B</xsl:text>
69 <xsl:text>\c</xsl:text>
70 <xsl:value-of select="/gamebook/meta/title" />
71 <xsl:value-of select="$newline" />
72 <xsl:text>\c</xsl:text>
73 <xsl:text>\B\l\X0</xsl:text>
74 <xsl:value-of select="$newparagraph" />
76 <xsl:text>\c</xsl:text>
77 <xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" />
78 <xsl:value-of select="$newline" />
79 <xsl:text>\c</xsl:text>
81 <xsl:value-of select="$newpage" />
83 <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
85 <xsl:value-of select="$newparagraph" />
86 <xsl:text>Publication Date: </xsl:text>
87 <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
88 <xsl:text> </xsl:text>
90 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
91 <xsl:text>January</xsl:text>
93 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
94 <xsl:text>February</xsl:text>
96 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
97 <xsl:text>March</xsl:text>
99 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
100 <xsl:text>April</xsl:text>
102 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
103 <xsl:text>May</xsl:text>
105 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
106 <xsl:text>June</xsl:text>
108 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
109 <xsl:text>July</xsl:text>
111 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
112 <xsl:text>August</xsl:text>
114 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
115 <xsl:text>September</xsl:text>
117 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
118 <xsl:text>October</xsl:text>
120 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
121 <xsl:text>November</xsl:text>
123 <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
124 <xsl:text>December</xsl:text>
127 <xsl:text>Invalid Month</xsl:text>
130 <xsl:text> </xsl:text>
132 <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
134 <xsl:value-of select="$newparagraph" />
135 <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
137 <xsl:if test="data/section[@class='frontmatter']">
138 <xsl:apply-templates select="data/section[@class='frontmatter']" />
141 <xsl:if test="data/section[@class='mainmatter']">
142 <xsl:apply-templates select="data/section[@class='mainmatter']" />
145 <xsl:if test="data/section[@class='numbered']">
146 <xsl:apply-templates select="data/section[@class='numbered']" />
149 <xsl:if test="data/section[@class='backmatter']">
150 <xsl:apply-templates select="data/section[@class='backmatter']" />
153 <xsl:for-each select="//footnote">
154 <xsl:value-of select="$newparagraph" />
155 <xsl:text><footnote id="</xsl:text><xsl:value-of select="@id" /><xsl:text>"></xsl:text>
156 <xsl:text>[</xsl:text><xsl:number count="footnote" from="/" level="any" format="1" /><xsl:text>]</xsl:text>
157 <xsl:apply-templates />
158 <xsl:text></footnote></xsl:text>
163 <xsl:template match="/gamebook/section[@id='toc']" />
165 <xsl:template match="section" />
167 <!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
169 <xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
170 <xsl:value-of select="$newpage" />
172 <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
173 <xsl:value-of select="meta/title" />
174 <xsl:text>\B\l\X1</xsl:text>
175 <xsl:value-of select="$newparagraph" />
177 <xsl:apply-templates />
180 <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
182 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
183 <xsl:value-of select="$newpage" />
184 <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
185 <xsl:value-of select="meta/title" />
186 <xsl:text>\l\X2</xsl:text>
187 <xsl:value-of select="$newparagraph" />
189 <xsl:apply-templates />
192 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
193 <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
194 <xsl:value-of select="meta/title" />
195 <xsl:text>\l</xsl:text>
196 <xsl:value-of select="$newparagraph" />
198 <xsl:apply-templates />
199 <xsl:if test="following-sibling::node( )">
200 <xsl:value-of select="$newparagraph" />
204 <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
206 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
207 <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
208 <xsl:value-of select="meta/title" />
209 <xsl:text>\B</xsl:text>
210 <xsl:value-of select="$newparagraph" />
212 <xsl:apply-templates />
213 <xsl:if test="following-sibling::node( )">
214 <xsl:value-of select="$newparagraph" />
218 <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
220 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
221 <xsl:text>\Q{</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
222 <xsl:value-of select="meta/title" />
223 <xsl:value-of select="$newparagraph" />
225 <xsl:apply-templates />
226 <xsl:if test="following-sibling::node( )">
227 <xsl:value-of select="$newparagraph" />
231 <!-- ::::::::::: second-level main matter sections :::::::::::::: -->
233 <xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
234 <xsl:value-of select="$newpage" />
235 <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
236 <xsl:value-of select="meta/title" />
237 <xsl:text>\B\l\X1</xsl:text>
238 <xsl:value-of select="$newparagraph" />
240 <xsl:apply-templates />
243 <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
245 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
246 <xsl:value-of select="$newpage" />
247 <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
248 <xsl:value-of select="meta/title" />
249 <xsl:text>\l\X2</xsl:text>
250 <xsl:value-of select="$newparagraph" />
252 <xsl:apply-templates />
255 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
256 <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
257 <xsl:value-of select="meta/title" />
258 <xsl:text>\l</xsl:text>
259 <xsl:value-of select="$newparagraph" />
261 <xsl:apply-templates />
262 <xsl:if test="following-sibling::node( )">
263 <xsl:value-of select="$newparagraph" />
267 <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
269 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter-separate']">
270 <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
271 <xsl:value-of select="meta/title" />
272 <xsl:text>\B</xsl:text>
273 <xsl:value-of select="$newparagraph" />
275 <xsl:apply-templates />
276 <xsl:if test="following-sibling::node( )">
277 <xsl:value-of select="$newparagraph" />
281 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
282 <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
283 <xsl:value-of select="meta/title" />
284 <xsl:text>\B</xsl:text>
285 <xsl:value-of select="$newparagraph" />
287 <xsl:apply-templates />
288 <xsl:if test="following-sibling::node( )">
289 <xsl:value-of select="$newparagraph" />
293 <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
295 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
296 <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
297 <xsl:value-of select="meta/title" />
298 <xsl:value-of select="$newparagraph" />
300 <xsl:apply-templates />
301 <xsl:if test="following-sibling::node( )">
302 <xsl:value-of select="$newparagraph" />
306 <!-- :::::::::::: third-level glossary sections ::::::::::::: -->
307 <!-- Glossary sections should be contained in a second level section. -->
309 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
310 <xsl:value-of select="$newpage" />
311 <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
312 <xsl:value-of select="meta/title" />
313 <xsl:text>\l\X2</xsl:text>
314 <xsl:value-of select="$newparagraph" />
316 <xsl:apply-templates />
319 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
320 <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
321 <xsl:value-of select="meta/title" />
322 <xsl:text>\l</xsl:text>
323 <xsl:value-of select="$newparagraph" />
325 <xsl:apply-templates />
326 <xsl:if test="following-sibling::node( )">
327 <xsl:value-of select="$newparagraph" />
331 <!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
333 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
334 <xsl:value-of select="$newpage" />
335 <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
336 <xsl:value-of select="meta/title" />
337 <xsl:text>\B\l\X1</xsl:text>
338 <xsl:value-of select="$newparagraph" />
340 <xsl:apply-templates />
343 <xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']">
344 <xsl:value-of select="$newpage" />
345 <xsl:text>\c\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
346 <xsl:value-of select="meta/title" />
347 <xsl:text>\l</xsl:text>
348 <xsl:value-of select="$newline" />
349 <xsl:text>\c</xsl:text><xsl:value-of select="$newline" />
351 <xsl:apply-templates />
352 <xsl:value-of select="$newparagraph" />
353 <xsl:text>\w="50%"</xsl:text>
356 <!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
358 <xsl:template match="/gamebook/section/data/section[@class='backmatter']">
359 <xsl:value-of select="$newpage" />
360 <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
361 <xsl:value-of select="meta/title" />
362 <xsl:text>\B\l\X1</xsl:text>
363 <xsl:value-of select="$newparagraph" />
365 <xsl:apply-templates />
368 <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
370 <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
371 <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
372 <xsl:value-of select="meta/title" />
373 <xsl:text>\l</xsl:text>
374 <xsl:value-of select="$newparagraph" />
376 <xsl:apply-templates />
377 <xsl:if test="following-sibling::node( )">
378 <xsl:value-of select="$newparagraph" />
382 <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
384 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
385 <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
386 <xsl:value-of select="meta/title" />
387 <xsl:text>\B</xsl:text>
388 <xsl:value-of select="$newparagraph" />
390 <xsl:apply-templates />
391 <xsl:if test="following-sibling::node( )">
392 <xsl:value-of select="$newparagraph" />
396 <!-- :::::::::::::::::: dedication template ::::::::::::::::::::: -->
398 <xsl:template match="id( 'dedicate' )">
399 <!-- PML doesn't allow blank lines at the top of a page without a space -->
400 <xsl:value-of select="$newpage" />
401 <xsl:text> </xsl:text><xsl:value-of select="$newparagraph" />
402 <xsl:text> </xsl:text><xsl:value-of select="$newparagraph" />
403 <xsl:text>\c\i</xsl:text>
404 <xsl:apply-templates select="data/p" />
405 <xsl:text>\i</xsl:text>
406 <xsl:value-of select="$newline" />
407 <xsl:text>\c</xsl:text>
408 <xsl:value-of select="$newline" />
411 <!-- ==================== block elements ======================== -->
413 <xsl:template match="p">
414 <xsl:apply-templates />
415 <xsl:if test="following-sibling::node( )">
416 <xsl:value-of select="$newparagraph" />
420 <xsl:template match="dd/p | li/p">
421 <xsl:apply-templates />
422 <xsl:if test="following-sibling::node( )">
424 <xsl:when test="following-sibling::illustration">
425 <xsl:if test="following-sibling::illustration/instance[@class='text']">
426 <xsl:value-of select="$newparagraph" />
430 <xsl:value-of select="$newparagraph" />
436 <xsl:template match="ul | ol | dl">
437 <xsl:apply-templates />
438 <xsl:if test="following-sibling::node( )">
439 <xsl:value-of select="$newparagraph" />
443 <xsl:template match="li/ul | li/ol | li/dl | dd/ul | dd/ol | dd/dl">
444 <xsl:apply-templates />
445 <xsl:if test="following-sibling::node( )">
446 <xsl:value-of select="$newparagraph" />
450 <xsl:template match="table">
451 <xsl:apply-templates />
452 <xsl:if test="following-sibling::node( )">
453 <xsl:value-of select="$newparagraph" />
457 <xsl:template match="tr">
458 <xsl:apply-templates />
459 <xsl:if test="following-sibling::node( )">
460 <xsl:value-of select="$newline" />
464 <xsl:template match="th">
465 <xsl:variable name="indent-level" select="count( th | td )" />
467 <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
468 <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
470 <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
473 <xsl:template match="td">
474 <xsl:variable name="indent-level" select="count( th | td )" />
476 <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
477 <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
479 <xsl:apply-templates />
482 <xsl:template match="combat">
483 <xsl:text>\t</xsl:text>
484 <xsl:apply-templates select="enemy" />
485 <xsl:text>:</xsl:text>
486 <xsl:text>\t</xsl:text>
488 <xsl:value-of select="$newline" />
489 <xsl:text>\t </xsl:text>
491 <xsl:when test="enemy-attribute[@class='combatskill']">
492 <xsl:text>COMBAT SKILL </xsl:text>
493 <xsl:value-of select="enemy-attribute[@class='combatskill']" />
495 <xsl:when test="enemy-attribute[@class='closecombatskill']">
496 <xsl:text>CLOSE COMBAT SKILL </xsl:text>
497 <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
500 <xsl:text>\t</xsl:text>
502 <xsl:value-of select="$newline" />
503 <xsl:text>\t </xsl:text>
504 <xsl:text>ENDURANCE </xsl:text>
506 <xsl:when test="enemy-attribute[@class='target']">
507 <xsl:text>(TARGET points) </xsl:text>
508 <xsl:value-of select="enemy-attribute[@class='target']" />
510 <xsl:when test="enemy-attribute[@class='resistance']">
511 <xsl:text>(RESISTANCE points) </xsl:text>
512 <xsl:value-of select="enemy-attribute[@class='resistance']" />
515 <xsl:value-of select="enemy-attribute[@class='endurance']" />
518 <xsl:text>\t</xsl:text>
520 <xsl:if test="following-sibling::node( )">
521 <xsl:value-of select="$newparagraph" />
525 <xsl:template match="choice">
526 <xsl:variable name="link">
527 <xsl:value-of select="@idref" />
530 <xsl:text>\t</xsl:text>
531 <xsl:for-each select="* | text()">
533 <xsl:when test="self::link-text">
534 <xsl:text>\q="#</xsl:text><xsl:value-of select="$link" /><xsl:text>"</xsl:text>
535 <xsl:apply-templates />
536 <xsl:text>\q</xsl:text>
539 <xsl:apply-templates select="." />
543 <xsl:text>\t</xsl:text>
544 <xsl:if test="following-sibling::node( )">
545 <xsl:value-of select="$newparagraph" />
549 <xsl:template match="signpost">
550 <xsl:text>\c</xsl:text>
551 <xsl:apply-templates />
552 <xsl:value-of select="$newline" />
553 <xsl:text>\c</xsl:text>
554 <xsl:if test="following-sibling::node( )">
555 <xsl:value-of select="$newparagraph" />
559 <xsl:template match="blockquote">
560 <xsl:text>\t</xsl:text>
561 <xsl:apply-templates />
562 <xsl:text>\t</xsl:text>
563 <xsl:if test="following-sibling::node( )">
564 <xsl:value-of select="$newparagraph" />
568 <xsl:template match="illustration">
570 <xsl:when test="instance[@class='pml'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
571 <xsl:text>\c\m="</xsl:text><xsl:value-of select="instance[@class='pml']/@src" /><xsl:text>"</xsl:text>
572 <xsl:value-of select="$newline" />
573 <xsl:text>\c</xsl:text>
574 <xsl:if test="following-sibling::node( )">
575 <xsl:value-of select="$newparagraph" />
578 <xsl:when test="instance[@class='text'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
579 <xsl:apply-templates select="instance[@class='text']/*" />
580 <xsl:if test="following-sibling::node( )">
581 <xsl:value-of select="$newparagraph" />
587 <xsl:template match="instance" />
589 <xsl:template match="footnotes" />
591 <xsl:template match="footnote">
592 <xsl:apply-templates />
595 <xsl:template match="hr">
596 <xsl:text>\w="80%"</xsl:text>
597 <xsl:value-of select="$newline" />
600 <xsl:template match="dt">
601 <xsl:apply-templates />
602 <xsl:if test="following-sibling::node( )">
603 <xsl:value-of select="$newline" />
607 <xsl:template match="dd">
608 <xsl:text>\t</xsl:text>
609 <xsl:apply-templates />
610 <xsl:text>\t</xsl:text>
611 <xsl:if test="following-sibling::node( )">
612 <xsl:value-of select="$newline" />
616 <xsl:template match="ol/li">
617 <xsl:number count="li" /><xsl:text>. </xsl:text>
618 <xsl:apply-templates />
619 <xsl:if test="following-sibling::node( )">
620 <xsl:value-of select="$newline" />
624 <xsl:template match="ul/li">
625 <xsl:text>• </xsl:text>
626 <xsl:apply-templates />
627 <xsl:if test="following-sibling::node( )">
628 <xsl:value-of select="$newline" />
632 <xsl:template match="ul[@class='unbulleted']/li">
633 <xsl:apply-templates />
634 <xsl:if test="following-sibling::node( )">
635 <xsl:value-of select="$newline" />
639 <!-- ==================== inline elements ======================= -->
641 <xsl:template match="a">
643 <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
645 <xsl:if test="@idref">
646 <xsl:text>\q="#</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
649 <xsl:apply-templates />
651 <xsl:if test="@idref">
652 <xsl:text>\q</xsl:text>
656 <xsl:template match="footnote//a">
657 <xsl:apply-templates />
660 <xsl:template match="a[@class='footnote']">
661 <xsl:apply-templates />
662 <xsl:text>\Sp\Fn="</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
663 <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
664 <xsl:text>\Fn\Sp</xsl:text>
667 <xsl:template match="em">
668 <xsl:text>\i{</xsl:text><xsl:apply-templates /><xsl:text>i</xsl:text>
671 <xsl:template match="strong">
672 <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
675 <xsl:template match="cite">
676 <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
679 <xsl:template match="thought">
680 <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
683 <xsl:template match="onomatopoeia">
684 <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
687 <xsl:template match="spell">
688 <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
691 <xsl:template match="item">
692 <xsl:apply-templates />
695 <xsl:template match="foreign">
696 <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
699 <xsl:template match="quote">
700 <xsl:text>&lsquot;</xsl:text>
701 <xsl:apply-templates />
702 <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&rsquot;</xsl:text></xsl:if>
705 <xsl:template match="quote//quote">
706 <xsl:text>&ldquot;</xsl:text>
707 <xsl:apply-templates />
708 <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&rdquot;</xsl:text></xsl:if>
711 <xsl:template match="code">
712 <xsl:apply-templates />
715 <xsl:template match="br">
716 <xsl:value-of select="$newline" />