1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <!-- ==================================================================== -->
13 <xsl:template match="d:qandaset">
14 <xsl:variable name="title" select="(d:blockinfo/d:title|d:info/d:title|d:title)[1]"/>
15 <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
16 <xsl:variable name="toc">
17 <xsl:call-template name="pi.dbhtml_toc"/>
20 <xsl:variable name="toc.params">
21 <xsl:call-template name="find.path.params">
22 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
27 <xsl:apply-templates select="." mode="common.html.attributes"/>
28 <xsl:call-template name="id.attribute">
29 <xsl:with-param name="conditional" select="0"/>
31 <xsl:apply-templates select="$title"/>
32 <xsl:if test="not($title)">
33 <!-- andhor is output on title if there is one -->
34 <xsl:call-template name="anchor">
35 <xsl:with-param name="conditional" select="0"/>
38 <xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1') and not(ancestor::d:answer and not($qanda.nested.in.toc=0))">
39 <xsl:call-template name="process.qanda.toc"/>
41 <xsl:apply-templates select="$preamble"/>
42 <xsl:call-template name="process.qandaset"/>
46 <xsl:template match="d:qandaset/d:blockinfo/d:title| d:qandaset/d:info/d:title| d:qandaset/d:title">
47 <xsl:variable name="qalevel">
48 <xsl:call-template name="qanda.section.level"/>
50 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
51 <xsl:apply-templates select="." mode="class.attribute"/>
52 <xsl:call-template name="anchor">
53 <xsl:with-param name="node" select=".."/>
54 <xsl:with-param name="conditional" select="0"/>
56 <xsl:apply-templates/>
60 <xsl:template match="d:qandaset/d:blockinfo|d:qandaset/d:info">
61 <!-- what should this template really do? -->
62 <xsl:apply-templates select="d:legalnotice" mode="titlepage.mode"/>
65 <xsl:template match="d:qandadiv">
66 <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
68 <xsl:if test="d:blockinfo/d:title|d:info/d:title|d:title">
70 <td align="{$direction.align.start}" valign="top" colspan="2">
71 <xsl:apply-templates select="(d:blockinfo/d:title|d:info/d:title|d:title)[1]"/>
76 <xsl:variable name="toc">
77 <xsl:call-template name="pi.dbhtml_toc"/>
80 <xsl:variable name="toc.params">
81 <xsl:call-template name="find.path.params">
82 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
86 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
88 <td align="{$direction.align.start}" valign="top" colspan="2">
89 <xsl:call-template name="process.qanda.toc"/>
93 <xsl:if test="$preamble">
95 <td align="{$direction.align.start}" valign="top" colspan="2">
96 <xsl:apply-templates select="$preamble"/>
100 <xsl:apply-templates select="d:qandadiv|d:qandaentry"/>
103 <xsl:template match="d:qandadiv/d:blockinfo/d:title| d:qandadiv/d:info/d:title| d:qandadiv/d:title">
104 <xsl:variable name="qalevel">
105 <xsl:call-template name="qandadiv.section.level"/>
108 <xsl:element name="h{string(number($qalevel)+1)}" namespace="http://www.w3.org/1999/xhtml">
109 <xsl:apply-templates select="." mode="class.attribute"/>
110 <xsl:call-template name="id.attribute">
111 <xsl:with-param name="node" select=".."/>
112 <xsl:with-param name="conditional" select="0"/>
114 <xsl:call-template name="anchor">
115 <xsl:with-param name="node" select=".."/>
116 <xsl:with-param name="conditional" select="0"/>
118 <xsl:apply-templates select="parent::d:qandadiv" mode="label.markup"/>
119 <xsl:if test="$qandadiv.autolabel != 0">
120 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
121 <xsl:text> </xsl:text>
123 <xsl:apply-templates/>
127 <xsl:template match="d:qandaentry">
128 <xsl:apply-templates/>
131 <xsl:template match="d:question">
132 <xsl:variable name="deflabel">
133 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
137 <xsl:apply-templates select="." mode="common.html.attributes"/>
138 <!-- capture the id of the quandaentry -->
139 <xsl:call-template name="id.attribute">
140 <xsl:with-param name="node" select=".."/>
141 <xsl:with-param name="conditional" select="0"/>
143 <td align="{$direction.align.start}" valign="top">
144 <!-- and the id of the question too -->
145 <xsl:call-template name="id.attribute">
146 <xsl:with-param name="conditional" select="0"/>
148 <xsl:call-template name="anchor">
149 <xsl:with-param name="node" select=".."/>
150 <xsl:with-param name="conditional" select="0"/>
152 <xsl:call-template name="anchor">
153 <xsl:with-param name="conditional" select="0"/>
156 <xsl:variable name="label.content">
157 <xsl:apply-templates select="." mode="qanda.label"/>
160 <xsl:if test="string-length($label.content) > 0">
162 <xsl:copy-of select="$label.content"/>
166 <td align="{$direction.align.start}" valign="top">
168 <xsl:when test="$deflabel = 'none' and not(d:label)">
169 <strong><xsl:apply-templates select="*[local-name(.) != 'label']"/></strong>
172 <xsl:apply-templates select="*[local-name(.) != 'label']"/>
179 <xsl:template match="*" mode="qanda.defaultlabel">
181 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
182 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
185 <xsl:value-of select="$qanda.defaultlabel"/>
190 <xsl:template match="d:question" mode="qanda.label">
191 <xsl:variable name="deflabel">
192 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
194 <xsl:apply-templates select="." mode="label.markup"/>
195 <xsl:if test="contains($deflabel, 'number') and not(d:label)">
196 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
200 <xsl:template match="d:answer">
201 <xsl:variable name="deflabel">
202 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
206 <xsl:apply-templates select="." mode="common.html.attributes"/>
207 <xsl:call-template name="id.attribute"/>
208 <td align="{$direction.align.start}" valign="top">
209 <xsl:call-template name="anchor"/>
210 <xsl:variable name="answer.label">
211 <xsl:apply-templates select="." mode="label.markup"/>
213 <xsl:if test="string-length($answer.label) > 0">
215 <xsl:copy-of select="$answer.label"/>
219 <td align="{$direction.align.start}" valign="top">
220 <xsl:apply-templates select="*[local-name(.) != 'label' and local-name(.) != 'qandaentry']"/>
221 <!-- * handle nested answer/qandaentry instances -->
222 <!-- * (bug 1509043 from Daniel Leidert) -->
223 <xsl:if test="descendant::d:question">
224 <xsl:call-template name="process.qandaset"/>
230 <xsl:template match="d:answer" mode="qanda.label">
231 <xsl:apply-templates select="." mode="label.markup"/>
234 <xsl:template match="d:label">
235 <xsl:apply-templates/>
238 <!-- ==================================================================== -->
240 <xsl:template name="process.qanda.toc">
241 <!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
242 <!-- * then don't also include the nested stuff in the sub TOCs -->
244 <xsl:apply-templates select="d:qandadiv" mode="qandatoc.mode"/>
245 <xsl:apply-templates select="d:qandaset|d:qandaentry" mode="qandatoc.mode"/>
249 <xsl:template match="d:qandadiv" mode="qandatoc.mode">
250 <dt><xsl:apply-templates select="d:title" mode="qandatoc.mode"/></dt>
251 <dd><xsl:call-template name="process.qanda.toc"/></dd>
254 <xsl:template match="d:qandadiv/d:blockinfo/d:title| d:qandadiv/d:info/d:title| d:qandadiv/d:title" mode="qandatoc.mode">
255 <xsl:variable name="qalevel">
256 <xsl:call-template name="qandadiv.section.level"/>
258 <xsl:variable name="id">
259 <xsl:call-template name="object.id">
260 <xsl:with-param name="object" select="parent::*"/>
264 <xsl:variable name="div.label">
265 <xsl:apply-templates select="parent::d:qandadiv" mode="label.markup"/>
267 <xsl:if test="string-length($div.label) != 0">
268 <xsl:copy-of select="$div.label"/>
269 <xsl:value-of select="$autotoc.label.separator"/>
271 <xsl:text> </xsl:text>
273 <xsl:attribute name="href">
274 <xsl:call-template name="href.target">
275 <xsl:with-param name="object" select="parent::*"/>
278 <xsl:apply-templates/>
282 <xsl:template match="d:qandaset" mode="qandatoc.mode">
283 <xsl:for-each select="d:qandaentry">
284 <xsl:apply-templates select="." mode="qandatoc.mode"/>
288 <xsl:template match="d:qandaentry" mode="qandatoc.mode">
289 <xsl:apply-templates select="d:question" mode="qandatoc.mode"/>
292 <xsl:template match="d:question" mode="qandatoc.mode">
293 <xsl:variable name="firstch">
294 <!-- Use a titleabbrev or title if available -->
296 <xsl:when test="../d:blockinfo/d:titleabbrev">
297 <xsl:apply-templates select="../d:blockinfo/d:titleabbrev[1]/node()"/>
299 <xsl:when test="../d:blockinfo/d:title">
300 <xsl:apply-templates select="../d:blockinfo/d:title[1]/node()"/>
302 <xsl:when test="../d:info/d:titleabbrev">
303 <xsl:apply-templates select="../d:info/d:titleabbrev[1]/node()"/>
305 <xsl:when test="../d:titleabbrev">
306 <xsl:apply-templates select="../d:titleabbrev[1]/node()"/>
308 <xsl:when test="../d:info/d:title">
309 <xsl:apply-templates select="../d:info/d:title[1]/node()"/>
311 <xsl:when test="../d:title">
312 <xsl:apply-templates select="../d:title[1]/node()"/>
315 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
319 <xsl:variable name="deflabel">
321 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
322 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
325 <xsl:value-of select="$qanda.defaultlabel"/>
331 <xsl:apply-templates select="." mode="label.markup"/>
332 <xsl:if test="contains($deflabel,'number') and not(d:label)">
333 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
335 <xsl:text> </xsl:text>
337 <xsl:attribute name="href">
338 <xsl:call-template name="href.target">
339 <xsl:with-param name="object" select=".."/>
342 <xsl:value-of select="$firstch"/>
345 <!-- * include nested qandaset/qandaentry in TOC if user wants it -->
346 <xsl:if test="not($qanda.nested.in.toc = 0)">
347 <xsl:apply-templates select="following-sibling::d:answer" mode="qandatoc.mode"/>
351 <xsl:template match="d:answer" mode="qandatoc.mode">
352 <xsl:if test="descendant::d:question">
354 <xsl:call-template name="process.qanda.toc"/>
359 <!-- ==================================================================== -->
361 <xsl:template name="process.qandaset">
363 <xsl:variable name="deflabel">
364 <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
367 <xsl:variable name="label-width">
368 <xsl:call-template name="pi.dbhtml_label-width"/>
371 <xsl:variable name="table-summary">
372 <xsl:call-template name="pi.dbhtml_table-summary"/>
375 <xsl:variable name="cellpadding">
376 <xsl:call-template name="pi.dbhtml_cellpadding"/>
379 <xsl:variable name="cellspacing">
380 <xsl:call-template name="pi.dbhtml_cellspacing"/>
383 <table border="{$table.border.off}">
384 <xsl:if test="$css.decoration != 0">
385 <xsl:attribute name="style">width: 100%;</xsl:attribute>
387 <xsl:if test="$table-summary != ''">
388 <xsl:attribute name="summary">
389 <xsl:value-of select="$table-summary"/>
393 <xsl:if test="$cellpadding != ''">
394 <xsl:attribute name="cellpadding">
395 <xsl:value-of select="$cellpadding"/>
399 <xsl:if test="$cellspacing != ''">
400 <xsl:attribute name="cellspacing">
401 <xsl:value-of select="$cellspacing"/>
406 <col align="{$direction.align.start}">
407 <xsl:attribute name="width">
409 <xsl:when test="$label-width != ''">
410 <xsl:value-of select="$label-width"/>
413 <xsl:text>1%</xsl:text>
421 <xsl:apply-templates select="d:qandaentry|d:qandadiv"/>
426 <!-- ==================================================================== -->
428 <xsl:template match="*" mode="no.wrapper.mode">
429 <xsl:apply-templates/>
432 <!-- ==================================================================== -->