source: trunk/Distribution/XSL/xhtml/qandaset.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 11.8 KB
Line 
1<?xml version="1.0" encoding="US-ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets. Do not edit this file.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc" version="1.0">
5
6<!-- ********************************************************************
7 $Id: qandaset.xsl,v 1.19 2003/09/27 22:01:59 nwalsh Exp $
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 and other information.
13
14 ******************************************************************** -->
15
16<!-- ==================================================================== -->
17
18<xsl:template match="qandaset">
19 <xsl:variable name="title" select="(blockinfo/title|title)[1]"/>
20 <xsl:variable name="preamble" select="*[name(.) != 'title' and name(.) != 'titleabbrev' and name(.) != 'qandadiv' and name(.) != 'qandaentry']"/>
21 <xsl:variable name="label-width">
22 <xsl:call-template name="dbhtml-attribute">
23 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
24 <xsl:with-param name="attribute" select="'label-width'"/>
25 </xsl:call-template>
26 </xsl:variable>
27
28 <xsl:variable name="table-summary">
29 <xsl:call-template name="dbhtml-attribute">
30 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
31 <xsl:with-param name="attribute" select="'table-summary'"/>
32 </xsl:call-template>
33 </xsl:variable>
34
35 <xsl:variable name="cellpadding">
36 <xsl:call-template name="dbhtml-attribute">
37 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
38 <xsl:with-param name="attribute" select="'cellpadding'"/>
39 </xsl:call-template>
40 </xsl:variable>
41
42 <xsl:variable name="cellspacing">
43 <xsl:call-template name="dbhtml-attribute">
44 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
45 <xsl:with-param name="attribute" select="'cellspacing'"/>
46 </xsl:call-template>
47 </xsl:variable>
48
49 <xsl:variable name="toc">
50 <xsl:call-template name="dbhtml-attribute">
51 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
52 <xsl:with-param name="attribute" select="'toc'"/>
53 </xsl:call-template>
54 </xsl:variable>
55
56 <xsl:variable name="toc.params">
57 <xsl:call-template name="find.path.params">
58 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
59 </xsl:call-template>
60 </xsl:variable>
61
62 <div class="{name(.)}">
63 <xsl:apply-templates select="$title"/>
64 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
65 <xsl:call-template name="process.qanda.toc"/>
66 </xsl:if>
67 <xsl:apply-templates select="$preamble"/>
68 <table border="0" summary="Q and A Set">
69 <xsl:if test="$table-summary != ''">
70 <xsl:attribute name="summary">
71 <xsl:value-of select="$table-summary"/>
72 </xsl:attribute>
73 </xsl:if>
74
75 <xsl:if test="$cellpadding != ''">
76 <xsl:attribute name="cellpadding">
77 <xsl:value-of select="$cellpadding"/>
78 </xsl:attribute>
79 </xsl:if>
80
81 <xsl:if test="$cellspacing != ''">
82 <xsl:attribute name="cellspacing">
83 <xsl:value-of select="$cellspacing"/>
84 </xsl:attribute>
85 </xsl:if>
86
87 <col align="left">
88 <xsl:attribute name="width">
89 <xsl:choose>
90 <xsl:when test="$label-width != ''">
91 <xsl:value-of select="$label-width"/>
92 </xsl:when>
93 <xsl:otherwise>1%</xsl:otherwise>
94 </xsl:choose>
95 </xsl:attribute>
96 </col>
97 <tbody>
98 <xsl:apply-templates select="qandaentry|qandadiv"/>
99 </tbody>
100 </table>
101 </div>
102</xsl:template>
103
104<xsl:template match="qandaset/blockinfo/title|qandaset/title">
105 <xsl:variable name="qalevel">
106 <xsl:call-template name="qanda.section.level"/>
107 </xsl:variable>
108 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
109 <xsl:attribute name="class">
110 <xsl:value-of select="name(.)"/>
111 </xsl:attribute>
112 <xsl:apply-templates/>
113 </xsl:element>
114</xsl:template>
115
116<xsl:template match="qandaset/blockinfo">
117 <!-- what should this template really do? -->
118 <xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
119</xsl:template>
120
121<xsl:template match="qandadiv">
122 <xsl:variable name="preamble" select="*[name(.) != 'title' and name(.) != 'titleabbrev' and name(.) != 'qandadiv' and name(.) != 'qandaentry']"/>
123
124 <xsl:if test="blockinfo/title|title">
125 <tr class="qandadiv">
126 <td align="left" valign="top" colspan="2">
127 <xsl:call-template name="anchor">
128 <xsl:with-param name="conditional" select="0"/>
129 </xsl:call-template>
130 <xsl:apply-templates select="(blockinfo/title|title)[1]"/>
131 </td>
132 </tr>
133 </xsl:if>
134
135 <xsl:variable name="toc">
136 <xsl:call-template name="dbhtml-attribute">
137 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
138 <xsl:with-param name="attribute" select="'toc'"/>
139 </xsl:call-template>
140 </xsl:variable>
141
142 <xsl:variable name="toc.params">
143 <xsl:call-template name="find.path.params">
144 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
145 </xsl:call-template>
146 </xsl:variable>
147
148 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
149 <tr class="toc" colspan="2">
150 <td align="left" valign="top" colspan="2">
151 <xsl:call-template name="process.qanda.toc"/>
152 </td>
153 </tr>
154 </xsl:if>
155 <xsl:if test="$preamble">
156 <tr class="toc" colspan="2">
157 <td align="left" valign="top" colspan="2">
158 <xsl:apply-templates select="$preamble"/>
159 </td>
160 </tr>
161 </xsl:if>
162 <xsl:apply-templates select="qandadiv|qandaentry"/>
163</xsl:template>
164
165<xsl:template match="qandadiv/blockinfo/title|qandadiv/title">
166 <xsl:variable name="qalevel">
167 <xsl:call-template name="qandadiv.section.level"/>
168 </xsl:variable>
169
170 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
171 <xsl:attribute name="class">
172 <xsl:value-of select="name(.)"/>
173 </xsl:attribute>
174 <xsl:call-template name="anchor">
175 <xsl:with-param name="node" select=".."/>
176 <xsl:with-param name="conditional" select="0"/>
177 </xsl:call-template>
178 <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
179 <xsl:if test="$qandadiv.autolabel != 0">
180 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
181 <xsl:text> </xsl:text>
182 </xsl:if>
183 <xsl:apply-templates/>
184 </xsl:element>
185</xsl:template>
186
187<xsl:template match="qandaentry">
188 <xsl:apply-templates/>
189</xsl:template>
190
191<xsl:template match="question">
192 <xsl:variable name="deflabel">
193 <xsl:choose>
194 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
195 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
196 </xsl:when>
197 <xsl:otherwise>
198 <xsl:value-of select="$qanda.defaultlabel"/>
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:variable>
202
203 <tr class="{name(.)}">
204 <td align="left" valign="top">
205 <xsl:call-template name="anchor">
206 <xsl:with-param name="node" select=".."/>
207 <xsl:with-param name="conditional" select="0"/>
208 </xsl:call-template>
209 <xsl:call-template name="anchor">
210 <xsl:with-param name="conditional" select="0"/>
211 </xsl:call-template>
212
213 <b>
214 <xsl:apply-templates select="." mode="label.markup"/>
215 <xsl:if test="$deflabel = 'number' and not(label)">
216 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
217 </xsl:if>
218 </b>
219 </td>
220 <td align="left" valign="top">
221 <xsl:choose>
222 <xsl:when test="$deflabel = 'none' and not(label)">
223 <b><xsl:apply-templates select="*[name(.) != 'label']"/></b>
224 </xsl:when>
225 <xsl:otherwise>
226 <xsl:apply-templates select="*[name(.) != 'label']"/>
227 </xsl:otherwise>
228 </xsl:choose>
229 </td>
230 </tr>
231</xsl:template>
232
233<xsl:template match="answer">
234 <xsl:variable name="deflabel">
235 <xsl:choose>
236 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
237 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
238 </xsl:when>
239 <xsl:otherwise>
240 <xsl:value-of select="$qanda.defaultlabel"/>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:variable>
244
245 <tr class="{name(.)}">
246 <td align="left" valign="top">
247 <xsl:call-template name="anchor"/>
248 <b>
249 <xsl:variable name="answer.label">
250 <xsl:apply-templates select="." mode="label.markup"/>
251 </xsl:variable>
252 <xsl:copy-of select="$answer.label"/>
253 </b>
254 </td>
255 <td align="left" valign="top">
256 <xsl:apply-templates select="*[name(.) != 'label']"/>
257 </td>
258 </tr>
259</xsl:template>
260
261<xsl:template match="label">
262 <xsl:apply-templates/>
263</xsl:template>
264
265<!-- ==================================================================== -->
266
267<xsl:template name="process.qanda.toc">
268 <dl>
269 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
270 <xsl:apply-templates select="qandaentry" mode="qandatoc.mode"/>
271 </dl>
272</xsl:template>
273
274<xsl:template match="qandadiv" mode="qandatoc.mode">
275 <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
276 <dd><xsl:call-template name="process.qanda.toc"/></dd>
277</xsl:template>
278
279<xsl:template match="qandadiv/blockinfo/title|qandadiv/title" mode="qandatoc.mode">
280 <xsl:variable name="qalevel">
281 <xsl:call-template name="qandadiv.section.level"/>
282 </xsl:variable>
283 <xsl:variable name="id">
284 <xsl:call-template name="object.id">
285 <xsl:with-param name="object" select="parent::*"/>
286 </xsl:call-template>
287 </xsl:variable>
288
289 <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
290 <xsl:value-of select="$autotoc.label.separator"/>
291 <xsl:text> </xsl:text>
292 <a>
293 <xsl:attribute name="href">
294 <xsl:call-template name="href.target">
295 <xsl:with-param name="object" select="parent::*"/>
296 </xsl:call-template>
297 </xsl:attribute>
298 <xsl:apply-templates/>
299 </a>
300</xsl:template>
301
302<xsl:template match="qandaentry" mode="qandatoc.mode">
303 <xsl:apply-templates select="question" mode="qandatoc.mode"/>
304</xsl:template>
305
306<xsl:template match="question" mode="qandatoc.mode">
307 <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
308 <xsl:variable name="deflabel">
309 <xsl:choose>
310 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
311 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
312 </xsl:when>
313 <xsl:otherwise>
314 <xsl:value-of select="$qanda.defaultlabel"/>
315 </xsl:otherwise>
316 </xsl:choose>
317 </xsl:variable>
318
319 <dt>
320 <xsl:apply-templates select="." mode="label.markup"/>
321 <xsl:if test="$deflabel = 'number' and not(label)">
322 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
323 </xsl:if>
324 <xsl:text> </xsl:text>
325 <a>
326 <xsl:attribute name="href">
327 <xsl:call-template name="href.target">
328 <xsl:with-param name="object" select=".."/>
329 </xsl:call-template>
330 </xsl:attribute>
331 <xsl:value-of select="$firstch"/>
332 </a>
333 </dt>
334</xsl:template>
335
336<!-- ==================================================================== -->
337
338<xsl:template match="*" mode="no.wrapper.mode">
339 <xsl:apply-templates/>
340</xsl:template>
341
342<!-- ==================================================================== -->
343
344</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.