1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version='1.0'>
4
5<!-- ********************************************************************
6     $Id$
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See /README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<xsl:template match="processing-instruction()">
16</xsl:template>
17
18<!-- ==================================================================== -->
19
20<xsl:template name="dbfo-attribute">
21  <xsl:param name="pis" select="processing-instruction('dbfo')"/>
22  <xsl:param name="attribute">filename</xsl:param>
23  <xsl:param name="count">1</xsl:param>
24
25  <xsl:choose>
26    <xsl:when test="$count>count($pis)">
27      <!-- not found -->
28    </xsl:when>
29    <xsl:otherwise>
30      <xsl:variable name="pi">
31        <xsl:value-of select="$pis[$count]"/>
32      </xsl:variable>
33      <xsl:choose>
34        <xsl:when test="contains($pi,concat($attribute, '='))">
35          <xsl:variable name="rest" select="substring-after($pi,concat($attribute,'='))"/>
36          <xsl:variable name="quote" select="substring($rest,1,1)"/>
37          <xsl:value-of select="substring-before(substring($rest,2),$quote)"/>
38        </xsl:when>
39        <xsl:otherwise>
40          <xsl:call-template name="dbfo-attribute">
41            <xsl:with-param name="pis" select="$pis"/>
42            <xsl:with-param name="attribute" select="$attribute"/>
43            <xsl:with-param name="count" select="$count + 1"/>
44          </xsl:call-template>
45        </xsl:otherwise>
46      </xsl:choose>
47    </xsl:otherwise>
48  </xsl:choose>
49</xsl:template>
50
51<xsl:template name="dbfo-filename">
52  <xsl:param name="pis" select="/processing-instruction('dbfo')"/>
53  <xsl:call-template name="dbfo-attribute">
54    <xsl:with-param name="pis" select="$pis"/>
55    <xsl:with-param name="attribute">filename</xsl:with-param>
56  </xsl:call-template>
57</xsl:template>
58
59<xsl:template name="dbfo-dir">
60  <xsl:param name="pis" select="/processing-instruction('dbfo')"/>
61  <xsl:call-template name="dbfo-attribute">
62    <xsl:with-param name="pis" select="$pis"/>
63    <xsl:with-param name="attribute">dir</xsl:with-param>
64  </xsl:call-template>
65</xsl:template>
66
67<!-- ==================================================================== -->
68
69<xsl:template name="process.cmdsynopsis.list">
70  <xsl:param name="cmdsynopses"/><!-- empty node list by default -->
71  <xsl:param name="count" select="1"/>
72
73  <xsl:choose>
74    <xsl:when test="$count>count($cmdsynopses)"></xsl:when>
75    <xsl:otherwise>
76      <xsl:variable name="cmdsyn" select="$cmdsynopses[$count]"/>
77
78       <dt>
79       <a>
80         <xsl:attribute name="href">
81           <xsl:call-template name="object.id">
82             <xsl:with-param name="object" select="$cmdsyn"/>
83           </xsl:call-template>
84         </xsl:attribute>
85
86         <xsl:choose>
87           <xsl:when test="$cmdsyn/@xreflabel">
88             <xsl:call-template name="xref.xreflabel">
89               <xsl:with-param name="target" select="$cmdsyn"/>
90             </xsl:call-template>
91           </xsl:when>
92           <xsl:otherwise>
93             <xsl:apply-templates select="$cmdsyn" mode="xref-to">
94               <xsl:with-param name="target" select="$cmdsyn"/>
95             </xsl:apply-templates>
96           </xsl:otherwise>
97         </xsl:choose>
98       </a>
99       </dt>
100
101        <xsl:call-template name="process.cmdsynopsis.list">
102          <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
103          <xsl:with-param name="count" select="$count+1"/>
104        </xsl:call-template>
105      </xsl:otherwise>
106    </xsl:choose>
107</xsl:template>
108
109<xsl:template match="processing-instruction('dbcmdlist')">
110  <xsl:variable name="cmdsynopses" select="..//cmdsynopsis"/>
111
112  <xsl:if test="count($cmdsynopses)&lt;1">
113    <xsl:message><xsl:text>No cmdsynopsis elements matched dbcmdlist PI, perhaps it's nested too deep?</xsl:text>
114    </xsl:message>
115  </xsl:if>
116
117  <dl>
118    <xsl:call-template name="process.cmdsynopsis.list">
119      <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
120    </xsl:call-template>
121  </dl>
122</xsl:template>
123
124<!-- ==================================================================== -->
125
126<xsl:template name="process.funcsynopsis.list">
127  <xsl:param name="funcsynopses"/><!-- empty node list by default -->
128  <xsl:param name="count" select="1"/>
129
130  <xsl:choose>
131    <xsl:when test="$count>count($funcsynopses)"></xsl:when>
132    <xsl:otherwise>
133      <xsl:variable name="cmdsyn" select="$funcsynopses[$count]"/>
134
135       <dt>
136       <a>
137         <xsl:attribute name="href">
138           <xsl:call-template name="object.id">
139             <xsl:with-param name="object" select="$cmdsyn"/>
140           </xsl:call-template>
141         </xsl:attribute>
142
143         <xsl:choose>
144           <xsl:when test="$cmdsyn/@xreflabel">
145             <xsl:call-template name="xref.xreflabel">
146               <xsl:with-param name="target" select="$cmdsyn"/>
147             </xsl:call-template>
148           </xsl:when>
149           <xsl:otherwise>
150              <xsl:apply-templates select="$cmdsyn" mode="xref-to">
151                <xsl:with-param name="target" select="$cmdsyn"/>
152              </xsl:apply-templates>
153           </xsl:otherwise>
154         </xsl:choose>
155       </a>
156       </dt>
157
158        <xsl:call-template name="process.funcsynopsis.list">
159          <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
160          <xsl:with-param name="count" select="$count+1"/>
161        </xsl:call-template>
162      </xsl:otherwise>
163    </xsl:choose>
164</xsl:template>
165
166<xsl:template match="processing-instruction('dbfunclist')">
167  <xsl:variable name="funcsynopses" select="..//funcsynopsis"/>
168
169  <xsl:if test="count($funcsynopses)&lt;1">
170    <xsl:message><xsl:text>No funcsynopsis elements matched dbfunclist PI, perhaps it's nested too deep?</xsl:text>
171    </xsl:message>
172  </xsl:if>
173
174  <dl>
175    <xsl:call-template name="process.funcsynopsis.list">
176      <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
177    </xsl:call-template>
178  </dl>
179</xsl:template>
180
181<!-- ==================================================================== -->
182
183</xsl:stylesheet>
184