1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "../common/entities.ent">
7 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 xmlns:d="http://docbook.org/ns/docbook"
9 xmlns:exsl="http://exslt.org/common"
10 xmlns="http://www.w3.org/1999/xhtml"
11 xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
12 xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
13 xmlns:lxslt="http://xml.apache.org/xslt"
14 xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
15 exclude-result-prefixes="exsl stbl xtbl lxslt ptbl d"
18 <!-- $I html5-element-mods.xsl,v 1.2 2011-09-18 17:47:28 bobs Exp $ -->
20 <!--==============================================================-->
21 <!-- DocBook XSL Parameter settings -->
22 <!--==============================================================-->
23 <!-- Set these to blank so can output special HTML5 empty DOCTYPE -->
24 <xsl:param name="chunker.output.doctype-system" select="''"/>
25 <xsl:param name="chunker.output.doctype-public" select="''"/>
27 <xsl:param name="table.borders.with.css" select="1"/>
28 <xsl:param name="html.ext">.xhtml</xsl:param>
29 <xsl:param name="toc.list.type">ul</xsl:param>
30 <xsl:param name="css.decoration" select="1"/>
31 <xsl:param name="make.clean.html" select="1"/>
32 <xsl:param name="generate.id.attributes" select="1"/>
33 <xsl:variable name="div.element">section</xsl:variable>
35 <!--==============================================================-->
36 <!-- Customized templates -->
37 <!--==============================================================-->
39 <!-- HTML5: needs special doctype -->
40 <xsl:template name="user.preroot">
41 <xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
44 <!-- HTML5: Replace HTML acronum with abbr for HTML 5 -->
45 <xsl:template match="d:acronym">
46 <xsl:call-template name="inline.charseq">
47 <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
51 <!-- HTML5: replace border="0" with border="" -->
52 <!-- HTML5: No @summary allowed -->
53 <!-- HTML5: replace many table atts with CSS styles -->
54 <xsl:template match="d:tgroup" name="tgroup">
55 <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
56 <xsl:message terminate="yes">
57 <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
61 <xsl:variable name="summary">
62 <xsl:call-template name="pi.dbhtml_table-summary"/>
65 <xsl:variable name="cellspacing">
66 <xsl:call-template name="pi.dbhtml_cellspacing"/>
69 <xsl:variable name="cellpadding">
70 <xsl:call-template name="pi.dbhtml_cellpadding"/>
73 <!-- First generate colgroup with attributes -->
74 <xsl:variable name="colgroup.with.attributes">
76 <xsl:call-template name="generate.colgroup">
77 <xsl:with-param name="cols" select="@cols"/>
82 <!-- then modify colgroup attributes with extension -->
83 <xsl:variable name="colgroup.with.extension">
85 <xsl:when test="$use.extensions != 0
86 and $tablecolumns.extension != 0">
88 <xsl:when test="function-available('stbl:adjustColumnWidths')">
89 <xsl:copy-of select="stbl:adjustColumnWidths($colgroup.with.attributes)"/>
91 <xsl:when test="function-available('xtbl:adjustColumnWidths')">
92 <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup.with.attributes)"/>
94 <xsl:when test="function-available('ptbl:adjustColumnWidths')">
95 <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup.with.attributes)"/>
98 <xsl:message terminate="yes">
99 <xsl:text>No adjustColumnWidths function available.</xsl:text>
105 <xsl:copy-of select="$colgroup.with.attributes"/>
110 <!-- Now convert to @style -->
111 <xsl:variable name="colgroup">
112 <xsl:call-template name="colgroup.with.style">
113 <xsl:with-param name="colgroup" select="$colgroup.with.extension"/>
117 <xsl:variable name="explicit.table.width">
118 <xsl:call-template name="pi.dbhtml_table-width">
119 <xsl:with-param name="node" select=".."/>
123 <xsl:variable name="table.width.candidate">
125 <xsl:when test="$explicit.table.width != ''">
126 <xsl:value-of select="$explicit.table.width"/>
128 <xsl:when test="$default.table.width = ''">
129 <xsl:text>100%</xsl:text>
132 <xsl:value-of select="$default.table.width"/>
138 <xsl:variable name="table.width">
139 <xsl:if test="$default.table.width != ''
140 or $explicit.table.width != ''">
142 <xsl:when test="contains($table.width.candidate, '%')">
143 <xsl:value-of select="$table.width.candidate"/>
145 <xsl:when test="$use.extensions != 0
146 and $tablecolumns.extension != 0">
148 <xsl:when test="function-available('stbl:convertLength')">
149 <xsl:value-of select="stbl:convertLength($table.width.candidate)"/>
151 <xsl:when test="function-available('xtbl:convertLength')">
152 <xsl:value-of select="xtbl:convertLength($table.width.candidate)"/>
155 <xsl:message terminate="yes">
156 <xsl:text>No convertLength function available.</xsl:text>
162 <xsl:value-of select="$table.width.candidate"/>
168 <!-- assemble a table @style -->
169 <xsl:variable name="table.style">
171 <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
172 <xsl:text>cellspacing: </xsl:text>
174 <xsl:when test="$cellspacing != ''">
175 <xsl:value-of select="$cellspacing"/>
178 <xsl:value-of select="$html.cellspacing"/>
181 <xsl:text>; </xsl:text>
184 <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
185 <xsl:text>cellpadding: </xsl:text>
187 <xsl:when test="$cellpadding != ''">
188 <xsl:value-of select="$cellpadding"/>
191 <xsl:value-of select="$html.cellpadding"/>
194 <xsl:text>; </xsl:text>
198 <xsl:when test="string-length($table.width) != 0">
199 <xsl:text>width: </xsl:text>
200 <xsl:value-of select="$table.width"/>
201 <xsl:text>; </xsl:text>
203 <xsl:when test="../@pgwide=1 or local-name(.) = 'entrytbl'">
204 <xsl:text>width: 100%; </xsl:text>
211 <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
212 <xsl:text>border-collapse: collapse; </xsl:text>
213 <xsl:call-template name="border">
214 <xsl:with-param name="side" select="'top'"/>
215 <xsl:with-param name="style" select="$table.frame.border.style"/>
216 <xsl:with-param name="color" select="$table.frame.border.color"/>
217 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
219 <xsl:call-template name="border">
220 <xsl:with-param name="side" select="'bottom'"/>
221 <xsl:with-param name="style" select="$table.frame.border.style"/>
222 <xsl:with-param name="color" select="$table.frame.border.color"/>
223 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
225 <xsl:call-template name="border">
226 <xsl:with-param name="side" select="'left'"/>
227 <xsl:with-param name="style" select="$table.frame.border.style"/>
228 <xsl:with-param name="color" select="$table.frame.border.color"/>
229 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
231 <xsl:call-template name="border">
232 <xsl:with-param name="side" select="'right'"/>
233 <xsl:with-param name="style" select="$table.frame.border.style"/>
234 <xsl:with-param name="color" select="$table.frame.border.color"/>
235 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
238 <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
239 <xsl:text>border-collapse: collapse;</xsl:text>
240 <xsl:call-template name="border">
241 <xsl:with-param name="side" select="'top'"/>
242 <xsl:with-param name="style" select="$table.frame.border.style"/>
243 <xsl:with-param name="color" select="$table.frame.border.color"/>
244 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
246 <xsl:call-template name="border">
247 <xsl:with-param name="side" select="'bottom'"/>
248 <xsl:with-param name="style" select="$table.frame.border.style"/>
249 <xsl:with-param name="color" select="$table.frame.border.color"/>
250 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
253 <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
254 <xsl:text>border-collapse: collapse;</xsl:text>
255 <xsl:call-template name="border">
256 <xsl:with-param name="side" select="'top'"/>
257 <xsl:with-param name="style" select="$table.frame.border.style"/>
258 <xsl:with-param name="color" select="$table.frame.border.color"/>
259 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
262 <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
263 <xsl:text>border-collapse: collapse;</xsl:text>
264 <xsl:call-template name="border">
265 <xsl:with-param name="side" select="'bottom'"/>
266 <xsl:with-param name="style" select="$table.frame.border.style"/>
267 <xsl:with-param name="color" select="$table.frame.border.color"/>
268 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
271 <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
272 <xsl:text>border-collapse: collapse;</xsl:text>
273 <xsl:call-template name="border">
274 <xsl:with-param name="side" select="'left'"/>
275 <xsl:with-param name="style" select="$table.frame.border.style"/>
276 <xsl:with-param name="color" select="$table.frame.border.color"/>
277 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
279 <xsl:call-template name="border">
280 <xsl:with-param name="side" select="'right'"/>
281 <xsl:with-param name="style" select="$table.frame.border.style"/>
282 <xsl:with-param name="color" select="$table.frame.border.color"/>
283 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
286 <xsl:when test="../@frame='none'">
287 <xsl:text>border: none;</xsl:text>
290 <xsl:text>border-collapse: collapse;</xsl:text>
296 <!-- HTML5: no table summary allowed -->
297 <xsl:if test="string-length($table.style) != 0">
298 <xsl:attribute name="style">
299 <xsl:value-of select="$table.style"/>
304 <xsl:copy-of select="$colgroup"/>
306 <xsl:apply-templates select="d:thead"/>
307 <xsl:apply-templates select="d:tfoot"/>
308 <xsl:apply-templates select="d:tbody"/>
310 <xsl:if test=".//d:footnote|../d:title//d:footnote">
311 <tbody class="footnotes">
313 <td colspan="{@cols}">
314 <xsl:apply-templates select=".//d:footnote|../d:title//d:footnote" mode="table.footnote.mode"/>
322 <!-- HTML5: convert col attributes to col CSS styles -->
323 <xsl:template name="colgroup.with.style">
324 <xsl:param name="colgroup"/>
326 <xsl:variable name="colgroup.nodeset" select="exsl:node-set($colgroup)"/>
327 <xsl:apply-templates select="$colgroup.nodeset" mode="convert.to.style"/>
330 <xsl:template match="d:colgroup" mode="convert.to.style">
332 <xsl:copy-of select="@*"/>
333 <xsl:apply-templates mode="convert.to.style"/>
337 <!-- HTML5: converts obsolete HTML attributes to CSS styles -->
338 <xsl:template match="*" mode="convert.to.style">
340 <xsl:variable name="element" select="local-name(.)"/>
342 <xsl:variable name="style.from.atts">
343 <xsl:for-each select="@*">
346 <!-- width and height attributes are ok for img element -->
347 <xsl:when test="local-name() = 'width' and $element != 'img'">
348 <xsl:variable name="attvalue" select="normalize-space(.)"/>
349 <xsl:text>width: </xsl:text>
350 <xsl:value-of select="$attvalue"/>
351 <!-- if integer value, add px unit -->
352 <xsl:if test="floor($attvalue) = $attvalue">
353 <xsl:text>px</xsl:text>
355 <xsl:text>; </xsl:text>
358 <xsl:when test="local-name() = 'height' and $element != 'img'">
359 <xsl:variable name="attvalue" select="normalize-space(.)"/>
360 <xsl:text>height: </xsl:text>
361 <xsl:value-of select="$attvalue"/>
362 <!-- if integer value, add px unit -->
363 <xsl:if test="floor($attvalue) = $attvalue">
364 <xsl:text>px</xsl:text>
366 <xsl:text>; </xsl:text>
369 <xsl:when test="local-name() = 'align'">
370 <xsl:text>text-align: </xsl:text>
371 <xsl:value-of select="."/>
372 <xsl:text>; </xsl:text>
375 <xsl:when test="local-name() = 'valign'">
376 <xsl:text>vertical-align: </xsl:text>
377 <xsl:value-of select="."/>
378 <xsl:text>; </xsl:text>
381 <xsl:when test="local-name() = 'border'">
382 <xsl:text>border: </xsl:text>
383 <xsl:value-of select="."/>
384 <xsl:text>; </xsl:text>
387 <xsl:when test="local-name() = 'cellspacing'">
388 <xsl:text>border-spacing: </xsl:text>
389 <xsl:value-of select="."/>
390 <xsl:text>px</xsl:text>
391 <xsl:text>; </xsl:text>
394 <xsl:when test="local-name() = 'cellpadding'">
395 <xsl:text>padding: </xsl:text>
396 <xsl:value-of select="."/>
397 <xsl:text>px</xsl:text>
398 <xsl:text>; </xsl:text>
404 <!-- merge existing styles with these new styles -->
405 <xsl:variable name="style">
406 <xsl:value-of select="concat($style.from.atts, @style)"/>
409 <!-- HTML5: reserved for element name conversion if needed -->
410 <xsl:variable name="element.name">
411 <xsl:value-of select="local-name(.)"/>
414 <xsl:element name="{$element.name}">
415 <xsl:if test="string-length($style) != 0">
416 <xsl:attribute name="style">
417 <xsl:value-of select="$style"/>
420 <!-- skip converted atts, and also skip disallowed summary attribute -->
421 <xsl:for-each select="@*">
423 <xsl:when test="local-name(.) = 'width' and $element != 'img'"/>
424 <xsl:when test="local-name(.) = 'height' and $element != 'img'"/>
425 <xsl:when test="local-name(.) = 'summary'"/>
426 <xsl:when test="local-name(.) = 'border'"/>
427 <xsl:when test="local-name(.) = 'cellspacing'"/>
428 <xsl:when test="local-name(.) = 'cellpadding'"/>
429 <xsl:when test="local-name(.) = 'style'"/>
430 <xsl:when test="local-name(.) = 'align'"/>
431 <xsl:when test="local-name(.) = 'valign'"/>
433 <xsl:copy-of select="."/>
437 <xsl:apply-templates mode="convert.to.style"/>
441 <!-- HTML5: convert some attributes to CSS style attribute -->
442 <xsl:template match="d:entry|d:entrytbl">
443 <xsl:param name="col">
445 <xsl:when test="@revisionflag">
446 <xsl:number from="d:row"/>
448 <xsl:otherwise>1</xsl:otherwise>
452 <xsl:param name="spans"/>
455 <!-- Process with stock template -->
456 <xsl:variable name="cell">
457 <xsl:call-template name="entry">
458 <xsl:with-param name="col" select="$col"/>
459 <xsl:with-param name="spans" select="$spans"/>
463 <xsl:variable name="cell.nodes" select="exsl:node-set($cell)"/>
465 <xsl:apply-templates select="$cell.nodes" mode="convert.to.style"/>
469 <xsl:template match="d:mediaobject|d:inlinemediaobject">
470 <xsl:call-template name="convert.styles"/>
473 <xsl:template match="d:qandaset">
474 <xsl:call-template name="convert.styles"/>
477 <xsl:template match="d:calloutlist|d:revhistory|d:footnote|d:figure|d:co">
478 <xsl:call-template name="convert.styles"/>
481 <xsl:template match="d:revhistory" mode="titlepage.mode">
482 <xsl:call-template name="convert.styles"/>
485 <xsl:template match="d:variablelist">
486 <xsl:call-template name="convert.styles"/>
489 <xsl:template match="d:orderedlist[@inheritnum = 'inherit']">
490 <xsl:call-template name="convert.styles"/>
493 <xsl:template match="d:simplelist">
494 <xsl:call-template name="convert.styles"/>
497 <xsl:template match="d:blockquote">
498 <xsl:call-template name="convert.styles"/>
501 <xsl:template match="d:note|d:important|d:warning|d:caution|d:tip">
502 <xsl:call-template name="convert.styles"/>
505 <xsl:template match="d:funcprototype" mode="ansi-tabular">
506 <xsl:call-template name="convert.styles"/>
509 <xsl:template match="d:funcprototype" mode="kr-tabular">
510 <xsl:call-template name="convert.styles"/>
513 <xsl:template name="convert.styles">
514 <xsl:param name="content">
517 <xsl:variable name="nodes" select="exsl:node-set($content)"/>
519 <xsl:apply-templates mode="convert.to.style" select="$nodes"/>
522 <!-- HTML5: link rel="home" is not permitted -->
523 <!-- Add support for attributes on <html> element -->
524 <xsl:template match="*" mode="process.root">
525 <xsl:variable name="doc" select="self::*"/>
527 <xsl:call-template name="user.preroot"/>
528 <xsl:call-template name="root.messages"/>
531 <xsl:call-template name="root.attributes"/>
533 <xsl:call-template name="system.head.content">
534 <xsl:with-param name="node" select="$doc"/>
536 <xsl:call-template name="head.content">
537 <xsl:with-param name="node" select="$doc"/>
539 <xsl:call-template name="user.head.content">
540 <xsl:with-param name="node" select="$doc"/>
544 <xsl:call-template name="body.attributes"/>
545 <xsl:call-template name="user.header.content">
546 <xsl:with-param name="node" select="$doc"/>
548 <xsl:apply-templates select="."/>
549 <xsl:call-template name="user.footer.content">
550 <xsl:with-param name="node" select="$doc"/>
554 <xsl:value-of select="$html.append"/>
556 <!-- Generate any css files only once, not once per chunk -->
557 <xsl:call-template name="generate.css.files"/>
560 <xsl:template name="root.attributes">
563 <!-- HTML5: uses <ul> instead of <dl> for TOC -->
564 <xsl:template match="d:question" mode="qandatoc.mode">
565 <xsl:variable name="firstch">
566 <!-- Use a titleabbrev or title if available -->
568 <xsl:when test="../d:blockinfo/d:titleabbrev">
569 <xsl:apply-templates select="../d:blockinfo/d:titleabbrev[1]/node()"/>
571 <xsl:when test="../d:blockinfo/d:title">
572 <xsl:apply-templates select="../d:blockinfo/d:title[1]/node()"/>
574 <xsl:when test="../d:info/d:titleabbrev">
575 <xsl:apply-templates select="../d:info/d:titleabbrev[1]/node()"/>
577 <xsl:when test="../d:titleabbrev">
578 <xsl:apply-templates select="../d:titleabbrev[1]/node()"/>
580 <xsl:when test="../d:info/d:title">
581 <xsl:apply-templates select="../d:info/d:title[1]/node()"/>
583 <xsl:when test="../d:title">
584 <xsl:apply-templates select="../d:title[1]/node()"/>
587 <xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
591 <xsl:variable name="deflabel">
593 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
594 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
598 <xsl:value-of select="$qanda.defaultlabel"/>
605 <xsl:attribute name="href">
606 <xsl:call-template name="href.target">
607 <xsl:with-param name="object" select=".."/>
610 <xsl:apply-templates select="." mode="label.markup"/>
611 <xsl:if test="contains($deflabel,'number') and not(d:label)">
612 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
614 <xsl:text> </xsl:text>
615 <xsl:value-of select="$firstch"/>
617 <!-- * include nested qandaset/qandaentry in TOC if user wants it -->
619 <xsl:if test="not($qanda.nested.in.toc = 0)">
620 <xsl:apply-templates select="following-sibling::d:answer" mode="qandatoc.mode"/>
625 <xsl:template match="d:answer" mode="qandatoc.mode">
626 <xsl:if test="descendant::d:question">
627 <xsl:call-template name="process.qanda.toc"/>
631 <!-- html5 uses <ul> instead of <dl> for toc -->
632 <xsl:template name="process.qanda.toc">
634 <xsl:apply-templates select="d:qandadiv" mode="qandatoc.mode"/>
635 <xsl:apply-templates select="d:qandaset|d:qandaentry" mode="qandatoc.mode"/>
639 <xsl:template match="d:qandadiv" mode="qandatoc.mode">
641 <dt><xsl:apply-templates select="d:title" mode="qandatoc.mode"/></dt>
642 <dd><xsl:call-template name="process.qanda.toc"/></dd>
645 <xsl:apply-templates select="d:title" mode="qandatoc.mode"/>
646 <xsl:call-template name="process.qanda.toc"/>
650 <!-- output html5 video and source elements -->
651 <xsl:template match="d:videoobject">
653 <xsl:call-template name="common.html.attributes"/>
654 <xsl:call-template name="video.poster"/>
655 <!-- copy videodata attributes from first videodata child only -->
656 <xsl:apply-templates select="d:videodata[1]/@*" mode="video.attribute"/>
657 <xsl:apply-templates select="d:videodata[1]/d:multimediaparam" mode="video.attribute"/>
659 <!-- generate <source> element for each videodata element -->
660 <xsl:apply-templates select="d:videodata"/>
662 <!-- add any fallback content -->
663 <xsl:call-template name="video.fallback"/>
668 <!-- output html5 audio and source elements -->
669 <xsl:template match="d:audioobject">
671 <xsl:call-template name="common.html.attributes"/>
673 <!-- copy audiodata attributes from first audiodata child only -->
674 <xsl:apply-templates select="d:audiodata[1]/@*" mode="audio.attribute"/>
675 <xsl:apply-templates select="d:audiodata[1]/d:multimediaparam" mode="audio.attribute"/>
677 <!-- generate <source> element for each videodata element -->
678 <xsl:apply-templates select="d:audiodata"/>
680 <!-- add any fallback content -->
681 <xsl:call-template name="audio.fallback"/>
686 <xsl:template match="d:videodata">
688 <xsl:variable name="filename">
689 <xsl:call-template name="mediaobject.filename">
690 <!-- Call it with the videodata as the object -->
691 <xsl:with-param name="object" select="."/>
696 <xsl:call-template name="common.html.attributes"/>
698 <xsl:attribute name="src">
699 <xsl:value-of select="$filename"/>
702 <xsl:apply-templates select="@format" mode="source.attribute"/>
704 <xsl:apply-templates select="d:multimediaparam" mode="source.attribute"/>
709 <xsl:template match="d:audiodata">
711 <xsl:variable name="filename">
712 <xsl:call-template name="mediaobject.filename">
713 <!-- Call it with the videodata as the object -->
714 <xsl:with-param name="object" select="."/>
719 <xsl:call-template name="common.html.attributes"/>
721 <xsl:attribute name="src">
722 <xsl:value-of select="$filename"/>
725 <xsl:apply-templates select="@format" mode="source.attribute"/>
727 <xsl:apply-templates select="d:multimediaparam" mode="source.attribute"/>
732 <!-- attributes handled in modes, so default is off -->
733 <xsl:template match="@*" mode="source.attribute"/>
734 <xsl:template match="@*" mode="video.attribute"/>
735 <xsl:template match="@*" mode="audio.attribute"/>
737 <xsl:template match="@format" mode="source.attribute">
738 <xsl:attribute name="type">
739 <xsl:value-of select="normalize-space(.)"/>
743 <!-- use only an imageobject with @role = 'poster' -->
744 <xsl:template name="video.poster">
745 <!-- context is videoobject -->
746 <xsl:variable name="imageobject"
747 select="../../d:imageobject[@role = 'poster'][1] |
748 ../d:imageobject[@role = 'poster'][1]"/>
749 <xsl:if test="$imageobject">
750 <xsl:attribute name="poster">
751 <xsl:value-of select="$imageobject/d:imagedata/@fileref"/>
756 <xsl:template match="d:videodata/@fileref" mode="source.attribute">
757 <!-- process in normal mode -->
758 <xsl:apply-templates select="."/>
761 <xsl:template match="d:videodata/@fileref" mode="video.attribute"/>
763 <xsl:template match="d:audiodata/@fileref" mode="source.attribute">
764 <!-- process in normal mode -->
765 <xsl:apply-templates select="."/>
768 <xsl:template match="d:audiodata/@fileref" mode="audio.attribute"/>
770 <xsl:template match="d:videodata/@contentwidth | d:videodata/@width"
771 mode="video.attribute">
772 <xsl:attribute name="width">
773 <xsl:value-of select="."/>
777 <xsl:template match="d:videodata/@contentdepth | d:videodata/@depth"
778 mode="video.attribute">
779 <xsl:attribute name="height">
780 <xsl:value-of select="."/>
784 <xsl:template match="d:multimediaparam" mode="source.attribute"/>
785 <xsl:template match="d:multimediaparam" mode="video.attribute"/>
787 <xsl:template match="d:multimediaparam[@name = 'autoplay' or
788 @name = 'controls' or
794 mode="video.attribute">
795 <xsl:call-template name="process.multimediaparam">
796 <xsl:with-param name="object" select=".."/>
797 <xsl:with-param name="param.name" select="@name"/>
798 <xsl:with-param name="param.value" select="@value"/>
802 <xsl:template match="d:multimediaparam[@name = 'autoplay' or
803 @name = 'controls' or
807 mode="audio.attribute">
808 <xsl:call-template name="process.multimediaparam">
809 <xsl:with-param name="object" select=".."/>
810 <xsl:with-param name="param.name" select="@name"/>
811 <xsl:with-param name="param.value" select="@value"/>
815 <xsl:template match="d:multimediaparam[not(@name = 'autoplay' or
816 @name = 'controls' or
822 mode="source.attribute">
823 <xsl:call-template name="process.multimediaparam">
824 <xsl:with-param name="object" select=".."/>
825 <xsl:with-param name="param.name" select="@name"/>
826 <xsl:with-param name="param.value" select="@value"/>
831 <!-- Determines the best value of a media attribute from the
832 attributes and multimediaparam elements -->
833 <xsl:template name="process.multimediaparam">
834 <xsl:param name="object" select="NOTANELEMENT"/>
835 <xsl:param name="param.name"/>
836 <xsl:param name="param.value"/>
839 <xsl:when test="$object/*/@*[local-name(.) = $param.name]">
840 <!-- explicit attribute with that name takes precedence -->
841 <xsl:attribute name="{$param.name}">
842 <xsl:value-of select="$object/*/@*[local-name(.) = $param.name]"/>
846 <xsl:attribute name="{$param.name}">
847 <xsl:value-of select="$param.value"/>
853 <xsl:template name="video.fallback">
854 <xsl:param name="videoobject" select="."/>
855 <xsl:variable name="textobject" select="$videoobject/../d:textobject"/>
858 <xsl:when test="$textobject">
859 <xsl:apply-templates select="$textobject" mode="fallback"/>
862 <xsl:call-template name="video.fallback.text"/>
867 <xsl:template name="video.fallback.text">
868 <xsl:call-template name="gentext">
869 <xsl:with-param name="key" select="'video-unsupported'"/>
873 <xsl:template name="audio.fallback">
874 <xsl:param name="audiodata" select="."/>
875 <xsl:variable name="textobject" select="$audiodata/../../d:textobject"/>
878 <xsl:when test="$textobject">
879 <xsl:apply-templates select="$textobject" mode="fallback"/>
882 <xsl:call-template name="audio.fallback.text"/>
888 <xsl:template name="audio.fallback.text">
889 <xsl:call-template name="gentext">
890 <xsl:with-param name="key" select="'audio-unsupported'"/>
894 <xsl:template match="d:textobject" mode="fallback">
896 <xsl:apply-templates select="." mode="class.attribute"/>
897 <xsl:apply-templates/>
901 <!-- HTML5: no body attributes -->
902 <xsl:template name="body.attributes"/>