Next update of VFS modules development guide
[ira/wip.git] / docs / xslt / db2latex-xsl / xsl / refentry.mod.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--############################################################################# 
4 |       $Id: refentry.mod.xsl,v 1.7 2004/01/14 14:54:32 j-devenish Exp $
5 |- #############################################################################
6 |       $Author: j-devenish $
7 + ############################################################################## -->
8
9 <xsl:stylesheet
10         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11         xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
12         exclude-result-prefixes="doc" version='1.0'>
13
14         <doc:reference id="refentry" xmlns="">
15                 <referenceinfo>
16                         <releaseinfo role="meta">
17                                 $Id: refentry.mod.xsl,v 1.7 2004/01/14 14:54:32 j-devenish Exp $
18                         </releaseinfo>
19                         <authorgroup>
20                                 &ramon;
21                                 &james;
22                         </authorgroup>
23                         <copyright>
24                                 <year>2000</year><year>2001</year><year>2002</year><year>2003</year>
25                                 <holder>Ramon Casellas</holder>
26                         </copyright>
27                         <revhistory>
28                                 <doc:revision rcasver="1.5">&rev_2003_05;</doc:revision>
29                         </revhistory>
30                 </referenceinfo>
31                 <title>References and Entries <filename>refentry.mod.xsl</filename></title>
32                 <partintro>
33                         <para>The file <filename>refentry.mod.xsl</filename> contains
34                         XSL templates for <doc:db basename="reference">references</doc:db>.</para>
35                 </partintro>
36         </doc:reference>
37
38         <doc:template xmlns="">
39                 <refpurpose>Process <doc:db>reference</doc:db> elements</refpurpose>
40                 <doc:description>
41                         <para>
42                                 Invokes the mapping templates and applies content templates.
43                         </para>
44                 </doc:description>
45                 <doc:variables>
46                         &no_var;
47                 </doc:variables>
48                 <doc:seealso>
49                         <itemizedlist>
50                                 <listitem><simpara>&mapping;</simpara></listitem>
51                                 <listitem><simpara><xref linkend="template.content-templates"/></simpara></listitem>
52                         </itemizedlist>
53                 </doc:seealso>
54         </doc:template>
55         <xsl:template match="reference">
56                 <xsl:call-template name="map.begin"/>
57                 <xsl:call-template name="content-templates"/>
58                 <xsl:call-template name="map.end"/>
59         </xsl:template>
60
61         <doc:template xmlns="">
62                 <refpurpose>Process <doc:db>refentry</doc:db> elements</refpurpose>
63                 <doc:description>
64                         <para>
65                                 Invokes the mapping templates and applies content templates.
66                         </para>
67                 </doc:description>
68                 <doc:variables>
69                         &no_var;
70                 </doc:variables>
71                 <doc:seealso>
72                         <itemizedlist>
73                                 <listitem><simpara>&mapping;</simpara></listitem>
74                                 <listitem><simpara><xref linkend="template.content-templates"/></simpara></listitem>
75                         </itemizedlist>
76                 </doc:seealso>
77         </doc:template>
78         <xsl:template match="refentry">
79                 <xsl:variable name="refmeta" select=".//refmeta"/>
80                 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
81                 <xsl:variable name="refnamediv" select=".//refnamediv"/>
82                 <xsl:variable name="refname" select="$refnamediv//refname"/>
83                 <xsl:variable name="title">
84                         <xsl:choose>
85                         <xsl:when test="$refentrytitle">
86                                 <xsl:apply-templates select="$refentrytitle[1]"/>
87                         </xsl:when>
88                         <xsl:when test="$refname">
89                                 <xsl:apply-templates select="$refname[1]"/>
90                                 <xsl:apply-templates select="$refnamediv//refpurpose"/>
91                         </xsl:when>
92                         </xsl:choose>
93                 </xsl:variable>
94                 <xsl:call-template name="map.begin">
95                         <xsl:with-param name="string" select="$title"/>
96                 </xsl:call-template>
97                 <xsl:call-template name="content-templates"/>
98                 <xsl:call-template name="map.end">
99                         <xsl:with-param name="string" select="$title"/>
100                 </xsl:call-template>
101         </xsl:template>
102
103         <doc:template xmlns="">
104                 <refpurpose>Process <doc:db>refentry</doc:db> elements</refpurpose>
105                 <doc:description>
106                         <para>
107                                 Suppresses <doc:db basename="refentry">refentries</doc:db>.
108                         </para>
109                 </doc:description>
110                 <doc:variables>
111                         &no_var;
112                 </doc:variables>
113         </doc:template>
114         <xsl:template match="refmeta"/>
115
116         <doc:template xmlns="">
117                 <refpurpose>Process <doc:db>refentrytitle</doc:db> elements</refpurpose>
118                 <doc:description>
119                         <para>
120                                 Format a reference entry title.
121                         </para>
122                 </doc:description>
123                 <doc:variables>
124                         &no_var;
125                 </doc:variables>
126                 <doc:notes>
127                         <para>
128                                 This template uses <literal>inline.charseq</literal>,
129                                 though I'm not sure if this should be changed to
130                                 a single <literal>apply-templates</literal>.
131                         </para>
132                 </doc:notes>
133                 <doc:seealso>
134                         <itemizedlist>
135                                 <listitem><simpara><xref linkend="template.inline.charseq"/></simpara></listitem>
136                         </itemizedlist>
137                 </doc:seealso>
138         </doc:template>
139         <xsl:template match="refentrytitle">
140                 <xsl:call-template name="inline.charseq"/>
141         </xsl:template>
142
143         <!--
144         <xsl:template match="refnamediv">
145                 <xsl:call-template name="block.object"/>
146         </xsl:template>
147         -->
148
149         <doc:template xmlns="">
150                 <refpurpose>Process <doc:db>manvolnum</doc:db> elements</refpurpose>
151                 <doc:description>
152                         <para>
153                                 Format a reference volume number.
154                         </para>
155                 </doc:description>
156                 <doc:variables>
157                         <itemizedlist>
158                                 <listitem><simpara><xref linkend="param.refentry.xref.manvolnum"/></simpara></listitem>
159                         </itemizedlist>
160                 </doc:variables>
161                 <doc:notes>
162                         <para>
163                                 If <xref linkend="param.refentry.xref.manvolnum"/> is set,
164                                 this template will apply templates. Otherwise, no output
165                                 is produced.
166                         </para>
167                 </doc:notes>
168         </doc:template>
169         <xsl:template match="manvolnum">
170                 <xsl:if test="$refentry.xref.manvolnum != 0">
171                         <xsl:text>(</xsl:text>
172                         <xsl:apply-templates/>
173                         <xsl:text>)</xsl:text>
174                 </xsl:if>
175         </xsl:template>
176
177         <doc:template xmlns="">
178                 <refpurpose>Process <doc:db>refnamediv</doc:db> elements</refpurpose>
179                 <doc:description>
180                         <para>
181                                 Format a reference header.
182                         </para>
183                 </doc:description>
184                 <doc:variables>
185                         &no_var;
186                 </doc:variables>
187                 <doc:description>
188                         <para>
189                                 Calls <xref linkend="template.block.object"/>.
190                         </para>
191                 </doc:description>
192                 <doc:seealso>
193                         <itemizedlist>
194                                 <listitem><simpara><xref linkend="template.block.object"/></simpara></listitem>
195                         </itemizedlist>
196                 </doc:seealso>
197         </doc:template>
198         <xsl:template match="refnamediv">
199                 <xsl:call-template name="block.object"/>
200         </xsl:template>
201
202         <doc:template xmlns="">
203                 <refpurpose>Process <doc:db>refname</doc:db> elements</refpurpose>
204                 <doc:description>
205                         <para>
206                                 Formats a <doc:db>refname</doc:db> as a start-of-section
207                                 for a <doc:db>refentry</doc:db>.
208                         </para>
209                 </doc:description>
210                 <doc:variables>
211                         <itemizedlist>
212                                 <listitem><simpara><xref linkend="param.refentry.generate.name"/></simpara></listitem>
213                         </itemizedlist>
214                 </doc:variables>
215                 <doc:notes>
216                         <para>Will commence a &LaTeX; <function
217                         condition="latex">section</function> if necessary.</para>
218                         <para>Designed to accommodate multiple <doc:db>refname</doc:db>s in
219                         a single <doc:db>refentry</doc:db>.</para>
220                         <para>The use of a comma between multiple <doc:db>refname</doc:db>s
221                         should probably be localised.</para>
222                 </doc:notes>
223                 <doc:seealso>
224                         <itemizedlist>
225                                 <listitem><simpara>&mapping;</simpara></listitem>
226                         </itemizedlist>
227                 </doc:seealso>
228         </doc:template>
229         <xsl:template match="refname">
230                 <xsl:if test="not (preceding-sibling::refname)">
231                         <xsl:text>&#10;\section*{</xsl:text>
232                         <xsl:if test="$refentry.generate.name != 0">
233                         <xsl:call-template name="gentext.element.name"/>
234                         </xsl:if>
235                         <xsl:text>}&#10;</xsl:text>
236                 </xsl:if>
237                 <xsl:apply-templates/>
238                 <xsl:if test="following-sibling::refname">
239                         <xsl:text>, </xsl:text>
240                 </xsl:if>
241         </xsl:template>
242
243         <doc:template xmlns="">
244                 <refpurpose>Process <doc:db>refpurpose</doc:db> elements</refpurpose>
245                 <doc:description>
246                         <para>
247                                 Formats a <doc:db>refpurpose</doc:db>.
248                         </para>
249                 </doc:description>
250                 <doc:variables>
251                         &no_var;
252                 </doc:variables>
253                 <doc:notes>
254                         <para>Outputs an em dash and then applies templates.</para>
255                 </doc:notes>
256         </doc:template>
257         <xsl:template match="refpurpose">
258                 <xsl:text> --- </xsl:text>
259                 <xsl:apply-templates/>
260         </xsl:template>
261
262         <doc:template xmlns="">
263                 <refpurpose>Process <doc:db>refdescriptor</doc:db> elements</refpurpose>
264                 <doc:description>
265                         <para>
266                                 Formats a <doc:db>refdescriptor</doc:db>.
267                         </para>
268                 </doc:description>
269                 <doc:variables>
270                         &no_var;
271                 </doc:variables>
272                 <doc:notes>
273                         <para>Suppressed.</para>
274                 </doc:notes>
275         </doc:template>
276         <xsl:template match="refdescriptor">
277                 <!-- todo: finish this -->
278         </xsl:template>
279
280         <doc:template xmlns="">
281                 <refpurpose>Process <doc:db>refclass</doc:db> elements</refpurpose>
282                 <doc:description>
283                         <para>
284                                 Formats a <doc:db>refclass</doc:db>.
285                         </para>
286                 </doc:description>
287                 <doc:variables>
288                         &no_var;
289                 </doc:variables>
290                 <doc:notes>
291                         <para>Applies templates. If the role attribute is not empty,
292                         it will be output prior to content, separated by a colon.</para>
293                 </doc:notes>
294         </doc:template>
295         <xsl:template match="refclass">
296                 <xsl:if test="@role!=''">
297                         <xsl:value-of select="@role"/>
298                         <xsl:text>: </xsl:text>
299                 </xsl:if>
300                 <xsl:apply-templates/>
301         </xsl:template>
302
303         <doc:template xmlns="">
304                 <refpurpose>Process <doc:db>refsynopsisdiv</doc:db> elements</refpurpose>
305                 <doc:description>
306                         <para>
307                                 Formats a <doc:db>refsynopsisdiv</doc:db> as an unnumbered subsection.
308                         </para>
309                 </doc:description>
310                 <doc:variables>
311                         &no_var;
312                 </doc:variables>
313         </doc:template>
314         <xsl:template match="refsynopsisdiv">
315                 <xsl:call-template name="label.id"/>
316                 <xsl:text>&#10;\subsection*{Synopsis}&#10;</xsl:text>
317                 <xsl:call-template name="content-templates"/>
318         </xsl:template>
319
320         <doc:template xmlns="">
321                 <refpurpose>Process <sgmltag>refsect</sgmltag> elements</refpurpose>
322                 <doc:description>
323                         <para>
324                                 Invokes the mapping templates and applies content templates.
325                         </para>
326                 </doc:description>
327                 <doc:variables>
328                         &no_var;
329                 </doc:variables>
330                 <doc:seealso>
331                         <itemizedlist>
332                                 <listitem><simpara>&mapping;</simpara></listitem>
333                                 <listitem><simpara><xref linkend="template.content-templates"/></simpara></listitem>
334                         </itemizedlist>
335                 </doc:seealso>
336         </doc:template>
337         <xsl:template match="refsect1|refsect2|refsect3">
338                 <xsl:call-template name="map.begin"/>
339                 <xsl:call-template name="content-templates"/>
340                 <xsl:call-template name="map.end"/>
341         </xsl:template>
342
343 </xsl:stylesheet>