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