Initial freepository revision of XML support documents.
authorJonathan Blake <jonathan.blake@projectaon.org>
Sun, 30 Jan 2005 01:32:52 +0000 (01:32 +0000)
committerJonathan Blake <jonathan.blake@projectaon.org>
Sun, 30 Jan 2005 01:32:52 +0000 (01:32 +0000)
git-svn-id: https://projectaon.org/data/trunk@13 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11

20 files changed:
xml/bwbiolw.inc [new file with mode: 0644]
xml/endowmnt.inc [new file with mode: 0644]
xml/gamebook.dtd [new file with mode: 0644]
xml/geninc.mod [new file with mode: 0644]
xml/genlink.mod [new file with mode: 0644]
xml/htmlchar.mod [new file with mode: 0644]
xml/htmllink.mod [new file with mode: 0644]
xml/identity.xsl [new file with mode: 0644]
xml/indent.xsl [new file with mode: 0644]
xml/ipbiogs.inc [new file with mode: 0644]
xml/jdbiogs.inc [new file with mode: 0644]
xml/jdbiolw.inc [new file with mode: 0644]
xml/latex.xsl [new file with mode: 0644]
xml/license.inc [new file with mode: 0644]
xml/ltexchar.mod [new file with mode: 0644]
xml/pml.xsl [new file with mode: 0644]
xml/pmlchar.mod [new file with mode: 0644]
xml/xhtml-pda.xsl [new file with mode: 0644]
xml/xhtml-single.xsl [new file with mode: 0644]
xml/xhtml.xsl [new file with mode: 0644]

diff --git a/xml/bwbiolw.inc b/xml/bwbiolw.inc
new file mode 100644 (file)
index 0000000..1829b7d
--- /dev/null
@@ -0,0 +1 @@
+   <p><strong>Brian Williams</strong> was first noticed by Joe Dever for his work in White Dwarf magazine (circa issue 50) and the Real Life Adventure series by Jon Sutherland. Brian Williams was Joe&apos;s first choice of illustrators to replace Gary Chalk. Jon, being an old friend of Joe&apos;s, introduced the two. Brian was excited to work with Joe on the Lone Wolf series. He illustrated <cite>The Cauldron of Fear</cite> and almost every book about Magnamund since that time.</p>
diff --git a/xml/endowmnt.inc b/xml/endowmnt.inc
new file mode 100644 (file)
index 0000000..434c816
--- /dev/null
@@ -0,0 +1,2 @@
+     <p><quote>I would be especially pleased if my granting of the rights to distribute my books in this way was seen as my <quote>millennium gift</quote> to all those devoted readers who have kept the Kai flag flying high, through all the good times, and the not-so-good. It would make me very proud indeed if this enterprise laid the foundations of a lasting legacy, securing the longevity of Lone Wolf by making my creation freely and readily accessible to current and future online generations. For them, for us, for Sommerlund and the Kai.&ellips;</quote> <strong>Joe Dever</strong></p>
+     <p>Project Aon would first like to thank Joe Dever for making this generous offering of the books that we have all loved from the beginning. We are also grateful for the generosity of Gary Chalk, Ian Page, and Brian Williams for contributing their portions of the world of Magnamund to Project Aon. We would also like to acknowledge the following members of Project Aon for their diligent work:</p>
diff --git a/xml/gamebook.dtd b/xml/gamebook.dtd
new file mode 100644 (file)
index 0000000..d5a5b2a
--- /dev/null
@@ -0,0 +1,1255 @@
+<!-- ============================================================= -->
+<!--             Gamebook Document Type Definition v0.10           -->
+<!-- ============================================================= -->
+<!--
+
+This DTD was designed around XML 1.0.
+
+This gamebook DTD is aimed primarily at the books under development by 
+Project Aon (http://www.projectaon.org/). Future versions may be of 
+more general utility.
+
+$Id$
+
+Change Log:
+
+18 April 2003 (version 0.11.1)
+ * Added the following inline elements: "onomatopoeia", "spell",
+   "item".
+
+27 January 2003 (version 0.11.0)
+ * Moved the optional "footnotes" element between the "meta" and 
+   "data" elements.
+
+10 January 2003 (version 0.10.4)
+ * Removed the "inline.content" entity from the declaration of the
+   contents of the "blockquote" element. This will break some existing
+   documents.
+
+7 January 2003 (version 0.10.3)
+ * Made the "src", "width", and "height" attributes of the "instance"
+   element IMPLIED.
+
+4 January 2003 (version 0.10.2)
+ * Moved the specialized character entity definitions into module
+   files.
+
+5 October 2002 (version 0.10.1)
+ * Added the "lellips" and "minus" entities and changed the definition
+   of the "emdash" entity.
+
+5 September 2002 (version 0.10.0)
+ * Added the "quote" element.
+
+31 August 2002 (version 0.9.1)
+ * Added the "xml:lang" attribute to the "core.attributes" entity.
+   Although this could be used for most elements, it is primarily
+   aimed at the "foreign" element.
+
+6 July 2002 (version 0.9)
+ * Replaced the "caption" element and the "illustrator" attribute with
+   the use of the "meta" element.
+ * Renamed the "illustration-instance" element to simply "instance".
+ * Removed the "character-attribute" element.
+ * Added the "typ" element for typographical markup.
+ * Removed the "shortname" attribute.
+
+1 June 2002 (version 0.8.3)
+ * Removed the "marker" attribute from the "footnote" element.
+
+29 April 2002 (vesion 0.8.2)
+ * Changed the content of the "enemy" element from "#PCDATA" to 
+   "%inline.content;".
+
+4 April 2002 (version 0.8.1)
+ * Added the "thinspace" entity
+
+3 April 2002 (version 0.8.0)
+ * Added the "thought" element.
+ * Added the "foreign" element.
+
+15 March 2002 (version 0.7.0)
+ * Changed the name of the "illustration-set" element to "illustration"
+   and changed the name of the "illustration" element to
+   "illustration-instance".
+ * Made many minor changes to bring the DTD up to current practice.
+
+11 May 2001 (version 0.6.0)
+ * Removed the "publication-date" element.
+
+5 May 2001 (version 0.5.0)
+ * Added facilities for transformation to LaTeX - mainly appropriate 
+   character escapes.
+ * Added the "marker" attribute to the "footnote" element.
+
+1 May 2001 (version 0.4.0)
+
+ * Added the "link" element to the set of allowable "meta" elements.
+   Although not a Dublin Core meta-data element, it's functionality
+   adds a lot to the document.
+
+30 April 2001 (version 0.3.0)
+
+ * Changed the basic orgranization of the sections by allowing them to
+   have their own meta section instead of a "section-title" element.
+ * Changed the name of the "section-data" element to simply "data".
+
+17 April 2001 (version 0.2.0)
+
+ * Changed some of the block and inline elements in order to make them 
+   more useful.
+
+14 April 2001 (version 0.1.0)
+
+ * First revision
+                                                                   -->
+<!-- ============================================================= -->
+
+<!-- ============================================================= -->
+<!--                      Table of Contents                        -->
+<!-- ============================================================= -->
+
+<!--
+
+  I. Entities
+     A. General Entities
+     B. Character Entities
+ II. Hierarchical Elements
+III. Block Elements
+ IV. Inline Elements
+
+  V. Appendices
+     A. Valid Document Example
+
+-->
+
+<!-- ============================================================= -->
+<!--                           Entities                            -->
+<!-- ============================================================= -->
+
+<!-- ::::::::::::::::::::: General Entities :::::::::::::::::::::: -->
+
+<!ENTITY % block.content "p | ul | ol | dl | table | blockquote | illustration | combat | choice | signpost | hr">
+
+<!ENTITY % inline.content "#PCDATA | a | em | strong | thought | foreign | quote | cite | code | br | typ | onomatopoeia | spell | item">
+
+<!ENTITY % core.attributes "
+         class CDATA #IMPLIED
+         xml:lang CDATA #IMPLIED
+">
+
+<!ENTITY % link.attributes "
+         idref IDREF #IMPLIED
+         id    ID    #IMPLIED
+">
+
+<!ENTITY % cell.align.attributes "
+         align  ( left | center | right | justify | char ) #IMPLIED
+         char   CDATA                                      #IMPLIED
+         valign ( top | middle | bottom | baseline )       #IMPLIED
+">
+
+<!-- :::::::::::::::::::: Character Entities ::::::::::::::::::::: -->
+
+<!ENTITY lt     "&#38;#60;"><!-- left angle bracket -->
+<!ENTITY gt     "&#62;">    <!-- right angle bracket -->
+<!ENTITY amp    "&#38;#38;"><!-- ampersand -->
+<!ENTITY apos   "&#39;">    <!-- apostrophe = single quotation mark -->
+<!ENTITY quot   "&#34;">    <!-- double quotation mark -->
+
+
+<!--
+
+It is the responsibility of the document to define relevant character 
+entities in its internal subset.
+
+-->
+
+<!-- ============================================================= -->
+<!--                     Hierarchical Elements                     -->
+<!-- ============================================================= -->
+
+
+<!ELEMENT gamebook ( meta, section+ )>
+<!ATTLIST gamebook
+          version  CDATA #REQUIRED
+          xml:lang CDATA #IMPLIED
+>
+<!--
+
+The "version" attribute represents the revision number of the gamebook 
+DTD. This allows gamebook processors to make decisions about the 
+suitability of the data.
+
+The "xml:lang" attribute specifies the primary language of the 
+document. The data should conform to the IETF RFC1766.
+
+ http://www.ietf.org/rfc/rfc1766.txt
+
+Examples:
+
+ <gamebook version="0.11" xml:lang="en-UK">
+  <meta . . .> . . . </meta>
+  <section . . .> . . . </section>
+  . . .
+ </gamebook>
+
+ <gamebook version="0.11" > . . . </gamebook>
+
+-->
+
+<!-- :::::::::::::::::::::::: meta Element ::::::::::::::::::::::: -->
+<!--
+
+The children of the meta element are designed to directly translate to
+the Dublin Core Element Set v1.1. For a description of each Dublin
+Core element, visit the following URL:
+
+ (http://dublincore.org/documents/1999/07/02/dces/)
+
+Although many Dublin Core elements will probably never have any real 
+relevance to gamebooks, all are included for completeness's sake.
+
+[editor: add dc: namespace to isolate dublin core elements
+  http://dublincore.org/documents/2001/10/26/dcmi-namespace/ ]
+
+Note: The "link" element doesn't correspond directly to any Dublin
+Core element. It has been added here for required functionality.
+-->
+
+<!ELEMENT meta ( title | creator | subject | description | publisher | contributor | date | type | format | identifier | source | language | relation | coverage | rights | link)*>
+<!--
+
+The "meta" element represents underlying information about the 
+document. It should contain any number of the Dublin Core 1.1 
+elements.
+
+Example:
+
+ <meta>
+  <title . . .> . . . </title>
+  <creator . . .> . . . </creator>
+  . . .
+ </meta>
+
+-->
+
+<!ELEMENT title ( %inline.content; )*>
+<!ATTLIST title
+          %core.attributes;
+>
+
+<!ELEMENT creator ( %inline.content; | %block.content; )*>
+<!ATTLIST creator
+          %core.attributes;
+>
+
+<!ELEMENT subject ( %inline.content; | %block.content; )*>
+<!ATTLIST subject
+          %core.attributes;
+>
+
+<!ELEMENT description ( %inline.content; | %block.content; )*>
+<!ATTLIST description
+          %core.attributes;
+>
+
+<!ELEMENT publisher ( %inline.content; | %block.content; )*>
+<!ATTLIST publisher
+          %core.attributes;
+>
+
+<!ELEMENT contributor ( %inline.content; | %block.content; )*>
+<!ATTLIST contributor
+          %core.attributes;
+>
+
+<!ELEMENT date ( year, month, day )>
+<!ATTLIST date
+          %core.attributes;
+>
+<!--
+
+The "date" element has been extended beyond the specification made in 
+the Dublin Core. It should contain "year", "month" and "day" elements.
+
+Example:
+
+ <date>
+  <year . . .> . . . </year>
+  <month . . .> . . . </month>
+  <day . . .> . . . </day>
+ </date>
+
+-->
+
+<!ELEMENT year ( #PCDATA )>
+<!--
+
+The year should be specified in full digit numeric format.
+
+Example:
+
+ <year>2001</year>
+
+-->
+
+<!ELEMENT month ( #PCDATA )>
+<!--
+
+The month should be specified in numeric format with January as "1", 
+February as "2", etc.
+
+Example:
+
+ <month>4</month>
+
+-->
+
+<!ELEMENT day ( #PCDATA )>
+<!--
+
+The "day" element specifies the day of the month in numeric format.
+
+Example:
+
+ <day>14</day>
+
+-->
+
+<!ELEMENT type ( %inline.content; )*>
+<!ATTLIST type
+          %core.attributes;
+>
+
+<!ELEMENT format ( %inline.content; )*>
+<!ATTLIST format
+          %core.attributes;
+>
+
+<!ELEMENT identifier ( %inline.content; )*>
+<!ATTLIST identifier
+          %core.attributes;
+>
+
+<!ELEMENT source ( %inline.content; )*>
+<!ATTLIST source
+          %core.attributes;
+>
+
+<!ELEMENT language ( %inline.content; )*>
+<!ATTLIST language
+          %core.attributes;
+>
+
+<!ELEMENT relation ( %inline.content; )*>
+<!ATTLIST relation
+          %core.attributes;
+>
+
+<!ELEMENT coverage ( %inline.content; | %block.content; )*>
+<!ATTLIST coverage
+          %core.attributes;
+>
+
+<!ELEMENT rights ( %inline.content; | %block.content; )*>
+<!ATTLIST rights
+          %core.attributes;
+>
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+          %core.attributes;
+          %link.attributes;
+          idrefs IDREFS #IMPLIED>
+<!--
+
+The "link" element has been added to the Dublin Core elements to 
+represent relationships to other parts of the document. The "idrefs" 
+attribute has been added to allow relationships that are held with 
+more than one part of the document.
+
+Examples:
+
+ <link class="next" idref="dedicate" />
+
+ <link class="friends" idrefs="dedicate cmbtrulz" />
+
+-->
+
+<!-- ::::::::::::::::::::: section Element ::::::::::::::::::::::: -->
+
+<!ELEMENT section ( meta, footnotes?, data )>
+<!ATTLIST section
+          %core.attributes;
+          %link.attributes;
+>
+<!--
+
+The "section" element represents one hierarchical level of data. 
+Section elements can be nested (inside the "data" element) in 
+order to create more complex data representations.
+
+A "section" element can used as a linking element. The most useful way 
+to utilize this is to make it a named anchor and thus the target of a 
+"choice" element.
+
+Examples:
+
+ <section>
+  <meta><title . . .> . . . </title></meta>
+  <data . . .> . . . </data>
+  <footnotes . . .> . . . </footnotes>
+ </section>
+
+ <section id="title">
+  <meta><title . . .> . . . </title></meta>
+  <data . . .>
+   . . .
+   <section id="dedication">
+    <meta><title . . .> . . . </title></meta>
+    <data . . .> . . . </data>
+   </section>
+   . . .
+  </data>
+ </section>
+
+-->
+
+<!ELEMENT data ( %block.content; | section )*>
+<!ATTLIST data
+          %core.attributes;
+>
+<!--
+
+The "data" element contains the main data contained within 
+a section. Note that a nested section structure can be created by 
+including a "section" element within the content of the "data" 
+element.
+
+Examples:
+
+ <data>
+  <p . . .> . . . </p>
+  <combat . . .> . . . </combat>
+  . . .
+ </data>
+
+ <data>
+  <section . . .> . . . </section>
+ </data>
+
+-->
+
+<!ELEMENT footnotes ( footnote )*>
+<!ATTLIST footnotes
+          %core.attributes;
+>
+<!--
+
+The "footnotes" element represents the collection of extra-textual 
+information contained within "footnote" elements.
+
+Example:
+
+ <footnotes>
+  <footnote . . .> . . . </footnote>
+  <footnote . . .> . . . </footnote>
+  . . .
+ </footnotes> 
+
+-->
+
+<!ELEMENT footnote ( %block.content; )*>
+<!ATTLIST footnote
+          %core.attributes;
+          %link.attributes;
+>
+<!--
+
+The "footnote" element contains extra-textual information. It can be 
+used as a linking element and can thus be used to refer back to a 
+named anchor within the document.
+
+Example:
+
+ <data . . .>
+  <p . . .>This paragraph requires an appropriate 
+   <a id="reference" idref="footnote-reference" . . .>footnote</a>.
+  </p>
+  . . .
+ </data>
+ <footnotes . . .>
+  <footnote id="footnote-reference" idref="reference">
+   <p . . .>This is the appropriate footnote.</p>
+  </footnote>
+  . . .
+ </footnotes>
+
+-->
+
+<!-- ============================================================= -->
+<!--                        Block Elements                         -->
+<!-- ============================================================= -->
+
+<!-- :::::::::::::::::::::::::: Lists :::::::::::::::::::::::::::: -->
+
+<!ELEMENT ul ( li )*>
+<!ATTLIST ul
+          %core.attributes;
+>
+<!--
+
+The "ul" represents an unordered list.
+
+Example:
+
+ <ul>
+  <li . . .> . . . </li>
+  <li . . .> . . . </li>
+  . . .
+ </ul>
+
+-->
+
+<!ELEMENT ol ( li )*>
+<!ATTLIST ol
+          %core.attributes;
+>
+<!--
+
+The "ol" element represents an ordered list.
+
+Example:
+
+ <ol>
+  <li . . .> . . . First Item . . . </li>
+  <li . . .> . . . Second Item . . . </li>
+  . . .
+ </ol>
+
+-->
+
+<!ELEMENT li ( %inline.content; | %block.content; )*>
+<!ATTLIST li
+          %core.attributes;
+>
+<!--
+
+The "li" element is a generic list item used within both ordered and 
+unordered lists (i.e. "ol" and "ul" elements).
+
+Examples:
+
+ <ul . . .>
+  . . .
+  <li>list item</li>
+  <li>another list item</li>
+  . . .
+ </ul>
+
+ <ol . . .>
+  <li>first list item</li>
+  <li>second list item</li>
+  . . .
+ </ol>
+
+-->
+
+<!ELEMENT dl ( dt, dd? )*>
+<!ATTLIST dl
+          %core.attributes;
+>
+<!--
+
+The "dl" element represents a list of terms and their definitions.
+
+Example:
+
+ <dl>
+  <dt . . .> . . . First Term . . . </dt>
+   <dd . . .> . . . First Term's Definition . . . </dd>
+   . . .
+  <dt . . .> . . . Second Term . . . </dt>
+   <dd . . .> . . . Second Term's Definition . . . </dd>
+  <dt . . .> . . . Third Term with No Definition . . . </dt>
+ </dl>
+
+-->
+
+<!ELEMENT dt ( %inline.content; )*>
+<!ATTLIST dt
+          %core.attributes;
+>
+<!--
+
+The "dt" element represents a definition term within a definition 
+list. It should be immediately followed by its definitions contained 
+within "dd" elements.
+
+Example:
+
+ <dl . . .>
+  . . .
+  <dt>Definition Term</dt>
+   <dd . . .> . . . Definition . . . </dd>
+  . . .
+ </dl>
+
+-->
+
+<!ELEMENT dd ( %inline.content; | %block.content; )*>
+<!ATTLIST dd
+          %core.attributes;
+>
+<!--
+
+The "dd" element contains a definition.
+
+Example:
+
+ <dt . . .> . . . Term to be defined . . . </dt>
+  <dd>Definition of the term.</dd>
+
+-->
+
+<!-- :::::::::::::::::::::::::: Tables ::::::::::::::::::::::::::: -->
+
+<!ELEMENT table ( tr )*>
+<!ATTLIST table
+          %core.attributes;
+>
+<!--
+
+The "table" element represents tabular data. It's data is organized 
+within rows.
+
+Example:
+
+ <table>
+  <tr . . .> . . . </tr>
+  <tr . . .> . . . </tr>
+  . . .
+ </table>
+
+-->
+
+<!ELEMENT tr ( th | td )*>
+<!ATTLIST tr
+          %core.attributes;
+>
+<!--
+
+The "tr" element contains a collection of "th" and "td" elements that 
+represent one row of a "table".
+
+Example:
+
+ <table . . .>
+  . . .
+  <tr>
+   <th . . .> . . . </th>
+   <td . . .> . . . </td>
+   . . .
+  </tr>
+  . . .
+ </table>
+
+-->
+
+<!ELEMENT th ( %inline.content; )*>
+<!ATTLIST th
+          %core.attributes;
+          %cell.align.attributes;
+>
+<!--
+
+The "th" contains a table header used to label a particular row or 
+column of tabular data.
+
+Example:
+
+ <tr . . .>
+  . . .
+  <th>Row Label</th>
+  <td . . .> . . . </td>
+  <td . . .> . . . </td>
+  . . .
+ </tr>
+
+-->
+
+<!ELEMENT td ( %inline.content; )*>
+<!ATTLIST td
+          %core.attributes;
+          %cell.align.attributes;
+>
+<!--
+
+The "td" element contains one cell of tabular data.
+
+Example:
+
+ <tr . . .>
+  . . .
+  <td>Cell data</td>
+  . . .
+ </tr>
+
+-->
+
+<!-- :::::::::::::::::::::: Miscellaneous :::::::::::::::::::::::: -->
+
+<!ELEMENT p ( %inline.content; )*>
+<!ATTLIST p
+          %core.attributes;
+>
+<!--
+
+The "p" element contains a paragraph.
+
+Example:
+
+ <p>This is a (short) paragraph.</p>
+
+-->
+
+<!ELEMENT blockquote ( %block.content; )*>
+<!ATTLIST blockquote
+          %core.attributes;
+>
+<!--
+
+The "blockquote" element contains a lengthy quotation which isn't 
+contained within a paragraph.
+
+Example:
+
+ <blockquote>
+  <p>There was once a Kai monk from Sommerlund . . .</p>
+ </blockquote>
+
+-->
+
+<!ELEMENT combat ( enemy, enemy-attribute+ )>
+<!ATTLIST combat
+          %core.attributes;
+>
+<!--
+
+The "combat" element contains one combat represented by the enemy's 
+name and attributes.
+
+Example:
+
+ <combat>
+  <enemy . . .> . . . </enemy>
+  <enemy-attribute . . .> . . . </enemy-attribute>
+  <enemy-attribute . . .> . . . </enemy-attribute>
+  . . .
+ </combat>
+
+-->
+
+<!ELEMENT enemy ( %inline.content; )*>
+<!ATTLIST enemy
+          %core.attributes;
+>
+<!--
+
+The "enemy" element contains an enemy's name.
+
+Example:
+
+ <combat . . .>
+  . . .
+  <enemy>12-foot Giak</enemy>
+  . . .
+ </combat>
+
+-->
+
+<!ELEMENT enemy-attribute ( #PCDATA )*>
+<!ATTLIST enemy-attribute
+          %core.attributes;
+>
+<!--
+
+The "enemy-attribute" element contains one particular attribute which 
+describes an enemy.
+
+Example:
+
+ <combat . . .>
+  . . .
+  <enemy-attribute>30</enemy-attribute>
+  . . .
+ </combat>
+
+-->
+
+<!ELEMENT choice ( %inline.content; | link-text )*>
+<!ATTLIST choice
+          %core.attributes;
+          %link.attributes;
+>
+<!--
+
+The "choice" element contains the text describing a choice presented 
+within a section. It's a linking element and therefore can link to 
+the place to which the choice leads.
+
+The choice element can contain "link-text" elements which suggest text 
+that should be used by the user agent to represent the hyperlink.
+
+Example:
+
+ <section id="section12" . . .> . . . </section>
+ . . .
+ <choice idref="section12">If you would like to fight the 12-foot Giak, 
+  <link-text . . .> . . . turn to 12. . . . </link-text>
+ </choice>
+
+-->
+
+<!ELEMENT link-text ( %inline.content; )*>
+<!ATTLIST link-text
+          %core.attributes;
+>
+<!--
+
+The "link-text" element contains text which is suggested for use by 
+hypertext user interfaces to represent one end of a hyperlink.
+
+Example:
+
+ <choice . . .>
+  . . .
+  <link-text>the unfortunately ubiquitous "Click Here!"</link-text>
+  . . .
+ </choice>
+
+-->
+
+<!ELEMENT illustration ( meta?, instance+ )>
+<!ATTLIST illustration
+          %core.attributes;
+          %link.attributes;
+>
+
+<!--
+
+The "illustration" element contains a set of alternate 
+representations of a particular illustration.
+
+Example:
+
+ <illustration>
+  <meta> . . . </meta>
+  <instance . . .> . . . </instance>
+  <instance . . .> . . . </instance>
+  . . .
+ </illustration>
+
+-->
+
+<!ELEMENT instance ( %inline.content; | %block.content; )*>
+<!ATTLIST instance
+          %core.attributes;
+          src         CDATA #IMPLIED
+          width       CDATA #IMPLIED
+          height      CDATA #IMPLIED
+          mime-type   CDATA #IMPLIED
+>
+<!--
+
+The "instance" element describes one instance of an illustration.
+
+The "src" attribute is a URL for the data file for the illustration.
+
+The "width" and "height" attributes contain the dimensions of the 
+illustration.
+
+The "mime-type" attribute can contain an appropriate label for the 
+format of the illustration file (e.g. "image/png" or "image/jpeg").
+
+The "instance" element can contain block or inline content that
+is intended to replace graphical illustrations.
+
+Example:
+
+ <illustration . . .>
+  . . .
+  <instance src="17.gif" width="386" height="532" type="image/gif" />
+  <instance src="" width="" height="" type="text" >
+   [content here]
+  </instance>
+  . . .
+ </illustration>
+
+-->
+
+<!ELEMENT signpost ( %inline.content; | %block.content; )*>
+<!ATTLIST signpost
+          %core.attributes;
+>
+<!--
+
+The "signpost" element contains the text of a sign or message that
+should be presented offset from surrounding text.
+
+Example:
+
+ <signpost>RENDALIM'S LABORATORY</signpost>
+
+-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+          %core.attributes;
+>
+<!--
+
+The "hr" element designates a horizontal rule. Since this is a 
+presentational tag, it should be used sparingly in cases where new
+logical divisions of the text begin which aren't given a unique 
+title.
+
+Example:
+
+ <hr />
+
+--> 
+
+<!-- ============================================================= -->
+<!--                       Inline Elements                         -->
+<!-- ============================================================= -->
+
+<!ELEMENT a ( %inline.content; )*>
+<!ATTLIST a
+          %core.attributes;
+          %link.attributes;
+          href CDATA #IMPLIED
+>
+<!--
+
+The "a" element is used to contain inline content that should be a 
+hypertext anchor.
+
+The "href" attribute is added to allow a reference outside of the 
+document itself.
+
+Example:
+
+ <p . . .>
+  . . .
+  <a idref="section12" id="foo">Section 12</a>
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT em ( %inline.content; )*>
+<!ATTLIST em
+          %core.attributes;
+>
+<!--
+
+The "em" element contains text that should be emphasized. Although not 
+part of the DTD and therefore not guaranteed or required to be so, the 
+text should be typeset with an italic font.
+
+ <p . . .>
+  . . .
+  <em>You are being attacked!</em>
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT strong ( %inline.content; )*>
+<!ATTLIST strong
+          %core.attributes;
+>
+<!--
+
+The "strong" element contains text that should be emphasized. Although 
+not part of the DTD and therefore not guaranteed or required to be so, 
+the text should be typeset with a bold font weight.
+
+ <p . . .>
+  . . .
+  <strong>If</strong> you have the Talisman of Supreme Obscurity,
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT thought ( %inline.content; )*>
+<!ATTLIST thought
+          %core.attributes;
+>
+<!--
+
+The "thought" element contains text that is the character's thoughts or is 
+an overheard thought. Although not part of the DTD and therefore not 
+guaranteed or required to be so, the text should be typeset with an italic
+font face.
+
+ <p . . .>
+  . . .
+  Lone Wolf heard the words <thought>Die Northlander!</strong> echo in
+  his mind,
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT foreign ( %inline.content; )*>
+<!ATTLIST foreign
+          %core.attributes;
+>
+<!--
+
+The "foreign" element contains a phrase in a non-native language.
+Although not part of the DTD and therefore not guaranteed or required 
+to be so, the text should be typeset with an italic font face.
+
+ <p . . .>
+  . . .
+  The Giak horde attacked <foreign>en masse</foreign>.
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT quote ( %inline.content; )*>
+<!ATTLIST quote
+          %core.attributes;
+>
+<!--
+
+The "quote" element contains an inline quotation.
+
+Example:
+
+ <p . . .>The Giak yelped <quote . . .>Oww!</quote></p>
+
+-->
+
+<!ELEMENT cite ( %inline.content; )*>
+<!ATTLIST cite
+          %core.attributes;
+>
+<!--
+
+The "cite" element contains the title of a sited resource.
+
+Example:
+
+ <p . . .>
+  . . .
+  <cite>Flight from the Dark</cite>
+  . . .
+ </p>
+
+-->
+
+<!ELEMENT code ( %inline.content; )*>
+<!ATTLIST code
+          %core.attributes;
+>
+<!--
+
+The "code" element contains data that should be interpreted as literal 
+input to a computer (e.g. email addresses and URIs).
+
+Example:
+
+ <code>staff@projectaon.org</code>
+
+-->
+
+<!ELEMENT br EMPTY>
+<!ATTLIST br
+          %core.attributes;
+>
+<!--
+
+The "br" indicates a required line break. Its use should be confined 
+to documents such as poems that require a particular line structure.
+
+Example:
+
+ <blockquote . . .>
+  . . .
+  There once was a Kai monk from Sommerlund<br />
+  Who always wore a cummerbund<br />
+  . . .
+ </blockquote>
+
+-->
+
+<!ELEMENT typ ( #PCDATA )>
+<!ATTLIST typ
+          %core.attributes;
+>
+<!--
+
+The "typ" element is used to denote purely typographical markup. For
+example, bold font face, italics, and smaller font are purely of
+typographical concern. Take care to not use this in place of logical
+markup such as the "em" element when it is more appropriate.
+
+Example:
+
+The <typ class="bold">Project Aon</a> volunteers.
+
+-->
+
+<!ELEMENT onomatopoeia ( #PCDATA )>
+<!ATTLIST onomatopoeia
+          %core.attributes;
+>
+<!--
+
+The "onomatopoeia" element is used to denote words that imitate a
+sound (e.g., "whoosh", "bang").
+
+Example:
+
+The <onomatopoeia>clang</onomatopoeia> of the bell is deafening.
+
+-->
+
+<!ELEMENT spell ( #PCDATA )>
+<!ATTLIST spell
+          %core.attributes;
+>
+<!--
+
+The "spell" element contains the name of a magic spell.
+
+Example:
+
+Having had no success with his female peers, the acolyte learned the
+forbidden <spell>Attract Opposite Gender</spell> spell.
+
+-->
+
+<!ELEMENT item ( #PCDATA )>
+<!ATTLIST item
+          %core.attributes;
+>
+<!--
+
+The "item" element contains the name of an item that the reader can
+pick up or interact with.
+
+Example:
+
+Her <item>Sword</a> lay just out of reach.
+
+-->
+
+<!-- ============================================================= -->
+<!--                          Appendices                           -->
+<!-- ============================================================= -->
+
+<!-- :::::::::::::: Valid Gamebook Document Example :::::::::::::: -->
+<!--
+This document is not intended to document current practice in Project
+Aon. It is merely here to demonstrate the concepts of the Gamebook 
+DTD. For current practice, please refer to published XML files.
+-->
+
+<!--
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE gamebook SYSTEM "gamebook.dtd">
+
+<gamebook version="0.11" xml:lang="en-UK">
+
+<meta>
+ <title>Flight from the Dark</title>
+ <creator>Joe Dever and Gary Chalk</creator>
+ <publisher>Project Aon</publisher>
+ <date><year>2001</year><month>10</month><day>24</day></date>
+ <rights>Copyright &copy; 1984 Joe Dever and Gary Chalk.</rights>
+</meta>
+
+<section id="section1">
+ <meta><title>1</title></meta>
+ <data>
+  <p>You must make haste for you sense it is not safe to linger by the smoking remains of the ruined monastery. The black-winged beasts could return at any moment. You must set out for the Sommerlund capital of Holmgard and tell the King the terrible news of the massacre: that the whole &eacute;lite of Kai warriors, save yourself, have been slaughtered. Without the Kai Lords to lead her armies, Sommerlund will be at the mercy of their ancient enemy, the Darklords.</p>
+  <p>Fighting back tears, you bid farewell to your dead kinsmen. Silently, you promise that their deaths will be avenged. You turn away from the ruins and carefully descend the steep track.</p>
+  <p>At the foot of the hill, the path splits into two directions, both leading into a large wood.</p>
+
+  <choice idref="section85">If you wish to take the right path into the wood, <link-text>turn to 85</link-text>.</choice>
+  <choice idref="section275">If you wish to follow the left track, <link-text>turn to 275</link-text>.</choice>
+  <choice idref="section141">If you wish to use your Kai Discipline of Sixth Sense, <link-text>turn to 141</link-text>.</choice>
+ </data>
+ <footnotes>
+  <footnote><p>Later books use <quote>Sommlending</quote> as the possessive adjective for Sommerlund, contrary to the use of the word <quote>Sommerlund</quote> in the third sentence. This is probably not a typo, but a reflection of Joe Dever&apos;s later expansion of the vocabulary of Magnamund.</p></footnote>
+ </footnotes>
+</section>
+
+<section id="section17">
+ <meta><title>17</title></meta>
+ <data>
+  <p>You raise your weapon to strike at the beast as its razor-fanged mouth snaps shut just inches from your head. Buffeted by the beating of its wings you find it difficult to stand.</p>
+
+  <illustration>
+   <instance src="1.gif" width="386" height="532" mime-type="image/gif" />
+  </illustration>
+
+  <p>Deduct 1 point from your <typ class="attribute">COMBAT SKILL</typ> and fight the Kraan.</p>
+
+  <combat>
+   <enemy>Kraan:</enemy>
+   <enemy-attribute>16</enemy-attribute>
+   <enemy-attribute>24</enemy-attribute>
+  </combat>
+
+  <p>If you kill the creature, you quickly descend the far side of the hill to avoid the Giaks.</p>
+  <p>Pick a number from the Random Number Table.</p>
+
+  <choice idref="section53">If you pick 0, <link-text>turn to 53</link-text>.</choice>
+  <choice idref="section274">If you pick 1&endash;2, <link-text>turn to 274</link-text>.</choice>
+  <choice idref="section316">If you pick 3&endash;9, <link-text>turn to 316</link-text>.</choice>
+ </data>
+</section>
+
+<section id="section53">
+ <meta><title>53</title></meta>
+ <data />
+</section>
+
+<section id="section85">
+ <meta><title>85</title></meta>
+ <data />
+</section>
+
+<section id="section141">
+ <meta><title>141</title></meta>
+ <data />
+</section>
+
+<section id="section274">
+ <meta><title>274</title></meta>
+ <data />
+</section>
+
+<section id="section275">
+ <meta><title>275</title></meta>
+ <data />
+</section>
+
+<section id="section316">
+ <meta><title>316</title></meta>
+ <data />
+</section>
+
+</gamebook>
+
+-->
diff --git a/xml/geninc.mod b/xml/geninc.mod
new file mode 100644 (file)
index 0000000..7d2fbe3
--- /dev/null
@@ -0,0 +1,16 @@
+<!-- ============================================================= -->
+<!--                 General Inclusions Module v0.1                -->
+<!-- ============================================================= -->
+<!--
+
+These inclusions define commonly used snippets of text.
+
+-->
+
+<!ENTITY inclusion.joe.dever.bio.lw      SYSTEM "jdbiolw.inc">
+<!ENTITY inclusion.joe.dever.bio.gs      SYSTEM "jdbiogs.inc">
+<!ENTITY inclusion.gary.chalk.bio.lw     SYSTEM "gcbiolw.inc">
+<!ENTITY inclusion.brian.williams.bio.lw SYSTEM "bwbiolw.inc">
+<!ENTITY inclusion.ian.page.bio.gs       SYSTEM "ipbiogs.inc">
+<!ENTITY inclusion.joe.dever.endowment   SYSTEM "endowmnt.inc">
+<!ENTITY inclusion.project.aon.license   SYSTEM "license.inc">
diff --git a/xml/genlink.mod b/xml/genlink.mod
new file mode 100644 (file)
index 0000000..5aa077b
--- /dev/null
@@ -0,0 +1,13 @@
+<!-- ============================================================= -->
+<!--                    General Links Module v0.1                  -->
+<!-- ============================================================= -->
+<!--
+
+These entities define URLs of general utility.
+
+-->
+
+<!ENTITY link.project.website    "http://www.projectaon.org/">
+<!ENTITY link.staff.email        "staff@projectaon.org">
+<!ENTITY link.gary.chalk.website "http://www.garychalk.com/">
+<!ENTITY link.the.affair.website "http://www.theaffair.co.uk/">
\ No newline at end of file
diff --git a/xml/htmlchar.mod b/xml/htmlchar.mod
new file mode 100644 (file)
index 0000000..6c0c809
--- /dev/null
@@ -0,0 +1,128 @@
+<!-- ============================================================= -->
+<!--                  XHTML Characters Module v0.1                 -->
+<!-- ============================================================= -->
+<!--
+
+This module defines the mapping between the character entities used in
+the Project Aon instances of Gamebook XML and the ISO-8859-1
+characters.
+
+Portions Copyright International Organization for Standardization 1986 
+Permission to copy in any form is granted for use with conforming SGML 
+systems and applications as defined in ISO 8879, provided this notice 
+is included in all copies.
+
+-->
+
+<!ENTITY nbsp   "&#160;"><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
+<!ENTITY iexcl  "&#161;"><!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent   "&#162;"><!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound  "&#163;"><!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"><!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen    "&#165;"><!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
+<!ENTITY sect   "&#167;"><!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml    "&#168;"><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
+<!ENTITY copy   "&#169;"><!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf   "&#170;"><!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo  "&#171;"><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not    "&#172;"><!-- not sign, U+00AC ISOnum -->
+<!ENTITY shy    "&#173;"><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
+<!ENTITY reg    "&#174;"><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
+<!ENTITY macr   "&#175;"><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg    "&#176;"><!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
+<!ENTITY sup2   "&#178;"><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
+<!ENTITY sup3   "&#179;"><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
+<!ENTITY acute  "&#180;"><!-- acute accent = spacing acute, U+00B4 ISOdia -->
+<!ENTITY micro  "&#181;"><!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para   "&#182;"><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil  "&#184;"><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1   "&#185;"><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
+<!ENTITY ordm   "&#186;"><!-- masculine ordinal indicator, U+00BA ISOnum -->
+<!ENTITY raquo  "&#187;"><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"><!-- latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
+<!ENTITY Acirc  "&#194;"><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
+<!ENTITY Auml   "&#196;"><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
+<!ENTITY Aring  "&#197;"><!-- latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 -->
+<!ENTITY AElig  "&#198;"><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
+<!ENTITY Ecirc  "&#202;"><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
+<!ENTITY Euml   "&#203;"><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
+<!ENTITY Icirc  "&#206;"><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
+<!ENTITY Iuml   "&#207;"><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
+<!ENTITY ETH    "&#208;"><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
+<!ENTITY Ocirc  "&#212;"><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
+<!ENTITY Ouml   "&#214;"><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
+<!ENTITY times  "&#215;"><!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"><!-- latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
+<!ENTITY Ucirc  "&#219;"><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
+<!ENTITY Uuml   "&#220;"><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
+<!ENTITY THORN  "&#222;"><!-- latin capital letter THORN, U+00DE ISOlat1 -->
+<!ENTITY szlig  "&#223;"><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"><!-- latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
+<!ENTITY acirc  "&#226;"><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
+<!ENTITY auml   "&#228;"><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
+<!ENTITY aring  "&#229;"><!-- latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 -->
+<!ENTITY aelig  "&#230;"><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
+<!ENTITY ecirc  "&#234;"><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
+<!ENTITY euml   "&#235;"><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"><!-- latin small letter i with grave, U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"><!-- latin small letter i with acute, U+00ED ISOlat1 -->
+<!ENTITY icirc  "&#238;"><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
+<!ENTITY iuml   "&#239;"><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
+<!ENTITY eth    "&#240;"><!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
+<!ENTITY ocirc  "&#244;"><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
+<!ENTITY ouml   "&#246;"><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"><!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"><!-- latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"><!-- latin small letter u with acute, U+00FA ISOlat1 -->
+<!ENTITY ucirc  "&#251;"><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
+<!ENTITY uuml   "&#252;"><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"><!-- latin small letter y with acute, U+00FD ISOlat1 -->
+<!ENTITY thorn  "&#254;"><!-- latin small letter thorn, U+00FE ISOlat1 -->
+<!ENTITY yuml   "&#255;"><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
+
+<!-- ::::::::::::::::::::: Special Characters :::::::::::::::::::: -->
+
+<!ENTITY ampersand "&amp;"><!-- ampersand -->
+<!ENTITY lsquot    "&apos;"><!-- opening left quotation mark -->
+<!ENTITY rsquot    "&apos;"><!-- closing right quotation mark -->
+<!ENTITY ldquot    "&quot;"><!-- opening left double quotation mark -->
+<!ENTITY rdquot    "&quot;"><!-- closing right double quotation mark -->
+<!ENTITY minus     "-"><!-- mathematical minus -->
+<!ENTITY endash    "-"><!-- endash -->
+<!ENTITY emdash    "--"><!-- emdash -->
+<!ENTITY ellips    "&nbsp;.&nbsp;.&nbsp;."><!-- ellipsis -->
+<!ENTITY lellips   ".&nbsp;.&nbsp;.&nbsp;"><!-- left ellipsis, used at the beginning of edited material -->
+<!ENTITY blankline "_______"><!-- blank line to be filled in -->
+<!ENTITY percent   "&#37;"><!-- percent sign -->
+<!ENTITY thinspace ""><!-- small horizontal space for use between adjacent quotation marks - added mainly for LaTeX's sake -->
diff --git a/xml/htmllink.mod b/xml/htmllink.mod
new file mode 100644 (file)
index 0000000..3cf6673
--- /dev/null
@@ -0,0 +1,53 @@
+<!-- ============================================================= -->
+<!--                    XHTML Links Module v0.1                    -->
+<!-- ============================================================= -->
+<!--
+
+These entities define link URLs between books when using XHTML. Note
+that the facility hasn't been added to link between book series
+although it would be trivial to do so.
+
+-->
+
+<!ENTITY link.01fftd  "../../lw/01fftd/title.htm">
+<!ENTITY link.02fotw  "../../lw/02fotw/title.htm">
+<!ENTITY link.03tcok  "../../lw/03tcok/title.htm">
+<!ENTITY link.04tcod  "../../lw/04tcod/title.htm">
+<!ENTITY link.05sots  "../../lw/05sots/title.htm">
+<!ENTITY link.06tkot  "../../lw/06tkot/title.htm">
+<!ENTITY link.07cd    "../../lw/07cd/title.htm">
+<!ENTITY link.08tjoh  "../../lw/08tjoh/title.htm">
+<!ENTITY link.09tcof  "../../lw/09tcof/title.htm">
+<!ENTITY link.10tdot  "../../lw/10tdot/title.htm">
+<!ENTITY link.11tpot  "../../lw/11tpot/title.htm">
+<!ENTITY link.12tmod  "../../lw/12tmod/title.htm">
+<!ENTITY link.13tplor "../../lw/13tplor/title.htm">
+<!ENTITY link.14tcok  "../../lw/14tcok/title.htm">
+<!ENTITY link.15tdc   "../../lw/15tdc/title.htm">
+<!ENTITY link.16tlov  "../../lw/16tlov/title.htm">
+<!ENTITY link.17tdoi  "../../lw/17tdoi/title.htm">
+<!ENTITY link.18dotd  "../../lw/18dotd/title.htm">
+<!ENTITY link.19wb    "../../lw/19wb/title.htm">
+<!ENTITY link.20tcon  "../../lw/20tcon/title.htm">
+<!ENTITY link.21votm  "../../lw/21votm/title.htm">
+<!ENTITY link.22tbos  "../../lw/22tbos/title.htm">
+<!ENTITY link.23mh    "../../lw/23mh/title.htm">
+<!ENTITY link.24rw    "../../lw/24rw/title.htm">
+<!ENTITY link.25totw  "../../lw/25totw/title.htm">
+<!ENTITY link.26tfobm "../../lw/26tfobm/title.htm">
+<!ENTITY link.27v     "../../lw/27v/title.htm">
+<!ENTITY link.28thos  "../../lw/28thos/title.htm">
+
+<!ENTITY link.01gstw  "../../gs/01gstw/title.htm">
+<!ENTITY link.02tfc   "../../gs/02tfc/title.htm">
+<!ENTITY link.03btng  "../../gs/03btng/title.htm">
+<!ENTITY link.04wotw  "../../gs/04wotw/title.htm">
+
+<!ENTITY link.01hh    "../../fw/01hh/title.htm">
+<!ENTITY link.02smr   "../../fw/02smr/title.htm">
+<!ENTITY link.03oz    "../../fw/03oz/title.htm">
+<!ENTITY link.04cc    "../../fw/04cc/title.htm">
+
+<!ENTITY link.rh      "../../misc/rh/title.htm">
+<!ENTITY link.tmc     "../../misc/tmc/title.htm">
+
diff --git a/xml/identity.xsl b/xml/identity.xsl
new file mode 100644 (file)
index 0000000..b800311
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="node()|@*">
+  <xsl:copy>
+   <xsl:apply-templates select="node()|@*"/>
+  </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/xml/indent.xsl b/xml/indent.xsl
new file mode 100644 (file)
index 0000000..c7b75e7
--- /dev/null
@@ -0,0 +1,11 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+     <xsl:output indent="yes"/>
+     <xsl:template match="@* | node()">
+         <xsl:copy>
+             <xsl:apply-templates select="@* | node()"/>
+         </xsl:copy>
+     </xsl:template>
+     <xsl:template match="text()">
+         <xsl:value-of select="normalize-space()"/>
+     </xsl:template>
+</xsl:stylesheet>
diff --git a/xml/ipbiogs.inc b/xml/ipbiogs.inc
new file mode 100644 (file)
index 0000000..f9ce6e5
--- /dev/null
@@ -0,0 +1,2 @@
+   <p><strong>Ian Page</strong> was born in London in 1960. Since the age of sixteen he has pursued a successful career as a singer/songwriter. With the band Secret Affair, he had a string of chart hits to his credit including <cite>Time for Action</cite> and <cite>My World</cite>. His interest in the fantastic worlds of <quote>Sword and Sorcery</quote> dates back to his early teens, and to his love of the novels of J.R.R. Tolkien and Michael Moorcock. It was in 1979, when Joe Dever introduced him to role-playing games, that his involvement in the world of Magnamund began. He contributed greatly to the development of the southern reaches of this fantastic world, and worked closely with Joe on several other role-playing games projects that include TV and radio appearances.</p>
+   <p>Ian has since re-entered the music industry with a band known as <a href="&link.the.affair.website;">The Affair</a>.</p>
diff --git a/xml/jdbiogs.inc b/xml/jdbiogs.inc
new file mode 100644 (file)
index 0000000..715f6a3
--- /dev/null
@@ -0,0 +1,7 @@
+   <p><strong>Joe Dever</strong>, the creator of the bestselling Lone Wolf adventure books and novels and editor for the World of Lone Wolf series, has achieved world-wide recognition in three creative fields&emdash;as an award-winning author of international renown, as an acclaimed musician and composer, and as a games designer specialising in role-playing games.</p>
+   <p>On graduating from college in 1974, Joe Dever became a professional musician, and for several years, he worked in the music industry in Europe and the United States.</p>
+   <p>While working in Los Angeles in 1977 he discovered a then little-known game called <quote>Dungeons &ampersand; Dragons</quote>. Although the game was in its infancy, Joe at once realised its huge potential and began designing his own role-playing games along similar conceptual lines. These first games were to form the basis of a fantasy world called Magnamund, which later became the setting for the Lone Wolf books.</p>
+   <p>Five years later, in 1982, Joe won the Advanced Dungeons &ampersand; Dragons World Championships in Baltimore, an event held before 16,000 people. Inspired and encouraged by his success at Origins, Joe decided to quit the music business and devote his time to writing and games design.</p>
+   <p>In 1983, after a brief spell at Games Workshop in London, he wrote <cite>Flight from the Dark</cite>&emdash;the first Lone Wolf interactive gamebook. His manuscript immediately attracted a frenzy of interest from three major London publishing companies, all of whom bid for world rights. Joe accepted an offer of publication from Hutchinson&apos;s (later to become Century Hutchinson Ltd; now Random House UK) and <cite>Flight from the Dark</cite> was first published in 1984.</p>
+   <p>This first book sold more than 100,000 copies within its first month of publication, and overseas rights were snapped up by twelve countries (including the United States, France, Germany, Japan, Italy and Sweden). The success of Joe&apos;s first book laid the foundations for the future of the Lone Wolf series, which has sold millions of copies around the world.</p>
+   <p>Joe has continued to work in the games industry as script writer and games design consultant.</p>
diff --git a/xml/jdbiolw.inc b/xml/jdbiolw.inc
new file mode 100644 (file)
index 0000000..9431564
--- /dev/null
@@ -0,0 +1,7 @@
+   <p><strong>Joe Dever</strong>, the creator of the bestselling Lone Wolf adventure books and novels, has achieved world-wide recognition in three creative fields&emdash;as an award-winning author of international renown, as an acclaimed musician and composer, and as a games designer specialising in role-playing games.</p>
+   <p>On graduating from college in 1974, Joe Dever became a professional musician, and for several years, he worked in the music industry in Europe and the United States.</p>
+   <p>While working in Los Angeles in 1977 he discovered a then little-known game called <quote>Dungeons &ampersand; Dragons</quote>. Although the game was in its infancy, Joe at once realised its huge potential and began designing his own role-playing games along similar conceptual lines. These first games were to form the basis of a fantasy world called Magnamund, which later became the setting for the Lone Wolf books.</p>
+   <p>Five years later, in 1982, Joe won the Advanced Dungeons &ampersand; Dragons World Championships in Baltimore, an event held before 16,000 people. Inspired and encouraged by his success at Origins, Joe decided to quit the music business and devote his time to writing and games design.</p>
+   <p>In 1983, after a brief spell at Games Workshop in London, he wrote <cite>Flight from the Dark</cite>&emdash;the first Lone Wolf interactive gamebook. His manuscript immediately attracted a frenzy of interest from three major London publishing companies, all of whom bid for world rights. Joe accepted an offer of publication from Hutchinson&apos;s (later to become Century Hutchinson Ltd; now Random House UK) and <cite>Flight from the Dark</cite> was first published in 1984.</p>
+   <p>This first book sold more than 100,000 copies within its first month of publication, and overseas rights were snapped up by twelve countries (including the United States, France, Germany, Japan, Italy and Sweden). The success of Joe&apos;s first book laid the foundations for the future of the Lone Wolf series, which has sold millions of copies around the world.</p>
+   <p>The Lone Wolf series ended after 28 books and 14 years. Joe has continued to work in the games industry as script writer and games design consultant.</p>
diff --git a/xml/latex.xsl b/xml/latex.xsl
new file mode 100644 (file)
index 0000000..5f01f96
--- /dev/null
@@ -0,0 +1,966 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:transform [
+ <!ENTITY % latex.characters SYSTEM "ltexchar.mod">
+ %latex.characters;
+]>
+
+<xsl:transform version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="text" encoding="ISO-8859-1" />
+
+<xsl:strip-space elements="gamebook meta section data ol ul dl li dd footnotes footnote illustration instance" />
+<xsl:preserve-space elements="p choice" />
+
+<!--
+
+$Id$
+
+$Log$
+Revision 1.1  2005/01/30 01:32:52  jonathan.blake
+Initial freepository revision of XML support documents.
+
+Revision 1.3  2002/10/30 06:33:22  jblake
+Added capability to filter which illustrators' work is included in the output.
+
+Revision 1.2  2002/10/20 06:29:58  jblake
+Added support for CLOSE COMBAT SKILL from the Freeway Warrior books.
+
+Revision 1.1  2002/10/15 23:30:23  jblake
+Initial revision
+
+-->
+
+<!--
+
+To Implement:
+
+The implementation of tables is incomplete and kludgy.
+
+-->
+
+<!-- ====================== parameters ========================== -->
+
+<xsl:param name="title-color"><xsl:text>0.0,0.0,0.0</xsl:text></xsl:param>
+<xsl:param name="use-illustrators" />
+
+<!-- ======================= variables ========================== -->
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:variable name="newparagraph">
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+</xsl:variable>
+
+<!-- ======================== Templates ========================= -->
+
+<!-- ================= hierarchical sections ==================== -->
+
+<xsl:template match="meta" />
+
+<!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section[@id='title']">
+
+<xsl:text>
+%% Two-sided %%
+\documentclass[letterpaper,12pt,twoside]{book}
+%\documentclass[a4paper,12pt,twoside]{book}
+
+%% One-sided %%
+%\documentclass[letterpaper,12pt,oneside]{book}
+%\documentclass[a4paper,12pt,oneside]{book}
+
+ \usepackage[pdftex]{graphicx}
+ \usepackage{ifthen}
+
+ %% color info %%
+ \usepackage{color}
+ \definecolor{titlecolor}{rgb}{</xsl:text><xsl:value-of select="$title-color" /><xsl:text>}
+ \definecolor{lightgray}{gray}{0.75}
+
+ %% headers and footers %%
+ \usepackage{fancyhdr}
+
+ \renewcommand{\chaptermark}[1]{}
+ \renewcommand{\sectionmark}[1]{}
+ \fancyhf{}
+
+ \ifthenelse{\boolean{@twoside}}%
+ {%% Two-sided %%
+  \fancyhead[CO]{\iffloatpage{}{</xsl:text><xsl:value-of select="/gamebook/meta/creator[@class='short']" /><xsl:text>}}
+  \fancyhead[CE]{\iffloatpage{}{\bfseries </xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>}}
+  \fancyhead[LO,RE]{\iffloatpage{}{\thepage}}}%
+ {%% One-sided %%
+  %\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>}}}
+  %\fancyhead[R]{\iffloatpage{}{\thepage}}}
+ \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
+
+ \fancypagestyle{plain}{
+  \fancyhf{}
+  \renewcommand{\headrulewidth}{0pt}
+ }
+
+ \fancypagestyle{empty}{
+  \fancyhf{}
+  \renewcommand{\headrulewidth}{0pt}
+ }
+
+ %% hyper-references %%
+ \usepackage[pdftex,colorlinks=true,linkcolor=black,bookmarks=false]{hyperref}
+
+ %% custom style info %%
+ \setlength{\parindent}{0pt}
+ \setlength{\parskip}{1em}
+ \setlength{\headheight}{18pt}
+ \addtolength{\headwidth}{\marginparwidth}
+ \addtolength{\headwidth}{\marginparsep}
+ \setlength{\textheight}{44\baselineskip}
+ \ifthenelse{\lengthtest{\paperwidth = 210mm}}%
+   {%% if A4 (210.0 mm x 297.0 mm)
+   \addtolength{\topmargin}{-1\baselineskip}}%
+   {%% else if letter (8.5" x 11" == 215.9 mm x 279.4 mm)
+   \addtolength{\topmargin}{-2.5\baselineskip}}
+
+ %% TrueType font %%
+ \usepackage[T1]{fontenc}
+ \usepackage{souvenir}
+ %\renewcommand{\rmdefault}{souvnrttf}
+
+ \raggedbottom
+
+ %% new environments %%
+ \newenvironment{aonchoice}{\begin{list}{}{\setlength{\topsep}{0pt}} \item}{\end{list}}
+ \newenvironment{aoncombat}{\begin{list}{}{\setlength{\topsep}{0pt}} \item}{\end{list}}
+ \newenvironment{aonitemize}{\begin{list}{}{\setlength{\topsep}{0pt} \setlength{\parsep}{0pt} \setlength{\itemsep}{0pt}}}{\end{list}}
+ \newenvironment{aonordereditemize}{\begin{list}{\arabic{aoncounter}.}{\usecounter{aoncounter} \setlength{\topsep}{0pt} \setlength{\parsep}{0pt} \setlength{\itemsep}{0pt}}}{\end{list}}
+ \newcounter{aoncounter}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{document}
+
+\begin{titlepage}
+
+ \vspace*{\stretch{0.7}}
+ \begin{center}
+  \Huge{\textcolor{titlecolor}{\textbf{</xsl:text><xsl:value-of select="/gamebook/meta/title[1]" /><xsl:text>}}} \vspace{-0.8em}\\
+
+  \vspace*{\stretch{1}}
+  \normalsize{</xsl:text><xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" /><xsl:text>}
+ \end{center}
+ \vspace*{\stretch{1.3}}
+
+ \pagestyle{empty}
+
+ \newpage
+
+ \vspace*{\stretch{1}}
+
+ </xsl:text>
+ <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
+ <xsl:text>
+
+ Publication Date: </xsl:text>
+ <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
+   <xsl:text>January</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
+   <xsl:text>February</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
+   <xsl:text>March</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
+   <xsl:text>April</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
+   <xsl:text>May</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
+   <xsl:text>June</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
+   <xsl:text>July</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
+   <xsl:text>August</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
+   <xsl:text>September</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
+   <xsl:text>October</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
+   <xsl:text>November</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
+   <xsl:text>December</xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:text>Invalid Month</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
+ <xsl:text>
+
+ </xsl:text>
+ <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
+ <xsl:text>
+
+ \vspace*{\stretch{3}}
+
+ \pagestyle{empty}
+
+\end{titlepage}
+
+\clearpage{\pagestyle{empty}\cleardoublepage}
+
+ \vspace*{\stretch{1}}
+
+ \thispagestyle{empty}
+ </xsl:text>
+ <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
+ <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
+ <xsl:text>
+
+ \vspace*{\stretch{3}}
+
+\clearpage{\pagestyle{empty}\cleardoublepage}
+
+ \pagestyle{fancy}
+
+\begin{frontmatter}
+</xsl:text>
+
+ <xsl:apply-templates select="data/section[@class='frontmatter']" />
+
+<xsl:text>
+\end{frontmatter}
+
+</xsl:text>
+<xsl:if test="data/section[@class='mainmatter']">
+ <xsl:text>\begin{mainmatter}
+
+ </xsl:text>
+
+ <xsl:apply-templates select="data/section[@class='mainmatter']" />
+
+ <xsl:text>
+ \end{mainmatter}
+ </xsl:text>
+</xsl:if>
+
+<xsl:if test="data/section[@class='numbered']">
+ <xsl:apply-templates select="data/section[@class='numbered']" />
+</xsl:if>
+
+ <xsl:text>
+\begin{backmatter}
+\ifthenelse{\boolean{@twoside}}%
+ {%% Two-sided %%
+  \fancyhead[RO,LE]{}}
+ {%% One-sided %%
+  \fancyhead[R]{}}
+
+ \setcounter{topnumber}{6}
+ \renewcommand{\topfraction}{1}
+ \renewcommand{\textfraction}{0}
+ \setlength{\floatsep}{10pt}
+
+ </xsl:text>
+ <xsl:apply-templates select="data/section[@class='backmatter']" />
+ <xsl:text>
+
+\end{backmatter}
+
+\end{document}
+</xsl:text>
+
+</xsl:template>
+
+<xsl:template match="/gamebook/section[@id='toc']" />
+
+<xsl:template match="section" />
+
+<!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
+
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:text>{\huge \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+
+</xsl:template>
+
+<!-- :::::::::::: third-level front matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
+
+ <xsl:text>{\LARGE \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
+
+ <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
+ <xsl:text>{\LARGE \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\addcontentsline{toc}{subsection}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
+ <xsl:text>{\Large \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
+ <xsl:text>{\large \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::: second-level main matter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:text>{\huge \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+
+</xsl:template>
+
+<!-- :::::::::::: third-level main matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter'] | /gamebook/section/data/section/data/section[@class='mainmatter-separate']">
+
+ <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
+ <xsl:text>{\LARGE \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\addcontentsline{toc}{subsection}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter'] | /gamebook/section/data/section/data/section/data/section[@class='mainmatter-separate']">
+ <xsl:text>{\Large \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
+ <xsl:text>{\large \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: third-level glossary sections ::::::::::::: -->
+<!-- Glossary sections should be contained in a second level section. -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary'] | /gamebook/section/data/section/data/section[@class='glossary-separate']">
+
+ <xsl:text>\newpage</xsl:text><xsl:value-of select="$newline" />
+ <xsl:text>{\LARGE \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']">
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text> <xsl:value-of select="$newparagraph" />
+
+ <xsl:if test="position() = 1">
+  <xsl:text>\newcommand{\aonmarks}{
+    \ifthenelse{\equal{\leftmark}{\rightmark}}
+      {\rightmark}
+      {\rightmark{} - \leftmark}}
+  \ifthenelse{\boolean{@twoside}}%
+   {%% Two-sided %%
+    \fancyhead[RO,LE]{\iffloatpage{}{\large{\bfseries \aonmarks}}}
+    \fancyhead[LO,RE]{\iffloatpage{}{\thepage}}}
+   {%% One-sided %%
+    %\fancyhead[R]{\iffloatpage{}{\large{\bfseries \aonmarks}}}
+    %\fancyhead[L]{\iffloatpage{}{\thepage}}}</xsl:text> <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+
+ <xsl:if test="not( self::node()[@id='numbered'] )">
+  <xsl:text>{\huge \hypertarget{</xsl:text>
+   <xsl:value-of select="@id" />
+  <xsl:text>}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+  <xsl:text>}}</xsl:text>
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+ <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+
+ <xsl:value-of select="$newparagraph" />
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']">
+ <xsl:variable name="section-title" select="meta/title[1]" />
+
+<xsl:value-of select="$newline" />
+<xsl:text>\vspace{\parskip} \hypertarget{</xsl:text>
+<xsl:value-of select="@id" />
+<xsl:text>}{} \hspace*{\fill} \markboth{</xsl:text>
+<xsl:value-of select="$section-title" />
+<xsl:text>}{</xsl:text>
+<xsl:value-of select="$section-title" />
+<xsl:text>} {\Large \bfseries </xsl:text>
+<xsl:value-of select="$section-title" />
+<xsl:text>} \hspace*{\fill}\\*[\parskip]</xsl:text>
+<xsl:value-of select="$newline" />
+
+<xsl:for-each select="data/illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]">
+ <xsl:text>\hspace*{\fill} \mbox{\itshape \hyperlink{ill</xsl:text>
+ <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
+ <xsl:text>}{Illustration </xsl:text>
+ <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
+ <xsl:text>}}\hspace*{\fill}\\*[\parskip]</xsl:text>
+</xsl:for-each>
+
+ <xsl:apply-templates />
+
+</xsl:template>
+
+<!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='backmatter']">
+
+ <xsl:text>\clearpage{}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:text>{\huge \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
+ <xsl:text>{\LARGE \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
+ <xsl:text>{\Large \hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+ <xsl:text>}{</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:text>}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::::::::: dedication template ::::::::::::::::::::: -->
+
+<xsl:template match="id( 'dedicate' )">
+ <xsl:text>\vspace*{\stretch{1}}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+ <xsl:text>\begin{center}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\thispagestyle{empty}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\itshape </xsl:text>
+ <xsl:apply-templates select="data/p" />
+ <xsl:value-of select="$newline" />
+ <xsl:text>\end{center}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+ <xsl:text>\vspace*{\stretch{3}}</xsl:text>
+ <xsl:value-of select="$newline" />
+
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\tableofcontents</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+ <xsl:value-of select="$newline" />
+
+ <xsl:text>\setcounter{page}{1}</xsl:text><xsl:value-of select="$newline" />
+ <xsl:text>\pagenumbering{arabic}</xsl:text><xsl:value-of select="$newline" />
+
+</xsl:template>
+
+<!-- ::::::::::::::::::::: map template ::::::::::::::::::::::::: -->
+
+<xsl:template match="id( 'map' )">
+ <xsl:variable name="map-title" select="meta/title" />
+
+ <xsl:text>\clearpage{\pagestyle{empty}\cleardoublepage}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+  <xsl:for-each select="data/illustration[contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]">
+   <xsl:variable name="illustration-src" select="instance[@class='pdf']/@src" />
+
+   <xsl:text>\hypertarget{map}{~}</xsl:text>
+   <xsl:value-of select="$newline" />
+   <xsl:text>\addcontentsline{toc}{section}{\protect\numberline{}{</xsl:text>
+    <xsl:value-of select="$map-title" />
+   <xsl:text>}}</xsl:text>
+   <xsl:value-of select="$newparagraph" />
+
+<!--   <xsl:value-of select="$newline" />
+   <xsl:text>\begin{figure}[!h]</xsl:text>
+   <xsl:value-of select="$newline" />
+    <xsl:text>\centering</xsl:text>
+    <xsl:value-of select="$newline" />
+    <xsl:text>\thispagestyle{empty}</xsl:text>
+    <xsl:value-of select="$newline" />
+    <xsl:text>\rotatebox{90}{\includegraphics[width=550pt,keepaspectratio]{</xsl:text><xsl:value-of select="$illustration-src" /><xsl:text>}}%</xsl:text>
+    <xsl:value-of select="$newline" />
+   <xsl:text>\end{figure}</xsl:text> -->
+
+   <xsl:text>\thispagestyle{empty}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>\newlength{\saveunitlength}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>\setlength{\saveunitlength}{\unitlength}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>\setlength{\unitlength}{1mm}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>\ifthenelse{\boolean{@twoside}}%</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text> {%% Two-sided %%</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \begin{picture}(10,10)</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \put(-23,-188){\includegraphics[angle=90,origin=c,width=20cm,height=28cm,keepaspectratio]{map.pdf}}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \end{picture}}%</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text> {%% One-sided %%</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \begin{picture}(10,10)</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \put(-29,-188){\includegraphics[angle=90,origin=c,width=20cm,height=28cm,keepaspectratio]{map.pdf}}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>  \end{picture}}</xsl:text><xsl:value-of select="$newline" />
+   <xsl:text>\setlength{\unitlength}{\saveunitlength}</xsl:text><xsl:value-of select="$newline" />
+
+  </xsl:for-each>
+</xsl:template>
+
+<!-- ==================== block elements ======================== -->
+
+<xsl:template match="p">
+ <xsl:apply-templates />
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="ul">
+ <xsl:text>\begin{aonitemize}</xsl:text><xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:text>\end{aonitemize}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="ul[@class='unbulleted']">
+ <xsl:text>\begin{aonitemize}</xsl:text><xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:text>\end{aonitemize}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="ol">
+ <xsl:text>\begin{enumerate}</xsl:text><xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:text>\end{enumerate}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="dl">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="table">
+ <xsl:text>\begin{tabular}{*{</xsl:text>
+ <xsl:for-each select="tr[1]">
+  <xsl:for-each select="th[1]">
+   <xsl:number count="th" />
+  </xsl:for-each>
+ </xsl:for-each>
+ <xsl:text>}{l}}</xsl:text>
+ <xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ <xsl:text>\end{tabular}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="tr">
+ <xsl:apply-templates />
+ <xsl:text> \\</xsl:text>
+</xsl:template>
+
+<xsl:template match="th">
+ <xsl:text>\multicolumn{1}{</xsl:text>
+ <xsl:choose>
+  <xsl:when test="@align='left'"><xsl:text>l}{\bfseries </xsl:text></xsl:when>
+  <xsl:when test="@align='right'"><xsl:text>r}{\bfseries </xsl:text></xsl:when>
+  <xsl:when test="@align='center'"><xsl:text>c}{\bfseries </xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>l}{\bfseries </xsl:text></xsl:otherwise>
+ </xsl:choose>
+  <xsl:apply-templates />
+ <xsl:text>} </xsl:text>
+ <xsl:if test="position != last()"><xsl:text>&amp;</xsl:text></xsl:if>
+</xsl:template>
+
+<xsl:template match="td">
+ <xsl:text>\multicolumn{1}{</xsl:text>
+ <xsl:choose>
+  <xsl:when test="@align='left'"><xsl:text>l}{</xsl:text></xsl:when>
+  <xsl:when test="@align='right'"><xsl:text>r}{</xsl:text></xsl:when>
+  <xsl:when test="@align='center'"><xsl:text>c}{</xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>l}{</xsl:text></xsl:otherwise>
+ </xsl:choose>
+  <xsl:apply-templates />
+ <xsl:text>} </xsl:text>
+ <xsl:if test="position != last()"><xsl:text>&amp;</xsl:text></xsl:if>
+</xsl:template>
+
+<xsl:template match="combat">
+ <xsl:text>\begin{aoncombat}</xsl:text>
+  <xsl:apply-templates select="enemy" />
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='combatskill']">
+    <xsl:text>: {\small COMBAT~SKILL}~</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='combatskill']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='closecombatskill']">
+    <xsl:text>: {\small CLOSE~COMBAT~SKILL}~</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
+   </xsl:when>
+  </xsl:choose>
+  <xsl:text> ~~{\small ENDURANCE}~</xsl:text>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='target']">
+    <xsl:text>~({\small TARGET}~points)~</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='target']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='resistance']">
+    <xsl:text>~({\small RESISTANCE}~points)~</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='resistance']" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="enemy-attribute[@class='endurance']" />
+   </xsl:otherwise>
+  </xsl:choose>
+ <xsl:text>\end{aoncombat}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="choice">
+ <xsl:variable name="link">
+  <xsl:value-of select="@idref" />
+ </xsl:variable>
+
+ <xsl:text>\begin{aonchoice}</xsl:text>
+  <xsl:for-each select="* | text()">
+   <xsl:choose>
+    <xsl:when test="self::link-text">
+     <xsl:text>\hyperlink{</xsl:text>
+     <xsl:value-of select="$link" />
+     <xsl:text>}{\bfseries </xsl:text>
+      <xsl:apply-templates />
+     <xsl:text>}</xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="." />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:for-each>
+ <xsl:text>\end{aonchoice}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="signpost">
+ <xsl:text>\begin{center}</xsl:text><xsl:apply-templates /><xsl:text>\end{center}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="blockquote">
+ <xsl:text>\begin{quote}</xsl:text><xsl:apply-templates /><xsl:text>\end{quote}</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="illustration">
+ <xsl:choose>
+  <xsl:when test="instance[@class='pdf'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:text>\begin{figure}[</xsl:text>
+   <xsl:choose>
+    <xsl:when test="@class='inline'">!ht</xsl:when>
+    <xsl:when test="@class='float'">p</xsl:when>
+    <xsl:when test="@class='accent'">bt</xsl:when>
+    <xsl:otherwise><xsl:text>invalid class</xsl:text></xsl:otherwise>
+   </xsl:choose>
+   <xsl:text>]</xsl:text>
+   <xsl:value-of select="$newline" />
+   <xsl:text>\centering</xsl:text>
+   <xsl:value-of select="$newline" />
+   <xsl:text>\includegraphics</xsl:text>
+   <xsl:if test="@class='float'">
+    <!--<xsl:text>[width=\textwidth,keepaspectratio]</xsl:text>-->
+    <xsl:text>[width=\textwidth,height=570pt,keepaspectratio]</xsl:text>
+   </xsl:if>
+   <xsl:text>{</xsl:text>
+    <xsl:value-of select="instance[@class='pdf']/@src" />
+   <xsl:text>} %</xsl:text>
+   <xsl:if test="@class='float'">
+    <xsl:value-of select="$newline" />
+    <xsl:text>\vspace*{\fill}</xsl:text>
+    <xsl:value-of select="$newline" />
+    <xsl:text>\\ \mbox{ \hypertarget{ill</xsl:text>
+     <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" />
+    <xsl:text>}{Illustration </xsl:text>
+     <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
+    <xsl:text>}}\\[1em]{\itshape </xsl:text>
+    <xsl:apply-templates select="meta/description" />
+    <xsl:text>}</xsl:text>
+   </xsl:if>
+   <xsl:value-of select="$newline" />
+   <xsl:text>\end{figure}</xsl:text>
+   <xsl:value-of select="$newline" />
+  </xsl:when>
+
+  <xsl:when test="instance[@class='tex'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:value-of select="$newline" />
+   <xsl:text>\begin{figure}[!h]</xsl:text>
+   <xsl:value-of select="$newline" />
+    <xsl:text>\centering</xsl:text>
+    <xsl:value-of select="$newline" />
+    <xsl:text>\input{</xsl:text><xsl:value-of select="instance[@class='tex']/@src" /><xsl:text>}</xsl:text>
+    <xsl:value-of select="$newline" />
+   <xsl:text>\end{figure}</xsl:text>
+   <xsl:value-of select="$newline" />
+
+   <xsl:text>\clearpage{}</xsl:text>   
+   <xsl:value-of select="$newparagraph" />
+  </xsl:when>
+
+  <xsl:otherwise />
+
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="instance" />
+
+<xsl:template match="footnotes" />
+
+<xsl:template match="footnote">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="hr">
+ <xsl:text>\rule{\textwidth}{0.4pt}</xsl:text>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dt">
+ <xsl:text>{\bfseries </xsl:text><xsl:apply-templates /><xsl:text>}\\*\\*</xsl:text>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dd">
+ <xsl:apply-templates />
+ <xsl:value-of select="$newparagraph" />
+</xsl:template>
+
+<xsl:template match="li">
+ <xsl:text>\item </xsl:text><xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== inline elements ======================= -->
+
+<xsl:template match="a">
+ <xsl:if test="@idref">
+  <xsl:text>\hyperlink{</xsl:text>
+  <xsl:value-of select="@idref" />
+  <xsl:text>}{</xsl:text>
+ </xsl:if>
+ <xsl:if test="@id">
+  <xsl:text>\hypertarget{</xsl:text>
+  <xsl:value-of select="@id" />
+  <xsl:text>}{</xsl:text>
+ </xsl:if>
+
+ <xsl:apply-templates />
+
+ <xsl:if test="@idref">
+  <xsl:text>}</xsl:text>
+ </xsl:if>
+ <xsl:if test="@id">
+  <xsl:text>}</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="a[@class='footnote']">
+ <xsl:apply-templates />
+ <xsl:text>\footnote{</xsl:text>
+ <xsl:for-each select="id( @idref )">
+  <xsl:apply-templates />
+ </xsl:for-each>
+ <xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="em">
+ <xsl:text>\emph{</xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="strong">
+ <xsl:text>{\bfseries </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="cite">
+ <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="thought">
+ <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="onomatopoeia">
+ <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="spell">
+ <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="item">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="foreign">
+ <xsl:text>{\itshape </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>&lsquot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&rsquot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote//quote">
+ <xsl:text>&ldquot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&rdquot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="code">
+ <xsl:text>{\ttfamily </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="br">
+ <xsl:text>\\</xsl:text>
+</xsl:template>
+
+<xsl:template match="typ[@class='attribute']">
+ <xsl:text>{\small </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="footnote//typ[@class='attribute']">
+ <xsl:text>{\scriptsize </xsl:text><xsl:apply-templates /><xsl:text>}</xsl:text>
+</xsl:template>
+
+</xsl:transform>
diff --git a/xml/license.inc b/xml/license.inc
new file mode 100644 (file)
index 0000000..19891cf
--- /dev/null
@@ -0,0 +1,318 @@
+   <section class="backmatter" id="license">
+    <meta><title>Project Aon License</title></meta>
+
+    <data>
+     <p>5 February 2004</p>
+
+     <section class="backmatter" id="lic-pre">
+      <meta><title>0. Preamble</title></meta>
+
+      <data>
+       <p>Joe Dever, author of the Lone Wolf game books, and Ian Page, author of the World of Lone Wolf books are providing certain of their works for free (gratis) download from the internet. Gary Chalk, Melvyn Grant, and Brian Williams are similarly offering the illustrations that they did for Joe Dever&apos;s books. This license is intended to protect the rights of the authors and the illustrators, the rights of his readers, and the quality of the distributions of the books.</p>
+       <p>By viewing or downloading the books or the illustrations, you agree to refrain from redistributing them in any format for any reason. This is intended to protect readers from getting poor quality, unofficial versions or from being asked for payment in exchange for the books by someone who is redistributing them unofficially.</p>
+       <p>Anyone who wishes to simply view or download the Internet Editions for their own personal use need not worry about running afoul of the terms of this License. These activities are within acceptable behaviour as defined by this License.</p>
+       <p>This section does not contain the legally binding terms of this license. The precise terms and conditions of this license follow.</p>
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-1">
+      <meta><title>1. Definitions</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-1-0">
+        <meta><title>1.0</title></meta>
+
+        <data>
+         <p><quote>License</quote> shall hereafter refer to this document.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-1">
+        <meta><title>1.1</title></meta>
+
+        <data>
+         <p><quote>Authors</quote> shall hereafter refer to Joe Dever and Ian Page, copyright holders for the literary works covered by this license. Where either Joe Dever or Ian Page are mentioned singly, they will be referred to by name.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-2">
+        <meta><title>1.2</title></meta>
+
+        <data>
+         <p><quote>Illustrator</quote> shall hereafter refer to Gary Chalk, holder of the copyrights for the illustrations of Lone Wolf books one through eight counted inclusively, Melvyn Grant, holder of the copyrights for the illustrations of <cite>Freeway Warrior 1: Highway Holocaust</cite>, and Brian Williams, holder of the copyrights for the illustrations of Lone Wolf books nine through twenty-eight counted inclusively with the exception of the illustrations for book twenty-one, <cite>The Voyage of the Moonstone</cite> and holder of the copyrights for the illustrations of books two through four of the Freeway Warrior series. Where either Gary Chalk, Melvyn Grant, or Brian Williams are mentioned singly, they will be referred to by name.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-3">
+        <meta><title>1.3</title></meta>
+
+        <data>
+         <p><quote>Internet</quote> shall hereafter refer to any means of transferring information electronically between two or more <quote>Licensees</quote>. (the term <quote>Licensee</quote> is defined in Section 1.5 of the License)</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-4">
+        <meta><title>1.4</title></meta>
+
+        <data>
+         <p><quote>Internet Editions</quote> shall hereafter refer to the document or documents, any parts thereof or derivative works thereof (including translations) made available to the public under the terms of this License via the Internet. The term <quote>Internet Editions</quote> is limited to the electronic transcription of certain text and illustrations by the Authors and Illustrators respectively as listed hereafter.</p>
+         <p>The following are the works written by Joe Dever which are being offered under the terms of this license:</p>
+
+         <ul>
+          <li><cite>Flight from the Dark</cite>; Copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>Fire on the Water</cite>; Copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Caverns of Kalte</cite>; Copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Chasm of Doom</cite>; Copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>Shadow on the Sand</cite>; Copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Kingdoms of Terror</cite>; Copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>Castle Death</cite>; Copyright 1986 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Jungle of Horrors</cite>; Copyright 1987 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Cauldron of Fear</cite>; Copyright 1987 Joe Dever.</li>
+          <li><cite>The Dungeons of Torgar</cite>; Copyright 1987 Joe Dever.</li>
+          <li><cite>The Prisoners of Time</cite>; Copyright 1987 Joe Dever.</li>
+          <li><cite>The Masters of Darkness</cite>; Copyright 1988 Joe Dever.</li>
+          <li><cite>The Plague Lords of Ruel</cite>; Copyright 1990, 1992 Joe Dever.</li>
+          <li><cite>The Captives of Kaag</cite>; Copyright 1991 Joe Dever.</li>
+          <li><cite>The Darke Crusade</cite>; Copyright 1991, 1993 Joe Dever.</li>
+          <li><cite>The Legacy of Vashna</cite>; Copyright 1991, 1993 Joe Dever.</li>
+          <li><cite>The Deathlord of Ixia</cite>; Copyright 1992, 1994 Joe Dever.</li>
+          <li><cite>Dawn of the Dragons</cite>; Copyright 1992 Joe Dever.</li>
+          <li><cite>Wolf&apos;s Bane</cite>; Copyright 1993, 1995 Joe Dever.</li>
+          <li><cite>The Curse of Naar</cite>; Copyright 1993, 1996 Joe Dever.</li>
+          <li><cite>The Magnamund Companion</cite>; Copyright 1986 Joe Dever.</li>
+          <li><cite>Freeway Warrior 1: Highway Holocaust</cite>; Copyright 1988 Joe Dever.</li>
+          <li><cite>Freeway Warrior 2: Slaughter Mountain Run</cite>; Copyright 1988 Joe Dever.</li>
+          <li><cite>Freeway Warrior 3: The Omega Zone</cite>; Copyright 1989 Joe Dever.</li>
+          <li><cite>Freeway Warrior 4: California Countdown</cite>; Copyright 1989 Joe Dever.</li>
+         </ul>
+
+         <p>The following are the works written by Ian Page which are being offered under the terms of this license:</p>
+
+         <ul>
+          <li><cite>Grey Star the Wizard</cite>; Copyright 1985 Ian Page.</li>
+          <li><cite>The Forbidden City</cite>; Copyright 1986 Ian Page.</li>
+          <li><cite>Beyond the Nightmare Gate</cite>; Copyright 1986 Ian Page.</li>
+          <li><cite>War of the Wizards</cite>; Copyright 1986 Ian Page.</li>
+         </ul>
+
+
+         <p>The illustrations created by Gary Chalk for the following books are part of the illustrations being offered under the terms of this License:</p>
+
+         <ul>
+          <li><cite>Flight from the Dark</cite>; Illustrations copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>Fire on the Water</cite>; Illustrations copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Caverns of Kalte</cite>; Illustrations copyright 1984 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Chasm of Doom</cite>; Illustrations copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>Shadow on the Sand</cite>; Illustrations copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Kingdoms of Terror</cite>; Illustrations copyright 1985 Joe Dever and Gary Chalk.</li>
+          <li><cite>Castle Death</cite>; Illustrations copyright 1986 Joe Dever and Gary Chalk.</li>
+          <li><cite>The Jungle of Horrors</cite>; Illustrations copyright 1987 Joe Dever and Gary Chalk.</li>
+         </ul>
+
+         <p>The illustrations created by Melvyn Grant for the following books are part of the illustrations being offered under the terms of this License:</p>
+
+         <ul>
+          <li><cite>Freeway Warrior 1: Highway Holocaust</cite>; Illustrations copyright 1988 Melvyn Grant.</li>
+         </ul>
+
+         <p>The illustrations created by Brian Williams for the following books are part of the illustrations being offered under the terms of this License:</p>
+
+         <ul>
+          <li><cite>The Cauldron of Fear</cite>; Illustrations Copyright 1987 Brian Williams.</li>
+          <li><cite>The Dungeons of Torgar</cite>; Illustrations Copyright 1987 Brian Williams.</li>
+          <li><cite>The Prisoners of Time</cite>; Illustrations Copyright 1987 Brian Williams.</li>
+          <li><cite>The Masters of Darkness</cite>; Illustrations Copyright 1988 Brian Williams.</li>
+          <li><cite>The Plague Lords of Ruel</cite>; Illustrations Copyright 1990, 1992 Brian Williams.</li>
+          <li><cite>The Captives of Kaag</cite>; Illustrations Copyright 1990, 1992 Brian Williams.</li>
+          <li><cite>The Darke Crusade</cite>; Illustrations Copyright 1991, 1993 Brian Williams.</li>
+          <li><cite>The Legacy of Vashna</cite>; Illustrations Copyright 1991, 1993 Brian Williams.</li>
+          <li><cite>The Deathlord of Ixia</cite>; Illustrations Copyright 1992 Brian Williams.</li>
+          <li><cite>Dawn of the Dragons</cite>; Illustrations Copyright 1992 Brian Williams.</li>
+          <li><cite>Wolf&apos;s Bane</cite>; Illustrations Copyright 1993 Brian Williams.</li>
+          <li><cite>The Curse of Naar</cite>; Illustrations Copyright 1993 Brian Williams.</li>
+          <li><cite>The Buccaneers of Shadaki</cite>; Illustrations Copyright 1994 Brian Williams.</li>
+          <li><cite>Mydnight&apos;s Hero</cite>; Illustrations Copyright 1995 Brian Williams.</li>
+          <li><cite>Rune War</cite>; Illustrations Copyright 1995 Brian Williams.</li>
+          <li><cite>Trail of the Wolf</cite>; Illustrations Copyright 1997 Brian Williams.</li>
+          <li><cite>The Fall of Blood Mountain</cite>; Illustrations Copyright 1997 Brian Williams.</li>
+          <li><cite>Vampirium</cite>; Illustrations Copyright 1998 Brian Williams.</li>
+          <li><cite>The Hunger of Sejanoz</cite>; Illustrations Copyright 1998 Brian Williams.</li>
+          <li><cite>Freeway Warrior: Slaughter Mountain Run</cite>; Illustrations Copyright 1988 Brian Williams.</li>
+          <li><cite>Freeway Warrior: The Omega Zone</cite>; Illustrations Copyright 1989 Brian Williams.</li>
+          <li><cite>Freeway Warrior: California Countdown</cite>; Illustrations Copyright 1989 Brian Williams.</li>
+         </ul>
+
+         <p>The works distributed under the collective title <cite>Lone Wolf Club Newsletters</cite>&emdash;which are composed of, in part, the above named works&emdash;will also be distributed under the terms of this License.</p>
+
+         <p><quote>Internet Editions</quote> shall not refer to any other works by the Authors nor any other illustrations by the Illustrators. <quote>Internet Editions</quote> shall refer solely to the text and illustrations of the above works when made available through the Internet.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-5">
+        <meta><title>1.5</title></meta>
+
+        <data>
+         <p><quote>Licensee</quote> shall hereafter refer to any person or electronic agent who receives some or all of the Internet Editions. The <quote>Licensee</quote> shall hereinafter be referred to as <quote>Licensee</quote> or <quote>you</quote>.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-6">
+        <meta><title>1.6</title></meta>
+
+        <data>
+         <p><quote>Distribution Point</quote> shall hereafter refer to the specific Internet site or sites to which the Authors and Illustrators have granted rights to distribute the Internet Editions.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-1-7">
+        <meta><title>1.7</title></meta>
+
+        <data>
+         <p><quote>Maintainer</quote> shall hereafter refer to the person or persons who are responsible for the maintenance of the Distribution Point.</p>
+        </data>
+       </section>
+
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-2">
+      <meta><title>2. Terms of Distribution</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-2-0">
+        <meta><title>2.0</title></meta>
+
+        <data>
+         <p>The terms of this License are limited to the distribution of the Internet Editions. No other form of distribution is covered under the terms of this License.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-2-1">
+        <meta><title>2.1</title></meta>
+
+        <data>
+         <p>The Authors and Illustrators grant you the right to receive a copy or copies of the Internet Editions from the Distribution Point at no charge provided that you agree to all of the terms and obligations of this License. If you do not agree to all of the terms and obligations of this License, you are not granted any rights by this License.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-2-2">
+        <meta><title>2.2</title></meta>
+
+        <data>
+         <p>You agree to refrain from redistributing the Internet Editions in any form, electronic or otherwise, to any other person or persons for any reason by any means. You are granted the right to receive a copy or copies only for your own personal use.</p>
+         <p>This License does not collectively grant any rights to corporations or groups of individuals when regarded as one legal entity. This License exclusively grants rights to private individuals.</p>
+         <p>Redistribution includes but is not limited to displaying the Internet Editions within the graphical representation of an Internet site other than the Distribution Point. This prohibition includes but is not limited to HTML <quote>frames</quote>.</p>
+         <p>One exception to the restrictions on redistribution in this section is made in that you may send the Internet Editions or derivative works thereof to the Distribution Point by the consent of the Maintainer.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-2-3">
+        <meta><title>2.3</title></meta>
+
+        <data>
+         <p>You agree to be bound by the terms and obligations of this License by receiving or viewing a copy or copies of the Internet Editions even though you have not signed any written document. Indeed you have no right to receive or view a copy or copies without first agreeing to the terms and obligations of this License.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-2-4">
+        <meta><title>2.4</title></meta>
+
+        <data>
+         <p>The Authors and Illustrators retain all other rights to their respective portions of the Internet Editions not covered by this License. The Authors or Illustrators may, at any time, without notice and without need to show due cause, revoke the rights granted to you by this License to their respective portions of the Internet Editions.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-2-5">
+        <meta><title>2.5</title></meta>
+
+        <data>
+         <p>If a person is under the legal age to be able to enter into a contractual relationship as defined by the laws of the area in which that person lives, they may have a parent or legal guardian agree to be bound by the terms and obligations of this license. That same parent or legal guardian may thereafter give a copy or copies of the Internet Editions to that child. That parent or legal guardian is thereafter legally responsible to ensure that that child behaves in accordance with all of the terms and obligations of this License.</p>
+         <p>The authority of a parent or legal guardian to distribute the Internet Editions does not extend to the distribution of the Internet Editions to any other person or persons except his or her child or legal dependent.</p>
+        </data>
+       </section>
+
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-3">
+      <meta><title>3. Termination of the License</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-3-0">
+        <meta><title>3.0</title></meta>
+
+        <data>
+         <p>If for any reason you are unable to comply with any of the terms and obligations of this License, you agree to destroy all copies of the Internet Editions of which you have control within fourteen calendar days after the first violation.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-3-1">
+        <meta><title>3.1</title></meta>
+
+        <data>
+         <p>If any of the Authors or the Illustrators revokes your rights granted under this License, you agree to destroy all copies of the Authors&apos; or Illustrators&apos; work which is a part of the Internet Editions of which you have control within fourteen calendar days of receiving notification in any form.</p>
+        </data>
+       </section>
+
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-4">
+      <meta><title>4. Jurisdiction</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-4-0">
+        <meta><title>4.0</title></meta>
+
+        <data>
+         <p>If, in consequence of court judgement or the laws of a particular area, any portion of the License is held as invalid or unenforceable in any particular circumstance, you are no longer granted any rights under the terms of this License in that circumstance. You agree to act in accordance with section 3.0 for all copies of the Internet Editions for which the License is held as invalid or unenforceable as if you had violated the terms and obligations of the License. The License is intended to remain in force in all other circumstances.</p>
+        </data>
+       </section>
+
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-5">
+      <meta><title>5. Revision of the License</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-5-0">
+        <meta><title>5.0</title></meta>
+
+        <data>
+         <p>The Authors and the Illustrators may publish revisions of this License in the future to address new concerns. Any further revisions will be legally binding at the time that you receive notification in any form of the revision.</p>
+        </data>
+       </section>
+
+      </data>
+     </section>
+
+     <section class="backmatter" id="lic-6">
+      <meta><title>6. NO WARRANTY</title></meta>
+
+      <data>
+
+       <section class="backmatter" id="lic-6-0">
+        <meta><title>6.0</title></meta>
+
+        <data>
+         <p>BECAUSE THE INTERNET EDITIONS ARE LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE INTERNET EDITIONS, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS OR OTHER PARTIES PROVIDE THE INTERNET EDITIONS "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE INTERNET EDITIONS IS WITH YOU. SHOULD THE INTERNET EDITIONS PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY REPAIRS.</p>
+        </data>
+       </section>
+
+       <section class="backmatter" id="lic-6-1">
+        <meta><title>6.1</title></meta>
+
+        <data>
+         <p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER OR MAINTAINER BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE INTERNET EDITIONS (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE INTERNET EDITIONS TO OPERATE WITH ANY PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+        </data>
+       </section>
+      </data>
+     </section>
+    </data>
+   </section>
diff --git a/xml/ltexchar.mod b/xml/ltexchar.mod
new file mode 100644 (file)
index 0000000..387b640
--- /dev/null
@@ -0,0 +1,128 @@
+<!-- ============================================================= -->
+<!--                  LaTeX Characters Module v0.1                 -->
+<!-- ============================================================= -->
+<!--
+
+This module defines the mapping between the character entities used in
+the Project Aon instances of Gamebook XML and the ISO-8859-1
+characters. It is targeted at LaTeX as the output encoding.
+
+Portions Copyright International Organization for Standardization 1986 
+Permission to copy in any form is granted for use with conforming SGML 
+systems and applications as defined in ISO 8879, provided this notice 
+is included in all copies.
+
+-->
+
+<!ENTITY nbsp   "~"><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
+<!ENTITY iexcl  "!&#96;"><!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent   "?"><!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound  "\pounds "><!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "?"><!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen    "?"><!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "|"><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
+<!ENTITY sect   "\S "><!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml    "\&quot;{ }"><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
+<!ENTITY copy   "\copyright "><!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf   "?"><!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo  "?"><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not    "\not "><!-- not sign, U+00AC ISOnum -->
+<!ENTITY shy    "\-"><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
+<!ENTITY reg    "?"><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
+<!ENTITY macr   "\={ }"><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg    "?"><!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "?"><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
+<!ENTITY sup2   "?"><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
+<!ENTITY sup3   "?"><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
+<!ENTITY acute  "\'{ }"><!-- acute accent = spacing acute, U+00B4 ISOdia -->
+<!ENTITY micro  "?"><!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para   "\P"><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
+<!ENTITY middot "?"><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil  "\c{ }"><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1   "?"><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
+<!ENTITY ordm   "?"><!-- masculine ordinal indicator, U+00BA ISOnum -->
+<!ENTITY raquo  "?"><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "?"><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "?"><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "?"><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "?&#96;"><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "\&#96;{A}"><!-- latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 -->
+<!ENTITY Aacute "\&apos;{A}"><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
+<!ENTITY Acirc  "\^{A}"><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
+<!ENTITY Atilde "\~{A}"><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
+<!ENTITY Auml   "\&quot;{A}"><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
+<!ENTITY Aring  "\AA"><!-- latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 -->
+<!ENTITY AElig  "\AE"><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "\c{C}"><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
+<!ENTITY Egrave "\&#96;{E}"><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
+<!ENTITY Eacute "\&apos;{E}"><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
+<!ENTITY Ecirc  "\^{E}"><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
+<!ENTITY Euml   "\&quot;{E}"><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
+<!ENTITY Igrave "\&#96;{I}"><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
+<!ENTITY Iacute "\&apos;{I}"><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
+<!ENTITY Icirc  "\^{I}"><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
+<!ENTITY Iuml   "\&quot;{I}"><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
+<!ENTITY ETH    "?"><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "\~{N}"><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
+<!ENTITY Ograve "\&#96;{O}"><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
+<!ENTITY Oacute "\&apos;{O}"><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
+<!ENTITY Ocirc  "\^{O}"><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
+<!ENTITY Otilde "\~{O}"><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
+<!ENTITY Ouml   "\&quot;{O}"><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
+<!ENTITY times  "?"><!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "\O"><!-- latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "\&#96;{U}"><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
+<!ENTITY Uacute "\&apos;{U}"><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
+<!ENTITY Ucirc  "\^{U}"><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
+<!ENTITY Uuml   "\&quot;{U}"><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
+<!ENTITY Yacute "\&apos;{Y}"><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
+<!ENTITY THORN  "?"><!-- latin capital letter THORN, U+00DE ISOlat1 -->
+<!ENTITY szlig  "\ss"><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
+<!ENTITY agrave "\&#96;{a}"><!-- latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 -->
+<!ENTITY aacute "\&apos;{a}"><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
+<!ENTITY acirc  "\^{a}"><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
+<!ENTITY atilde "\~{a}"><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
+<!ENTITY auml   "\&quot;{a}"><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
+<!ENTITY aring  "\aa"><!-- latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 -->
+<!ENTITY aelig  "\ae"><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "\c{c}"><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
+<!ENTITY egrave "\&#96;{e}"><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
+<!ENTITY eacute "\&apos;{e}"><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
+<!ENTITY ecirc  "\^{e}"><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
+<!ENTITY euml   "\&quot;{e}"><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
+<!ENTITY igrave "\&#96;{\i}"><!-- latin small letter i with grave, U+00EC ISOlat1 -->
+<!ENTITY iacute "\&apos;{\i}"><!-- latin small letter i with acute, U+00ED ISOlat1 -->
+<!ENTITY icirc  "\^{\i}"><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
+<!ENTITY iuml   "\&quot;{\i}"><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
+<!ENTITY eth    "&#240;"><!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "\~{n}"><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
+<!ENTITY ograve "\&#96;{o}"><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
+<!ENTITY oacute "\&apos;{o}"><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
+<!ENTITY ocirc  "\^{o}"><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
+<!ENTITY otilde "\~{o}"><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
+<!ENTITY ouml   "\&quot;{o}"><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
+<!ENTITY divide "?"><!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "\o"><!-- latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 -->
+<!ENTITY ugrave "\&#96;{u}"><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
+<!ENTITY uacute "\&apos;{u}"><!-- latin small letter u with acute, U+00FA ISOlat1 -->
+<!ENTITY ucirc  "\^{u}"><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
+<!ENTITY uuml   "\&quot;{u}"><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
+<!ENTITY yacute "\&apos;{y}"><!-- latin small letter y with acute, U+00FD ISOlat1 -->
+<!ENTITY thorn  "?"><!-- latin small letter thorn, U+00FE ISOlat1 -->
+<!ENTITY yuml   "\&quot;{y}"><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
+
+<!-- ::::::::::::::::::::: Special Characters :::::::::::::::::::: -->
+
+<!ENTITY ampersand "\&amp;"><!-- ampersand -->
+<!ENTITY lsquot    "`"><!-- opening left quotation mark -->
+<!ENTITY rsquot    "'"><!-- closing right quotation mark -->
+<!ENTITY ldquot    "``"><!-- opening left double quotation mark -->
+<!ENTITY rdquot    "''"><!-- closing right double quotation mark -->
+<!ENTITY minus     "-"><!-- mathematical minus -->
+<!ENTITY endash    "-"><!-- endash -->
+<!ENTITY emdash    "--"><!-- emdash -->
+<!ENTITY ellips    "~\ldots "><!-- ellipsis -->
+<!ENTITY lellips   "\ldots ~"><!-- left ellipsis, used at the beginning of edited material -->
+<!ENTITY blankline "\_\_\_\_\_\_\_"><!-- blank line to be filled in -->
+<!ENTITY percent   "\&#37;"><!-- percent sign -->
+<!ENTITY thinspace "\,"><!-- small horizontal space for use between adjacent quotation marks -->
diff --git a/xml/pml.xsl b/xml/pml.xsl
new file mode 100644 (file)
index 0000000..bdaf32a
--- /dev/null
@@ -0,0 +1,717 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:transform [
+ <!ENTITY % pml.characters SYSTEM "pmlchar.mod">
+ %pml.characters;
+]>
+
+<!--
+
+$Id$
+
+$Log$
+Revision 1.1  2005/01/30 01:32:52  jonathan.blake
+Initial freepository revision of XML support documents.
+
+Revision 1.2  2003/01/07 16:55:28  jblake
+Restarted work from base xhtml.xsl.
+
+
+-->
+
+<xsl:transform version="1.0"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lxslt="http://xml.apache.org/xslt">
+
+<xsl:output method="text" encoding="ISO-8859-1" />
+
+<xsl:strip-space elements="gamebook section meta data ol ul dl li dd footnotes footnote illustration instance" />
+<xsl:preserve-space elements="p choice" />
+
+<!-- ====================== parameters ========================== -->
+
+<xsl:param name="use-illustrators" />
+
+<!-- ======================= variables ========================== -->
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:variable name="newparagraph">
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+</xsl:variable>
+
+<xsl:variable name="newpage">
+ <xsl:value-of select="$newline" />
+ <xsl:text>\p</xsl:text>
+</xsl:variable>
+
+<!-- ======================== Templates ========================= -->
+
+<!-- ================= hierarchical sections ==================== -->
+
+<xsl:template match="meta" />
+
+<!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section[@id='title']">
+ <xsl:text>\vTITLE="</xsl:text><xsl:value-of select="/gamebook/meta/title" /><xsl:text>"\v</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:text>\X0\l\B</xsl:text>
+  <xsl:text>\c</xsl:text>
+   <xsl:value-of select="/gamebook/meta/title" />
+   <xsl:value-of select="$newline" />
+  <xsl:text>\c</xsl:text>
+ <xsl:text>\B\l\X0</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:text>\c</xsl:text>
+  <xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" />
+  <xsl:value-of select="$newline" />
+ <xsl:text>\c</xsl:text>
+
+ <xsl:value-of select="$newpage" />
+ <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
+
+ <xsl:value-of select="$newparagraph" />
+ <xsl:text>Publication Date: </xsl:text>
+ <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
+   <xsl:text>January</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
+   <xsl:text>February</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
+   <xsl:text>March</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
+   <xsl:text>April</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
+   <xsl:text>May</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
+   <xsl:text>June</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
+   <xsl:text>July</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
+   <xsl:text>August</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
+   <xsl:text>September</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
+   <xsl:text>October</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
+   <xsl:text>November</xsl:text>
+  </xsl:when>
+  <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
+   <xsl:text>December</xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:text>Invalid Month</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+
+ <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
+
+ <xsl:value-of select="$newparagraph" />
+ <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
+
+ <xsl:if test="data/section[@class='frontmatter']">
+  <xsl:apply-templates select="data/section[@class='frontmatter']" />
+ </xsl:if>
+
+ <xsl:if test="data/section[@class='mainmatter']">
+  <xsl:apply-templates select="data/section[@class='mainmatter']" />
+ </xsl:if>
+
+ <xsl:if test="data/section[@class='numbered']">
+  <xsl:apply-templates select="data/section[@class='numbered']" />
+ </xsl:if>
+
+ <xsl:if test="data/section[@class='backmatter']">
+  <xsl:apply-templates select="data/section[@class='backmatter']" />
+ </xsl:if>
+
+ <xsl:for-each select="//footnote">
+  <xsl:value-of select="$newparagraph" />
+  <xsl:text>&lt;footnote id="</xsl:text><xsl:value-of select="@id" /><xsl:text>"&gt;</xsl:text>
+   <xsl:text>[</xsl:text><xsl:number count="footnote" from="/" level="any" format="1" /><xsl:text>]</xsl:text>
+   <xsl:apply-templates />
+  <xsl:text>&lt;/footnote&gt;</xsl:text>
+ </xsl:for-each>
+
+</xsl:template>
+
+<xsl:template match="/gamebook/section[@id='toc']" />
+
+<xsl:template match="section" />
+
+<!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
+ <xsl:value-of select="$newpage" />
+
+ <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B\l\X1</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: third-level front matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l\X2</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
+ <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
+ <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
+ <xsl:text>\Q{</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- ::::::::::: second-level main matter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B\l\X1</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: third-level main matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l\X2</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
+ <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter-separate']">
+ <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
+ <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
+ <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+ <xsl:value-of select="meta/title" />
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- :::::::::::: third-level glossary sections ::::::::::::: -->
+<!-- Glossary sections should be contained in a second level section. -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X2\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l\X2</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
+ <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B\l\X1</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']/data/section[@class='numbered']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\c\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\c</xsl:text><xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+ <xsl:value-of select="$newparagraph" />
+ <xsl:text>\w="50%"</xsl:text>
+</xsl:template>
+
+<!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='backmatter']">
+ <xsl:value-of select="$newpage" />
+ <xsl:text>\X1\l\B\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B\l\X1</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
+ <xsl:text>\l\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\l</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
+ <xsl:text>\B\Q="</xsl:text><xsl:value-of select="@id" />><xsl:text>"</xsl:text>
+  <xsl:value-of select="meta/title" />
+ <xsl:text>\B</xsl:text>
+ <xsl:value-of select="$newparagraph" />
+
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<!-- :::::::::::::::::: dedication template ::::::::::::::::::::: -->
+
+<xsl:template match="id( 'dedicate' )">
+ <!-- PML doesn't allow blank lines at the top of a page without a space -->
+ <xsl:value-of select="$newpage" />
+ <xsl:text>&nbsp;</xsl:text><xsl:value-of select="$newparagraph" />
+ <xsl:text>&nbsp;</xsl:text><xsl:value-of select="$newparagraph" />
+ <xsl:text>\c\i</xsl:text>
+  <xsl:apply-templates select="data/p" />
+ <xsl:text>\i</xsl:text>
+ <xsl:value-of select="$newline" />
+ <xsl:text>\c</xsl:text>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== block elements ======================== -->
+
+<xsl:template match="p">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="dd/p | li/p">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:choose>
+   <xsl:when test="following-sibling::illustration">
+    <xsl:if test="following-sibling::illustration/instance[@class='text']">
+     <xsl:value-of select="$newparagraph" />
+    </xsl:if>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:value-of select="$newparagraph" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="ul | ol | dl">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="li/ul | li/ol | li/dl | dd/ul | dd/ol | dd/dl">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="table">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="tr">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="th">
+ <xsl:variable name="indent-level" select="count( th | td )" />
+ <xsl:choose>
+  <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
+  <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
+ </xsl:choose>
+ <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
+</xsl:template>
+
+<xsl:template match="td">
+ <xsl:variable name="indent-level" select="count( th | td )" />
+ <xsl:choose>
+  <xsl:when test="$indent-level = 2"><xsl:text>\T="33%"</xsl:text></xsl:when>
+  <xsl:when test="$indent-level = 3"><xsl:text>\T="66%"</xsl:text></xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="combat">
+ <xsl:text>\t</xsl:text>
+ <xsl:apply-templates select="enemy" />
+ <xsl:text>:</xsl:text>
+ <xsl:text>\t</xsl:text>
+
+ <xsl:value-of select="$newline" />
+ <xsl:text>\t&nbsp;&nbsp;</xsl:text>
+ <xsl:choose>
+  <xsl:when test="enemy-attribute[@class='combatskill']">
+   <xsl:text>COMBAT&nbsp;SKILL&nbsp;</xsl:text>
+   <xsl:value-of select="enemy-attribute[@class='combatskill']" />
+  </xsl:when>
+  <xsl:when test="enemy-attribute[@class='closecombatskill']">
+   <xsl:text>CLOSE&nbsp;COMBAT&nbsp;SKILL&nbsp;</xsl:text>
+   <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
+  </xsl:when>
+ </xsl:choose>
+ <xsl:text>\t</xsl:text>
+
+ <xsl:value-of select="$newline" />
+ <xsl:text>\t&nbsp;&nbsp;</xsl:text>
+ <xsl:text>ENDURANCE&nbsp;</xsl:text>
+ <xsl:choose>
+  <xsl:when test="enemy-attribute[@class='target']">
+   <xsl:text>(TARGET&nbsp;points)&nbsp;</xsl:text>
+   <xsl:value-of select="enemy-attribute[@class='target']" />
+  </xsl:when>
+  <xsl:when test="enemy-attribute[@class='resistance']">
+   <xsl:text>(RESISTANCE&nbsp;points)&nbsp;</xsl:text>
+   <xsl:value-of select="enemy-attribute[@class='resistance']" />
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="enemy-attribute[@class='endurance']" />
+  </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>\t</xsl:text>
+
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="choice">
+ <xsl:variable name="link">
+  <xsl:value-of select="@idref" />
+ </xsl:variable>
+
+ <xsl:text>\t</xsl:text>
+ <xsl:for-each select="* | text()">
+  <xsl:choose>
+   <xsl:when test="self::link-text">
+    <xsl:text>\q="#</xsl:text><xsl:value-of select="$link" /><xsl:text>"</xsl:text>
+     <xsl:apply-templates />
+    <xsl:text>\q</xsl:text>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:apply-templates select="." />
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:for-each>
+ <xsl:text>\t</xsl:text>
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="signpost">
+ <xsl:text>\c</xsl:text>
+  <xsl:apply-templates />
+  <xsl:value-of select="$newline" />
+ <xsl:text>\c</xsl:text>
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="blockquote">
+ <xsl:text>\t</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>\t</xsl:text>
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newparagraph" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="illustration">
+ <xsl:choose>
+  <xsl:when test="instance[@class='pml'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:text>\c\m="</xsl:text><xsl:value-of select="instance[@class='pml']/@src" /><xsl:text>"</xsl:text>
+   <xsl:value-of select="$newline" />
+   <xsl:text>\c</xsl:text>
+   <xsl:if test="following-sibling::node( )">
+    <xsl:value-of select="$newparagraph" />
+   </xsl:if>
+  </xsl:when>
+  <xsl:when test="instance[@class='text'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <xsl:apply-templates select="instance[@class='text']/*" />
+   <xsl:if test="following-sibling::node( )">
+    <xsl:value-of select="$newparagraph" />
+   </xsl:if>
+  </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="instance" />
+
+<xsl:template match="footnotes" />
+
+<xsl:template match="footnote">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="hr">
+ <xsl:text>\w="80%"</xsl:text>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dt">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="dd">
+ <xsl:text>\t</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>\t</xsl:text>
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="ol/li">
+ <xsl:number count="li" /><xsl:text>. </xsl:text>
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="ul/li">
+ <xsl:text>&bullet; </xsl:text>
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="ul[@class='unbulleted']/li">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::node( )">
+  <xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<!-- ==================== inline elements ======================= -->
+
+<xsl:template match="a">
+ <xsl:if test="@id">
+  <xsl:text>\Q="</xsl:text><xsl:value-of select="@id" /><xsl:text>"</xsl:text>
+ </xsl:if>
+ <xsl:if test="@idref">
+  <xsl:text>\q="#</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
+ </xsl:if>
+
+ <xsl:apply-templates />
+
+ <xsl:if test="@idref">
+  <xsl:text>\q</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="footnote//a">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="a[@class='footnote']">
+ <xsl:apply-templates />
+ <xsl:text>\Sp\Fn="</xsl:text><xsl:value-of select="@idref" /><xsl:text>"</xsl:text>
+ <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
+ <xsl:text>\Fn\Sp</xsl:text>
+</xsl:template>
+
+<xsl:template match="em">
+ <xsl:text>\i{</xsl:text><xsl:apply-templates /><xsl:text>i</xsl:text>
+</xsl:template>
+
+<xsl:template match="strong">
+ <xsl:text>\B</xsl:text><xsl:apply-templates /><xsl:text>\B</xsl:text>
+</xsl:template>
+
+<xsl:template match="cite">
+ <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
+</xsl:template>
+
+<xsl:template match="thought">
+ <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
+</xsl:template>
+
+<xsl:template match="onomatopoeia">
+ <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
+</xsl:template>
+
+<xsl:template match="spell">
+ <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
+</xsl:template>
+
+<xsl:template match="item">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="foreign">
+ <xsl:text>\i</xsl:text><xsl:apply-templates /><xsl:text>\i</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>&lsquot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&rsquot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote//quote">
+ <xsl:text>&ldquot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&rdquot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="code">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="br">
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+</xsl:transform>
+
diff --git a/xml/pmlchar.mod b/xml/pmlchar.mod
new file mode 100644 (file)
index 0000000..0e63222
--- /dev/null
@@ -0,0 +1,130 @@
+<!-- ============================================================= -->
+<!--                    PML Characters Module v0.1                 -->
+<!-- ============================================================= -->
+<!--
+
+This module defines the mapping between the character entities used in
+the Project Aon instances of Gamebook XML and the ISO-8859-1
+characters.
+
+Portions Copyright International Organization for Standardization 1986 
+Permission to copy in any form is granted for use with conforming SGML 
+systems and applications as defined in ISO 8879, provided this notice 
+is included in all copies.
+
+-->
+
+<!ENTITY nbsp   "\a160"><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
+<!ENTITY iexcl  "\a161"><!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent   "\a162"><!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound  "\a163"><!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "\a164"><!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen    "\a165"><!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "\a166"><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
+<!ENTITY sect   "\a167"><!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml    "\a168"><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
+<!ENTITY copy   "\a169"><!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf   "\a170"><!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo  "\a171"><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not    "\a172"><!-- not sign, U+00AC ISOnum -->
+<!ENTITY shy    "\a173"><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
+<!ENTITY reg    "\a174"><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
+<!ENTITY macr   "\a175"><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg    "\a176"><!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "\a177"><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
+<!ENTITY sup2   "\a178"><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
+<!ENTITY sup3   "\a179"><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
+<!ENTITY acute  "\a180"><!-- acute accent = spacing acute, U+00B4 ISOdia -->
+<!ENTITY micro  "\a181"><!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para   "\a182"><!-- pilcrow sign  = paragraph sign, U+00B6 ISOnum -->
+<!ENTITY middot "\a183"><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil  "\a184"><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1   "\a185"><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
+<!ENTITY ordm   "\a186"><!-- masculine ordinal indicator, U+00BA ISOnum -->
+<!ENTITY raquo  "\a187"><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "\a188"><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "\a189"><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "\a190"><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "\a191"><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "\a192"><!-- latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1 -->
+<!ENTITY Aacute "\a193"><!-- latin capital letter A with acute, U+00C1 ISOlat1 -->
+<!ENTITY Acirc  "\a194"><!-- latin capital letter A with circumflex, U+00C2 ISOlat1 -->
+<!ENTITY Atilde "\a195"><!-- latin capital letter A with tilde, U+00C3 ISOlat1 -->
+<!ENTITY Auml   "\a196"><!-- latin capital letter A with diaeresis, U+00C4 ISOlat1 -->
+<!ENTITY Aring  "\a197"><!-- latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1 -->
+<!ENTITY AElig  "\a198"><!-- latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "\a199"><!-- latin capital letter C with cedilla, U+00C7 ISOlat1 -->
+<!ENTITY Egrave "\a200"><!-- latin capital letter E with grave, U+00C8 ISOlat1 -->
+<!ENTITY Eacute "\a201"><!-- latin capital letter E with acute, U+00C9 ISOlat1 -->
+<!ENTITY Ecirc  "\a202"><!-- latin capital letter E with circumflex, U+00CA ISOlat1 -->
+<!ENTITY Euml   "\a203"><!-- latin capital letter E with diaeresis, U+00CB ISOlat1 -->
+<!ENTITY Igrave "\a204"><!-- latin capital letter I with grave, U+00CC ISOlat1 -->
+<!ENTITY Iacute "\a205"><!-- latin capital letter I with acute, U+00CD ISOlat1 -->
+<!ENTITY Icirc  "\a206"><!-- latin capital letter I with circumflex, U+00CE ISOlat1 -->
+<!ENTITY Iuml   "\a207"><!-- latin capital letter I with diaeresis, U+00CF ISOlat1 -->
+<!ENTITY ETH    "\a208"><!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "\a209"><!-- latin capital letter N with tilde, U+00D1 ISOlat1 -->
+<!ENTITY Ograve "\a210"><!-- latin capital letter O with grave, U+00D2 ISOlat1 -->
+<!ENTITY Oacute "\a211"><!-- latin capital letter O with acute, U+00D3 ISOlat1 -->
+<!ENTITY Ocirc  "\a212"><!-- latin capital letter O with circumflex, U+00D4 ISOlat1 -->
+<!ENTITY Otilde "\a213"><!-- latin capital letter O with tilde, U+00D5 ISOlat1 -->
+<!ENTITY Ouml   "\a214"><!-- latin capital letter O with diaeresis, U+00D6 ISOlat1 -->
+<!ENTITY times  "\a215"><!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "\a216"><!-- latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "\a217"><!-- latin capital letter U with grave, U+00D9 ISOlat1 -->
+<!ENTITY Uacute "\a218"><!-- latin capital letter U with acute, U+00DA ISOlat1 -->
+<!ENTITY Ucirc  "\a219"><!-- latin capital letter U with circumflex, U+00DB ISOlat1 -->
+<!ENTITY Uuml   "\a220"><!-- latin capital letter U with diaeresis, U+00DC ISOlat1 -->
+<!ENTITY Yacute "\a221"><!-- latin capital letter Y with acute, U+00DD ISOlat1 -->
+<!ENTITY THORN  "\a222"><!-- latin capital letter THORN, U+00DE ISOlat1 -->
+<!ENTITY szlig  "\a223"><!-- latin small letter sharp s = ess-zed, U+00DF ISOlat1 -->
+<!ENTITY agrave "\a224"><!-- latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1 -->
+<!ENTITY aacute "\a225"><!-- latin small letter a with acute, U+00E1 ISOlat1 -->
+<!ENTITY acirc  "\a226"><!-- latin small letter a with circumflex, U+00E2 ISOlat1 -->
+<!ENTITY atilde "\a227"><!-- latin small letter a with tilde, U+00E3 ISOlat1 -->
+<!ENTITY auml   "\a228"><!-- latin small letter a with diaeresis, U+00E4 ISOlat1 -->
+<!ENTITY aring  "\a229"><!-- latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1 -->
+<!ENTITY aelig  "\a230"><!-- latin small letter ae = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "\a231"><!-- latin small letter c with cedilla, U+00E7 ISOlat1 -->
+<!ENTITY egrave "\a232"><!-- latin small letter e with grave, U+00E8 ISOlat1 -->
+<!ENTITY eacute "\a233"><!-- latin small letter e with acute, U+00E9 ISOlat1 -->
+<!ENTITY ecirc  "\a234"><!-- latin small letter e with circumflex, U+00EA ISOlat1 -->
+<!ENTITY euml   "\a235"><!-- latin small letter e with diaeresis, U+00EB ISOlat1 -->
+<!ENTITY igrave "\a236"><!-- latin small letter i with grave, U+00EC ISOlat1 -->
+<!ENTITY iacute "\a237"><!-- latin small letter i with acute, U+00ED ISOlat1 -->
+<!ENTITY icirc  "\a238"><!-- latin small letter i with circumflex, U+00EE ISOlat1 -->
+<!ENTITY iuml   "\a239"><!-- latin small letter i with diaeresis, U+00EF ISOlat1 -->
+<!ENTITY eth    "\a240"><!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "\a241"><!-- latin small letter n with tilde, U+00F1 ISOlat1 -->
+<!ENTITY ograve "\a242"><!-- latin small letter o with grave, U+00F2 ISOlat1 -->
+<!ENTITY oacute "\a243"><!-- latin small letter o with acute, U+00F3 ISOlat1 -->
+<!ENTITY ocirc  "\a244"><!-- latin small letter o with circumflex, U+00F4 ISOlat1 -->
+<!ENTITY otilde "\a245"><!-- latin small letter o with tilde, U+00F5 ISOlat1 -->
+<!ENTITY ouml   "\a246"><!-- latin small letter o with diaeresis, U+00F6 ISOlat1 -->
+<!ENTITY divide "\a247"><!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "\a248"><!-- latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1 -->
+<!ENTITY ugrave "\a249"><!-- latin small letter u with grave, U+00F9 ISOlat1 -->
+<!ENTITY uacute "\a250"><!-- latin small letter u with acute, U+00FA ISOlat1 -->
+<!ENTITY ucirc  "\a251"><!-- latin small letter u with circumflex, U+00FB ISOlat1 -->
+<!ENTITY uuml   "\a252"><!-- latin small letter u with diaeresis, U+00FC ISOlat1 -->
+<!ENTITY yacute "\a253"><!-- latin small letter y with acute, U+00FD ISOlat1 -->
+<!ENTITY thorn  "\a254"><!-- latin small letter thorn, U+00FE ISOlat1 -->
+<!ENTITY yuml   "\a255"><!-- latin small letter y with diaeresis, U+00FF ISOlat1 -->
+
+<!-- ::::::::::::::::::::: Special Characters :::::::::::::::::::: -->
+
+<!ENTITY ampersand "&amp;"><!-- ampersand -->
+<!ENTITY lsquot    "\a145"><!-- opening left quotation mark -->
+<!ENTITY rsquot    "\a146"><!-- closing right quotation mark -->
+<!ENTITY ldquot    "\a147"><!-- opening left double quotation mark -->
+<!ENTITY rdquot    "\a148"><!-- closing right double quotation mark -->
+<!ENTITY minus     "-"><!-- mathematical minus -->
+<!ENTITY endash    "\a150"><!-- endash -->
+<!ENTITY emdash    "\a151"><!-- emdash -->
+<!ENTITY ellips    "\a133"><!-- ellipsis -->
+<!ENTITY lellips   "\a133"><!-- left ellipsis, used at the beginning of edited material -->
+<!ENTITY blankline "_______"><!-- blank line to be filled in -->
+<!ENTITY percent   "&#37;"><!-- percent sign -->
+<!ENTITY thinspace "\a160"><!-- small horizontal space for use between adjacent quotation marks - added mainly for LaTeX's sake -->
+
+<!ENTITY bullet    "\a149"><!-- bullet, only used in PML -->
\ No newline at end of file
diff --git a/xml/xhtml-pda.xsl b/xml/xhtml-pda.xsl
new file mode 100644 (file)
index 0000000..519a180
--- /dev/null
@@ -0,0 +1,1293 @@
+<?xml version="1.0"?>
+<!DOCTYPE xhtml-transform [
+ <!ENTITY nbsp "&#160;">
+]>
+
+<!--
+
+$Id$
+
+$Log$
+Revision 1.1  2005/01/30 01:32:52  jonathan.blake
+Initial freepository revision of XML support documents.
+
+Revision 1.1  2003/01/15 17:22:44  jblake
+Initial revision
+
+
+Revision 1.1  2002/10/22 16:35:26  jblake
+Initial revision
+
+
+Revision 1.2  2002/10/20 06:25:35  jblake
+Added support for CLOSE COMBAT SKILL for Freeway Warrior books.
+
+Revision 1.1  2002/10/15 23:29:51  jblake
+Initial revision
+
+
+20020327 - repurposed to be used with Xalan Java 2
+-->
+
+<xsl:transform version="1.0"
+  xmlns:xml="http://www.w3.org/XML/1998/namespace"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lxslt="http://xml.apache.org/xslt"
+  xmlns:redirect="org.apache.xalan.lib.Redirect"
+  extension-element-prefixes="redirect">
+
+<xsl:output method="xml"
+            encoding="ISO-8859-1"
+            omit-xml-declaration="yes"
+            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
+
+<xsl:strip-space elements="section data ol ul dl li dd footnotes footnote" />
+<xsl:preserve-space elements="p" />
+
+<!-- ====================== parameters ========================== -->
+
+<xsl:param name="book-path"><xsl:text>undefined-book</xsl:text></xsl:param>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ colors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+<xsl:param name="link-color"><xsl:text>#ff0000</xsl:text></xsl:param>
+<xsl:param name="alink-color"><xsl:value-of select="$link-color" /></xsl:param>
+<xsl:param name="vlink-color"><xsl:value-of select="$link-color" /></xsl:param>
+
+<xsl:param name="text-color"><xsl:text>#000000</xsl:text></xsl:param>
+<xsl:param name="background-color"><xsl:text>ffffe4</xsl:text></xsl:param>
+
+<!-- ======================= variables ========================== -->
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- ======================== Templates ========================= -->
+
+<!-- ================= hierarchical sections ==================== -->
+
+<xsl:template match="meta" />
+<xsl:template match="section" />
+
+<!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">top-level</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">toc</xsl:with-param>
+  <xsl:with-param name="filename">toc</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:apply-templates />
+
+</xsl:template>
+
+<!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-frontmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level front matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-frontmatter-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h5><xsl:value-of select="meta/title[1]" /></h5>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::: second-level main matter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-mainmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level main matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-mainmatter-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h5><xsl:value-of select="meta/title[1]" /></h5>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: second-level glossary sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='glossary']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-glossary</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+  <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level glossary sections ::::::::::::: -->
+<!-- glossary sections should be enclosed in a second level glossary section -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-glossary-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+  <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-numbered</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='numbered']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-numbered</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='backmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-backmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::::::::::: map template ::::::::::::::::::::::::: -->
+
+<xsl:template match="id( 'map' )">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">map-adjusted</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">map</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /><xsl:text>large</xsl:text></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- ==================== block elements ======================== -->
+
+<xsl:template match="p">
+ <p><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="p[@class='dedication']">
+ <p class="dedication"><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl[@class='paragraphed']/dd/node() | ol[@class='paragraphed']/li/node() | ul[@class='paragraphed']/li/node()">
+ <xsl:choose>
+  <xsl:when test="self::p">
+   <xsl:apply-templates /><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::dl">
+   <dl><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </dl><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ol">
+   <ol><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ol><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ul">
+   <ul>
+    <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+    <xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ul><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::blockquote">
+   <blockquote><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </blockquote><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::illustration">
+   <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+   <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+   <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+   <xsl:if test="instance[@class='pdaxhtml']">
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <p><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" border="0" align="middle" alt="[illustration]" /></p><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+   </xsl:if>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:text>[error: paragraphed list template]</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="ol">
+ <ol><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ol><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="ul">
+ <ul>
+  <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+  <xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ul><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl">
+ <dl><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </dl><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dt">
+ <dt><xsl:apply-templates /></dt>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dd">
+ <dd><xsl:apply-templates /></dd>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="li">
+ <li><xsl:apply-templates /></li>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="table">
+ <table border="1" cellspacing="0" cellpadding="2">
+  <xsl:apply-templates />
+ </table>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="tr">
+ <tr>
+  <xsl:apply-templates />
+ </tr>
+</xsl:template>
+
+<xsl:template match="th">
+ <th>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </th>
+</xsl:template>
+
+<xsl:template match="td">
+ <td>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </td>
+</xsl:template>
+
+<xsl:template match="combat">
+ <p class="combat">
+  <xsl:apply-templates select="enemy" />
+  <xsl:text>: </xsl:text>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='combatskill']">
+    <span class="smallcaps">COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='combatskill']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='closecombatskill']">
+    <span class="smallcaps">CLOSE<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
+   </xsl:when>
+  </xsl:choose>
+  <xsl:text disable-output-escaping="yes"> &amp;nbsp;&amp;nbsp;</xsl:text>
+  <span class="smallcaps">ENDURANCE</span>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='target']">
+    <xsl:text>(</xsl:text><span class="smallcaps">TARGET</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='target']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='resistance']">
+    <xsl:text>(</xsl:text><span class="smallcaps">RESISTANCE</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='resistance']" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='endurance']" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="choice">
+ <xsl:variable name="link">
+  <xsl:value-of select="@idref" />
+ </xsl:variable>
+
+ <p class="choice">
+  <xsl:for-each select="* | text()">
+   <xsl:choose>
+    <xsl:when test="self::link-text">
+     <a href="{$link}.htm">
+      <xsl:apply-templates />
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="." />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:for-each>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="signpost">
+ <div class="signpost">
+  <xsl:apply-templates />
+ </div>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="blockquote">
+ <blockquote><xsl:value-of select="$newline" />
+  <xsl:apply-templates /><xsl:value-of select="$newline" />
+ </blockquote><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="illustration">
+ <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+ <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+ <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+ <xsl:variable name="illustration-width-adjusted"><xsl:number value="$illustration-width div 2" /></xsl:variable>
+ <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height div 2" /></xsl:variable>
+
+ <xsl:if test="instance[@class='pdaxhtml']">
+  <xsl:choose>
+   <xsl:when test="@class='float'">
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <p>
+      <a>
+       <xsl:attribute name="href"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float']" from="/" level="any" format="1" /><xsl:text>.htm</xsl:text></xsl:attribute>
+       <img src="{$illustration-src}" width="{$illustration-width-adjusted}" height="{$illustration-height-adjusted}" border="0" align="middle" alt="[illustration]" />
+      </a>
+     </p><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+
+    <xsl:call-template name="xhtml-wrapper">
+     <xsl:with-param name="document-type">illustration</xsl:with-param>
+     <xsl:with-param name="filename"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float']" from="/" level="any" format="1" /></xsl:with-param>
+    </xsl:call-template>
+   </xsl:when>
+
+   <xsl:otherwise>
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <p><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" border="0" align="middle" alt="[illustration]" /></p><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+   </xsl:otherwise>
+  </xsl:choose>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="instance" />
+
+<xsl:template match="footnotes" />
+
+<xsl:template match="footnote" />
+
+<xsl:template match="hr">
+ <hr />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== inline elements ======================= -->
+
+<xsl:template match="a">
+ <xsl:choose>
+  <xsl:when test="@href">
+   <a>
+    <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
+    <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <a>
+    <xsl:if test="@idref">
+     <xsl:variable name="my-idref" select="@idref" />
+     <xsl:attribute name="href">
+      <xsl:choose>
+       <!-- The order of these tests is deliberate. They are ordered roughly from most to least specific. -->
+       <xsl:when test="/gamebook/section[@id=$my-idref] | /gamebook/section/data/section[@id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='numbered' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section[descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section[descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>[error: "a" template]</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="a[@class='footnote']">
+ <xsl:apply-templates />
+ <sup>
+  <a>
+   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
+   <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
+   <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
+  </a>
+ </sup>
+</xsl:template>
+
+<xsl:template match="em">
+ <em><xsl:apply-templates /></em>
+</xsl:template>
+
+<xsl:template match="strong">
+ <strong><xsl:apply-templates /></strong>
+</xsl:template>
+
+<xsl:template match="thought">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="onomatopoeia">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="spell">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="item">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="foreign">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>&apos;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&apos;</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote//quote">
+ <xsl:text>&quot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&quot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="cite">
+ <cite><xsl:apply-templates /></cite>
+</xsl:template>
+
+<xsl:template match="code">
+ <tt><xsl:apply-templates /></tt>
+</xsl:template>
+
+<xsl:template match="br">
+ <br />
+</xsl:template>
+
+<xsl:template match="typ[@class='attribute']">
+ <span class="smallcaps"><xsl:apply-templates /></span>
+</xsl:template>
+
+<!-- ==================== named templates ======================= -->
+
+<xsl:template name="xhtml-wrapper">
+ <xsl:param name="document-type">undefined</xsl:param>
+ <xsl:param name="filename">undefined</xsl:param>
+ <xsl:param name="glossary-id-prefix"></xsl:param>
+
+ <redirect:write file="{$book-path}/{$filename}.htm">
+  <xsl:fallback>
+   <xsl:text>xhtml-wrapper: Cannot write to filename: "</xsl:text>
+   <xsl:value-of select="$filename" /><xsl:text>.htm"</xsl:text>
+  </xsl:fallback>
+
+  <xsl:comment>
+   <xsl:text> </xsl:text>
+   <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
+   <xsl:text> Published by </xsl:text>
+   <xsl:value-of select="/gamebook/meta/publisher[1]" />
+   <xsl:text>. </xsl:text>
+  </xsl:comment>
+  <xsl:value-of select="$newline" />
+
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-UK" lang="en-UK">
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+   <head><xsl:value-of select="$newline" />
+    <title>
+     <xsl:value-of select="/gamebook/meta/title[1]" />
+     <xsl:text>: </xsl:text>
+     <xsl:choose>
+      <xsl:when test="$document-type='illustration'">
+       <xsl:text>Illustration </xsl:text>
+       <xsl:number count="illustration[@class='float']" from="/" level="any" format="I" />
+      </xsl:when>
+      <xsl:otherwise><xsl:value-of select="meta/title[1]" /></xsl:otherwise>
+     </xsl:choose>
+    </title><xsl:value-of select="$newline" />
+    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><xsl:value-of select="$newline" />
+    <meta name="robots" content="noindex,nofollow" /><xsl:value-of select="$newline" />
+    <link rel="stylesheet" href="main.css" type="text/css" /><xsl:value-of select="$newline" />
+   </head>
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+   <body>
+    <xsl:attribute name="text"><xsl:value-of select="$text-color" /></xsl:attribute>
+    <xsl:attribute name="bgcolor"><xsl:value-of select="$background-color" /></xsl:attribute>
+    <xsl:attribute name="background"><xsl:text>bckgrnd.gif</xsl:text></xsl:attribute>
+    <xsl:attribute name="link"><xsl:value-of select="$link-color" /></xsl:attribute>
+    <xsl:attribute name="alink"><xsl:value-of select="$alink-color" /></xsl:attribute>
+    <xsl:attribute name="vlink"><xsl:value-of select="$vlink-color" /></xsl:attribute>
+
+    <xsl:value-of select="$newline" />
+    <h1><xsl:value-of select="/gamebook/meta/title[1]" /></h1><xsl:value-of select="$newline" />
+    <div id="body"><xsl:value-of select="$newline" />
+
+     <xsl:choose>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ top-level ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='top-level'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <p class="author"><xsl:apply-templates select="/gamebook/meta/creator[@class='medium']" /></p>
+
+        <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
+
+        <p>
+         <xsl:text>Publication Date: </xsl:text>
+         <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
+         <xsl:text> </xsl:text>
+         <xsl:choose>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
+           <xsl:text>January</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
+           <xsl:text>February</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
+           <xsl:text>March</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
+           <xsl:text>April</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
+           <xsl:text>May</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
+           <xsl:text>June</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
+           <xsl:text>July</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
+           <xsl:text>August</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
+           <xsl:text>September</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
+           <xsl:text>October</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
+           <xsl:text>November</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
+           <xsl:text>December</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>Invalid Month</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> </xsl:text>
+         <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
+        </p>
+
+        <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
+
+        <hr />
+
+        <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
+        <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ toc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='toc'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2>Table of Contents</h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <ul><xsl:value-of select="$newline" />
+         <li>
+          <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+           <xsl:value-of select="meta/title[1]" />
+          </a>
+         </li>
+         <xsl:for-each select="data/section">
+          <li>
+           <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+            <xsl:value-of select="meta/title[1]" />
+           </a>
+           <xsl:if test="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
+            <xsl:value-of select="$newline" />
+            <ul><xsl:value-of select="$newline" />
+             <xsl:for-each select="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
+              <li>
+               <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+                <xsl:value-of select ="meta/title[1]" />
+               </a>
+              </li><xsl:value-of select="$newline" />
+             </xsl:for-each>
+            </ul><xsl:value-of select="$newline" />
+           </xsl:if>
+          </li><xsl:value-of select="$newline" />
+         </xsl:for-each>
+        </ul><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+        <xsl:call-template name="navigation-bar" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-frontmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-frontmatter'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-frontmatter-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-frontmatter-separate'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-mainmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-mainmatter'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-mainmatter-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-mainmatter-separate'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-glossary ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-glossary'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="alpha-bar">
+         <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-glossary-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-glossary-separate'">
+       <div class="glossary"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:call-template name="alpha-bar">
+         <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~ second-level-numbered ~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-numbered'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <p>
+         <xsl:for-each select="data/section">
+          <xsl:if test="position() mod 50 = 1">
+           <a>
+            <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="position()" /></xsl:attribute>
+            <xsl:value-of select="position()" /><xsl:text> - </xsl:text>
+            <xsl:choose>
+             <xsl:when test="position() + 49 &lt;= last()">
+              <xsl:value-of select="position() + 49" />
+             </xsl:when>
+             <xsl:otherwise>
+              <xsl:value-of select="last()" />
+             </xsl:otherwise>
+            </xsl:choose>
+           </a><br /><xsl:value-of select="$newline" />
+          </xsl:if>
+         </xsl:for-each>
+        </p>
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <hr />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:for-each select="data/section">
+         <xsl:if test="position() mod 10 = 1">
+          <h3>
+           <a>
+            <xsl:attribute name="name"><xsl:value-of select="position()" /></xsl:attribute>
+            <xsl:value-of select="position()" /><xsl:text> - </xsl:text>
+            <xsl:choose>
+             <xsl:when test="position() + 9 &lt;= last()">
+              <xsl:value-of select="position() + 9" />
+             </xsl:when>
+             <xsl:otherwise>
+              <xsl:value-of select="last()" />
+             </xsl:otherwise>
+            </xsl:choose>
+           </a>
+          </h3><xsl:value-of select="$newline" />
+          <xsl:text disable-output-escaping="yes">&lt;p class="center"&gt;&lt;tt&gt;[</xsl:text>
+         </xsl:if>
+         <a>
+          <xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+          <xsl:value-of select="meta/title[1]" />
+         </a>
+         <xsl:choose>
+          <xsl:when test="position() mod 10 = 0">
+           <xsl:text disable-output-escaping="yes">]&lt;/tt&gt;&lt;/p&gt;</xsl:text>
+           <xsl:value-of select="$newline" />
+           <xsl:value-of select="$newline" />
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>|</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+        </xsl:for-each>
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~ third-level-numbered ~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-numbered'">
+       <div class="numbered"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~ second-level-backmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-backmatter'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~ map-adjusted ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='map-adjusted'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:for-each select="data/* | data/text()">
+         <xsl:choose>
+          <xsl:when test="self::illustration">
+           <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+           <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+           <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+           <xsl:variable name="illustration-width-adjusted"><xsl:number value="386" /></xsl:variable>
+           <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height * $illustration-width-adjusted div $illustration-width" /></xsl:variable>
+
+           <p>[map]</p>
+
+<!--           <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+            <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrtpl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtp.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtpr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrl.gif" width="31" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><a href="maplarge.htm"><img src="{$illustration-src}" width="{$illustration-width-adjusted}" height="{$illustration-height-adjusted}" align="middle" border="0" alt="[map]" /></a></td><xsl:value-of select="$newline" />
+              <td><img src="brdrr.gif" width="33" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrbtl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbt.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbtr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+            </table><xsl:value-of select="$newline" />
+            <br /><br />
+           </div></div><xsl:value-of select="$newline" /> -->
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:apply-templates select="." />
+          </xsl:otherwise>
+         </xsl:choose>
+        </xsl:for-each>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ map ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='map'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:for-each select="data/* | data/text()">
+         <xsl:choose>
+          <xsl:when test="self::illustration">
+           <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+           <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+           <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+           <p>[map]</p>
+
+<!--           <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+            <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrtpl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtp.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtpr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrl.gif" width="31"  height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><a href="map.htm"><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[map]" /></a></td><xsl:value-of select="$newline" />
+              <td><img src="brdrr.gif" width="33" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrbtl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbt.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbtr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+            </table><br /><xsl:value-of select="$newline" />
+           </div></div><xsl:value-of select="$newline" />-->
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:apply-templates select="." />
+          </xsl:otherwise>
+         </xsl:choose>
+        </xsl:for-each>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~ illustration ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='illustration'">
+       <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+       <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+       <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+       <h3>
+        <xsl:text>Illustration </xsl:text>
+        <xsl:number count="illustration[@class='float']" from="/" level="any" format="I" />
+       </h3><xsl:value-of select="$newline" />
+
+       <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+        <p><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[illustration]" /></p><xsl:value-of select="$newline" />
+       </div></div><xsl:value-of select="$newline" />
+       <p class="caption"><strong><xsl:apply-templates select="meta/description" /></strong></p><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:otherwise>
+       <xsl:message>
+        <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
+        <xsl:value-of select="$document-type" />
+        <xsl:text>".</xsl:text>
+       </xsl:message>
+       <p>
+        <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
+        <xsl:value-of select="$document-type" />
+        <xsl:text>".</xsl:text>
+       </p>
+      </xsl:otherwise>
+
+     </xsl:choose>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+     <xsl:call-template name="process-footnotes" />
+
+     <p class="copyright"><xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" /></p><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    </div><xsl:value-of select="$newline" />
+
+    <map name="imagemap" id="imagemap">
+     <area shape="rect" coords="0,0,99,99" href="http://www.projectaon.org/" alt="Project Aon" />
+     <area shape="default" href="title.htm" alt="The Masters of Darkness" />
+    </map>
+
+   </body>
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+  </html>
+ </redirect:write>
+
+</xsl:template>
+
+<xsl:template name="process-footnotes">
+ <xsl:if test="footnotes/footnote">
+  <div id="footnotes"><xsl:value-of select="$newline" />
+   <xsl:for-each select="footnotes/footnote">
+    <xsl:variable name="footnote-idref" select="@idref" />
+    <xsl:variable name="footnote-id" select="@id" />
+    <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
+
+    <xsl:for-each select="*[1]">
+     <p>
+      <xsl:text>[</xsl:text>
+       <a href="#{$footnote-idref}" name="{$footnote-id}"><xsl:value-of select="$footnote-marker" /></a>
+      <xsl:text>] </xsl:text>
+      <xsl:apply-templates select="child::* | child::text()" />
+     </p>
+    </xsl:for-each>
+
+    <xsl:for-each select="*[position() != 1]">
+      <xsl:apply-templates select="." />
+    </xsl:for-each>
+   </xsl:for-each>
+  </div><xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="navigation-bar">
+ <div class="navigation">
+  <table cellspacing="0" cellpadding="0" border="0">
+   <tr>
+    <td>
+     <xsl:choose>
+      <xsl:when test="meta/link[@class='prev']">
+       <a>
+        <xsl:attribute name="href">
+         <xsl:value-of select="meta/link[@class='prev']/@idref" />
+         <xsl:text>.htm</xsl:text>
+        </xsl:attribute>
+        <img src="back.gif" width="150" height="30" border="0">
+         <xsl:attribute name="alt">
+          <xsl:value-of select="id( meta/link[@class='prev']/@idref )/meta/title" />
+         </xsl:attribute>
+        </img>
+       </a>
+      </xsl:when>
+      <xsl:otherwise>
+       <img src="left.gif" width="150" height="30" border="0" alt="" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </td>
+    <td><a href="toc.htm"><img src="toc.gif" width="150" height="30" border="0" alt="" /></a></td>
+    <td>
+     <xsl:choose>
+      <xsl:when test="meta/link[@class='next']">
+       <a>
+        <xsl:attribute name="href">
+         <xsl:value-of select="meta/link[@class='next']/@idref" />
+         <xsl:text>.htm</xsl:text>
+        </xsl:attribute>
+        <img src="forward.gif" width="150" height="30" border="0">
+         <xsl:attribute name="alt">
+          <xsl:choose>
+           <xsl:when test="$next-id = 'sect1'">
+            <xsl:text>Section 1</xsl:text>
+           </xsl:when>
+           <xsl:otherwise>
+            <xsl:value-of select="id( meta/link[@class='next']/@idref )/meta/title" />
+           </xsl:otherwise>
+          </xsl:choose>
+         </xsl:attribute>
+        </img>
+       </a>
+      </xsl:when>
+      <xsl:otherwise>
+       <img src="right.gif" width="150" height="30" border="0" alt="" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </td>
+   </tr>
+  </table>
+ </div>
+</xsl:template>
+
+<xsl:template name="alpha-bar">
+ <xsl:param name="alpha-bar-id-prefix"></xsl:param>
+
+  <p class="navigation">[<a href="{$alpha-bar-id-prefix}a.htm">A</a>&nbsp;<a href="{$alpha-bar-id-prefix}b.htm">B</a>&nbsp;<a href="{$alpha-bar-id-prefix}c.htm">C</a>&nbsp;<a href="{$alpha-bar-id-prefix}d.htm">D</a>&nbsp;<a href="{$alpha-bar-id-prefix}e.htm">E</a>&nbsp;<a href="{$alpha-bar-id-prefix}f.htm">F</a>&nbsp;<a href="{$alpha-bar-id-prefix}g.htm">G</a>&nbsp;<a href="{$alpha-bar-id-prefix}h.htm">H</a>&nbsp;<a href="{$alpha-bar-id-prefix}i.htm">I</a>&nbsp;<a href="{$alpha-bar-id-prefix}j.htm">J</a>&nbsp;<a href="{$alpha-bar-id-prefix}k.htm">K</a>&nbsp;<a href="{$alpha-bar-id-prefix}l.htm">L</a>&nbsp;<a href="{$alpha-bar-id-prefix}m.htm">M</a>&nbsp;<a href="{$alpha-bar-id-prefix}n.htm">N</a>&nbsp;<a href="{$alpha-bar-id-prefix}o.htm">O</a>&nbsp;<a href="{$alpha-bar-id-prefix}p.htm">P</a>&nbsp;<a href="{$alpha-bar-id-prefix}q.htm">Q</a>&nbsp;<a href="{$alpha-bar-id-prefix}r.htm">R</a>&nbsp;<a href="{$alpha-bar-id-prefix}s.htm">S</a>&nbsp;<a href="{$alpha-bar-id-prefix}t.htm">T</a>&nbsp;<a href="{$alpha-bar-id-prefix}u.htm">U</a>&nbsp;<a href="{$alpha-bar-id-prefix}v.htm">V</a>&nbsp;<a href="{$alpha-bar-id-prefix}w.htm">W</a>&nbsp;<a href="{$alpha-bar-id-prefix}x.htm">X</a>&nbsp;<a href="{$alpha-bar-id-prefix}y.htm">Y</a>&nbsp;<a href="{$alpha-bar-id-prefix}z.htm">Z</a>]</p><xsl:value-of select="$newline" />
+
+</xsl:template>
+
+</xsl:transform>
\ No newline at end of file
diff --git a/xml/xhtml-single.xsl b/xml/xhtml-single.xsl
new file mode 100644 (file)
index 0000000..75c5b76
--- /dev/null
@@ -0,0 +1,705 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:transform [
+ <!ENTITY % xhtml.characters SYSTEM "htmlchar.mod">
+ %xhtml.characters;
+]>
+
+<!--
+
+$Id$
+
+$Log$
+Revision 1.1  2005/01/30 01:32:52  jonathan.blake
+Initial freepository revision of XML support documents.
+
+Revision 1.1  2003/01/15 17:24:02  jblake
+Initial revision - originally xhtml.xsl:
+
+Revision 1.11  2002/12/06 22:12:04  jblake
+Added default namespace declaration to transformation element
+and removed all the extraneous declarations in the template
+elements.
+
+Revision 1.10  2002/11/17 22:37:25  jblake
+Removed the "medium" creator entry from the templates.
+Will they be of any use?
+
+Revision 1.9  2002/11/17 05:06:56  jblake
+Rearranged the title page.
+
+Revision 1.8  2002/11/15 19:35:25  jblake
+Fixed "Content-type" of XHTML output.
+
+Revision 1.7  2002/11/15 00:15:39  jblake
+Fixed a problem with the client-side image map and fixed
+the numbered section list generation so that it will work
+for Shadow on the Sand.
+
+Revision 1.6  2002/10/30 05:59:45  jblake
+Added a value for the alt attribute of the ToC image on the navigation bar.
+
+Revision 1.5  2002/10/24 15:53:41  jblake
+Fixed a conflict with whitespace and paragraphed lists.
+
+Revision 1.4  2002/10/24 15:06:51  jblake
+Added xmlns attributes to all elements that are top level in
+their templates. This was an adjustment required by Xalan-J 2.4.
+
+Also reinstated the comment in each document since the new
+version of Xalan redirects it properly.
+
+Revision 1.3  2002/10/23 05:18:29  jblake
+Added the capability to filter which illustrators' work is used.
+This is accomplished by the "use-illustrators" parameter.
+
+Revision 1.2  2002/10/20 06:25:35  jblake
+Added support for CLOSE COMBAT SKILL for Freeway Warrior books.
+
+Revision 1.1  2002/10/15 23:29:51  jblake
+Initial revision
+
+
+20020327 - repurposed to be used with Xalan Java 2
+
+Todo:
+
+* Add blank whitespace handling to the paragraphed list template
+
+-->
+
+<xsl:transform version="1.0"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lxslt="http://xml.apache.org/xslt">
+
+<xsl:output method="html"
+            encoding="ISO-8859-1"
+            omit-xml-declaration="yes"
+            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
+
+<xsl:strip-space elements="gamebook section meta data ol ul dl li dd footnotes footnote illustration instance" />
+<xsl:preserve-space elements="p choice" />
+
+<!-- ====================== parameters ========================== -->
+
+<xsl:param name="book-path"><xsl:text>undefined-book</xsl:text></xsl:param>
+<xsl:param name="use-illustrators" />
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ colors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+<xsl:param name="link-color"><xsl:text>#ff0000</xsl:text></xsl:param>
+<xsl:param name="alink-color"><xsl:value-of select="$link-color" /></xsl:param>
+<xsl:param name="vlink-color"><xsl:value-of select="$link-color" /></xsl:param>
+
+<xsl:param name="text-color"><xsl:text>#000000</xsl:text></xsl:param>
+<xsl:param name="background-color"><xsl:text>#ffffe4</xsl:text></xsl:param>
+
+<!-- ======================= variables ========================== -->
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- ======================== Templates ========================= -->
+
+<!-- ================= hierarchical sections ==================== -->
+
+<xsl:template match="meta" />
+<xsl:template match="section" />
+
+<!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section[@id='title']">
+ <html xml:lang="en-UK" lang="en-UK">
+
+  <xsl:value-of select="$newline" />
+  <xsl:value-of select="$newline" />
+
+  <head><xsl:value-of select="$newline" />
+   <title>
+    <xsl:value-of select="/gamebook/meta/title[1]" />
+   </title><xsl:value-of select="$newline" />
+   <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" /><xsl:value-of select="$newline" />
+   <meta name="robots" content="noindex,nofollow" /><xsl:value-of select="$newline" />
+   <link rel="stylesheet" href="main.css" type="text/css" /><xsl:value-of select="$newline" />
+  </head>
+
+  <xsl:value-of select="$newline" />
+  <xsl:value-of select="$newline" />
+
+  <xsl:comment>
+   <xsl:text> </xsl:text>
+   <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
+   <xsl:text> Published by </xsl:text>
+   <xsl:value-of select="/gamebook/meta/publisher[1]" />
+   <xsl:text>. </xsl:text>
+  </xsl:comment>
+
+  <xsl:value-of select="$newline" />
+  <xsl:value-of select="$newline" />
+
+  <body>
+   <xsl:attribute name="text"><xsl:value-of select="$text-color" /></xsl:attribute>
+   <xsl:attribute name="bgcolor"><xsl:value-of select="$background-color" /></xsl:attribute>
+   <xsl:attribute name="background"><xsl:text>bckgrnd.gif</xsl:text></xsl:attribute>
+   <xsl:attribute name="link"><xsl:value-of select="$link-color" /></xsl:attribute>
+   <xsl:attribute name="alink"><xsl:value-of select="$alink-color" /></xsl:attribute>
+   <xsl:attribute name="vlink"><xsl:value-of select="$vlink-color" /></xsl:attribute>
+
+   <xsl:value-of select="$newline" />
+   <h1 id="title"><xsl:value-of select="/gamebook/meta/title[1]" /></h1><xsl:value-of select="$newline" />
+   <div id="body"><xsl:value-of select="$newline" />
+
+    <div class="frontmatter"><xsl:value-of select="$newline" />
+
+     <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
+     <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
+
+     <hr />
+
+     <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
+
+     <p>
+      <xsl:text>Publication Date: </xsl:text>
+      <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
+      <xsl:text> </xsl:text>
+      <xsl:choose>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
+        <xsl:text>January</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
+        <xsl:text>February</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
+        <xsl:text>March</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
+        <xsl:text>April</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
+        <xsl:text>May</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
+        <xsl:text>June</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
+        <xsl:text>July</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
+        <xsl:text>August</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
+        <xsl:text>September</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
+        <xsl:text>October</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
+        <xsl:text>November</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
+        <xsl:text>December</xsl:text>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>Invalid Month</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
+     </p>
+
+     <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
+     <xsl:value-of select="$newline" />
+
+     <xsl:apply-templates select="data/section[@class='frontmatter']" />
+
+    </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    <div class="mainmatter"><xsl:value-of select="$newline" />
+     <xsl:apply-templates select="/gamebook/section/data/section[@class='mainmatter']" />
+     <xsl:apply-templates select="/gamebook/section/data/section[@class='glossary']" />
+    </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    <div class="numbered"><xsl:value-of select="$newline" />
+     <xsl:apply-templates select="/gamebook/section/data/section[@class='numbered']" />
+    </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    <div class="backmatter"><xsl:value-of select="$newline" />
+     <xsl:apply-templates select="/gamebook/section/data/section[@class='backmatter']" />
+    </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    <div id="footnotes">
+     <h2>Footnotes</h2><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+     <xsl:for-each select="//footnote">
+      <xsl:variable name="footnote-idref" select="@idref" />
+      <xsl:variable name="footnote-id" select="@id" />
+      <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
+      <xsl:for-each select="*">
+       <xsl:choose>
+        <xsl:when test="preceding-sibling::node( )">
+         <xsl:apply-templates select="." />
+        </xsl:when>
+        <xsl:otherwise>
+         <p>
+          <xsl:text>[</xsl:text>
+           <a href="#{$footnote-idref}" name="{$footnote-id}"><xsl:value-of select="$footnote-marker" /></a>
+          <xsl:text>] </xsl:text>
+          <xsl:apply-templates select="child::node()" />
+         </p>
+        </xsl:otherwise>
+       </xsl:choose>
+      </xsl:for-each>
+     </xsl:for-each>
+    </div><xsl:value-of select="$newline" />
+
+   </div><xsl:value-of select="$newline" />
+  </body>
+
+  <xsl:value-of select="$newline" />
+  <xsl:value-of select="$newline" />
+
+ </html>
+</xsl:template>
+
+<xsl:template match="/gamebook/section[@id='toc']" />
+
+<!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
+ <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h2><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: third-level frontmatter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter' or @class='frontmatter-separate']">
+ <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h3><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: fourth-level frontmatter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h4><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level frontmatter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h5><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ::::::::::: second-level main matter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
+ <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h2><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: third-level main matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter' or @class='mainmatter-separate']">
+ <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h3><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h4><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h5><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h5><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: second-level glossary sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='glossary']">
+ <xsl:variable name="glossary-id-prefix"><xsl:text>topics</xsl:text></xsl:variable>
+ <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h2><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: third-level glossary sections ::::::::::::: -->
+<!-- glossary sections should be enclosed in a second level glossary section -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
+ <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h3><xsl:value-of select="$newline" />
+ <xsl:call-template name="alpha-bar">
+  <xsl:with-param name="alpha-bar-id-prefix">topics</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']">
+ <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h2><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='numbered']">
+ <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h3><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='backmatter']">
+ <h2><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h2><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
+ <h3><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h3><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
+ <h4><a><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute><xsl:value-of select="meta/title" /></a></h4><xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+ <xsl:apply-templates />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== block elements ======================== -->
+
+<xsl:template match="p">
+ <p><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="p[@class='dedication']">
+ <p class="dedication"><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl[@class='paragraphed']/dd/node() | ol[@class='paragraphed']/li/node() | ul[@class='paragraphed']/li/node()">
+ <xsl:choose>
+  <xsl:when test="self::p">
+   <xsl:apply-templates /><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::dl">
+   <dl><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </dl><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ol">
+   <ol><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ol><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ul">
+   <ul>
+    <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+    <xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ul><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::blockquote">
+   <blockquote><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </blockquote><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::illustration" />
+  <xsl:otherwise>
+   <xsl:text>[error: paragraphed list template]</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="ol">
+ <ol><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ol><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="ul">
+ <ul>
+  <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+  <xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ul><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl">
+ <dl><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </dl><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dt">
+ <dt><xsl:apply-templates /></dt>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dd">
+ <dd><xsl:apply-templates /></dd>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="li">
+ <li><xsl:apply-templates /></li>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="table">
+ <table border="1" cellspacing="0" cellpadding="2">
+  <xsl:apply-templates />
+ </table>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="tr">
+ <tr>
+  <xsl:apply-templates />
+ </tr>
+</xsl:template>
+
+<xsl:template match="th">
+ <th>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </th>
+</xsl:template>
+
+<xsl:template match="td">
+ <td>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </td>
+</xsl:template>
+
+<xsl:template match="combat">
+ <p class="combat">
+  <xsl:apply-templates select="enemy" />
+  <xsl:text>: </xsl:text>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='combatskill']">
+    <span class="smallcaps">COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='combatskill']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='closecombatskill']">
+    <span class="smallcaps">CLOSE<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
+   </xsl:when>
+  </xsl:choose>
+  <xsl:text disable-output-escaping="yes"> &amp;nbsp;&amp;nbsp;</xsl:text>
+  <span class="smallcaps">ENDURANCE</span>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='target']">
+    <xsl:text> (</xsl:text><span class="smallcaps">TARGET</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='target']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='resistance']">
+    <xsl:text> (</xsl:text><span class="smallcaps">RESISTANCE</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='resistance']" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='endurance']" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="choice">
+ <xsl:variable name="link">
+  <xsl:value-of select="@idref" />
+ </xsl:variable>
+
+ <p class="choice">
+  <xsl:for-each select="* | text()">
+   <xsl:choose>
+    <xsl:when test="self::link-text">
+     <a href="#{$link}">
+      <xsl:apply-templates />
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="." />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:for-each>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="signpost">
+ <div class="signpost">
+  <xsl:apply-templates />
+ </div>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="blockquote">
+ <blockquote><xsl:value-of select="$newline" />
+  <xsl:apply-templates /><xsl:value-of select="$newline" />
+ </blockquote><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="illustration" />
+
+<xsl:template match="instance" />
+
+<xsl:template match="footnotes" />
+
+<xsl:template match="footnote" />
+
+<xsl:template match="hr">
+ <hr />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== inline elements ======================= -->
+
+<xsl:template match="a">
+ <xsl:choose>
+  <xsl:when test="@href">
+   <a>
+    <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
+    <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <a>
+    <xsl:if test="@idref">
+     <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@id">
+     <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
+    </xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="a[@class='footnote']">
+ <xsl:apply-templates />
+ <sup>
+  <a>
+   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
+   <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
+   <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
+  </a>
+ </sup>
+</xsl:template>
+
+<xsl:template match="em">
+ <em><xsl:apply-templates /></em>
+</xsl:template>
+
+<xsl:template match="strong">
+ <strong><xsl:apply-templates /></strong>
+</xsl:template>
+
+<xsl:template match="thought">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="onomatopoeia">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="spell">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="item">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="foreign">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>&apos;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&apos;</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote//quote">
+ <xsl:text>&quot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&quot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="cite">
+ <cite><xsl:apply-templates /></cite>
+</xsl:template>
+
+<xsl:template match="code">
+ <tt><xsl:apply-templates /></tt>
+</xsl:template>
+
+<xsl:template match="br">
+ <br />
+</xsl:template>
+
+<xsl:template match="typ[@class='attribute']">
+ <span class="smallcaps"><xsl:apply-templates /></span>
+</xsl:template>
+
+<!-- ==================== named templates ======================= -->
+
+<xsl:template name="alpha-bar">
+ <xsl:param name="alpha-bar-id-prefix"></xsl:param>
+
+  <p class="navigation">[<a href="#{$alpha-bar-id-prefix}a">A</a>&nbsp;<a href="#{$alpha-bar-id-prefix}b">B</a>&nbsp;<a href="#{$alpha-bar-id-prefix}c">C</a>&nbsp;<a href="#{$alpha-bar-id-prefix}d">D</a>&nbsp;<a href="#{$alpha-bar-id-prefix}e">E</a>&nbsp;<a href="#{$alpha-bar-id-prefix}f">F</a>&nbsp;<a href="#{$alpha-bar-id-prefix}g">G</a>&nbsp;<a href="#{$alpha-bar-id-prefix}h">H</a>&nbsp;<a href="#{$alpha-bar-id-prefix}i">I</a>&nbsp;<a href="#{$alpha-bar-id-prefix}j">J</a>&nbsp;<a href="#{$alpha-bar-id-prefix}k">K</a>&nbsp;<a href="#{$alpha-bar-id-prefix}l">L</a>&nbsp;<a href="#{$alpha-bar-id-prefix}m">M</a>&nbsp;<a href="#{$alpha-bar-id-prefix}n">N</a>&nbsp;<a href="#{$alpha-bar-id-prefix}o">O</a>&nbsp;<a href="#{$alpha-bar-id-prefix}p">P</a>&nbsp;<a href="#{$alpha-bar-id-prefix}q">Q</a>&nbsp;<a href="#{$alpha-bar-id-prefix}r">R</a>&nbsp;<a href="#{$alpha-bar-id-prefix}s">S</a>&nbsp;<a href="#{$alpha-bar-id-prefix}t">T</a>&nbsp;<a href="#{$alpha-bar-id-prefix}u">U</a>&nbsp;<a href="#{$alpha-bar-id-prefix}v">V</a>&nbsp;<a href="#{$alpha-bar-id-prefix}w">W</a>&nbsp;<a href="#{$alpha-bar-id-prefix}x">X</a>&nbsp;<a href="#{$alpha-bar-id-prefix}y">Y</a>&nbsp;<a href="#{$alpha-bar-id-prefix}z">Z</a>]</p><xsl:value-of select="$newline" />
+
+</xsl:template>
+
+</xsl:transform>
\ No newline at end of file
diff --git a/xml/xhtml.xsl b/xml/xhtml.xsl
new file mode 100644 (file)
index 0000000..468f0c1
--- /dev/null
@@ -0,0 +1,1386 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:transform [
+ <!ENTITY % xhtml.characters SYSTEM "htmlchar.mod">
+ %xhtml.characters;
+]>
+
+<!--
+
+$Id$
+
+$Log$
+Revision 1.1  2005/01/30 01:32:52  jonathan.blake
+Initial freepository revision of XML support documents.
+
+Revision 1.12  2003/10/07 06:05:14  Jon
+Added capability for "accent" illustrations.
+
+Revision 1.11  2002/12/06 22:12:04  jblake
+Added default namespace declaration to transformation element
+and removed all the extraneous declarations in the template
+elements.
+
+Revision 1.10  2002/11/17 22:37:25  jblake
+Removed the "medium" creator entry from the templates.
+Will they be of any use?
+
+Revision 1.9  2002/11/17 05:06:56  jblake
+Rearranged the title page.
+
+Revision 1.8  2002/11/15 19:35:25  jblake
+Fixed "Content-type" of XHTML output.
+
+Revision 1.7  2002/11/15 00:15:39  jblake
+Fixed a problem with the client-side image map and fixed
+the numbered section list generation so that it will work
+for Shadow on the Sand.
+
+Revision 1.6  2002/10/30 05:59:45  jblake
+Added a value for the alt attribute of the ToC image on the navigation bar.
+
+Revision 1.5  2002/10/24 15:53:41  jblake
+Fixed a conflict with whitespace and paragraphed lists.
+
+Revision 1.4  2002/10/24 15:06:51  jblake
+Added xmlns attributes to all elements that are top level in
+their templates. This was an adjustment required by Xalan-J 2.4.
+
+Also reinstated the comment in each document since the new
+version of Xalan redirects it properly.
+
+Revision 1.3  2002/10/23 05:18:29  jblake
+Added the capability to filter which illustrators' work is used.
+This is accomplished by the "use-illustrators" parameter.
+
+Revision 1.2  2002/10/20 06:25:35  jblake
+Added support for CLOSE COMBAT SKILL for Freeway Warrior books.
+
+Revision 1.1  2002/10/15 23:29:51  jblake
+Initial revision
+
+
+20020327 - repurposed to be used with Xalan Java 2
+
+Todo:
+
+* Add blank whitespace handling to the paragraphed list template
+
+-->
+
+<xsl:transform version="1.0"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lxslt="http://xml.apache.org/xslt"
+  xmlns:redirect="org.apache.xalan.lib.Redirect"
+  extension-element-prefixes="redirect">
+
+<xsl:output method="xml"
+            encoding="ISO-8859-1"
+            omit-xml-declaration="yes"
+            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
+
+<xsl:strip-space elements="section data ol ul dl li dd footnotes footnote" />
+<xsl:preserve-space elements="p choice" />
+
+<!-- ====================== parameters ========================== -->
+
+<xsl:param name="book-path"><xsl:text>undefined-book</xsl:text></xsl:param>
+<xsl:param name="use-illustrators" />
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ colors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+<xsl:param name="link-color"><xsl:text>#ff0000</xsl:text></xsl:param>
+<xsl:param name="alink-color"><xsl:value-of select="$link-color" /></xsl:param>
+<xsl:param name="vlink-color"><xsl:value-of select="$link-color" /></xsl:param>
+
+<xsl:param name="text-color"><xsl:text>#000000</xsl:text></xsl:param>
+<xsl:param name="background-color"><xsl:text>#ffffe4</xsl:text></xsl:param>
+
+<!-- ======================= variables ========================== -->
+
+<xsl:variable name="newline">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- ======================== Templates ========================= -->
+
+<!-- ================= hierarchical sections ==================== -->
+
+<xsl:template match="meta" />
+<xsl:template match="section" />
+
+<!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section[@id='title']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">top-level</xsl:with-param>
+  <xsl:with-param name="filename">title</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section[@id='toc']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">toc</xsl:with-param>
+  <xsl:with-param name="filename">toc</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::: second-level frontmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='frontmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-frontmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level front matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-frontmatter-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level front matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='frontmatter']">
+ <h5><xsl:value-of select="meta/title[1]" /></h5>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::: second-level main matter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='mainmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-mainmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level main matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='mainmatter-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-mainmatter-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: fourth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fifth-level main matter sections :::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section/data/section[@class='mainmatter']">
+ <h5><xsl:value-of select="meta/title[1]" /></h5>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- :::::::::::: second-level glossary sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='glossary']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-glossary</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+  <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: third-level glossary sections ::::::::::::: -->
+<!-- glossary sections should be enclosed in a second level glossary section -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='glossary-separate']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-glossary-separate</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+  <xsl:with-param name="glossary-id-prefix">topics</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::::::::: numbered sections ::::::::::::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='numbered']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-numbered</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='numbered']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">third-level-numbered</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- :::::::::::: second-level backmatter sections :::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section[@class='backmatter']">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">second-level-backmatter</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- ::::::::::::: third-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section[@class='backmatter']">
+ <h3><xsl:value-of select="meta/title[1]" /></h3>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::: fourth-level back matter sections ::::::::::::: -->
+
+<xsl:template match="/gamebook/section/data/section/data/section/data/section[@class='backmatter']">
+ <h4><xsl:value-of select="meta/title[1]" /></h4>
+
+ <xsl:value-of select="$newline" />
+ <xsl:value-of select="$newline" />
+
+ <xsl:apply-templates />
+</xsl:template>
+
+<!-- ::::::::::::::::::::: map template ::::::::::::::::::::::::: -->
+
+<xsl:template match="id( 'map' )">
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">map-adjusted</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /></xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="xhtml-wrapper">
+  <xsl:with-param name="document-type">map</xsl:with-param>
+  <xsl:with-param name="filename"><xsl:value-of select="@id" /><xsl:text>large</xsl:text></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- ==================== block elements ======================== -->
+
+<xsl:template match="p">
+ <p><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="p[@class='dedication']">
+ <p class="dedication"><xsl:apply-templates /></p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl[@class='paragraphed']/dd/node() | ol[@class='paragraphed']/li/node() | ul[@class='paragraphed']/li/node()">
+ <xsl:choose>
+  <xsl:when test="self::p">
+   <xsl:apply-templates /><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::dl">
+   <dl><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </dl><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ol">
+   <ol><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ol><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::ul">
+   <ul>
+    <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+    <xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </ul><br /><br /><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::blockquote">
+   <blockquote><xsl:value-of select="$newline" />
+    <xsl:apply-templates />
+   </blockquote><xsl:value-of select="$newline" />
+  </xsl:when>
+  <xsl:when test="self::illustration">
+   <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+   <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+   <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+   <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrtpl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtp.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtpr.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrl.gif" width="32" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" border="0" align="middle" alt="[illustration]" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrr.gif" width="32" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrbtl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbt.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbtr.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+     </table><br /><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+   </xsl:if>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:text>[error: paragraphed list template]</xsl:text>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="ol">
+ <ol><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ol><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="ul">
+ <ul>
+  <xsl:if test="self::*[@class='unbulleted']"><xsl:attribute name="class"><xsl:text>unbulleted</xsl:text></xsl:attribute></xsl:if>
+  <xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </ul><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dl">
+ <dl><xsl:value-of select="$newline" />
+  <xsl:apply-templates />
+ </dl><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dt">
+ <dt><xsl:apply-templates /></dt>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="dd">
+ <dd><xsl:apply-templates /></dd>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="li">
+ <li><xsl:apply-templates /></li>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="table">
+ <table border="1" cellspacing="0" cellpadding="2">
+  <xsl:apply-templates />
+ </table>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="tr">
+ <tr>
+  <xsl:apply-templates />
+ </tr>
+</xsl:template>
+
+<xsl:template match="th">
+ <th>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </th>
+</xsl:template>
+
+<xsl:template match="td">
+ <td>
+  <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align" /></xsl:attribute></xsl:if>
+  <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute></xsl:if>
+  <xsl:if test="@char"><xsl:attribute name="char"><xsl:value-of select="@char" /></xsl:attribute></xsl:if>
+  <xsl:apply-templates />
+ </td>
+</xsl:template>
+
+<xsl:template match="combat">
+ <p class="combat">
+  <xsl:apply-templates select="enemy" />
+  <xsl:text>: </xsl:text>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='combatskill']">
+    <span class="smallcaps">COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='combatskill']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='closecombatskill']">
+    <span class="smallcaps">CLOSE<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>COMBAT<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>SKILL</span>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='closecombatskill']" />
+   </xsl:when>
+  </xsl:choose>
+  <xsl:text disable-output-escaping="yes"> &amp;nbsp;&amp;nbsp;</xsl:text>
+  <span class="smallcaps">ENDURANCE</span>
+  <xsl:choose>
+   <xsl:when test="enemy-attribute[@class='target']">
+    <xsl:text> (</xsl:text><span class="smallcaps">TARGET</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='target']" />
+   </xsl:when>
+   <xsl:when test="enemy-attribute[@class='resistance']">
+    <xsl:text> (</xsl:text><span class="smallcaps">RESISTANCE</span><xsl:text> points)</xsl:text>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='resistance']" />
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
+    <xsl:value-of select="enemy-attribute[@class='endurance']" />
+   </xsl:otherwise>
+  </xsl:choose>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="choice">
+ <xsl:variable name="link">
+  <xsl:value-of select="@idref" />
+ </xsl:variable>
+
+ <p class="choice">
+  <xsl:for-each select="* | text()">
+   <xsl:choose>
+    <xsl:when test="self::link-text">
+     <a href="{$link}.htm">
+      <xsl:apply-templates />
+     </a>
+    </xsl:when>
+    <xsl:otherwise>
+     <xsl:apply-templates select="." />
+    </xsl:otherwise>
+   </xsl:choose>
+  </xsl:for-each>
+ </p>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="signpost">
+ <div class="signpost">
+  <xsl:apply-templates />
+ </div>
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="blockquote">
+ <blockquote><xsl:value-of select="$newline" />
+  <xsl:apply-templates /><xsl:value-of select="$newline" />
+ </blockquote><xsl:value-of select="$newline" />
+</xsl:template>
+
+<xsl:template match="illustration">
+ <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+ <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+ <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+ <xsl:variable name="illustration-width-adjusted"><xsl:number value="$illustration-width div 2" /></xsl:variable>
+ <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height div 2" /></xsl:variable>
+
+ <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+  <xsl:choose>
+   <xsl:when test="@class='float'">
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrtpl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtp.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtpr.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrl.gif" width="32" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+        <td>
+        <a>
+         <xsl:attribute name="href"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="1" /><xsl:text>.htm</xsl:text></xsl:attribute>
+         <img src="{$illustration-src}" width="{$illustration-width-adjusted}" height="{$illustration-height-adjusted}" border="0" align="middle" alt="[illustration]" />
+        </a>
+       </td><xsl:value-of select="$newline" />
+       <td><img src="brdrr.gif" width="32" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrbtl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbt.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbtr.gif" width="32" height="32" align="middle" alt=""/></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+     </table><br /><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+
+    <xsl:call-template name="xhtml-wrapper">
+     <xsl:with-param name="document-type">illustration</xsl:with-param>
+     <xsl:with-param name="filename"><xsl:text>ill</xsl:text><xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) ) ]" from="/" level="any" format="1" /></xsl:with-param>
+    </xsl:call-template>
+   </xsl:when>
+
+   <xsl:when test="@class='accent'" />
+
+   <xsl:otherwise>
+    <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+     <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrtpl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtp.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrtpr.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrl.gif" width="32" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" border="0" align="middle" alt="[illustration]" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrr.gif" width="32" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+      <tr><xsl:value-of select="$newline" />
+       <td><img src="brdrbtl.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbt.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+       <td><img src="brdrbtr.gif" width="32" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+      </tr><xsl:value-of select="$newline" />
+     </table><br /><xsl:value-of select="$newline" />
+    </div></div><xsl:value-of select="$newline" />
+   </xsl:otherwise>
+  </xsl:choose>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="instance" />
+
+<xsl:template match="footnotes" />
+
+<xsl:template match="footnote" />
+
+<xsl:template match="hr">
+ <hr />
+ <xsl:value-of select="$newline" />
+</xsl:template>
+
+<!-- ==================== inline elements ======================= -->
+
+<xsl:template match="a">
+ <xsl:choose>
+  <xsl:when test="@href">
+   <a>
+    <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
+    <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:when>
+  <xsl:otherwise>
+   <a>
+    <xsl:if test="@idref">
+     <xsl:variable name="my-idref" select="@idref" />
+     <xsl:attribute name="href">
+      <xsl:choose>
+       <!-- The order of these tests is deliberate. They are ordered roughly from most to least specific. -->
+       <xsl:when test="/gamebook/section[@id=$my-idref] | /gamebook/section/data/section[@id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='numbered' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and @id=$my-idref]">
+        <xsl:value-of select="$my-idref" /><xsl:text>.htm</xsl:text>
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='frontmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='mainmatter-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section/data/section[@class='glossary-separate' and descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:when test="/gamebook/section/data/section[descendant::*[@id=$my-idref]]">
+        <xsl:value-of select="/gamebook/section/data/section[descendant::*[@id=$my-idref]]/@id" /><xsl:text>.htm#</xsl:text><xsl:value-of select="$my-idref" />
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>[error: a template]</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute></xsl:if>
+    <xsl:apply-templates />
+   </a>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="a[@class='footnote']">
+ <xsl:apply-templates />
+ <sup>
+  <a>
+   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@idref" /></xsl:attribute>
+   <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
+   <xsl:number count="a[@class='footnote']" from="/" level="any" format="1" />
+  </a>
+ </sup>
+</xsl:template>
+
+<xsl:template match="a[@class='accent-illustration']">
+ <xsl:for-each select="id( @idref )">
+  <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+  <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+  <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+  <xsl:if test="instance[@class='html'] and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+   <img src="{$illustration-src}" class="accent" width="{$illustration-width}" height="{$illustration-height}" alt="" border="" align="left" />
+  </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="em">
+ <em><xsl:apply-templates /></em>
+</xsl:template>
+
+<xsl:template match="strong">
+ <strong><xsl:apply-templates /></strong>
+</xsl:template>
+
+<xsl:template match="thought">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="onomatopoeia">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="spell">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="item">
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="foreign">
+ <i><xsl:apply-templates /></i>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>&apos;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&apos;</xsl:text>
+</xsl:template>
+
+<xsl:template match="quote//quote">
+ <xsl:text>&quot;</xsl:text>
+  <xsl:apply-templates />
+ <xsl:text>&quot;</xsl:text>
+</xsl:template>
+
+<xsl:template match="cite">
+ <cite><xsl:apply-templates /></cite>
+</xsl:template>
+
+<xsl:template match="code">
+ <tt><xsl:apply-templates /></tt>
+</xsl:template>
+
+<xsl:template match="br">
+ <br />
+</xsl:template>
+
+<xsl:template match="typ[@class='attribute']">
+ <span class="smallcaps"><xsl:apply-templates /></span>
+</xsl:template>
+
+<!-- ==================== named templates ======================= -->
+
+<xsl:template name="xhtml-wrapper">
+ <xsl:param name="document-type">undefined</xsl:param>
+ <xsl:param name="filename">undefined</xsl:param>
+ <xsl:param name="glossary-id-prefix"></xsl:param>
+
+<!-- <redirect:write file="{$book-path}/{$filename}.htm">-->
+ <redirect:write file="{$filename}.htm">
+  <xsl:fallback>
+   <xsl:text>xhtml-wrapper: Cannot write to filename: "</xsl:text>
+   <xsl:value-of select="$filename" /><xsl:text>.htm"</xsl:text>
+  </xsl:fallback>
+
+  <html xml:lang="en-UK" lang="en-UK">
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+   <head><xsl:value-of select="$newline" />
+    <title>
+     <xsl:value-of select="/gamebook/meta/title[1]" />
+     <xsl:text>: </xsl:text>
+     <xsl:choose>
+      <xsl:when test="$document-type='illustration'">
+       <xsl:text>Illustration </xsl:text>
+       <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
+      </xsl:when>
+      <xsl:otherwise><xsl:value-of select="meta/title[1]" /></xsl:otherwise>
+     </xsl:choose>
+    </title><xsl:value-of select="$newline" />
+    <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" /><xsl:value-of select="$newline" />
+    <meta name="robots" content="noindex,nofollow" /><xsl:value-of select="$newline" />
+    <link rel="stylesheet" href="main.css" type="text/css" /><xsl:value-of select="$newline" />
+   </head>
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+   <xsl:comment>
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" />
+    <xsl:text> Published by </xsl:text>
+    <xsl:apply-templates select="/gamebook/meta/publisher[1]" />
+    <xsl:text>. </xsl:text>
+   </xsl:comment>
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+   <body>
+    <xsl:attribute name="text"><xsl:value-of select="$text-color" /></xsl:attribute>
+    <xsl:attribute name="bgcolor"><xsl:value-of select="$background-color" /></xsl:attribute>
+    <xsl:attribute name="background"><xsl:text>bckgrnd.gif</xsl:text></xsl:attribute>
+    <xsl:attribute name="link"><xsl:value-of select="$link-color" /></xsl:attribute>
+    <xsl:attribute name="alink"><xsl:value-of select="$alink-color" /></xsl:attribute>
+    <xsl:attribute name="vlink"><xsl:value-of select="$vlink-color" /></xsl:attribute>
+
+    <xsl:value-of select="$newline" />
+    <div id="title"><img src="title.gif" width="550" height="100" border="0" align="middle" usemap="#imagemap"><xsl:attribute name="alt"><xsl:value-of select="/gamebook/meta/title[1]" /></xsl:attribute></img></div><xsl:value-of select="$newline" />
+    <div id="body"><xsl:value-of select="$newline" />
+
+     <xsl:choose>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ top-level ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='top-level'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+
+        <xsl:apply-templates select="/gamebook/meta/description[@class='blurb']" />
+        <xsl:apply-templates select="/gamebook/meta/creator[@class='long']" />
+
+        <hr />
+
+        <xsl:apply-templates select="/gamebook/meta/description[@class='publication']" />
+
+        <p>
+         <xsl:text>Publication Date: </xsl:text>
+         <xsl:value-of select="/gamebook/meta/date[@class='publication']/day" />
+         <xsl:text> </xsl:text>
+         <xsl:choose>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 1">
+           <xsl:text>January</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 2">
+           <xsl:text>February</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 3">
+           <xsl:text>March</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 4">
+           <xsl:text>April</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 5">
+           <xsl:text>May</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 6">
+           <xsl:text>June</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 7">
+           <xsl:text>July</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 8">
+           <xsl:text>August</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 9">
+           <xsl:text>September</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 10">
+           <xsl:text>October</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 11">
+           <xsl:text>November</xsl:text>
+          </xsl:when>
+          <xsl:when test="/gamebook/meta/date[@class='publication']/month = 12">
+           <xsl:text>December</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>Invalid Month</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> </xsl:text>
+         <xsl:value-of select="/gamebook/meta/date[@class='publication']/year" />
+        </p>
+
+        <xsl:apply-templates select="/gamebook/meta/rights[@class='license-notification']" />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ toc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='toc'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2>Table of Contents</h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <ul><xsl:value-of select="$newline" />
+         <li><a href="title.htm">Title Page</a></li><xsl:value-of select="$newline" />
+         <xsl:for-each select="/gamebook/section/data/section">
+          <li>
+           <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+            <xsl:value-of select="meta/title[1]" />
+           </a>
+           <xsl:if test="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
+            <xsl:value-of select="$newline" />
+            <ul><xsl:value-of select="$newline" />
+             <xsl:for-each select="data/section[@class='frontmatter-separate' or @class='mainmatter-separate']">
+              <li>
+               <a><xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+                <xsl:value-of select ="meta/title[1]" />
+               </a>
+              </li><xsl:value-of select="$newline" />
+             </xsl:for-each>
+            </ul><xsl:value-of select="$newline" />
+           </xsl:if>
+          </li><xsl:value-of select="$newline" />
+         </xsl:for-each>
+        </ul><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+        <xsl:call-template name="navigation-bar" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-frontmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-frontmatter'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-frontmatter-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-frontmatter-separate'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-mainmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-mainmatter'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-mainmatter-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-mainmatter-separate'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~ second-level-glossary ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-glossary'">
+       <div class="mainmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="alpha-bar">
+         <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:call-template name="navigation-bar" />
+
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~ third-level-glossary-separate ~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-glossary-separate'">
+       <div class="glossary"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:call-template name="alpha-bar">
+         <xsl:with-param name="alpha-bar-id-prefix"><xsl:value-of select="$glossary-id-prefix" /></xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~ second-level-numbered ~~~~~~~~~~~~~~~~~~~~ -->
+<!--
+
+The following automatically generated section list requires that the
+title of each section be a simple number.
+
+-->
+      <xsl:when test="$document-type='second-level-numbered'">
+       <div class="numbered"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:variable name="base-section-number" select="number( data/section[1]/meta/title ) - 1" />
+        <p>
+         <xsl:for-each select="data/section">
+          <xsl:if test="position( ) mod 10 = 1">
+           <b><a><xsl:attribute name="name"><xsl:value-of select="position( ) + $base-section-number" /></xsl:attribute>
+            <xsl:value-of select="position( ) + $base-section-number" />
+            <xsl:if test="not( position( ) = last( ) )">
+             <xsl:text>-</xsl:text>
+             <xsl:choose>
+              <xsl:when test="position( ) + 9 &lt;= last( )">
+               <xsl:value-of select="position( ) + 9 + $base-section-number" />
+              </xsl:when>
+              <xsl:otherwise>
+               <xsl:value-of select="last( ) + $base-section-number" />
+              </xsl:otherwise>
+             </xsl:choose>
+            </xsl:if>
+           </a><xsl:text>: </xsl:text></b>
+          </xsl:if>
+          <a>
+           <xsl:attribute name="href"><xsl:value-of select="@id" /><xsl:text>.htm</xsl:text></xsl:attribute>
+           <xsl:value-of select="meta/title" />
+          </a>
+          <xsl:choose>
+           <xsl:when test="position( ) mod 10 = 0">
+            <br /><xsl:value-of select="$newline" />
+           </xsl:when>
+           <xsl:otherwise>
+            <xsl:text> </xsl:text>
+           </xsl:otherwise>
+          </xsl:choose>
+         </xsl:for-each>
+        </p>
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~ third-level-numbered ~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='third-level-numbered'">
+       <div class="numbered"><xsl:value-of select="$newline" />
+        <h3><xsl:value-of select="meta/title" /></h3><xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~ second-level-backmatter ~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='second-level-backmatter'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:apply-templates />
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~ map-adjusted ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='map-adjusted'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:for-each select="data/* | data/text()">
+         <xsl:choose>
+          <xsl:when test="self::illustration and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+           <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+           <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+           <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+           <xsl:variable name="illustration-width-adjusted"><xsl:number value="386" /></xsl:variable>
+           <xsl:variable name="illustration-height-adjusted"><xsl:number value="$illustration-height * $illustration-width-adjusted div $illustration-width" /></xsl:variable>
+
+           <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+            <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrtpl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtp.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtpr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrl.gif" width="31" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><a href="maplarge.htm"><img src="{$illustration-src}" width="{$illustration-width-adjusted}" height="{$illustration-height-adjusted}" align="middle" border="0" alt="[map]" /></a></td><xsl:value-of select="$newline" />
+              <td><img src="brdrr.gif" width="33" height="{$illustration-height-adjusted}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrbtl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbt.gif" width="{$illustration-width-adjusted}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbtr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+            </table><xsl:value-of select="$newline" />
+            <br /><br />
+           </div></div><xsl:value-of select="$newline" />
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:apply-templates select="." />
+          </xsl:otherwise>
+         </xsl:choose>
+        </xsl:for-each>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ map ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='map'">
+       <div class="frontmatter"><xsl:value-of select="$newline" />
+        <h2><xsl:value-of select="meta/title" /></h2><xsl:value-of select="$newline" />
+
+        <xsl:value-of select="$newline" />
+        <xsl:value-of select="$newline" />
+
+        <xsl:for-each select="data/* | data/text()">
+         <xsl:choose>
+          <xsl:when test="self::illustration and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )">
+           <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+           <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+           <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+           <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+            <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrtpl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtp.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrtpr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrl.gif" width="31"  height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><a href="map.htm"><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[map]" /></a></td><xsl:value-of select="$newline" />
+              <td><img src="brdrr.gif" width="33" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+             <tr><xsl:value-of select="$newline" />
+              <td><img src="brdrbtl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbt.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+              <td><img src="brdrbtr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+             </tr><xsl:value-of select="$newline" />
+            </table><br /><xsl:value-of select="$newline" />
+           </div></div><xsl:value-of select="$newline" />
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:apply-templates select="." />
+          </xsl:otherwise>
+         </xsl:choose>
+        </xsl:for-each>
+
+        <xsl:value-of select="$newline" />
+
+        <xsl:call-template name="navigation-bar" />
+        <xsl:value-of select="$newline" />
+       </div>
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~ illustration ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:when test="$document-type='illustration'">
+       <xsl:variable name="illustration-width" select="instance[@class='html']/@width" />
+       <xsl:variable name="illustration-height" select="instance[@class='html']/@height" />
+       <xsl:variable name="illustration-src" select="instance[@class='html']/@src" />
+
+       <h3>
+        <xsl:text>Illustration </xsl:text>
+        <xsl:number count="illustration[@class='float' and contains( $use-illustrators, concat( ':', meta/creator, ':' ) )]" from="/" level="any" format="I" />
+       </h3><xsl:value-of select="$newline" />
+
+       <div class="illustration"><div align="center"><xsl:value-of select="$newline" />
+        <table border="0" cellpadding="0" cellspacing="0"><xsl:value-of select="$newline" />
+         <tr><xsl:value-of select="$newline" />
+          <td><img src="brdrtpl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+          <td><img src="brdrtp.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+          <td><img src="brdrtpr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+         </tr><xsl:value-of select="$newline" />
+         <tr><xsl:value-of select="$newline" />
+          <td><img src="brdrl.gif" width="31" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+          <td><img src="{$illustration-src}" width="{$illustration-width}" height="{$illustration-height}" align="middle" border="0" alt="[illustration]" /></td><xsl:value-of select="$newline" />
+          <td><img src="brdrr.gif" width="33" height="{$illustration-height}" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+         </tr><xsl:value-of select="$newline" />
+         <tr><xsl:value-of select="$newline" />
+          <td><img src="brdrbtl.gif" width="31" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+          <td><img src="brdrbt.gif" width="{$illustration-width}" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+          <td><img src="brdrbtr.gif" width="33" height="32" align="middle" alt="" /></td><xsl:value-of select="$newline" />
+         </tr><xsl:value-of select="$newline" />
+        </table><br /><xsl:value-of select="$newline" />
+       </div></div><xsl:value-of select="$newline" />
+       <p class="caption"><strong><xsl:apply-templates select="meta/description" /></strong></p><xsl:value-of select="$newline" />
+      </xsl:when>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+      <xsl:otherwise>
+       <xsl:message>
+        <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
+        <xsl:value-of select="$document-type" />
+        <xsl:text>".</xsl:text>
+       </xsl:message>
+       <p>
+        <xsl:text>xhtml-wrapper: Cannot process document of type "</xsl:text>
+        <xsl:value-of select="$document-type" />
+        <xsl:text>".</xsl:text>
+       </p>
+      </xsl:otherwise>
+
+     </xsl:choose>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+     <xsl:call-template name="process-footnotes" />
+
+     <p class="copyright"><xsl:apply-templates select="/gamebook/meta/rights[@class='copyrights']" /></p><xsl:value-of select="$newline" /><xsl:value-of select="$newline" />
+
+    </div><xsl:value-of select="$newline" />
+
+    <map name="imagemap" id="imagemap">
+     <area shape="rect" coords="0,0,99,99" href="http://www.projectaon.org/" alt="Project Aon" target="_top" />
+     <area shape="default" href="title.htm">
+      <xsl:attribute name="alt"><xsl:value-of select="/gamebook/meta/title[1]" /></xsl:attribute>
+     </area>
+    </map>
+
+   </body>
+
+   <xsl:value-of select="$newline" />
+   <xsl:value-of select="$newline" />
+
+  </html>
+ </redirect:write>
+
+</xsl:template>
+
+<xsl:template name="process-footnotes">
+ <xsl:if test="footnotes/footnote">
+  <div id="footnotes"><xsl:value-of select="$newline" />
+   <xsl:for-each select="footnotes/footnote">
+    <xsl:variable name="footnote-idref" select="@idref" />
+    <xsl:variable name="footnote-id" select="@id" />
+    <xsl:variable name="footnote-marker"><xsl:number count="footnotes/footnote" from="/" level="any" format="1" /></xsl:variable>
+
+    <xsl:for-each select="*[1]">
+     <p>
+      <xsl:text>[</xsl:text>
+       <a href="#{$footnote-idref}" name="{$footnote-id}"><xsl:value-of select="$footnote-marker" /></a>
+      <xsl:text>] </xsl:text>
+      <xsl:apply-templates select="child::* | child::text()" />
+     </p>
+    </xsl:for-each>
+
+    <xsl:for-each select="*[position() != 1]">
+      <xsl:apply-templates select="." />
+    </xsl:for-each>
+   </xsl:for-each>
+  </div><xsl:value-of select="$newline" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="navigation-bar">
+ <div class="navigation">
+  <table cellspacing="0" cellpadding="0" border="0">
+   <tr>
+    <td>
+     <xsl:choose>
+      <xsl:when test="meta/link[@class='prev']">
+       <a>
+        <xsl:attribute name="href">
+         <xsl:value-of select="meta/link[@class='prev']/@idref" />
+         <xsl:text>.htm</xsl:text>
+        </xsl:attribute>
+        <img src="back.gif" width="150" height="30" border="0">
+         <xsl:attribute name="alt">
+          <xsl:value-of select="id( meta/link[@class='prev']/@idref )/meta/title" />
+         </xsl:attribute>
+        </img>
+       </a>
+      </xsl:when>
+      <xsl:otherwise>
+       <img src="left.gif" width="150" height="30" border="0" alt="" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </td>
+    <td><a href="toc.htm"><img src="toc.gif" width="150" height="30" border="0" alt="Table of Contents" /></a></td>
+    <td>
+     <xsl:choose>
+      <xsl:when test="meta/link[@class='next']">
+       <a>
+        <xsl:attribute name="href">
+         <xsl:value-of select="meta/link[@class='next']/@idref" />
+         <xsl:text>.htm</xsl:text>
+        </xsl:attribute>
+        <img src="forward.gif" width="150" height="30" border="0">
+         <xsl:attribute name="alt">
+          <xsl:choose>
+           <xsl:when test="meta/link[@class='next']/@idref = 'sect1'">
+            <xsl:text>Section 1</xsl:text>
+           </xsl:when>
+           <xsl:otherwise>
+            <xsl:value-of select="id( meta/link[@class='next']/@idref )/meta/title" />
+           </xsl:otherwise>
+          </xsl:choose>
+         </xsl:attribute>
+        </img>
+       </a>
+      </xsl:when>
+      <xsl:otherwise>
+       <img src="right.gif" width="150" height="30" border="0" alt="" />
+      </xsl:otherwise>
+     </xsl:choose>
+    </td>
+   </tr>
+  </table>
+ </div>
+</xsl:template>
+
+<xsl:template name="alpha-bar">
+ <xsl:param name="alpha-bar-id-prefix"></xsl:param>
+
+  <p class="navigation">[<a href="{$alpha-bar-id-prefix}a.htm">A</a>&nbsp;<a href="{$alpha-bar-id-prefix}b.htm">B</a>&nbsp;<a href="{$alpha-bar-id-prefix}c.htm">C</a>&nbsp;<a href="{$alpha-bar-id-prefix}d.htm">D</a>&nbsp;<a href="{$alpha-bar-id-prefix}e.htm">E</a>&nbsp;<a href="{$alpha-bar-id-prefix}f.htm">F</a>&nbsp;<a href="{$alpha-bar-id-prefix}g.htm">G</a>&nbsp;<a href="{$alpha-bar-id-prefix}h.htm">H</a>&nbsp;<a href="{$alpha-bar-id-prefix}i.htm">I</a>&nbsp;<a href="{$alpha-bar-id-prefix}j.htm">J</a>&nbsp;<a href="{$alpha-bar-id-prefix}k.htm">K</a>&nbsp;<a href="{$alpha-bar-id-prefix}l.htm">L</a>&nbsp;<a href="{$alpha-bar-id-prefix}m.htm">M</a>&nbsp;<a href="{$alpha-bar-id-prefix}n.htm">N</a>&nbsp;<a href="{$alpha-bar-id-prefix}o.htm">O</a>&nbsp;<a href="{$alpha-bar-id-prefix}p.htm">P</a>&nbsp;<a href="{$alpha-bar-id-prefix}q.htm">Q</a>&nbsp;<a href="{$alpha-bar-id-prefix}r.htm">R</a>&nbsp;<a href="{$alpha-bar-id-prefix}s.htm">S</a>&nbsp;<a href="{$alpha-bar-id-prefix}t.htm">T</a>&nbsp;<a href="{$alpha-bar-id-prefix}u.htm">U</a>&nbsp;<a href="{$alpha-bar-id-prefix}v.htm">V</a>&nbsp;<a href="{$alpha-bar-id-prefix}w.htm">W</a>&nbsp;<a href="{$alpha-bar-id-prefix}x.htm">X</a>&nbsp;<a href="{$alpha-bar-id-prefix}y.htm">Y</a>&nbsp;<a href="{$alpha-bar-id-prefix}z.htm">Z</a>]</p><xsl:value-of select="$newline" />
+
+</xsl:template>
+
+</xsl:transform>