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>
15 <!-- ======================== Templates ========================= -->
17 <!-- ================= hierarchical sections ==================== -->
19 <xsl:template match="*" />
21 <xsl:template match="/gamebook">
23 <xsl:attribute name="toc">
24 <xsl:value-of select="$toc-id"/>
27 <xsl:apply-templates select="section[@id='title']"/>
32 <!-- ::::::::::::::::::: top-level section :::::::::::::::::::::: -->
34 <xsl:template match="/gamebook/section[@id='title']">
35 <itemref idref="title" media-type="application/xhtml+xml"/>
36 <itemref idref="toc" media-type="application/xhtml+xml"/>
38 <xsl:apply-templates select="data/section"/>
41 <!-- ::::::::::: second-level sections :::::::::::::: -->
43 <xsl:template match="/gamebook/section/data/section">
45 <xsl:attribute name="idref">
46 <xsl:value-of select="@id"/>
48 <xsl:attribute name="media-type">
49 <xsl:text>application/xhtml+xml</xsl:text>
53 <xsl:apply-templates select="data/section"/>
56 <xsl:template match="/gamebook/section/data/section[@class='numbered']">
57 <!-- Put the numbered section list after the numbered sections so
58 the reader doesn't get sent there between the Kai Wisdom page
60 <xsl:apply-templates select="data/section"/>
63 <xsl:attribute name="idref">
64 <xsl:value-of select="@id"/>
66 <xsl:attribute name="media-type">
67 <xsl:text>application/xhtml+xml</xsl:text>
72 <!-- :::::::::::: third-level sections ::::::::::::: -->
74 <xsl:template match="/gamebook/section/data/section/data/section">
75 <xsl:apply-templates select="data/section"/>
78 <xsl:template match="/gamebook/section/data/section/data/section[@class='frontmatter-separate' or @class='mainmatter-separate' or @class='numbered' or @class='glossary-separate']">
80 <xsl:attribute name="idref">
81 <xsl:value-of select="@id"/>
83 <xsl:attribute name="media-type">
84 <xsl:text>application/xhtml+xml</xsl:text>
88 <xsl:apply-templates select="data/section"/>