Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/boostbook/xsl/docbook-layout.xsl @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 8.9 KB
Line 
1<?xml version = "1.0" encoding = "utf-8"?>
2
3<xsl:stylesheet version = "1.0"
4   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
5>
6  <!-- needed for calsTable template -->
7 
8  <xsl:import
9    href="http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl"/>
10
11  <!--
12     Override the behaviour of some DocBook elements for better
13     integration with the new look & feel.
14  -->
15
16  <xsl:template match = "programlisting[ancestor::informaltable]">
17     <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
18  </xsl:template>
19
20  <xsl:template match = "refsynopsisdiv">
21     <h2 class = "{name(.)}-title">Synopsis</h2>
22     <div class = "{name(.)}"><xsl:apply-templates/></div>
23  </xsl:template>
24
25  <!-- table: remove border = '1' -->
26
27  <xsl:template match = "table|informaltable">
28     <xsl:choose>
29        <xsl:when test = "self::table and tgroup|mediaobject|graphic">
30           <xsl:apply-imports/>
31        </xsl:when><xsl:when test = "self::informaltable and tgroup|mediaobject|graphic">
32           <xsl:call-template name = "informal.object">
33              <xsl:with-param name = "class"><xsl:choose>
34                 <xsl:when test = "@tabstyle">
35                    <xsl:value-of select = "@tabstyle"/>
36                 </xsl:when><xsl:otherwise>
37                    <xsl:value-of select = "local-name(.)"/>
38                 </xsl:otherwise>
39              </xsl:choose></xsl:with-param>
40           </xsl:call-template>
41        </xsl:when><xsl:otherwise>
42           <table class = "table"><xsl:copy-of select = "@*[not(local-name(.)='border')]"/>
43              <xsl:call-template name = "htmlTable"/>
44           </table>
45        </xsl:otherwise>
46     </xsl:choose>
47  </xsl:template>
48
49  <xsl:template match = "tgroup" name = "tgroup">
50     <xsl:variable name="summary"><xsl:call-template name="dbhtml-attribute">
51        <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
52        <xsl:with-param name="attribute" select="'table-summary'"/>
53     </xsl:call-template></xsl:variable>
54
55     <xsl:variable name="cellspacing"><xsl:call-template name="dbhtml-attribute">
56        <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
57        <xsl:with-param name="attribute" select="'cellspacing'"/>
58     </xsl:call-template></xsl:variable>
59
60     <xsl:variable name="cellpadding"><xsl:call-template name="dbhtml-attribute">
61        <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/>
62        <xsl:with-param name="attribute" select="'cellpadding'"/>
63     </xsl:call-template></xsl:variable>
64
65     <table class = "table">
66        <xsl:choose>
67           <xsl:when test="../textobject/phrase">
68              <xsl:attribute name="summary">
69                 <xsl:value-of select="../textobject/phrase"/>
70              </xsl:attribute>
71           </xsl:when><xsl:when test="$summary != ''">
72              <xsl:attribute name="summary">
73                 <xsl:value-of select="$summary"/>
74              </xsl:attribute>
75           </xsl:when><xsl:when test="../title">
76              <xsl:attribute name="summary">
77                 <xsl:value-of select="string(../title)"/>
78              </xsl:attribute>
79           </xsl:when>
80           <xsl:otherwise/>
81        </xsl:choose><xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
82           <xsl:attribute name="cellspacing"><xsl:choose>
83              <xsl:when test="$cellspacing != ''"><xsl:value-of select="$cellspacing"/></xsl:when>
84              <xsl:otherwise><xsl:value-of select="$html.cellspacing"/></xsl:otherwise>
85           </xsl:choose></xsl:attribute>
86        </xsl:if><xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
87           <xsl:attribute name="cellpadding"><xsl:choose>
88              <xsl:when test="$cellpadding != ''"><xsl:value-of select="$cellpadding"/></xsl:when>
89              <xsl:otherwise><xsl:value-of select="$html.cellpadding"/></xsl:otherwise>
90           </xsl:choose></xsl:attribute>
91        </xsl:if><xsl:if test="../@pgwide=1">
92           <xsl:attribute name="width">100%</xsl:attribute>
93        </xsl:if>
94
95        <xsl:variable name="colgroup">
96           <colgroup><xsl:call-template name="generate.colgroup">
97              <xsl:with-param name="cols" select="@cols"/>
98           </xsl:call-template></colgroup>
99        </xsl:variable>
100
101        <xsl:variable name="explicit.table.width"><xsl:call-template name="dbhtml-attribute">
102           <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/>
103           <xsl:with-param name="attribute" select="'table-width'"/>
104        </xsl:call-template></xsl:variable>
105
106        <xsl:variable name="table.width"><xsl:choose>
107           <xsl:when test="$explicit.table.width != ''">
108              <xsl:value-of select="$explicit.table.width"/>
109           </xsl:when><xsl:when test="$default.table.width = ''">
110              <xsl:text>100%</xsl:text>
111           </xsl:when><xsl:otherwise>
112              <xsl:value-of select="$default.table.width"/>
113           </xsl:otherwise>
114        </xsl:choose></xsl:variable>
115
116        <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
117           <xsl:attribute name="width"><xsl:choose>
118              <xsl:when test="contains($table.width, '%')">
119                 <xsl:value-of select="$table.width"/>
120              </xsl:when><xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
121                 <xsl:choose>
122                    <xsl:when test="function-available('stbl:convertLength')">
123                       <xsl:value-of select="stbl:convertLength($table.width)"/>
124                    </xsl:when><xsl:when test="function-available('xtbl:convertLength')">
125                       <xsl:value-of select="xtbl:convertLength($table.width)"/>
126                    </xsl:when><xsl:otherwise>
127                       <xsl:message terminate="yes">
128                          <xsl:text>No convertLength function available.</xsl:text>
129                       </xsl:message>
130                    </xsl:otherwise>
131                 </xsl:choose>
132              </xsl:when><xsl:otherwise>
133                 <xsl:value-of select="$table.width"/>
134              </xsl:otherwise>
135           </xsl:choose></xsl:attribute>
136        </xsl:if>
137
138        <xsl:choose>
139           <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
140              <xsl:choose>
141                 <xsl:when test="function-available('stbl:adjustColumnWidths')">
142                    <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
143                 </xsl:when><xsl:when test="function-available('xtbl:adjustColumnWidths')">
144                    <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
145                 </xsl:when><xsl:when test="function-available('ptbl:adjustColumnWidths')">
146                    <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
147                 </xsl:when><xsl:otherwise>
148                    <xsl:message terminate="yes">
149                       <xsl:text>No adjustColumnWidths function available.</xsl:text>
150                    </xsl:message>
151                 </xsl:otherwise>
152              </xsl:choose>
153           </xsl:when><xsl:otherwise>
154              <xsl:copy-of select="$colgroup"/>
155           </xsl:otherwise>
156        </xsl:choose>
157
158        <xsl:apply-templates select="thead"/>
159        <xsl:apply-templates select="tfoot"/>
160        <xsl:apply-templates select="tbody"/>
161
162        <xsl:if test=".//footnote"><tbody class="footnotes">
163           <tr><td colspan="{@cols}">
164              <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
165           </td></tr>
166        </tbody></xsl:if>
167     </table>
168  </xsl:template>
169
170  <!-- table of contents
171       
172    The standard Docbook template selects, amoung others,
173    the 'refentry' element for inclusion in TOC. In some
174    cases, this creates empty TOC. The most possible reason
175    is that there's 'refentry' element without 'refentrytitle',
176    but it's a mistery why it occurs. Even if we fix that
177    problem, we'll get non-empty TOC where no TOC is desired
178    (e.g. for section corresponding to each header file in
179    library doc). So, don't bother for now.
180  -->
181
182  <xsl:template name="section.toc">
183     <xsl:param name="toc-context" select="."/>
184     <xsl:param name="toc.title.p" select="true()"/>
185
186     <xsl:call-template name="make.toc">
187        <xsl:with-param name="toc-context" select="$toc-context"/>
188        <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
189        <xsl:with-param name="nodes" select="
190           section|sect1|sect2|sect3|sect4|sect5|
191           bridgehead[$bridgehead.in.toc != 0]
192        "/>
193     </xsl:call-template>
194  </xsl:template>
195
196  <!-- When there is both a title and a caption for a table, only use the
197       title. -->
198  <xsl:template match="table" mode="title.markup">
199    <xsl:param name="allow-anchors" select="0"/>
200    <xsl:apply-templates select="(title|caption)[1]" mode="title.markup">
201      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
202    </xsl:apply-templates>
203  </xsl:template>
204</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.