XSL for XEP from the XSL-DocBook-XML-4.4 project
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<!-- It is necessary to include both namespaces, or so I am told -->
<!-- START PRINT CUSTOMIZATION -->
<!-- This is the local path to Norm Walsh's DocBook stylesheets -->
<xsl:import href="/usr/share/xml/docbook/xsl-stylesheets-1.70-1/fo/docbook.xsl"/>
<!-- Include local common customization stylesheet (currently empty) -->
<xsl:include href="common-customizations.xsl" />
<!-- current docs say that "At present, this consists of PDF
bookmarks."
<xsl:param name="fop.extensions" select="1"/>
-->
<!-- If non-zero, XEP extensions will be used. XEP extensions consists
of PDF bookmarks, document information and better index processing.
This parameter can also affect which graphics file formats are
supported.
-->
<xsl:param name="xep.extensions" select="1"></xsl:param>
<!-- Turn off draft mode -->
<xsl:param name="draft.mode" select="no"/>
<!-- Body font. The body font family is the default font used for text
in the page body. -->
<xsl:param name="body.font.family">AGaramond-Regular</xsl:param>
<!-- Specifies the default font size for body text. -->
<xsl:param name="body.font.master">11</xsl:param>
<xsl:param name="body.font.size">
<xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
</xsl:param>
<!-- The dingbat font family is used for dingbats. If it is defined as
the empty string, no font change is effected around dingbats. -->
<!-- <xsl:param name="dingbat.font.family">Times-Roman</xsl:param> -->
<!-- <xsl:param name="dingbat.font.family" select="'serif'"></xsl:param> -->
<!-- seems to have no affect on my system. FOP still claims it cannot find
ZapfDingbats,italic,normal-->
<!-- <xsl:param name="dingbat.font.family"></xsl:param> -->
<!-- The monospace font family is used for verbatim environments
(program listings, screens, etc.). -->
<xsl:param name="monospace.font.family">Courier</xsl:param>
<!-- The default sans-serif font family. At the present, this isn't
actually used by the stylesheets. -->
<xsl:param name="sans.font.family">GillSans</xsl:param>
<!-- The title font family is used for titles (chapter, section, figure,
etc.) -->
<xsl:param name="title.font.family">GillSans-Bold</xsl:param>
<!-- FOP and XEP both look for this image even if the image is not used,
and issue an error message if they cannot find the image -->
<xsl:param name="draft.watermark.image"
select="'file:///usr/share/xml/docbook/images/draft.png'"/>
<!-- **** GENERAL, LAYOUT, ETC. ****************************** -->
<!-- ************************************************************ -->
<!-- Double/single sided. 0 = single, 1 = double -->
<xsl:param name="double.sided">1</xsl:param>
<!-- In portrait orientation, the short edge is horizontal; in landscape
orientation, it is vertical. -->
<xsl:param name="page.orientation" select="'portrait'"></xsl:param>
<!-- The portrait page height is the length of the long edge of the
physical page. -->
<xsl:param name="page.height.portrait">11in</xsl:param>
<!-- The portrait page width is the length of the short edge of the
physical page. -->
<xsl:param name="page.width.portrait">8.5in</xsl:param>
<!-- Distance from binding edge of the page to the first column of
text. -->
<xsl:param name="page.margin.inner">1.25in</xsl:param>
<!-- Distance from the non-binding edge of the page to the last column
of text. -->
<xsl:param name="page.margin.outer">1.00in</xsl:param>
<!-- This parameter provides one means of indenting the body text relative
to the left page margin. It is used in place of the title.margin.left
for all XSL-FO processors except FOP. It enables support for side
floats to appear in the indented margin area. This start-indent
property is added to the fo:flow for certain page sequences. Which
page-sequences it is applied to is determined by the template named
set.flow.properties. By default, that template adds it to the flow for
page-sequences using the "body" master-reference, as well as appendixes
and prefaces. If this parameter is used, section titles should have a
start-indent value of 0pt if they are to be outdented relative to the
body text. If you are using FOP, then set this parameter to a zero
width value and set the title.margin.left parameter to the negative
value of the desired indent.
-->
<xsl:param name="body.start.indent">
<xsl:choose>
<xsl:when test="$fop.extensions != 0">0pt</xsl:when>
<xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
<xsl:otherwise>1.50in</xsl:otherwise>
</xsl:choose>
</xsl:param>
<!-- Top of page edge to top of header area. -->
<xsl:param name= "page.margin.top">0.50in</xsl:param>
<!-- Height of the header -->
<xsl:param name="region.before.extent">0.25in</xsl:param>
<!-- Distance from the top of the region-before to the first line of text
in the page body -->
<xsl:param name="body.margin.top">0.50in</xsl:param>
<!-- Bottom of main text area to bottom of footer area. -->
<xsl:param name="body.margin.bottom">0.50in</xsl:param>
<!-- Height of footer area, from the top of the footer area to the bottom
of the footer text. -->
<xsl:param name="region.after.extent">0.25in</xsl:param>
<!-- Bottom of footer area to bottom of page edge. -->
<xsl:param name="page.margin.bottom">0.50in</xsl:param>
<!-- Columns for the various page types. -->
<xsl:param name="column.count.titlepage" select="1"/>
<xsl:param name="column.count.lot" select="1"/>
<xsl:param name="column.count.front" select="1"/>
<xsl:param name="column.count.body" select="1"/>
<xsl:param name="column.count.back" select="1"/>
<xsl:param name="column.count.index" select="2"/>
<!-- Text alignmnet for the entire document -->
<xsl:param name="alignment">justify</xsl:param>
<!-- Hyphenation true/false for all text in the entire document -->
<xsl:param name="hyphenate">false</xsl:param>
<!-- Allow SVG in the result tree -->
<xsl:param name="use.svg" select="1"></xsl:param>
<!-- Include an auto-generated List of Figures and a
auto-generated List of Tables. these two params work,
but they are not documented. Also, they may interfere
with custom formatting of the various generated lists.
Therefore, use the more complicated param
(<xsl:param name="generate.toc">) until all the formatting
is implemented.
<xsl:param name="generate.book.figure.lot" select="1"/>
<xsl:param name="generate.book.table.lot" select="1"/>
-->
<xsl:param name="generate.toc">
book toc,title,figure,table,example,equation
</xsl:param>
<!-- Include an auto-generated Index -->
<xsl:param name="generate.index" select="1"/>
<!-- **** LISTS, ITEMIZEDLISTS, ORDEREDLISTS ETC. *********** -->
<!-- ************************************************************ -->
<!-- From Bob S. Indents lists. -->
<xsl:template match="orderedlist|itemizedlist">
<xsl:choose>
<xsl:when test="not(ancestor::itemizedlist or ancestor::orderedlist)">
<fo:block margin-left=".25in">
<xsl:apply-imports/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- spacing before the list, and between list elements -->
<xsl:attribute-set name="list.block.spacing">
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.3em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0.2em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0.3em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="list.item.spacing">
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.3em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.5em</xsl:attribute>
</xsl:attribute-set>
<!-- control what symbols are used in lists, copied from
common/common.xsl -->
<xsl:template name="next.itemsymbol">
<xsl:param name="itemsymbol" select="'default'"/>
<xsl:choose>
<!-- Change this list if you want to change the order of symbols -->
<xsl:when test="$itemsymbol = 'disc'">circle</xsl:when>
<xsl:when test="$itemsymbol = 'round'">square</xsl:when>
<!-- I added the next line. -->
<xsl:when test="$itemsymbol = 'ndash'">ndash</xsl:when>
<xsl:otherwise>disc</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Entire template copied from fo/lists.xsl -->
<xsl:template match="itemizedlist/listitem">
<xsl:variable name="id"><xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="itemsymbol">
<xsl:call-template name="list.itemsymbol">
<xsl:with-param name="node" select="parent::itemizedlist"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="item.contents">
<fo:list-item-label end-indent="label-end()">
<fo:block>
<xsl:choose>
<xsl:when test="$itemsymbol='disc'">•</xsl:when>
<xsl:when test="$itemsymbol='bullet'">•</xsl:when>
<!-- why do these symbols not work? FOP deficiency most of the
time, probably. -->
<!-- I added the next line. -->
<xsl:when test="$itemsymbol='ndash'">–</xsl:when>
<xsl:when test="$itemsymbol='circle'">∘</xsl:when>
<xsl:when test="$itemsymbol='round'">∘</xsl:when>
<xsl:when test="$itemsymbol='square'">☐</xsl:when>
<xsl:when test="$itemsymbol='box'">☐</xsl:when>
<xsl:otherwise>•</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</xsl:variable>
<xsl:choose>
<xsl:when test="parent::*/@spacing = 'compact'">
<fo:list-item
id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
<xsl:copy-of select="$item.contents"/>
</fo:list-item>
</xsl:when>
<xsl:otherwise>
<fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
<xsl:copy-of select="$item.contents"/>
</fo:list-item>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Force a page break prior to each level 1 heading -->
<!-- <xsl:attribute-set name="section.level1.properties">
<xsl:attribute name="break-before">page</xsl:attribute>
</xsl:attribute-set> -->
<!-- **** Section titles (headings) and Chapter titles ******** -->
<!-- ************************************************************ -->
<!-- This is supposed to control how Chapter titles are displayed,
but it seems to not work.
<xsl:param name="local.l10n.xml"
select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="en">
<l:context name="title">
<l:template name="chapter" text="%t"/>
</l:context>
</l:l10n>
</l:i18n> -->
<!-- Suppress automatic "Chapter #" in Chapter titles (works) -->
<xsl:param name="chapter.autolabel" select="0"/>
<!-- Set the outdent for section and chapter titles
<xsl:param name="title.margin.left" select="'0pc'"/>
-->
<!-- Turns on/off section numbering. 0=off, 1=on -->
<xsl:param name="section.autolabel" select="0"/>
<!-- Adds the chapter number to the section numbering -->
<xsl:param name="section.label.includes.component.label" select="0"/>
<!-- style properties for all levels of section titles -->
<xsl:attribute-set name="section.title.properties">
<xsl:attribute name="font-family">
<xsl:value-of select="$title.font.family"/>
</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<!-- keep-with-next does not seem to work -->
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<!-- font size is calculated dynamically by section.heading template -->
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
<xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
<!-- font-family, font-size, and color of the Chapter titles. Includes a
matching colored rule beneath the Chapter title text. -->
<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
<fo:block color="#336666" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="chapter.titlepage.recto.style"
margin-left="{$title.margin.left} - 1.5in"
font-size="20pt"
font-weight="bold"
font-style="italic"
font-family="GillSans-BoldItalic"
border-bottom-style="solid"
border-bottom-width="3pt"
border-bottom-color="#336666"
space-after="9pt">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
</xsl:call-template>
</fo:block>
</xsl:template>
<!-- set the font size for level 1 headings. defaul = * 2.0736 -->
<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="font-size">
<!-- <xsl:value-of select="$body.font.master * 2.0736"/> -->
<xsl:text>16pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">0.5in</xsl:attribute>
</xsl:attribute-set>
<!-- Include a rule below level1 headings -->
<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
<xsl:attribute name="border-bottom-width">.5pt</xsl:attribute>
<xsl:attribute name="space-after">6pt</xsl:attribute>
</xsl:attribute-set>
<!-- set the font size for level 2 headings. default = * 1.728 -->
<xsl:attribute-set name="section.title.level2.properties">
<xsl:attribute name="font-size">
<!-- <xsl:value-of select="$body.font.master * 1.728"/> -->
<xsl:text>14pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">1.0in</xsl:attribute>
</xsl:attribute-set>
<!-- set the font size for level 3 headings. default = * 1.44 -->
<xsl:attribute-set name="section.title.level3.properties">
<xsl:attribute name="font-size">
<!-- <xsl:value-of select="$body.font.master * 1.44"/> -->
<xsl:text>12pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">
<xsl:value-of select="$body.start.indent"/>
</xsl:attribute>
</xsl:attribute-set>
<!-- set the font size for level 4 headings. default = * 1.2 -->
<xsl:attribute-set name="section.title.level4.properties">
<xsl:attribute name="font-size">
<!-- <xsl:value-of select="$body.font.master * 1.2"/> -->
<xsl:text>10pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">
<xsl:value-of select="$body.start.indent"/>
</xsl:attribute>
</xsl:attribute-set>
<!-- set the font size for level 5 headings. default = body font size -->
<xsl:attribute-set name="section.title.level5.properties">
<xsl:attribute name="font-size">
<xsl:value-of select="$body.font.master"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">
<xsl:value-of select="$body.start.indent"/>
</xsl:attribute>
</xsl:attribute-set>
<!-- set the font size for level 6 headings. default = body font size-->
<xsl:attribute-set name="section.title.level6.properties">
<xsl:attribute name="font-size">
<xsl:value-of select="$body.font.master"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
<xsl:attribute name="start-indent">
<xsl:value-of select="$body.start.indent"/>
</xsl:attribute>
</xsl:attribute-set>
<!-- **** TOCS, LOTs ****************************** -->
<!-- ************************************************************ -->
<!-- TOCs in components (Chapters, Appendixes, etc.)
0=false, nonzero=true -->
<xsl:param name="generate.component.toc" select="0"/>
<!-- Limits the TOC to the level of sect_N at the most -->
<xsl:param name="toc.section.depth" select="3"/>
<!-- These attributes are set on the wrapper that surrounds the ToC block,
not on each individual line. In the toc.margins.properties
attribute-set, start-indent works, but end-indent does not.
In fact, start-indent is the only one of the following that I can get
to work at all. Email from Bob Stayton informs me that I must edit
the toc.line template because it overrides some settings I am
trying to customize here in this attribute-set.
-->
<xsl:attribute-set name="toc.margin.properties">
<xsl:attribute name="space-before.minimum">0.375in</xsl:attribute>
<xsl:attribute name="space-before.optimum">0.4375in</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.50in</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.optimum">1em</xsl:attribute>
<xsl:attribute name="space-after.maximum">2em</xsl:attribute>
<xsl:attribute name="start-indent">0.0in</xsl:attribute>
</xsl:attribute-set>
<!-- See Bob Stayton's book, the "Print TOC control" section. This
template is copied directly from there and then customized.
-->
<xsl:template name="toc.line">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<fo:block text-align-last="justify"
end-indent="1.0in + {$toc.indent.width}pt"
last-line-end-indent="-{$toc.indent.width}pt">
<fo:inline keep-with-next.within-line="always">
<xsl:choose>
<xsl:when test="self::chapter">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">12pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::index">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">12pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::appendix">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">12pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::sect1">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::sect2">
<xsl:attribute name="font-family">Helvetica</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::sect3">
<xsl:attribute name="font-family">Helvetica</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::figure">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">11pt</xsl:attribute>
</xsl:when>
<xsl:when test="self::table">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">11pt</xsl:attribute>
</xsl:when>
</xsl:choose>
<fo:basic-link internal-destination="{$id}">
<xsl:if test="$label != ''">
<xsl:copy-of select="$label"/>
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<xsl:apply-templates select="." mode="title.markup"/>
</fo:basic-link>
</fo:inline>
<fo:inline keep-together.within-line="always">
<xsl:text> </xsl:text>
<fo:leader leader-pattern="dots"
leader-pattern-width="3pt"
leader-alignment="reference-area"
keep-with-next.within-line="always"/>
<xsl:text> </xsl:text>
<fo:basic-link internal-destination="{$id}">
<fo:page-number-citation ref-id="{$id}"/>
</fo:basic-link>
</fo:inline>
</fo:block>
</xsl:template>
<!-- Copied from Bob Stayton's book: "When a TOC page is started, it is
assigned a format for its own page numbers. It gets the format by
calling the template named page.number.format. That is a simple
template that can be customized in a customization layer. Here is an
example that changes the page numbering style of the TOC to 1, 2, 3
etc.
-->
<xsl:template name="page.number.format">
<xsl:param name="element" select="local-name(.)"/>
<!--
It would seem that this is the place to control the font used
as numbers in the TOC/LOT lines, but this does not work. The
default is to use the body text font.
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="font-size">11pt</xsl:attribute>
-->
<xsl:choose>
<xsl:when test="$element = 'toc'">1</xsl:when>
<xsl:when test="$element = 'preface'">i</xsl:when>
<xsl:when test="$element = 'dedication'">i</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- The following is the first suggestion from Bob Stayton to neutralize the
body.start.indent value that gets applied to LOTs. For TOCs,
the body.start.indent value is being neutralized above with the
<xsl:attribute name="start-indent">0.0in</xsl:attribute> child
element within <xsl:attribute-set name="toc.margin.properties">
I don't know why, but the following code is haviing no affect on either
the start-indent or the end-indent for LOT lines. I may have
misunderstood Bob's suggestion. This code may not even belong here
inside the toc.line template.
<fo:block xsl:use-attribute-sets="toc.line.properties"
end-indent="1.0in + {$toc.indent.width}pt"
last-line-end-indent="-{$toc.indent.width}pt">
<xsl:if test="self::figure or self::table or self::example or
self::equation or self::procedure">
<xsl:attribute name="start-indent">0pt</xsl:attribute>
</xsl:if>
</fo:block>
</xsl:template>
-->
<!-- This is the second suggestion from Bob Stayton to neutralize the
body.start.indent value that gets applied to LOTs. For TOCs,
the body.start.indent value is being neutralized above with the
<xsl:attribute name="start-indent">0.0in</xsl:attribute> child
element within <xsl:attribute-set name="toc.margin.properties">
This approach is working for the start-indent on LOT lines, but
not for the end-indent on TOC lines.
-->
<xsl:template match="figure|table|example|equation|procedure" mode="toc">
<fo:block start-indent="0pt">
<!-- in the above two lines, start-indent works to affect the
start-indent of LOT lines, but a setting here for end-indent
has no affect at all on the end-indent of LOT lines -->
<xsl:call-template name="toc.line"/>
</fo:block>
</xsl:template>
<xsl:template name="table.of.contents.titlepage" priority="1">
<fo:block color="#336666" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="chapter.titlepage.recto.style"
space-before="0.25in"
space-before.conditionality="retain"
margin-left="{$title.margin.left}"
font-size="25pt"
font-stretch="extra-expanded"
letter-spacing="0pt"
font-weight="bold"
font-family="GillSans"
border-bottom-style="solid"
border-bottom-width="3pt"
border-bottom-color="#336666"
space-after="0.375in">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'TableofContents'"/>
</xsl:call-template>
</fo:block>
</xsl:template>
<xsl:template name="list.of.figures.titlepage" priority="1">
<fo:block color="#336666" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="chapter.titlepage.recto.style"
space-before="0.25in"
space-before.conditionality="retain"
margin-left="{$title.margin.left} - 1.5in"
font-size="25pt"
font-stretch="extra-expanded"
letter-spacing="0pt"
font-weight="bold"
font-family="GillSans"
border-bottom-style="solid"
border-bottom-width="3pt"
border-bottom-color="#336666"
space-after="0.375in">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'ListofFigures'"/>
</xsl:call-template>
</fo:block>
</xsl:template>
<xsl:template name="list.of.tables.titlepage" priority="1">
<fo:block color="#336666" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="chapter.titlepage.recto.style"
space-before="0.25in"
space-before.conditionality="retain"
margin-left="{$title.margin.left} - 1.5in"
font-size="25pt"
font-stretch="extra-expanded"
letter-spacing="0pt"
font-weight="bold"
font-family="GillSans"
border-bottom-style="solid"
border-bottom-width="3pt"
border-bottom-color="#336666"
space-after="0.375in">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'ListofTables'"/>
</xsl:call-template>
</fo:block>
</xsl:template>
<!-- **** Running HEADERS AND FOOTERS ************************** -->
<!-- ************************************************************ -->
<!-- Specify the height of the header specified above
<xsl:param name="region.before.extent" select="'0.5in'"/>
-->
<!-- Specify the height of the footer -->
<xsl:param name="region.after.extent" select="'0.5in'"/>
<!-- Footnote font size as a percentage of the body font. -->
<xsl:param name="footnote.font.size">
<xsl:value-of select="$body.font.master * 0.8"/>
<xsl:text>pt</xsl:text>
</xsl:param>
<!-- Bottom of footer area to bottom of page edge. -->
<xsl:param name="page.margin.bottom">0.25in</xsl:param>
<!-- Top of header area to top of main text area. specified above
<xsl:param name="body.margin.top">0.5in</xsl:param>
-->
<!-- Bottom of main text area to bottom of footer area. specified above
<xsl:param name="body.margin.bottom">0.25in</xsl:param>
-->
<!-- Header content and placement. -->
<xsl:template name="header.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<xsl:variable name="candidate">
<!-- sequence can be odd, even, first, blank -->
<!-- position can be left, center, right -->
<xsl:choose>
<xsl:when test="$sequence = 'odd' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'odd' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'odd' and $position = 'right'">
<xsl:text>freedom Architecture </xsl:text>
<fo:page-number/>
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'left'">
<fo:page-number/>
<xsl:text> freedom Architecture</xsl:text>
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'right'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'right'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'left'">
<fo:page-number/>
<xsl:text> freedom Architecture</xsl:text>
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'center'">
<!-- no output -->
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'right'">
</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Does runtime parameter turn off blank page headers? -->
<xsl:choose>
<xsl:when test="$sequence='blank' and $headers.on.blank.pages=1">
<!-- no output -->
</xsl:when>
<!-- titlepages have no headers -->
<xsl:when test="$pageclass = 'titlepage'">
<!-- no output -->
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Header fonts and font size. -->
<xsl:attribute-set name="header.content.properties">
<xsl:attribute name="font-family">GillSans-Light</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>
<xsl:attribute name="font-stretch">semi-expanded</xsl:attribute>
<xsl:attribute name="letter-spacing">1pt</xsl:attribute>
</xsl:attribute-set>
<!-- Header rule -->
<xsl:template name="head.sep.rule">
<xsl:if test="$header.rule != 0">
<xsl:attribute name="border-bottom-width">0.0pt</xsl:attribute>
<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
<xsl:attribute name="border-bottom-color">black</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- Footer content and placement. -->
<xsl:template name="footer.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<xsl:variable name="candidate">
<!-- sequence can be odd, even, first, blank -->
<!-- position can be left, center, right -->
<xsl:choose>
<xsl:when test="$sequence = 'odd' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'odd' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'odd' and $position = 'right'">
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'even' and $position = 'right'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'right'">
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'left'">
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'center'">
</xsl:when>
<xsl:when test="$sequence = 'blank' and $position = 'right'">
</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Does runtime parameter turn off blank page footers? -->
<xsl:choose>
<xsl:when test="$sequence='blank' and $footers.on.blank.pages=0">
<!-- no output -->
</xsl:when>
<!-- titlepages have no footers -->
<xsl:when test="$pageclass = 'titlepage'">
<!-- no output -->
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Footer fonts and font size. -->
<xsl:attribute-set name="footer.content.properties">
<xsl:attribute name="font-family">Helvetica</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
</xsl:attribute-set>
<!-- Footer rule -->
<xsl:template name="foot.sep.rule">
<xsl:if test="$footer.rule != 0">
<xsl:attribute name="border-bottom-width">0.0pt</xsl:attribute>
<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
<xsl:attribute name="border-bottom-color">black</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- **** MISC. DETAILS, FINE TUNING *************************** -->
<!-- ************************************************************ -->
<!-- Specify how formal object titles should be styled. (figures, etc.) -->
<xsl:attribute-set name="formal.title.properties"
use-attribute-sets="normal.para.spacing">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
</xsl:attribute-set>
<!-- Specify the vertical placement of the figure/example/table title -->
<xsl:param name="formal.title.placement">
figure after
example after
equation after
table after
procedure after
</xsl:param>
<!-- To prevent figure, table, example, or procedure autolabels from
resetting to 1 at the beginning of each chapter, but rather cary
on with a continuous sequence starting from the beginning of the
book, I changed the order of two xsl:number command lines commented
out below. I understand some, but not all of this code. -->
<xsl:template match="figure|table|example|procedure" mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) > 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="local-name() = 'procedure' and
$formal.procedures = 0">
<!-- No label -->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count($pchap)>0">
<xsl:if test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap"
mode="intralabel.punctuation"/>
</xsl:if>
<!-- <xsl:number format="1" from="chapter|appendix"
level="any"/> -->
<xsl:number format="1" from="book|article" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" from="chapter|appendix" level="any"/>
<!-- <xsl:number format="1" from="book|article" level="any"/> -->
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Tip from Bob Stayton. What we do to get center alignment of
table titles. This will probably work for figure, example, etc.
Most of this template is copied from fo/formal.xsl. The
xsl if test part does what's needed. -->
<xsl:template name="formal.object.heading">
<xsl:param name="object" select="."/>
<xsl:param name="placement" select="'before'"/>
<fo:block xsl:use-attribute-sets="formal.title.properties">
<xsl:if test="self::table">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:if>
<xsl:if test="self::figure">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$placement = 'before'">
<xsl:attribute
name="keep-with-next.within-column">always</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="keep-with-previous.within-column">always</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="$object" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</fo:block>
</xsl:template>
<!-- -->
<xsl:attribute-set name="formal.object.properties">
<xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
<xsl:attribute name="space-before.maximum">2em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.optimum">1em</xsl:attribute>
<xsl:attribute name="space-after.maximum">2em</xsl:attribute>
<!--
If I use a setting of "always" for the keep-together.within-column
attribute, the <fo:block . . .> elements that contain tables
will inherit that attribute setting. But, surprise, they inherit
that attribute setting even if I comment it out. From where?
I haven't figured that out. But I do know that it is necessary to
override that setting here so that I can prevent the problem
where big blank areas are created because the table gets bumped to
start at the top of the next page. At least that happens with XEP.
Forcing figure titles and table titles to keep with their
figures/tables is a different problem. That's done in the
formal.object.heading template. Setting the formal.object.properties
keep-together.within-column attribute to "auto" cures the problem.
The "auto" setting means there are no keep-together conditions
imposed by the property. The "auto" setting could cause problems
for some formal objects, like equations or examples. Perhaps we
need a way to set this attribute value separately for different
types of formal objects.
-->
<xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
</xsl:attribute-set>
<!-- Create a border and background around figures -->
<!-- <xsl:attribute-set name="figure.properties"
use-attribute-sets="formal.object.properties">
<xsl:attribute name="border-color">#000000</xsl:attribute>
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">1px</xsl:attribute>
<xsl:attribute name="padding">1em</xsl:attribute>
<xsl:attribute name="background-color">#dddddd</xsl:attribute>
</xsl:attribute-set> -->
<!-- Spacing between paragraphs -->
<xsl:attribute-set name="normal.para.spacing">
<xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
</xsl:attribute-set>
<!-- Triggers generation of page number citations after xrefs -->
<!-- Don't put the id on the title element. Put it on the element that
contains the title. A title element does not output its id value to
the XSL-FO. -->
<xsl:param name="insert.xref.page.number">maybe</xsl:param>
<!-- Force a page break. You must include the following in the XML
document where you want the pagebreak: <?pagebreak?> -->
<xsl:template match="processing-instruction('pagebreak')">
<fo:block break-after="page"/>
</xsl:template>
<!-- suppress generation and inclusion of title in xrefs -->
<xsl:param name="xref.with.number.and.title" select="0"></xsl:param>
<!-- Controls the size of the superscript number denoting a footnote -->
<xsl:template name="format.footnote.mark">
<xsl:param name="mark" select="'?'"/>
<fo:inline font-size="80%">
<xsl:choose>
<xsl:when test="$fop.extensions != 0">
<xsl:attribute name="vertical-align">super</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="baseline-shift">super</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$mark"/>
</fo:inline>
</xsl:template>
<!-- **** Tables ***************************************** -->
<!-- ************************************************************ -->
<!-- The (absolute) nominal width of tables. In order to convert CALS column
widths into HTML column widths, it is sometimes necessary to have an
absolute table width to use for conversion of mixed absolute and
relative widths. This value must be an absolute length (not a
percentage). Need to know what the default is here, or else I
need to explicitly set it so that I know what the
the default.table.width % is taken on.
<xsl:param name="nominal.table.width" select="'8.5in'"></xsl:param>
-->
<!-- If specified, this value will be used for the WIDTH attribute on
tables that do not specify an alternate width (with the dbhtml
processing instruction). . . . or with the dbfo PI.
Through experimentation, I discovered that this % represents a
percentage of the width of the column in which the table appears.
A nominal.table.width setting larger than the column width does not
affect this.
-->
<xsl:param name="default.table.width" select="'100%'"></xsl:param>
<!-- This changes the font-family in the text of a table. The text of
column headings will automatically be set to a bold variation of
the table text. So, you must make sure that FOP/XEP is properly
configured to also use the bold variation.-->
<xsl:attribute-set name="table.properties"
use-attribute-sets="formal.object.properties">
<xsl:attribute name="font-family">GillSans</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
</xsl:attribute-set>
<!-- Set table cell padding (globally.) You cannot set the padding
values for individual tables for FO output. -->
<xsl:attribute-set name="table.cell.padding">
<xsl:attribute name="padding-left">8pt</xsl:attribute>
<xsl:attribute name="padding-right">8pt</xsl:attribute>
<xsl:attribute name="padding-top">8pt</xsl:attribute>
<xsl:attribute name="padding-bottom">8pt</xsl:attribute>
</xsl:attribute-set>
<!-- **** Title page customization *************************** -->
<!-- ************************************************************ -->
<!-- ************************************************************ -->
<!--
By "title page customizations," I mean customizations to the
first page of the entire PDF file, and the first page of the
TOC, LOF, LOT, and Index.
-->
<!-- **** Experimental *************************** -->
<!-- ************************************************************ -->
<!-- This is supposed to implement a general keep-with-next ****
from:
http://lists.oasis-open.org/archives/docbook-apps/200210/msg00109.html
". . . "
-->
<!--
<xsl:template match="para[informalfigure or figure or screenshot]">
<fo:block xsl:use-attribute-sets="normal.para.spacing">
<xsl:call-template name="anchor"/>
<xsl:call-template name="para.figure">
<xsl:with-param name="current.nodeset">
<xsl:copy-of select="./* | ./text() | ./processing-instruction() | ./comment()"/>
</xsl:with-param>
</xsl:call-template>
</fo:block>
</xsl:template>
<xsl:template name="para.figure">
<xsl:param name="current.nodeset"/>
<xsl:variable name="before.figure">
<xsl:for-each select="node()">
<xsl:if test="
not(self::informalfigure) and
not(self::figure) and
not(self::screenshot) and
not(preceding-sibling::informalfigure) and
not(preceding-sibling::figure) and
not(preceding-sibling::screenshot)">
<xsl:copy-of select="current()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="rest">
<xsl:for-each select="$current.nodeset/node()">
<xsl:if test="preceding-sibling::informalfigure or
preceding-sibling::figure or preceding-sibling::screenshot">
<xsl:copy-of select="current()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<fo:block> --> <!-- before.figure --> <!--
<xsl:apply-templates select="$before.figure/node()"/>
</fo:block>
<xsl:if test="
$current.nodeset/informalfigure or
$current.nodeset/figure or
$current.nodeset/screenshot">
<fo:block
keep-with-previous.within-column="always"
keep-together.within-column="always"
xsl:use-attribute-sets="normal.para.spacing">
<xsl:apply-templates select="$current.nodeset/informalfigure[
not(preceding-sibling::figure) and
not(preceding-sibling::informalfigure) and
not(preceding-sibling::screenshot)]"/>
<xsl:apply-templates select="$current.nodeset/figure[
not(preceding-sibling::figure) and
not(preceding-sibling::informalfigure) and
not(preceding-sibling::screenshot)]"/>
<xsl:apply-templates select="$current.nodeset/screenshot[
not(preceding-sibling::figure) and
not(preceding-sibling::informalfigure) and
not(preceding-sibling::screenshot)]"/>
</fo:block>
</xsl:if>
<xsl:if test="normalize-space($rest) != ''">
<xsl:call-template name="para.figure">
<xsl:with-param name="current.nodeset" select="$rest"/>
</xsl:call-template>
</xsl:if>
</xsl:template> -->
</xsl:stylesheet>