1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                xmlns:fo="http://www.w3.org/1999/XSL/Format"
4                version='1.0'>
5
6<!-- ********************************************************************
7     $Id$
8     ********************************************************************
9
10     This file is part of the XSL DocBook Stylesheet distribution.
11     See /README or http://nwalsh.com/docbook/xsl/ for copyright
12     and other information.
13
14     ******************************************************************** -->
15
16<xsl:template name="formal.object">
17  <xsl:variable name="id">
18    <xsl:call-template name="object.id"/>
19  </xsl:variable>
20
21  <fo:block id="{$id}"
22            space-before.minimum="1em"
23            space-before.optimum="1.5em"
24            space-before.maximum="2em"
25            space-after.minimum="1em"
26            space-after.optimum="1.5em"
27            space-after.maximum="2em"
28            keep-with-previous.within-column="always">
29    <xsl:call-template name="formal.object.heading">
30       <xsl:with-param name="title">
31         <xsl:apply-templates select="." mode="title.markup"/>
32       </xsl:with-param>
33    </xsl:call-template>
34    <xsl:apply-templates/>
35  </fo:block>
36</xsl:template>
37
38<xsl:template name="formal.object.heading">
39  <xsl:param name="title"></xsl:param>
40  <fo:block xsl:use-attribute-sets="formal.title.properties">
41    <xsl:copy-of select="$title"/>
42  </fo:block>
43</xsl:template>
44
45<xsl:template name="informal.object">
46  <fo:block>
47    <xsl:apply-templates/>
48  </fo:block>
49</xsl:template>
50
51<xsl:template name="semiformal.object">
52  <xsl:choose>
53    <xsl:when test="/title">
54      <xsl:call-template name="formal.object"/>
55    </xsl:when>
56    <xsl:otherwise>
57      <xsl:call-template name="informal.object"/>
58    </xsl:otherwise>
59  </xsl:choose>
60</xsl:template>
61
62<xsl:template match="figure|example">
63  <xsl:call-template name="formal.object"/>
64</xsl:template>
65
66<xsl:template match="table">
67  <xsl:variable name="id">
68    <xsl:call-template name="object.id"/>
69  </xsl:variable>
70  <xsl:variable name="prop-columns"
71    select=".//colspec[contains(@colwidth, '*')]"/>
72
73  <fo:table-and-caption id="{$id}"
74      keep-together.within-column="always"
75      space-before.minimum="0.8em"
76      space-before.optimum="1em"
77      space-before.maximum="1.2em"
78      space-after.minimum="0.8em"
79      space-after.optimum="1em"
80      space-after.maximum="1.2em">
81    <fo:table-caption>
82      <fo:block font-weight='bold'
83          space-after.minimum="0.2em"
84          space-after.optimum="0.5em"
85          space-after.maximum="0.8em"
86          keep-with-next.within-column="always"
87          hyphenate="false">
88         <xsl:apply-templates select="." mode="title.markup"/>
89      </fo:block>
90    </fo:table-caption>
91    <fo:table>
92      <xsl:if test="count($prop-columns) != 0">
93	<xsl:attribute name="table-layout">fixed</xsl:attribute>
94      </xsl:if>
95      <xsl:apply-templates/>
96    </fo:table>
97  </fo:table-and-caption>
98</xsl:template>
99
100<xsl:template match="equation">
101  <xsl:call-template name="semiformal.object"/>
102</xsl:template>
103
104<xsl:template match="figure/title"></xsl:template>
105<xsl:template match="table/title"></xsl:template>
106<xsl:template match="example/title"></xsl:template>
107<xsl:template match="equation/title"></xsl:template>
108
109<xsl:template match="informalfigure">
110  <xsl:call-template name="informal.object"/>
111</xsl:template>
112
113<xsl:template match="informalexample">
114  <xsl:call-template name="informal.object"/>
115</xsl:template>
116
117<xsl:template match="informaltable">
118  <xsl:variable name="prop-columns"
119    select=".//colspec[contains(@colwidth, '*')]"/>
120
121  <fo:table>
122    <xsl:if test="count($prop-columns) != 0">
123      <xsl:attribute name="table-layout">fixed</xsl:attribute>
124    </xsl:if>
125    <xsl:apply-templates/>
126  </fo:table>
127</xsl:template>
128
129<xsl:template match="informalequation">
130  <xsl:call-template name="informal.object"/>
131</xsl:template>
132
133</xsl:stylesheet>
134