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