Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / html / pi.xsl
blob51567eaad9a4894cd6899049ababb0d9fda30838
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
5 <!-- ********************************************************************
6 $Id: pi.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
7 ********************************************************************
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.
13 ******************************************************************** -->
15 <xsl:template match="processing-instruction()">
16 </xsl:template>
18 <xsl:template match="processing-instruction('dbhtml')">
19 <!-- nop -->
20 </xsl:template>
22 <!-- ==================================================================== -->
24 <xsl:template name="dbhtml-attribute">
25 <xsl:param name="pis" select="processing-instruction('dbhtml')"/>
26 <xsl:param name="attribute">filename</xsl:param>
28 <xsl:call-template name="pi-attribute">
29 <xsl:with-param name="pis" select="$pis"/>
30 <xsl:with-param name="attribute" select="$attribute"/>
31 </xsl:call-template>
32 </xsl:template>
34 <xsl:template name="dbhtml-filename">
35 <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
36 <xsl:call-template name="dbhtml-attribute">
37 <xsl:with-param name="pis" select="$pis"/>
38 <xsl:with-param name="attribute">filename</xsl:with-param>
39 </xsl:call-template>
40 </xsl:template>
42 <!--
43 <xsl:template name="dbhtml-dir">
44 <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
45 <xsl:call-template name="dbhtml-attribute">
46 <xsl:with-param name="pis" select="$pis"/>
47 <xsl:with-param name="attribute">dir</xsl:with-param>
48 </xsl:call-template>
49 </xsl:template>
50 -->
52 <xsl:template name="dbhtml-dir">
53 <xsl:param name="context" select="."/>
55 <!-- directories are now inherited from previous levels -->
57 <xsl:variable name="ppath">
58 <xsl:if test="$context/parent::*">
59 <xsl:call-template name="dbhtml-dir">
60 <xsl:with-param name="context" select="$context/parent::*"/>
61 </xsl:call-template>
62 </xsl:if>
63 </xsl:variable>
65 <xsl:variable name="path">
66 <xsl:call-template name="dbhtml-attribute">
67 <xsl:with-param name="pis" select="$context/processing-instruction('dbhtml')"/>
68 <xsl:with-param name="attribute">dir</xsl:with-param>
69 </xsl:call-template>
70 </xsl:variable>
72 <xsl:choose>
73 <xsl:when test="$path = ''">
74 <xsl:if test="$ppath != ''">
75 <xsl:value-of select="$ppath"/>
76 </xsl:if>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:if test="$ppath != ''">
80 <xsl:value-of select="$ppath"/>
81 <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
82 <xsl:text>/</xsl:text>
83 </xsl:if>
84 </xsl:if>
85 <xsl:value-of select="$path"/>
86 <xsl:text>/</xsl:text>
87 </xsl:otherwise>
88 </xsl:choose>
89 </xsl:template>
91 <!-- ==================================================================== -->
93 <xsl:template name="process.cmdsynopsis.list">
94 <xsl:param name="cmdsynopses"/><!-- empty node list by default -->
95 <xsl:param name="count" select="1"/>
97 <xsl:choose>
98 <xsl:when test="$count>count($cmdsynopses)"></xsl:when>
99 <xsl:otherwise>
100 <xsl:variable name="cmdsyn" select="$cmdsynopses[$count]"/>
102 <dt>
104 <xsl:attribute name="href">
105 <xsl:call-template name="object.id">
106 <xsl:with-param name="object" select="$cmdsyn"/>
107 </xsl:call-template>
108 </xsl:attribute>
110 <xsl:choose>
111 <xsl:when test="$cmdsyn/@xreflabel">
112 <xsl:call-template name="xref.xreflabel">
113 <xsl:with-param name="target" select="$cmdsyn"/>
114 </xsl:call-template>
115 </xsl:when>
116 <xsl:otherwise>
117 <xsl:apply-templates select="$cmdsyn" mode="xref-to">
118 <xsl:with-param name="target" select="$cmdsyn"/>
119 </xsl:apply-templates>
120 </xsl:otherwise>
121 </xsl:choose>
122 </a>
123 </dt>
125 <xsl:call-template name="process.cmdsynopsis.list">
126 <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
127 <xsl:with-param name="count" select="$count+1"/>
128 </xsl:call-template>
129 </xsl:otherwise>
130 </xsl:choose>
131 </xsl:template>
133 <xsl:template match="processing-instruction('dbcmdlist')">
134 <xsl:variable name="cmdsynopses" select="..//cmdsynopsis"/>
136 <xsl:if test="count($cmdsynopses)&lt;1">
137 <xsl:message><xsl:text>No cmdsynopsis elements matched dbcmdlist PI, perhaps it's nested too deep?</xsl:text>
138 </xsl:message>
139 </xsl:if>
141 <dl>
142 <xsl:call-template name="process.cmdsynopsis.list">
143 <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
144 </xsl:call-template>
145 </dl>
146 </xsl:template>
148 <!-- ==================================================================== -->
150 <xsl:template name="process.funcsynopsis.list">
151 <xsl:param name="funcsynopses"/><!-- empty node list by default -->
152 <xsl:param name="count" select="1"/>
154 <xsl:choose>
155 <xsl:when test="$count>count($funcsynopses)"></xsl:when>
156 <xsl:otherwise>
157 <xsl:variable name="cmdsyn" select="$funcsynopses[$count]"/>
159 <dt>
161 <xsl:attribute name="href">
162 <xsl:call-template name="object.id">
163 <xsl:with-param name="object" select="$cmdsyn"/>
164 </xsl:call-template>
165 </xsl:attribute>
167 <xsl:choose>
168 <xsl:when test="$cmdsyn/@xreflabel">
169 <xsl:call-template name="xref.xreflabel">
170 <xsl:with-param name="target" select="$cmdsyn"/>
171 </xsl:call-template>
172 </xsl:when>
173 <xsl:otherwise>
174 <xsl:apply-templates select="$cmdsyn" mode="xref-to">
175 <xsl:with-param name="target" select="$cmdsyn"/>
176 </xsl:apply-templates>
177 </xsl:otherwise>
178 </xsl:choose>
179 </a>
180 </dt>
182 <xsl:call-template name="process.funcsynopsis.list">
183 <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
184 <xsl:with-param name="count" select="$count+1"/>
185 </xsl:call-template>
186 </xsl:otherwise>
187 </xsl:choose>
188 </xsl:template>
190 <xsl:template match="processing-instruction('dbfunclist')">
191 <xsl:variable name="funcsynopses" select="..//funcsynopsis"/>
193 <xsl:if test="count($funcsynopses)&lt;1">
194 <xsl:message><xsl:text>No funcsynopsis elements matched dbfunclist PI, perhaps it's nested too deep?</xsl:text>
195 </xsl:message>
196 </xsl:if>
198 <dl>
199 <xsl:call-template name="process.funcsynopsis.list">
200 <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
201 </xsl:call-template>
202 </dl>
203 </xsl:template>
205 <!-- ==================================================================== -->
207 <!-- Copy well-formed external HTML content to the output. -->
208 <!-- An optional <html> wrapper will be removed before content is copied
209 to support multiple elements in output without a wrapper.
210 No other processing is done to the content. -->
211 <xsl:template match="processing-instruction('dbhtml-include')">
212 <xsl:param name="href">
213 <xsl:call-template name="dbhtml-attribute">
214 <xsl:with-param name="pis" select="."/>
215 <xsl:with-param name="attribute">href</xsl:with-param>
216 </xsl:call-template>
217 </xsl:param>
219 <xsl:choose>
220 <xsl:when test="$href != ''">
221 <xsl:variable name="content" select="document($href,/)"/>
222 <xsl:choose>
223 <xsl:when test="$content/*">
224 <xsl:choose>
225 <xsl:when test="$content/*[1][self::html]">
226 <!-- include just the children of html wrapper -->
227 <xsl:copy-of select="$content/*[1]/node()"/>
228 </xsl:when>
229 <xsl:otherwise>
230 <xsl:copy-of select="$content"/>
231 </xsl:otherwise>
232 </xsl:choose>
233 </xsl:when>
234 <xsl:otherwise>
235 <xsl:message>
236 <xsl:text>ERROR: dbhtml-include processing instruction </xsl:text>
237 <xsl:text>href has no content.</xsl:text>
238 </xsl:message>
239 </xsl:otherwise>
240 </xsl:choose>
241 </xsl:when>
242 <xsl:otherwise>
243 <xsl:message>
244 <xsl:text>ERROR: dbhtml-include processing instruction has </xsl:text>
245 <xsl:text>missing or empty href value.</xsl:text>
246 </xsl:message>
247 </xsl:otherwise>
248 </xsl:choose>
249 </xsl:template>
251 </xsl:stylesheet>