2 <!--#############################################################################
3 | $Id: synop-struct.mod.xsl,v 1.5 2003/10/19 07:56:56 j-devenish Exp $
4 |- #############################################################################
5 | $Author: j-devenish $
8 + ############################################################################## -->
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'
>
15 <xsl:template match=
"synopsis">
16 <xsl:call-template name=
"label.id"/>
17 <xsl:apply-templates/>
20 <xsl:template match=
"cmdsynopsis">
21 <xsl:call-template name=
"label.id"/>
22 <xsl:text> \begin{list}{}{\setlength{\itemindent}{-\leftmargin}\setlength{\parsep}{
0mm}}
</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>}
</xsl:text>
28 <xsl:text>\item\raggedright\texttt{
</xsl:text>
29 <xsl:apply-templates/>
30 <xsl:text>}
</xsl:text>
31 <xsl:text>\end{list}
</xsl:text>
35 <xsl:template match=
"cmdsynopsis/command">
36 <xsl:apply-templates />
40 <xsl:template match=
"cmdsynopsis//replaceable" priority=
"2">
41 <xsl:text>\textit{
</xsl:text>
42 <xsl:apply-templates />
43 <xsl:text>}
</xsl:text>
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">
52 <xsl:when test=
"ancestor-or-self::*/@sepchar">
53 <xsl:value-of select=
"ancestor-or-self::*/@sepchar"/>
56 <xsl:text> </xsl:text>
60 <xsl:if test=
"position()>1"><xsl:value-of select=
"$sepchar"/></xsl:if>
62 <xsl:when test=
"$choice='plain'">
63 <xsl:value-of select=
"$arg.choice.plain.open.str"/>
65 <xsl:when test=
"$choice='req'">
66 <xsl:value-of select=
"$arg.choice.req.open.str"/>
68 <xsl:when test=
"$choice='opt'">
69 <xsl:value-of select=
"$arg.choice.opt.open.str"/>
72 <xsl:value-of select=
"$arg.choice.def.open.str"/>
75 <xsl:apply-templates/>
77 <xsl:when test=
"$rep='repeat'">
78 <xsl:value-of select=
"$arg.rep.repeat.str"/>
80 <xsl:when test=
"$rep='norepeat'">
81 <xsl:value-of select=
"$arg.rep.norepeat.str"/>
84 <xsl:value-of select=
"$arg.rep.def.str"/>
88 <xsl:when test=
"$choice='plain'">
89 <xsl:value-of select=
"$arg.choice.plain.close.str"/>
91 <xsl:when test=
"$choice='req'">
92 <xsl:value-of select=
"$arg.choice.req.close.str"/>
94 <xsl:when test=
"$choice='opt'">
95 <xsl:value-of select=
"$arg.choice.opt.close.str"/>
98 <xsl:value-of select=
"$arg.choice.def.close.str"/>
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/>
110 <xsl:template match=
"sbr">
111 <xsl:text> </xsl:text>
114 <!-- ==================================================================== -->
116 <xsl:template match=
"synopfragmentref">
117 <!-- VAR target : -->
118 <xsl:variable name=
"target" select=
"key('id',@linkend)"/>
120 <xsl:variable name=
"snum">
121 <xsl:apply-templates select=
"$target" mode=
"synopfragment.number"/>
124 <xsl:text> {\em (
</xsl:text> <xsl:value-of select=
"$snum"/> <xsl:text>) }
</xsl:text>
127 <xsl:template match=
"synopfragment" mode=
"synopfragment.number">
128 <xsl:number format=
"1"/>
131 <xsl:template match=
"synopfragment">
132 <xsl:variable name=
"snum">
133 <xsl:apply-templates select=
"." mode=
"synopfragment.number"/>
137 <xsl:text>(
</xsl:text>
138 <xsl:value-of select=
"$snum"/>
139 <xsl:text>)
</xsl:text>
141 <xsl:text> </xsl:text>
142 <xsl:apply-templates/>
147 <xsl:template match=
"funcsynopsis">
148 <xsl:call-template name=
"informal.object"/>
152 <xsl:template match=
"funcsynopsisinfo">
153 <xsl:call-template name=
"verbatim.apply.templates"/>
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"/>
164 <xsl:template match=
"funcdef">
165 <xsl:apply-templates/>
168 <xsl:template match=
"funcdef/function">
170 <xsl:when test=
"$funcsynopsis.decoration != 0">
171 <xsl:text>\textbf{
</xsl:text><xsl:apply-templates/><xsl:text> }
</xsl:text>
174 <xsl:apply-templates/>
180 <xsl:template match=
"void">
182 <xsl:when test=
"$funcsynopsis.style='ansi'">
183 <xsl:text>(void);
</xsl:text>
186 <xsl:text>();
</xsl:text>
191 <xsl:template match=
"varargs">
192 <xsl:text>( ... );
</xsl:text>
195 <xsl:template match=
"paramdef">
196 <!-- VAR paramnum -->
197 <xsl:variable name=
"paramnum"> <xsl:number count=
"paramdef" format=
"1"/> </xsl:variable>
199 <xsl:if test=
"$paramnum=1">(
</xsl:if>
201 <xsl:when test=
"$funcsynopsis.style='ansi'">
202 <xsl:apply-templates/>
205 <xsl:apply-templates select=
"./parameter"/>
209 <xsl:when test=
"following-sibling::paramdef">
210 <xsl:text>,
</xsl:text>
213 <xsl:text>);
</xsl:text>
220 <xsl:template match=
"paramdef/parameter">
222 <xsl:when test=
"$funcsynopsis.decoration != 0">
223 <xsl:apply-templates/>
226 <xsl:apply-templates/>
229 <xsl:if test=
"following-sibling::parameter">
230 <xsl:text>,
</xsl:text>
236 <xsl:template match=
"paramdef" mode=
"kr-funcsynopsis-mode">
238 <xsl:apply-templates/>
239 <xsl:text>;
</xsl:text>
242 <xsl:template match=
"funcparams">
243 <xsl:text>(
</xsl:text>
244 <xsl:apply-templates/>
245 <xsl:text>)
</xsl:text>