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">
6 <!-- ********************************************************************
7 $Id: qandaset.xsl 8421 2009-05-04 07:49:49Z bobstayton $
8 ********************************************************************
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.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
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"/>
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)"/>
32 <xsl:apply-templates select="." mode="common.html.attributes"/>
33 <xsl:apply-templates select="$title"/>
34 <xsl:if test="not($title)">
35 <!-- id is output on title if there is one -->
36 <xsl:call-template name="anchor">
37 <xsl:with-param name="conditional" select="0"/>
40 <xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1') and not(ancestor::answer and not($qanda.nested.in.toc=0))">
41 <xsl:call-template name="process.qanda.toc"/>
43 <xsl:apply-templates select="$preamble"/>
44 <xsl:call-template name="process.qandaset"/>
48 <xsl:template match="qandaset/blockinfo/title| qandaset/info/title| qandaset/title">
49 <xsl:variable name="qalevel">
50 <xsl:call-template name="qanda.section.level"/>
52 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
53 <xsl:attribute name="class">
54 <xsl:value-of select="local-name(.)"/>
56 <xsl:call-template name="anchor">
57 <xsl:with-param name="node" select=".."/>
58 <xsl:with-param name="conditional" select="0"/>
60 <xsl:apply-templates/>
64 <xsl:template match="qandaset/blockinfo|qandaset/info">
65 <!-- what should this template really do? -->
66 <xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
69 <xsl:template match="qandadiv">
70 <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
72 <xsl:if test="blockinfo/title|info/title|title">
74 <td align="{$direction.align.start}" valign="top" colspan="2">
75 <xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
80 <xsl:variable name="toc">
81 <xsl:call-template name="pi.dbhtml_toc"/>
84 <xsl:variable name="toc.params">
85 <xsl:call-template name="find.path.params">
86 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
90 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
92 <td align="{$direction.align.start}" valign="top" colspan="2">
93 <xsl:call-template name="process.qanda.toc"/>
97 <xsl:if test="$preamble">
99 <td align="{$direction.align.start}" valign="top" colspan="2">
100 <xsl:apply-templates select="$preamble"/>
104 <xsl:apply-templates select="qandadiv|qandaentry"/>
107 <xsl:template match="qandadiv/blockinfo/title| qandadiv/info/title| qandadiv/title">
108 <xsl:variable name="qalevel">
109 <xsl:call-template name="qandadiv.section.level"/>
112 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
113 <xsl:attribute name="class">
114 <xsl:value-of select="local-name(.)"/>
116 <xsl:call-template name="anchor">
117 <xsl:with-param name="node" select=".."/>
118 <xsl:with-param name="conditional" select="0"/>
120 <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
121 <xsl:if test="$qandadiv.autolabel != 0">
122 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
123 <xsl:text> </xsl:text>
125 <xsl:apply-templates/>
129 <xsl:template match="qandaentry">
130 <xsl:apply-templates/>
133 <xsl:template match="question">
134 <xsl:variable name="deflabel">
135 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
139 <xsl:apply-templates select="." mode="common.html.attributes"/>
140 <td align="{$direction.align.start}" valign="top">
141 <xsl:call-template name="anchor">
142 <xsl:with-param name="node" select=".."/>
143 <xsl:with-param name="conditional" select="0"/>
145 <xsl:call-template name="anchor">
146 <xsl:with-param name="conditional" select="0"/>
149 <xsl:variable name="label.content">
150 <xsl:apply-templates select="." mode="qanda.label"/>
153 <xsl:if test="string-length($label.content) > 0">
154 <p><strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
155 <xsl:copy-of select="$label.content"/>
159 <td align="{$direction.align.start}" valign="top">
161 <xsl:when test="$deflabel = 'none' and not(label)">
162 <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="*[local-name(.) != 'label']"/></strong>
165 <xsl:apply-templates select="*[local-name(.) != 'label']"/>
172 <xsl:template match="*" mode="qanda.defaultlabel">
174 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
175 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
178 <xsl:value-of select="$qanda.defaultlabel"/>
183 <xsl:template match="question" mode="qanda.label">
184 <xsl:variable name="deflabel">
185 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
187 <xsl:apply-templates select="." mode="label.markup"/>
188 <xsl:if test="contains($deflabel, 'number') and not(label)">
189 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
193 <xsl:template match="answer">
194 <xsl:variable name="deflabel">
195 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
198 <tr class="{local-name(.)}">
199 <td align="{$direction.align.start}" valign="top">
200 <xsl:call-template name="anchor"/>
201 <xsl:variable name="answer.label">
202 <xsl:apply-templates select="." mode="label.markup"/>
204 <xsl:if test="string-length($answer.label) > 0">
205 <p><strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
206 <xsl:copy-of select="$answer.label"/>
210 <td align="{$direction.align.start}" valign="top">
211 <xsl:apply-templates select="*[local-name(.) != 'label' and local-name(.) != 'qandaentry']"/>
212 <!-- * handle nested answer/qandaentry instances -->
213 <!-- * (bug 1509043 from Daniel Leidert) -->
214 <xsl:if test="descendant::question">
215 <xsl:call-template name="process.qandaset"/>
221 <xsl:template match="answer" mode="qanda.label">
222 <xsl:apply-templates select="." mode="label.markup"/>
225 <xsl:template match="label">
226 <xsl:apply-templates/>
229 <!-- ==================================================================== -->
231 <xsl:template name="process.qanda.toc">
232 <!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
233 <!-- * then don't also include the nested stuff in the sub TOCs -->
235 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
236 <xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
240 <xsl:template match="qandadiv" mode="qandatoc.mode">
241 <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
242 <dd><xsl:call-template name="process.qanda.toc"/></dd>
245 <xsl:template match="qandadiv/blockinfo/title| qandadiv/info/title| qandadiv/title" mode="qandatoc.mode">
246 <xsl:variable name="qalevel">
247 <xsl:call-template name="qandadiv.section.level"/>
249 <xsl:variable name="id">
250 <xsl:call-template name="object.id">
251 <xsl:with-param name="object" select="parent::*"/>
255 <xsl:variable name="div.label">
256 <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
258 <xsl:if test="string-length($div.label) != 0">
259 <xsl:copy-of select="$div.label"/>
260 <xsl:value-of select="$autotoc.label.separator"/>
262 <xsl:text> </xsl:text>
264 <xsl:attribute name="href">
265 <xsl:call-template name="href.target">
266 <xsl:with-param name="object" select="parent::*"/>
269 <xsl:apply-templates/>
273 <xsl:template match="qandaset" mode="qandatoc.mode">
274 <xsl:for-each select="qandaentry">
275 <xsl:apply-templates select="." mode="qandatoc.mode"/>
279 <xsl:template match="qandaentry" mode="qandatoc.mode">
280 <xsl:apply-templates select="question" mode="qandatoc.mode"/>
283 <xsl:template match="question" mode="qandatoc.mode">
284 <xsl:variable name="firstch">
285 <!-- Use a titleabbrev or title if available -->
287 <xsl:when test="../blockinfo/titleabbrev">
288 <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
290 <xsl:when test="../blockinfo/title">
291 <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
293 <xsl:when test="../info/titleabbrev">
294 <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
296 <xsl:when test="../titleabbrev">
297 <xsl:apply-templates select="../titleabbrev[1]/node()"/>
299 <xsl:when test="../info/title">
300 <xsl:apply-templates select="../info/title[1]/node()"/>
302 <xsl:when test="../title">
303 <xsl:apply-templates select="../title[1]/node()"/>
306 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
310 <xsl:variable name="deflabel">
312 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
313 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
316 <xsl:value-of select="$qanda.defaultlabel"/>
322 <xsl:apply-templates select="." mode="label.markup"/>
323 <xsl:if test="contains($deflabel,'number') and not(label)">
324 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
326 <xsl:text> </xsl:text>
328 <xsl:attribute name="href">
329 <xsl:call-template name="href.target">
330 <xsl:with-param name="object" select=".."/>
333 <xsl:value-of select="$firstch"/>
336 <!-- * include nested qandaset/qandaentry in TOC if user wants it -->
337 <xsl:if test="not($qanda.nested.in.toc = 0)">
338 <xsl:apply-templates select="following-sibling::answer" mode="qandatoc.mode"/>
342 <xsl:template match="answer" mode="qandatoc.mode">
343 <xsl:if test="descendant::question">
345 <xsl:call-template name="process.qanda.toc"/>
350 <!-- ==================================================================== -->
352 <xsl:template name="process.qandaset">
354 <xsl:variable name="deflabel">
355 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
358 <xsl:variable name="label-width">
359 <xsl:call-template name="pi.dbhtml_label-width"/>
362 <xsl:variable name="table-summary">
363 <xsl:call-template name="pi.dbhtml_table-summary"/>
366 <xsl:variable name="cellpadding">
367 <xsl:call-template name="pi.dbhtml_cellpadding"/>
370 <xsl:variable name="cellspacing">
371 <xsl:call-template name="pi.dbhtml_cellspacing"/>
374 <table border="0" width="100%" summary="Q and A Set">
375 <xsl:if test="$table-summary != ''">
376 <xsl:attribute name="summary">
377 <xsl:value-of select="$table-summary"/>
381 <xsl:if test="$cellpadding != ''">
382 <xsl:attribute name="cellpadding">
383 <xsl:value-of select="$cellpadding"/>
387 <xsl:if test="$cellspacing != ''">
388 <xsl:attribute name="cellspacing">
389 <xsl:value-of select="$cellspacing"/>
393 <col align="{$direction.align.start}">
394 <xsl:attribute name="width">
396 <xsl:when test="$label-width != ''">
397 <xsl:value-of select="$label-width"/>
400 <xsl:text>1%</xsl:text>
407 <xsl:apply-templates select="qandaentry|qandadiv"/>
412 <!-- ==================================================================== -->
414 <xsl:template match="*" mode="no.wrapper.mode">
415 <xsl:apply-templates/>
418 <!-- ==================================================================== -->