3 <xsl:transform version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
6 <xsl:output method="xml"
8 omit-xml-declaration="yes"/>
9 <xsl:strip-space elements="*" />
11 <!-- ====================== parameters ========================== -->
13 <xsl:param name="toc-id"><xsl:text>toc.ncx</xsl:text></xsl:param>
14 <xsl:param name="addcover" />
16 <!-- ======================== Templates ========================= -->
18 <!-- ================= hierarchical sections ==================== -->
20 <xsl:template match="*" />
22 <xsl:template match="/gamebook">
24 <xsl:attribute name="toc">
25 <xsl:value-of select="$toc-id"/>
28 <xsl:apply-templates select="section[@id='title']"/>
33 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
35 <xsl:template match="/gamebook/section[@id='title']">
36 <itemref idref="title" media-type="application/xhtml+xml"/>
37 <itemref idref="toc" media-type="application/xhtml+xml"/>
38 <itemref idref="coverpage" media-type="application/xhtml+xml"/>
40 <xsl:apply-templates select="data/section"/>
43 <!-- ::::::::::: second-level sections :::::::::::::: -->
45 <xsl:template match="/gamebook/section/data/section">
47 <xsl:attribute name="idref">
48 <xsl:value-of select="@id"/>
50 <xsl:attribute name="media-type">
51 <xsl:text>application/xhtml+xml</xsl:text>
55 <xsl:apply-templates select="data/section"/>
58 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
59 <!-- Put the numbered section list after the numbered sections so
60 the reader doesn't get sent there between the Kai Wisdom page
62 <xsl:apply-templates select="data/section"/>
65 <xsl:attribute name="idref">
66 <xsl:value-of select="@id"/>
68 <xsl:attribute name="media-type">
69 <xsl:text>application/xhtml+xml</xsl:text>
74 <!-- :::::::::::: third-level sections ::::::::::::: -->
76 <xsl:template match="/gamebook/section/data/section/data/section">
77 <xsl:apply-templates select="data/section"/>
80 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate' or @class='mainmatter-separate' or @class='numbered' or @class='glossary-separate']">
82 <xsl:attribute name="idref">
83 <xsl:value-of select="@id"/>
85 <xsl:attribute name="media-type">
86 <xsl:text>application/xhtml+xml</xsl:text>
90 <xsl:apply-templates select="data/section"/>