| <?xml version='1.0'?> |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| xmlns:fo="http://www.w3.org/1999/XSL/Format" |
| version='1.0'> |
| |
| <!-- ******************************************************************** |
| $Id: division.xsl,v 1.1 2004/03/01 10:26:06 eelco12 Exp $ |
| ******************************************************************** |
| |
| This file is part of the XSL DocBook Stylesheet distribution. |
| See ../README or http://nwalsh.com/docbook/xsl/ for copyright |
| and other information. |
| |
| ******************************************************************** --> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template name="division.title"> |
| <xsl:param name="node" select="."/> |
| <xsl:variable name="id"> |
| <xsl:call-template name="object.id"> |
| <xsl:with-param name="object" select="$node"/> |
| </xsl:call-template> |
| </xsl:variable> |
| <xsl:variable name="title"> |
| <xsl:apply-templates select="$node" mode="object.title.markup"/> |
| </xsl:variable> |
| |
| <xsl:if test="$passivetex.extensions != 0"> |
| <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex" |
| fotex-bookmark-level="1" |
| fotex-bookmark-label="{$id}"> |
| <xsl:value-of select="$title"/> |
| </fotex:bookmark> |
| </xsl:if> |
| |
| <fo:block keep-with-next.within-column="always" |
| hyphenate="false"> |
| <xsl:copy-of select="$title"/> |
| </fo:block> |
| </xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template match="set"> |
| <xsl:variable name="id"> |
| <xsl:call-template name="object.id"/> |
| </xsl:variable> |
| |
| <xsl:variable name="preamble" |
| select="*[not(self::book or self::setindex)]"/> |
| |
| <xsl:variable name="content" select="book|setindex"/> |
| |
| <xsl:variable name="titlepage-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'titlepage'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:variable name="lot-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'lot'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:if test="$preamble"> |
| <fo:page-sequence id="{$id}" |
| hyphenate="{$hyphenate}" |
| master-reference="{$titlepage-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"/> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="set.titlepage"/> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:variable name="toc.params"> |
| <xsl:call-template name="find.path.params"> |
| <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:if test="contains($toc.params, 'toc')"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="set.toc"/> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:apply-templates select="$content"/> |
| </xsl:template> |
| |
| <xsl:template match="set/setinfo"></xsl:template> |
| <xsl:template match="set/title"></xsl:template> |
| <xsl:template match="set/subtitle"></xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template match="book"> |
| <xsl:variable name="id"> |
| <xsl:call-template name="object.id"/> |
| </xsl:variable> |
| |
| <xsl:variable name="preamble" |
| select="title|subtitle|titleabbrev|bookinfo"/> |
| |
| <xsl:variable name="content" |
| select="*[not(self::title or self::subtitle |
| or self::titleabbrev |
| or self::bookinfo)]"/> |
| |
| <xsl:variable name="titlepage-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'titlepage'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:variable name="lot-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'lot'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:if test="$preamble"> |
| <fo:page-sequence id="{$id}" |
| hyphenate="{$hyphenate}" |
| master-reference="{$titlepage-master-reference}" |
| initial-page-number="1"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"/> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="book.titlepage"/> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:apply-templates select="dedication" mode="dedication"/> |
| |
| <xsl:variable name="toc.params"> |
| <xsl:call-template name="find.path.params"> |
| <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:if test="contains($toc.params, 'toc')"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'TableofContents'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'TableofContents'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="division.toc"/> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:if test="contains($toc.params,'figure') and .//figure"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofFigures'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofFigures'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="list.of.titles"> |
| <xsl:with-param name="titles" select="'figure'"/> |
| <xsl:with-param name="nodes" select=".//figure"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:if test="contains($toc.params,'table') and .//table"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofTables'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofTables'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="list.of.titles"> |
| <xsl:with-param name="titles" select="'table'"/> |
| <xsl:with-param name="nodes" select=".//table"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:if test="contains($toc.params,'example') and .//example"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofExamples'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofExamples'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="list.of.titles"> |
| <xsl:with-param name="titles" select="'example'"/> |
| <xsl:with-param name="nodes" select=".//example"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:if test="contains($toc.params,'equation') and .//equation"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofEquations'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofEquations'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="list.of.titles"> |
| <xsl:with-param name="titles" select="'equation'"/> |
| <xsl:with-param name="nodes" select=".//equation[title]"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:if test="contains($toc.params,'procedure') and .//procedure"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| format="i" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofProcedures'"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| <xsl:with-param name="gentext-key" select="'ListofProcedures'"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="list.of.titles"> |
| <xsl:with-param name="titles" select="'procedure'"/> |
| <xsl:with-param name="nodes" select=".//procedure[title]"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| |
| <xsl:apply-templates select="$content"/> |
| </xsl:template> |
| |
| <xsl:template match="book/bookinfo"></xsl:template> |
| <xsl:template match="book/title"></xsl:template> |
| <xsl:template match="book/subtitle"></xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template match="part"> |
| <xsl:if test="not(partintro)"> |
| <xsl:apply-templates select="." mode="part.titlepage.mode"/> |
| <xsl:call-template name="generate.part.toc"/> |
| </xsl:if> |
| <xsl:apply-templates/> |
| </xsl:template> |
| |
| <xsl:template match="part" mode="part.titlepage.mode"> |
| <!-- done this way to force the context node to be the part --> |
| <xsl:param name="additional.content"/> |
| |
| <xsl:variable name="id"> |
| <xsl:call-template name="object.id"/> |
| </xsl:variable> |
| |
| <xsl:variable name="titlepage-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'titlepage'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <fo:page-sequence id="{$id}" |
| hyphenate="{$hyphenate}" |
| master-reference="{$titlepage-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"/> |
| </xsl:attribute> |
| |
| <xsl:choose> |
| <xsl:when test="not(preceding::chapter) |
| and not(preceding::part)"> |
| <!-- if there is a preceding chapter or part, page numbering will already --> |
| <!-- be adjusted, otherwise restart the page numbers --> |
| <xsl:attribute name="initial-page-number">1</xsl:attribute> |
| </xsl:when> |
| <xsl:when test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:when> |
| </xsl:choose> |
| |
| <xsl:apply-templates select="." mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="." mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$titlepage-master-reference"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="part.titlepage"/> |
| <xsl:copy-of select="$additional.content"/> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:template> |
| |
| <xsl:template match="part/docinfo|partinfo"></xsl:template> |
| <xsl:template match="part/title"></xsl:template> |
| <xsl:template match="part/subtitle"></xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template name="generate.part.toc"> |
| <xsl:param name="part" select="."/> |
| |
| <xsl:variable name="lot-master-reference"> |
| <xsl:call-template name="select.pagemaster"> |
| <xsl:with-param name="pageclass" select="'lot'"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:variable name="toc.params"> |
| <xsl:call-template name="find.path.params"> |
| <xsl:with-param name="node" select="$part"/> |
| <xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| </xsl:call-template> |
| </xsl:variable> |
| |
| <xsl:if test="contains($toc.params, 'toc')"> |
| <fo:page-sequence hyphenate="{$hyphenate}" |
| master-reference="{$lot-master-reference}"> |
| <xsl:attribute name="language"> |
| <xsl:call-template name="l10n.language"/> |
| </xsl:attribute> |
| <xsl:attribute name="format"> |
| <xsl:call-template name="page.number.format"> |
| <xsl:with-param name="element" select="'toc'"/> |
| </xsl:call-template> |
| </xsl:attribute> |
| <xsl:if test="$double.sided != 0"> |
| <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute> |
| </xsl:if> |
| |
| <xsl:apply-templates select="$part" mode="running.head.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| </xsl:apply-templates> |
| |
| <xsl:apply-templates select="$part" mode="running.foot.mode"> |
| <xsl:with-param name="master-reference" select="$lot-master-reference"/> |
| </xsl:apply-templates> |
| |
| <fo:flow flow-name="xsl-region-body"> |
| <xsl:call-template name="division.toc"> |
| <xsl:with-param name="toc-context" select="$part"/> |
| </xsl:call-template> |
| </fo:flow> |
| </fo:page-sequence> |
| </xsl:if> |
| </xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template match="part/partintro"> |
| <xsl:apply-templates select=".." mode="part.titlepage.mode"> |
| <xsl:with-param name="additional.content"> |
| <xsl:if test="title"> |
| <xsl:call-template name="partintro.titlepage"/> |
| </xsl:if> |
| <xsl:apply-templates/> |
| </xsl:with-param> |
| </xsl:apply-templates> |
| |
| <xsl:call-template name="generate.part.toc"> |
| <xsl:with-param name="part" select=".."/> |
| </xsl:call-template> |
| </xsl:template> |
| |
| <xsl:template match="partintro/title"></xsl:template> |
| <xsl:template match="partintro/subtitle"></xsl:template> |
| <xsl:template match="partintro/titleabbrev"></xsl:template> |
| |
| <!-- ==================================================================== --> |
| |
| <xsl:template match="book" mode="division.number"> |
| <xsl:number from="set" count="book" format="1."/> |
| </xsl:template> |
| |
| <xsl:template match="part" mode="division.number"> |
| <xsl:number from="book" count="part" format="I."/> |
| </xsl:template> |
| |
| </xsl:stylesheet> |
| |