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 9354 2012-05-12 23:29:36Z 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:call-template name="id.attribute">
34 <xsl:with-param name="conditional" select="0"/>
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"/>
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"/>
46 <xsl:apply-templates select="$preamble"/>
47 <xsl:call-template name="process.qandaset"/>
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"/>
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"/>
61 <xsl:apply-templates/>
65 <xsl:template match="qandaset/blockinfo|qandaset/info">
66 <!-- what should this template really do? -->
67 <xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
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']"/>
73 <xsl:if test="blockinfo/title|info/title|title">
75 <td align="{$direction.align.start}" valign="top" colspan="2">
76 <xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
81 <xsl:variable name="toc">
82 <xsl:call-template name="pi.dbhtml_toc"/>
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)"/>
91 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
93 <td align="{$direction.align.start}" valign="top" colspan="2">
94 <xsl:call-template name="process.qanda.toc"/>
98 <xsl:if test="$preamble">
100 <td align="{$direction.align.start}" valign="top" colspan="2">
101 <xsl:apply-templates select="$preamble"/>
105 <xsl:apply-templates select="qandadiv|qandaentry"/>
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"/>
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"/>
119 <xsl:call-template name="anchor">
120 <xsl:with-param name="node" select=".."/>
121 <xsl:with-param name="conditional" select="0"/>
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>
128 <xsl:apply-templates/>
132 <xsl:template match="qandaentry">
133 <xsl:apply-templates/>
136 <xsl:template match="question">
137 <xsl:variable name="deflabel">
138 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
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"/>
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"/>
153 <xsl:call-template name="anchor">
154 <xsl:with-param name="node" select=".."/>
155 <xsl:with-param name="conditional" select="0"/>
157 <xsl:call-template name="anchor">
158 <xsl:with-param name="conditional" select="0"/>
161 <xsl:variable name="label.content">
162 <xsl:apply-templates select="." mode="qanda.label"/>
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"/>
171 <td align="{$direction.align.start}" valign="top">
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>
177 <xsl:apply-templates select="*[local-name(.) != 'label']"/>
184 <xsl:template match="*" mode="qanda.defaultlabel">
186 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
187 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
190 <xsl:value-of select="$qanda.defaultlabel"/>
195 <xsl:template match="question" mode="qanda.label">
196 <xsl:variable name="deflabel">
197 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
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"/>
205 <xsl:template match="answer">
206 <xsl:variable name="deflabel">
207 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
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"/>
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"/>
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"/>
235 <xsl:template match="answer" mode="qanda.label">
236 <xsl:apply-templates select="." mode="label.markup"/>
239 <xsl:template match="label">
240 <xsl:apply-templates/>
243 <!-- ==================================================================== -->
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 -->
249 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
250 <xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
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>
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"/>
263 <xsl:variable name="id">
264 <xsl:call-template name="object.id">
265 <xsl:with-param name="object" select="parent::*"/>
269 <xsl:variable name="div.label">
270 <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
272 <xsl:if test="string-length($div.label) != 0">
273 <xsl:copy-of select="$div.label"/>
274 <xsl:value-of select="$autotoc.label.separator"/>
276 <xsl:text> </xsl:text>
278 <xsl:attribute name="href">
279 <xsl:call-template name="href.target">
280 <xsl:with-param name="object" select="parent::*"/>
283 <xsl:apply-templates/>
287 <xsl:template match="qandaset" mode="qandatoc.mode">
288 <xsl:for-each select="qandaentry">
289 <xsl:apply-templates select="." mode="qandatoc.mode"/>
293 <xsl:template match="qandaentry" mode="qandatoc.mode">
294 <xsl:apply-templates select="question" mode="qandatoc.mode"/>
297 <xsl:template match="question" mode="qandatoc.mode">
298 <xsl:variable name="firstch">
299 <!-- Use a titleabbrev or title if available -->
301 <xsl:when test="../blockinfo/titleabbrev">
302 <xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
304 <xsl:when test="../blockinfo/title">
305 <xsl:apply-templates select="../blockinfo/title[1]/node()"/>
307 <xsl:when test="../info/titleabbrev">
308 <xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
310 <xsl:when test="../titleabbrev">
311 <xsl:apply-templates select="../titleabbrev[1]/node()"/>
313 <xsl:when test="../info/title">
314 <xsl:apply-templates select="../info/title[1]/node()"/>
316 <xsl:when test="../title">
317 <xsl:apply-templates select="../title[1]/node()"/>
320 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
324 <xsl:variable name="deflabel">
326 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
327 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
330 <xsl:value-of select="$qanda.defaultlabel"/>
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"/>
340 <xsl:text> </xsl:text>
342 <xsl:attribute name="href">
343 <xsl:call-template name="href.target">
344 <xsl:with-param name="object" select=".."/>
347 <xsl:value-of select="$firstch"/>
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"/>
356 <xsl:template match="answer" mode="qandatoc.mode">
357 <xsl:if test="descendant::question">
359 <xsl:call-template name="process.qanda.toc"/>
364 <!-- ==================================================================== -->
366 <xsl:template name="process.qandaset">
368 <xsl:variable name="deflabel">
369 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
372 <xsl:variable name="label-width">
373 <xsl:call-template name="pi.dbhtml_label-width"/>
376 <xsl:variable name="table-summary">
377 <xsl:call-template name="pi.dbhtml_table-summary"/>
380 <xsl:variable name="cellpadding">
381 <xsl:call-template name="pi.dbhtml_cellpadding"/>
384 <xsl:variable name="cellspacing">
385 <xsl:call-template name="pi.dbhtml_cellspacing"/>
388 <table border="{$table.border.off}">
389 <xsl:if test="$css.decoration != 0">
390 <xsl:attribute name="style">width: 100%;</xsl:attribute>
392 <xsl:if test="$table-summary != ''">
393 <xsl:attribute name="summary">
394 <xsl:value-of select="$table-summary"/>
398 <xsl:if test="$cellpadding != ''">
399 <xsl:attribute name="cellpadding">
400 <xsl:value-of select="$cellpadding"/>
404 <xsl:if test="$cellspacing != ''">
405 <xsl:attribute name="cellspacing">
406 <xsl:value-of select="$cellspacing"/>
411 <col align="{$direction.align.start}">
412 <xsl:attribute name="width">
414 <xsl:when test="$label-width != ''">
415 <xsl:value-of select="$label-width"/>
418 <xsl:text>1%</xsl:text>
426 <xsl:apply-templates select="qandaentry|qandadiv"/>
431 <!-- ==================================================================== -->
433 <xsl:template match="*" mode="no.wrapper.mode">
434 <xsl:apply-templates/>
437 <!-- ==================================================================== -->