1 | <?xml version="1.0" encoding="ASCII"?>
|
---|
2 | <!--This file was created automatically by html2xhtml-->
|
---|
3 | <!--from the HTML stylesheets.-->
|
---|
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 9354 2012-05-12 23:29:36Z bobstayton $
|
---|
8 | ********************************************************************
|
---|
9 |
|
---|
10 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
11 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
12 | copyright and other information.
|
---|
13 |
|
---|
14 | ******************************************************************** -->
|
---|
15 |
|
---|
16 | <!-- ==================================================================== -->
|
---|
17 |
|
---|
18 | <xsl:template match="qandaset">
|
---|
19 | <xsl:variable name="title" select="(blockinfo/title|info/title|title)[1]"/>
|
---|
20 | <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
|
---|
21 | <xsl:variable name="toc">
|
---|
22 | <xsl:call-template name="pi.dbhtml_toc"/>
|
---|
23 | </xsl:variable>
|
---|
24 |
|
---|
25 | <xsl:variable name="toc.params">
|
---|
26 | <xsl:call-template name="find.path.params">
|
---|
27 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
|
---|
28 | </xsl:call-template>
|
---|
29 | </xsl:variable>
|
---|
30 |
|
---|
31 | <div>
|
---|
32 | <xsl:apply-templates select="." mode="common.html.attributes"/>
|
---|
33 | <xsl:call-template name="id.attribute">
|
---|
34 | <xsl:with-param name="conditional" select="0"/>
|
---|
35 | </xsl:call-template>
|
---|
36 | <xsl:apply-templates select="$title"/>
|
---|
37 | <xsl:if test="not($title)">
|
---|
38 | <!-- andhor is output on title if there is one -->
|
---|
39 | <xsl:call-template name="anchor">
|
---|
40 | <xsl:with-param name="conditional" select="0"/>
|
---|
41 | </xsl:call-template>
|
---|
42 | </xsl:if>
|
---|
43 | <xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1') and not(ancestor::answer and not($qanda.nested.in.toc=0))">
|
---|
44 | <xsl:call-template name="process.qanda.toc"/>
|
---|
45 | </xsl:if>
|
---|
46 | <xsl:apply-templates select="$preamble"/>
|
---|
47 | <xsl:call-template name="process.qandaset"/>
|
---|
48 | </div>
|
---|
49 | </xsl:template>
|
---|
50 |
|
---|
51 | <xsl:template match="qandaset/blockinfo/title| qandaset/info/title| qandaset/title">
|
---|
52 | <xsl:variable name="qalevel">
|
---|
53 | <xsl:call-template name="qanda.section.level"/>
|
---|
54 | </xsl:variable>
|
---|
55 | <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
|
---|
56 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
57 | <xsl:call-template name="anchor">
|
---|
58 | <xsl:with-param name="node" select=".."/>
|
---|
59 | <xsl:with-param name="conditional" select="0"/>
|
---|
60 | </xsl:call-template>
|
---|
61 | <xsl:apply-templates/>
|
---|
62 | </xsl:element>
|
---|
63 | </xsl:template>
|
---|
64 |
|
---|
65 | <xsl:template match="qandaset/blockinfo|qandaset/info">
|
---|
66 | <!-- what should this template really do? -->
|
---|
67 | <xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
|
---|
68 | </xsl:template>
|
---|
69 |
|
---|
70 | <xsl:template match="qandadiv">
|
---|
71 | <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
|
---|
72 |
|
---|
73 | <xsl:if test="blockinfo/title|info/title|title">
|
---|
74 | <tr class="qandadiv">
|
---|
75 | <td align="{$direction.align.start}" valign="top" colspan="2">
|
---|
76 | <xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
|
---|
77 | </td>
|
---|
78 | </tr>
|
---|
79 | </xsl:if>
|
---|
80 |
|
---|
81 | <xsl:variable name="toc">
|
---|
82 | <xsl:call-template name="pi.dbhtml_toc"/>
|
---|
83 | </xsl:variable>
|
---|
84 |
|
---|
85 | <xsl:variable name="toc.params">
|
---|
86 | <xsl:call-template name="find.path.params">
|
---|
87 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
|
---|
88 | </xsl:call-template>
|
---|
89 | </xsl:variable>
|
---|
90 |
|
---|
91 | <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
|
---|
92 | <tr class="toc">
|
---|
93 | <td align="{$direction.align.start}" valign="top" colspan="2">
|
---|
94 | <xsl:call-template name="process.qanda.toc"/>
|
---|
95 | </td>
|
---|
96 | </tr>
|
---|
97 | </xsl:if>
|
---|
98 | <xsl:if test="$preamble">
|
---|
99 | <tr class="toc">
|
---|
100 | <td align="{$direction.align.start}" valign="top" colspan="2">
|
---|
101 | <xsl:apply-templates select="$preamble"/>
|
---|
102 | </td>
|
---|
103 | </tr>
|
---|
104 | </xsl:if>
|
---|
105 | <xsl:apply-templates select="qandadiv|qandaentry"/>
|
---|
106 | </xsl:template>
|
---|
107 |
|
---|
108 | <xsl:template match="qandadiv/blockinfo/title| qandadiv/info/title| qandadiv/title">
|
---|
109 | <xsl:variable name="qalevel">
|
---|
110 | <xsl:call-template name="qandadiv.section.level"/>
|
---|
111 | </xsl:variable>
|
---|
112 |
|
---|
113 | <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
|
---|
114 | <xsl:apply-templates select="." mode="class.attribute"/>
|
---|
115 | <xsl:call-template name="id.attribute">
|
---|
116 | <xsl:with-param name="node" select=".."/>
|
---|
117 | <xsl:with-param name="conditional" select="0"/>
|
---|
118 | </xsl:call-template>
|
---|
119 | <xsl:call-template name="anchor">
|
---|
120 | <xsl:with-param name="node" select=".."/>
|
---|
121 | <xsl:with-param name="conditional" select="0"/>
|
---|
122 | </xsl:call-template>
|
---|
123 | <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
|
---|
124 | <xsl:if test="$qandadiv.autolabel != 0">
|
---|
125 | <xsl:apply-templates select="." mode="intralabel.punctuation"/>
|
---|
126 | <xsl:text> </xsl:text>
|
---|
127 | </xsl:if>
|
---|
128 | <xsl:apply-templates/>
|
---|
129 | </xsl:element>
|
---|
130 | </xsl:template>
|
---|
131 |
|
---|
132 | <xsl:template match="qandaentry">
|
---|
133 | <xsl:apply-templates/>
|
---|
134 | </xsl:template>
|
---|
135 |
|
---|
136 | <xsl:template match="question">
|
---|
137 | <xsl:variable name="deflabel">
|
---|
138 | <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
|
---|
139 | </xsl:variable>
|
---|
140 |
|
---|
141 | <tr>
|
---|
142 | <xsl:apply-templates select="." mode="common.html.attributes"/>
|
---|
143 | <!-- capture the id of the quandaentry -->
|
---|
144 | <xsl:call-template name="id.attribute">
|
---|
145 | <xsl:with-param name="node" select=".."/>
|
---|
146 | <xsl:with-param name="conditional" select="0"/>
|
---|
147 | </xsl:call-template>
|
---|
148 | <td align="{$direction.align.start}" valign="top">
|
---|
149 | <!-- and the id of the question too -->
|
---|
150 | <xsl:call-template name="id.attribute">
|
---|
151 | <xsl:with-param name="conditional" select="0"/>
|
---|
152 | </xsl:call-template>
|
---|
153 | <xsl:call-template name="anchor">
|
---|
154 | <xsl:with-param name="node" select=".."/>
|
---|
155 | <xsl:with-param name="conditional" select="0"/>
|
---|
156 | </xsl:call-template>
|
---|
157 | <xsl:call-template name="anchor">
|
---|
158 | <xsl:with-param name="conditional" select="0"/>
|
---|
159 | </xsl:call-template>
|
---|
160 |
|
---|
161 | <xsl:variable name="label.content">
|
---|
162 | <xsl:apply-templates select="." mode="qanda.label"/>
|
---|
163 | </xsl:variable>
|
---|
164 |
|
---|
165 | <xsl:if test="string-length($label.content) > 0">
|
---|
166 | <p><strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
|
---|
167 | <xsl:copy-of select="$label.content"/>
|
---|
168 | </strong></p>
|
---|
169 | </xsl:if>
|
---|
170 | </td>
|
---|
171 | <td align="{$direction.align.start}" valign="top">
|
---|
172 | <xsl:choose>
|
---|
173 | <xsl:when test="$deflabel = 'none' and not(label)">
|
---|
174 | <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="*[local-name(.) != 'label']"/></strong>
|
---|
175 | </xsl:when>
|
---|
176 | <xsl:otherwise>
|
---|
177 | <xsl:apply-templates select="*[local-name(.) != 'label']"/>
|
---|
178 | </xsl:otherwise>
|
---|
179 | </xsl:choose>
|
---|
180 | </td>
|
---|
181 | </tr>
|
---|
182 | </xsl:template>
|
---|
183 |
|
---|
184 | <xsl:template match="*" mode="qanda.defaultlabel">
|
---|
185 | <xsl:choose>
|
---|
186 | <xsl:when test="ancestor-or-self::*[@defaultlabel]">
|
---|
187 | <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
|
---|
188 | </xsl:when>
|
---|
189 | <xsl:otherwise>
|
---|
190 | <xsl:value-of select="$qanda.defaultlabel"/>
|
---|
191 | </xsl:otherwise>
|
---|
192 | </xsl:choose>
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 | <xsl:template match="question" mode="qanda.label">
|
---|
196 | <xsl:variable name="deflabel">
|
---|
197 | <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
|
---|
198 | </xsl:variable>
|
---|
199 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
200 | <xsl:if test="contains($deflabel, 'number') and not(label)">
|
---|
201 | <xsl:apply-templates select="." mode="intralabel.punctuation"/>
|
---|
202 | </xsl:if>
|
---|
203 | </xsl:template>
|
---|
204 |
|
---|
205 | <xsl:template match="answer">
|
---|
206 | <xsl:variable name="deflabel">
|
---|
207 | <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
|
---|
208 | </xsl:variable>
|
---|
209 |
|
---|
210 | <tr>
|
---|
211 | <xsl:apply-templates select="." mode="common.html.attributes"/>
|
---|
212 | <xsl:call-template name="id.attribute"/>
|
---|
213 | <td align="{$direction.align.start}" valign="top">
|
---|
214 | <xsl:call-template name="anchor"/>
|
---|
215 | <xsl:variable name="answer.label">
|
---|
216 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
217 | </xsl:variable>
|
---|
218 | <xsl:if test="string-length($answer.label) > 0">
|
---|
219 | <p><strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
|
---|
220 | <xsl:copy-of select="$answer.label"/>
|
---|
221 | </strong></p>
|
---|
222 | </xsl:if>
|
---|
223 | </td>
|
---|
224 | <td align="{$direction.align.start}" valign="top">
|
---|
225 | <xsl:apply-templates select="*[local-name(.) != 'label' and local-name(.) != 'qandaentry']"/>
|
---|
226 | <!-- * handle nested answer/qandaentry instances -->
|
---|
227 | <!-- * (bug 1509043 from Daniel Leidert) -->
|
---|
228 | <xsl:if test="descendant::question">
|
---|
229 | <xsl:call-template name="process.qandaset"/>
|
---|
230 | </xsl:if>
|
---|
231 | </td>
|
---|
232 | </tr>
|
---|
233 | </xsl:template>
|
---|
234 |
|
---|
235 | <xsl:template match="answer" mode="qanda.label">
|
---|
236 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
237 | </xsl:template>
|
---|
238 |
|
---|
239 | <xsl:template match="label">
|
---|
240 | <xsl:apply-templates/>
|
---|
241 | </xsl:template>
|
---|
242 |
|
---|
243 | <!-- ==================================================================== -->
|
---|
244 |
|
---|
245 | <xsl:template name="process.qanda.toc">
|
---|
246 | <!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
|
---|
247 | <!-- * then don't also include the nested stuff in the sub TOCs -->
|
---|
248 | <dl>
|
---|
249 | <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
|
---|
250 | <xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
|
---|
251 | </dl>
|
---|
252 | </xsl:template>
|
---|
253 |
|
---|
254 | <xsl:template match="qandadiv" mode="qandatoc.mode">
|
---|
255 | <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
|
---|
256 | <dd><xsl:call-template name="process.qanda.toc"/></dd>
|
---|
257 | </xsl:template>
|
---|
258 |
|
---|
259 | <xsl:template match="qandadiv/blockinfo/title| qandadiv/info/title| qandadiv/title" mode="qandatoc.mode">
|
---|
260 | <xsl:variable name="qalevel">
|
---|
261 | <xsl:call-template name="qandadiv.section.level"/>
|
---|
262 | </xsl:variable>
|
---|
263 | <xsl:variable name="id">
|
---|
264 | <xsl:call-template name="object.id">
|
---|
265 | <xsl:with-param name="object" select="parent::*"/>
|
---|
266 | </xsl:call-template>
|
---|
267 | </xsl:variable>
|
---|
268 |
|
---|
269 | <xsl:variable name="div.label">
|
---|
270 | <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
|
---|
271 | </xsl:variable>
|
---|
272 | <xsl:if test="string-length($div.label) != 0">
|
---|
273 | <xsl:copy-of select="$div.label"/>
|
---|
274 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
275 | </xsl:if>
|
---|
276 | <xsl:text> </xsl:text>
|
---|
277 | <a>
|
---|
278 | <xsl:attribute name="href">
|
---|
279 | <xsl:call-template name="href.target">
|
---|
280 | <xsl:with-param name="object" select="parent::*"/>
|
---|
281 | </xsl:call-template>
|
---|
282 | </xsl:attribute>
|
---|
283 | <xsl:apply-templates/>
|
---|
284 | </a>
|
---|
285 | </xsl:template>
|
---|
286 |
|
---|
287 | <xsl:template match="qandaset" mode="qandatoc.mode">
|
---|
288 | <xsl:for-each select="qandaentry">
|
---|
289 | <xsl:apply-templates select="." mode="qandatoc.mode"/>
|
---|
290 | </xsl:for-each>
|
---|
291 | </xsl:template>
|
---|
292 |
|
---|
293 | <xsl:template match="qandaentry" mode="qandatoc.mode">
|
---|
294 | <xsl:apply-templates select="question" mode="qandatoc.mode"/>
|
---|
295 | </xsl:template>
|
---|
296 |
|
---|
297 | <xsl:template match="question" mode="qandatoc.mode">
|
---|
298 | <xsl:variable name="firstch">
|
---|
299 | <!-- Use a titleabbrev or title if available -->
|
---|
300 | <xsl:choose>
|
---|
301 | <xsl:when test="../blockinfo/titleabbrev">
|
---|
302 | <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
|
---|
303 | </xsl:when>
|
---|
304 | <xsl:when test="../blockinfo/title">
|
---|
305 | <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
|
---|
306 | </xsl:when>
|
---|
307 | <xsl:when test="../info/titleabbrev">
|
---|
308 | <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
|
---|
309 | </xsl:when>
|
---|
310 | <xsl:when test="../titleabbrev">
|
---|
311 | <xsl:apply-templates select="../titleabbrev[1]/node()"/>
|
---|
312 | </xsl:when>
|
---|
313 | <xsl:when test="../info/title">
|
---|
314 | <xsl:apply-templates select="../info/title[1]/node()"/>
|
---|
315 | </xsl:when>
|
---|
316 | <xsl:when test="../title">
|
---|
317 | <xsl:apply-templates select="../title[1]/node()"/>
|
---|
318 | </xsl:when>
|
---|
319 | <xsl:otherwise>
|
---|
320 | <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
|
---|
321 | </xsl:otherwise>
|
---|
322 | </xsl:choose>
|
---|
323 | </xsl:variable>
|
---|
324 | <xsl:variable name="deflabel">
|
---|
325 | <xsl:choose>
|
---|
326 | <xsl:when test="ancestor-or-self::*[@defaultlabel]">
|
---|
327 | <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
|
---|
328 | </xsl:when>
|
---|
329 | <xsl:otherwise>
|
---|
330 | <xsl:value-of select="$qanda.defaultlabel"/>
|
---|
331 | </xsl:otherwise>
|
---|
332 | </xsl:choose>
|
---|
333 | </xsl:variable>
|
---|
334 |
|
---|
335 | <dt>
|
---|
336 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
337 | <xsl:if test="contains($deflabel,'number') and not(label)">
|
---|
338 | <xsl:apply-templates select="." mode="intralabel.punctuation"/>
|
---|
339 | </xsl:if>
|
---|
340 | <xsl:text> </xsl:text>
|
---|
341 | <a>
|
---|
342 | <xsl:attribute name="href">
|
---|
343 | <xsl:call-template name="href.target">
|
---|
344 | <xsl:with-param name="object" select=".."/>
|
---|
345 | </xsl:call-template>
|
---|
346 | </xsl:attribute>
|
---|
347 | <xsl:value-of select="$firstch"/>
|
---|
348 | </a>
|
---|
349 | </dt>
|
---|
350 | <!-- * include nested qandaset/qandaentry in TOC if user wants it -->
|
---|
351 | <xsl:if test="not($qanda.nested.in.toc = 0)">
|
---|
352 | <xsl:apply-templates select="following-sibling::answer" mode="qandatoc.mode"/>
|
---|
353 | </xsl:if>
|
---|
354 | </xsl:template>
|
---|
355 |
|
---|
356 | <xsl:template match="answer" mode="qandatoc.mode">
|
---|
357 | <xsl:if test="descendant::question">
|
---|
358 | <dd>
|
---|
359 | <xsl:call-template name="process.qanda.toc"/>
|
---|
360 | </dd>
|
---|
361 | </xsl:if>
|
---|
362 | </xsl:template>
|
---|
363 |
|
---|
364 | <!-- ==================================================================== -->
|
---|
365 |
|
---|
366 | <xsl:template name="process.qandaset">
|
---|
367 |
|
---|
368 | <xsl:variable name="deflabel">
|
---|
369 | <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
|
---|
370 | </xsl:variable>
|
---|
371 |
|
---|
372 | <xsl:variable name="label-width">
|
---|
373 | <xsl:call-template name="pi.dbhtml_label-width"/>
|
---|
374 | </xsl:variable>
|
---|
375 |
|
---|
376 | <xsl:variable name="table-summary">
|
---|
377 | <xsl:call-template name="pi.dbhtml_table-summary"/>
|
---|
378 | </xsl:variable>
|
---|
379 |
|
---|
380 | <xsl:variable name="cellpadding">
|
---|
381 | <xsl:call-template name="pi.dbhtml_cellpadding"/>
|
---|
382 | </xsl:variable>
|
---|
383 |
|
---|
384 | <xsl:variable name="cellspacing">
|
---|
385 | <xsl:call-template name="pi.dbhtml_cellspacing"/>
|
---|
386 | </xsl:variable>
|
---|
387 |
|
---|
388 | <table border="{$table.border.off}">
|
---|
389 | <xsl:if test="$css.decoration != 0">
|
---|
390 | <xsl:attribute name="style">width: 100%;</xsl:attribute>
|
---|
391 | </xsl:if>
|
---|
392 | <xsl:if test="$table-summary != ''">
|
---|
393 | <xsl:attribute name="summary">
|
---|
394 | <xsl:value-of select="$table-summary"/>
|
---|
395 | </xsl:attribute>
|
---|
396 | </xsl:if>
|
---|
397 |
|
---|
398 | <xsl:if test="$cellpadding != ''">
|
---|
399 | <xsl:attribute name="cellpadding">
|
---|
400 | <xsl:value-of select="$cellpadding"/>
|
---|
401 | </xsl:attribute>
|
---|
402 | </xsl:if>
|
---|
403 |
|
---|
404 | <xsl:if test="$cellspacing != ''">
|
---|
405 | <xsl:attribute name="cellspacing">
|
---|
406 | <xsl:value-of select="$cellspacing"/>
|
---|
407 | </xsl:attribute>
|
---|
408 | </xsl:if>
|
---|
409 |
|
---|
410 | <colgroup>
|
---|
411 | <col align="{$direction.align.start}">
|
---|
412 | <xsl:attribute name="width">
|
---|
413 | <xsl:choose>
|
---|
414 | <xsl:when test="$label-width != ''">
|
---|
415 | <xsl:value-of select="$label-width"/>
|
---|
416 | </xsl:when>
|
---|
417 | <xsl:otherwise>
|
---|
418 | <xsl:text>1%</xsl:text>
|
---|
419 | </xsl:otherwise>
|
---|
420 | </xsl:choose>
|
---|
421 | </xsl:attribute>
|
---|
422 | </col>
|
---|
423 | <col/>
|
---|
424 | </colgroup>
|
---|
425 | <tbody>
|
---|
426 | <xsl:apply-templates select="qandaentry|qandadiv"/>
|
---|
427 | </tbody>
|
---|
428 | </table>
|
---|
429 | </xsl:template>
|
---|
430 |
|
---|
431 | <!-- ==================================================================== -->
|
---|
432 |
|
---|
433 | <xsl:template match="*" mode="no.wrapper.mode">
|
---|
434 | <xsl:apply-templates/>
|
---|
435 | </xsl:template>
|
---|
436 |
|
---|
437 | <!-- ==================================================================== -->
|
---|
438 |
|
---|
439 | </xsl:stylesheet>
|
---|