Use system-provided dblatex to build the docs rather than included
[jra/samba/.git] / docs-xml / xslt / db2latex-xsl / xsl / lists.mod.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--############################################################################# 
4 |       $Id: lists.mod.xsl,v 1.25 2004/01/31 11:53:50 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="lists" xmlns="">
15                 <referenceinfo>
16                         <releaseinfo role="meta">
17                                 $Id: lists.mod.xsl,v 1.25 2004/01/31 11:53:50 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><year>2004</year>
25                                 <holder>Ramon Casellas</holder>
26                         </copyright>
27                         <revhistory>
28                                 <doc:revision rcasver="1.16">&rev_2003_05;</doc:revision>
29                         </revhistory>
30                 </referenceinfo>
31                 <title>Lists <filename>lists.mod.xsl</filename></title>
32                 <partintro>
33                         <para>
34                         
35                         
36                         
37                         </para>
38                 </partintro>
39         </doc:reference>
40
41         <doc:template xmlns="">
42                 <refpurpose>Process titles for <doc:db>variablelist</doc:db>, <doc:db>orderedlist</doc:db>, <doc:db>itemizedlist</doc:db> and <doc:db>simplelist</doc:db> elements</refpurpose>
43                 <doc:description>
44                         <para>
45                         
46                         Formats a title.
47                         
48                         </para>
49                 </doc:description>
50                 <doc:variables>
51                         <variablelist>
52                                 <varlistentry>
53                                         <term><xref linkend="param.latex.list.title.style"/></term>
54                                         <listitem><simpara>
55                                         The &LaTeX; command for formatting titles.
56                                         </simpara></listitem>
57                                 </varlistentry>
58                         </variablelist>
59                 </doc:variables>
60                 <doc:params>
61                         <variablelist>
62                                 <varlistentry>
63                                         <term>style</term>
64                                         <listitem><simpara>The &LaTeX; command to use. Defaults to
65                                         <xref linkend="param.latex.list.title.style"/>.</simpara></listitem>
66                                 </varlistentry>
67                         </variablelist>
68                 </doc:params>
69                 <doc:notes>
70                         <para>
71                                 Applies templates as a paragraph, formatted with the specified style.
72                         </para>
73                 </doc:notes>
74         </doc:template>
75         <xsl:template match="variablelist/title|orderedlist/title|itemizedlist/title|simplelist/title">
76                 <xsl:param name="style" select="$latex.list.title.style"/>
77                 <xsl:text>&#10;{</xsl:text>
78                 <xsl:value-of select="$style"/>
79                 <xsl:text>{</xsl:text>
80                 <xsl:apply-templates/>
81                 <xsl:text>}}&#10;</xsl:text>
82         </xsl:template>
83
84         <doc:template basename="listitem" xmlns="">
85                 <refpurpose>Process <doc:db>listitem</doc:db> elements</refpurpose>
86                 <doc:description>
87                         <para>
88                                 Formats a list item.
89                         </para>
90                 </doc:description>
91                 <doc:variables>
92                         &no_var;
93                 </doc:variables>
94                 <doc:notes>
95                         <para>
96                                 Applies templates within a &LaTeX; <function condition="latex">item</function>
97                                 command.
98                         </para>
99                 </doc:notes>
100         </doc:template>
101         <xsl:template match="listitem">
102                 <xsl:text>&#10;%--- Item&#10;</xsl:text>
103                 <xsl:text>\item </xsl:text>
104                 <xsl:apply-templates/>
105                 <xsl:text>&#10;</xsl:text>
106         </xsl:template>
107
108         <doc:template xmlns="">
109                 <refpurpose>Process <doc:db>itemizedlist</doc:db> elements</refpurpose>
110                 <doc:description>
111                         <para>
112                                 Formats an itemised list.
113                         </para>
114                 </doc:description>
115                 <doc:variables>
116                         <itemizedlist>
117                                 <listitem><simpara><xref linkend="param.latex.use.noindent"/></simpara></listitem>
118                         </itemizedlist>
119                 </doc:variables>
120                 <doc:notes>
121                         <para>
122                                 Applies templates. Uses a &LaTeX; <function condition="env">itemize</function>
123                                 environment.
124                         </para>
125                         <para>
126                                 The <sgmltag class="attribute">spacing</sgmltag>=<quote>compact</quote>
127                                 attribute is recognised.
128                         </para>
129                 </doc:notes>
130                 <doc:samples>
131                         <simplelist type='inline'>
132                                 &test_book;
133                                 &test_chemistry;
134                                 &test_lists;
135                         </simplelist>
136                 </doc:samples>
137         </doc:template>
138         <xsl:template match="itemizedlist">
139                 <xsl:apply-templates select="node()[not(self::listitem)]"/>
140                 <xsl:call-template name="compactlist.pre"/>
141                 <xsl:text>&#10;\begin{itemize}</xsl:text>
142                 <xsl:call-template name="compactlist.begin"/>
143                 <xsl:apply-templates select="listitem"/>
144                 <xsl:text>\end{itemize}&#10;</xsl:text>
145                 <xsl:call-template name="compactlist.post"/>
146         </xsl:template>
147
148         <doc:template xmlns="">
149                 <refpurpose>Process <doc:db>variablelist</doc:db> elements</refpurpose>
150                 <doc:description>
151                         <para>
152                                 Formats a list in which each item is denoted by a textual label.
153                         </para>
154                 </doc:description>
155                 <doc:variables>
156                         <itemizedlist>
157                                 <listitem><simpara><xref linkend="param.latex.use.noindent"/></simpara></listitem>
158                         </itemizedlist>
159                 </doc:variables>
160                 <doc:notes>
161                         <para>
162                                 Applies templates. Uses a &LaTeX; <function condition="env">description</function>
163                                 environment.
164                         </para>
165                 </doc:notes>
166                 <doc:samples>
167                         <simplelist type='inline'>
168                                 &test_bind;
169                                 &test_book;
170                                 &test_ddh;
171                                 &test_lists;
172                         </simplelist>
173                 </doc:samples>
174         </doc:template>
175         <xsl:template match="variablelist">
176                 <xsl:apply-templates select="node()[not(self::varlistentry)]"/>
177                 <xsl:text>&#10;\begin{description}&#10;</xsl:text>
178                 <xsl:apply-templates select="varlistentry"/>
179                 <xsl:text>\end{description}&#10;</xsl:text>
180                 <xsl:if test="$latex.use.noindent=1">
181                         <xsl:text>\noindent </xsl:text>
182                 </xsl:if>
183         </xsl:template>
184
185         <doc:template xmlns="">
186                 <refpurpose>Process <doc:db>orderedlist</doc:db> elements</refpurpose>
187                 <doc:description>
188                         <para>
189                                 Formats a list in which each item is denoted by a numeric label.
190                         </para>
191                 </doc:description>
192                 <doc:variables>
193                         <itemizedlist>
194                                 <listitem><simpara><xref linkend="param.latex.use.noindent"/></simpara></listitem>
195                         </itemizedlist>
196                 </doc:variables>
197                 <doc:notes>
198                         <para>The only &DocBook; attribute that is supported is <sgmltag class="attribute">numeration</sgmltag>.</para>
199                         <para>
200                                 Applies templates. Uses a &LaTeX; <function condition="env">enumerate</function>
201                                 environment.
202                         </para>
203                         <para>
204                                 The <sgmltag class="attribute">spacing</sgmltag>=<quote>compact</quote>
205                                 attribute is recognised.
206                         </para>
207                         <para>
208                                 The <sgmltag class="attribute">numeration</sgmltag> attribute
209                                 is recognised.
210                         </para>
211                 </doc:notes>
212                 <doc:samples>
213                         <simplelist type='inline'>
214                                 &test_book;
215                                 &test_chemistry;
216                         </simplelist>
217                 </doc:samples>
218         </doc:template>
219         <xsl:template match="orderedlist">
220                 <xsl:variable name="numeration">
221                         <xsl:choose>
222                                 <xsl:when test="@numeration">
223                                         <xsl:value-of select="@numeration"/>
224                                 </xsl:when>
225                                 <xsl:otherwise>
226                                         <xsl:value-of select="arabic"/>
227                                 </xsl:otherwise>
228                         </xsl:choose>
229                 </xsl:variable>
230                 <xsl:apply-templates select="node()[not(self::listitem)]"/>
231                 <xsl:call-template name="compactlist.pre"/>
232                 <xsl:text>&#10;\begin{enumerate}</xsl:text>
233                 <xsl:if test="@numeration">
234                         <xsl:choose>
235                         <xsl:when test="@numeration='arabic'">  <xsl:text>[1]</xsl:text>&#10;</xsl:when>
236                         <xsl:when test="@numeration='upperalpha'"><xsl:text>[A]</xsl:text>&#10;</xsl:when>
237                         <xsl:when test="@numeration='loweralpha'"><xsl:text>[a]</xsl:text>&#10;</xsl:when>
238                         <xsl:when test="@numeration='upperroman'"><xsl:text>[I]</xsl:text>&#10;</xsl:when>
239                         <xsl:when test="@numeration='lowerroman'"><xsl:text>[i]</xsl:text>&#10;</xsl:when>
240                         </xsl:choose>
241                 </xsl:if>
242                 <xsl:call-template name="compactlist.begin"/>
243                 <xsl:apply-templates select="listitem"/>
244                 <xsl:text>\end{enumerate}&#10;</xsl:text>
245                 <xsl:call-template name="compactlist.post"/>
246         </xsl:template>
247
248         <doc:template xmlns="">
249                 <refpurpose>Process <doc:db>varlistentry</doc:db> elements</refpurpose>
250                 <doc:description>
251                         <para>
252                                 Formats a labeled list item.
253                         </para>
254                 </doc:description>
255                 <doc:variables>
256                         &no_var;
257                 </doc:variables>
258                 <doc:notes>
259                         <para>
260                                 Applies templates within a &LaTeX; <function condition="latex">item</function>
261                                 command.
262                                 A comma is inserted between successive <doc:db basename="term">terms</doc:db>.
263                         </para>
264                         <para>
265                                 A &LaTeX; <function condition="latex">null{}</function> command is
266                                 inserted after the <function condition="latex">item</function> to
267                                 guard against empty <doc:db basename="listitem">listitems</doc:db>.
268                         </para>
269                 </doc:notes>
270         </doc:template>
271         <xsl:template match="varlistentry">
272                 <xsl:param name="object" select="listitem/*[1]"/>
273                 <xsl:param name="next.is.list">
274                         <xsl:value-of select="count($object[self::itemizedlist or self::orderedlist or self::variablelist])"/>
275                 </xsl:param>
276                 <xsl:variable name="id">
277                         <xsl:call-template name="label.id"/>
278                 </xsl:variable>
279                 <xsl:text>% \null and \mbox are tricks to induce different typesetting decisions&#10;</xsl:text>
280                 <xsl:text>\item[{</xsl:text>
281                 <xsl:for-each select="term">
282                         <xsl:apply-templates/>
283                         <xsl:if test="position()!=last()">
284                                 <xsl:text>, </xsl:text>
285                         </xsl:if>
286                 </xsl:for-each>
287                 <xsl:choose>
288                         <xsl:when test="$next.is.list=1">
289                                 <xsl:text>}]\mbox{}</xsl:text>
290                         </xsl:when>
291                         <xsl:otherwise>
292                                 <xsl:text>}]\null{}</xsl:text>
293                         </xsl:otherwise>
294                 </xsl:choose>
295                 <xsl:apply-templates select="listitem"/>
296         </xsl:template>
297
298         <doc:template basename="term" xmlns="">
299                 <refpurpose>Process <doc:db>varlistentry</doc:db>'s <doc:db>term</doc:db> elements</refpurpose>
300                 <doc:description>
301                         <para>
302                                 Applies templates.
303                         </para>
304                 </doc:description>
305                 <doc:variables>
306                         &no_var;
307                 </doc:variables>
308         </doc:template>
309         <xsl:template match="varlistentry/term">
310                 <xsl:apply-templates/><xsl:text>, </xsl:text>
311         </xsl:template>
312
313         <doc:template basename="listitem" xmlns="">
314                 <refpurpose>Process <doc:db>listitem</doc:db> elements</refpurpose>
315                 <doc:description>
316                         <para>
317                                 Applies templates.
318                         </para>
319                 </doc:description>
320                 <doc:variables>
321                         &no_var;
322                 </doc:variables>
323                 <doc:notes>
324                         <para>
325                                 Unlike <xref linkend="template.listitem"/>, the \item
326                                 has been output by the enclosing element's template.
327                         </para>
328                 </doc:notes>
329         </doc:template>
330         <xsl:template match="varlistentry/listitem">
331                 <xsl:apply-templates/>
332         </xsl:template>
333
334         <doc:template xmlns="">
335                 <refpurpose>Generate a <function condition="env">tabular</function> specification</refpurpose>
336                 <doc:description>
337                         <para>
338                         
339                         Produces a left-aligned tabular specification list.
340                         
341                         </para>
342                 </doc:description>
343                 <doc:variables>
344                         &no_var;
345                 </doc:variables>
346                 <doc:params>
347                         <variablelist>
348                                 <varlistentry>
349                                         <term>cols</term>
350                                         <listitem><simpara>The number of repetitions</simpara></listitem>
351                                 </varlistentry>
352                         </variablelist>
353                 </doc:params>
354         </doc:template>
355         <xsl:template name="generate.simplelist.tabular.string">
356                 <xsl:param name="cols" select="1"/>
357                 <xsl:param name="i" select="1"/>
358                 <xsl:choose>
359                         <xsl:when test="$i > $cols"></xsl:when>
360                         <xsl:otherwise>
361                         <xsl:text>l</xsl:text>
362                         <xsl:call-template name="generate.simplelist.tabular.string">
363                                 <xsl:with-param name="i" select="$i+1"/>
364                                 <xsl:with-param name="cols" select="$cols"/>
365                         </xsl:call-template>
366                         </xsl:otherwise>
367                 </xsl:choose>
368         </xsl:template>
369
370         <doc:template basename="simplelist" xmlns="">
371                 <refpurpose>Process <doc:db>simplelist</doc:db> elements with inline <doc:db basename="member">members</doc:db></refpurpose>
372                 <doc:description>
373                         <para>
374                         Formats a simple, comma-separated list for a <doc:db>simplelist</doc:db>
375                         that has a <sgmltag class="attribute">type</sgmltag> attribute equal to <quote>inline</quote>.
376                         </para>
377                 </doc:description>
378                 <doc:variables>
379                         &no_var;
380                 </doc:variables>
381                 <doc:notes>
382                         <para>
383                                 This is not made into a paragraph and is not temrinated by a full stop (<quote>period</quote>).
384                         </para>
385                 </doc:notes>
386         </doc:template>
387         <xsl:template match="simplelist[@type='inline']" name="generate.simplelist.inline">
388                 <xsl:for-each select="member">
389                         <xsl:apply-templates/>
390                         <xsl:if test="position()!=last()">
391                                 <xsl:text>, </xsl:text>
392                         </xsl:if>
393                 </xsl:for-each>
394         </xsl:template>
395
396         <doc:template basename="simplelist" xmlns="">
397                 <refpurpose>Process <doc:db>simplelist</doc:db> elements with <quote>horiz</quote> <doc:db basename="member">members</doc:db></refpurpose>
398                 <doc:description>
399                         <para>
400                         Formats a simple, comma-separated list for a <doc:db>simplelist</doc:db>
401                         that has a <sgmltag class="attribute">type</sgmltag> attribute equal to <quote>horiz</quote>.
402                         </para>
403                 </doc:description>
404                 <doc:variables>
405                         &no_var;
406                 </doc:variables>
407                 <doc:params>
408                         <variablelist>
409                                 <varlistentry>
410                                         <term>environment</term>
411                                         <listitem><simpara>The &LaTeX; tabular-like environment to use. Defaults to <quote>tabular</quote> unless <xref linkend="param.latex.use.ltxtable"/> or <xref linkend="param.latex.use.longtable"/> is enabled, in which case the default is <quote>longtable</quote>.</simpara></listitem>
412                                 </varlistentry>
413                                 <varlistentry>
414                                         <term>cols</term>
415                                         <listitem><simpara>The number of members per line (defaults to the value of the <sgmltag class="attribute">columns</sgmltag> attribute).</simpara></listitem>
416                                 </varlistentry>
417                         </variablelist>
418                 </doc:params>
419                 <doc:notes>
420                         <para>
421                                 This is formatted as a border-less &LaTeX; table.
422                         </para>
423                 </doc:notes>
424         </doc:template>
425         <xsl:template match="simplelist[@type='horiz']" name="generate.simplelist.horiz">
426                 <xsl:param name="environment">
427                         <xsl:choose>
428                                 <xsl:when test="$latex.use.ltxtable='1' or $latex.use.longtable='1'">
429                                         <xsl:text>longtable</xsl:text>
430                                 </xsl:when>
431                                 <xsl:otherwise>
432                                         <xsl:text>tabular</xsl:text>
433                                 </xsl:otherwise>
434                         </xsl:choose>
435                 </xsl:param>
436                 <xsl:param name="cols">
437                         <xsl:choose>
438                         <xsl:when test="@columns">
439                                 <xsl:value-of select="@columns"/>
440                         </xsl:when>
441                         <xsl:otherwise>1</xsl:otherwise>
442                         </xsl:choose>
443                 </xsl:param>
444                 <xsl:text>&#10;</xsl:text>
445                 <xsl:text>\begin{</xsl:text>
446                 <xsl:value-of select="$environment"/>
447                 <xsl:text>}{</xsl:text>
448                 <xsl:call-template name="generate.simplelist.tabular.string">
449                         <xsl:with-param name="cols" select="$cols"/>
450                 </xsl:call-template>
451                 <xsl:text>}&#10;</xsl:text>
452                 <xsl:call-template name="simplelist.horiz">
453                         <xsl:with-param name="cols" select="$cols"/>
454                 </xsl:call-template>
455                 <xsl:text>&#10;\end{</xsl:text>
456                 <xsl:value-of select="$environment"/>
457                 <xsl:text>}&#10;</xsl:text>
458         </xsl:template>
459
460     <xsl:template name="simplelist.horiz">
461         <xsl:param name="cols">1</xsl:param>
462         <xsl:param name="cell">1</xsl:param>
463         <xsl:param name="members" select="./member"/>
464         <xsl:if test="$cell &lt;= count($members)">
465             <xsl:text>&#10;</xsl:text> 
466             <xsl:call-template name="simplelist.horiz.row">
467                 <xsl:with-param name="cols" select="$cols"/>
468                 <xsl:with-param name="cell" select="$cell"/>
469                 <xsl:with-param name="members" select="$members"/>
470             </xsl:call-template>
471             <xsl:text> \\</xsl:text> 
472             <xsl:call-template name="simplelist.horiz">
473                 <xsl:with-param name="cols" select="$cols"/>
474                 <xsl:with-param name="cell" select="$cell + $cols"/>
475                 <xsl:with-param name="members" select="$members"/>
476             </xsl:call-template>
477         </xsl:if>
478     </xsl:template>
479
480     <xsl:template name="simplelist.horiz.row">
481         <xsl:param name="cols">1</xsl:param>
482         <xsl:param name="cell">1</xsl:param>
483         <xsl:param name="members" select="./member"/>
484         <xsl:param name="curcol">1</xsl:param>
485         <xsl:if test="$curcol &lt;= $cols">
486             <xsl:choose>
487                 <xsl:when test="$members[position()=$cell]">
488                     <xsl:apply-templates select="$members[position()=$cell]"/>
489                     <xsl:text> </xsl:text> 
490                     <xsl:if test="$curcol &lt; $cols">
491                         <xsl:call-template name="generate.latex.cell.separator"/>
492                     </xsl:if>
493                 </xsl:when>
494             </xsl:choose>
495             <xsl:call-template name="simplelist.horiz.row">
496                 <xsl:with-param name="cols" select="$cols"/>
497                 <xsl:with-param name="cell" select="$cell+1"/>
498                 <xsl:with-param name="members" select="$members"/>
499                 <xsl:with-param name="curcol" select="$curcol+1"/>
500             </xsl:call-template>
501         </xsl:if>
502     </xsl:template>
503
504         <doc:template basename="simplelist" xmlns="">
505                 <refpurpose>Process <doc:db>simplelist</doc:db> elements with <quote>vert</quote> <doc:db basename="member">members</doc:db></refpurpose>
506                 <doc:description>
507                         <para>
508                         Formats a simple, comma-separated list for a <doc:db>simplelist</doc:db>
509                         that has a <sgmltag class="attribute">type</sgmltag> attribute that is either
510                         empty or equal to <quote>vert</quote>.
511                         </para>
512                 </doc:description>
513                 <doc:variables>
514                         &no_var;
515                 </doc:variables>
516                 <doc:params>
517                         <variablelist>
518                                 <varlistentry>
519                                         <term>environment</term>
520                                         <listitem><simpara>The &LaTeX; tabular-like environment to use. Defaults to <quote>tabular</quote> unless <xref linkend="param.latex.use.ltxtable"/> or <xref linkend="param.latex.use.longtable"/> is set, in which case the default is <quote>longtable</quote>.</simpara></listitem>
521                                 </varlistentry>
522                                 <varlistentry>
523                                         <term>cols</term>
524                                         <listitem><simpara>The number of members per line (defaults to the value of the <sgmltag class="attribute">columns</sgmltag> attribute).</simpara></listitem>
525                                 </varlistentry>
526                         </variablelist>
527                 </doc:params>
528                 <doc:notes>
529                         <para>
530                                 This is formatted as a border-less &LaTeX; table.
531                         </para>
532                 </doc:notes>
533         </doc:template>
534         <xsl:template match="simplelist|simplelist[@type='vert']" name="generate.simplelist.vert">
535                 <xsl:param name="environment">
536                         <xsl:choose>
537                                 <xsl:when test="$latex.use.ltxtable='1' or $latex.use.longtable='1'">
538                                         <xsl:text>longtable</xsl:text>
539                                 </xsl:when>
540                                 <xsl:otherwise>
541                                         <xsl:text>tabular</xsl:text>
542                                 </xsl:otherwise>
543                         </xsl:choose>
544                 </xsl:param>
545                 <xsl:param name="cols">
546                         <xsl:choose>
547                         <xsl:when test="@columns">
548                                 <xsl:value-of select="@columns"/>
549                         </xsl:when>
550                         <xsl:otherwise>1</xsl:otherwise>
551                         </xsl:choose>
552                 </xsl:param>
553                 <xsl:text>&#10;</xsl:text>
554                 <xsl:text>\begin{</xsl:text>
555                 <xsl:value-of select="$environment"/>
556                 <xsl:text>}{</xsl:text>
557                 <xsl:call-template name="generate.simplelist.tabular.string">
558                         <xsl:with-param name="cols" select="$cols"/>
559                 </xsl:call-template>
560                 <xsl:text>}&#10;</xsl:text> 
561                 <xsl:call-template name="simplelist.vert">
562                         <xsl:with-param name="cols" select="$cols"/>
563                 </xsl:call-template>
564                 <xsl:text>&#10;\end{</xsl:text>
565                 <xsl:value-of select="$environment"/>
566                 <xsl:text>}&#10;</xsl:text>
567         </xsl:template>
568
569     <xsl:template name="simplelist.vert">
570         <xsl:param name="cols">1</xsl:param>
571         <xsl:param name="cell">1</xsl:param>
572         <xsl:param name="members" select="./member"/>
573         <xsl:param name="rows" select="floor((count($members)+$cols - 1) div $cols)"/>
574         <xsl:if test="$cell &lt;= $rows">
575             <xsl:text>&#10;</xsl:text> 
576             <xsl:call-template name="simplelist.vert.row">
577                 <xsl:with-param name="cols" select="$cols"/>
578                 <xsl:with-param name="rows" select="$rows"/>
579                 <xsl:with-param name="cell" select="$cell"/>
580                 <xsl:with-param name="members" select="$members"/>
581             </xsl:call-template>
582             <xsl:text> \\</xsl:text> 
583             <xsl:call-template name="simplelist.vert">
584                 <xsl:with-param name="cols" select="$cols"/>
585                 <xsl:with-param name="cell" select="$cell+1"/>
586                 <xsl:with-param name="members" select="$members"/>
587                 <xsl:with-param name="rows" select="$rows"/>
588             </xsl:call-template>
589         </xsl:if>
590     </xsl:template>
591
592     <xsl:template name="simplelist.vert.row">
593         <xsl:param name="cols">1</xsl:param>
594         <xsl:param name="rows">1</xsl:param>
595         <xsl:param name="cell">1</xsl:param>
596         <xsl:param name="members" select="./member"/>
597         <xsl:param name="curcol">1</xsl:param>
598         <xsl:if test="$curcol &lt;= $cols">
599             <xsl:choose>
600                 <xsl:when test="$members[position()=$cell]">
601                     <xsl:apply-templates select="$members[position()=$cell]"/>
602                     <xsl:text> </xsl:text> 
603                     <xsl:if test="$curcol &lt; $cols">
604                         <xsl:call-template name="generate.latex.cell.separator"/>
605                     </xsl:if>
606                 </xsl:when>
607                 <xsl:otherwise>
608                 </xsl:otherwise>
609             </xsl:choose>
610             <xsl:call-template name="simplelist.vert.row">
611                 <xsl:with-param name="cols" select="$cols"/>
612                 <xsl:with-param name="rows" select="$rows"/>
613                 <xsl:with-param name="cell" select="$cell+$rows"/>
614                 <xsl:with-param name="members" select="$members"/>
615                 <xsl:with-param name="curcol" select="$curcol+1"/>
616             </xsl:call-template>
617         </xsl:if>
618     </xsl:template>
619
620         <doc:template xmlns="">
621                 <refpurpose>Process <doc:db>member</doc:db> elements</refpurpose>
622                 <doc:description>
623                         <para>
624                         Applies templates.
625                         </para>
626                 </doc:description>
627                 <doc:variables>
628                         &no_var;
629                 </doc:variables>
630         </doc:template>
631         <xsl:template match="member">
632                 <xsl:apply-templates/>
633         </xsl:template>
634
635         <doc:template xmlns="">
636                 <refpurpose>Process <doc:db>segmentedlist</doc:db> elements</refpurpose>
637                 <doc:description>
638                         <para>
639                         Applies templates.
640                         </para>
641                 </doc:description>
642                 <doc:variables>
643                         &no_var;
644                 </doc:variables>
645                 <doc:samples>
646                         <simplelist type='inline'>
647                                 &test_book;
648                         </simplelist>
649                 </doc:samples>
650         </doc:template>
651         <xsl:template match="segmentedlist">
652                 <xsl:apply-templates select="title|titleabbrev"/>
653                 <xsl:apply-templates select="seglistitem"/>
654         </xsl:template>
655
656         <doc:template xmlns="">
657                 <refpurpose>Process titles for <doc:db>segmentedlist</doc:db> elements</refpurpose>
658                 <doc:description>
659                         <para>
660                         Formats a title as a paragraph.
661                         </para>
662                 </doc:description>
663                 <doc:variables>
664                         &no_var;
665                 </doc:variables>
666                 <doc:params>
667                         <variablelist>
668                                 <varlistentry>
669                                         <term>style</term>
670                                         <listitem><simpara>The &LaTeX; command to use.</simpara></listitem>
671                                 </varlistentry>
672                         </variablelist>
673                 </doc:params>
674                 <doc:notes>
675                         <para>
676                                 Applies templates as a paragraph, formatted with the specified style, and
677                                 terminated with a newline command.
678                         </para>
679                 </doc:notes>
680         </doc:template>
681         <xsl:template match="segmentedlist/title">
682                 <xsl:param name="style" select="$latex.list.title.style"/>
683                 <xsl:text>&#10;{</xsl:text>
684                 <xsl:value-of select="$style"/>
685                 <xsl:text>{</xsl:text>
686                 <xsl:apply-templates/>
687                 <xsl:text>}}\\&#10;</xsl:text>
688         </xsl:template>
689
690         <doc:template xmlns="">
691                 <refpurpose>Process <doc:db>segtitle</doc:db> elements</refpurpose>
692                 <doc:description>
693                         <para>
694                         Applies templates.
695                         </para>
696                 </doc:description>
697                 <doc:variables>
698                         &no_var;
699                 </doc:variables>
700         </doc:template>
701         <xsl:template match="segtitle">
702                 <xsl:apply-templates/>
703         </xsl:template>
704
705         <doc:template xmlns="">
706                 <refpurpose>Process <doc:db>seglistitem</doc:db> elements</refpurpose>
707                 <doc:description>
708                         <para>
709                                 Formats a segmented list item.
710                         </para>
711                 </doc:description>
712                 <doc:variables>
713                         &no_var;
714                 </doc:variables>
715                 <doc:notes>
716                         <para>Applies <doc:db>seg</doc:db> templates. Each item is separated by a &LaTeX;
717                         <function condition="latex">\</function> command.</para>
718                 </doc:notes>
719         </doc:template>
720         <xsl:template match="seglistitem">
721                 <xsl:apply-templates/>
722                 <xsl:choose>
723                         <xsl:when test="position()=last()"><xsl:text>&#10;&#10;</xsl:text></xsl:when>
724                         <xsl:otherwise><xsl:text> \\&#10;</xsl:text></xsl:otherwise>
725                 </xsl:choose>
726         </xsl:template>
727
728         <doc:template xmlns="">
729                 <refpurpose>Process <doc:db>seg</doc:db> elements</refpurpose>
730                 <doc:description>
731                         <para>
732                                 Formats a <doc:db>seg</doc:db> with its <doc:db>segtitle</doc:db>.
733                         </para>
734                 </doc:description>
735                 <doc:variables>
736                         <itemizedlist>
737                                 <listitem><simpara><xref linkend="param.latex.segtitle.style"/></simpara></listitem>
738                         </itemizedlist>
739                 </doc:variables>
740         </doc:template>
741         <xsl:template match="seg">
742                 <xsl:variable name="segnum" select="position()"/>
743                 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
744                 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
745
746                 <!--
747                 Note: segtitle is only going to be the right thing in a well formed
748                 SegmentedList.  If there are too many Segs or too few SegTitles,
749                 you'll get something odd...maybe an error
750                 -->
751
752                 <xsl:text> {</xsl:text>
753                 <xsl:value-of select="$latex.segtitle.style"/>
754                 <xsl:text>{</xsl:text>
755                 <xsl:apply-templates select="$segtitles[$segnum=position()]"/>
756                 <xsl:text>:}} </xsl:text>
757                 <xsl:apply-templates/>
758         </xsl:template>
759
760         <xsl:template name="compactlist.pre">
761                 <xsl:if test="@spacing='compact'">
762                         <xsl:if test="$latex.use.parskip=1">
763                                 <xsl:text>&#10;\docbooktolatexnoparskip</xsl:text>
764                         </xsl:if>
765                 </xsl:if>
766         </xsl:template>
767
768         <xsl:template name="compactlist.begin">
769                 <xsl:if test="@spacing='compact' and $latex.use.parskip!=1">
770                         <xsl:text>\setlength{\itemsep}{-0.25em}&#10;</xsl:text>
771                 </xsl:if>
772         </xsl:template>
773
774         <xsl:template name="compactlist.post">
775                 <xsl:if test="@spacing='compact' and $latex.use.parskip=1">
776                         <xsl:text>\docbooktolatexrestoreparskip&#10;</xsl:text>
777                 </xsl:if>
778                 <xsl:if test="$latex.use.noindent=1">
779                         <xsl:text>\noindent </xsl:text>
780                 </xsl:if>
781         </xsl:template>
782
783 </xsl:stylesheet>