Debian Codegraph @

doc/SystemTap_Beginners_Guide/en-US/xsl/xhtml-common.xsl

raw
1 <?xml version='1.0'?>
2
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
4 xmlns:exsl="http://exslt.org/common"
5 xmlns:xtext="xalan://com.nwalsh.xalan.Text"
6 xmlns:xlink="http://www.w3.org/1999/xlink"
7 xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
8 xmlns:simg="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.ImageIntrinsics"
9 xmlns:ximg="xalan://com.nwalsh.xalan.ImageIntrinsics"
10 xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
11 xmlns:xtbl="com.nwalsh.xalan.Table"
12 xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
13 xmlns:perl="urn:perl"
14 xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
15 xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
16 xmlns:d="http://docbook.org/ns/docbook"
17 version="1.0"
18 exclude-result-prefixes="sverb xverb xlink exsl stext xtext simg ximg"
19 extension-element-prefixes="stext xtext perl ptbl xtbl stbl"
20 >
21
22 <!-- Admonition Graphics -->
23 <xsl:param name="admon.graphics" select="1"/>
24 <xsl:param name="callouts.extension" select="1"/>
25 <xsl:param name="admon.style" select="''"/>
26 <xsl:param name="admon.graphics.path">
27 <xsl:choose>
28 <xsl:when test="$embedtoc != 0">
29 <xsl:value-of select="concat($tocpath, '/../', $brand, '/', $langpath, '/images/')"/>
30 </xsl:when>
31 <xsl:otherwise>
32 <xsl:text>Common_Content/images/</xsl:text>
33 </xsl:otherwise>
34 </xsl:choose>
35 </xsl:param>
36 <xsl:param name="callout.graphics.path"><xsl:value-of select="$admon.graphics.path"/></xsl:param>
37
38 <xsl:param name="package" select="''"/>
39
40 <xsl:param name="ignore.image.scaling" select="0"/>
41
42 <xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD XHTML 1.0 Strict//EN'"/>
43 <xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"/>
44 <xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
45 <xsl:param name="chunker.output.indent" select="'no'"/>
46 <xsl:param name="html.longdesc.link" select="0"/>
47 <xsl:param name="html.longdesc" select="0"/>
48 <xsl:param name="html.stylesheet"><xsl:if test="$embedtoc = 0 ">Common_Content/css/default.css</xsl:if></xsl:param>
49 <xsl:param name="html.stylesheet.type" select="'text/css'"/>
50 <xsl:param name="html.stylesheet.print"><xsl:if test="$embedtoc = 0 ">Common_Content/css/print.css</xsl:if></xsl:param>
51 <xsl:param name="html.cleanup" select="0"/>
52 <xsl:param name="html.ext" select="'.html'"/>
53 <xsl:output method="xml" indent="yes"/>
54 <xsl:param name="highlight.source" select="1"/>
55 <xsl:param name="use.extensions" select="1"/>
56 <xsl:param name="tablecolumns.extension" select="1"/>
57
58 <xsl:param name="qanda.in.toc" select="0"/>
59 <xsl:param name="segmentedlist.as.table" select="1"/>
60 <xsl:param name="othercredit.like.author.enabled" select="0"/>
61 <xsl:param name="email.delimiters.enabled">0</xsl:param>
62
63 <xsl:param name="generate.id.attributes" select="0"/>
64 <xsl:param name="make.graphic.viewport" select="0"/>
65 <xsl:param name="use.embed.for.svg" select="0"/>
66
67 <!-- TOC -->
68 <xsl:param name="section.autolabel" select="1"/>
69 <xsl:param name="section.label.includes.component.label" select="1"/>
70
71 <xsl:param name="generate.toc">
72 set toc
73 book toc
74 article nop
75 chapter toc
76 qandadiv toc
77 qandaset toc
78 sect1 nop
79 sect2 nop
80 sect3 nop
81 sect4 nop
82 sect5 nop
83 section toc
84 part toc
85 </xsl:param>
86
87 <xsl:param name="suppress.navigation" select="0"/>
88 <xsl:param name="suppress.header.navigation" select="0"/>
89
90 <xsl:param name="header.rule" select="0"/>
91 <xsl:param name="footer.rule" select="0"/>
92 <xsl:param name="css.decoration" select="0"/>
93 <xsl:param name="ulink.target"/>
94 <xsl:param name="table.cell.border.style"/>
95
96 <!-- BUGBUG
97
98 There is a bug where inserting elements in to the body level
99 of xhtml will add xmlns="" to the tag. This is invalid xhtml.
100 To overcome this I added:
101 xmlns="http://www.w3.org/1999/xhtml"
102 to the outer most tag. This gets stripped by the parser, resulting
103 in valid xhtml ... go figure.
104 -->
105
106 <!--
107 From: xhtml/admon.xsl
108 Reason: remove tables
109 Version: 1.72.0
110 -->
111 <xsl:template name="graphical.admonition">
112 <xsl:variable name="admon.type">
113 <xsl:choose>
114 <xsl:when test="local-name(.)='note'">Note</xsl:when>
115 <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
116 <xsl:when test="local-name(.)='important'">Important</xsl:when>
117 <xsl:otherwise>Note</xsl:otherwise>
118 </xsl:choose>
119 </xsl:variable>
120
121 <xsl:variable name="alt">
122 <xsl:call-template name="gentext">
123 <xsl:with-param name="key" select="$admon.type"/>
124 </xsl:call-template>
125 </xsl:variable>
126
127 <div xmlns="http://www.w3.org/1999/xhtml">
128 <xsl:apply-templates select="." mode="class.attribute"/>
129 <xsl:if test="$admon.style != ''">
130 <xsl:attribute name="style">
131 <xsl:value-of select="$admon.style"/>
132 </xsl:attribute>
133 </xsl:if>
134 <xsl:if test="@id or @xml:id">
135 <xsl:attribute name="id">
136 <xsl:value-of select="(@id|@xml:id)[1]"/>
137 </xsl:attribute>
138 </xsl:if>
139 <xsl:call-template name="common.html.attributes"/>
140 <xsl:if test="$admon.textlabel != 0 or title">
141 <div class="admonition_header">
142 <p>
143 <strong><xsl:apply-templates select="." mode="object.title.markup"/></strong>
144 </p>
145 </div>
146 </xsl:if>
147 <div class="admonition">
148 <xsl:apply-templates/>
149 </div>
150 </div>
151 </xsl:template>
152
153 <!--
154 From: xhtml/lists.xsl
155 Reason: Remove invalid type attribute from ol
156 Version: 1.72.0
157 -->
158 <xsl:template match="substeps">
159 <xsl:variable name="numeration">
160 <xsl:call-template name="procedure.step.numeration"/>
161 </xsl:variable>
162 <ol xmlns="http://www.w3.org/1999/xhtml" class="substeps {$numeration}">
163 <xsl:call-template name="anchor"/>
164 <xsl:apply-templates/>
165 </ol>
166 </xsl:template>
167
168 <!--
169 From: xhtml/lists.xsl
170 Reason: Remove invalid type, start & compact attributes from ol, use role as class
171 Version: 1.72.0
172 -->
173 <xsl:template match="orderedlist">
174 <div xmlns="http://www.w3.org/1999/xhtml">
175 <xsl:call-template name="common.html.attributes"/>
176 <xsl:apply-templates select="." mode="class.attribute"/>
177 <xsl:call-template name="anchor"/>
178 <xsl:if test="title">
179 <xsl:call-template name="formal.object.heading"/>
180 </xsl:if>
181 <!-- Preserve order of PIs and comments -->
182 <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |
183 comment()[not(preceding-sibling::listitem)] |
184 processing-instruction()[not(preceding-sibling::listitem)]"/>
185 <ol>
186 <xsl:if test="@role">
187 <xsl:apply-templates select="." mode="class.attribute">
188 <xsl:with-param name="class" select="@role"/>
189 </xsl:apply-templates>
190 </xsl:if>
191 <xsl:if test="@numeration">
192 <xsl:apply-templates select="." mode="class.attribute">
193 <xsl:with-param name="class" select="@numeration"/>
194 </xsl:apply-templates>
195 </xsl:if>
196 <xsl:apply-templates select="listitem | comment()[preceding-sibling::listitem] | processing-instruction()[preceding-sibling::listitem]"/>
197 </ol>
198 </div>
199 </xsl:template>
200
201 <!--
202 From: xhtml/lists.xsl
203 Reason: Remove invalid type, start & compact attributes from ol
204 Version: 1.72.0
205 -->
206 <xsl:template match="procedure">
207 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
208
209 <xsl:variable name="placement">
210 <xsl:choose>
211 <xsl:when test="contains($param.placement, ' ')">
212 <xsl:value-of select="substring-before($param.placement, ' ')"/>
213 </xsl:when>
214 <xsl:when test="$param.placement = ''">before</xsl:when>
215 <xsl:otherwise>
216 <xsl:value-of select="$param.placement"/>
217 </xsl:otherwise>
218 </xsl:choose>
219 </xsl:variable>
220
221 <!-- Preserve order of PIs and comments -->
222 <xsl:variable name="preamble" select="*[not(self::step or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::step)] |processing-instruction()[not(preceding-sibling::step)]"/>
223 <div xmlns="http://www.w3.org/1999/xhtml">
224 <xsl:apply-templates select="." mode="class.attribute"/>
225 <xsl:call-template name="common.html.attributes"/>
226 <xsl:call-template name="anchor">
227 <xsl:with-param name="conditional">
228 <xsl:choose>
229 <xsl:when test="title">0</xsl:when>
230 <xsl:otherwise>1</xsl:otherwise>
231 </xsl:choose>
232 </xsl:with-param>
233 </xsl:call-template>
234 <xsl:if test="title and $placement = 'before'">
235 <xsl:call-template name="formal.object.heading"/>
236 </xsl:if>
237 <xsl:apply-templates select="$preamble"/>
238 <xsl:choose>
239 <xsl:when test="count(step) = 1">
240 <ul>
241 <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
242 </ul>
243 </xsl:when>
244 <xsl:otherwise>
245 <ol>
246 <xsl:attribute name="class">
247 <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
248 </xsl:attribute>
249 <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
250 </ol>
251 </xsl:otherwise>
252 </xsl:choose>
253 <xsl:if test="title and $placement != 'before'">
254 <xsl:call-template name="formal.object.heading"/>
255 </xsl:if>
256 </div>
257 </xsl:template>
258
259 <!--
260 From: xhtml/graphics.xsl
261 Reason: Remove html markup (align)
262 Version: 1.72.0
263 -->
264 <xsl:template name="longdesc.link">
265 <xsl:param name="longdesc.uri" select="''"/>
266
267 <xsl:variable name="this.uri">
268 <xsl:call-template name="make-relative-filename">
269 <xsl:with-param name="base.dir" select="$base.dir"/>
270 <xsl:with-param name="base.name">
271 <xsl:call-template name="href.target.uri"/>
272 </xsl:with-param>
273 </xsl:call-template>
274 </xsl:variable>
275 <xsl:variable name="href.to">
276 <xsl:call-template name="trim.common.uri.paths">
277 <xsl:with-param name="uriA" select="$longdesc.uri"/>
278 <xsl:with-param name="uriB" select="$this.uri"/>
279 <xsl:with-param name="return" select="'A'"/>
280 </xsl:call-template>
281 </xsl:variable>
282 <div xmlns="http://www.w3.org/1999/xhtml" class="longdesc-link">
283 <br/>
284 <span class="longdesc-link">
285 <xsl:text>[</xsl:text>
286 <a href="{$href.to}">D</a>
287 <xsl:text>]</xsl:text>
288 </span>
289 </div>
290 </xsl:template>
291
292 <!--
293 From: xhtml/docbook.xsl
294 Reason: Remove inline style for draft mode
295 Version: 1.72.0
296 -->
297 <xsl:template name="head.content">
298 <xsl:param name="node" select="."/>
299 <xsl:param name="title">
300 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
301 </xsl:param>
302
303 <title xmlns="http://www.w3.org/1999/xhtml" >
304 <xsl:copy-of select="$title"/>
305 </title>
306
307 <xsl:if test="$html.stylesheet != ''">
308 <xsl:call-template name="output.html.stylesheets">
309 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
310 </xsl:call-template>
311 </xsl:if>
312 <xsl:if test="$html.stylesheet.print != ''">
313 <link rel="stylesheet" media="print">
314 <xsl:attribute name="href">
315 <xsl:value-of select="$html.stylesheet.print"/>
316 </xsl:attribute>
317 <xsl:if test="$html.stylesheet.type != ''">
318 <xsl:attribute name="type">
319 <xsl:value-of select="$html.stylesheet.type"/>
320 </xsl:attribute>
321 </xsl:if>
322 </link>
323 </xsl:if>
324
325 <xsl:if test="$link.mailto.url != ''">
326 <link rev="made" href="{$link.mailto.url}"/>
327 </xsl:if>
328
329 <xsl:if test="$html.base != ''">
330 <base href="{$html.base}"/>
331 </xsl:if>
332
333 <meta xmlns="http://www.w3.org/1999/xhtml" name="generator">
334 <xsl:attribute name="content">
335 <xsl:text>not publican</xsl:text>
336 </xsl:attribute>
337 </meta>
338
339 <meta xmlns="http://www.w3.org/1999/xhtml" name="package">
340 <xsl:attribute name="content">
341 <xsl:copy-of select="$package"/>
342 </xsl:attribute>
343 </meta>
344 <xsl:if test="$generate.meta.abstract != 0">
345 <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/>
346 <xsl:if test="$info and $info/abstract">
347 <meta xmlns="http://www.w3.org/1999/xhtml" name="description">
348 <xsl:attribute name="content">
349 <xsl:for-each select="$info/abstract[1]/*">
350 <xsl:value-of select="normalize-space(.)"/>
351 <xsl:if test="position() &lt; last()">
352 <xsl:text> </xsl:text>
353 </xsl:if>
354 </xsl:for-each>
355 </xsl:attribute>
356 </meta>
357 </xsl:if>
358 </xsl:if>
359 <xsl:if test="$embedtoc != 0 ">
360 <link rel="stylesheet" type="text/css"><xsl:attribute name="href"><xsl:value-of select="$tocpath"/>/../chrome.css</xsl:attribute></link>
361 <link rel="stylesheet" type="text/css"><xsl:attribute name="href"><xsl:value-of select="$tocpath"/>/../db4.css</xsl:attribute></link>
362 <link rel="stylesheet" type="text/css"><xsl:attribute name="href"><xsl:value-of select="$tocpath"/>/../<xsl:value-of select="$brand"/>/<xsl:value-of select="$langpath"/>/css/brand.css</xsl:attribute></link>
363 <link rel="stylesheet" type="text/css"><xsl:attribute name="href"><xsl:value-of select="$tocpath"/>/../print.css</xsl:attribute><xsl:attribute name="media">print</xsl:attribute></link>
364 <script type="text/javascript"><xsl:attribute name="src"><xsl:value-of select="$tocpath"/>/../jquery-1.7.1.min.js</xsl:attribute></script>
365 <script type="text/javascript"><xsl:attribute name="src"><xsl:value-of select="$tocpath"/>/labels.js</xsl:attribute></script>
366 <script type="text/javascript"><xsl:attribute name="src"><xsl:value-of select="$tocpath"/>/../toc.js</xsl:attribute></script>
367 <script type="text/javascript">
368 <xsl:if test="$web.type = ''">
369 current_book = '<xsl:copy-of select="$pop_name"/>';
370 current_version = '<xsl:copy-of select="$pop_ver"/>';
371 current_product = '<xsl:copy-of select="$pop_prod"/>';
372 </xsl:if>
373 <xsl:if test="$web.type != ''">
374 current_book = '';
375 current_version = '';
376 </xsl:if>
377 toc_path = '<xsl:value-of select="$tocpath"/>';
378 loadMenu();
379 </script>
380 </xsl:if>
381
382 <xsl:apply-templates select="." mode="head.keywords.content"/>
383 </xsl:template>
384
385 <!--
386 From: xhtml/docbook.xsl
387 Reason: Add css class for draft mode
388 Version: 1.72.0
389 -->
390 <xsl:template name="body.attributes">
391 <!-- remove the if stmt checking writing.mode since it's not always defined, and RHEL5 doesn't like that. -->
392 <xsl:variable name="class">
393 <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and (ancestor-or-self::set | ancestor-or-self::book | ancestor-or-self::article)[1]/@status = 'draft'))">
394 <xsl:value-of select="ancestor-or-self::*[@status][1]/@status"/><xsl:text> </xsl:text>
395 </xsl:if>
396 <xsl:if test="$embedtoc != 0">
397 <xsl:text>toc_embeded </xsl:text>
398 </xsl:if>
399 <xsl:if test="$desktop != 0">
400 <xsl:text>desktop </xsl:text>
401 </xsl:if>
402 </xsl:variable>
403 <xsl:if test="$class != ''">
404 <xsl:attribute name="class">
405 <xsl:value-of select="$class"/>
406 </xsl:attribute>
407 </xsl:if>
408 </xsl:template>
409
410 <!--
411 From: xhtml/docbook.xsl
412 Reason: Add confidential to footer
413 Version: 1.72.0
414 -->
415 <xsl:template name="user.footer.content">
416 <xsl:param name="node" select="."/>
417 <xsl:if test="$confidential = '1'">
418 <div xmlns="http://www.w3.org/1999/xhtml" class="confidential">
419 <xsl:value-of select="$confidential.text"/>
420 </div>
421 </xsl:if>
422 <xsl:if test="$embedtoc != 0">
423 <div id="site_footer"></div>
424 <script type="text/javascript">
425 $("#site_footer").load("<xsl:value-of select="$tocpath"/>/../footer.html");
426 </script>
427 </xsl:if>
428 </xsl:template>
429
430 <!--
431 From: xhtml/block.xsl
432 Reason: default class (otherwise) to formalpara
433 Version: 1.72.0
434 -->
435 <xsl:template match="formalpara">
436 <xsl:call-template name="paragraph">
437 <xsl:with-param name="class">
438 <xsl:choose>
439 <xsl:when test="@role and $para.propagates.style != 0">
440 <xsl:value-of select="@role"/>
441 </xsl:when>
442 <xsl:otherwise>
443 <xsl:text>formalpara</xsl:text>
444 </xsl:otherwise>
445 </xsl:choose>
446 </xsl:with-param>
447 <xsl:with-param name="content">
448 <xsl:apply-templates/>
449 </xsl:with-param>
450 </xsl:call-template>
451 <!--xsl:apply-templates/-->
452 </xsl:template>
453
454 <!--
455 From: xhtml/block.xsl
456 Reason: h5 instead of <b>, remove default title end punctuation
457 Version: 1.72.0
458 -->
459 <xsl:template match="formalpara/title|formalpara/info/title">
460 <xsl:variable name="titleStr">
461 <xsl:apply-templates/>
462 </xsl:variable>
463 <div xmlns="http://www.w3.org/1999/xhtml" class="title">
464 <xsl:copy-of select="$titleStr"/>
465 </div>
466 </xsl:template>
467
468 <!--
469 From: xhtml/lists.xsl
470 Reason: use role as class
471 Version: 1.72.0
472 -->
473 <xsl:template match="itemizedlist">
474 <div xmlns="http://www.w3.org/1999/xhtml">
475 <xsl:call-template name="common.html.attributes"/>
476 <xsl:apply-templates select="." mode="class.attribute"/>
477 <xsl:call-template name="anchor"/>
478 <xsl:if test="title">
479 <xsl:call-template name="formal.object.heading"/>
480 </xsl:if>
481
482 <!-- Preserve order of PIs and comments -->
483 <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |
484 comment()[not(preceding-sibling::listitem)] |
485 processing-instruction()[not(preceding-sibling::listitem)]"/>
486 <ul>
487 <xsl:if test="@role">
488 <xsl:apply-templates select="." mode="class.attribute">
489 <xsl:with-param name="class" select="@role"/>
490 </xsl:apply-templates>
491 </xsl:if>
492 <xsl:if test="$css.decoration != 0">
493 <xsl:attribute name="type">
494 <xsl:call-template name="list.itemsymbol"/>
495 </xsl:attribute>
496 </xsl:if>
497
498 <xsl:apply-templates select="listitem | comment()[preceding-sibling::listitem] | processing-instruction()[preceding-sibling::listitem]"/>
499 </ul>
500 </div>
501 </xsl:template>
502
503 <!--
504 From: xhtml/xref.xsl
505 Reason: use role as class
506 Version: 1.72.0
507 -->
508 <xsl:template match="ulink" name="ulink">
509 <xsl:param name="url" select="@url"/>
510 <xsl:variable name="link">
511 <a xmlns="http://www.w3.org/1999/xhtml">
512 <xsl:if test="@id or @xml:id">
513 <xsl:attribute name="id">
514 <xsl:value-of select="(@id|@xml:id)[1]"/>
515 </xsl:attribute>
516 </xsl:if>
517 <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
518 <xsl:if test="$ulink.target != ''">
519 <xsl:attribute name="target">
520 <xsl:value-of select="$ulink.target"/>
521 </xsl:attribute>
522 </xsl:if>
523 <xsl:if test="@role">
524 <xsl:apply-templates select="." mode="class.attribute">
525 <xsl:with-param name="class" select="@role"/>
526 </xsl:apply-templates>
527 </xsl:if>
528 <xsl:choose>
529 <xsl:when test="count(child::node())=0">
530 <xsl:value-of select="$url"/>
531 </xsl:when>
532 <xsl:otherwise>
533 <xsl:apply-templates/>
534 </xsl:otherwise>
535 </xsl:choose>
536 </a>
537 </xsl:variable>
538 <xsl:copy-of select="$link"/>
539 </xsl:template>
540
541 <xsl:template match="*" mode="class.attribute">
542 <xsl:param name="class" select="local-name(.)"/>
543 <!-- permit customization of class attributes -->
544 <!-- Use element name by default -->
545 <xsl:variable name="class.value">
546 <xsl:apply-templates select="." mode="class.value">
547 <xsl:with-param name="class" select="$class"/>
548 </xsl:apply-templates>
549 <xsl:if test="@role">
550 <xsl:text> </xsl:text>
551 <xsl:value-of select="@role"/>
552 </xsl:if>
553 <xsl:if test="@revisionflag and ($draft.mode = 'yes' or ($draft.mode = 'maybe' and (ancestor-or-self::set | ancestor-or-self::book | ancestor-or-self::article)[1]/@status = 'draft'))">
554 <xsl:text> </xsl:text>
555 <xsl:value-of select="@revisionflag"/>
556 </xsl:if>
557 </xsl:variable>
558
559 <xsl:if test="string-length(normalize-space($class.value)) != 0">
560 <xsl:attribute name="class">
561 <xsl:value-of select="$class.value"/>
562 </xsl:attribute>
563 </xsl:if>
564 </xsl:template>
565
566 <!--
567 From: xhtml/qandaset.xsl
568 Reason: No stinking tables
569 Version: 1.72.0
570 -->
571 <xsl:template name="qandaset">
572 <div class="qandaset">
573 <xsl:apply-templates select="." mode="class.attribute"/>
574 <xsl:apply-templates />
575 </div>
576 </xsl:template>
577
578 <xsl:template name="process.qandaset">
579 <div class="qandaset">
580 <xsl:apply-templates select="." mode="class.attribute"/>
581 <xsl:apply-templates />
582 </div>
583 </xsl:template>
584
585 <xsl:template match="qandadiv">
586 <xsl:variable name="preamble" select="*[local-name(.) != 'title' and local-name(.) != 'titleabbrev' and local-name(.) != 'qandadiv' and local-name(.) != 'qandaentry']"/>
587
588 <xsl:if test="blockinfo/title|info/title|title">
589 <div class="qandadiv">
590 <xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
591 </div>
592 </xsl:if>
593
594 <xsl:variable name="toc">
595 <xsl:call-template name="dbhtml-attribute">
596 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
597 <xsl:with-param name="attribute" select="'toc'"/>
598 </xsl:call-template>
599 </xsl:variable>
600
601 <xsl:variable name="toc.params">
602 <xsl:call-template name="find.path.params">
603 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
604 </xsl:call-template>
605 </xsl:variable>
606 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
607 <div class="toc">
608 <xsl:call-template name="process.qanda.toc"/>
609 </div>
610 </xsl:if>
611 <xsl:if test="$preamble">
612 <div class="preamble">
613 <xsl:apply-templates select="$preamble"/>
614 </div>
615 </xsl:if>
616 <div>
617 <xsl:apply-templates select="." mode="class.attribute"/>
618 <xsl:apply-templates select="qandadiv|qandaentry"/>
619 </div>
620 </xsl:template>
621
622 <xsl:template match="qandaentry">
623 <div>
624 <xsl:apply-templates select="." mode="class.attribute"/>
625 <xsl:apply-templates/>
626 </div>
627 </xsl:template>
628
629 <xsl:template match="question">
630 <xsl:variable name="deflabel">
631 <xsl:choose>
632 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
633 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
634 </xsl:when>
635 <xsl:otherwise>
636 <xsl:value-of select="$qanda.defaultlabel"/>
637 </xsl:otherwise>
638 </xsl:choose>
639 </xsl:variable>
640 <xsl:variable name="label.content">
641 <xsl:apply-templates select="." mode="label.markup"/>
642 <xsl:if test="$deflabel = 'number' and not(label)">
643 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
644 </xsl:if>
645 </xsl:variable>
646 <div>
647 <xsl:apply-templates select="." mode="class.attribute"/>
648 <xsl:call-template name="anchor">
649 <xsl:with-param name="node" select=".."/>
650 <xsl:with-param name="conditional" select="0"/>
651 </xsl:call-template>
652 <!--xsl:call-template name="anchor">
653 <xsl:with-param name="conditional" select="0"/>
654 </xsl:call-template-->
655 <xsl:if test="string-length($label.content) &gt; 0">
656 <div class="label">
657 <xsl:copy-of select="$label.content"/>
658 </div>
659 </xsl:if>
660 <div class="data">
661 <xsl:apply-templates/>
662 </div>
663 </div>
664 </xsl:template>
665
666 <xsl:template match="answer">
667 <xsl:variable name="deflabel">
668 <xsl:choose>
669 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
670 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/>
671 </xsl:when>
672 <xsl:otherwise>
673 <xsl:value-of select="$qanda.defaultlabel"/>
674 </xsl:otherwise>
675 </xsl:choose>
676 </xsl:variable>
677
678 <div>
679 <xsl:apply-templates select="." mode="class.attribute"/>
680 <xsl:variable name="answer.label">
681 <xsl:apply-templates select="." mode="label.markup"/>
682 </xsl:variable>
683 <xsl:if test="string-length($answer.label) &gt; 0">
684 <div class="label">
685 <xsl:copy-of select="$answer.label"/>
686 </div>
687 </xsl:if>
688 <div class="data">
689 <xsl:apply-templates />
690 </div>
691 </div>
692 </xsl:template>
693
694 <!--
695
696 BUGBUG callout code blows up highlight if the span contains a newline
697 because it has to parse lines one by one to place the gfx
698
699 -->
700 <xsl:template match="perl_Alert | perl_BaseN | perl_BString | perl_Char | perl_Comment | perl_DataType | perl_DecVal | perl_Error | perl_Float | perl_Function | perl_IString | perl_Keyword | perl_Operator | perl_Others | perl_RegionMarker | perl_Reserved | perl_String | perl_Variable | perl_Warning ">
701 <xsl:variable name="name">
702 <xsl:value-of select="local-name(.)"/>
703 </xsl:variable>
704 <xsl:variable name="content">
705 <xsl:apply-templates/>
706 </xsl:variable>
707 <xsl:choose>
708 <xsl:when test="contains($content,'&#xA;')">
709 <span><xsl:attribute name="class"><xsl:value-of select="$name"/></xsl:attribute><xsl:value-of select="substring-before($content,'&#xA;')"/></span><xsl:text>
710 </xsl:text>
711 <span><xsl:attribute name="class"><xsl:value-of select="$name"/></xsl:attribute><xsl:value-of select="substring-after($content,'&#xA;')"/></span>
712 </xsl:when>
713 <xsl:otherwise>
714 <span><xsl:attribute name="class"><xsl:value-of select="$name"/></xsl:attribute><xsl:value-of select="$content"/></span>
715 </xsl:otherwise>
716 </xsl:choose>
717 </xsl:template>
718
719 <xsl:template match="productnumber" mode="book.titlepage.recto.auto.mode">
720 <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
721 </xsl:template>
722
723 <xsl:template match="productname" mode="titlepage.mode">
724 <span>
725 <xsl:apply-templates select="." mode="class.attribute"/>
726 <xsl:apply-templates mode="titlepage.mode"/>
727 </span>
728 </xsl:template>
729
730 <xsl:template match="productnumber" mode="titlepage.mode">
731 <span>
732 <xsl:apply-templates select="." mode="class.attribute"/>
733 <xsl:apply-templates mode="titlepage.mode"/>
734 </span>
735 </xsl:template>
736
737 <xsl:template match="productname" mode="book.titlepage.recto.auto.mode">
738 <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
739 </xsl:template>
740
741 <xsl:template match="orgdiv" mode="titlepage.mode">
742 <xsl:if test="preceding-sibling::*[1][self::orgname]">
743 <xsl:text> </xsl:text>
744 </xsl:if>
745 <span>
746 <xsl:apply-templates select="." mode="class.attribute"/>
747 <xsl:apply-templates mode="titlepage.mode"/>
748 </span>
749 </xsl:template>
750
751 <xsl:template match="orgname" mode="titlepage.mode">
752 <span>
753 <xsl:apply-templates select="." mode="class.attribute"/>
754 <xsl:apply-templates mode="titlepage.mode"/>
755 </span>
756 </xsl:template>
757
758 <xsl:template name="book.titlepage.recto">
759 <xsl:choose>
760 <xsl:when test="bookinfo/productname">
761 <div class="producttitle" xsl:use-attribute-sets="book.titlepage.recto.style">
762 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/productname"/>
763 <xsl:text> </xsl:text>
764 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/productnumber"/>
765 </div>
766 </xsl:when>
767 </xsl:choose>
768 <xsl:choose>
769 <xsl:when test="bookinfo/title">
770 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/>
771 </xsl:when>
772 <xsl:when test="info/title">
773 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/>
774 </xsl:when>
775 <xsl:when test="title">
776 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/>
777 </xsl:when>
778 </xsl:choose>
779
780 <xsl:choose>
781 <xsl:when test="bookinfo/subtitle">
782 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/>
783 </xsl:when>
784 <xsl:when test="info/subtitle">
785 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/>
786 </xsl:when>
787 <xsl:when test="subtitle">
788 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/>
789 </xsl:when>
790 </xsl:choose>
791
792 <xsl:apply-templates mode="titlepage.mode" select="bookinfo/edition"/>
793 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/>
794 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/>
795 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/>
796 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/>
797 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/>
798 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/>
799 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/>
800 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/>
801 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/>
802 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/>
803 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/>
804 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/>
805 <!--hr/-->
806 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/>
807 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/>
808 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/>
809 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/>
810 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/>
811 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/>
812 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/>
813 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/>
814 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/>
815 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/>
816 </xsl:template>
817
818 <xsl:template match="legalnotice" mode="titlepage.mode">
819 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
820 <xsl:choose>
821 <xsl:when test="$generate.legalnotice.link != 0">
822 <xsl:variable name="filename">
823 <xsl:call-template name="make-relative-filename">
824 <xsl:with-param name="base.dir" select="$base.dir"/>
825 <xsl:with-param name="base.name">
826 <xsl:apply-templates mode="chunk-filename" select="."/>
827 </xsl:with-param>
828 </xsl:call-template>
829 </xsl:variable>
830
831 <xsl:variable name="title">
832 <xsl:apply-templates select="." mode="title.markup"/>
833 </xsl:variable>
834
835 <xsl:variable name="href">
836 <xsl:apply-templates mode="chunk-filename" select="."/>
837 </xsl:variable>
838
839 <a href="{$href}"><xsl:copy-of select="$title"/></a>
840
841 <xsl:call-template name="write.chunk">
842 <xsl:with-param name="filename" select="$filename"/>
843 <xsl:with-param name="quiet" select="$chunk.quietly"/>
844 <xsl:with-param name="content">
845 <xsl:call-template name="user.preroot"/>
846 <html>
847 <head>
848 <xsl:call-template name="system.head.content"/>
849 <xsl:call-template name="head.content"/>
850 <xsl:call-template name="user.head.content"/>
851 </head>
852 <body>
853 <xsl:call-template name="body.attributes"/>
854 <div>
855 <xsl:apply-templates select="." mode="class.attribute"/>
856 <xsl:apply-templates mode="titlepage.mode"/>
857 </div>
858 </body>
859 </html>
860 <xsl:value-of select="$chunk.append"/>
861 </xsl:with-param>
862 </xsl:call-template>
863 </xsl:when>
864 <xsl:otherwise>
865 <div>
866 <xsl:apply-templates select="." mode="class.attribute"/>
867 <a id="{$id}"/>
868 <h1 class="legalnotice">
869 <xsl:call-template name="gentext">
870 <xsl:with-param name="key">LegalNotice</xsl:with-param>
871 </xsl:call-template>
872 </h1>
873 <xsl:apply-templates mode="titlepage.mode"/>
874 </div>
875 </xsl:otherwise>
876 </xsl:choose>
877 </xsl:template>
878
879 <xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
880 <xsl:call-template name="component.title">
881 <xsl:with-param name="node" select="ancestor::chapter[1]"/>
882 </xsl:call-template>
883 </xsl:template>
884
885 <xsl:template match="section/title|section/info/title|sectioninfo/title" mode="titlepage.mode" priority="2">
886 <xsl:call-template name="section.title"/>
887 </xsl:template>
888
889 <xsl:template match="edition" mode="titlepage.mode">
890 <p>
891 <xsl:apply-templates select="." mode="class.attribute"/>
892 <xsl:call-template name="gentext">
893 <xsl:with-param name="key" select="'Edition'"/>
894 </xsl:call-template>
895 <xsl:call-template name="gentext.space"/>
896 <xsl:apply-templates mode="titlepage.mode"/>
897 </p>
898 </xsl:template>
899
900 <xsl:template name="article.titlepage.recto">
901 <xsl:choose>
902 <xsl:when test="articleinfo/productname">
903 <div class="producttitle" xsl:use-attribute-sets="book.titlepage.recto.style">
904 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="articleinfo/productname"/>
905 <xsl:text> </xsl:text>
906 <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="articleinfo/productnumber"/>
907 </div>
908 </xsl:when>
909 </xsl:choose>
910 <xsl:choose>
911 <xsl:when test="articleinfo/title">
912 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/title"/>
913 </xsl:when>
914 <xsl:when test="artheader/title">
915 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/title"/>
916 </xsl:when>
917 <xsl:when test="info/title">
918 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/title"/>
919 </xsl:when>
920 <xsl:when test="title">
921 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="title"/>
922 </xsl:when>
923 </xsl:choose>
924
925 <xsl:choose>
926 <xsl:when test="articleinfo/subtitle">
927 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/subtitle"/>
928 </xsl:when>
929 <xsl:when test="artheader/subtitle">
930 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/subtitle"/>
931 </xsl:when>
932 <xsl:when test="info/subtitle">
933 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/subtitle"/>
934 </xsl:when>
935 <xsl:when test="subtitle">
936 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="subtitle"/>
937 </xsl:when>
938 </xsl:choose>
939
940 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/corpauthor"/>
941 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/corpauthor"/>
942 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/corpauthor"/>
943 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/authorgroup"/>
944 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/authorgroup"/>
945 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/authorgroup"/>
946 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/author"/>
947 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/author"/>
948 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/author"/>
949 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/othercredit"/>
950 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/othercredit"/>
951 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/othercredit"/>
952 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/releaseinfo"/>
953 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/releaseinfo"/>
954 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/releaseinfo"/>
955 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/copyright"/>
956 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/copyright"/>
957 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/copyright"/>
958 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/legalnotice"/>
959 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/legalnotice"/>
960 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/legalnotice"/>
961 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/pubdate"/>
962 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/pubdate"/>
963 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/pubdate"/>
964 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revision"/>
965 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revision"/>
966 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revision"/>
967 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revhistory"/>
968 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revhistory"/>
969 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revhistory"/>
970 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/abstract"/>
971 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/abstract"/>
972 <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/abstract"/>
973 </xsl:template>
974
975 <!--
976 From: xhtml/block.xsl
977 Reason: make para use a div since using P makes a bunch of nested block tags output invalid XHTML
978 Version: 1.72.0
979 -->
980
981 <xsl:template name="paragraph">
982 <xsl:param name="class" select="''"/>
983 <xsl:param name="content"/>
984
985 <xsl:variable name="p">
986 <div>
987 <xsl:call-template name="dir"/>
988 <xsl:apply-templates select="." mode="class.attribute">
989 <xsl:with-param name="class" select="'para'"/>
990 </xsl:apply-templates>
991 <!--xsl:if test="@id or @xml:id">
992 <xsl:attribute name="id">
993 <xsl:value-of select="(@id|@xml:id)[1]"/>
994 </xsl:attribute>
995 </xsl:if-->
996 <xsl:copy-of select="$content"/>
997 </div>
998 </xsl:variable>
999
1000 <xsl:choose>
1001 <xsl:when test="$html.cleanup != 0">
1002 <xsl:call-template name="unwrap.p">
1003 <xsl:with-param name="p" select="$p"/>
1004 </xsl:call-template>
1005 </xsl:when>
1006 <xsl:otherwise>
1007 <xsl:copy-of select="$p"/>
1008 </xsl:otherwise>
1009 </xsl:choose>
1010 </xsl:template>
1011
1012 <!--
1013 From: xhtml/block.xsl
1014 Reason: make para use a div since using P makes a bunch of nested block tags output invalid XHTML
1015 Version: 1.72.0
1016 -->
1017 <xsl:template match="simpara">
1018 <!-- see also listitem/simpara in lists.xsl -->
1019 <div class="para">
1020 <xsl:if test="@role and $para.propagates.style != 0">
1021 <xsl:apply-templates select="." mode="class.attribute">
1022 <xsl:with-param name="class" select="@role"/>
1023 </xsl:apply-templates>
1024 </xsl:if>
1025
1026 <xsl:call-template name="anchor"/>
1027 <p/>
1028 <xsl:apply-templates/>
1029 </div>
1030 </xsl:template>
1031
1032 <xsl:template match="collab" mode="titlepage.mode">
1033 </xsl:template>
1034
1035 <xsl:template match="funcprototype">
1036 <xsl:variable name="html-style">
1037 <xsl:call-template name="dbhtml-attribute">
1038 <xsl:with-param name="pis" select="ancestor::funcsynopsis//processing-instruction('dbhtml')"/>
1039 <xsl:with-param name="attribute" select="'funcsynopsis-style'"/>
1040 </xsl:call-template>
1041 </xsl:variable>
1042
1043 <xsl:variable name="style">
1044 <xsl:choose>
1045 <xsl:when test="$html-style != ''">
1046 <xsl:value-of select="$html-style"/>
1047 </xsl:when>
1048 <xsl:otherwise>
1049 <xsl:value-of select="$funcsynopsis.style"/>
1050 </xsl:otherwise>
1051 </xsl:choose>
1052 </xsl:variable>
1053
1054 <!--
1055 <xsl:variable name="tabular-p"
1056 select="$funcsynopsis.tabular.threshold &gt; 0
1057 and string-length(.) &gt; $funcsynopsis.tabular.threshold"/>
1058 -->
1059
1060 <xsl:variable name="tabular-p" select="false()"/>
1061
1062 <xsl:choose>
1063 <xsl:when test="$style = 'kr' and $tabular-p">
1064 <xsl:apply-templates select="." mode="kr-tabular"/>
1065 </xsl:when>
1066 <xsl:when test="$style = 'kr'">
1067 <xsl:apply-templates select="." mode="kr-nontabular"/>
1068 </xsl:when>
1069 <xsl:when test="$style = 'ansi' and $tabular-p">
1070 <xsl:apply-templates select="." mode="ansi-tabular"/>
1071 </xsl:when>
1072 <xsl:otherwise>
1073 <xsl:apply-templates select="." mode="ansi-nontabular"/>
1074 </xsl:otherwise>
1075 </xsl:choose>
1076 </xsl:template>
1077
1078 <xsl:template name="process.image">
1079 <!-- When this template is called, the current node should be -->
1080 <!-- a graphic, inlinegraphic, imagedata, or videodata. All -->
1081 <!-- those elements have the same set of attributes, so we can -->
1082 <!-- handle them all in one place. -->
1083 <xsl:param name="tag" select="'img'"/>
1084 <xsl:param name="alt"/>
1085 <xsl:param name="longdesc"/>
1086
1087 <!-- The HTML img element only supports the notion of content-area
1088 scaling; it doesn't support the distinction between a
1089 content-area and a viewport-area, so we have to make some
1090 compromises.
1091
1092 1. If only the content-area is specified, everything is fine.
1093 (If you ask for a three inch image, that's what you'll get.)
1094
1095 2. If only the viewport-area is provided:
1096 - If scalefit=1, treat it as both the content-area and
1097 the viewport-area. (If you ask for an image in a five inch
1098 area, we'll make the image five inches to fill that area.)
1099 - If scalefit=0, ignore the viewport-area specification.
1100
1101 Note: this is not quite the right semantic and has the additional
1102 problem that it can result in anamorphic scaling, which scalefit
1103 should never cause.
1104
1105 3. If both the content-area and the viewport-area is specified
1106 on a graphic element, ignore the viewport-area.
1107 (If you ask for a three inch image in a five inch area, we'll assume
1108 it's better to give you a three inch image in an unspecified area
1109 than a five inch image in a five inch area.
1110
1111 Relative units also cause problems. As a general rule, the stylesheets
1112 are operating too early and too loosely coupled with the rendering engine
1113 to know things like the current font size or the actual dimensions of
1114 an image. Therefore:
1115
1116 1. We use a fixed size for pixels, $pixels.per.inch
1117
1118 2. We use a fixed size for "em"s, $points.per.em
1119
1120 Percentages are problematic. In the following discussion, we speak
1121 of width and contentwidth, but the same issues apply to depth and
1122 contentdepth
1123
1124 1. A width of 50% means "half of the available space for the image."
1125 That's fine. But note that in HTML, this is a dynamic property and
1126 the image size will vary if the browser window is resized.
1127
1128 2. A contentwidth of 50% means "half of the actual image width". But
1129 the stylesheets have no way to assess the image's actual size. Treating
1130 this as a width of 50% is one possibility, but it produces behavior
1131 (dynamic scaling) that seems entirely out of character with the
1132 meaning.
1133
1134 Instead, the stylesheets define a $nominal.image.width
1135 and convert percentages to actual values based on that nominal size.
1136
1137 Scale can be problematic. Scale applies to the contentwidth, so
1138 a scale of 50 when a contentwidth is not specified is analagous to a
1139 width of 50%. (If a contentwidth is specified, the scaling factor can
1140 be applied to that value and no problem exists.)
1141
1142 If scale is specified but contentwidth is not supplied, the
1143 nominal.image.width is used to calculate a base size
1144 for scaling.
1145
1146 Warning: as a consequence of these decisions, unless the aspect ratio
1147 of your image happens to be exactly the same as (nominal width / nominal height),
1148 specifying contentwidth="50%" and contentdepth="50%" is NOT going to
1149 scale the way you expect (or really, the way it should).
1150
1151 Don't do that. In fact, a percentage value is not recommended for content
1152 size at all. Use scale instead.
1153
1154 Finally, align and valign are troublesome. Horizontal alignment is now
1155 supported by wrapping the image in a <div align="{@align}"> (in block
1156 contexts!). I can't think of anything (practical) to do about vertical
1157 alignment.
1158 -->
1159
1160 <xsl:variable name="width-units">
1161 <xsl:choose>
1162 <xsl:when test="$ignore.image.scaling != 0"/>
1163 <xsl:when test="@width">
1164 <xsl:call-template name="length-units">
1165 <xsl:with-param name="length" select="@width"/>
1166 </xsl:call-template>
1167 </xsl:when>
1168 <xsl:when test="not(@depth) and $default.image.width != ''">
1169 <xsl:call-template name="length-units">
1170 <xsl:with-param name="length" select="$default.image.width"/>
1171 </xsl:call-template>
1172 </xsl:when>
1173 </xsl:choose>
1174 </xsl:variable>
1175
1176 <xsl:variable name="width">
1177 <xsl:choose>
1178 <xsl:when test="$ignore.image.scaling != 0"/>
1179 <xsl:when test="@width">
1180 <xsl:choose>
1181 <xsl:when test="$width-units = '%'">
1182 <xsl:value-of select="@width"/>
1183 </xsl:when>
1184 <xsl:otherwise>
1185 <xsl:call-template name="length-spec">
1186 <xsl:with-param name="length" select="@width"/>
1187 </xsl:call-template>
1188 </xsl:otherwise>
1189 </xsl:choose>
1190 </xsl:when>
1191 <xsl:when test="not(@depth) and $default.image.width != ''">
1192 <xsl:value-of select="$default.image.width"/>
1193 </xsl:when>
1194 </xsl:choose>
1195 </xsl:variable>
1196
1197 <xsl:variable name="scalefit">
1198 <xsl:choose>
1199 <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
1200 <xsl:when test="@contentwidth or @contentdepth">0</xsl:when>
1201 <xsl:when test="@scale">0</xsl:when>
1202 <xsl:when test="@scalefit"><xsl:value-of select="@scalefit"/></xsl:when>
1203 <xsl:when test="$width != '' or @depth">1</xsl:when>
1204 <xsl:otherwise>0</xsl:otherwise>
1205 </xsl:choose>
1206 </xsl:variable>
1207
1208 <xsl:variable name="scale">
1209 <xsl:choose>
1210 <xsl:when test="$ignore.image.scaling != 0">1.0</xsl:when>
1211 <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
1212 <xsl:when test="@scale">
1213 <xsl:value-of select="@scale div 100.0"/>
1214 </xsl:when>
1215 <xsl:otherwise>1.0</xsl:otherwise>
1216 </xsl:choose>
1217 </xsl:variable>
1218
1219 <xsl:variable name="filename">
1220 <xsl:choose>
1221 <xsl:when test="local-name(.) = 'graphic' or local-name(.) = 'inlinegraphic'">
1222 <!-- handle legacy graphic and inlinegraphic by new template -->
1223 <xsl:call-template name="mediaobject.filename">
1224 <xsl:with-param name="object" select="."/>
1225 </xsl:call-template>
1226 </xsl:when>
1227 <xsl:otherwise>
1228 <!-- imagedata, videodata, audiodata -->
1229 <xsl:call-template name="mediaobject.filename">
1230 <xsl:with-param name="object" select=".."/>
1231 </xsl:call-template>
1232 </xsl:otherwise>
1233 </xsl:choose>
1234 </xsl:variable>
1235
1236 <xsl:variable name="output_filename">
1237 <xsl:choose>
1238 <xsl:when test="$embedtoc != 0 and contains($filename, 'Common_Content')">
1239 <xsl:value-of select=" concat($tocpath, '/../', $brand, '/',$langpath)"/>
1240 <xsl:value-of select="substring-after($filename, 'Common_Content')"/>
1241 </xsl:when>
1242 <xsl:when test="@entityref">
1243 <xsl:value-of select="$filename"/>
1244 </xsl:when>
1245 <!--
1246 Moved test for $keep.relative.image.uris to template below:
1247 <xsl:template match="@fileref">
1248 -->
1249 <xsl:otherwise>
1250 <xsl:value-of select="$filename"/>
1251 </xsl:otherwise>
1252 </xsl:choose>
1253 </xsl:variable>
1254
1255 <xsl:variable name="img.src.path.pi">
1256 <xsl:call-template name="dbhtml-attribute">
1257 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
1258 <xsl:with-param name="attribute" select="'img.src.path'"/>
1259 </xsl:call-template>
1260 </xsl:variable>
1261
1262 <xsl:variable name="filename.for.graphicsize">
1263 <xsl:choose>
1264 <xsl:when test="$img.src.path.pi != ''">
1265 <xsl:value-of select="concat($img.src.path.pi, $filename)"/>
1266 </xsl:when>
1267 <xsl:when test="$img.src.path != '' and $graphicsize.use.img.src.path != 0 and $tag = 'img' and not(starts-with($filename, '/')) and not(contains($filename, '://'))">
1268 <xsl:value-of select="concat($img.src.path, $filename)"/>
1269 </xsl:when>
1270 <xsl:otherwise>
1271 <xsl:value-of select="$filename"/>
1272 </xsl:otherwise>
1273 </xsl:choose>
1274 </xsl:variable>
1275
1276 <xsl:variable name="realintrinsicwidth">
1277 <!-- This funny compound test works around a bug in XSLTC -->
1278 <xsl:choose>
1279 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
1280 <xsl:choose>
1281 <xsl:when test="function-available('simg:getWidth')">
1282 <xsl:value-of select="simg:getWidth(simg:new($filename.for.graphicsize), $nominal.image.width)"/>
1283 </xsl:when>
1284 <xsl:when test="function-available('ximg:getWidth')">
1285 <xsl:value-of select="ximg:getWidth(ximg:new($filename.for.graphicsize), $nominal.image.width)"/>
1286 </xsl:when>
1287 <xsl:otherwise>
1288 <xsl:value-of select="0"/>
1289 </xsl:otherwise>
1290 </xsl:choose>
1291 </xsl:when>
1292 <xsl:otherwise>
1293 <xsl:value-of select="0"/>
1294 </xsl:otherwise>
1295 </xsl:choose>
1296 </xsl:variable>
1297
1298 <xsl:variable name="intrinsicwidth">
1299 <xsl:choose>
1300 <xsl:when test="$realintrinsicwidth = 0">
1301 <xsl:value-of select="$nominal.image.width"/>
1302 </xsl:when>
1303 <xsl:otherwise>
1304 <xsl:value-of select="$realintrinsicwidth"/>
1305 </xsl:otherwise>
1306 </xsl:choose>
1307 </xsl:variable>
1308
1309 <xsl:variable name="intrinsicdepth">
1310 <!-- This funny compound test works around a bug in XSLTC -->
1311 <xsl:choose>
1312 <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
1313 <xsl:choose>
1314 <xsl:when test="function-available('simg:getDepth')">
1315 <xsl:value-of select="simg:getDepth(simg:new($filename.for.graphicsize), $nominal.image.depth)"/>
1316 </xsl:when>
1317 <xsl:when test="function-available('ximg:getDepth')">
1318 <xsl:value-of select="ximg:getDepth(ximg:new($filename.for.graphicsize), $nominal.image.depth)"/>
1319 </xsl:when>
1320 <xsl:otherwise>
1321 <xsl:value-of select="$nominal.image.depth"/>
1322 </xsl:otherwise>
1323 </xsl:choose>
1324 </xsl:when>
1325 <xsl:otherwise>
1326 <xsl:value-of select="$nominal.image.depth"/>
1327 </xsl:otherwise>
1328 </xsl:choose>
1329 </xsl:variable>
1330
1331 <xsl:variable name="contentwidth">
1332 <xsl:choose>
1333 <xsl:when test="$ignore.image.scaling != 0"/>
1334 <xsl:when test="@contentwidth">
1335 <xsl:variable name="units">
1336 <xsl:call-template name="length-units">
1337 <xsl:with-param name="length" select="@contentwidth"/>
1338 </xsl:call-template>
1339 </xsl:variable>
1340
1341 <xsl:choose>
1342 <xsl:when test="$units = '%'">
1343 <xsl:variable name="cmagnitude">
1344 <xsl:call-template name="length-magnitude">
1345 <xsl:with-param name="length" select="@contentwidth"/>
1346 </xsl:call-template>
1347 </xsl:variable>
1348 <xsl:value-of select="$intrinsicwidth * $cmagnitude div 100.0"/>
1349 <xsl:text>px</xsl:text>
1350 </xsl:when>
1351 <xsl:otherwise>
1352 <xsl:call-template name="length-spec">
1353 <xsl:with-param name="length" select="@contentwidth"/>
1354 </xsl:call-template>
1355 </xsl:otherwise>
1356 </xsl:choose>
1357 </xsl:when>
1358 <xsl:otherwise>
1359 <xsl:value-of select="$intrinsicwidth"/>
1360 <xsl:text>px</xsl:text>
1361 </xsl:otherwise>
1362 </xsl:choose>
1363 </xsl:variable>
1364
1365 <xsl:variable name="scaled.contentwidth">
1366 <xsl:if test="$contentwidth != ''">
1367 <xsl:variable name="cwidth.in.points">
1368 <xsl:call-template name="length-in-points">
1369 <xsl:with-param name="length" select="$contentwidth"/>
1370 <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
1371 <xsl:with-param name="em.size" select="$points.per.em"/>
1372 </xsl:call-template>
1373 </xsl:variable>
1374 <xsl:value-of select="$cwidth.in.points div 72.0 * $pixels.per.inch * $scale"/>
1375 </xsl:if>
1376 </xsl:variable>
1377
1378 <xsl:variable name="html.width">
1379 <xsl:choose>
1380 <xsl:when test="$ignore.image.scaling != 0"/>
1381 <xsl:when test="$width-units = '%'">
1382 <xsl:value-of select="$width"/>
1383 </xsl:when>
1384 <xsl:when test="$width != ''">
1385 <xsl:variable name="width.in.points">
1386 <xsl:call-template name="length-in-points">
1387 <xsl:with-param name="length" select="$width"/>
1388 <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
1389 <xsl:with-param name="em.size" select="$points.per.em"/>
1390 </xsl:call-template>
1391 </xsl:variable>
1392 <xsl:value-of select="round($width.in.points div 72.0 * $pixels.per.inch)"/>
1393 </xsl:when>
1394 <xsl:otherwise/>
1395 </xsl:choose>
1396 </xsl:variable>
1397
1398 <xsl:variable name="contentdepth">
1399 <xsl:choose>
1400 <xsl:when test="$ignore.image.scaling != 0"/>
1401 <xsl:when test="@contentdepth">
1402 <xsl:variable name="units">
1403 <xsl:call-template name="length-units">
1404 <xsl:with-param name="length" select="@contentdepth"/>
1405 </xsl:call-template>
1406 </xsl:variable>
1407
1408 <xsl:choose>
1409 <xsl:when test="$units = '%'">
1410 <xsl:variable name="cmagnitude">
1411 <xsl:call-template name="length-magnitude">
1412 <xsl:with-param name="length" select="@contentdepth"/>
1413 </xsl:call-template>
1414 </xsl:variable>
1415 <xsl:value-of select="$intrinsicdepth * $cmagnitude div 100.0"/>
1416 <xsl:text>px</xsl:text>
1417 </xsl:when>
1418 <xsl:otherwise>
1419 <xsl:call-template name="length-spec">
1420 <xsl:with-param name="length" select="@contentdepth"/>
1421 </xsl:call-template>
1422 </xsl:otherwise>
1423 </xsl:choose>
1424 </xsl:when>
1425 <xsl:otherwise>
1426 <xsl:value-of select="$intrinsicdepth"/>
1427 <xsl:text>px</xsl:text>
1428 </xsl:otherwise>
1429 </xsl:choose>
1430 </xsl:variable>
1431
1432 <xsl:variable name="scaled.contentdepth">
1433 <xsl:if test="$contentdepth != ''">
1434 <xsl:variable name="cdepth.in.points">
1435 <xsl:call-template name="length-in-points">
1436 <xsl:with-param name="length" select="$contentdepth"/>
1437 <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
1438 <xsl:with-param name="em.size" select="$points.per.em"/>
1439 </xsl:call-template>
1440 </xsl:variable>
1441 <xsl:value-of select="$cdepth.in.points div 72.0 * $pixels.per.inch * $scale"/>
1442 </xsl:if>
1443 </xsl:variable>
1444
1445 <xsl:variable name="depth-units">
1446 <xsl:if test="@depth">
1447 <xsl:call-template name="length-units">
1448 <xsl:with-param name="length" select="@depth"/>
1449 </xsl:call-template>
1450 </xsl:if>
1451 </xsl:variable>
1452
1453 <xsl:variable name="depth">
1454 <xsl:if test="@depth">
1455 <xsl:choose>
1456 <xsl:when test="$depth-units = '%'">
1457 <xsl:value-of select="@depth"/>
1458 </xsl:when>
1459 <xsl:otherwise>
1460 <xsl:call-template name="length-spec">
1461 <xsl:with-param name="length" select="@depth"/>
1462 </xsl:call-template>
1463 </xsl:otherwise>
1464 </xsl:choose>
1465 </xsl:if>
1466 </xsl:variable>
1467
1468 <xsl:variable name="html.depth">
1469 <xsl:choose>
1470 <xsl:when test="$ignore.image.scaling != 0"/>
1471 <xsl:when test="$depth-units = '%'">
1472 <xsl:value-of select="$depth"/>
1473 </xsl:when>
1474 <xsl:when test="@depth and @depth != ''">
1475 <xsl:variable name="depth.in.points">
1476 <xsl:call-template name="length-in-points">
1477 <xsl:with-param name="length" select="$depth"/>
1478 <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
1479 <xsl:with-param name="em.size" select="$points.per.em"/>
1480 </xsl:call-template>
1481 </xsl:variable>
1482 <xsl:value-of select="round($depth.in.points div 72.0 * $pixels.per.inch)"/>
1483 </xsl:when>
1484 <xsl:otherwise/>
1485 </xsl:choose>
1486 </xsl:variable>
1487
1488 <xsl:variable name="viewport">
1489 <xsl:choose>
1490 <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
1491 <xsl:when test="local-name(.) = 'inlinegraphic' or ancestor::inlinemediaobject or ancestor::inlineequation">0</xsl:when>
1492 <xsl:otherwise>
1493 <xsl:value-of select="$make.graphic.viewport"/>
1494 </xsl:otherwise>
1495 </xsl:choose>
1496 </xsl:variable>
1497
1498 <!--
1499 <xsl:message>=====================================
1500 scale: <xsl:value-of select="$scale"/>, <xsl:value-of select="$scalefit"/>
1501 @contentwidth <xsl:value-of select="@contentwidth"/>
1502 $contentwidth <xsl:value-of select="$contentwidth"/>
1503 scaled.contentwidth: <xsl:value-of select="$scaled.contentwidth"/>
1504 @width: <xsl:value-of select="@width"/>
1505 width: <xsl:value-of select="$width"/>
1506 html.width: <xsl:value-of select="$html.width"/>
1507 @contentdepth <xsl:value-of select="@contentdepth"/>
1508 $contentdepth <xsl:value-of select="$contentdepth"/>
1509 scaled.contentdepth: <xsl:value-of select="$scaled.contentdepth"/>
1510 @depth: <xsl:value-of select="@depth"/>
1511 depth: <xsl:value-of select="$depth"/>
1512 html.depth: <xsl:value-of select="$html.depth"/>
1513 align: <xsl:value-of select="@align"/>
1514 valign: <xsl:value-of select="@valign"/></xsl:message>
1515 -->
1516
1517 <xsl:variable name="scaled" select="@width|@depth|@contentwidth|@contentdepth |@scale|@scalefit"/>
1518
1519 <xsl:variable name="img">
1520 <xsl:choose>
1521 <xsl:when test="@format = 'SVG' and $svg.object != 0">
1522 <object data="{$output_filename}" type="image/svg+xml">
1523 <xsl:call-template name="process.image.attributes">
1524 <!--xsl:with-param name="alt" select="$alt"/ there's no alt here-->
1525 <xsl:with-param name="html.depth" select="$html.depth"/>
1526 <xsl:with-param name="html.width" select="$html.width"/>
1527 <xsl:with-param name="longdesc" select="$longdesc"/>
1528 <xsl:with-param name="scale" select="$scale"/>
1529 <xsl:with-param name="scalefit" select="$scalefit"/>
1530 <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
1531 <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
1532 <xsl:with-param name="viewport" select="$viewport"/>
1533 </xsl:call-template>
1534 <xsl:if test="@align">
1535 <xsl:attribute name="align">
1536 <xsl:choose>
1537 <xsl:when test="@align = 'center'">middle</xsl:when>
1538 <xsl:otherwise>
1539 <xsl:value-of select="@align"/>
1540 </xsl:otherwise>
1541 </xsl:choose>
1542 </xsl:attribute>
1543 </xsl:if>
1544 <xsl:if test="$use.embed.for.svg != 0">
1545 <embed src="{$output_filename}" type="image/svg+xml">
1546 <xsl:call-template name="process.image.attributes">
1547 <!--xsl:with-param name="alt" select="$alt"/ there's no alt here -->
1548 <xsl:with-param name="html.depth" select="$html.depth"/>
1549 <xsl:with-param name="html.width" select="$html.width"/>
1550 <xsl:with-param name="longdesc" select="$longdesc"/>
1551 <xsl:with-param name="scale" select="$scale"/>
1552 <xsl:with-param name="scalefit" select="$scalefit"/>
1553 <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
1554 <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
1555 <xsl:with-param name="viewport" select="$viewport"/>
1556 </xsl:call-template>
1557 </embed>
1558 </xsl:if>
1559 <img src="{substring-before($output_filename,'.svg')}.png" alt="{$alt}"/>
1560 </object>
1561 </xsl:when>
1562 <xsl:otherwise>
1563 <xsl:element name="{$tag}" namespace="http://www.w3.org/1999/xhtml">
1564 <xsl:if test="$tag = 'img' and ../../self::imageobjectco">
1565 <xsl:variable name="mapname">
1566 <xsl:call-template name="object.id">
1567 <xsl:with-param name="object" select="../../areaspec"/>
1568 </xsl:call-template>
1569 </xsl:variable>
1570 <xsl:choose>
1571 <xsl:when test="$scaled">
1572 <!-- It might be possible to handle some scaling; needs -->
1573 <!-- more investigation -->
1574 <xsl:message>
1575 <xsl:text>Warning: imagemaps not supported </xsl:text>
1576 <xsl:text>on scaled images</xsl:text>
1577 </xsl:message>
1578 </xsl:when>
1579 <xsl:otherwise>
1580 <xsl:attribute name="border">0</xsl:attribute>
1581 <xsl:attribute name="usemap">
1582 <xsl:value-of select="concat('#', $mapname)"/>
1583 </xsl:attribute>
1584 </xsl:otherwise>
1585 </xsl:choose>
1586 </xsl:if>
1587
1588 <xsl:attribute name="src">
1589 <xsl:choose>
1590 <xsl:when test="$img.src.path != '' and $tag = 'img' and not(starts-with($output_filename, '/')) and not(contains($output_filename, '://'))">
1591 <xsl:value-of select="$img.src.path"/>
1592 </xsl:when>
1593 </xsl:choose>
1594 <xsl:value-of select="$output_filename"/>
1595 </xsl:attribute>
1596
1597 <xsl:if test="@align">
1598 <xsl:attribute name="align">
1599 <xsl:choose>
1600 <xsl:when test="@align = 'center'">middle</xsl:when>
1601 <xsl:otherwise>
1602 <xsl:value-of select="@align"/>
1603 </xsl:otherwise>
1604 </xsl:choose>
1605 </xsl:attribute>
1606 </xsl:if>
1607
1608 <xsl:call-template name="process.image.attributes">
1609 <xsl:with-param name="alt">
1610 <xsl:choose>
1611 <xsl:when test="$alt != ''">
1612 <xsl:copy-of select="$alt"/>
1613 </xsl:when>
1614 <xsl:when test="ancestor::figure">
1615 <xsl:value-of select="normalize-space(ancestor::figure/title)"/>
1616 </xsl:when>
1617 </xsl:choose>
1618 </xsl:with-param>
1619 <xsl:with-param name="html.depth" select="$html.depth"/>
1620 <xsl:with-param name="html.width" select="$html.width"/>
1621 <xsl:with-param name="longdesc" select="$longdesc"/>
1622 <xsl:with-param name="scale" select="$scale"/>
1623 <xsl:with-param name="scalefit" select="$scalefit"/>
1624 <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
1625 <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
1626 <xsl:with-param name="viewport" select="$viewport"/>
1627 </xsl:call-template>
1628 </xsl:element>
1629 </xsl:otherwise>
1630 </xsl:choose>
1631 </xsl:variable>
1632
1633 <xsl:variable name="bgcolor">
1634 <xsl:call-template name="dbhtml-attribute">
1635 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
1636 <xsl:with-param name="attribute" select="'background-color'"/>
1637 </xsl:call-template>
1638 </xsl:variable>
1639
1640 <xsl:variable name="use.viewport" select="$viewport != 0 and ($html.width != '' or ($html.depth != '' and $depth-units != '%') or $bgcolor != '' or @valign)"/>
1641
1642 <xsl:choose>
1643 <xsl:when test="$use.viewport">
1644 <table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0">
1645 <xsl:if test="$html.width != ''">
1646 <xsl:attribute name="width">
1647 <xsl:value-of select="$html.width"/>
1648 </xsl:attribute>
1649 </xsl:if>
1650 <tr>
1651 <xsl:if test="$html.depth != '' and $depth-units != '%'">
1652 <!-- don't do this for percentages because browsers get confused -->
1653 <xsl:choose>
1654 <xsl:when test="$css.decoration != 0">
1655 <xsl:attribute name="style">
1656 <xsl:text>height: </xsl:text>
1657 <xsl:value-of select="$html.depth"/>
1658 <xsl:text>px</xsl:text>
1659 </xsl:attribute>
1660 </xsl:when>
1661 <xsl:otherwise>
1662 <xsl:attribute name="height">
1663 <xsl:value-of select="$html.depth"/>
1664 </xsl:attribute>
1665 </xsl:otherwise>
1666 </xsl:choose>
1667 </xsl:if>
1668 <td>
1669 <xsl:if test="$bgcolor != ''">
1670 <xsl:choose>
1671 <xsl:when test="$css.decoration != 0">
1672 <xsl:attribute name="style">
1673 <xsl:text>background-color: </xsl:text>
1674 <xsl:value-of select="$bgcolor"/>
1675 </xsl:attribute>
1676 </xsl:when>
1677 <xsl:otherwise>
1678 <xsl:attribute name="bgcolor">
1679 <xsl:value-of select="$bgcolor"/>
1680 </xsl:attribute>
1681 </xsl:otherwise>
1682 </xsl:choose>
1683 </xsl:if>
1684 <xsl:if test="@align">
1685 <xsl:attribute name="align">
1686 <xsl:value-of select="@align"/>
1687 </xsl:attribute>
1688 </xsl:if>
1689 <xsl:if test="@valign">
1690 <xsl:attribute name="valign">
1691 <xsl:value-of select="@valign"/>
1692 </xsl:attribute>
1693 </xsl:if>
1694 <xsl:copy-of select="$img"/>
1695 </td>
1696 </tr>
1697 </table>
1698 </xsl:when>
1699 <xsl:otherwise>
1700 <xsl:copy-of select="$img"/>
1701 </xsl:otherwise>
1702 </xsl:choose>
1703
1704 <xsl:if test="$tag = 'img' and ../../self::imageobjectco and not($scaled)">
1705 <xsl:variable name="mapname">
1706 <xsl:call-template name="object.id">
1707 <xsl:with-param name="object" select="../../areaspec"/>
1708 </xsl:call-template>
1709 </xsl:variable>
1710
1711 <map name="{$mapname}">
1712 <xsl:for-each select="../../areaspec//area">
1713 <xsl:variable name="units">
1714 <xsl:choose>
1715 <xsl:when test="@units = 'other' and @otherunits">
1716 <xsl:value-of select="@otherunits"/>
1717 </xsl:when>
1718 <xsl:when test="@units">
1719 <xsl:value-of select="@units"/>
1720 </xsl:when>
1721 <!-- areaspec|areaset/area -->
1722 <xsl:when test="../@units = 'other' and ../@otherunits">
1723 <xsl:value-of select="../@otherunits"/>
1724 </xsl:when>
1725 <xsl:when test="../@units">
1726 <xsl:value-of select="../@units"/>
1727 </xsl:when>
1728 <!-- areaspec/areaset/area -->
1729 <xsl:when test="../../@units = 'other' and ../../@otherunits">
1730 <xsl:value-of select="../@otherunits"/>
1731 </xsl:when>
1732 <xsl:when test="../../@units">
1733 <xsl:value-of select="../../@units"/>
1734 </xsl:when>
1735 <xsl:otherwise>calspair</xsl:otherwise>
1736 </xsl:choose>
1737 </xsl:variable>
1738
1739 <xsl:choose>
1740 <xsl:when test="$units = 'calspair' or $units = 'imagemap'">
1741 <xsl:variable name="coords" select="normalize-space(@coords)"/>
1742
1743 <area shape="rect">
1744 <xsl:variable name="linkends">
1745 <xsl:choose>
1746 <xsl:when test="@linkends">
1747 <xsl:value-of select="normalize-space(@linkends)"/>
1748 </xsl:when>
1749 <xsl:otherwise>
1750 <xsl:value-of select="normalize-space(../@linkends)"/>
1751 </xsl:otherwise>
1752 </xsl:choose>
1753 </xsl:variable>
1754
1755 <xsl:variable name="href">
1756 <xsl:choose>
1757 <xsl:when test="@xlink:href">
1758 <xsl:value-of select="@xlink:href"/>
1759 </xsl:when>
1760 <xsl:otherwise>
1761 <xsl:value-of select="../@xlink:href"/>
1762 </xsl:otherwise>
1763 </xsl:choose>
1764 </xsl:variable>
1765
1766 <xsl:choose>
1767 <xsl:when test="$linkends != ''">
1768 <xsl:variable name="linkend">
1769 <xsl:choose>
1770 <xsl:when test="contains($linkends, ' ')">
1771 <xsl:value-of select="substring-before($linkends, ' ')"/>
1772 </xsl:when>
1773 <xsl:otherwise>
1774 <xsl:value-of select="$linkends"/>
1775 </xsl:otherwise>
1776 </xsl:choose>
1777 </xsl:variable>
1778 <xsl:variable name="target" select="key('id', $linkend)[1]"/>
1779
1780 <xsl:if test="$target">
1781 <xsl:attribute name="href">
1782 <xsl:call-template name="href.target">
1783 <xsl:with-param name="object" select="$target"/>
1784 </xsl:call-template>
1785 </xsl:attribute>
1786 </xsl:if>
1787 </xsl:when>
1788 <xsl:when test="$href != ''">
1789 <xsl:attribute name="href">
1790 <xsl:value-of select="$href"/>
1791 </xsl:attribute>
1792 </xsl:when>
1793 </xsl:choose>
1794
1795 <xsl:if test="alt">
1796 <xsl:attribute name="alt">
1797 <xsl:value-of select="alt[1]"/>
1798 </xsl:attribute>
1799 </xsl:if>
1800
1801 <xsl:attribute name="coords">
1802 <xsl:choose>
1803 <xsl:when test="$units = 'calspair'">
1804
1805 <xsl:variable name="p1" select="substring-before($coords, ' ')"/>
1806 <xsl:variable name="p2" select="substring-after($coords, ' ')"/>
1807
1808 <xsl:variable name="x1" select="substring-before($p1,',')"/>
1809 <xsl:variable name="y1" select="substring-after($p1,',')"/>
1810 <xsl:variable name="x2" select="substring-before($p2,',')"/>
1811 <xsl:variable name="y2" select="substring-after($p2,',')"/>
1812
1813 <xsl:variable name="x1p" select="$x1 div 100.0"/>
1814 <xsl:variable name="y1p" select="$y1 div 100.0"/>
1815 <xsl:variable name="x2p" select="$x2 div 100.0"/>
1816 <xsl:variable name="y2p" select="$y2 div 100.0"/>
1817
1818 <!--
1819 <xsl:message>
1820 <xsl:text>units: </xsl:text>
1821 <xsl:value-of select="$units"/>
1822 <xsl:text> </xsl:text>
1823 <xsl:value-of select="$x1p"/><xsl:text>, </xsl:text>
1824 <xsl:value-of select="$y1p"/><xsl:text>, </xsl:text>
1825 <xsl:value-of select="$x2p"/><xsl:text>, </xsl:text>
1826 <xsl:value-of select="$y2p"/><xsl:text>, </xsl:text>
1827 </xsl:message>
1828
1829 <xsl:message>
1830 <xsl:text> </xsl:text>
1831 <xsl:value-of select="$intrinsicwidth"/>
1832 <xsl:text>, </xsl:text>
1833 <xsl:value-of select="$intrinsicdepth"/>
1834 </xsl:message>
1835
1836 <xsl:message>
1837 <xsl:text> </xsl:text>
1838 <xsl:value-of select="$units"/>
1839 <xsl:text> </xsl:text>
1840 <xsl:value-of
1841 select="round($x1p * $intrinsicwidth div 100.0)"/>
1842 <xsl:text>,</xsl:text>
1843 <xsl:value-of select="round($intrinsicdepth
1844 - ($y2p * $intrinsicdepth div 100.0))"/>
1845 <xsl:text>,</xsl:text>
1846 <xsl:value-of select="round($x2p *
1847 $intrinsicwidth div 100.0)"/>
1848 <xsl:text>,</xsl:text>
1849 <xsl:value-of select="round($intrinsicdepth
1850 - ($y1p * $intrinsicdepth div 100.0))"/>
1851 </xsl:message>
1852 -->
1853 <xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
1854 <xsl:text>,</xsl:text>
1855 <xsl:value-of select="round($intrinsicdepth - ($y2p * $intrinsicdepth div 100.0))"/>
1856 <xsl:text>,</xsl:text>
1857 <xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
1858 <xsl:text>,</xsl:text>
1859 <xsl:value-of select="round($intrinsicdepth - ($y1p * $intrinsicdepth div 100.0))"/>
1860 </xsl:when>
1861 <xsl:otherwise>
1862 <xsl:copy-of select="$coords"/>
1863 </xsl:otherwise>
1864 </xsl:choose>
1865 </xsl:attribute>
1866 </area>
1867 </xsl:when>
1868 <xsl:otherwise>
1869 <xsl:message>
1870 <xsl:text>Warning: only calspair or </xsl:text>
1871 <xsl:text>otherunits='imagemap' supported </xsl:text>
1872 <xsl:text>in imageobjectco</xsl:text>
1873 </xsl:message>
1874 </xsl:otherwise>
1875 </xsl:choose>
1876 </xsl:for-each>
1877 </map>
1878 </xsl:if>
1879 </xsl:template>
1880
1881 <xsl:template match="tgroup" name="tgroup">
1882 <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
1883 <xsl:message terminate="yes">
1884 <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
1885 </xsl:message>
1886 </xsl:if>
1887
1888 <xsl:variable name="summary">
1889 <xsl:call-template name="dbhtml-attribute">
1890 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
1891 <xsl:with-param name="attribute" select="'table-summary'"/>
1892 </xsl:call-template>
1893 </xsl:variable>
1894
1895 <xsl:variable name="cellspacing">
1896 <xsl:call-template name="dbhtml-attribute">
1897 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
1898 <xsl:with-param name="attribute" select="'cellspacing'"/>
1899 </xsl:call-template>
1900 </xsl:variable>
1901
1902 <xsl:variable name="cellpadding">
1903 <xsl:call-template name="dbhtml-attribute">
1904 <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/>
1905 <xsl:with-param name="attribute" select="'cellpadding'"/>
1906 </xsl:call-template>
1907 </xsl:variable>
1908
1909 <xsl:variable name="colclass">
1910 <xsl:choose>
1911 <xsl:when test="@cols &lt; 4"><xsl:text>lt-4-cols</xsl:text></xsl:when>
1912 <xsl:when test="@cols &lt; 9"><xsl:text>gt-4-cols</xsl:text></xsl:when>
1913 <xsl:otherwise><xsl:text>gt-8-cols</xsl:text></xsl:otherwise>
1914 </xsl:choose>
1915 </xsl:variable>
1916
1917 <xsl:variable name="rowclass">
1918 <xsl:choose>
1919 <xsl:when test="count(tbody/row) &lt; 7"><xsl:text>lt-7-rows</xsl:text></xsl:when>
1920 <xsl:when test="count(tbody/row) &lt; 15"><xsl:text>gt-7-rows</xsl:text></xsl:when>
1921 <xsl:otherwise><xsl:text>gt-14-rows</xsl:text></xsl:otherwise>
1922 </xsl:choose>
1923 </xsl:variable>
1924
1925 <table>
1926 <xsl:attribute name="class">
1927 <xsl:value-of select="$colclass"/><xsl:text> </xsl:text><xsl:value-of select="$rowclass"/>
1928 </xsl:attribute>
1929
1930 <xsl:choose>
1931 <!-- If there's a textobject/phrase for the table summary, use it -->
1932 <xsl:when test="../textobject/phrase">
1933 <xsl:attribute name="summary">
1934 <xsl:value-of select="../textobject/phrase"/>
1935 </xsl:attribute>
1936 </xsl:when>
1937
1938 <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
1939 the HTML table summary attribute -->
1940 <xsl:when test="$summary != ''">
1941 <xsl:attribute name="summary">
1942 <xsl:value-of select="$summary"/>
1943 </xsl:attribute>
1944 </xsl:when>
1945
1946 <!-- Otherwise, if there's a title, use that -->
1947 <xsl:when test="../title">
1948 <xsl:attribute name="summary">
1949 <xsl:value-of select="string(../title)"/>
1950 </xsl:attribute>
1951 </xsl:when>
1952
1953 <!-- Otherwise, forget the whole idea -->
1954 <xsl:otherwise><!-- nevermind --></xsl:otherwise>
1955 </xsl:choose>
1956
1957 <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
1958 <xsl:attribute name="cellspacing">
1959 <xsl:choose>
1960 <xsl:when test="$cellspacing != ''">
1961 <xsl:value-of select="$cellspacing"/>
1962 </xsl:when>
1963 <xsl:otherwise>
1964 <xsl:value-of select="$html.cellspacing"/>
1965 </xsl:otherwise>
1966 </xsl:choose>
1967 </xsl:attribute>
1968 </xsl:if>
1969
1970 <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
1971 <xsl:attribute name="cellpadding">
1972 <xsl:choose>
1973 <xsl:when test="$cellpadding != ''">
1974 <xsl:value-of select="$cellpadding"/>
1975 </xsl:when>
1976 <xsl:otherwise>
1977 <xsl:value-of select="$html.cellpadding"/>
1978 </xsl:otherwise>
1979 </xsl:choose>
1980 </xsl:attribute>
1981 </xsl:if>
1982
1983 <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
1984 <xsl:attribute name="width">100%</xsl:attribute>
1985 </xsl:if>
1986 <!--
1987 snip border rubbish. BZ #875967
1988 -->
1989 <xsl:variable name="colgroup">
1990 <colgroup>
1991 <xsl:call-template name="generate.colgroup">
1992 <xsl:with-param name="cols" select="@cols"/>
1993 </xsl:call-template>
1994 </colgroup>
1995 </xsl:variable>
1996
1997 <xsl:variable name="explicit.table.width">
1998 <xsl:call-template name="dbhtml-attribute">
1999 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/>
2000 <xsl:with-param name="attribute" select="'table-width'"/>
2001 </xsl:call-template>
2002 </xsl:variable>
2003
2004 <xsl:variable name="table.width">
2005 <xsl:choose>
2006 <xsl:when test="$explicit.table.width != ''">
2007 <xsl:value-of select="$explicit.table.width"/>
2008 </xsl:when>
2009 <xsl:when test="$default.table.width = ''">
2010 <xsl:text>100%</xsl:text>
2011 </xsl:when>
2012 <xsl:otherwise>
2013 <xsl:value-of select="$default.table.width"/>
2014 </xsl:otherwise>
2015 </xsl:choose>
2016 </xsl:variable>
2017
2018 <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
2019 <xsl:attribute name="width">
2020 <xsl:choose>
2021 <xsl:when test="contains($table.width, '%')">
2022 <xsl:value-of select="$table.width"/>
2023 </xsl:when>
2024 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
2025 <xsl:choose>
2026 <xsl:when test="function-available('stbl:convertLength')">
2027 <xsl:value-of select="stbl:convertLength($table.width)"/>
2028 </xsl:when>
2029 <xsl:when test="function-available('xtbl:convertLength')">
2030 <xsl:value-of select="xtbl:convertLength($table.width)"/>
2031 </xsl:when>
2032 <xsl:otherwise>
2033 <xsl:message terminate="yes">
2034 <xsl:text>No convertLength function available.</xsl:text>
2035 </xsl:message>
2036 </xsl:otherwise>
2037 </xsl:choose>
2038 </xsl:when>
2039 <xsl:otherwise>
2040 <xsl:value-of select="$table.width"/>
2041 </xsl:otherwise>
2042 </xsl:choose>
2043 </xsl:attribute>
2044 </xsl:if>
2045
2046 <xsl:choose>
2047 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
2048 <xsl:choose>
2049 <xsl:when test="function-available('stbl:adjustColumnWidths')">
2050 <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
2051 </xsl:when>
2052 <xsl:when test="function-available('xtbl:adjustColumnWidths')">
2053 <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
2054 </xsl:when>
2055 <xsl:when test="function-available('ptbl:adjustColumnWidths')">
2056 <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
2057 </xsl:when>
2058 <xsl:when test="function-available('perl:adjustColumnWidths')">
2059 <xsl:copy-of select="perl:adjustColumnWidths($table.width, $colgroup)"/>
2060 </xsl:when>
2061 <xsl:otherwise>
2062 <xsl:message terminate="yes">
2063 <xsl:text>No adjustColumnWidths function available.</xsl:text>
2064 </xsl:message>
2065 </xsl:otherwise>
2066 </xsl:choose>
2067 </xsl:when>
2068 <xsl:otherwise>
2069 <xsl:copy-of select="$colgroup"/>
2070 </xsl:otherwise>
2071 </xsl:choose>
2072
2073 <xsl:apply-templates select="thead"/>
2074 <xsl:apply-templates select="tfoot"/>
2075 <xsl:apply-templates select="tbody"/>
2076
2077 <xsl:if test=".//footnote">
2078 <tbody class="footnotes">
2079 <tr>
2080 <td colspan="{@cols}">
2081 <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
2082 </td>
2083 </tr>
2084 </tbody>
2085 </xsl:if>
2086 </table>
2087 </xsl:template>
2088
2089 <xsl:template match="programlistingco|screenco">
2090 <xsl:variable name="verbatim" select="programlisting|screen"/>
2091
2092 <xsl:choose>
2093 <xsl:when test="$use.extensions != '0' and $callouts.extension != '0'">
2094 <xsl:variable name="rtf">
2095 <xsl:apply-templates select="$verbatim">
2096 <xsl:with-param name="suppress-numbers" select="'1'"/>
2097 </xsl:apply-templates>
2098 </xsl:variable>
2099
2100 <xsl:variable name="rtf-with-callouts">
2101 <xsl:choose>
2102 <xsl:when test="function-available('sverb:insertCallouts')">
2103 <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
2104 </xsl:when>
2105 <xsl:when test="function-available('xverb:insertCallouts')">
2106 <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
2107 </xsl:when>
2108 <xsl:when test="function-available('perl:insertCallouts')">
2109 <xsl:copy-of select="perl:insertCallouts(areaspec,exsl:node-set($rtf))"/>
2110 </xsl:when>
2111 <xsl:otherwise>
2112 <xsl:message terminate="yes">
2113 <xsl:text>No insertCallouts function is available.</xsl:text>
2114 </xsl:message>
2115 </xsl:otherwise>
2116 </xsl:choose>
2117 </xsl:variable>
2118
2119 <xsl:choose>
2120 <xsl:when test="$verbatim/@linenumbering = 'numbered' and $linenumbering.extension != '0'">
2121 <div>
2122 <xsl:call-template name="common.html.attributes"/>
2123 <xsl:call-template name="number.rtf.lines">
2124 <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
2125 <xsl:with-param name="pi.context" select="programlisting|screen"/>
2126 </xsl:call-template>
2127 <xsl:apply-templates select="calloutlist"/>
2128 </div>
2129 </xsl:when>
2130 <xsl:otherwise>
2131 <div>
2132 <xsl:call-template name="common.html.attributes"/>
2133 <xsl:copy-of select="$rtf-with-callouts"/>
2134 <xsl:apply-templates select="calloutlist"/>
2135 </div>
2136 </xsl:otherwise>
2137 </xsl:choose>
2138 </xsl:when>
2139 <xsl:otherwise>
2140 <div>
2141 <xsl:apply-templates select="." mode="common.html.attributes"/>
2142 <xsl:apply-templates/>
2143 </div>
2144 </xsl:otherwise>
2145 </xsl:choose>
2146 </xsl:template>
2147
2148 <xsl:template match="co" name="co">
2149 <!-- Support a single linkend in HTML -->
2150 <xsl:variable name="targets" select="key('id', @linkends)"/>
2151 <xsl:variable name="target" select="$targets[1]"/>
2152 <xsl:choose>
2153 <xsl:when test="$target">
2154 <a>
2155 <xsl:apply-templates select="." mode="common.html.attributes"/>
2156 <xsl:if test="@id or @xml:id">
2157 <xsl:attribute name="id">
2158 <xsl:value-of select="(@id|@xml:id)[1]"/>
2159 </xsl:attribute>
2160 </xsl:if>
2161 <xsl:attribute name="href">
2162 <xsl:call-template name="href.target">
2163 <xsl:with-param name="object" select="$target"/>
2164 </xsl:call-template>
2165 </xsl:attribute>
2166 <xsl:apply-templates select="." mode="callout-bug"/>
2167 </a>
2168 </xsl:when>
2169 <xsl:otherwise>
2170 <span>
2171 <xsl:if test="@id or @xml:id">
2172 <xsl:attribute name="id">
2173 <xsl:value-of select="(@id|@xml:id)[1]"/>
2174 </xsl:attribute>
2175 </xsl:if>
2176 <xsl:apply-templates select="." mode="callout-bug"/>
2177 </span>
2178 </xsl:otherwise>
2179 </xsl:choose>
2180 </xsl:template>
2181
2182 <xsl:template match="co" mode="callout-bug">
2183 <xsl:call-template name="callout-bug">
2184 <xsl:with-param name="conum">
2185 <xsl:number count="co" level="any" from="programlisting|screen|literallayout|synopsis" format="1"/>
2186 </xsl:with-param>
2187 </xsl:call-template>
2188 </xsl:template>
2189
2190 <xsl:template name="callout-bug">
2191 <xsl:param name="conum" select="1"/>
2192
2193 <xsl:choose>
2194 <xsl:when test="$callout.graphics != 0 and $conum &lt;= $callout.graphics.number.limit">
2195 <img class="callout" src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}" alt="{$conum}">
2196 </img>
2197 </xsl:when>
2198 <xsl:when test="$callout.unicode != 0 and $conum &lt;= $callout.unicode.number.limit">
2199 <xsl:choose>
2200 <xsl:when test="$callout.unicode.start.character = 10102">
2201 <xsl:choose>
2202 <xsl:when test="$conum = 1">&#10102;</xsl:when>
2203 <xsl:when test="$conum = 2">&#10103;</xsl:when>
2204 <xsl:when test="$conum = 3">&#10104;</xsl:when>
2205 <xsl:when test="$conum = 4">&#10105;</xsl:when>
2206 <xsl:when test="$conum = 5">&#10106;</xsl:when>
2207 <xsl:when test="$conum = 6">&#10107;</xsl:when>
2208 <xsl:when test="$conum = 7">&#10108;</xsl:when>
2209 <xsl:when test="$conum = 8">&#10109;</xsl:when>
2210 <xsl:when test="$conum = 9">&#10110;</xsl:when>
2211 <xsl:when test="$conum = 10">&#10111;</xsl:when>
2212 </xsl:choose>
2213 </xsl:when>
2214 <xsl:otherwise>
2215 <xsl:message>
2216 <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
2217 <xsl:text>when $callout.unicode.start.character is </xsl:text>
2218 <xsl:value-of select="$callout.unicode.start.character"/>
2219 </xsl:message>
2220 <xsl:text>(</xsl:text>
2221 <xsl:value-of select="$conum"/>
2222 <xsl:text>)</xsl:text>
2223 </xsl:otherwise>
2224 </xsl:choose>
2225 </xsl:when>
2226 <xsl:otherwise>
2227 <xsl:text>(</xsl:text>
2228 <xsl:value-of select="$conum"/>
2229 <xsl:text>)</xsl:text>
2230 </xsl:otherwise>
2231 </xsl:choose>
2232 </xsl:template>
2233
2234 <xsl:template name="number.rtf.lines">
2235 <xsl:param name="rtf" select="''"/>
2236 <xsl:param name="pi.context" select="."/>
2237
2238 <!-- Save the global values -->
2239 <xsl:variable name="global.linenumbering.everyNth" select="$linenumbering.everyNth"/>
2240
2241 <xsl:variable name="global.linenumbering.separator" select="$linenumbering.separator"/>
2242
2243 <xsl:variable name="global.linenumbering.width" select="$linenumbering.width"/>
2244
2245 <!-- Extract the <?dbhtml linenumbering.*?> PI values -->
2246 <xsl:variable name="pi.linenumbering.everyNth">
2247 <xsl:call-template name="pi.dbhtml_linenumbering.everyNth">
2248 <xsl:with-param name="node" select="$pi.context"/>
2249 </xsl:call-template>
2250 </xsl:variable>
2251
2252 <xsl:variable name="pi.linenumbering.separator">
2253 <xsl:call-template name="pi.dbhtml_linenumbering.separator">
2254 <xsl:with-param name="node" select="$pi.context"/>
2255 </xsl:call-template>
2256 </xsl:variable>
2257
2258 <xsl:variable name="pi.linenumbering.width">
2259 <xsl:call-template name="pi.dbhtml_linenumbering.width">
2260 <xsl:with-param name="node" select="$pi.context"/>
2261 </xsl:call-template>
2262 </xsl:variable>
2263
2264 <!-- Construct the 'in-context' values -->
2265 <xsl:variable name="linenumbering.everyNth">
2266 <xsl:choose>
2267 <xsl:when test="$pi.linenumbering.everyNth != ''">
2268 <xsl:value-of select="$pi.linenumbering.everyNth"/>
2269 </xsl:when>
2270 <xsl:otherwise>
2271 <xsl:value-of select="$global.linenumbering.everyNth"/>
2272 </xsl:otherwise>
2273 </xsl:choose>
2274 </xsl:variable>
2275
2276 <xsl:variable name="linenumbering.separator">
2277 <xsl:choose>
2278 <xsl:when test="$pi.linenumbering.separator != ''">
2279 <xsl:value-of select="$pi.linenumbering.separator"/>
2280 </xsl:when>
2281 <xsl:otherwise>
2282 <xsl:value-of select="$global.linenumbering.separator"/>
2283 </xsl:otherwise>
2284 </xsl:choose>
2285 </xsl:variable>
2286
2287 <xsl:variable name="linenumbering.width">
2288 <xsl:choose>
2289 <xsl:when test="$pi.linenumbering.width != ''">
2290 <xsl:value-of select="$pi.linenumbering.width"/>
2291 </xsl:when>
2292 <xsl:otherwise>
2293 <xsl:value-of select="$global.linenumbering.width"/>
2294 </xsl:otherwise>
2295 </xsl:choose>
2296 </xsl:variable>
2297
2298 <xsl:variable name="linenumbering.startinglinenumber">
2299 <xsl:choose>
2300 <xsl:when test="$pi.context/@startinglinenumber">
2301 <xsl:value-of select="$pi.context/@startinglinenumber"/>
2302 </xsl:when>
2303 <xsl:when test="$pi.context/@continuation='continues'">
2304 <xsl:variable name="lastLine">
2305 <xsl:choose>
2306 <xsl:when test="$pi.context/self::programlisting">
2307 <xsl:call-template name="lastLineNumber">
2308 <xsl:with-param name="listings" select="preceding::programlisting[@linenumbering='numbered']"/>
2309 </xsl:call-template>
2310 </xsl:when>
2311 <xsl:when test="$pi.context/self::screen">
2312 <xsl:call-template name="lastLineNumber">
2313 <xsl:with-param name="listings" select="preceding::screen[@linenumbering='numbered']"/>
2314 </xsl:call-template>
2315 </xsl:when>
2316 <xsl:when test="$pi.context/self::literallayout">
2317 <xsl:call-template name="lastLineNumber">
2318 <xsl:with-param name="listings" select="preceding::literallayout[@linenumbering='numbered']"/>
2319 </xsl:call-template>
2320 </xsl:when>
2321 <xsl:when test="$pi.context/self::address">
2322 <xsl:call-template name="lastLineNumber">
2323 <xsl:with-param name="listings" select="preceding::address[@linenumbering='numbered']"/>
2324 </xsl:call-template>
2325 </xsl:when>
2326 <xsl:when test="$pi.context/self::synopsis">
2327 <xsl:call-template name="lastLineNumber">
2328 <xsl:with-param name="listings" select="preceding::synopsis[@linenumbering='numbered']"/>
2329 </xsl:call-template>
2330 </xsl:when>
2331 <xsl:otherwise>
2332 <xsl:message>
2333 <xsl:text>Unexpected verbatim environment: </xsl:text>
2334 <xsl:value-of select="local-name($pi.context)"/>
2335 </xsl:message>
2336 <xsl:value-of select="0"/>
2337 </xsl:otherwise>
2338 </xsl:choose>
2339 </xsl:variable>
2340
2341 <xsl:value-of select="$lastLine + 1"/>
2342 </xsl:when>
2343 <xsl:otherwise>1</xsl:otherwise>
2344 </xsl:choose>
2345 </xsl:variable>
2346
2347 <xsl:choose>
2348 <xsl:when test="function-available('sverb:numberLines')">
2349 <xsl:copy-of select="sverb:numberLines($rtf)"/>
2350 </xsl:when>
2351 <xsl:when test="function-available('xverb:numberLines')">
2352 <xsl:copy-of select="xverb:numberLines($rtf)"/>
2353 </xsl:when>
2354 <xsl:when test="function-available('perl:numberLines')">
2355 <xsl:copy-of select="perl:numberLines($linenumbering.startinglinenumber, $rtf)"/>
2356 </xsl:when>
2357 <xsl:otherwise>
2358 <xsl:message terminate="yes">
2359 <xsl:text>No numberLines function available.</xsl:text>
2360 </xsl:message>
2361 </xsl:otherwise>
2362 </xsl:choose>
2363 </xsl:template>
2364
2365 <!-- ONLY add title attribute if there is an alt text -->
2366 <!-- Generate a title attribute for the context node -->
2367 <xsl:template match="*" mode="html.title.attribute">
2368 <xsl:variable name="is.title">
2369 <xsl:call-template name="gentext.template.exists">
2370 <xsl:with-param name="context" select="'title'"/>
2371 <xsl:with-param name="name" select="local-name(.)"/>
2372 <xsl:with-param name="lang">
2373 <xsl:call-template name="l10n.language"/>
2374 </xsl:with-param>
2375 </xsl:call-template>
2376 </xsl:variable>
2377
2378 <xsl:variable name="is.title-numbered">
2379 <xsl:call-template name="gentext.template.exists">
2380 <xsl:with-param name="context" select="'title-numbered'"/>
2381 <xsl:with-param name="name" select="local-name(.)"/>
2382 <xsl:with-param name="lang">
2383 <xsl:call-template name="l10n.language"/>
2384 </xsl:with-param>
2385 </xsl:call-template>
2386 </xsl:variable>
2387
2388 <xsl:variable name="is.title-unnumbered">
2389 <xsl:call-template name="gentext.template.exists">
2390 <xsl:with-param name="context" select="'title-unnumbered'"/>
2391 <xsl:with-param name="name" select="local-name(.)"/>
2392 <xsl:with-param name="lang">
2393 <xsl:call-template name="l10n.language"/>
2394 </xsl:with-param>
2395 </xsl:call-template>
2396 </xsl:variable>
2397
2398 <xsl:variable name="has.title.markup">
2399 <xsl:apply-templates select="." mode="title.markup">
2400 <xsl:with-param name="verbose" select="0"/>
2401 </xsl:apply-templates>
2402 </xsl:variable>
2403
2404 <xsl:variable name="gentext.title">
2405 <xsl:if test="$has.title.markup != '???TITLE???' and ($is.title != 0 or $is.title-numbered != 0 or $is.title-unnumbered != 0)">
2406 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
2407 </xsl:if>
2408 </xsl:variable>
2409
2410 <xsl:choose>
2411 <!--xsl:when test="string-length($gentext.title) != 0">
2412 <xsl:attribute name="title">
2413 <xsl:value-of select="$gentext.title"/>
2414 </xsl:attribute>
2415 </xsl:when-->
2416 <!-- Fall back to alt if available -->
2417 <xsl:when test="alt">
2418 <xsl:attribute name="title">
2419 <xsl:value-of select="normalize-space(alt)"/>
2420 </xsl:attribute>
2421 </xsl:when>
2422 </xsl:choose>
2423 </xsl:template>
2424
2425 <xsl:template name="book.titlepage.separator">
2426 </xsl:template>
2427
2428 <xsl:template name="reference.titlepage.separator">
2429 </xsl:template>
2430
2431 <xsl:template name="article.titlepage.separator">
2432 </xsl:template>
2433
2434 <xsl:template name="set.titlepage.separator">
2435 </xsl:template>
2436
2437 <xsl:template match="footnote">
2438 <xsl:variable name="href">
2439 <xsl:text>#ftn.</xsl:text>
2440 <xsl:call-template name="object.id">
2441 <xsl:with-param name="conditional" select="0"/>
2442 </xsl:call-template>
2443 </xsl:variable>
2444
2445 <xsl:call-template name="anchor">
2446 <xsl:with-param name="conditional" select="0"/>
2447 </xsl:call-template>
2448 <a href="{$href}">
2449 <xsl:apply-templates select="." mode="class.attribute"/>
2450 <sup>
2451 <xsl:apply-templates select="." mode="class.attribute"/>
2452 <xsl:call-template name="id.attribute">
2453 <xsl:with-param name="conditional" select="0"/>
2454 </xsl:call-template>
2455 <!-- MOVED UP BZ #
2456 <xsl:call-template name="anchor">
2457 <xsl:with-param name="conditional" select="0"/>
2458 </xsl:call-template>
2459 -->
2460 <xsl:text>[</xsl:text>
2461 <xsl:apply-templates select="." mode="footnote.number"/>
2462 <xsl:text>]</xsl:text>
2463 </sup>
2464 </a>
2465 </xsl:template>
2466
2467 <!--
2468
2469 biblio.xsl
2470
2471 Fix double footnote in bibliography. BZ #653447
2472
2473 -->
2474 <xsl:template match="bibliography">
2475 <xsl:call-template name="id.warning"/>
2476
2477 <div>
2478 <xsl:call-template name="common.html.attributes">
2479 <xsl:with-param name="inherit" select="1"/>
2480 </xsl:call-template>
2481 <xsl:call-template name="id.attribute">
2482 <xsl:with-param name="conditional" select="0"/>
2483 </xsl:call-template>
2484
2485 <xsl:call-template name="bibliography.titlepage"/>
2486
2487 <xsl:apply-templates/>
2488
2489 <xsl:if test="parent::book|parent::part">
2490 <xsl:call-template name="process.footnotes"/>
2491 </xsl:if>
2492 </div>
2493 </xsl:template>
2494
2495 <xsl:template match="replaceable" priority="1">
2496 <xsl:call-template name="inline.italicseq"/>
2497 </xsl:template>
2498
2499 <xsl:template name="anchor">
2500 <xsl:param name="node" select="."/>
2501 <xsl:param name="conditional" select="1"/>
2502
2503 <xsl:choose>
2504 <xsl:when test="$generate.id.attributes != 0">
2505 <!-- No named anchors output when this param is set -->
2506 </xsl:when>
2507 <xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
2508 <a>
2509 <xsl:attribute name="id">
2510 <xsl:call-template name="object.id">
2511 <xsl:with-param name="object" select="$node"/>
2512 </xsl:call-template>
2513 </xsl:attribute>
2514 <!-- need a zero-width non-breaking space because webkit doesn't render empty anchors -->
2515 &#8288;</a>
2516 </xsl:when>
2517 </xsl:choose>
2518 </xsl:template>
2519
2520 </xsl:stylesheet>