]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/html/formal.xsl
Capitalized the start of a sentence in the bucket section of cataloging.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / html / formal.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 version='1.0'>
4
5 <!-- ********************************************************************
6      $Id: formal.xsl 8310 2009-03-11 08:29:45Z bobstayton $
7      ********************************************************************
8
9      This file is part of the XSL DocBook Stylesheet distribution.
10      See ../README or http://docbook.sf.net/release/xsl/current/ for
11      copyright and other information.
12
13      ******************************************************************** -->
14
15 <xsl:param name="formal.object.break.after">1</xsl:param>
16
17 <xsl:template name="formal.object">
18   <xsl:param name="placement" select="'before'"/>
19   <xsl:param name="class">
20     <xsl:apply-templates select="." mode="class.value"/>
21   </xsl:param>
22
23   <xsl:call-template name="id.warning"/>
24
25   <xsl:variable name="content">
26     <div class="{$class}">
27       <xsl:call-template name="anchor">
28         <xsl:with-param name="conditional" select="0"/>
29       </xsl:call-template>
30     
31       <xsl:choose>
32         <xsl:when test="$placement = 'before'">
33           <xsl:call-template name="formal.object.heading"/>
34           <div class="{$class}-contents">
35             <xsl:apply-templates/>
36           </div>
37           <!-- HACK: This doesn't belong inside formal.object; it 
38                should be done by the table template, but I want 
39                the link to be inside the DIV, so... -->
40           <xsl:if test="local-name(.) = 'table'">
41             <xsl:call-template name="table.longdesc"/>
42           </xsl:if>
43     
44           <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
45         </xsl:when>
46         <xsl:otherwise>
47           <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
48           <div class="{$class}-contents"><xsl:apply-templates/></div>
49           <!-- HACK: This doesn't belong inside formal.object; it 
50                should be done by the table template, but I want 
51                the link to be inside the DIV, so... -->
52           <xsl:if test="local-name(.) = 'table'">
53             <xsl:call-template name="table.longdesc"/>
54           </xsl:if>
55     
56           <xsl:call-template name="formal.object.heading"/>
57         </xsl:otherwise>
58       </xsl:choose>
59     </div>
60     <xsl:if test="not($formal.object.break.after = '0')">
61       <br class="{$class}-break"/>
62     </xsl:if>
63   </xsl:variable>
64
65   <xsl:variable name="floatstyle">
66     <xsl:call-template name="floatstyle"/>
67   </xsl:variable>
68
69   <xsl:choose>
70     <xsl:when test="$floatstyle != ''">
71       <xsl:call-template name="floater">
72         <xsl:with-param name="class"><xsl:value-of 
73                      select="$class"/>-float</xsl:with-param>
74         <xsl:with-param name="floatstyle" select="$floatstyle"/>
75         <xsl:with-param name="content" select="$content"/>
76       </xsl:call-template>
77     </xsl:when>
78     <xsl:otherwise>
79       <xsl:copy-of select="$content"/>
80     </xsl:otherwise>
81   </xsl:choose>
82
83 </xsl:template>
84
85 <xsl:template name="formal.object.heading">
86   <xsl:param name="object" select="."/>
87   <xsl:param name="title">
88     <xsl:apply-templates select="$object" mode="object.title.markup">
89       <xsl:with-param name="allow-anchors" select="1"/>
90     </xsl:apply-templates>
91   </xsl:param>
92
93   <p class="title">
94     <b>
95       <xsl:copy-of select="$title"/>
96     </b>
97   </p>
98 </xsl:template>
99
100 <xsl:template name="informal.object">
101   <xsl:param name="class" select="local-name(.)"/>
102
103   <xsl:variable name="content">
104     <div class="{$class}">
105       <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
106       <xsl:call-template name="anchor"/>
107       <xsl:apply-templates/>
108   
109       <!-- HACK: This doesn't belong inside formal.object; it 
110            should be done by the table template, but I want 
111            the link to be inside the DIV, so... -->
112       <xsl:if test="local-name(.) = 'informaltable'">
113         <xsl:call-template name="table.longdesc"/>
114       </xsl:if>
115   
116       <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
117     </div>
118   </xsl:variable>
119
120   <xsl:variable name="floatstyle">
121     <xsl:call-template name="floatstyle"/>
122   </xsl:variable>
123
124   <xsl:choose>
125     <xsl:when test="$floatstyle != ''">
126       <xsl:call-template name="floater">
127         <xsl:with-param name="class"><xsl:value-of 
128                      select="$class"/>-float</xsl:with-param>
129         <xsl:with-param name="floatstyle" select="$floatstyle"/>
130         <xsl:with-param name="content" select="$content"/>
131       </xsl:call-template>
132     </xsl:when>
133     <xsl:otherwise>
134       <xsl:copy-of select="$content"/>
135     </xsl:otherwise>
136   </xsl:choose>
137
138 </xsl:template>
139
140 <xsl:template name="semiformal.object">
141   <xsl:param name="placement" select="'before'"/>
142   <xsl:param name="class" select="local-name(.)"/>
143
144   <xsl:choose>
145     <xsl:when test="title">
146       <xsl:call-template name="formal.object">
147         <xsl:with-param name="placement" select="$placement"/>
148         <xsl:with-param name="class" select="$class"/>
149       </xsl:call-template>
150     </xsl:when>
151     <xsl:otherwise>
152       <xsl:call-template name="informal.object">
153         <xsl:with-param name="class" select="$class"/>
154       </xsl:call-template>
155     </xsl:otherwise>
156   </xsl:choose>
157 </xsl:template>
158
159 <xsl:template match="figure">
160   <xsl:variable name="param.placement"
161                 select="substring-after(normalize-space($formal.title.placement),
162                                         concat(local-name(.), ' '))"/>
163
164   <xsl:variable name="placement">
165     <xsl:choose>
166       <xsl:when test="contains($param.placement, ' ')">
167         <xsl:value-of select="substring-before($param.placement, ' ')"/>
168       </xsl:when>
169       <xsl:when test="$param.placement = ''">before</xsl:when>
170       <xsl:otherwise>
171         <xsl:value-of select="$param.placement"/>
172       </xsl:otherwise>
173     </xsl:choose>
174   </xsl:variable>
175
176   <xsl:call-template name="formal.object">
177     <xsl:with-param name="placement" select="$placement"/>
178   </xsl:call-template>
179
180 </xsl:template>
181
182 <xsl:template match="table">
183   <xsl:choose>
184     <xsl:when test="tgroup|mediaobject|graphic">
185       <xsl:call-template name="calsTable"/>
186     </xsl:when>
187     <xsl:otherwise>
188       <!-- do not use xsl:copy because of XHTML's needs -->
189       <xsl:element name="table" namespace="">
190         <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
191         <xsl:attribute name="id">
192           <xsl:call-template name="object.id"/>
193         </xsl:attribute>
194         <xsl:call-template name="htmlTable"/>
195       </xsl:element>
196     </xsl:otherwise>
197   </xsl:choose>
198 </xsl:template>
199
200 <xsl:template name="calsTable">
201   <xsl:if test="tgroup/tbody/tr
202                 |tgroup/thead/tr
203                 |tgroup/tfoot/tr">
204     <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
205   </xsl:if>
206
207   <xsl:variable name="param.placement"
208                 select="substring-after(normalize-space($formal.title.placement),
209                                         concat(local-name(.), ' '))"/>
210
211   <xsl:variable name="placement">
212     <xsl:choose>
213       <xsl:when test="contains($param.placement, ' ')">
214         <xsl:value-of select="substring-before($param.placement, ' ')"/>
215       </xsl:when>
216       <xsl:when test="$param.placement = ''">before</xsl:when>
217       <xsl:otherwise>
218         <xsl:value-of select="$param.placement"/>
219       </xsl:otherwise>
220     </xsl:choose>
221   </xsl:variable>
222
223   <xsl:call-template name="formal.object">
224     <xsl:with-param name="placement" select="$placement"/>
225     <xsl:with-param name="class">
226       <xsl:choose>
227         <xsl:when test="@tabstyle">
228           <!-- hack, this will only ever occur on table, not example -->
229           <xsl:value-of select="@tabstyle"/>
230         </xsl:when>
231         <xsl:otherwise>
232           <xsl:value-of select="local-name(.)"/>
233         </xsl:otherwise>
234       </xsl:choose>
235     </xsl:with-param>
236   </xsl:call-template>
237 </xsl:template>
238
239 <xsl:template name="htmlTable">
240   <xsl:if test="tgroup/tbody/row
241                 |tgroup/thead/row
242                 |tgroup/tfoot/row">
243     <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
244   </xsl:if>
245
246   <xsl:apply-templates mode="htmlTable"/>
247 </xsl:template>
248
249 <xsl:template match="example">
250   <xsl:variable name="param.placement"
251              select="substring-after(normalize-space($formal.title.placement),
252                      concat(local-name(.), ' '))"/>
253
254   <xsl:variable name="placement">
255     <xsl:choose>
256       <xsl:when test="contains($param.placement, ' ')">
257         <xsl:value-of select="substring-before($param.placement, ' ')"/>
258       </xsl:when>
259       <xsl:when test="$param.placement = ''">before</xsl:when>
260       <xsl:otherwise>
261         <xsl:value-of select="$param.placement"/>
262       </xsl:otherwise>
263     </xsl:choose>
264   </xsl:variable>
265
266   <xsl:call-template name="formal.object">
267     <xsl:with-param name="placement" select="$placement"/>
268   </xsl:call-template>
269
270 </xsl:template>
271
272 <xsl:template match="equation">
273   <xsl:variable name="param.placement"
274               select="substring-after(normalize-space($formal.title.placement),
275                                       concat(local-name(.), ' '))"/>
276
277   <xsl:variable name="placement">
278     <xsl:choose>
279       <xsl:when test="contains($param.placement, ' ')">
280         <xsl:value-of select="substring-before($param.placement, ' ')"/>
281       </xsl:when>
282       <xsl:when test="$param.placement = ''">before</xsl:when>
283       <xsl:otherwise>
284         <xsl:value-of select="$param.placement"/>
285       </xsl:otherwise>
286     </xsl:choose>
287   </xsl:variable>
288
289   <xsl:call-template name="formal.object">
290     <xsl:with-param name="placement" select="$placement"/>
291   </xsl:call-template>
292
293 </xsl:template>
294
295 <xsl:template match="figure/title"></xsl:template>
296 <xsl:template match="figure/titleabbrev"></xsl:template>
297 <xsl:template match="table/title"></xsl:template>
298 <xsl:template match="table/titleabbrev"></xsl:template>
299 <xsl:template match="table/textobject"></xsl:template>
300 <xsl:template match="example/title"></xsl:template>
301 <xsl:template match="example/titleabbrev"></xsl:template>
302 <xsl:template match="equation/title"></xsl:template>
303 <xsl:template match="equation/titleabbrev"></xsl:template>
304
305 <xsl:template match="informalfigure">
306   <xsl:call-template name="informal.object"/>
307 </xsl:template>
308
309 <xsl:template match="informalexample">
310   <xsl:call-template name="informal.object"/>
311 </xsl:template>
312
313 <xsl:template match="informaltable">
314   <xsl:choose>
315     <xsl:when test="tgroup|mediaobject|graphic">
316       <xsl:call-template name="informal.object">
317         <xsl:with-param name="class">
318           <xsl:choose>
319             <xsl:when test="@tabstyle">
320               <xsl:value-of select="@tabstyle"/>
321             </xsl:when>
322             <xsl:otherwise>
323               <xsl:value-of select="local-name(.)"/>
324             </xsl:otherwise>
325           </xsl:choose>
326         </xsl:with-param>
327       </xsl:call-template>
328     </xsl:when>
329     <xsl:otherwise>
330       <xsl:element name="table" namespace="">
331         <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
332         <xsl:attribute name="id">
333           <xsl:call-template name="object.id"/>
334         </xsl:attribute>
335         <xsl:call-template name="htmlTable"/>
336       </xsl:element>
337     </xsl:otherwise>
338   </xsl:choose>
339 </xsl:template>
340
341 <xsl:template match="informaltable/textobject"></xsl:template>
342
343 <xsl:template name="table.longdesc">
344   <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
345   <!-- the table template, but I want the link to be inside the DIV, so... -->
346   <xsl:variable name="longdesc.uri">
347     <xsl:call-template name="longdesc.uri">
348       <xsl:with-param name="mediaobject" select="."/>
349     </xsl:call-template>
350   </xsl:variable>
351
352   <xsl:variable name="irrelevant">
353     <!-- write.longdesc returns the filename ... -->
354     <xsl:call-template name="write.longdesc">
355       <xsl:with-param name="mediaobject" select="."/>
356     </xsl:call-template>
357   </xsl:variable>
358
359   <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
360                 and textobject[not(phrase)]">
361     <xsl:call-template name="longdesc.link">
362       <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
363     </xsl:call-template>
364   </xsl:if>
365 </xsl:template>
366
367 <xsl:template match="informalequation">
368   <xsl:call-template name="informal.object"/>
369 </xsl:template>
370
371 <xsl:template name="floatstyle">
372   <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
373     <xsl:choose>
374       <xsl:when test="@floatstyle != ''">
375         <xsl:value-of select="@floatstyle"/>
376       </xsl:when>
377       <xsl:when test="@float = '1'">
378         <xsl:value-of select="$default.float.class"/>
379       </xsl:when>
380       <xsl:otherwise>
381         <xsl:value-of select="@float"/>
382       </xsl:otherwise>
383     </xsl:choose>
384   </xsl:if>
385 </xsl:template>
386
387 <xsl:template name="floater">
388   <xsl:param name="content"/>
389   <xsl:param name="class" select="'float'"/>
390   <xsl:param name="floatstyle" select="'left'"/>
391
392   <div class="{$class}">
393     <xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
394       <xsl:attribute name="style">
395         <xsl:text>float: </xsl:text>
396         <xsl:value-of select="$floatstyle"/>
397         <xsl:text>;</xsl:text>
398       </xsl:attribute>
399     </xsl:if>
400     <xsl:copy-of select="$content"/>
401   </div>
402 </xsl:template>
403
404 </xsl:stylesheet>