1<?xml version="1.0"?> 2 3<!--This file was created automatically by xhtml2xhtml5.xsl from the xhtml stylesheet.--> 4 5<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl" version="1.0"> 6 7<!--Same as xhtml but with doctypes removed from xsl:output --> 8<!--and including from ../xhtml directory --> 9<xslo:output xmlns:xslo="http://www.w3.org/1999/XSL/Transform" method="xml" encoding="UTF-8" indent="no"/> 10 11<!-- ******************************************************************** 12 $Id: docbook.xsl 9983 2015-09-16 20:58:50Z bobstayton $ 13 ******************************************************************** 14 15 This file is part of the XSL DocBook Stylesheet distribution. 16 See ../README or http://docbook.sf.net/release/xsl/current/ for 17 copyright and other information. 18 19 ******************************************************************** --> 20 21<!-- ==================================================================== --> 22 23<xsl:include href="../VERSION.xsl"/> 24<xsl:include href="../xhtml/param.xsl"/> 25<xsl:include href="../lib/lib.xsl"/> 26<xsl:include href="../common/l10n.xsl"/> 27<xsl:include href="../common/common.xsl"/> 28<xsl:include href="../common/utility.xsl"/> 29<xsl:include href="../common/labels.xsl"/> 30<xsl:include href="../common/titles.xsl"/> 31<xsl:include href="../common/subtitles.xsl"/> 32<xsl:include href="../common/gentext.xsl"/> 33<xsl:include href="../common/targets.xsl"/> 34<xsl:include href="../common/olink.xsl"/> 35<xsl:include href="../common/pi.xsl"/> 36<xsl:include href="../xhtml/autotoc.xsl"/> 37<xsl:include href="../xhtml/autoidx.xsl"/> 38<xsl:include href="../xhtml/lists.xsl"/> 39<xsl:include href="../xhtml/callout.xsl"/> 40<xsl:include href="../xhtml/verbatim.xsl"/> 41<xsl:include href="../xhtml/graphics.xsl"/> 42<xsl:include href="../xhtml/xref.xsl"/> 43<xsl:include href="../xhtml/formal.xsl"/> 44<xsl:include href="../xhtml/table.xsl"/> 45<xsl:include href="../xhtml/htmltbl.xsl"/> 46<xsl:include href="../xhtml/sections.xsl"/> 47<xsl:include href="../xhtml/inline.xsl"/> 48<xsl:include href="../xhtml/footnote.xsl"/> 49<xsl:include href="../xhtml/html.xsl"/> 50<xsl:include href="../xhtml/its.xsl"/> 51<xsl:include href="../xhtml/info.xsl"/> 52<xsl:include href="../xhtml/keywords.xsl"/> 53<xsl:include href="../xhtml/division.xsl"/> 54<xsl:include href="../xhtml/toc.xsl"/> 55<xsl:include href="../xhtml/index.xsl"/> 56<xsl:include href="../xhtml/refentry.xsl"/> 57<xsl:include href="../xhtml/math.xsl"/> 58<xsl:include href="../xhtml/admon.xsl"/> 59<xsl:include href="../xhtml/component.xsl"/> 60<xsl:include href="../xhtml/biblio.xsl"/> 61<xsl:include href="../xhtml/biblio-iso690.xsl"/> 62<xsl:include href="../xhtml/glossary.xsl"/> 63<xsl:include href="../xhtml/block.xsl"/> 64<xsl:include href="../xhtml/task.xsl"/> 65<xsl:include href="../xhtml/qandaset.xsl"/> 66<xsl:include href="../xhtml/synop.xsl"/> 67<xsl:include href="../xhtml/titlepage.xsl"/> 68<xsl:include href="../xhtml/titlepage.templates.xsl"/> 69<xsl:include href="../xhtml/pi.xsl"/> 70<xsl:include href="../xhtml/ebnf.xsl"/> 71<xsl:include href="../xhtml/chunker.xsl"/> 72<xsl:include href="../xhtml/html-rtf.xsl"/> 73<xsl:include href="../xhtml/annotations.xsl"/> 74<xsl:include href="../common/stripns.xsl"/> 75<xsl:include href="../xhtml/publishers.xsl"/> 76 77<xsl:param name="stylesheet.result.type" select="'xhtml'"/> 78<xsl:param name="htmlhelp.output" select="0"/> 79 80<!-- ==================================================================== --> 81 82<xsl:key name="id" match="*" use="@id|@xml:id"/> 83<xsl:key name="gid" match="*" use="generate-id()"/> 84 85<!-- ==================================================================== --> 86 87<xsl:template match="*"> 88 <xsl:message> 89 <xsl:text>Element </xsl:text> 90 <xsl:value-of select="local-name(.)"/> 91 <xsl:text> in namespace '</xsl:text> 92 <xsl:value-of select="namespace-uri(.)"/> 93 <xsl:text>' encountered</xsl:text> 94 <xsl:if test="parent::*"> 95 <xsl:text> in </xsl:text> 96 <xsl:value-of select="name(parent::*)"/> 97 </xsl:if> 98 <xsl:text>, but no template matches.</xsl:text> 99 </xsl:message> 100 101 <span style="color: red"> 102 <xsl:text><</xsl:text> 103 <xsl:value-of select="name(.)"/> 104 <xsl:text>></xsl:text> 105 <xsl:apply-templates/> 106 <xsl:text></</xsl:text> 107 <xsl:value-of select="name(.)"/> 108 <xsl:text>></xsl:text> 109 </span> 110</xsl:template> 111 112<xsl:template match="text()"> 113 <xsl:value-of select="."/> 114</xsl:template> 115 116<xsl:template name="body.attributes"><xslo:if xmlns:xslo="http://www.w3.org/1999/XSL/Transform" test="starts-with($writing.mode, 'rl')"><xslo:attribute name="dir">rtl</xslo:attribute></xslo:if> 117<!-- no apply-templates; make it empty except for dir for rtl--> 118</xsl:template> 119 120<xsl:template name="head.content.base"> 121 <xsl:param name="node" select="."/> 122 <base href="{$html.base}"/> 123</xsl:template> 124 125<xsl:template name="head.content.abstract"> 126 <xsl:param name="node" select="."/> 127 <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/> 128 <xsl:if test="$info and $info/abstract"> 129 <meta name="description"> 130 <xsl:attribute name="content"> 131 <xsl:for-each select="$info/abstract[1]/*"> 132 <xsl:value-of select="normalize-space(.)"/> 133 <xsl:if test="position() < last()"> 134 <xsl:text> </xsl:text> 135 </xsl:if> 136 </xsl:for-each> 137 </xsl:attribute> 138 </meta> 139 </xsl:if> 140</xsl:template> 141 142<xsl:template name="head.content.link.made"> 143 <xsl:param name="node" select="."/> 144 145 <link rev="made" href="{$link.mailto.url}"/> 146</xsl:template> 147 148<xsl:template name="head.content.generator"> 149 <xsl:param name="node" select="."/> 150 <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/> 151</xsl:template> 152 153<xsl:template name="head.content.style"> 154 <xsl:param name="node" select="."/> 155 <style type="text/css"><xsl:text> 156body { background-image: url('</xsl:text> 157<xsl:value-of select="$draft.watermark.image"/><xsl:text>'); 158 background-repeat: no-repeat; 159 background-position: top left; 160 /* The following properties make the watermark "fixed" on the page. */ 161 /* I think that's just a bit too distracting for the reader... */ 162 /* background-attachment: fixed; */ 163 /* background-position: center center; */ 164 }</xsl:text> 165 </style> 166</xsl:template> 167 168<xsl:template name="head.content"> 169 <xsl:param name="node" select="."/> 170 <xsl:param name="title"> 171 <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/> 172 </xsl:param> 173 174 <xsl:call-template name="user.head.title"> 175 <xsl:with-param name="title" select="$title"/> 176 <xsl:with-param name="node" select="$node"/> 177 </xsl:call-template> 178 179 <xsl:if test="$html.base != ''"> 180 <xsl:call-template name="head.content.base"> 181 <xsl:with-param name="node" select="$node"/> 182 </xsl:call-template> 183 </xsl:if> 184 185 <!-- Insert links to CSS files or insert literal style elements --> 186 <xsl:call-template name="generate.css"/> 187 188 <xsl:if test="$html.stylesheet != ''"> 189 <xsl:call-template name="output.html.stylesheets"> 190 <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/> 191 </xsl:call-template> 192 </xsl:if> 193 194 <xsl:if test="$html.script != ''"> 195 <xsl:call-template name="output.html.scripts"> 196 <xsl:with-param name="scripts" select="normalize-space($html.script)"/> 197 </xsl:call-template> 198 </xsl:if> 199 200 <xsl:if test="$link.mailto.url != ''"> 201 <xsl:call-template name="head.content.link.made"> 202 <xsl:with-param name="node" select="$node"/> 203 </xsl:call-template> 204 </xsl:if> 205 206 <xsl:call-template name="head.content.generator"> 207 <xsl:with-param name="node" select="$node"/> 208 </xsl:call-template> 209 210 <xsl:if test="$generate.meta.abstract != 0"> 211 <xsl:call-template name="head.content.abstract"> 212 <xsl:with-param name="node" select="$node"/> 213 </xsl:call-template> 214 </xsl:if> 215 216 <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''"> 217 <xsl:call-template name="head.content.style"> 218 <xsl:with-param name="node" select="$node"/> 219 </xsl:call-template> 220 </xsl:if> 221 <xsl:apply-templates select="." mode="head.keywords.content"/> 222</xsl:template> 223 224<xsl:template name="output.html.stylesheets"> 225 <xsl:param name="stylesheets" select="''"/> 226 227 <xsl:choose> 228 <xsl:when test="contains($stylesheets, ' ')"> 229 <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/> 230 231 <xsl:call-template name="make.css.link"> 232 <xsl:with-param name="css.filename" select="$css.filename"/> 233 </xsl:call-template> 234 235 <xsl:call-template name="output.html.stylesheets"> 236 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/> 237 </xsl:call-template> 238 </xsl:when> 239 <xsl:when test="$stylesheets != ''"> 240 <xsl:call-template name="make.css.link"> 241 <xsl:with-param name="css.filename" select="$stylesheets"/> 242 </xsl:call-template> 243 </xsl:when> 244 </xsl:choose> 245</xsl:template> 246 247<xsl:template name="output.html.scripts"> 248 <xsl:param name="scripts" select="''"/> 249 250 <xsl:choose> 251 <xsl:when test="contains($scripts, ' ')"> 252 <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/> 253 254 <xsl:call-template name="make.script.link"> 255 <xsl:with-param name="script.filename" select="$script.filename"/> 256 </xsl:call-template> 257 258 <xsl:call-template name="output.html.scripts"> 259 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/> 260 </xsl:call-template> 261 </xsl:when> 262 <xsl:when test="$scripts != ''"> 263 <xsl:call-template name="make.script.link"> 264 <xsl:with-param name="script.filename" select="$scripts"/> 265 </xsl:call-template> 266 </xsl:when> 267 </xsl:choose> 268</xsl:template> 269 270<!-- ============================================================ --> 271 272<xsl:template match="*" mode="head.keywords.content"> 273 <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/> 274 <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/> 275 <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/> 276 <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/> 277 <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/> 278 <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/> 279 <xsl:apply-templates select="artheader/keywordset" mode="html.header"/> 280 <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/> 281 <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/> 282 <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/> 283 <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/> 284 <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/> 285 <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/> 286 <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/> 287 <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/> 288 <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/> 289 <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/> 290 <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/> 291 <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/> 292 <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/> 293 <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/> 294 <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/> 295 <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/> 296 <xsl:apply-templates select="info/keywordset" mode="html.header"/> 297 298 <xsl:if test="$inherit.keywords != 0 and parent::*"> 299 <xsl:apply-templates select="parent::*" mode="head.keywords.content"/> 300 </xsl:if> 301</xsl:template> 302 303<!-- ============================================================ --> 304 305<xsl:template name="system.head.content"> 306 <xsl:param name="node" select="."/> 307 308 <!-- FIXME: When chunking, only the annotations actually used 309 in this chunk should be referenced. I don't think it 310 does any harm to reference them all, but it adds 311 unnecessary bloat to each chunk. --> 312 <xsl:if test="$annotation.support != 0 and //annotation"> 313 <xsl:call-template name="add.annotation.links"/> 314 <script type="text/javascript"> 315 <xsl:text> 316// Create PopupWindow objects</xsl:text> 317 <xsl:for-each select="//annotation"> 318 <xsl:text> 319var popup_</xsl:text> 320 <xsl:value-of select="generate-id(.)"/> 321 <xsl:text> = new PopupWindow("popup-</xsl:text> 322 <xsl:value-of select="generate-id(.)"/> 323 <xsl:text>"); 324</xsl:text> 325 <xsl:text>popup_</xsl:text> 326 <xsl:value-of select="generate-id(.)"/> 327 <xsl:text>.offsetY = 15; 328</xsl:text> 329 <xsl:text>popup_</xsl:text> 330 <xsl:value-of select="generate-id(.)"/> 331 <xsl:text>.autoHide(); 332</xsl:text> 333 </xsl:for-each> 334 </script> 335 336 <style type="text/css"> 337 <xsl:value-of select="$annotation.css"/> 338 </style> 339 </xsl:if> 340 341 <!-- system.head.content is like user.head.content, except that 342 it is called before head.content. This is important because it 343 means, for example, that <style> elements output by system.head.content 344 have a lower CSS precedence than the users stylesheet. --> 345</xsl:template> 346 347<!-- ============================================================ --> 348 349<xsl:template name="user.preroot"> 350 <!-- Pre-root output, can be used to output comments and PIs. --> 351 <!-- This must not output any element content! --> 352</xsl:template> 353 354<xsl:template name="user.head.title"> 355 <xsl:param name="node" select="."/> 356 <xsl:param name="title"/> 357 358 <title> 359 <xsl:copy-of select="$title"/> 360 </title> 361</xsl:template> 362 363<xsl:template name="user.head.content"> 364 <xsl:param name="node" select="."/> 365</xsl:template> 366 367<xsl:template name="user.header.navigation"> 368 <xsl:param name="node" select="."/> 369 <xsl:param name="prev" select="/foo"/> 370 <xsl:param name="next" select="/foo"/> 371 <xsl:param name="nav.context"/> 372</xsl:template> 373 374<xsl:template name="user.header.content"> 375 <xsl:param name="node" select="."/> 376</xsl:template> 377 378<xsl:template name="user.footer.content"> 379 <xsl:param name="node" select="."/> 380</xsl:template> 381 382<xsl:template name="user.footer.navigation"> 383 <xsl:param name="node" select="."/> 384 <xsl:param name="prev" select="/foo"/> 385 <xsl:param name="next" select="/foo"/> 386 <xsl:param name="nav.context"/> 387</xsl:template> 388 389<!-- To use the same namespace-adjusted nodeset everywhere, it should 390be created as a global variable here. 391Used by docbook.xsl, chunk-common.xsl, chunktoc.xsl, and 392chunk-code.xsl; and in $chunk.hierarchy used in chunkfast.xsl --> 393<xsl:variable name="no.namespace"> 394 <xsl:if test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'"> 395 <xsl:apply-templates select="/*" mode="stripNS"/> 396 </xsl:if> 397</xsl:variable> 398 399<xsl:template match="/"> 400 <!-- * Get a title for current doc so that we let the user --> 401 <!-- * know what document we are processing at this point. --> 402 <xsl:variable name="doc.title"> 403 <xsl:call-template name="get.doc.title"/> 404 </xsl:variable> 405 <xsl:choose> 406 <!-- fix namespace if necessary --> 407 <xsl:when test="$exsl.node.set.available != 0 and namespace-uri(/*) = 'http://docbook.org/ns/docbook'"> 408 <xsl:call-template name="log.message"> 409 <xsl:with-param name="level">Note</xsl:with-param> 410 <xsl:with-param name="source" select="$doc.title"/> 411 <xsl:with-param name="context-desc"> 412 <xsl:text>namesp. cut</xsl:text> 413 </xsl:with-param> 414 <xsl:with-param name="message"> 415 <xsl:text>stripped namespace before processing</xsl:text> 416 </xsl:with-param> 417 </xsl:call-template> 418 <!-- DEBUG: uncomment to save namespace-fixed document. 419 <xsl:message>Saving namespace-fixed document.</xsl:message> 420 <xsl:call-template name="write.chunk"> 421 <xsl:with-param name="filename" select="'namespace-fixed.debug.xml'"/> 422 <xsl:with-param name="method" select="'xml'"/> 423 <xsl:with-param name="content"> 424 <xsl:copy-of select="exsl:node-set($no.namespace)"/> 425 </xsl:with-param> 426 </xsl:call-template> 427 --> 428 <xsl:apply-templates select="exsl:node-set($no.namespace)"/> 429 </xsl:when> 430 <!-- Can't process unless namespace fixed with exsl node-set()--> 431 <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'"> 432 <xsl:message terminate="yes"> 433 <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text> 434 <xsl:text> cannot proceed.</xsl:text> 435 </xsl:message> 436 </xsl:when> 437 <xsl:otherwise> 438 <xsl:choose> 439 <xsl:when test="$rootid != ''"> 440 <xsl:choose> 441 <xsl:when test="count(key('id',$rootid)) = 0"> 442 <xsl:message terminate="yes"> 443 <xsl:text>ID '</xsl:text> 444 <xsl:value-of select="$rootid"/> 445 <xsl:text>' not found in document.</xsl:text> 446 </xsl:message> 447 </xsl:when> 448 <xsl:otherwise> 449 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'"> 450 <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/> 451 </xsl:if> 452 <xsl:if test="$collect.xref.targets != 'only'"> 453 <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/> 454 <xsl:if test="$tex.math.in.alt != ''"> 455 <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/> 456 </xsl:if> 457 </xsl:if> 458 </xsl:otherwise> 459 </xsl:choose> 460 </xsl:when> 461 <xsl:otherwise> 462 <xsl:if test="$collect.xref.targets = 'yes' or $collect.xref.targets = 'only'"> 463 <xsl:apply-templates select="/" mode="collect.targets"/> 464 </xsl:if> 465 <xsl:if test="$collect.xref.targets != 'only'"> 466 <xsl:apply-templates select="/" mode="process.root"/> 467 <xsl:if test="$tex.math.in.alt != ''"> 468 <xsl:apply-templates select="/" mode="collect.tex.math"/> 469 </xsl:if> 470 </xsl:if> 471 </xsl:otherwise> 472 </xsl:choose> 473 </xsl:otherwise> 474 </xsl:choose> 475</xsl:template> 476 477<xsl:template match="*" mode="process.root"> 478 <xsl:variable name="doc" select="self::*"/> 479 480 <xsl:call-template name="user.preroot"/> 481 <xsl:call-template name="root.messages"/> 482 483 <html> 484 <xsl:call-template name="root.attributes"/> 485 <head> 486 <xsl:call-template name="system.head.content"> 487 <xsl:with-param name="node" select="$doc"/> 488 </xsl:call-template> 489 <xsl:call-template name="head.content"> 490 <xsl:with-param name="node" select="$doc"/> 491 </xsl:call-template> 492 <xsl:call-template name="user.head.content"> 493 <xsl:with-param name="node" select="$doc"/> 494 </xsl:call-template> 495 </head> 496 <body> 497 <xsl:call-template name="body.attributes"/> 498 <xsl:call-template name="user.header.content"> 499 <xsl:with-param name="node" select="$doc"/> 500 </xsl:call-template> 501 <xsl:apply-templates select="."/> 502 <xsl:call-template name="user.footer.content"> 503 <xsl:with-param name="node" select="$doc"/> 504 </xsl:call-template> 505 </body> 506 </html> 507 <xsl:value-of select="$html.append"/> 508 509 <!-- Generate any css files only once, not once per chunk --> 510 <xsl:call-template name="generate.css.files"/> 511</xsl:template> 512 513<xsl:template name="root.attributes"> 514 <!-- customize to add attributes to <html> element --> 515</xsl:template> 516 517<xsl:template name="root.messages"> 518 <!-- redefine this any way you'd like to output messages --> 519 <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE --> 520</xsl:template> 521 522<!-- ==================================================================== --> 523 524<xsl:template name="chunk"> 525 <xsl:param name="node" select="."/> 526 527 <!-- The default is that we are not chunking... --> 528 <xsl:text>0</xsl:text> 529</xsl:template> 530 531</xsl:stylesheet> 532