]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/boostbook/xsl/docbook-layout.xsl
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / boostbook / xsl / docbook-layout.xsl
1 <?xml version = "1.0" encoding = "utf-8"?>
2 <!--
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 -->
9
10 <xsl:stylesheet version = "1.0"
11 xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
12 >
13
14 <!-- needed for calsTable template -->
15
16 <xsl:import
17 href="http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl"/>
18
19 <!-- Optionally add the section id to each section's class.
20 This is useful if you want to style individual sections differently. -->
21 <xsl:param name="boost.section.class.add.id" select="0"/>
22
23 <!--
24 Override the behaviour of some DocBook elements for better
25 integration with the new look & feel.
26 -->
27
28 <xsl:template match = "programlisting[ancestor::informaltable]">
29 <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
30 </xsl:template>
31
32 <xsl:template match = "refsynopsisdiv">
33 <h2 class = "{name(.)}-title">Synopsis</h2>
34 <div class = "{name(.)}"><xsl:apply-templates/></div>
35 </xsl:template>
36
37 <!-- table: remove border = '1' -->
38
39 <xsl:template match = "table|informaltable">
40 <xsl:choose>
41 <xsl:when test = "self::table and tgroup|mediaobject|graphic">
42 <xsl:apply-imports/>
43 </xsl:when><xsl:when test = "self::informaltable and tgroup|mediaobject|graphic">
44 <xsl:call-template name = "informal.object">
45 <xsl:with-param name = "class"><xsl:choose>
46 <xsl:when test = "@tabstyle">
47 <xsl:value-of select = "@tabstyle"/>
48 </xsl:when><xsl:otherwise>
49 <xsl:value-of select = "local-name(.)"/>
50 </xsl:otherwise>
51 </xsl:choose></xsl:with-param>
52 </xsl:call-template>
53 </xsl:when><xsl:otherwise>
54 <table class = "table"><xsl:copy-of select = "@*[not(local-name(.)='border')]"/>
55 <xsl:call-template name = "htmlTable"/>
56 </table>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:template>
60
61 <xsl:template match = "tgroup" name = "tgroup">
62 <xsl:variable name="summary"><xsl:call-template name="dbhtml-attribute">
63 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
64 <xsl:with-param name="attribute" select="'table-summary'"/>
65 </xsl:call-template></xsl:variable>
66
67 <xsl:variable name="cellspacing"><xsl:call-template name="dbhtml-attribute">
68 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
69 <xsl:with-param name="attribute" select="'cellspacing'"/>
70 </xsl:call-template></xsl:variable>
71
72 <xsl:variable name="cellpadding"><xsl:call-template name="dbhtml-attribute">
73 <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/>
74 <xsl:with-param name="attribute" select="'cellpadding'"/>
75 </xsl:call-template></xsl:variable>
76
77 <table class = "table">
78 <xsl:choose>
79 <xsl:when test="../textobject/phrase">
80 <xsl:attribute name="summary">
81 <xsl:value-of select="../textobject/phrase"/>
82 </xsl:attribute>
83 </xsl:when><xsl:when test="$summary != ''">
84 <xsl:attribute name="summary">
85 <xsl:value-of select="$summary"/>
86 </xsl:attribute>
87 </xsl:when><xsl:when test="../title">
88 <xsl:attribute name="summary">
89 <xsl:value-of select="string(../title)"/>
90 </xsl:attribute>
91 </xsl:when>
92 <xsl:otherwise/>
93 </xsl:choose><xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
94 <xsl:attribute name="cellspacing"><xsl:choose>
95 <xsl:when test="$cellspacing != ''"><xsl:value-of select="$cellspacing"/></xsl:when>
96 <xsl:otherwise><xsl:value-of select="$html.cellspacing"/></xsl:otherwise>
97 </xsl:choose></xsl:attribute>
98 </xsl:if><xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
99 <xsl:attribute name="cellpadding"><xsl:choose>
100 <xsl:when test="$cellpadding != ''"><xsl:value-of select="$cellpadding"/></xsl:when>
101 <xsl:otherwise><xsl:value-of select="$html.cellpadding"/></xsl:otherwise>
102 </xsl:choose></xsl:attribute>
103 </xsl:if><xsl:if test="../@pgwide=1">
104 <xsl:attribute name="width">100%</xsl:attribute>
105 </xsl:if>
106
107 <xsl:variable name="colgroup">
108 <colgroup><xsl:call-template name="generate.colgroup">
109 <xsl:with-param name="cols" select="@cols"/>
110 </xsl:call-template></colgroup>
111 </xsl:variable>
112
113 <xsl:variable name="explicit.table.width"><xsl:call-template name="dbhtml-attribute">
114 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/>
115 <xsl:with-param name="attribute" select="'table-width'"/>
116 </xsl:call-template></xsl:variable>
117
118 <xsl:variable name="table.width"><xsl:choose>
119 <xsl:when test="$explicit.table.width != ''">
120 <xsl:value-of select="$explicit.table.width"/>
121 </xsl:when><xsl:when test="$default.table.width = ''">
122 <xsl:text>100%</xsl:text>
123 </xsl:when><xsl:otherwise>
124 <xsl:value-of select="$default.table.width"/>
125 </xsl:otherwise>
126 </xsl:choose></xsl:variable>
127
128 <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
129 <xsl:attribute name="width"><xsl:choose>
130 <xsl:when test="contains($table.width, '%')">
131 <xsl:value-of select="$table.width"/>
132 </xsl:when><xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
133 <xsl:choose>
134 <xsl:when test="function-available('stbl:convertLength')">
135 <xsl:value-of select="stbl:convertLength($table.width)"/>
136 </xsl:when><xsl:when test="function-available('xtbl:convertLength')">
137 <xsl:value-of select="xtbl:convertLength($table.width)"/>
138 </xsl:when><xsl:otherwise>
139 <xsl:message terminate="yes">
140 <xsl:text>No convertLength function available.</xsl:text>
141 </xsl:message>
142 </xsl:otherwise>
143 </xsl:choose>
144 </xsl:when><xsl:otherwise>
145 <xsl:value-of select="$table.width"/>
146 </xsl:otherwise>
147 </xsl:choose></xsl:attribute>
148 </xsl:if>
149
150 <xsl:choose>
151 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
152 <xsl:choose>
153 <xsl:when test="function-available('stbl:adjustColumnWidths')">
154 <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
155 </xsl:when><xsl:when test="function-available('xtbl:adjustColumnWidths')">
156 <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
157 </xsl:when><xsl:when test="function-available('ptbl:adjustColumnWidths')">
158 <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
159 </xsl:when><xsl:otherwise>
160 <xsl:message terminate="yes">
161 <xsl:text>No adjustColumnWidths function available.</xsl:text>
162 </xsl:message>
163 </xsl:otherwise>
164 </xsl:choose>
165 </xsl:when><xsl:otherwise>
166 <xsl:copy-of select="$colgroup"/>
167 </xsl:otherwise>
168 </xsl:choose>
169
170 <xsl:apply-templates select="thead"/>
171 <xsl:apply-templates select="tfoot"/>
172 <xsl:apply-templates select="tbody"/>
173
174 <xsl:if test=".//footnote"><tbody class="footnotes">
175 <tr><td colspan="{@cols}">
176 <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
177 </td></tr>
178 </tbody></xsl:if>
179 </table>
180 </xsl:template>
181
182 <!-- table of contents
183
184 The standard Docbook template selects, amoung others,
185 the 'refentry' element for inclusion in TOC. In some
186 cases, this creates empty TOC. The most possible reason
187 is that there's 'refentry' element without 'refentrytitle',
188 but it's a mistery why it occurs. Even if we fix that
189 problem, we'll get non-empty TOC where no TOC is desired
190 (e.g. for section corresponding to each header file in
191 library doc). So, don't bother for now.
192 -->
193
194 <xsl:template name="section.toc">
195 <xsl:param name="toc-context" select="."/>
196 <xsl:param name="toc.title.p" select="true()"/>
197
198 <xsl:call-template name="make.toc">
199 <xsl:with-param name="toc-context" select="$toc-context"/>
200 <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
201 <xsl:with-param name="nodes" select="
202 section|sect1|sect2|sect3|sect4|sect5|
203 bridgehead[$bridgehead.in.toc != 0]
204 "/>
205 </xsl:call-template>
206 </xsl:template>
207
208 <!-- When there is both a title and a caption for a table, only use the
209 title. -->
210 <xsl:template match="table" mode="title.markup">
211 <xsl:param name="allow-anchors" select="0"/>
212 <xsl:apply-templates select="(title|caption)[1]" mode="title.markup">
213 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
214 </xsl:apply-templates>
215 </xsl:template>
216
217
218 <!-- Adds role class for section element resulting div. So that
219 we can style them in the resulting HTML.
220 Also, add the section id, if boost.section.class.add.id = 1.
221 This can be used to style individual sections differently. -->
222 <xsl:template match="section" mode="class.value">
223 <xsl:param name="class" select="local-name(.)"/>
224 <xsl:param name="node" select="."/>
225 <xsl:variable name="id">
226 <xsl:if test="$boost.section.class.add.id">
227 <xsl:call-template name="object.id">
228 <xsl:with-param name="object" select="$node"/>
229 </xsl:call-template>
230 </xsl:if>
231 </xsl:variable>
232 <xsl:value-of select="normalize-space(concat($class, ' ',
233 @role, ' ', translate($id, '.', '_')))"/>
234 </xsl:template>
235
236 <!-- Adds role class for simplesect element resulting div. So that
237 we can style them in the resulting HTML. -->
238 <xsl:template match="simplesect" mode="class.value">
239 <xsl:param name="class" select="local-name(.)"/>
240 <xsl:param name="node" select="."/>
241 <xsl:value-of select="normalize-space(concat($class,' ',@role))"/>
242 </xsl:template>
243
244 <!-- Allow for specifying that a section should not include the parents
245 labeling. This allows us to start clean numering of a sub-section. -->
246 <xsl:template match="section[@label-style='no-parent']" mode="label.markup">
247 <xsl:choose>
248 <xsl:when test="@label">
249 <xsl:value-of select="@label"/>
250 </xsl:when>
251 <xsl:when test="$label != 0">
252 <xsl:variable name="format">
253 <xsl:call-template name="autolabel.format">
254 <xsl:with-param name="format" select="$section.autolabel"/>
255 </xsl:call-template>
256 </xsl:variable>
257 <xsl:number format="{$format}" count="section"/>
258 </xsl:when>
259 </xsl:choose>
260 </xsl:template>
261
262 </xsl:stylesheet>