+++ /dev/null
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
- version="1.0"
- exclude-result-prefixes="doc">
-
-<xsl:import href="docbook.xsl"/>
-<xsl:include href="chunker.xsl"/>
-
-<xsl:output method="xml" indent="yes"/>
-
-<!-- ==================================================================== -->
-<!-- What's a chunk?
-
- appendix
- article
- bibliography in article or book
- book
- chapter
- colophon
- glossary in article or book
- index in article or book
- part
- preface
- refentry
- reference
- sect1 if position()>1
- section if position()>1 && parent != section
- set
- setindex
- -->
-<!-- ==================================================================== -->
-
-<xsl:template name="chunk.info">
- <xsl:param name="node" select="."/>
- <xsl:variable name="id">
- <xsl:choose>
- <xsl:when test="$node/@id">
- <xsl:value-of select="$node/@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
- <xsl:text>Chunk for </xsl:text>
- <xsl:value-of select="local-name($node)"/>
- <xsl:text> has no id</xsl:text>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <chunk name="{local-name($node)}" id="{$id}">
- <xsl:attribute name="filename">
- <xsl:apply-templates select="." mode="chunk-filename-calc"/>
- </xsl:attribute>
- </chunk>
-</xsl:template>
-
-<xsl:template match="set" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="book" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="setindex" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="book" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="book/appendix" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="book/glossary" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="book/bibliography" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="book/index" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="preface|chapter" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="part|reference" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="refentry" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="colophon" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="article" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="article/appendix" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="article/glossary" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="article/bibliography" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="article/index" mode="calculate.chunks">
- <xsl:call-template name="chunk.info"/>
-</xsl:template>
-
-<xsl:template match="sect1
- |/section
- |section[local-name(parent::*) != 'section']"
- mode="calculate.chunks">
- <xsl:choose>
- <xsl:when test=". = /section">
- <xsl:call-template name="chunk.info"/>
- </xsl:when>
- <xsl:when test="$chunk.sections = 0">
- <!-- nop -->
- </xsl:when>
- <xsl:when test="ancestor::partintro">
- <!-- nop -->
- </xsl:when>
- <xsl:when test="$chunk.first.sections = 0">
- <xsl:if test="count(preceding-sibling::section) > 0
- or count(preceding-sibling::sect1) > 0">
- <xsl:call-template name="chunk.info"/>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="chunk.info"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="*" mode="calculate.chunks">
- <xsl:apply-templates select="*" mode="calculate.chunks"/>
-</xsl:template>
-
-<xsl:template match="text()" mode="calculate.chunks">
- <!-- nop -->
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="*" mode="chunk-filename-calc">
- <xsl:param name="recursive" select="false()"/>
- <!-- returns the filename of a chunk -->
-
- <xsl:variable name="dbhtml-filename">
- <xsl:call-template name="dbhtml-filename"/>
- </xsl:variable>
-
- <xsl:variable name="filename">
- <xsl:choose>
- <xsl:when test="$dbhtml-filename != ''">
- <xsl:value-of select="$dbhtml-filename"/>
- </xsl:when>
- <!-- if there's no dbhtml filename, and if we're to use IDs as -->
- <!-- filenames, then use the ID to generate the filename. -->
- <xsl:when test="@id and $use.id.as.filename != 0">
- <xsl:value-of select="@id"/>
- <xsl:value-of select="$html.ext"/>
- </xsl:when>
- <!-- if this is the root element, use the root.filename -->
- <xsl:when test="not(parent::*)">
- <xsl:value-of select="$root.filename"/>
- <xsl:value-of select="$html.ext"/>
- </xsl:when>
- <xsl:otherwise></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="dir">
- <xsl:call-template name="dbhtml-dir"/>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="not($recursive) and $filename != ''">
- <!-- if this chunk has an explicit name, use it -->
- <xsl:if test="$dir != ''">
- <xsl:value-of select="$dir"/>
- <xsl:text>/</xsl:text>
- </xsl:if>
- <xsl:value-of select="$filename"/>
- </xsl:when>
-
- <xsl:when test="name(.)='set'">
- <xsl:value-of select="$root.filename"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='book'">
- <xsl:text>bk</xsl:text>
- <xsl:number level="any" format="01"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='article'">
- <xsl:if test="/set">
- <!-- in a set, make sure we inherit the right book info... -->
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>ar</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='preface'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>pr</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='chapter'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>ch</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='appendix'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>ap</xsl:text>
- <xsl:number level="any" format="a" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='part'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>pt</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='reference'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>rn</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='refentry'">
- <xsl:if test="parent::reference">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>re</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='colophon'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>co</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='sect1' or name(.)='section'">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- <xsl:text>s</xsl:text>
- <xsl:number level="any" format="01" from="preface|chapter|appendix"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='bibliography'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>bi</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='glossary'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>go</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='index'">
- <xsl:if test="/set">
- <xsl:apply-templates mode="chunk-filename-calc" select="parent::*">
- <xsl:with-param name="recursive" select="true()"/>
- </xsl:apply-templates>
- </xsl:if>
- <xsl:text>ix</xsl:text>
- <xsl:number level="any" format="01" from="book"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="name(.)='setindex'">
- <xsl:text>si</xsl:text>
- <xsl:number level="any" format="01" from="set"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:text>chunk-filename-calc-error-</xsl:text>
- <xsl:value-of select="name(.)"/>
- <xsl:number level="any" format="01" from="set"/>
- <xsl:if test="not($recursive)">
- <xsl:value-of select="$html.ext"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="/" priority="-1">
- <xsl:call-template name="write.chunk">
- <xsl:with-param name="filename" select="$chunk.datafile"/>
- <xsl:with-param name="method" select="'xml'"/>
- <xsl:with-param name="encoding" select="'utf-8'"/>
- <xsl:with-param name="indent" select="'yes'"/>
- <xsl:with-param name="content">
- <!-- HACK! -->
- <xsl:text disable-output-escaping="yes">
-<!DOCTYPE chunks [
-<!ELEMENT chunks (chunk+)>
-<!ELEMENT chunk EMPTY>
-<!ATTLIST chunk
- id ID #REQUIRED
- name CDATA #REQUIRED
->
-]>
- </xsl:text>
- <chunks>
- <xsl:apply-templates mode="calculate.chunks"/>
- </chunks>
- </xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
- version="1.0"
- exclude-result-prefixes="doc">
-
-<xsl:import href="docbook.xsl"/>
-
-<!-- ==================================================================== -->
-<!-- What's a chunk?
-
- appendix
- article
- bibliography in article or book
- book
- chapter
- colophon
- glossary in article or book
- index in article or book
- part
- preface
- refentry
- reference
- sect1 if position()>1
- section if position()>1 && parent != section
- set
- setindex
- -->
-<!-- ==================================================================== -->
-
-<xsl:template name="chunk">
- <xsl:param name="node" select="."/>
- <!-- returns 1 if $node is a chunk -->
-
- <xsl:variable name="id">
- <xsl:choose>
- <xsl:when test="$node/@id">
- <xsl:value-of select="$node/@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="generate-id($node)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="chunks" select="document($chunk.datafile,.)"/>
-
- <xsl:choose>
- <xsl:when test="$chunks/chunks/chunk[@id=$id]">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="*" mode="chunk-filename">
- <!-- returns the filename of a chunk -->
-
- <xsl:variable name="id">
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="generate-id(.)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="chunks" select="document($chunk.datafile,.)"/>
- <xsl:variable name="chunk" select="$chunks/chunks/chunk[@id=$id]"/>
-
- <xsl:choose>
- <xsl:when test="$chunk">
- <xsl:value-of select="$chunk/@filename"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="parent::*" mode="chunk-filename"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="href.target">
- <xsl:param name="object" select="."/>
- <xsl:variable name="ischunk">
- <xsl:call-template name="chunk">
- <xsl:with-param name="node" select="$object"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:apply-templates mode="chunk-filename" select="$object"/>
-
- <xsl:if test="$ischunk='0'">
- <xsl:text>#</xsl:text>
- <xsl:call-template name="object.id">
- <xsl:with-param name="object" select="$object"/>
- </xsl:call-template>
- </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="html.head">
- <xsl:param name="prev" select="/foo"/>
- <xsl:param name="next" select="/foo"/>
- <xsl:variable name="home" select="/*[1]"/>
- <xsl:variable name="up" select="parent::*"/>
-
- <head>
- <xsl:call-template name="head.content"/>
- <xsl:call-template name="user.head.content"/>
-
- <xsl:if test="$home">
- <link rel="home">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$home"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:apply-templates select="$home"
- mode="object.title.markup.textonly"/>
- </xsl:attribute>
- </link>
- </xsl:if>
-
- <xsl:if test="$up">
- <link rel="up">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$up"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
- </xsl:attribute>
- </link>
- </xsl:if>
-
- <xsl:if test="$prev">
- <link rel="previous">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$prev"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
- </xsl:attribute>
- </link>
- </xsl:if>
-
- <xsl:if test="$next">
- <link rel="next">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$next"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
- </xsl:attribute>
- </link>
- </xsl:if>
- </head>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="header.navigation">
- <xsl:param name="prev" select="/foo"/>
- <xsl:param name="next" select="/foo"/>
- <xsl:variable name="home" select="/*[1]"/>
- <xsl:variable name="up" select="parent::*"/>
-
- <xsl:if test="$suppress.navigation = '0'">
- <div class="navheader">
- <table width="100%" summary="Navigation header">
- <tr>
- <th colspan="3" align="center">
- <xsl:apply-templates select="." mode="object.title.markup"/>
- </th>
- </tr>
- <tr>
- <td width="20%" align="left">
- <xsl:if test="count($prev)>0">
- <a accesskey="p">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$prev"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-prev</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:if>
- <xsl:text> </xsl:text>
- </td>
- <th width="60%" align="center">
- <xsl:choose>
- <xsl:when test="count($up) > 0 and $up != $home">
- <xsl:apply-templates select="$up" mode="object.title.markup"/>
- </xsl:when>
- <xsl:otherwise> </xsl:otherwise>
- </xsl:choose>
- </th>
- <td width="20%" align="right">
- <xsl:text> </xsl:text>
- <xsl:if test="count($next)>0">
- <a accesskey="n">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$next"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-next</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:if>
- </td>
- </tr>
- </table>
- <hr/>
- </div>
- </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="footer.navigation">
- <xsl:param name="prev" select="/foo"/>
- <xsl:param name="next" select="/foo"/>
- <xsl:variable name="home" select="/*[1]"/>
- <xsl:variable name="up" select="parent::*"/>
-
- <xsl:if test="$suppress.navigation = '0'">
- <div class="navfooter">
- <hr/>
- <table width="100%" summary="Navigation footer">
- <tr>
- <td width="40%" align="left">
- <xsl:if test="count($prev)>0">
- <a accesskey="p">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$prev"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-prev</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:if>
- <xsl:text> </xsl:text>
- </td>
- <td width="20%" align="center">
- <xsl:choose>
- <xsl:when test="$home != .">
- <a accesskey="h">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$home"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-home</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:when>
- <xsl:otherwise> </xsl:otherwise>
- </xsl:choose>
- </td>
- <td width="40%" align="right">
- <xsl:text> </xsl:text>
- <xsl:if test="count($next)>0">
- <a accesskey="n">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$next"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-next</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:if>
- </td>
- </tr>
-
- <tr>
- <td width="40%" align="left">
- <xsl:apply-templates select="$prev" mode="object.title.markup"/>
- <xsl:text> </xsl:text>
- </td>
- <td width="20%" align="center">
- <xsl:choose>
- <xsl:when test="count($up)>0">
- <a accesskey="u">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$up"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="gentext">
- <xsl:with-param name="key">nav-up</xsl:with-param>
- </xsl:call-template>
- </a>
- </xsl:when>
- <xsl:otherwise> </xsl:otherwise>
- </xsl:choose>
- </td>
- <td width="40%" align="right">
- <xsl:text> </xsl:text>
- <xsl:apply-templates select="$next" mode="object.title.markup"/>
- </td>
- </tr>
- </table>
- </div>
- </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="processing-instruction('dbhtml')">
- <!-- nop -->
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="process-chunk">
- <xsl:variable name="id">
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="generate-id(.)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="chunks" select="document($chunk.datafile,.)"/>
-
- <xsl:variable name="chunk" select="$chunks/chunks/chunk[@id=$id]"/>
- <xsl:variable name="prev-id"
- select="$chunk/preceding-sibling::chunk[1]/@id"/>
- <xsl:variable name="next-id"
- select="$chunk/following-sibling::chunk[1]/@id"/>
-
- <xsl:variable name="prev" select="key('id',$prev-id)"/>
- <xsl:variable name="next" select="key('id',$next-id)"/>
-
- <xsl:variable name="ischunk">
- <xsl:call-template name="chunk"/>
- </xsl:variable>
-
- <xsl:variable name="chunkfn">
- <xsl:if test="$ischunk='1'">
- <xsl:apply-templates mode="chunk-filename" select="."/>
- </xsl:if>
- </xsl:variable>
-
- <xsl:if test="$ischunk='0'">
- <xsl:message>
- <xsl:text>Error </xsl:text>
- <xsl:value-of select="name(.)"/>
- <xsl:text> is not a chunk!</xsl:text>
- </xsl:message>
- </xsl:if>
-
- <xsl:variable name="filename">
- <xsl:call-template name="make-relative-filename">
- <xsl:with-param name="base.dir" select="$base.dir"/>
- <xsl:with-param name="base.name" select="$chunkfn"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="write.chunk">
- <xsl:with-param name="filename" select="$filename"/>
- <xsl:with-param name="content">
- <xsl:call-template name="chunk-element-content">
- <xsl:with-param name="prev" select="$prev"/>
- <xsl:with-param name="next" select="$next"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-<xsl:template name="chunk-element-content">
- <xsl:param name="prev"></xsl:param>
- <xsl:param name="next"></xsl:param>
-
- <html>
- <xsl:call-template name="html.head">
- <xsl:with-param name="prev" select="$prev"/>
- <xsl:with-param name="next" select="$next"/>
- </xsl:call-template>
-
- <body>
- <xsl:call-template name="body.attributes"/>
- <xsl:call-template name="user.header.navigation"/>
-
- <xsl:call-template name="header.navigation">
- <xsl:with-param name="prev" select="$prev"/>
- <xsl:with-param name="next" select="$next"/>
- </xsl:call-template>
-
- <xsl:call-template name="user.header.content"/>
-
- <xsl:apply-imports/>
-
- <xsl:call-template name="user.footer.content"/>
-
- <xsl:call-template name="footer.navigation">
- <xsl:with-param name="prev" select="$prev"/>
- <xsl:with-param name="next" select="$next"/>
- </xsl:call-template>
-
- <xsl:call-template name="user.footer.navigation"/>
- </body>
- </html>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="set">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="book">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="book/appendix">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="book/glossary">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="book/bibliography">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="preface|chapter">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="part|reference">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="refentry">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="colophon">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="article">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="article/appendix">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="article/glossary">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="article/bibliography">
- <xsl:call-template name="process-chunk"/>
-</xsl:template>
-
-<xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
- <xsl:variable name="ischunk">
- <xsl:call-template name="chunk"/>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$ischunk != 0">
- <xsl:call-template name="process-chunk"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-imports/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="setindex
- |book/index
- |article/index">
- <!-- some implementations use completely empty index tags to indicate -->
- <!-- where an automatically generated index should be inserted. so -->
- <!-- if the index is completely empty, skip it. -->
- <xsl:if test="count(*)>0 or $generate.index != '0'">
- <xsl:call-template name="process-chunk"/>
- </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="/">
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:choose>
- <xsl:when test="count(key('id',$rootid)) = 0">
- <xsl:message terminate="yes">
- <xsl:text>ID '</xsl:text>
- <xsl:value-of select="$rootid"/>
- <xsl:text>' not found in document.</xsl:text>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="key('id',$rootid)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="/" mode="process.root"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="*" mode="process.root">
- <xsl:apply-templates select="."/>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="in.other.chunk">
- <xsl:param name="chunk" select="."/>
- <xsl:param name="node" select="."/>
-
- <xsl:variable name="is.chunk">
- <xsl:call-template name="chunk">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
-
-<!--
- <xsl:message>
- <xsl:text>in.other.chunk: </xsl:text>
- <xsl:value-of select="name($chunk)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="name($node)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$chunk = $node"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$is.chunk"/>
- </xsl:message>
--->
-
- <xsl:choose>
- <xsl:when test="$chunk = $node">0</xsl:when>
- <xsl:when test="$is.chunk = 1">1</xsl:when>
- <xsl:when test="count($node) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="in.other.chunk">
- <xsl:with-param name="chunk" select="$chunk"/>
- <xsl:with-param name="node" select="$node/parent::*"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="count.footnotes.in.this.chunk">
- <xsl:param name="node" select="."/>
- <xsl:param name="footnotes" select="$node//footnote"/>
- <xsl:param name="count" select="0"/>
-
-<!--
- <xsl:message>
- <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
- <xsl:value-of select="name($node)"/>
- </xsl:message>
--->
-
- <xsl:variable name="in.other.chunk">
- <xsl:call-template name="in.other.chunk">
- <xsl:with-param name="chunk" select="$node"/>
- <xsl:with-param name="node" select="$footnotes[1]"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="count($footnotes) = 0">
- <xsl:value-of select="$count"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$in.other.chunk != 0">
- <xsl:call-template name="count.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- <xsl:with-param name="count" select="$count"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$footnotes[1]/ancestor::table
- |$footnotes[1]/ancestor::informaltable">
- <xsl:call-template name="count.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- <xsl:with-param name="count" select="$count"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="count.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- <xsl:with-param name="count" select="$count + 1"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="process.footnotes.in.this.chunk">
- <xsl:param name="node" select="."/>
- <xsl:param name="footnotes" select="$node//footnote"/>
-
-<!--
- <xsl:message>process.footnotes.in.this.chunk</xsl:message>
--->
-
- <xsl:variable name="in.other.chunk">
- <xsl:call-template name="in.other.chunk">
- <xsl:with-param name="chunk" select="$node"/>
- <xsl:with-param name="node" select="$footnotes[1]"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="count($footnotes) = 0">
- <!-- nop -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$in.other.chunk != 0">
- <xsl:call-template name="process.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$footnotes[1]/ancestor::table
- |$footnotes[1]/ancestor::informaltable">
- <xsl:call-template name="process.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$footnotes[1]"
- mode="process.footnote.mode"/>
- <xsl:call-template name="process.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="footnotes"
- select="$footnotes[position() > 1]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="process.footnotes">
- <xsl:variable name="footnotes" select=".//footnote"/>
- <xsl:variable name="fcount">
- <xsl:call-template name="count.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="footnotes" select="$footnotes"/>
- </xsl:call-template>
- </xsl:variable>
-
-<!--
- <xsl:message>
- <xsl:value-of select="name(.)"/>
- <xsl:text> fcount: </xsl:text>
- <xsl:value-of select="$fcount"/>
- </xsl:message>
--->
-
- <!-- Only bother to do this if there's at least one non-table footnote -->
- <xsl:if test="$fcount > 0">
- <div class="footnotes">
- <br/>
- <hr width="100" align="left"/>
- <xsl:call-template name="process.footnotes.in.this.chunk">
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="footnotes" select="$footnotes"/>
- </xsl:call-template>
- </div>
- </xsl:if>
-</xsl:template>
-
-<xsl:template name="process.chunk.footnotes">
- <xsl:variable name="is.chunk">
- <xsl:call-template name="chunk"/>
- </xsl:variable>
- <xsl:if test="$is.chunk = 1">
- <xsl:call-template name="process.footnotes"/>
- </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-</xsl:stylesheet>