Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[tprouty/samba.git] / docs-xml / xslt / db2latex-xsl / xsl / synop-struct.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |       $Id: synop-struct.mod.xsl,v 1.5 2003/10/19 07:56:56 j-devenish Exp $
4 |- #############################################################################
5 |       $Author: j-devenish $
6 |                                                                                                               
7 |   PURPOSE:
8 + ############################################################################## -->
9
10 <xsl:stylesheet 
11     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
13     exclude-result-prefixes="doc" version='1.0'>
14
15         <xsl:template match="synopsis">
16         <xsl:call-template name="label.id"/>
17         <xsl:apply-templates/>
18         </xsl:template>
19
20         <xsl:template match="cmdsynopsis">
21         <xsl:call-template name="label.id"/>
22         <xsl:text>&#10;\begin{list}{}{\setlength{\itemindent}{-\leftmargin}\setlength{\parsep}{0mm}}&#10;</xsl:text>
23         <xsl:if test="@label!=''">
24                 <xsl:text>\item\textbf{</xsl:text>
25                 <xsl:call-template name="normalize-scape"><xsl:with-param name="string" select="@label"/></xsl:call-template>
26                 <xsl:text>}&#10;</xsl:text>
27         </xsl:if>
28         <xsl:text>\item\raggedright\texttt{</xsl:text>
29         <xsl:apply-templates/>
30         <xsl:text>}&#10;</xsl:text>
31         <xsl:text>\end{list}&#10;</xsl:text>
32         </xsl:template>
33
34
35         <xsl:template match="cmdsynopsis/command">
36         <xsl:apply-templates />
37         </xsl:template>
38
39
40         <xsl:template match="cmdsynopsis//replaceable" priority="2">
41         <xsl:text>\textit{</xsl:text>
42         <xsl:apply-templates />
43         <xsl:text>}</xsl:text>
44         </xsl:template>
45
46
47     <xsl:template match="group|arg">
48         <xsl:variable name="choice" select="@choice"/>
49         <xsl:variable name="rep" select="@rep"/>
50         <xsl:variable name="sepchar">
51             <xsl:choose>
52                 <xsl:when test="ancestor-or-self::*/@sepchar">
53                     <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
54                 </xsl:when>
55                 <xsl:otherwise>
56                     <xsl:text> </xsl:text>
57                 </xsl:otherwise>
58             </xsl:choose>
59         </xsl:variable>
60         <xsl:if test="position()>1"><xsl:value-of select="$sepchar"/></xsl:if>
61         <xsl:choose>
62             <xsl:when test="$choice='plain'">
63                 <xsl:value-of select="$arg.choice.plain.open.str"/>
64             </xsl:when>
65             <xsl:when test="$choice='req'">
66                 <xsl:value-of select="$arg.choice.req.open.str"/>
67             </xsl:when>
68             <xsl:when test="$choice='opt'">
69                 <xsl:value-of select="$arg.choice.opt.open.str"/>
70             </xsl:when>
71             <xsl:otherwise>
72                 <xsl:value-of select="$arg.choice.def.open.str"/>
73             </xsl:otherwise>
74         </xsl:choose>
75         <xsl:apply-templates/>
76         <xsl:choose>
77             <xsl:when test="$rep='repeat'">
78                 <xsl:value-of select="$arg.rep.repeat.str"/>
79             </xsl:when>
80             <xsl:when test="$rep='norepeat'">
81                 <xsl:value-of select="$arg.rep.norepeat.str"/>
82             </xsl:when>
83             <xsl:otherwise>
84                 <xsl:value-of select="$arg.rep.def.str"/>
85             </xsl:otherwise>
86         </xsl:choose>
87         <xsl:choose>
88             <xsl:when test="$choice='plain'">
89                 <xsl:value-of select="$arg.choice.plain.close.str"/>
90             </xsl:when>
91             <xsl:when test="$choice='req'">
92                 <xsl:value-of select="$arg.choice.req.close.str"/>
93             </xsl:when>
94             <xsl:when test="$choice='opt'">
95                 <xsl:value-of select="$arg.choice.opt.close.str"/>
96             </xsl:when>
97             <xsl:otherwise>
98                 <xsl:value-of select="$arg.choice.def.close.str"/>
99             </xsl:otherwise>
100         </xsl:choose>
101     </xsl:template>
102
103     <xsl:template match="group/arg">
104         <xsl:variable name="choice" select="@choice"/>
105         <xsl:variable name="rep" select="@rep"/>
106         <xsl:if test="position()>1"><xsl:value-of select="$arg.or.sep"/></xsl:if>
107         <xsl:apply-templates/>
108     </xsl:template>
109
110     <xsl:template match="sbr">
111         <xsl:text>&#10;</xsl:text>
112     </xsl:template>
113
114     <!-- ==================================================================== -->
115
116     <xsl:template match="synopfragmentref">
117         <!-- VAR target : -->
118         <xsl:variable name="target" select="key('id',@linkend)"/>
119         <!-- VAR snum : -->
120         <xsl:variable name="snum">
121             <xsl:apply-templates select="$target" mode="synopfragment.number"/>
122         </xsl:variable>
123
124         <xsl:text> {\em (</xsl:text> <xsl:value-of select="$snum"/> <xsl:text>) }</xsl:text>
125     </xsl:template>
126
127     <xsl:template match="synopfragment" mode="synopfragment.number">
128         <xsl:number format="1"/>
129     </xsl:template>
130
131     <xsl:template match="synopfragment">
132         <xsl:variable name="snum">
133             <xsl:apply-templates select="." mode="synopfragment.number"/>
134         </xsl:variable>
135         <p>
136             <a name="#{@id}">
137                 <xsl:text>(</xsl:text>
138                 <xsl:value-of select="$snum"/>
139                 <xsl:text>)</xsl:text>
140             </a>
141             <xsl:text> </xsl:text>
142             <xsl:apply-templates/>
143         </p>
144     </xsl:template>   
145
146
147     <xsl:template match="funcsynopsis">
148         <xsl:call-template name="informal.object"/>
149     </xsl:template>
150
151
152     <xsl:template match="funcsynopsisinfo">
153         <xsl:call-template name="verbatim.apply.templates"/>
154     </xsl:template>
155
156
157     <xsl:template match="funcprototype">
158         <xsl:apply-templates/>
159         <xsl:if test="$funcsynopsis.style='kr'">
160             <xsl:apply-templates select="./paramdef" mode="kr-funcsynopsis-mode"/>
161         </xsl:if>
162     </xsl:template>
163
164     <xsl:template match="funcdef">
165         <xsl:apply-templates/>
166     </xsl:template>
167
168     <xsl:template match="funcdef/function">
169         <xsl:choose>
170             <xsl:when test="$funcsynopsis.decoration != 0">
171                 <xsl:text>\textbf{ </xsl:text><xsl:apply-templates/><xsl:text> } </xsl:text>
172             </xsl:when>
173             <xsl:otherwise>
174                 <xsl:apply-templates/>
175             </xsl:otherwise>
176         </xsl:choose>
177     </xsl:template>
178
179
180     <xsl:template match="void">
181         <xsl:choose>
182             <xsl:when test="$funcsynopsis.style='ansi'">
183                 <xsl:text>(void);</xsl:text>
184             </xsl:when>
185             <xsl:otherwise>
186                 <xsl:text>();</xsl:text>
187             </xsl:otherwise>
188         </xsl:choose>
189     </xsl:template>
190
191     <xsl:template match="varargs">
192         <xsl:text>( ... );</xsl:text>
193     </xsl:template>
194
195     <xsl:template match="paramdef">
196         <!-- VAR paramnum -->
197         <xsl:variable name="paramnum"> <xsl:number count="paramdef" format="1"/> </xsl:variable>
198
199         <xsl:if test="$paramnum=1">(</xsl:if>
200         <xsl:choose>
201             <xsl:when test="$funcsynopsis.style='ansi'">
202                 <xsl:apply-templates/>
203             </xsl:when>
204             <xsl:otherwise>
205                 <xsl:apply-templates select="./parameter"/>
206             </xsl:otherwise>
207         </xsl:choose>
208         <xsl:choose>
209             <xsl:when test="following-sibling::paramdef">
210                 <xsl:text>, </xsl:text>
211             </xsl:when>
212             <xsl:otherwise>
213                 <xsl:text>);</xsl:text>
214             </xsl:otherwise>
215         </xsl:choose>
216     </xsl:template>
217
218
219
220     <xsl:template match="paramdef/parameter">
221         <xsl:choose>
222             <xsl:when test="$funcsynopsis.decoration != 0">
223                 <xsl:apply-templates/>
224             </xsl:when>
225             <xsl:otherwise>
226                 <xsl:apply-templates/>
227             </xsl:otherwise>
228         </xsl:choose>
229         <xsl:if test="following-sibling::parameter">
230             <xsl:text>, </xsl:text>
231         </xsl:if>
232     </xsl:template>
233
234
235
236     <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
237         \newline
238         <xsl:apply-templates/>
239         <xsl:text>;</xsl:text>
240     </xsl:template>
241
242     <xsl:template match="funcparams">
243         <xsl:text>(</xsl:text>
244         <xsl:apply-templates/>
245         <xsl:text>)</xsl:text>
246     </xsl:template>
247
248 </xsl:stylesheet>