2 <!DOCTYPE xsl:transform [
3 <!ENTITY % latex.characters SYSTEM "ltexchar.mod">
7 <xsl:transform version="1.0"
8 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:exslt="http://exslt.org/common"
10 xmlns:date="http://exslt.org/dates-and-times" >
12 <xsl:import href="../../common/xsl/org.projectaon.format-date-localized.template.xsl" />
14 <xsl:output method="text" encoding="ISO-8859-1" />
16 <xsl:strip-space elements="gamebook meta rights section data ol ul dl li dd footnotes footnote illustration instance table tr th td blockquote poetry" />
17 <xsl:preserve-space elements="p choice description" />
22 Revision 1.3 2006/04/04 22:02:14 cvsuser
23 Fix two bugs (one } too much and a missing line break)
25 Revision 1.2 2005/04/09 19:51:50 angantyr
26 Added handling of open-ended quotes.
28 Revision 1.1 2005/01/30 01:32:52 jonathan.blake
29 Initial freepository revision of XML support documents.
31 Revision 1.3 2002/10/30 06:33:22 jblake
32 Added capability to filter which illustrators' work is included in the output.
34 Revision 1.2 2002/10/20 06:29:58 jblake
35 Added support for CLOSE COMBAT SKILL from the Freeway Warrior books.
37 Revision 1.1 2002/10/15 23:30:23 jblake
46 The implementation of tables is incomplete and kludgy.
51 <!-- ====================== parameters ========================== -->
53 <xsl:param name="title-color"><xsl:text>0.0,0.0,0.0</xsl:text></xsl:param>
54 <xsl:param name="use-illustrators" />
55 <xsl:param name="language"><xsl:text>en</xsl:text></xsl:param>
56 <xsl:param name="papersize"><xsl:text>a5paper</xsl:text></xsl:param>
57 <xsl:param name="pagelayout"><xsl:text>twoside</xsl:text></xsl:param>
58 <xsl:param name="usesouvenirfont"><xsl:text>yes</xsl:text></xsl:param>
59 <xsl:param name="usexelatex"><xsl:text>yes</xsl:text></xsl:param>
62 The size of the original paperback books is about 178 mm x 110 mm,
63 the scans of the covers are 690 x 425, i.e. the aspect ratio is about
65 Scaling the page size to A5 (210 mm x 148.5 mm) on gets about
66 210 mm x 129.35 mm -> the binding correction should be set to 19.15 mm.
67 Scaling the page size to letter/2 (215.9 mm x 139.7 mm) on gets about
68 215.9 mm x 133 mm -> the binding correction should be set to 6.7 mm.
71 <!-- ======================= includes =========================== -->
74 <!-- ================= internationalization ===================== -->
76 <xsl:variable name="i18n" select="document( '../../common/l10n/i18n-pdf.xml' )/messages/message[@lang=$language]"/>
78 <!-- ======================= variables ========================== -->
80 <xsl:variable name="newline">
85 <xsl:variable name="newparagraph">
86 <xsl:value-of select="$newline" />
87 <xsl:value-of select="$newline" />
90 <xsl:variable name="resultBoxWidth">15</xsl:variable><!-- 45pt -->
91 <xsl:variable name="resultBoxHeight">15</xsl:variable><!-- 40pt -->
92 <xsl:variable name="rnColWidth">6</xsl:variable><!-- 20pt -->
93 <xsl:variable name="combatRatioBoxHeight">9</xsl:variable><!-- 30pt -->
94 <xsl:variable name="legendHeight">4.5</xsl:variable><!-- 15pt -->
95 <xsl:variable name="legendSep">3</xsl:variable><!-- 10pt -->
96 <xsl:variable name="topLabelSep">3</xsl:variable><!-- 10pt -->
97 <xsl:variable name="topLabelHeight">6</xsl:variable><!-- 20pt -->
98 <xsl:variable name="sideLabelWidth">6</xsl:variable><!-- 20pt -->
100 <!-- calculate a few positions -->
101 <xsl:variable name="randomNumberBoxWidth" select="$rnColWidth" />
102 <xsl:variable name="randomNumberBoxHeight" select="$resultBoxHeight" />
104 <xsl:variable name="combatRatioBoxWidth" select="$resultBoxWidth" />
106 <!-- Random Number Table -->
107 <xsl:variable name="RNTWidthOfBox">12</xsl:variable>
108 <xsl:variable name="RNTHeightOfBox">15.5</xsl:variable>
109 <!-- offsetX = \textwidth / 2 - 5 * widthOfBox = 116.2 / 2 - 60 = - 1.9 -->
110 <xsl:variable name="RNTOffsetX">-1.9</xsl:variable>
111 <xsl:variable name="RNTOffsetY">0</xsl:variable>
113 <!-- ======================== Templates ========================= -->
115 <!-- ================= hierarchical sections ==================== -->
117 <xsl:template match="meta" />
119 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
121 <xsl:template match="/gamebook/section[@id='title']">
123 <xsl:text>\documentclass[</xsl:text><xsl:value-of select="$papersize" /><xsl:text>,12pt,</xsl:text><xsl:value-of select="$pagelayout" /><xsl:text>,BCOR10mm,DIVcalc,headinclude,cleardoubleempty]{scrbook}
127 <xsl:when test="$usexelatex='yes'">
129 % xltxtra loads fontspec
136 \usepackage[T1]{fontenc}
142 <xsl:when test="$usesouvenirfont='yes'">
144 <xsl:when test="$usexelatex='yes'">
145 <xsl:text>\setmainfont[Ligatures=TeX]{ITC Souvenir Std Light}</xsl:text>
146 <xsl:value-of select="$newline" />
149 <xsl:text>\usepackage{souvenir}</xsl:text>
150 <xsl:value-of select="$newline" />
157 \typearea[current]{calc}
159 % list only chapters in the ToC
160 \setcounter{tocdepth}{1}
164 <xsl:when test="$usexelatex='yes'">
165 <xsl:text>% Graphicx package is loaded by xltxtra</xsl:text>
166 <xsl:value-of select="$newline" />
169 <xsl:text>\usepackage[pdftex]{graphicx}</xsl:text>
170 <xsl:value-of select="$newline" />
175 % The eso-pic package helps put objects on the background of pages, without
176 % respecting margins. This is what we use for the bearer scroll
180 % needed for using \centering in tabular environment
181 \newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
189 <!-- Review in ../l10n/i18n-pdf.xml but for the meantime define like this -->
191 <xsl:when test="$usexelatex='yes'">
193 % Polyglossia replaces Babel:
194 \usepackage{polyglossia}
195 \setdefaultlanguage{spanish}
199 <xsl:value-of select="$i18n[@src='include babel package']"/>
206 \definecolor{titlecolor}{rgb}{</xsl:text><xsl:value-of select="$title-color" /><xsl:text>}
207 \definecolor{lightgray}{gray}{0.75}
209 %% headers and footers %%
210 \usepackage{fancyhdr}
212 \renewcommand{\chaptermark}[1]{}
213 \renewcommand{\sectionmark}[1]{}
216 \ifthenelse{\boolean{@twoside}}%
218 \fancyhead[CO]{\iffloatpage{}{</xsl:text><xsl:value-of select="/gamebook/meta/creator[@class='short']" /><xsl:text>}}
219 \fancyhead[CE]{\iffloatpage{}{\bfseries </xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>}}
220 \fancyhead[LO,RE]{\iffloatpage{}{\thepage}}%
223 \fancyhead[C]{\iffloatpage{}{\bfseries{</xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>:} \normalfont{</xsl:text><xsl:value-of select="/gamebook/meta/creator[@class='short']" /><xsl:text>}}}
224 \fancyhead[R]{\iffloatpage{}{\thepage}}}
225 \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}%
228 \fancypagestyle{plain}{
230 \renewcommand{\headrulewidth}{0pt}
233 \fancypagestyle{empty}{
235 \renewcommand{\headrulewidth}{0pt}
238 % support for PDF metadata not supported by hyperref package
239 \usepackage{hyperxmp}
240 %% hyper-references %%
243 <xsl:when test="$usexelatex='yes'">
244 <xsl:text>\usepackage[xetex,colorlinks=false,bookmarks=true]{hyperref}</xsl:text>
245 <xsl:value-of select="$newline" />
248 <xsl:text>\usepackage[pdftex,colorlinks=false,pdfborder=0 0 0,bookmarks=true]{hyperref}</xsl:text>
249 <xsl:value-of select="$newline" />
254 pdftitle={</xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>},
255 pdfauthor={</xsl:text>
256 <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
257 <xsl:value-of select="$i18n[@src=' Published by ']"/>
258 <xsl:apply-templates select="/gamebook/meta/publisher[1]" />
260 pdfcopyright={</xsl:text>
261 <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
262 <xsl:value-of select="$i18n[@src=' Published by ']"/>
263 <xsl:apply-templates select="/gamebook/meta/publisher[1]" />
265 pdflicenseurl={http://www.projectaon.org/en/Main/License},
266 %% We need a meta-variable for the series in order to include it here:
267 pdfsubject={Lone Wolf Series},
268 pdfkeywords={lone wolf, project aon}
273 \usepackage{multicol}
275 % provides environments for changing the spacing
276 \usepackage{setspace}
278 % package ellipsis provides an ellipsis with even spacing before and after the ellipsis
279 \usepackage{ellipsis}
281 %% new environments %%
282 \newenvironment{aonchoice}{\begin{list}{}{\setlength{\topsep}{0pt}} \item}{\end{list}}
283 \newenvironment{aoncombat}{\begin{list}{}{\setlength{\topsep}{0pt}} \item}{\end{list}}
284 \newenvironment{aonitemize}{\begin{list}{}{\setlength{\topsep}{0pt} \setlength{\parsep}{0pt} \setlength{\itemsep}{0pt}}}{\end{list}}
285 \newenvironment{aonordereditemize}{\begin{list}{\arabic{aoncounter}.}{\usecounter{aoncounter} \setlength{\topsep}{0pt} \setlength{\parsep}{0pt} \setlength{\itemsep}{0pt}}}{\end{list}}
286 \newcounter{aoncounter}
289 \newcommand{\lightgraybox}[2]{{\fboxsep0pt%
290 \colorbox{lightgray}{\makebox(#1,#2){}}}}
292 % set the general style for all sectioning titles
293 \setkomafont{sectioning}{\normalcolor\bfseries}
295 % set the color of the title
296 \addtokomafont{title}{\color{titlecolor}}
298 % set layout of footnotes
299 \deffootnote{1em}{1em}{\textsuperscript{\thefootnotemark}}
301 % define the height of the large illustrations
302 \newlength{\figureheight}
303 \setlength{\figureheight}{\textheight+\headsep+\headheight/2}
305 % mark overfull lines; comment out to disable the marker
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311 \title{</xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>}
312 \author{</xsl:text><xsl:apply-templates select="/gamebook/meta/creator[@class='medium']/line" /><xsl:text>}
320 \vspace*{\stretch{0.7}}
322 \Huge{\textcolor{titlecolor}{\textbf{</xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>}}} \vspace{-0.8em}\\
324 \vspace*{\stretch{1}}
325 \normalsize{</xsl:text><xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" /><xsl:text>}
327 \vspace*{\stretch{1.3}}
333 \vspace*{\stretch{1}}
336 <xsl:text>\uppertitleback{</xsl:text>
337 <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
338 <xsl:text>}</xsl:text>
340 <xsl:value-of select="$newparagraph" />
342 <xsl:text>\lowertitleback{</xsl:text>
343 <xsl:value-of select="$newline" />
344 <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']/p/line" />
346 <xsl:value-of select="$newline" />
347 <xsl:text>~\\</xsl:text>
348 <xsl:value-of select="$newline" />
350 <xsl:value-of select="$i18n[@src='Publication Date: ']"/>
352 <xsl:variable name="date-string">
353 <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
354 <xsl:text>-</xsl:text>
355 <xsl:if test="/gamebook/meta/date[@class='publication']/month < 10">
356 <xsl:text>0</xsl:text>
358 <xsl:value-of select="/gamebook/meta/date[@class='publication']/month" />
359 <xsl:text>-</xsl:text>
360 <xsl:if test="/gamebook/meta/date[@class='publication']/day < 10">
361 <xsl:text>0</xsl:text>
363 <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
366 <xsl:call-template name="date:format-date-localized">
367 <xsl:with-param name="date-time" select="$date-string" />
368 <xsl:with-param name="pattern" select="$i18n[@src='Format of publication date']" />
371 <xsl:text>\\</xsl:text>
372 <xsl:value-of select="$newparagraph" />
374 <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
375 <xsl:text>~\\</xsl:text>
376 <xsl:value-of select="$newline" />
378 <xsl:value-of select="$i18n[@src='This PDF was typeset with \LaTeX.']"/>
379 <xsl:value-of select="$newline" />
380 <xsl:text>}</xsl:text>
382 <xsl:value-of select="$newparagraph" />
384 <xsl:text>\dedication{</xsl:text>
385 <xsl:apply-templates select="/gamebook/section/data/section/data/p[@class='dedication']" />
386 <xsl:text>}</xsl:text>
388 <xsl:value-of select="$newparagraph" />
390 <xsl:text>\maketitle</xsl:text>
392 <xsl:value-of select="$newparagraph" />
395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Bearer Scroll %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 % The following definition is use to put the bearer scroll over the margin.
400 % Measurement is based on the English bearer scrolls (420 x 597).
401 % To prevent problems with other scrolls, the scrolls is scaled to
403 % -----------------------------------------------------------------------
404 % \thispagestyle{empty}
405 % \newlength{\bearersaveunitlength}
406 % \setlength{\bearersaveunitlength}{\unitlength}
407 % \setlength{\unitlength}{1mm}
408 %\begin{picture}(0,0)
409 % \put(-22,-180){\includegraphics[height=597pt,keepaspectratio]{bearer.pdf}}
411 % \setlength{\unitlength}{\bearersaveunitlength}
413 % -----------------------------------------------------------------------
415 % Alternate definition - [TODO] needs to be tested in English PDF builds
417 % In order to not depend on the *real* size of the PDF
418 % it is be best to have the size be strictly defined.
419 % This section uses the eso-pic package to
420 % set the bearer scroll as a background picture, centered and
421 % scaled to fit in the page.
422 \AddToShipoutPicture*{
424 \parbox[b][\paperheight]{\paperwidth}{
427 \includegraphics[height=\paperheight,keepaspectratio]{bearer.pdf}
432 \clearpage\mbox{}\clearpage
441 % we do not need the special properties of the frontmatter, e.g.
442 % separate page numbering with Roman numbers; so we omit the command
447 <xsl:text>\addchap{</xsl:text>
448 <xsl:value-of select="$i18n[@src='About the Author and Illustrator']"/>
449 <xsl:text>}</xsl:text>
451 <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
453 <xsl:apply-templates select="data/section[@class='frontmatter']" />
457 % we do not use \frontmatter; so we omit the command \mainmatter as well
461 <xsl:if test="data/section[@class='mainmatter']">
462 <xsl:apply-templates select="data/section[@class='mainmatter']" />
465 <xsl:if test="data/section[@class='numbered']">
466 <xsl:apply-templates select="data/section[@class='numbered']" />
473 \ifthenelse{\boolean{@twoside}}%
481 \setcounter{topnumber}{6}
482 \renewcommand{\topfraction}{1}
483 \renewcommand{\textfraction}{0}
484 \setlength{\floatsep}{10pt}
488 <!-- insert the backmatter sections in the following order -->
490 <xsl:apply-templates select="data/section[@class='backmatter' and @id='action']" />
491 <xsl:apply-templates select="data/section[@class='backmatter' and @id='crsumary']" />
492 <xsl:apply-templates select="data/section[@class='backmatter' and @id='crtable']" />
493 <xsl:apply-templates select="data/section[@class='backmatter' and @id='random']" />
494 <xsl:apply-templates select="data/section[@class='backmatter' and @id='errata']" />
495 <xsl:apply-templates select="data/section[@class='backmatter' and @id='license']" />
496 <xsl:apply-templates select="data/section[@class='backmatter' and @id='map']" />
505 <xsl:template match="/gamebook/section[@id='toc']" />
507 <xsl:template match="section" />
509 <!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
511 <xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
513 <xsl:value-of select="$newline" />
515 <xsl:text>\addchap{</xsl:text>
516 <xsl:apply-templates select="meta/title[1]" />
517 <xsl:text>}</xsl:text>
518 <xsl:text>\hypertarget{</xsl:text>
519 <xsl:value-of select="@id" />
520 <xsl:text>}{}</xsl:text>
521 <xsl:value-of select="$newparagraph" />
523 <xsl:apply-templates />
528 <!-- override the above for the dedication section -->
529 <!-- do nothing; the dedication is explicitly handled by <xsl:template match="/gamebook/section[@id='title']"> -->
530 <xsl:template match="/gamebook/section/data/section[@class='frontmatter' and @id='dedicate']" />
533 <!-- :::::::::::: third-level front matter sections ::::::::::::: -->
535 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
537 <xsl:value-of select="$newline" />
539 <xsl:text>\addsec{</xsl:text>
540 <xsl:apply-templates select="meta/title[1]" />
541 <xsl:text>}</xsl:text>
542 <xsl:text>\hypertarget{</xsl:text>
543 <xsl:value-of select="@id" />
544 <xsl:text>}{}</xsl:text>
545 <xsl:value-of select="$newparagraph" />
547 <xsl:apply-templates />
552 <!-- override the above for the Credits section of the Acknowledgements chapter -->
553 <!-- do not add the title of the Credits section -->
554 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter' and @id='credits']">
555 <xsl:apply-templates />
559 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
561 <xsl:value-of select="$newline" />
564 <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
567 <xsl:text>\addsec{</xsl:text>
568 <xsl:apply-templates select="meta/title[1]" />
569 <xsl:text>}</xsl:text>
570 <xsl:text>\hypertarget{</xsl:text>
571 <xsl:value-of select="@id" />
572 <xsl:text>}{}</xsl:text>
573 <xsl:value-of select="$newparagraph" />
575 <xsl:apply-templates />
579 <!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
581 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
583 <xsl:value-of select="$newline" />
585 <xsl:text>\subsection*{</xsl:text>
586 <xsl:apply-templates select="meta/title[1]" />
587 <xsl:text>}</xsl:text>
588 <xsl:text>\hypertarget{</xsl:text>
589 <xsl:value-of select="@id" />
590 <xsl:text>}{}</xsl:text>
591 <xsl:value-of select="$newparagraph" />
593 <xsl:apply-templates />
597 <!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
599 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
600 <xsl:text>{\large \hypertarget{</xsl:text>
601 <xsl:value-of select="@id" />
602 <xsl:text>}{</xsl:text>
603 <xsl:apply-templates select="meta/title[1]" />
604 <xsl:text>}}</xsl:text>
605 <xsl:value-of select="$newparagraph" />
607 <xsl:apply-templates />
610 <!-- ::::::::::: second-level main matter sections :::::::::::::: -->
612 <xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
613 <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
614 <xsl:value-of select="$newparagraph" />
616 <xsl:text>{\huge \hypertarget{</xsl:text>
617 <xsl:value-of select="@id" />
618 <xsl:text>}{</xsl:text>
619 <xsl:apply-templates select="meta/title[1]" />
620 <xsl:text>}}</xsl:text>
621 <xsl:value-of select="$newline" />
622 <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
623 <xsl:apply-templates select="meta/title[1]" />
624 <xsl:text>}}</xsl:text>
625 <xsl:value-of select="$newparagraph" />
627 <xsl:apply-templates />
631 <!-- :::::::::::: third-level main matter sections ::::::::::::: -->
633 <xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter'] | /gamebook/section/data/section/data/section[@class='mainmatter-separate']">
635 <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
636 <xsl:text>{\LARGE \hypertarget{</xsl:text>
637 <xsl:value-of select="@id" />
638 <xsl:text>}{</xsl:text>
639 <xsl:apply-templates select="meta/title[1]" />
640 <xsl:text>}}</xsl:text>
641 <xsl:value-of select="$newline" />
642 <xsl:text>\addcontentsline{toc}{subsection}{\protect\numberline{}{</xsl:text>
643 <xsl:apply-templates select="meta/title[1]" />
644 <xsl:text>}}</xsl:text>
645 <xsl:value-of select="$newparagraph" />
647 <xsl:apply-templates />
650 <!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
652 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter'] | /gamebook/section/data/section/data/section/data/section[@class='mainmatter-separate']">
653 <xsl:text>{\Large \hypertarget{</xsl:text>
654 <xsl:value-of select="@id" />
655 <xsl:text>}{</xsl:text>
656 <xsl:apply-templates select="meta/title[1]" />
657 <xsl:text>}}</xsl:text>
658 <xsl:value-of select="$newparagraph" />
660 <xsl:apply-templates />
663 <!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
665 <xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
666 <xsl:text>{\large \hypertarget{</xsl:text>
667 <xsl:value-of select="@id" />
668 <xsl:text>}{</xsl:text>
669 <xsl:apply-templates select="meta/title[1]" />
670 <xsl:text>}}</xsl:text>
671 <xsl:value-of select="$newparagraph" />
673 <xsl:apply-templates />
676 <!-- :::::::::::: third-level glossary sections ::::::::::::: -->
677 <!-- Glossary sections should be contained in a second level section. -->
679 <xsl:template match="/gamebook/section/data/section/data/section[@class='glossary'] | /gamebook/section/data/section/data/section[@class='glossary-separate']">
681 <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
682 <xsl:text>{\LARGE \hypertarget{</xsl:text>
683 <xsl:value-of select="@id" />
684 <xsl:text>}{</xsl:text>
685 <xsl:apply-templates select="meta/title[1]" />
686 <xsl:text>}}</xsl:text>
687 <xsl:value-of select="$newparagraph" />
689 <xsl:apply-templates />
692 <!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
694 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
695 <xsl:text>\cleardoublepage</xsl:text>
696 <xsl:value-of select="$newparagraph" />
698 <xsl:if test="position() = 1">
699 <xsl:text>\newcommand{\aonmarks}{
700 \ifthenelse{\equal{\leftmark}{\rightmark}}
702 {\rightmark{} - \leftmark}
703 \ifthenelse{\boolean{@twoside}}%
705 \fancyhead[RO,LE]{\iffloatpage{}{\large{\bfseries \aonmarks}}}
706 \fancyhead[LO,RE]{\iffloatpage{}{\thepage}}}
708 \fancyhead[R]{\iffloatpage{}{\large{\bfseries \aonmarks}}}
709 \fancyhead[L]{\iffloatpage{}{\thepage}}%
712 <xsl:value-of select="$newparagraph" />
716 <xsl:when test="not( self::node()[@id='numbered'] )">
717 <xsl:text>\addchap[</xsl:text>
718 <xsl:apply-templates select="meta/title[1]" />
719 <xsl:text>]{\hfill{}</xsl:text>
720 <xsl:apply-templates select="meta/title[1]" />
721 <xsl:text>\hfill}</xsl:text>
722 <xsl:text>\hypertarget{</xsl:text>
723 <xsl:value-of select="@id" />
724 <xsl:text>}{}</xsl:text>
727 <xsl:text>\phantomsection</xsl:text>
728 <xsl:text>\hypertarget{</xsl:text>
729 <xsl:value-of select="@id" />
730 <xsl:text>}{}</xsl:text>
731 <xsl:value-of select="$newline" />
732 <xsl:text>\addcontentsline{toc}{chapter}{\protect{</xsl:text>
733 <xsl:apply-templates select="meta/title[1]" />
734 <xsl:text>}}</xsl:text>
738 <xsl:value-of select="$newparagraph" />
740 <xsl:apply-templates />
742 <xsl:value-of select="$newparagraph" />
743 <xsl:text>\cleardoublepage</xsl:text>
744 <xsl:value-of select="$newparagraph" />
748 <xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']">
750 <xsl:variable name="section-title" select="meta/title[1]" />
752 <xsl:value-of select="$newline" />
754 <xsl:text>\addsec[</xsl:text>
755 <xsl:value-of select="$i18n[@src='Section']" />
756 <xsl:text> </xsl:text>
757 <xsl:value-of select="$section-title" />
758 <xsl:text>]{\hspace*{\fill}</xsl:text>
759 <xsl:text>\hypertarget{</xsl:text>
760 <xsl:value-of select="@id" />
761 <xsl:text>}{}</xsl:text>
762 <xsl:value-of select="$section-title" />
763 <xsl:text>\hspace*{\fill}}</xsl:text>
764 <xsl:value-of select="$newparagraph" />
766 <xsl:for-each select="data/illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]">
767 <xsl:text>\hspace*{\fill} \mbox{\itshape \hyperlink{ill</xsl:text>
768 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
769 <xsl:text>}{</xsl:text>
770 <xsl:value-of select="$i18n[@src='Illustration']" />
771 <xsl:text>~</xsl:text>
772 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
773 <xsl:text>}}\hspace*{\fill}\\*[\parskip]</xsl:text>
774 <xsl:value-of select="$newline" />
776 <!-- insert the illustration -->
777 <xsl:text>\begin{figure}[p]</xsl:text>
778 <xsl:value-of select="$newline" />
779 <xsl:text>\centering</xsl:text>
780 <xsl:value-of select="$newline" />
781 <xsl:text>\hypertarget{ill</xsl:text>
782 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
783 <xsl:text>}{}</xsl:text>
784 <xsl:value-of select="$newline" />
785 <xsl:text>\raisebox{0cm}[\textheight]{</xsl:text>
786 <xsl:text>\includegraphics[width=\textwidth,height=\figureheight,keepaspectratio]{</xsl:text>
787 <xsl:value-of select="instance[@class='pdf']/@src" />
788 <xsl:text>}</xsl:text>
789 <xsl:text>}%</xsl:text>
790 <xsl:value-of select="$newline" />
791 <xsl:text>\\{\itshape </xsl:text>
792 <xsl:apply-templates select="meta/description" />
793 <xsl:text>}</xsl:text>
794 <xsl:value-of select="$newline" />
795 <xsl:text>\end{figure}</xsl:text>
796 <xsl:value-of select="$newline" />
799 <xsl:apply-templates />
803 <!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
805 <xsl:template match="/gamebook/section/data/section[@class='backmatter']">
807 <xsl:value-of select="$newline" />
809 <xsl:text>\addchap{</xsl:text>
810 <xsl:apply-templates select="meta/title[1]" />
811 <xsl:text>}</xsl:text>
812 <xsl:text>\hypertarget{</xsl:text>
813 <xsl:value-of select="@id" />
814 <xsl:text>}{}</xsl:text>
815 <xsl:value-of select="$newparagraph" />
817 <xsl:apply-templates />
822 <!-- override the above for the Footnotes section -->
823 <!-- do nothing; we do not want a Footnotes in the PDF -->
824 <xsl:template match="/gamebook/section/data/section[@class='backmatter' and @id='footnotz']" />
826 <!-- override the above for the Table of Illustrations section -->
827 <!-- do nothing; we do not want a Table of Illustrations in the PDF -->
828 <xsl:template match="/gamebook/section/data/section[@class='backmatter' and @id='illstrat']" />
830 <xsl:template match="/gamebook/section/data/section[@class='backmatter' and ( @id='license' or @id='errata' )]">
831 <xsl:value-of select="$newline" />
833 <xsl:text>\addchap{</xsl:text>
834 <xsl:apply-templates select="meta/title[1]" />
835 <xsl:text>}</xsl:text>
836 <xsl:text>\hypertarget{</xsl:text>
837 <xsl:value-of select="@id" />
838 <xsl:text>}{}</xsl:text>
839 <xsl:value-of select="$newparagraph" />
842 \addtokomafont{section}{\scriptsize}
843 \addtokomafont{paragraph}{\tiny}
848 <xsl:apply-templates />
852 \addtokomafont{section}{\Large}
853 \addtokomafont{paragraph}{\normalsize}
859 <!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
861 <xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
863 <xsl:value-of select="$newline" />
865 <xsl:text>\addsec*{</xsl:text>
866 <xsl:apply-templates select="meta/title[1]" />
867 <xsl:text>}</xsl:text>
868 <xsl:text>\hypertarget{</xsl:text>
869 <xsl:value-of select="@id" />
870 <xsl:text>}{}</xsl:text>
871 <xsl:value-of select="$newparagraph" />
873 <xsl:apply-templates />
877 <!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
879 <xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
881 <xsl:value-of select="$newline" />
883 <xsl:text>\subsection*{</xsl:text>
884 <xsl:apply-templates select="meta/title[1]" />
885 <xsl:text>}</xsl:text>
886 <xsl:text>\hypertarget{</xsl:text>
887 <xsl:value-of select="@id" />
888 <xsl:text>}{}</xsl:text>
889 <xsl:value-of select="$newline" />
891 <xsl:value-of select="$newparagraph" />
893 <xsl:apply-templates />
898 <xsl:template match="/gamebook/section/data/section[@id='license']/data/section/data/section[@class='backmatter']">
899 <xsl:value-of select="$newline" />
901 <xsl:text>\paragraph*{</xsl:text>
902 <xsl:apply-templates select="meta/title[1]" />
903 <xsl:text>}</xsl:text>
904 <xsl:text>\hypertarget{</xsl:text>
905 <xsl:value-of select="@id" />
906 <xsl:text>}{}</xsl:text>
907 <xsl:value-of select="$newparagraph" />
909 <xsl:apply-templates />
913 <!-- :::::::::::::::::: dedication template ::::::::::::::::::::: -->
915 <xsl:template match="p[@class='dedication']">
916 <xsl:apply-templates />
919 <!-- ::::::::::::::::::::: map template ::::::::::::::::::::::::: -->
921 <xsl:template match="/gamebook/section/data/section[@id='map']">
922 <xsl:variable name="map-title" select="meta/title" />
924 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
925 <xsl:value-of select="$newline" />
926 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Map %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
927 <xsl:value-of select="$newline" />
928 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
929 <xsl:value-of select="$newparagraph" />
931 <xsl:text>\clearpage</xsl:text>
932 <xsl:value-of select="$newline" />
933 <xsl:text>\ifthispageodd{\thispagestyle{empty}~\clearpage}{}</xsl:text>
934 <xsl:value-of select="$newparagraph" />
936 <xsl:for-each select="data/illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]">
937 <xsl:variable name="illustration-src" select="instance[@class='pdf']/@src" />
939 <xsl:text>\phantomsection\hypertarget{map}{}</xsl:text>
940 <xsl:value-of select="$newline" />
941 <xsl:text>\addcontentsline{toc}{chapter}{\protect{</xsl:text>
942 <xsl:value-of select="$map-title" />
943 <xsl:text>}}</xsl:text>
944 <xsl:value-of select="$newparagraph" />
947 \thispagestyle{empty}
948 \newlength{\saveunitlength}
949 \setlength{\saveunitlength}{\unitlength}
950 \setlength{\unitlength}{1mm}
951 \ifthenelse{\boolean{@twoside}}%
953 \begin{picture}(10,10)
954 \put(-0.5,-170){\includegraphics[origin=c,width=28cm,height=20cm,keepaspectratio]{</xsl:text><xsl:value-of select="$illustration-src" /><xsl:text>}}
957 \thispagestyle{empty}
958 \begin{picture}(10,10)
959 \put(-151.23,-170){\includegraphics[origin=c,width=28cm,height=20cm,keepaspectratio]{</xsl:text><xsl:value-of select="$illustration-src" /><xsl:text>}}
963 \begin{picture}(10,10)
964 \put(-29,-188){\includegraphics[angle=90,origin=c,width=20cm,height=28cm,keepaspectratio]{</xsl:text><xsl:value-of select="$illustration-src" /><xsl:text>}}
967 \setlength{\unitlength}{\saveunitlength}</xsl:text>
968 <xsl:value-of select="$newparagraph" />
972 <!-- :::::::::::::::::: action chart template ::::::::::::::::::: -->
974 <!-- TODO: This definition only works if the PDF image is exactly
975 one page in its size. This definition could be similar to the
976 bearer scroll above -->
977 <xsl:template match="/gamebook/section/data/section[@id='action']">
980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Action Chart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
985 \ifthispageodd{\thispagestyle{empty}~\clearpage}{}
987 \newlength{\acsaveunitlength}
988 \setlength{\acsaveunitlength}{\unitlength}
989 \setlength{\unitlength}{1mm}
991 \phantomsection\hypertarget{action}{}
992 \addcontentsline{toc}{chapter}{\protect{</xsl:text><xsl:apply-templates select="meta/title[1]" /><xsl:text>}}</xsl:text>
993 <xsl:value-of select="$newparagraph" />
995 <xsl:for-each select="data/illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]/instance[@class='pdf']">
996 <xsl:variable name="src" select="@src" />
997 <xsl:variable name="posx" select="@posx" />
998 <xsl:variable name="posy" select="@posy" />
1000 <xsl:text>\thispagestyle{empty}</xsl:text>
1001 <xsl:value-of select="$newline" />
1002 <xsl:text>\begin{picture}(0,0)</xsl:text>
1003 <xsl:value-of select="$newline" />
1004 <xsl:text> \put(</xsl:text><xsl:value-of select="$posx" /><xsl:text>,</xsl:text>
1005 <xsl:value-of select="$posy" /><xsl:text>){\includegraphics{</xsl:text>
1006 <xsl:value-of select="$src" /><xsl:text>}}</xsl:text>
1007 <xsl:value-of select="$newline" />
1008 <xsl:text>\end{picture}%</xsl:text>
1009 <xsl:value-of select="$newline" />
1010 <xsl:text>\clearpage</xsl:text>
1011 <xsl:value-of select="$newparagraph" />
1014 <xsl:text>\setlength{\unitlength}{\acsaveunitlength}</xsl:text>
1015 <xsl:value-of select="$newparagraph" />
1019 <!-- :::::::::::::: combat results table template ::::::::::::::: -->
1021 <xsl:template match="/gamebook/section/data/section[@id='crtable']">
1023 <xsl:text>\clearpage</xsl:text>
1024 <xsl:value-of select="$newline" />
1025 <xsl:text>\ifthispageodd{\thispagestyle{empty}~\clearpage}{}</xsl:text>
1026 <xsl:value-of select="$newparagraph" />
1028 <xsl:text>\phantomsection\hypertarget{crtable}{}</xsl:text>
1029 <xsl:value-of select="$newline" />
1030 <xsl:text>\addcontentsline{toc}{chapter}{\protect{</xsl:text>
1031 <xsl:apply-templates select="meta/title[1]" />
1032 <xsl:text>}}</xsl:text>
1033 <xsl:value-of select="$newparagraph" />
1036 <xsl:when test="data/illustration/instance[@class='text']">
1037 <xsl:text>\thispagestyle{empty}</xsl:text>
1038 <xsl:value-of select="$newparagraph" />
1039 <xsl:call-template name="combat-ratio-table">
1040 <xsl:with-param name="title"><xsl:value-of select="$i18n[@src='Negative Combat Ratio']" /></xsl:with-param>
1041 <xsl:with-param name="startCol" select="1" />
1042 <xsl:with-param name="endCol" select="7" />
1043 <xsl:with-param name="colHeaders">
1044 <th><xsl:text>\shortstack{\footnotesize \textbf{-11} </xsl:text><xsl:value-of select="$i18n[@src='or (as in -11 or less)']" /><xsl:text>\\ \footnotesize </xsl:text><xsl:value-of select="$i18n[@src='less (as in -11 or less)']" /><xsl:text>}</xsl:text></th>
1045 <th><xsl:text>\footnotesize \bfseries -10/-9</xsl:text></th>
1046 <th><xsl:text>\footnotesize \bfseries -8/-7</xsl:text></th>
1047 <th><xsl:text>\footnotesize \bfseries -6/-5</xsl:text></th>
1048 <th><xsl:text>\footnotesize \bfseries -4/-3</xsl:text></th>
1049 <th><xsl:text>\footnotesize \bfseries -2/-1</xsl:text></th>
1050 <th><xsl:text>\footnotesize \bfseries 0</xsl:text></th>
1052 <xsl:with-param name="showLeftLabel" select="1" />
1053 </xsl:call-template>
1054 <xsl:text>\clearpage</xsl:text>
1055 <xsl:value-of select="$newparagraph" />
1056 <xsl:text>\thispagestyle{empty}</xsl:text>
1057 <xsl:value-of select="$newparagraph" />
1058 <xsl:call-template name="combat-ratio-table">
1059 <xsl:with-param name="title"><xsl:value-of select="$i18n[@src='Positive Combat Ratio']" /></xsl:with-param>
1060 <xsl:with-param name="startCol" select="7" />
1061 <xsl:with-param name="endCol" select="13" />
1062 <xsl:with-param name="colHeaders">
1063 <th><xsl:text>\footnotesize \bfseries 0</xsl:text></th>
1064 <th><xsl:text>\footnotesize \bfseries 1/2</xsl:text></th>
1065 <th><xsl:text>\footnotesize \bfseries 3/4</xsl:text></th>
1066 <th><xsl:text>\footnotesize \bfseries 5/6</xsl:text></th>
1067 <th><xsl:text>\footnotesize \bfseries 7/8</xsl:text></th>
1068 <th><xsl:text>\footnotesize \bfseries 9/10</xsl:text></th>
1069 <th><xsl:text>\shortstack{\footnotesize \textbf{11} </xsl:text><xsl:value-of select="$i18n[@src='or (as in 11 or greater)']" /><xsl:text>\\ \footnotesize </xsl:text><xsl:value-of select="$i18n[@src='greater (as in 11 or greater)']" /><xsl:text>}</xsl:text></th>
1071 <xsl:with-param name="showRightLabel" select="1" />
1072 </xsl:call-template>
1075 <xsl:message terminate="yes">
1076 Error: Instance of random number table of class 'text' is missing.
1083 <!-- ::::::::::::::: random number table template ::::::::::::::: -->
1085 <xsl:template match="/gamebook/section/data/section[@id='random']">
1086 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
1087 <xsl:value-of select="$newline" />
1088 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Random Number Table %%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
1089 <xsl:value-of select="$newline" />
1090 <xsl:text>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</xsl:text>
1091 <xsl:value-of select="$newparagraph" />
1093 <xsl:text>\clearpage</xsl:text>
1094 <xsl:value-of select="$newline" />
1095 <xsl:text>\thispagestyle{empty}</xsl:text>
1096 <xsl:value-of select="$newparagraph" />
1098 <xsl:text>\phantomsection\begin{center}\hypertarget{random}{{\usekomafont{disposition}\usekomafont{chapter}</xsl:text>
1099 <xsl:apply-templates select="meta/title[1]" />
1100 <xsl:text>}}\end{center}</xsl:text>
1101 <xsl:value-of select="$newline" />
1102 <xsl:text>\addcontentsline{toc}{chapter}{\protect{</xsl:text>
1103 <xsl:apply-templates select="meta/title[1]" />
1104 <xsl:text>}}</xsl:text>
1105 <xsl:value-of select="$newparagraph" />
1108 <xsl:when test="data/illustration/instance[@class='text']">
1109 <!-- use a dummy value for the width of the picture environment -->
1111 \setlength{\unitlength}{1mm}
1112 \noindent\begin{picture}(10,</xsl:text><xsl:value-of select="10 * number($RNTHeightOfBox)" /><xsl:text>)(</xsl:text><xsl:value-of select="-1 * number($RNTOffsetX)" /><xsl:text>,</xsl:text><xsl:value-of select="-1 * number($RNTOffsetY)" /><xsl:text>)
1113 \linethickness{0.25mm}
1116 \multiput(0,0)(0,</xsl:text><xsl:value-of select="2 * number($RNTHeightOfBox)" /><xsl:text>){5}{%
1117 \multiput(0,0)(</xsl:text><xsl:value-of select="2 * number($RNTWidthOfBox)" /><xsl:text>,0){5}{\lightgraybox{</xsl:text><xsl:value-of select="$RNTWidthOfBox" /><xsl:text>}{</xsl:text><xsl:value-of select="$RNTHeightOfBox" /><xsl:text>}}%
1119 \multiput(0,</xsl:text><xsl:value-of select="$RNTHeightOfBox" /><xsl:text>)(0,</xsl:text><xsl:value-of select="2 * number($RNTHeightOfBox)" /><xsl:text>){5}{%
1120 \multiput(</xsl:text><xsl:value-of select="$RNTWidthOfBox" /><xsl:text>,0)(</xsl:text><xsl:value-of select="2 * number($RNTWidthOfBox)" /><xsl:text>,0){5}{\lightgraybox{</xsl:text><xsl:value-of select="$RNTWidthOfBox" /><xsl:text>}{</xsl:text><xsl:value-of select="$RNTHeightOfBox" /><xsl:text>}}%
1124 \multiput(0,0)(0,</xsl:text><xsl:value-of select="$RNTHeightOfBox" /><xsl:text>){11}{%
1125 \line(1,0){</xsl:text><xsl:value-of select="10 * number($RNTWidthOfBox)" /><xsl:text>}%
1127 \multiput(0,0)(</xsl:text><xsl:value-of select="$RNTWidthOfBox" /><xsl:text>,0){11}{%
1128 \line(0,1){</xsl:text><xsl:value-of select="10 * number($RNTHeightOfBox)" /><xsl:text>}%
1131 %% Numbers %%</xsl:text>
1132 <xsl:value-of select="$newline" />
1133 <xsl:for-each select="data/illustration/instance[@class='text']/table/tr">
1134 <xsl:variable name="row"><xsl:number value="position()" format="1" /></xsl:variable>
1135 <xsl:text> %% row </xsl:text><xsl:value-of select="$row" /><xsl:text> %%</xsl:text>
1136 <xsl:value-of select="$newline" />
1137 <xsl:for-each select="./td">
1138 <xsl:variable name="col"><xsl:number value="position()" format="1" /></xsl:variable>
1139 <xsl:text> \put(</xsl:text><xsl:value-of select="number($col) * number($RNTWidthOfBox) - number($RNTWidthOfBox) div 2" /><xsl:text>,</xsl:text><xsl:value-of select="(10 - number($row)) * number($RNTHeightOfBox) + number($RNTHeightOfBox) div 2" /><xsl:text>){\makebox(0,0){\bfseries \Huge </xsl:text><xsl:value-of select="." /><xsl:text>}}</xsl:text>
1140 <xsl:value-of select="$newline" />
1143 <xsl:value-of select="$newline" />
1144 <xsl:text>\end{picture}</xsl:text>
1145 <xsl:value-of select="$newline" />
1146 <xsl:text>\setlength{\unitlength}{1pt}</xsl:text>
1147 <xsl:value-of select="$newparagraph" />
1150 <xsl:message terminate="yes">
1151 Error: Instance of random number table of class 'text' is missing.
1158 <!-- ==================== block elements ======================== -->
1160 <xsl:template match="p">
1161 <xsl:apply-templates />
1163 <xsl:when test="position()!=last()">
1164 <xsl:value-of select="$newparagraph" />
1167 <xsl:value-of select="$newline" />
1172 <xsl:template match="ul">
1173 <xsl:text>\begin{aonitemize}</xsl:text><xsl:value-of select="$newline" />
1174 <xsl:apply-templates />
1175 <xsl:text>\end{aonitemize}</xsl:text>
1176 <xsl:value-of select="$newparagraph" />
1179 <xsl:template match="ul[@class='unbulleted']">
1180 <xsl:text>\begin{aonitemize}</xsl:text><xsl:value-of select="$newline" />
1181 <xsl:apply-templates />
1182 <xsl:text>\end{aonitemize}</xsl:text>
1183 <xsl:value-of select="$newparagraph" />
1186 <xsl:template match="ol">
1187 <xsl:text>\begin{aonordereditemize}</xsl:text><xsl:value-of select="$newline" />
1188 <xsl:apply-templates />
1189 <xsl:text>\end{aonordereditemize}</xsl:text>
1190 <xsl:value-of select="$newparagraph" />
1193 <xsl:template match="dl">
1194 <xsl:apply-templates />
1197 <xsl:template match="dt">
1198 <xsl:text>\minisec{</xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1199 <xsl:value-of select="$newline" />
1202 <xsl:template match="dd">
1203 <xsl:apply-templates />
1204 <xsl:value-of select="$newparagraph" />
1207 <xsl:template match="li">
1208 <xsl:text>\item </xsl:text><xsl:apply-templates />
1209 <xsl:value-of select="$newline" />
1212 <xsl:template match="table">
1213 <xsl:text>\begin{tabular}{*{</xsl:text>
1214 <xsl:for-each select="tr[1]">
1215 <xsl:value-of select="count(descendant::*[not(child::*)])" />
1217 <xsl:text>}{l}}</xsl:text>
1218 <xsl:value-of select="$newline" />
1219 <xsl:apply-templates />
1220 <xsl:text>\end{tabular}</xsl:text>
1221 <xsl:value-of select="$newparagraph" />
1224 <xsl:template match="tr">
1225 <xsl:apply-templates />
1226 <xsl:text>\\ </xsl:text>
1229 <xsl:template match="th">
1230 <xsl:text>\multicolumn{</xsl:text>
1232 <xsl:when test="@colspan!=0"><xsl:value-of select="@colspan" /></xsl:when>
1233 <xsl:otherwise><xsl:text>1</xsl:text></xsl:otherwise>
1235 <xsl:text>}{</xsl:text>
1237 <xsl:when test="@align='left'"><xsl:text>l}{\bfseries </xsl:text></xsl:when>
1238 <xsl:when test="@align='right'"><xsl:text>r}{\bfseries </xsl:text></xsl:when>
1239 <xsl:when test="@align='center'"><xsl:text>c}{\bfseries </xsl:text></xsl:when>
1240 <xsl:otherwise><xsl:text>l}{\bfseries </xsl:text></xsl:otherwise>
1242 <xsl:apply-templates />
1243 <xsl:text>} </xsl:text>
1244 <xsl:if test="position()!=last()"><xsl:text> & </xsl:text></xsl:if>
1247 <xsl:template match="td">
1248 <xsl:text>\multicolumn{</xsl:text>
1250 <xsl:when test="@colspan!=0"><xsl:value-of select="@colspan" /></xsl:when>
1251 <xsl:otherwise><xsl:text>1</xsl:text></xsl:otherwise>
1253 <xsl:text>}{</xsl:text>
1255 <xsl:when test="@align='left'"><xsl:text>l}{</xsl:text></xsl:when>
1256 <xsl:when test="@align='right'"><xsl:text>r}{</xsl:text></xsl:when>
1257 <xsl:when test="@align='center'"><xsl:text>c}{</xsl:text></xsl:when>
1258 <xsl:otherwise><xsl:text>l}{</xsl:text></xsl:otherwise>
1260 <xsl:apply-templates />
1261 <xsl:text>} </xsl:text>
1262 <xsl:if test="position()!=last()"><xsl:text> & </xsl:text></xsl:if>
1265 <xsl:template match="combat">
1266 <xsl:text>\begin{aoncombat}</xsl:text>
1267 <xsl:apply-templates select="enemy" />
1269 <xsl:when test="enemy-attribute[@class='combatskill']">
1270 <xsl:text>: {\sc </xsl:text>
1271 <xsl:value-of select="$i18n[@src='Combat~Skill']" />
1272 <xsl:text>}~</xsl:text>
1273 <xsl:value-of select="enemy-attribute[@class='combatskill']" />
1275 <xsl:when test="enemy-attribute[@class='closecombatskill']">
1276 <xsl:text>: {\sc </xsl:text>
1277 <xsl:value-of select="$i18n[@src='Close~Combat~Skill']" />
1278 <xsl:text>}~</xsl:text>
1279 <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
1283 <xsl:when test="enemy-attribute[@class='endurance']">
1284 <xsl:text> ~~{\sc </xsl:text>
1285 <xsl:value-of select="$i18n[@src='Endurance']" />
1286 <xsl:text>}~</xsl:text>
1287 <xsl:value-of select="enemy-attribute[@class='endurance']" />
1289 <xsl:when test="enemy-attribute[@class='target']">
1290 <xsl:value-of select="$i18n[@src='~({\sc Target}~points)~']" />
1291 <xsl:value-of select="enemy-attribute[@class='target']" />
1293 <xsl:when test="enemy-attribute[@class='resistance']">
1294 <xsl:value-of select="$i18n[@src='~({\sc Resistance}~points)~']" />
1295 <xsl:value-of select="enemy-attribute[@class='resistance']" />
1298 <xsl:text>\end{aoncombat}</xsl:text>
1299 <xsl:value-of select="$newparagraph" />
1302 <xsl:template match="choice">
1303 <xsl:variable name="link">
1304 <xsl:value-of select="@idref" />
1307 <xsl:text>\nopagebreak\begin{aonchoice}</xsl:text>
1308 <xsl:for-each select="* | text()">
1310 <xsl:when test="self::link-text">
1311 <xsl:text>\hyperlink{</xsl:text>
1312 <xsl:value-of select="$link" />
1313 <xsl:text>}{\bfseries </xsl:text>
1314 <xsl:apply-templates />
1315 <xsl:text>}</xsl:text>
1318 <xsl:apply-templates select="." />
1322 <xsl:text>\end{aonchoice}</xsl:text>
1323 <xsl:value-of select="$newparagraph" />
1326 <!-- "top-level" signpost element -->
1327 <xsl:template match="data/signpost">
1331 padding-bottom: 0.5em;
1334 <xsl:text>\begin{onehalfspace}\begin{center}</xsl:text>
1335 <xsl:apply-templates />
1336 <xsl:text>\end{center}\end{onehalfspace}</xsl:text>
1337 <xsl:value-of select="$newparagraph" />
1340 <!-- inline signpost element -->
1341 <xsl:template match="signpost">
1345 <xsl:text>\begin{small}</xsl:text>
1346 <xsl:apply-templates />
1347 <xsl:text>\end{small}</xsl:text>
1350 <xsl:template match="blockquote">
1351 <xsl:text>\begin{quote}</xsl:text>
1352 <xsl:apply-templates />
1353 <xsl:text>\end{quote}</xsl:text>
1354 <xsl:value-of select="$newparagraph" />
1357 <xsl:template match="poetry">
1358 <xsl:text>\begin{flushleft}</xsl:text>
1359 <xsl:value-of select="$newline" />
1360 <xsl:text>\begin{verse}</xsl:text>
1361 <xsl:value-of select="$newline" />
1362 <xsl:apply-templates />
1363 <xsl:text>\end{verse}</xsl:text>
1364 <xsl:value-of select="$newline" />
1365 <xsl:text>\end{flushleft}</xsl:text>
1366 <xsl:value-of select="$newparagraph" />
1369 <!-- special treatment of the blockquote in the License section
1370 since a quote environment does not fit -->
1371 <xsl:template match="section[@id='license']//blockquote">
1372 <xsl:text>\begin{center}</xsl:text>
1373 <xsl:value-of select="$newline" />
1374 <xsl:apply-templates />
1375 <xsl:text>\end{center}</xsl:text>
1376 <xsl:value-of select="$newparagraph" />
1379 <xsl:template match="illustration">
1381 <xsl:when test="instance[@class='pdf'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1382 <xsl:text>\begin{figure}[</xsl:text>
1384 <xsl:when test="@class='inline'">!ht</xsl:when>
1385 <xsl:when test="@class='float'">p</xsl:when>
1386 <xsl:when test="@class='accent'">bt</xsl:when>
1387 <xsl:otherwise><xsl:text>invalid class</xsl:text></xsl:otherwise>
1389 <xsl:text>]</xsl:text>
1390 <xsl:value-of select="$newline" />
1391 <xsl:text>\centering</xsl:text>
1392 <xsl:value-of select="$newline" />
1393 <xsl:if test="@class='float'">
1394 <xsl:text>\hypertarget{ill</xsl:text>
1395 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
1396 <xsl:text>}{}</xsl:text>
1397 <xsl:value-of select="$newline" />
1399 <xsl:text>\includegraphics</xsl:text>
1401 <xsl:when test="@class='inline'">
1402 <xsl:text>[width=</xsl:text>
1404 <xsl:when test="instance[@class='pdf']/@originalwidth">
1405 <xsl:value-of select="instance[@class='pdf']/@originalwidth" />
1407 <xsl:otherwise>\textwidth</xsl:otherwise>
1409 <xsl:text>,keepaspectratio]</xsl:text>
1411 <xsl:when test="@class='float'">
1412 <xsl:text>[width=\textwidth,height=\textheight,keepaspectratio]</xsl:text>
1414 <xsl:when test="@class='accent'" />
1415 <xsl:otherwise><xsl:text>invalid class</xsl:text></xsl:otherwise>
1417 <xsl:text>{</xsl:text>
1418 <xsl:value-of select="instance[@class='pdf']/@src" />
1419 <xsl:text>} %</xsl:text>
1420 <xsl:if test="@class='float'">
1421 <xsl:value-of select="$newline" />
1422 <xsl:text>\vspace*{\fill}</xsl:text>
1423 <xsl:value-of select="$newline" />
1425 <xsl:text>\\ \mbox{ \hypertarget{ill</xsl:text>
1426 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
1428 <xsl:when test="$language='es'">
1429 <xsl:text>}{Ilustración </xsl:text>
1432 <xsl:text>}{Illustration </xsl:text>
1435 <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
1436 <xsl:text>}}\\[1em]</xsl:text>
1438 <xsl:text>\\{\itshape </xsl:text>
1439 <xsl:apply-templates select="meta/description" />
1440 <xsl:text>}</xsl:text>
1442 <xsl:value-of select="$newline" />
1443 <xsl:text>\end{figure}</xsl:text>
1444 <xsl:value-of select="$newline" />
1447 <xsl:when test="instance[@class='tex'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1448 <xsl:value-of select="$newline" />
1449 <xsl:text>\begin{figure}[!h]</xsl:text>
1450 <xsl:value-of select="$newline" />
1451 <xsl:text>\centering</xsl:text>
1452 <xsl:value-of select="$newline" />
1453 <xsl:text>\input{</xsl:text><xsl:value-of select="instance[@class='tex']/@src" /><xsl:text>}</xsl:text>
1454 <xsl:value-of select="$newline" />
1455 <xsl:text>\end{figure}</xsl:text>
1456 <xsl:value-of select="$newline" />
1458 <xsl:text>\clearpage{}</xsl:text>
1459 <xsl:value-of select="$newparagraph" />
1467 <!-- override the above template for illustrations in numbered sections;
1468 they are handled by the template for numbered sections -->
1469 <xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']//illustration[@class='float']" />
1471 <!-- override the above template for illustrations for the Equipment section -->
1472 <xsl:template match="section[@id='equipmnt']//illustration[@class='inline']">
1473 <xsl:if test="instance[@class='pdf'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1474 <xsl:text>\vspace{.2\baselineskip}</xsl:text>
1475 <xsl:value-of select="$newline" />
1476 <xsl:text>\begin{center}</xsl:text>
1477 <xsl:value-of select="$newline" />
1478 <xsl:text>\includegraphics</xsl:text>
1479 <xsl:text>[width=</xsl:text>
1481 <xsl:when test="instance[@class='pdf']/@originalwidth">
1482 <xsl:value-of select="instance[@class='pdf']/@originalwidth" />
1484 <xsl:otherwise>\textwidth</xsl:otherwise>
1486 <xsl:text>,keepaspectratio]{</xsl:text>
1487 <xsl:value-of select="instance[@class='pdf']/@src" />
1488 <xsl:text>} %</xsl:text>
1489 <xsl:value-of select="$newline" />
1490 <xsl:text>\end{center}</xsl:text>
1491 <xsl:value-of select="$newline" />
1492 <xsl:text>\vspace{.2\baselineskip}</xsl:text>
1493 <xsl:value-of select="$newline" />
1497 <!-- override the above template for illustrations for the Weaponskill section -->
1498 <xsl:template match="section[@id='wepnskll']//illustration[@class='inline']">
1499 <xsl:if test="instance[@class='pdf'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1500 <xsl:text>\begin{figure}[!ht]</xsl:text>
1501 <xsl:value-of select="$newline" />
1502 <xsl:text>\centering</xsl:text>
1503 <xsl:value-of select="$newline" />
1506 \let\PBS=\PreserveBackslash
1507 \begin{tabular}{>{\PBS\centering}m{50mm}@{\hspace{0mm}}>{\PBS\centering}m{50mm}}%
1509 \rule[-1mm]{0mm}{10mm}\includegraphics[width=10.5mm,keepaspectratio]{weapons-dagger.pdf} &
1510 \rule[-1mm]{0mm}{10mm}\includegraphics[width=27mm,keepaspectratio]{weapons-sword.pdf} \\ % \hline
1511 0 = </xsl:text><xsl:value-of select="$i18n[@src='Dagger']"/><xsl:text> & 5 = </xsl:text><xsl:value-of select="$i18n[@src='Sword']"/><xsl:text> \\ % \hline
1512 \rule[-1mm]{0mm}{10mm}\includegraphics[width=39mm,keepaspectratio]{weapons-spear.pdf} &
1513 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-axe.pdf} \\ % \hline
1514 1 = </xsl:text><xsl:value-of select="$i18n[@src='Spear']"/><xsl:text> & 6 = </xsl:text><xsl:value-of select="$i18n[@src='Axe']"/><xsl:text> \\ % \hline
1515 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-mace.pdf} &
1516 \rule[-1mm]{0mm}{10mm}\includegraphics[width=27mm,keepaspectratio]{weapons-sword.pdf} \\ % \hline
1517 2 = </xsl:text><xsl:value-of select="$i18n[@src='Mace']"/><xsl:text> & 7 = </xsl:text><xsl:value-of select="$i18n[@src='Sword']"/><xsl:text> \\ % \hline
1518 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-shortsword.pdf} &
1519 \rule[-1mm]{0mm}{10mm}\includegraphics[width=43.5mm,keepaspectratio]{weapons-quarterstaff.pdf} \\ % \hline
1520 3 = </xsl:text><xsl:value-of select="$i18n[@src='Short Sword']"/><xsl:text> & 8 = </xsl:text><xsl:value-of select="$i18n[@src='Quarterstaff']"/><xsl:text> \\ % \hline
1521 \rule[-1mm]{0mm}{10mm}\includegraphics[width=16mm,keepaspectratio]{weapons-warhammer.pdf} &
1522 \rule[-1mm]{0mm}{10mm}\includegraphics[width=33mm,keepaspectratio]{weapons-broadsword.pdf} \\ % \hline
1523 4 = </xsl:text><xsl:value-of select="$i18n[@src='Warhammer']"/><xsl:text> & 9 = </xsl:text><xsl:value-of select="$i18n[@src='Broadsword']"/><xsl:text> \\ % \hline
1528 <xsl:for-each select="instance[@class='pdf']/table/tr">
1529 <xsl:variable name="row"><xsl:number value="position()" format="1" /></xsl:variable>
1531 <xsl:text> %% row </xsl:text><xsl:value-of select="$row" /><xsl:text> %%</xsl:text>
1532 <xsl:value-of select="$newline" />
1533 <xsl:for-each select="./td">
1534 <xsl:variable name="col"><xsl:number value="position()" format="1" /></xsl:variable>
1535 <xsl:text> \put(</xsl:text><xsl:value-of select="number($col) * number($RNTWidthOfBox) - number($RNTWidthOfBox) div 2" /><xsl:text>,</xsl:text><xsl:value-of select="(10 - number($row)) * number($RNTHeightOfBox) + number($RNTHeightOfBox) div 2" /><xsl:text>){\makebox(0,0){\bfseries \Huge </xsl:text><xsl:value-of select="." /><xsl:text>}}</xsl:text>
1536 <xsl:value-of select="$newline" />
1541 <xsl:text>\end{figure}</xsl:text>
1542 <xsl:value-of select="$newline" />
1546 <!-- override the above template for illustrations for the Weaponmastery section -->
1547 <xsl:template match="section[@id='wpnmstry']//illustration[@class='inline']">
1548 <xsl:if test="instance[@class='pdf'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
1549 <xsl:text>\begin{figure}[!ht]</xsl:text>
1550 <xsl:value-of select="$newline" />
1551 <xsl:text>\centering</xsl:text>
1552 <xsl:value-of select="$newline" />
1555 \let\PBS=\PreserveBackslash
1556 \begin{tabular}{>{\PBS\centering}m{50mm}@{\hspace{0mm}}>{\PBS\centering}m{50mm}}%
1558 \rule[-1mm]{0mm}{10mm}\includegraphics[width=39mm,keepaspectratio]{weapons-spear.pdf} &
1559 \rule[-1mm]{0mm}{10mm}\includegraphics[width=42.5mm,keepaspectratio]{weapons-bow.pdf} \\ % \hline
1560 </xsl:text><xsl:value-of select="$i18n[@src='Spear']"/><xsl:text> & </xsl:text><xsl:value-of select="$i18n[@src='Bow']"/><xsl:text> \\ % \hline
1561 \rule[-1mm]{0mm}{10mm}\includegraphics[width=10.5mm,keepaspectratio]{weapons-dagger.pdf} &
1562 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-axe.pdf} \\ % \hline
1563 </xsl:text><xsl:value-of select="$i18n[@src='Dagger']"/><xsl:text> & </xsl:text><xsl:value-of select="$i18n[@src='Axe']"/><xsl:text> \\ % \hline
1564 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-mace.pdf} &
1565 \rule[-1mm]{0mm}{10mm}\includegraphics[width=27mm,keepaspectratio]{weapons-sword.pdf} \\ % \hline
1566 </xsl:text><xsl:value-of select="$i18n[@src='Mace']"/><xsl:text> & </xsl:text><xsl:value-of select="$i18n[@src='Sword']"/><xsl:text> \\ % \hline
1567 \rule[-1mm]{0mm}{10mm}\includegraphics[width=20mm,keepaspectratio]{weapons-shortsword.pdf} &
1568 \rule[-1mm]{0mm}{10mm}\includegraphics[width=43.5mm,keepaspectratio]{weapons-quarterstaff.pdf} \\ % \hline
1569 </xsl:text><xsl:value-of select="$i18n[@src='Short Sword']"/><xsl:text> & </xsl:text><xsl:value-of select="$i18n[@src='Quarterstaff']"/><xsl:text> \\ % \hline
1570 \rule[-1mm]{0mm}{10mm}\includegraphics[width=16mm,keepaspectratio]{weapons-warhammer.pdf} &
1571 \rule[-1mm]{0mm}{10mm}\includegraphics[width=33mm,keepaspectratio]{weapons-broadsword.pdf} \\ % \hline
1572 </xsl:text><xsl:value-of select="$i18n[@src='Warhammer']"/><xsl:text> & </xsl:text><xsl:value-of select="$i18n[@src='Broadsword']"/><xsl:text> \\ % \hline
1575 <xsl:text>\end{figure}</xsl:text>
1576 <xsl:value-of select="$newline" />
1580 <!-- override the above template for illustrations for the Map section -->
1581 <!-- the map is handled by the template for the map section -->
1582 <xsl:template match="section[@id='map']//illustration" />
1584 <xsl:template match="instance" />
1586 <xsl:template match="footnotes" />
1588 <xsl:template match="footnote">
1589 <xsl:apply-templates />
1592 <xsl:template match="hr">
1593 <xsl:text>\rule{\textwidth}{0.4pt}</xsl:text>
1594 <xsl:value-of select="$newline" />
1597 <!-- ==================== inline elements ======================= -->
1599 <xsl:template match="a">
1600 <xsl:if test="@href">
1601 <xsl:text>\href{</xsl:text>
1602 <xsl:value-of select="@href" />
1603 <xsl:text>}{</xsl:text>
1605 <xsl:if test="@idref">
1606 <xsl:text>\hyperlink{</xsl:text>
1607 <xsl:value-of select="@idref" />
1608 <xsl:text>}{</xsl:text>
1611 <xsl:text>\hypertarget{</xsl:text>
1612 <xsl:value-of select="@id" />
1613 <xsl:text>}{</xsl:text>
1616 <xsl:apply-templates />
1619 <xsl:text>}</xsl:text>
1621 <xsl:if test="@idref">
1622 <xsl:text>}</xsl:text>
1624 <xsl:if test="@href">
1625 <xsl:text>}</xsl:text>
1629 <xsl:template match="a[@idref='action']">
1630 <xsl:text>\hyperlink{action}{\emph{</xsl:text>
1631 <xsl:apply-templates />
1632 <xsl:text>}}</xsl:text>
1635 <xsl:template match="a[@idref='random']">
1636 <xsl:text>\hyperlink{random}{\emph{</xsl:text>
1637 <xsl:apply-templates />
1638 <xsl:text>}}</xsl:text>
1641 <!-- This template is obsolete, the "footref" element should be used instead -->
1642 <xsl:template match="a[@class='footnote']">
1643 <xsl:apply-templates />
1644 <xsl:text>\footnote{</xsl:text>
1645 <xsl:for-each select="id( @idref )">
1646 <xsl:apply-templates />
1648 <xsl:text>}</xsl:text>
1651 <xsl:template match="footref">
1652 <xsl:apply-templates />
1653 <xsl:text>\footnote{</xsl:text>
1654 <xsl:for-each select="id( @idref )">
1655 <xsl:apply-templates />
1657 <xsl:text>}</xsl:text>
1660 <xsl:template match="em">
1661 <xsl:text>\emph{</xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1664 <xsl:template match="strong">
1665 <xsl:text>{\bfseries </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1668 <xsl:template match="thought">
1669 <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1672 <xsl:template match="onomatopoeia">
1673 <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1676 <xsl:template match="spell">
1677 <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1680 <xsl:template match="item">
1681 <xsl:apply-templates />
1684 <xsl:template match="foreign">
1685 <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1688 <xsl:template match="quote">
1689 <xsl:text>&lsquot;</xsl:text>
1690 <xsl:apply-templates />
1691 <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&rsquot;</xsl:text></xsl:if>
1694 <xsl:template match="quote//quote">
1695 <xsl:text>&ldquot;</xsl:text>
1696 <xsl:apply-templates />
1697 <xsl:if test="not(self::*[@class='open-ended'])"><xsl:text>&rdquot;</xsl:text></xsl:if>
1700 <xsl:template match="cite">
1701 <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1704 <xsl:template match="code">
1705 <xsl:text>{\ttfamily </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1708 <xsl:template match="line">
1709 <xsl:apply-templates />
1710 <xsl:if test="following-sibling::line">\\</xsl:if>
1711 <xsl:value-of select="$newline" />
1714 <xsl:template match="br">
1715 <xsl:text>\\</xsl:text>
1718 <xsl:template match="typ[@class='attribute']">
1720 <xsl:when test="contains(self::node(),'ENDURANCE')">
1721 <xsl:text>{\sc Endurance}</xsl:text>
1723 <xsl:when test="contains(self::node(),'COMBAT SKILL')">
1724 <xsl:text>{\sc Combat Skill}</xsl:text>
1726 <xsl:when test="contains(self::node(),'WILLPOWER')">
1727 <xsl:text>{\sc Willpower}</xsl:text>
1729 <xsl:when test="contains(self::node(),'TARGET')">
1730 <xsl:text>{\sc Target}</xsl:text>
1732 <xsl:when test="contains(self::node(),'CS')">
1733 <xsl:text>{\small CS}</xsl:text>
1735 <xsl:when test="contains(self::node(),'EP')">
1736 <xsl:text>{\small EP}</xsl:text>
1738 <xsl:when test="contains(self::node(),'RESISTANCE')">
1739 <xsl:text>{\sc Resistance}</xsl:text>
1741 <xsl:when test="contains(self::node(),'DESTREZA EN EL COMBATE')">
1742 <xsl:text>{\sc DESTREZA EN EL COMBATE}</xsl:text>
1744 <xsl:when test="contains(self::node(),'RESISTENCIA')">
1745 <xsl:text>{\sc RESISTENCIA}</xsl:text>
1747 <xsl:when test="contains(self::node(),'BLANCOS')">
1748 <xsl:text>{\sc BLANCOS}</xsl:text>
1750 <xsl:when test="contains(self::node(),'DC')">
1751 <xsl:text>{\small DC}</xsl:text>
1753 <xsl:when test="contains(self::node(),'PR')">
1754 <xsl:text>{\small PR}</xsl:text>
1757 <xsl:message terminate="yes">
1758 Error: Unknown attribute "<xsl:value-of select="self::node()" />"
1763 <xsl:text>{\small </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1767 <xsl:template match="footnote//typ[@class='attribute']">
1768 <xsl:text>{\scriptsize </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
1771 <!-- ====================== text elements ======================= -->
1773 <!-- Special template for discarding (whitespace) text between <line>
1774 elements in illustration captions; this is done to avoid potentially
1775 harmful (for the layout) line breaks.
1776 Note: Since <description> elements either contain "verbatim" text or
1777 text structured with <line> or <p> elements, but never a mix of
1778 non-whitespace text elements and <line> elements, I decided
1779 to leave out more complicated code that ensures that only
1780 whitespace is discarded.
1782 <xsl:template match="illustration/meta/description/text()">
1784 <xsl:when test="following-sibling::line|preceding-sibling::line" />
1791 <!-- ==================== character elements ==================== -->
1794 These templates define the mapping between the character elements used in
1795 the Project Aon instances of Gamebook XML and the ISO-8859-1
1798 Portions Copyright International Organization for Standardization 1986
1799 Permission to copy in any form is granted for use with conforming SGML
1800 systems and applications as defined in ISO 8879, provided this notice
1801 is included in all copies.
1805 <!-- JFS: TODO - probably the \definitions need to be in {} to prevent
1806 issues if followed by text -->
1808 <xsl:template match="ch.apos"><xsl:text>'</xsl:text></xsl:template><!-- apostrophe = single quotation mark -->
1809 <xsl:template match="ch.nbsp"><xsl:text>~</xsl:text></xsl:template><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
1810 <xsl:template match="ch.iexcl"><xsl:text>{\textexclamdown}</xsl:text></xsl:template><!-- inverted exclamation mark, U+00A1 ISOnum -->
1811 <xsl:template match="ch.cent"><xsl:text>\textcent</xsl:text></xsl:template><!-- cent sign, U+00A2 ISOnum -->
1812 <xsl:template match="ch.pound"><xsl:text>\pounds</xsl:text></xsl:template><!-- pound sign, U+00A3 ISOnum -->
1813 <xsl:template match="ch.curren"><xsl:text>\textcurrency</xsl:text></xsl:template><!-- currency sign, U+00A4 ISOnum -->
1814 <xsl:template match="ch.yen"><xsl:text>\textyen</xsl:text></xsl:template><!-- yen sign = yuan sign, U+00A5 ISOnum -->
1815 <xsl:template match="ch.brvbar"><xsl:text>\textbar</xsl:text></xsl:template><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
1816 <xsl:template match="ch.sect"><xsl:text>\textsection</xsl:text></xsl:template><!-- section sign, U+00A7 ISOnum -->
1817 <xsl:template match="ch.uml"><xsl:text>\ddot{}</xsl:text></xsl:template><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
1818 <xsl:template match="ch.copy"><xsl:text>{\copyright}</xsl:text></xsl:template><!-- copyright sign, U+00A9 ISOnum -->
1819 <xsl:template match="ch.ordf"><xsl:text>\textordfeminine</xsl:text></xsl:template><!-- feminine ordinal indicator, U+00AA ISOnum -->
1820 <xsl:template match="ch.laquo"><xsl:text>{\guillemotleft}</xsl:text></xsl:template><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
1821 <xsl:template match="ch.not"><xsl:text>\textlnot</xsl:text></xsl:template><!-- not sign, U+00AC ISOnum -->
1822 <xsl:template match="ch.shy"><xsl:text>\-</xsl:text></xsl:template><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
1823 <xsl:template match="ch.reg"><xsl:text>{\texttrademark}</xsl:text></xsl:template><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
1824 <xsl:template match="ch.macr"><xsl:text>\textasciimacron</xsl:text></xsl:template><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
1825 <xsl:template match="ch.deg"><xsl:text>\textdegree</xsl:text></xsl:template><!-- degree sign, U+00B0 ISOnum -->
1826 <xsl:template match="ch.plusmn"><xsl:text>\textpm</xsl:text></xsl:template><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
1827 <xsl:template match="ch.sup2"><xsl:text>^2</xsl:text></xsl:template><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
1828 <xsl:template match="ch.sup3"><xsl:text>^3</xsl:text></xsl:template><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
1829 <xsl:template match="ch.acute"><xsl:text>\'</xsl:text></xsl:template><!-- acute accent = spacing acute, U+00B4 ISOdia -->
1830 <xsl:template match="ch.micro"><xsl:text>\textmu</xsl:text></xsl:template><!-- micro sign, U+00B5 ISOnum -->
1831 <xsl:template match="ch.para"><xsl:text>\textparagraph</xsl:text></xsl:template><!-- pilcrow sign = paragraph sign, U+00B6 ISOnum -->
1832 <xsl:template match="ch.middot"><xsl:text>\textperiodcentered</xsl:text></xsl:template><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
1833 <xsl:template match="ch.cedil"><xsl:text>\c{c}</xsl:text></xsl:template><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
1834 <xsl:template match="ch.sup1"><xsl:text>^1</xsl:text></xsl:template><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
1835 <xsl:template match="ch.ordm"><xsl:text>\textordmasculine</xsl:text></xsl:template><!-- masculine ordinal indicator, U+00BA ISOnum -->
1836 <xsl:template match="ch.raquo"><xsl:text>{\guillemotright}</xsl:text></xsl:template><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
1837 <xsl:template match="ch.frac14"><xsl:text>$\frac{1}{4}$</xsl:text></xsl:template><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
1838 <xsl:template match="ch.frac12"><xsl:text>$\frac{1}{2}$</xsl:text></xsl:template><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
1839 <xsl:template match="ch.frac34"><xsl:text>$\frac{3}{4}$</xsl:text></xsl:template><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
1840 <xsl:template match="ch.iquest"><xsl:text>{\textquestiondown}</xsl:text></xsl:template><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
1841 <xsl:template match="ch.Agrave"><xsl:text>À</xsl:text></xsl:template><!-- latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 -->
1842 <xsl:template match="ch.Aacute"><xsl:text>Á</xsl:text></xsl:template><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
1843 <xsl:template match="ch.Acirc"><xsl:text>Â</xsl:text></xsl:template><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
1844 <xsl:template match="ch.Atilde"><xsl:text>Ã</xsl:text></xsl:template><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
1845 <xsl:template match="ch.Auml"><xsl:text>Ä</xsl:text></xsl:template><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
1846 <xsl:template match="ch.Aring"><xsl:text>Å</xsl:text></xsl:template><!-- latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 -->
1847 <xsl:template match="ch.AElig"><xsl:text>Æ</xsl:text></xsl:template><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
1848 <xsl:template match="ch.Ccedil"><xsl:text>Ç</xsl:text></xsl:template><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
1849 <xsl:template match="ch.Egrave"><xsl:text>È</xsl:text></xsl:template><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
1850 <xsl:template match="ch.Eacute"><xsl:text>É</xsl:text></xsl:template><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
1851 <xsl:template match="ch.Ecirc"><xsl:text>Ê</xsl:text></xsl:template><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
1852 <xsl:template match="ch.Euml"><xsl:text>Ë</xsl:text></xsl:template><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
1853 <xsl:template match="ch.Igrave"><xsl:text>Ì</xsl:text></xsl:template><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
1854 <xsl:template match="ch.Iacute"><xsl:text>Í</xsl:text></xsl:template><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
1855 <xsl:template match="ch.Icirc"><xsl:text>Î</xsl:text></xsl:template><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
1856 <xsl:template match="ch.Iuml"><xsl:text>Ï</xsl:text></xsl:template><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
1857 <xsl:template match="ch.ETH"><xsl:text>Ð</xsl:text></xsl:template><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
1858 <xsl:template match="ch.Ntilde"><xsl:text>Ñ</xsl:text></xsl:template><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
1859 <xsl:template match="ch.Ograve"><xsl:text>Ò</xsl:text></xsl:template><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
1860 <xsl:template match="ch.Oacute"><xsl:text>Ó</xsl:text></xsl:template><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
1861 <xsl:template match="ch.Ocirc"><xsl:text>Ô</xsl:text></xsl:template><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
1862 <xsl:template match="ch.Otilde"><xsl:text>Õ</xsl:text></xsl:template><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
1863 <xsl:template match="ch.Ouml"><xsl:text>Ö</xsl:text></xsl:template><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
1864 <xsl:template match="ch.times"><xsl:text>×</xsl:text></xsl:template><!-- multiplication sign, U+00D7 ISOnum -->
1865 <xsl:template match="ch.Oslash"><xsl:text>Ø</xsl:text></xsl:template><!-- latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 -->
1866 <xsl:template match="ch.Ugrave"><xsl:text>Ù</xsl:text></xsl:template><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
1867 <xsl:template match="ch.Uacute"><xsl:text>Ú</xsl:text></xsl:template><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
1868 <xsl:template match="ch.Ucirc"><xsl:text>Û</xsl:text></xsl:template><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
1869 <xsl:template match="ch.Uuml"><xsl:text>Ü</xsl:text></xsl:template><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
1870 <xsl:template match="ch.Yacute"><xsl:text>Ý</xsl:text></xsl:template><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
1871 <xsl:template match="ch.THORN"><xsl:text>Þ</xsl:text></xsl:template><!-- latin capital letter THORN, U+00DE ISOlat1 -->
1872 <xsl:template match="ch.szlig"><xsl:text>ß</xsl:text></xsl:template><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
1873 <xsl:template match="ch.agrave"><xsl:text>à</xsl:text></xsl:template><!-- latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 -->
1874 <xsl:template match="ch.aacute"><xsl:text>á</xsl:text></xsl:template><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
1875 <xsl:template match="ch.acirc"><xsl:text>â</xsl:text></xsl:template><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
1876 <xsl:template match="ch.atilde"><xsl:text>ã</xsl:text></xsl:template><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
1877 <xsl:template match="ch.auml"><xsl:text>ä</xsl:text></xsl:template><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
1878 <xsl:template match="ch.aring"><xsl:text>å</xsl:text></xsl:template><!-- latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 -->
1879 <xsl:template match="ch.aelig"><xsl:text>æ</xsl:text></xsl:template><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
1880 <xsl:template match="ch.ccedil"><xsl:text>ç</xsl:text></xsl:template><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
1881 <xsl:template match="ch.egrave"><xsl:text>è</xsl:text></xsl:template><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
1882 <xsl:template match="ch.eacute"><xsl:text>é</xsl:text></xsl:template><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
1883 <xsl:template match="ch.ecirc"><xsl:text>ê</xsl:text></xsl:template><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
1884 <xsl:template match="ch.euml"><xsl:text>ë</xsl:text></xsl:template><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
1885 <xsl:template match="ch.igrave"><xsl:text>ì</xsl:text></xsl:template><!-- latin small letter i with grave, U+00EC ISOlat1 -->
1886 <xsl:template match="ch.iacute"><xsl:text>í</xsl:text></xsl:template><!-- latin small letter i with acute, U+00ED ISOlat1 -->
1887 <xsl:template match="ch.icirc"><xsl:text>î</xsl:text></xsl:template><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
1888 <xsl:template match="ch.iuml"><xsl:text>ï</xsl:text></xsl:template><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
1889 <xsl:template match="ch.eth"><xsl:text>ð</xsl:text></xsl:template><!-- latin small letter eth, U+00F0 ISOlat1 -->
1890 <xsl:template match="ch.ntilde"><xsl:text>ñ</xsl:text></xsl:template><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
1891 <xsl:template match="ch.ograve"><xsl:text>ò</xsl:text></xsl:template><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
1892 <xsl:template match="ch.oacute"><xsl:text>ó</xsl:text></xsl:template><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
1893 <xsl:template match="ch.ocirc"><xsl:text>ô</xsl:text></xsl:template><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
1894 <xsl:template match="ch.otilde"><xsl:text>õ</xsl:text></xsl:template><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
1895 <xsl:template match="ch.ouml"><xsl:text>ö</xsl:text></xsl:template><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
1896 <xsl:template match="ch.divide"><xsl:text>÷</xsl:text></xsl:template><!-- division sign, U+00F7 ISOnum -->
1897 <xsl:template match="ch.oslash"><xsl:text>ø</xsl:text></xsl:template><!-- latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 -->
1898 <xsl:template match="ch.ugrave"><xsl:text>ù</xsl:text></xsl:template><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
1899 <xsl:template match="ch.uacute"><xsl:text>ú</xsl:text></xsl:template><!-- latin small letter u with acute, U+00FA ISOlat1 -->
1900 <xsl:template match="ch.ucirc"><xsl:text>û</xsl:text></xsl:template><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
1901 <xsl:template match="ch.uuml"><xsl:text>ü</xsl:text></xsl:template><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
1902 <xsl:template match="ch.yacute"><xsl:text>ý</xsl:text></xsl:template><!-- latin small letter y with acute, U+00FD ISOlat1 -->
1903 <xsl:template match="ch.thorn"><xsl:text>þ</xsl:text></xsl:template><!-- latin small letter thorn, U+00FE ISOlat1 -->
1904 <xsl:template match="ch.yuml"><xsl:text>ÿ</xsl:text></xsl:template><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
1906 <!-- ~~~~~~~~~~~~~~~~~~~~~ Special Characters ~~~~~~~~~~~~~~~~~~~~ -->
1908 <xsl:template match="ch.ampersand">\&</xsl:template><!-- ampersand -->
1909 <xsl:template match="ch.lsquot">\textquoteleft </xsl:template><!-- opening left quotation mark -->
1910 <xsl:template match="ch.rsquot">\textquoteright </xsl:template><!-- closing right quotation mark -->
1911 <xsl:template match="ch.ldquot">``</xsl:template><!-- opening left double quotation mark -->
1912 <xsl:template match="ch.rdquot">''</xsl:template><!-- closing right double quotation mark -->
1913 <xsl:template match="ch.minus">$-$</xsl:template><!-- mathematical minus -->
1914 <xsl:template match="ch.endash">--</xsl:template><!-- endash -->
1915 <xsl:template match="ch.emdash">---</xsl:template><!-- emdash -->
1916 <xsl:template match="ch.ellips">...</xsl:template><!-- ellipsis -->
1917 <xsl:template match="ch.lellips">...</xsl:template><!-- left ellipsis, used at the beginning of edited material -->
1918 <xsl:template match="ch.blankline">\_\_\_\_\_\_\_</xsl:template><!-- blank line to be filled in -->
1919 <xsl:template match="ch.percent"><xsl:text>\%</xsl:text></xsl:template><!-- percent sign -->
1920 <xsl:template match="ch.thinspace"><xsl:text>\ </xsl:text></xsl:template><!-- small horizontal space for use between adjacent quotation marks - added mainly for LaTeX's sake -->
1921 <xsl:template match="ch.frac116"><xsl:text>1/16</xsl:text></xsl:template><!-- vulgar fraction one sixteenth = fraction on sixteenth -->
1922 <xsl:template match="ch.plus"><xsl:text>+</xsl:text></xsl:template><!-- mathematical plus -->
1924 <!-- ==================== named templates ======================= -->
1927 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.
1929 <xsl:template name="section-title-link">
1930 <!-- will the list always contain the closest ancestor first? -->
1931 <xsl:variable name="section-title">
1932 <!-- numbered or not? -->
1933 <xsl:if test="ancestor::section[position()=1]/@class='numbered'">
1934 <xsl:value-of select="$i18n[@src='Section']" />
1935 <xsl:text>~</xsl:text>
1937 <xsl:apply-templates select="ancestor::section[position()=1]/meta/title[1]" />
1941 <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="ancestor::section[position()=1]/@id" /></xsl:attribute>
1942 <xsl:value-of select="$section-title" />
1947 Subroutines to generate the combat ratio tables.
1950 <xsl:template name="combat-ratio-table">
1951 <xsl:param name="title" />
1952 <xsl:param name="startCol" />
1953 <xsl:param name="endCol" />
1954 <xsl:param name="colHeaders" />
1955 <xsl:param name="showLeftLabel" select="0" />
1956 <xsl:param name="showRightLabel" select="0" />
1958 <xsl:variable name="offsetX">0</xsl:variable>
1959 <xsl:variable name="offsetY">10</xsl:variable>
1961 <!-- calculate a few sizes and positions -->
1962 <xsl:variable name="leftLabelWidth" select="number($showLeftLabel) * number($sideLabelWidth)" />
1963 <xsl:variable name="rightLabelWidth" select="number($showRightLabel) * number($sideLabelWidth)" />
1965 <xsl:variable name="legendWidth" select="2 * number($rnColWidth) + 7 * number($resultBoxWidth)" />
1966 <xsl:variable name="legendX" select="$leftLabelWidth" />
1967 <xsl:variable name="legendY" select="0" />
1969 <xsl:variable name="topLabelX" select="number($leftLabelWidth) + number($legendWidth) div 2" />
1970 <xsl:variable name="topLabelY" select="number($legendHeight) + number($legendSep) + 2 * number($combatRatioBoxHeight) + 10 * number($resultBoxHeight) + number($topLabelSep)" />
1972 <xsl:variable name="leftLabelX" select="number($leftLabelWidth) div 2" />
1973 <xsl:variable name="leftLabelY" select="number($legendHeight) + number($legendSep) + number($combatRatioBoxHeight) + 5 * number($resultBoxHeight)" />
1974 <xsl:variable name="rightLabelX" select="number($leftLabelWidth) + 2 * number($rnColWidth) + 7 * number($resultBoxWidth) + number($rightLabelWidth) div 2" />
1975 <xsl:variable name="rightLabelY" select="number($legendHeight) + number($legendSep) + number($combatRatioBoxHeight) + 5 * number($resultBoxHeight)" />
1977 <xsl:variable name="randomNumberBoxesLeftX" select="$leftLabelWidth" />
1978 <xsl:variable name="randomNumberBoxesRightX" select="number($leftLabelWidth) + number($rnColWidth) + 7 * number($resultBoxWidth)" />
1979 <xsl:variable name="randomNumberBoxesY" select="number($legendHeight) + number($legendSep) + number($combatRatioBoxHeight)" />
1981 <xsl:variable name="resultBoxesX" select="number($leftLabelWidth) + number($rnColWidth)" />
1982 <xsl:variable name="resultBoxesY" select="number($legendHeight) + number($legendSep) + number($combatRatioBoxHeight)" />
1984 <xsl:variable name="combatRatioBoxesX" select="number($leftLabelWidth) + number($rnColWidth)" />
1985 <xsl:variable name="combatRatioBoxesBottomY" select="number($legendHeight) + number($legendSep)" />
1986 <xsl:variable name="combatRatioBoxesTopY" select="number($legendHeight) + number($legendSep) + number($combatRatioBoxHeight) + 10 * number($resultBoxHeight)" />
1988 <xsl:variable name="totalWidth" select="number($sideLabelWidth) + 2 * number($rnColWidth) + 7 * number($resultBoxWidth)" />
1989 <xsl:variable name="totalHeight" select="number($legendHeight) + number($legendSep) + 2 * number($combatRatioBoxHeight) + 10 * number($resultBoxHeight) + number($topLabelSep) + number($topLabelHeight)" />
1991 <xsl:text>\setlength{\unitlength}{1mm}
1992 \vspace*{\stretch{1}}
1994 \begin{picture}(0,0)(</xsl:text><xsl:value-of select="0.5 * number($totalWidth) - number($offsetX)" /><xsl:text>,</xsl:text><xsl:value-of select="0.5 * number($totalHeight) - number($offsetY)" /><xsl:text>)
1997 \put(</xsl:text><xsl:value-of select="$legendX" /><xsl:text>,</xsl:text><xsl:value-of select="$legendY" /><xsl:text>){%
1998 \makebox(</xsl:text><xsl:value-of select="$legendWidth" /><xsl:text>,</xsl:text><xsl:value-of select="$legendHeight" /><xsl:text>){%
1999 \mbox{\footnotesize </xsl:text><xsl:value-of select="$i18n[@src='E = Enemy EP loss']" /><xsl:text>}%
2001 \mbox{\footnotesize </xsl:text><xsl:value-of select="$i18n[@src='LW = Lone Wolf EP loss']" /><xsl:text>}%
2003 \mbox{\footnotesize </xsl:text><xsl:value-of select="$i18n[@src='K = Automatic Kill']" /><xsl:text>}%
2007 %% the labels %%</xsl:text>
2008 <xsl:value-of select="$newline" />
2009 <xsl:if test="number($showLeftLabel) = 1">
2010 <xsl:text> \put(</xsl:text><xsl:value-of select="$leftLabelX" /><xsl:text>,</xsl:text><xsl:value-of select="$leftLabelY" /><xsl:text>){\makebox(0,0){\rotatebox{90}{\bfseries \large </xsl:text><xsl:value-of select="$i18n[@src='Random Number']" /><xsl:text>}}}</xsl:text>
2011 <xsl:value-of select="$newline" />
2013 <xsl:if test="number($showRightLabel) = 1">
2014 <xsl:text> \put(</xsl:text><xsl:value-of select="$rightLabelX" /><xsl:text>,</xsl:text><xsl:value-of select="$rightLabelY" /><xsl:text>){\makebox(0,0){\rotatebox{270}{\bfseries \large </xsl:text><xsl:value-of select="$i18n[@src='Random Number']" /><xsl:text>}}}</xsl:text>
2015 <xsl:value-of select="$newline" />
2017 <xsl:text> \put(</xsl:text><xsl:value-of select="$topLabelX" /><xsl:text>,</xsl:text><xsl:value-of select="$topLabelY" /><xsl:text>){\makebox(0,0)[b]{\bfseries \large </xsl:text><xsl:value-of select="$title" /><xsl:text>}}
2019 %% random number boxes %%
2020 \multiput(</xsl:text><xsl:value-of select="$randomNumberBoxesLeftX" /><xsl:text>,</xsl:text><xsl:value-of select="$randomNumberBoxesY" /><xsl:text>)(0,</xsl:text><xsl:value-of select="2 * number($randomNumberBoxHeight)" /><xsl:text>){5}{%
2021 \lightgraybox{</xsl:text><xsl:value-of select="$randomNumberBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$randomNumberBoxHeight" /><xsl:text>}%
2023 \multiput(</xsl:text><xsl:value-of select="$randomNumberBoxesRightX" /><xsl:text>,</xsl:text><xsl:value-of select="$randomNumberBoxesY" /><xsl:text>)(0,</xsl:text><xsl:value-of select="2 * number($randomNumberBoxHeight)" /><xsl:text>){5}{%
2024 \lightgraybox{</xsl:text><xsl:value-of select="$randomNumberBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$randomNumberBoxHeight" /><xsl:text>}%
2028 \multiput(</xsl:text><xsl:value-of select="$resultBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="$resultBoxesY" /><xsl:text>)(0,</xsl:text><xsl:value-of select="2 * number($resultBoxHeight)" /><xsl:text>){5}{%
2029 \multiput(</xsl:text><xsl:value-of select="$resultBoxWidth" /><xsl:text>,0)(</xsl:text><xsl:value-of select="2 * number($resultBoxWidth)" /><xsl:text>,0){3}{%
2030 \lightgraybox{</xsl:text><xsl:value-of select="$resultBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$resultBoxHeight" /><xsl:text>}%
2033 \multiput(</xsl:text><xsl:value-of select="$resultBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="number($resultBoxesY) + number($resultBoxHeight)" /><xsl:text>)(0,</xsl:text><xsl:value-of select="2 * number($resultBoxHeight)" /><xsl:text>){5}{%
2034 \multiput(0,0)(</xsl:text><xsl:value-of select="2 * number($resultBoxWidth)" /><xsl:text>,0){4}{%
2035 \lightgraybox{</xsl:text><xsl:value-of select="$resultBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$resultBoxHeight" /><xsl:text>}%
2039 %% combat ratio boxes %%
2040 \multiput(</xsl:text><xsl:value-of select="number($combatRatioBoxesX) + number($combatRatioBoxWidth)" /><xsl:text>,</xsl:text><xsl:value-of select="$combatRatioBoxesTopY" /><xsl:text>)(</xsl:text><xsl:value-of select="2 * number($combatRatioBoxWidth)" /><xsl:text>,0){3}{%
2041 \lightgraybox{</xsl:text><xsl:value-of select="$combatRatioBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$combatRatioBoxHeight" /><xsl:text>}%
2043 \multiput(</xsl:text><xsl:value-of select="$combatRatioBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="$combatRatioBoxesBottomY" /><xsl:text>)(</xsl:text><xsl:value-of select="2 * number($combatRatioBoxWidth)" /><xsl:text>,0){4}{%
2044 \lightgraybox{</xsl:text><xsl:value-of select="$combatRatioBoxWidth" /><xsl:text>}{</xsl:text><xsl:value-of select="$combatRatioBoxHeight" /><xsl:text>}%
2048 \put(</xsl:text><xsl:value-of select="$combatRatioBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="$combatRatioBoxesBottomY" /><xsl:text>){%
2049 \line(1,0){</xsl:text><xsl:value-of select="7 * number($combatRatioBoxWidth)" /><xsl:text>}%
2051 \multiput(</xsl:text><xsl:value-of select="$randomNumberBoxesLeftX" /><xsl:text>,</xsl:text><xsl:value-of select="$randomNumberBoxesY" /><xsl:text>)(0,</xsl:text><xsl:value-of select="$randomNumberBoxHeight" /><xsl:text>){11}{%
2052 \line(1,0){</xsl:text><xsl:value-of select="2 * number($randomNumberBoxWidth) + 7 * number($resultBoxWidth)" /><xsl:text>}%
2054 \multiput(</xsl:text><xsl:value-of select="$resultBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="number($resultBoxesY) + number($resultBoxHeight) div 2" /><xsl:text>)(0,</xsl:text><xsl:value-of select="$resultBoxHeight" /><xsl:text>){10}{%
2055 \line(1,0){</xsl:text><xsl:value-of select="7 * number($resultBoxWidth)" /><xsl:text>}%
2057 \put(</xsl:text><xsl:value-of select="$combatRatioBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="number($combatRatioBoxesTopY) + number($combatRatioBoxHeight)" /><xsl:text>){%
2058 \line(1,0){</xsl:text><xsl:value-of select="7 * number($combatRatioBoxWidth)" /><xsl:text>}%
2061 \put(</xsl:text><xsl:value-of select="$randomNumberBoxesLeftX" /><xsl:text>,</xsl:text><xsl:value-of select="$randomNumberBoxesY" /><xsl:text>){%
2062 \line(0,1){</xsl:text><xsl:value-of select="10 * number($randomNumberBoxHeight)" /><xsl:text>}%
2064 \multiput(</xsl:text><xsl:value-of select="$combatRatioBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="$combatRatioBoxesBottomY" /><xsl:text>)(</xsl:text><xsl:value-of select="$combatRatioBoxWidth" /><xsl:text>,0){8}{%
2065 \line(0,1){</xsl:text><xsl:value-of select="2 * number($combatRatioBoxHeight) + 10 * number($randomNumberBoxHeight)" /><xsl:text>}%
2067 \put(</xsl:text><xsl:value-of select="number($randomNumberBoxesRightX) + number($randomNumberBoxWidth)" /><xsl:text>,</xsl:text><xsl:value-of select="$randomNumberBoxesY" /><xsl:text>){%
2068 \line(0,1){</xsl:text><xsl:value-of select="10 * number($randomNumberBoxHeight)" /><xsl:text>}%
2070 <xsl:value-of select="$newparagraph" />
2072 <xsl:text> %% random numbers %%</xsl:text>
2073 <xsl:value-of select="$newline" />
2074 <!-- xsltproc does not understand select="1 to 10"; so we abuse the fact that the
2075 <tbody> element contains more than 10 <tr> elements. -->
2076 <xsl:for-each select="data/illustration/instance[@class='text']/table/tbody/tr">
2077 <xsl:if test="position() < 11">
2078 <xsl:text> \multiput(</xsl:text><xsl:value-of select="number($randomNumberBoxesLeftX) + number($randomNumberBoxWidth) div 2" /><xsl:text>,</xsl:text><xsl:value-of select="number($randomNumberBoxesY) + ( 10.5 - position() ) * number($randomNumberBoxHeight)" /><xsl:text>)(</xsl:text><xsl:value-of select="number($randomNumberBoxWidth) + 7 * number($resultBoxWidth)" /><xsl:text>,0){2}{\makebox(0,0){\bfseries </xsl:text><xsl:value-of select="position() mod 10" /><xsl:text>}}</xsl:text>
2079 <xsl:value-of select="$newline" />
2082 <xsl:value-of select="$newline" />
2084 <xsl:text> %% combat ratios %%</xsl:text>
2085 <xsl:value-of select="$newline" />
2086 <xsl:for-each select="exslt:node-set($colHeaders)/*">
2087 <xsl:text> \multiput(</xsl:text><xsl:value-of select="number($combatRatioBoxesX) + ( position() - 0.5 ) * number($combatRatioBoxWidth)" /><xsl:text>,</xsl:text><xsl:value-of select="number($combatRatioBoxesBottomY) + number($combatRatioBoxHeight) div 2" /><xsl:text>)(0,</xsl:text><xsl:value-of select="10 * number($resultBoxHeight) + number($combatRatioBoxHeight)" /><xsl:text>){2}{%</xsl:text>
2088 <xsl:value-of select="$newline" />
2089 <xsl:text> \makebox(0,0){</xsl:text><xsl:value-of select="." /><xsl:text>}%</xsl:text>
2090 <xsl:value-of select="$newline" />
2091 <xsl:text> }</xsl:text>
2092 <xsl:value-of select="$newline" />
2094 <xsl:value-of select="$newline" />
2096 <xsl:text> %% E & LW %%</xsl:text>
2097 <xsl:value-of select="$newline" />
2098 <xsl:text> \multiput(</xsl:text><xsl:value-of select="$resultBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="$resultBoxesY" /><xsl:text>)(0,</xsl:text><xsl:value-of select="$resultBoxHeight" /><xsl:text>){10}{%
2099 \multiput(0,0)(</xsl:text><xsl:value-of select="$resultBoxWidth" /><xsl:text>,0){7}{%
2100 \makebox(0,</xsl:text><xsl:value-of select="number($resultBoxHeight) div 2" /><xsl:text>)[l]{\footnotesize ~</xsl:text><xsl:value-of select="$i18n[@src='LW']" /><xsl:text>}%
2103 \multiput(</xsl:text><xsl:value-of select="$resultBoxesX" /><xsl:text>,</xsl:text><xsl:value-of select="number($resultBoxesY) + number($resultBoxHeight) div 2" /><xsl:text>)(0,</xsl:text><xsl:value-of select="$resultBoxHeight" /><xsl:text>){10}{%
2104 \multiput(0,0)(</xsl:text><xsl:value-of select="$resultBoxWidth" /><xsl:text>,0){7}{%
2105 \makebox(0,</xsl:text><xsl:value-of select="number($resultBoxHeight) div 2" /><xsl:text>)[l]{\footnotesize ~</xsl:text><xsl:value-of select="$i18n[@src='E (abbr. of Enemy EP loss)']" /><xsl:text>}%
2108 <xsl:value-of select="$newparagraph" />
2110 <xsl:text> %% losses %%</xsl:text>
2111 <xsl:value-of select="$newline" />
2112 <xsl:for-each select="data/illustration/instance[@class='text']/table/tbody/tr">
2113 <!-- the actual data is in row 3..12 -->
2114 <xsl:variable name="row" select="position() - 2" />
2115 <xsl:for-each select="./td">
2116 <xsl:if test="position() = 1">
2117 <xsl:text> %% row </xsl:text><xsl:value-of select="$row" /><xsl:text> %%</xsl:text>
2118 <xsl:value-of select="$newline" />
2120 <xsl:if test="position() >= number($startCol) and position() <= number($endCol)">
2121 <xsl:variable name="col" select="position() - number($startCol) + 1" />
2122 <xsl:variable name="losses"><xsl:value-of select="." /></xsl:variable>
2123 <xsl:variable name="lossE" select="substring-before($losses,'/')" />
2124 <xsl:text> \put(</xsl:text><xsl:value-of select="number($resultBoxesX) + number($col) * number($resultBoxWidth)" /><xsl:text>,</xsl:text><xsl:value-of select="number($resultBoxesY) + ( 10.5 - number($row) ) * number($resultBoxHeight)" /><xsl:text>){\makebox(0,</xsl:text><xsl:value-of select="number($resultBoxHeight) div 2" /><xsl:text>)[r]{\footnotesize </xsl:text>
2126 <xsl:when test="$lossE='k'">
2127 <xsl:value-of select="$i18n[@src='K (abbr. of Automatic Kill)']" />
2130 <xsl:value-of select="$lossE" />
2133 <xsl:text>~}}</xsl:text>
2134 <xsl:value-of select="$newline" />
2135 <xsl:variable name="lossLW" select="substring-after($losses,'/')" />
2136 <xsl:text> \put(</xsl:text><xsl:value-of select="number($resultBoxesX) + number($col) * number($resultBoxWidth)" /><xsl:text>,</xsl:text><xsl:value-of select="number($resultBoxesY) + ( 10 - number($row) ) * number($resultBoxHeight)" /><xsl:text>){\makebox(0,</xsl:text><xsl:value-of select="number($resultBoxHeight) div 2" /><xsl:text>)[r]{\footnotesize </xsl:text>
2138 <xsl:when test="$lossLW='k'">
2139 <xsl:text>K</xsl:text>
2142 <xsl:value-of select="$lossLW" />
2145 <xsl:text>~}}</xsl:text>
2146 <xsl:value-of select="$newline" />
2151 <xsl:text>\end{picture}
2153 \vspace*{\stretch{1}}</xsl:text>
2154 <xsl:value-of select="$newline" />
2155 <xsl:text>\setlength{\unitlength}{1pt}</xsl:text>
2156 <xsl:value-of select="$newparagraph" />