1<?xml version='1.0'?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 xmlns:html='http://www.w3.org/1999/xhtml' 4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" 5 exclude-result-prefixes="doc html" 6 version='1.0'> 7 8<!-- ******************************************************************** 9 $Id: website-common.xsl,v 1.22 2005/04/15 19:09:43 nwalsh Exp $ 10 ******************************************************************** 11 12 This file is part of the WebSite distribution. 13 See /README or http://nwalsh.com/website/ for copyright 14 and other information. 15 16 ******************************************************************** --> 17 18<!-- ==================================================================== --> 19 20<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/> 21<xsl:import href="xbel.xsl"/> 22<xsl:include href="/VERSION"/> 23<xsl:include href="param.xsl"/> 24<xsl:include href="head.xsl"/> 25<xsl:include href="rss.xsl"/> 26<xsl:include href="olink.xsl"/> 27 28<xsl:preserve-space elements="*"/> 29<xsl:strip-space elements="website webpage"/> 30 31<xsl:output method="html" 32 indent="no"/> 33 34<!-- ==================================================================== --> 35 36<xsl:template name="admon.graphic"> 37 <xsl:param name="node" select="."/> 38 <xsl:call-template name="root-rel-path"/> 39 <xsl:value-of select="$admon.graphics.path"/> 40 <xsl:choose> 41 <xsl:when test="name($node)='note'">note</xsl:when> 42 <xsl:when test="name($node)='warning'">warning</xsl:when> 43 <xsl:when test="name($node)='caution'">caution</xsl:when> 44 <xsl:when test="name($node)='tip'">tip</xsl:when> 45 <xsl:when test="name($node)='important'">important</xsl:when> 46 <xsl:otherwise>note</xsl:otherwise> 47 </xsl:choose> 48 <xsl:value-of select="$admon.graphics.extension"/> 49</xsl:template> 50 51<doc:template name="admon.graphic"> 52<refpurpose>Select appropriate admonition graphic</refpurpose> 53<refdescription> 54<para>Selects the appropriate admonition graphic file and returns the 55fully qualified path to it.</para> 56</refdescription> 57<refparam> 58<variablelist> 59<varlistentry><term>node</term> 60<listitem> 61<para>The source node to use for the purpose of selection. It should 62be one of the admonition elements (<sgmltag>note</sgmltag>, 63<sgmltag>warning</sgmltag>, etc.). The default node is the context 64node.</para> 65</listitem> 66</varlistentry> 67</variablelist> 68</refparam> 69<refreturns> 70<para>The fully qualified path to the admonition graphic. If the 71<varname>node</varname> is not an admonition element, the 72 <quote>note</quote> graphic is returned.</para> 73</refreturns> 74</doc:template> 75 76<!-- ==================================================================== --> 77 78<xsl:template match="/"> 79 <xsl:apply-templates/> 80</xsl:template> 81 82<!-- ==================================================================== --> 83 84<xsl:template name="allpages.banner"/> 85 86<!-- ==================================================================== --> 87 88<xsl:template name="webpage.table.footer"/> 89 90<xsl:template name="webpage.footer"> 91 <xsl:variable name="page" select="."/> 92 <xsl:variable name="footers" select="$page/config[@param='footer'] 93 |$page/config[@param='footlink'] 94 |$autolayout/autolayout/config[@param='footer'] 95 |$autolayout/autolayout/config[@param='footlink']"/> 96 97 <xsl:variable name="tocentry" select="$autolayout//*[@id=$page/@id]"/> 98 <xsl:variable name="toc" select="($tocentry/ancestor-or-self::toc[1] 99 | $autolayout//toc[1])[last()]"/> 100 101 <xsl:variable name="feedback"> 102 <xsl:choose> 103 <xsl:when test="$page/config[@param='feedback.href']"> 104 <xsl:value-of select="($page/config[@param='feedback.href'])[1]/@value"/> 105 </xsl:when> 106 <xsl:when test="$autolayout/autolayout/config[@param='feedback.href']"> 107 <xsl:value-of select="($autolayout/autolayout/config[@param='feedback.href'])[1]/@value"/> 108 </xsl:when> 109 <xsl:otherwise> 110 <xsl:value-of select="$feedback.href"/> 111 </xsl:otherwise> 112 </xsl:choose> 113 </xsl:variable> 114 115 <div class="navfoot"> 116 <xsl:if test="$footer.hr != 0"><hr/></xsl:if> 117 <table width="100%" border="0" summary="Footer navigation"> 118 <tr> 119 <td width="33%" align="left"> 120 <span class="footdate"> 121 <xsl:call-template name="rcsdate.format"> 122 <xsl:with-param name="rcsdate" 123 select="$page/config[@param='rcsdate']/@value"/> 124 </xsl:call-template> 125 </span> 126 </td> 127 <td width="34%" align="center"> 128 <xsl:choose> 129 <xsl:when test="not($toc)"> 130 <xsl:message> 131 <xsl:text>Cannot determine TOC for </xsl:text> 132 <xsl:value-of select="$page/@id"/> 133 </xsl:message> 134 </xsl:when> 135 <xsl:when test="$toc/@id = $page/@id"> 136 <!-- nop; this is the home page --> 137 </xsl:when> 138 <xsl:otherwise> 139 <span class="foothome"> 140 <a> 141 <xsl:attribute name="href"> 142 <xsl:call-template name="homeuri"/> 143 </xsl:attribute> 144 <xsl:call-template name="gentext.nav.home"/> 145 </a> 146 <xsl:if test="$footers"> 147 <xsl:text> | </xsl:text> 148 </xsl:if> 149 </span> 150 </xsl:otherwise> 151 </xsl:choose> 152 153 <xsl:apply-templates select="$footers" mode="footer.link.mode"/> 154 </td> 155 <td width="33%" align="right"> 156 <xsl:choose> 157 <xsl:when test="$feedback != ''"> 158 <span class="footfeed"> 159 <a> 160 <xsl:choose> 161 <xsl:when test="$feedback.with.ids != 0"> 162 <xsl:attribute name="href"> 163 <xsl:value-of select="$feedback"/> 164 <xsl:value-of select="$page/@id"/> 165 </xsl:attribute> 166 </xsl:when> 167 <xsl:otherwise> 168 <xsl:attribute name="href"> 169 <xsl:value-of select="$feedback"/> 170 </xsl:attribute> 171 </xsl:otherwise> 172 </xsl:choose> 173 <xsl:value-of select="$feedback.link.text"/> 174 </a> 175 </span> 176 </xsl:when> 177 <xsl:otherwise> </xsl:otherwise> 178 </xsl:choose> 179 </td> 180 </tr> 181 <tr> 182 <td colspan="3" align="right"> 183 <span class="footcopy"> 184 <xsl:choose> 185 <xsl:when test="head/copyright"> 186 <xsl:apply-templates select="head/copyright" mode="footer.mode"/> 187 </xsl:when> 188 <xsl:otherwise> 189 <xsl:apply-templates mode="footer.mode" 190 select="$autolayout/autolayout/copyright"/> 191 </xsl:otherwise> 192 </xsl:choose> 193 </span> 194 </td> 195 </tr> 196 <xsl:if test="$sequential.links != 0"> 197 <tr> 198 <xsl:variable name="prev"> 199 <xsl:call-template name="prev.page"/> 200 </xsl:variable> 201 <xsl:variable name="next"> 202 <xsl:call-template name="next.page"/> 203 </xsl:variable> 204 <xsl:variable name="ptoc" 205 select="$autolayout/autolayout//*[$prev=@id]"/> 206 <xsl:variable name="ntoc" 207 select="$autolayout/autolayout//*[$next=@id]"/> 208 209 <td align="left" valign="top"> 210 <xsl:choose> 211 <xsl:when test="$prev != ''"> 212 <xsl:call-template name="link.to.page"> 213 <xsl:with-param name="frompage" select="$tocentry"/> 214 <xsl:with-param name="page" select="$ptoc"/> 215 <xsl:with-param name="linktext" select="'Prev'"/> 216 </xsl:call-template> 217 </xsl:when> 218 <xsl:otherwise> </xsl:otherwise> 219 </xsl:choose> 220 </td> 221 <td> </td> 222 <td align="right" valign="top"> 223 <xsl:choose> 224 <xsl:when test="$next != ''"> 225 <xsl:call-template name="link.to.page"> 226 <xsl:with-param name="frompage" select="$tocentry"/> 227 <xsl:with-param name="page" select="$ntoc"/> 228 <xsl:with-param name="linktext" select="'Next'"/> 229 </xsl:call-template> 230 </xsl:when> 231 <xsl:otherwise> </xsl:otherwise> 232 </xsl:choose> 233 </td> 234 </tr> 235 </xsl:if> 236 </table> 237 </div> 238</xsl:template> 239 240<xsl:template name="rcsdate.format"> 241 <xsl:param name="rcsdate" select="/config[@param='rcsdate']/@value"/> 242 <xsl:value-of select="$rcsdate"/> 243</xsl:template> 244 245<xsl:template match="config" mode="footer.link.mode"> 246 <span class="foothome"> 247 <xsl:if test="position() > 1"> 248 <xsl:text> | </xsl:text> 249 </xsl:if> 250 <xsl:choose> 251 <xsl:when test="@param='footlink'"> 252 <xsl:variable name="id" select="@value"/> 253 <xsl:variable name="tocentry" 254 select="$autolayout//*[@id=$id]"/> 255 <xsl:if test="count($tocentry) != 1"> 256 <xsl:message> 257 <xsl:text>Footlink to </xsl:text> 258 <xsl:value-of select="$id"/> 259 <xsl:text> does not id a unique page.</xsl:text> 260 </xsl:message> 261 </xsl:if> 262 <xsl:variable name="dir"> 263 <xsl:choose> 264 <xsl:when test="starts-with($tocentry/@dir, '/')"> 265 <xsl:value-of select="substring($tocentry/@dir, 2)"/> 266 </xsl:when> 267 <xsl:otherwise> 268 <xsl:value-of select="$tocentry/@dir"/> 269 </xsl:otherwise> 270 </xsl:choose> 271 </xsl:variable> 272 <a> 273 <xsl:attribute name="href"> 274 <xsl:call-template name="root-rel-path"/> 275 <xsl:value-of select="$dir"/> 276 <xsl:value-of select="$filename-prefix"/> 277 <xsl:value-of select="$tocentry/@filename"/> 278 </xsl:attribute> 279 <xsl:value-of select="@altval"/> 280 </a> 281 </xsl:when> 282 <xsl:otherwise> 283 <a href="{@value}"> 284 <xsl:value-of select="@altval"/> 285 </a> 286 </xsl:otherwise> 287 </xsl:choose> 288 </span> 289</xsl:template> 290 291<!-- ==================================================================== --> 292 293<xsl:template name="homeuri"> 294 <xsl:param name="page" select="ancestor-or-self::webpage"/> 295 <xsl:variable name="id" select="$page/@id"/> 296 <xsl:variable name="tocentry" 297 select="$autolayout//*[@id=$id]"/> 298 <xsl:variable name="toc" select="$tocentry/ancestor::toc"/> 299 <xsl:variable name="first-toc" 300 select="$autolayout/autolayout/toc[1]"/> 301 302 <xsl:call-template name="root-rel-path"/> 303 <xsl:choose> 304 <xsl:when test="$toc"> 305 <xsl:choose> 306 <xsl:when test="starts-with($toc/@dir, '/')"> 307 <xsl:value-of select="substring($toc/@dir, 2)"/> 308 </xsl:when> 309 <xsl:otherwise> 310 <xsl:value-of select="$toc/@dir"/> 311 </xsl:otherwise> 312 </xsl:choose> 313 <xsl:value-of select="$filename-prefix"/> 314 <xsl:value-of select="$toc/@filename"/> 315 </xsl:when> 316 <xsl:otherwise> 317 <xsl:choose> 318 <xsl:when test="starts-with($first-toc/@dir, '/')"> 319 <xsl:value-of select="substring($first-toc/@dir, 2)"/> 320 </xsl:when> 321 <xsl:otherwise> 322 <xsl:value-of select="$first-toc/@dir"/> 323 </xsl:otherwise> 324 </xsl:choose> 325 <xsl:value-of select="$filename-prefix"/> 326 <xsl:value-of select="$first-toc/@filename"/> 327 </xsl:otherwise> 328 </xsl:choose> 329</xsl:template> 330 331<!-- ==================================================================== --> 332 333<xsl:template match="copyright" mode="footer.mode"> 334 <span class="{name(.)}"> 335 <xsl:call-template name="gentext.element.name"/> 336 <xsl:call-template name="gentext.space"/> 337 <xsl:call-template name="dingbat"> 338 <xsl:with-param name="dingbat">copyright</xsl:with-param> 339 </xsl:call-template> 340 <xsl:call-template name="gentext.space"/> 341 <xsl:apply-templates select="year" mode="footer.mode"/> 342 <xsl:call-template name="gentext.space"/> 343 <xsl:apply-templates select="holder" mode="footer.mode"/> 344 <xsl:value-of select="$biblioentry.item.separator"/> 345 </span> 346</xsl:template> 347 348<xsl:template match="year" mode="footer.mode"> 349 <xsl:apply-templates/><xsl:text>, </xsl:text> 350</xsl:template> 351 352<xsl:template match="year[position()=last()]" mode="footer.mode"> 353 <xsl:apply-templates/> 354</xsl:template> 355 356<xsl:template match="holder" mode="footer.mode"> 357 <xsl:apply-templates/> 358 <xsl:if test="position() != last()">, </xsl:if> 359</xsl:template> 360 361<!-- ==================================================================== --> 362 363<xsl:template match="config"> 364</xsl:template> 365 366<!-- ==================================================================== --> 367 368<xsl:template match="head"> 369</xsl:template> 370 371<xsl:template match="head/title" mode="title.mode"> 372 <h1><xsl:apply-templates/></h1> 373</xsl:template> 374 375<xsl:template match="head/title"> 376 <xsl:apply-templates/> 377</xsl:template> 378 379<!-- ==================================================================== --> 380 381<xsl:template name="directory-depth"> 382 <xsl:param name="dir"></xsl:param> 383 <xsl:param name="count" select="0"/> 384 385 <xsl:choose> 386 <xsl:when test='contains($dir,"/")'> 387 <xsl:call-template name="directory-depth"> 388 <xsl:with-param name="dir" select="substring-after($dir,'/')"/> 389 <xsl:with-param name="count" select="$count + 1"/> 390 </xsl:call-template> 391 </xsl:when> 392 <xsl:otherwise> 393 <xsl:choose> 394 <xsl:when test='$dir=""'> 395 <xsl:value-of select="$count"/> 396 </xsl:when> 397 <xsl:otherwise> 398 <xsl:value-of select="$count + 1"/> 399 </xsl:otherwise> 400 </xsl:choose> 401 </xsl:otherwise> 402 </xsl:choose> 403</xsl:template> 404 405<xsl:template name="root-rel-path"> 406 <xsl:param name="webpage" select="ancestor-or-self::webpage"/> 407 <xsl:variable name="tocentry" select="$autolayout//*[$webpage/@id=@id]"/> 408 <xsl:apply-templates select="$tocentry" mode="toc-rel-path"/> 409</xsl:template> 410 411<!-- ==================================================================== --> 412 413<xsl:template match="footnote" mode="footnote.number"> 414 <xsl:choose> 415 <xsl:when test="ancestor::table|ancestor::informaltable"> 416 <xsl:number level="any" from="table|informaltable" format="a"/> 417 </xsl:when> 418 <xsl:otherwise> 419 <xsl:number level="any" from="webpage" format="1"/> 420 </xsl:otherwise> 421 </xsl:choose> 422</xsl:template> 423 424<xsl:template name="process.footnotes"> 425 <!-- we're only interested in footnotes that occur on this page, not 426 on descendants of this page (which will be similarly processed) --> 427 <xsl:variable name="thispage" 428 select="ancestor-or-self::webpage"/> 429 <xsl:variable name="footnotes" 430 select=".//footnote[ancestor-or-self::webpage=$thispage]"/> 431 <xsl:variable name="table.footnotes" 432 select=".//table//footnote[ancestor-or-self::webpage=$thispage] 433 |.//informaltable//footnote[ancestor-or-self::webpage 434 =$thispage]"/> 435 436 <!-- Only bother to do this if there's at least one non-table footnote --> 437 <xsl:if test="count($footnotes)>count($table.footnotes)"> 438 <div class="footnotes"> 439 <hr width="100" align="left"/> 440 <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/> 441 </div> 442 </xsl:if> 443</xsl:template> 444 445<!-- ==================================================================== --> 446 447<xsl:template match="@*" mode="copy"> 448 <xsl:attribute name="{local-name(.)}"> 449 <xsl:value-of select="."/> 450 </xsl:attribute> 451</xsl:template> 452 453<xsl:template match="html:*"> 454 <xsl:element name="{local-name(.)}" namespace=""> 455 <xsl:apply-templates select="@*" mode="copy"/> 456 <xsl:apply-templates/> 457 </xsl:element> 458</xsl:template> 459 460<!-- ==================================================================== --> 461 462<xsl:template match="processing-instruction('php')"> 463 <xsl:processing-instruction name="php"> 464 <xsl:value-of select="."/> 465 </xsl:processing-instruction> 466</xsl:template> 467 468<!-- ==================================================================== --> 469 470<xsl:template match="rddl:*" xmlns:rddl='http://www.rddl.org/'> 471 <xsl:element name="{name(.)}"> 472 <xsl:apply-templates select="@*" mode="copy"/> 473 <xsl:apply-templates/> 474 </xsl:element> 475</xsl:template> 476 477<xsl:template match="section[@rddl]" xmlns:rddl='http://www.rddl.org/'> 478 <xsl:variable name="rddl" select="id(@rddl)"/> 479 <xsl:choose> 480 <xsl:when test="local-name($rddl) != 'resource'"> 481 <xsl:message> 482 <xsl:text>Warning: section rddl isn't an rddl:resource: </xsl:text> 483 <xsl:value-of select="@rddl"/> 484 </xsl:message> 485 <xsl:apply-imports/> 486 </xsl:when> 487 <xsl:otherwise> 488 <xsl:element name="{name($rddl)}"> 489 <xsl:apply-templates select="$rddl/@*" mode="copy"/> 490 <xsl:apply-imports/> 491 </xsl:element> 492 </xsl:otherwise> 493 </xsl:choose> 494</xsl:template> 495 496<!-- ==================================================================== --> 497 498<xsl:template name="page.uri"> 499 <xsl:param name="href" select="''"/> 500 <xsl:param name="page" select="ancestor-or-self::tocentry"/> 501 <xsl:param name="relpath"> 502 <xsl:call-template name="toc-rel-path"> 503 <xsl:with-param name="pageid" select="$page/@id"/> 504 </xsl:call-template> 505 </xsl:param> 506 507<!-- 508 <xsl:message><xsl:value-of select="$page/@id"/>: <xsl:value-of select="$relpath"/></xsl:message> 509--> 510 511 <xsl:variable name="dir"> 512 <xsl:choose> 513 <xsl:when test="starts-with($page/@dir, '/')"> 514 <xsl:value-of select="substring($page/@dir, 2)"/> 515 </xsl:when> 516 <xsl:otherwise> 517 <xsl:value-of select="$page/@dir"/> 518 </xsl:otherwise> 519 </xsl:choose> 520 </xsl:variable> 521 522 <xsl:variable name="html.href"> 523 <xsl:choose> 524 <xsl:when test="$href != ''"> 525 <xsl:value-of select="$href"/> 526 </xsl:when> 527 <xsl:when test="$page/@href"> 528 <xsl:value-of select="$page/@href"/> 529 </xsl:when> 530 <xsl:otherwise> 531 <xsl:value-of select="concat($relpath,$dir,$filename-prefix)"/> 532 <xsl:value-of select="$page/@filename"/> 533 </xsl:otherwise> 534 </xsl:choose> 535 </xsl:variable> 536 537 <xsl:value-of select="$html.href"/> 538</xsl:template> 539 540<xsl:template name="link.to.page"> 541 <xsl:param name="href" select="''"/> 542 <xsl:param name="frompage"/> 543 <xsl:param name="page" select="ancestor-or-self::tocentry"/> 544 <xsl:param name="relpath"> 545 <xsl:choose> 546 <xsl:when test="$frompage"> 547 <xsl:call-template name="toc-rel-path"> 548 <xsl:with-param name="pageid" select="$frompage/@id"/> 549 </xsl:call-template> 550 </xsl:when> 551 <xsl:otherwise> 552 <xsl:call-template name="toc-rel-path"> 553 <xsl:with-param name="pageid" select="$page/@id"/> 554 </xsl:call-template> 555 </xsl:otherwise> 556 </xsl:choose> 557 </xsl:param> 558 <xsl:param name="linktext" select="'???'"/> 559 560 <a> 561 <xsl:attribute name="href"> 562 <xsl:call-template name="page.uri"> 563 <xsl:with-param name="href" select="$href"/> 564 <xsl:with-param name="page" select="$page"/> 565 <xsl:with-param name="relpath" select="$relpath"/> 566 </xsl:call-template> 567 </xsl:attribute> 568 <xsl:if test="summary"> 569 <xsl:attribute name="title"> 570 <xsl:value-of select="normalize-space(string(summary))"/> 571 </xsl:attribute> 572 </xsl:if> 573 <xsl:copy-of select="$linktext"/> 574 </a> 575</xsl:template> 576 577<xsl:template name="next.page"> 578 <xsl:param name="page" select="ancestor-or-self::webpage"/> 579 <xsl:variable name="id" select="$page/@id"/> 580 <xsl:variable name="tocentry" 581 select="$autolayout//*[@id=$id]"/> 582 <xsl:variable name="next-following" 583 select="$tocentry/following::tocentry[1]"/> 584 <xsl:variable name="next-child" 585 select="$tocentry/descendant::tocentry[1]"/> 586 587 <xsl:variable name="nextid"> 588 <xsl:choose> 589 <xsl:when test="$next-child"> 590 <xsl:value-of select="$next-child/@id"/> 591 </xsl:when> 592 <xsl:when test="$next-following"> 593 <xsl:value-of select="$next-following/@id"/> 594 </xsl:when> 595 <xsl:otherwise></xsl:otherwise> 596 </xsl:choose> 597 </xsl:variable> 598 <xsl:value-of select="$nextid"/> 599</xsl:template> 600 601<xsl:template name="prev.page"> 602 <xsl:param name="page" select="ancestor-or-self::webpage"/> 603 <xsl:variable name="id" select="$page/@id"/> 604 <xsl:variable name="tocentry" 605 select="$autolayout//*[@id=$id]"/> 606 <xsl:variable name="prev-ancestor" 607 select="($tocentry/ancestor::tocentry 608 |$tocentry/ancestor::toc)[last()]"/> 609 <xsl:variable name="prev-sibling" 610 select="$tocentry/preceding-sibling::tocentry[1]"/> 611 612 <xsl:variable name="previd"> 613 <xsl:choose> 614 <xsl:when test="$prev-sibling"> 615 <xsl:value-of select="$prev-sibling/@id"/> 616 </xsl:when> 617 <xsl:when test="$prev-ancestor"> 618 <xsl:value-of select="$prev-ancestor/@id"/> 619 </xsl:when> 620 <xsl:otherwise></xsl:otherwise> 621 </xsl:choose> 622 </xsl:variable> 623 <xsl:value-of select="$previd"/> 624</xsl:template> 625 626<xsl:template name="top.page"> 627 <xsl:param name="page" select="ancestor-or-self::webpage"/> 628 <xsl:variable name="id" select="$page/@id"/> 629 <xsl:variable name="tocentry" 630 select="$autolayout//*[@id=$id]"/> 631 632 <xsl:value-of select="$tocentry/ancestor::toc/@id"/> 633</xsl:template> 634 635<xsl:template name="up.page"> 636 <xsl:param name="page" select="ancestor-or-self::webpage"/> 637 <xsl:variable name="id" select="$page/@id"/> 638 <xsl:variable name="tocentry" 639 select="$autolayout//*[@id=$id]"/> 640 641 <xsl:choose> 642 <xsl:when test="$tocentry/ancestor::tocentry"> 643 <xsl:value-of select="$tocentry/ancestor::tocentry[1]/@id"/> 644 </xsl:when> 645 <xsl:when test="$tocentry/ancestor::toc"> 646 <xsl:value-of select="$tocentry/ancestor::toc[1]/@id"/> 647 </xsl:when> 648 <xsl:otherwise></xsl:otherwise> 649 </xsl:choose> 650</xsl:template> 651 652<xsl:template name="first.page"> 653 <xsl:param name="page" select="ancestor-or-self::webpage"/> 654 <xsl:variable name="id" select="$page/@id"/> 655 <xsl:variable name="tocentry" 656 select="$autolayout//*[@id=$id]"/> 657 658 <xsl:value-of select="$tocentry/preceding-sibling::tocentry[last()]/@id"/> 659</xsl:template> 660 661<xsl:template name="last.page"> 662 <xsl:param name="page" select="ancestor-or-self::webpage"/> 663 <xsl:variable name="id" select="$page/@id"/> 664 <xsl:variable name="tocentry" 665 select="$autolayout//*[@id=$id]"/> 666 667 <xsl:variable name="prev-sibling" 668 select="$tocentry/preceding-sibling::tocentry[1]"/> 669 670 <xsl:value-of select="$tocentry/following-sibling::tocentry[last()]/@id"/> 671</xsl:template> 672 673<xsl:template match="autolayout" mode="collect.targets"> 674 <targetset> 675 <xsl:apply-templates mode="olink.mode"/> 676 </targetset> 677</xsl:template> 678 679<xsl:template match="toc|tocentry|notoc" mode="olink.mode"> 680 <xsl:text> </xsl:text> 681 <xsl:call-template name="tocentry"/> 682 <xsl:apply-templates select="tocentry" mode="olink.mode"/> 683</xsl:template> 684 685 686<xsl:template name="tocentry"> 687 <xsl:choose> 688 <xsl:when test="@href"> 689 <!-- no op --> 690 </xsl:when> 691 <xsl:otherwise> 692 <xsl:if test="not(@page)"> 693 <xsl:message terminate="yes"> 694 <xsl:text>All toc entries must have a page attribute.</xsl:text> 695 </xsl:message> 696 </xsl:if> 697 698 <xsl:variable name="page" select="document(@page,.)"/> 699 700 <xsl:if test="not($page/*[1]/@id)"> 701 <xsl:message terminate="yes"> 702 <xsl:value-of select="@page"/> 703 <xsl:text>: missing ID.</xsl:text> 704 </xsl:message> 705 </xsl:if> 706 707 <xsl:variable name="id" select="$page/*[1]/@id"/> 708 709 <xsl:variable name="filename"> 710 <xsl:choose> 711 <xsl:when test="@filename"> 712 <xsl:value-of select="$filename-prefix"/> 713 <xsl:value-of select="@filename"/> 714 </xsl:when> 715 <xsl:when test="/layout/config[@param='default-filename']"> 716 <xsl:value-of select="$filename-prefix"/> 717 <xsl:value-of select="(/layout/config[@param='default-filename'])[1]/@value"/> 718 </xsl:when> 719 <xsl:otherwise><xsl:value-of select="$filename-prefix"/>index.html</xsl:otherwise> 720 </xsl:choose> 721 </xsl:variable> 722 723 <xsl:variable name="dir" select="@dir"/> 724 725 <xsl:if test="$filename = ''"> 726 <xsl:message terminate="yes"> 727 <xsl:value-of select="@page"/> 728 <xsl:text>: missing filename.</xsl:text> 729 </xsl:message> 730 </xsl:if> 731 732 <!-- 733 <xsl:message> 734 <xsl:value-of select="@page"/> 735 <xsl:text>: </xsl:text> 736 <xsl:if test="$dir != ''"> 737 <xsl:value-of select="$dir"/> 738 </xsl:if> 739 <xsl:value-of select="$filename"/> 740 </xsl:message> 741 --> 742 743 <document> 744 <xsl:attribute name="targetdoc"> 745 <xsl:value-of select="$id"/> 746 </xsl:attribute> 747 <xsl:attribute name="baseuri"> 748 <xsl:value-of select="$filename"/> 749 </xsl:attribute> 750 <xsl:if test="$dir != ''"> 751 <xsl:attribute name="dir"> 752 <xsl:value-of select="$dir"/> 753 </xsl:attribute> 754 </xsl:if> 755 756 <xsl:apply-templates select="$page" mode="olink.mode"/> 757 </document> 758 </xsl:otherwise> 759 </xsl:choose> 760</xsl:template> 761 762<xsl:template match="webpage" mode="olink.mode"> 763 <xsl:call-template name="div"/> 764</xsl:template> 765 766<xsl:template match="webpage" mode="xref-to" > 767 <xsl:param name="referrer"/> 768 <xsl:param name="xrefstyle"/> 769 770 <xsl:apply-templates select="." mode="object.xref.markup"> 771 <xsl:with-param name="purpose" select="'xref'"/> 772 <xsl:with-param name="xrefstyle" select="$xrefstyle"/> 773 <xsl:with-param name="referrer" select="$referrer"/> 774 </xsl:apply-templates> 775 <!-- FIXME: What about "in Chapter X"? --> 776</xsl:template> 777 778<xsl:template match="webpage" mode="title.markup"> 779 <xsl:param name="allow-anchors" select="0"/> 780 <xsl:apply-templates select="head/title" 781 mode="title.markup"> 782 <xsl:with-param name="allow-anchors" select="$allow-anchors"/> 783 </xsl:apply-templates> 784</xsl:template> 785 786<xsl:param name="local.l10n.xml" select="document('')" /> 787<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> 788 <l:l10n language="en"> 789 <l:context name="title"> 790 <l:template name="webpage" text="%t"/> 791 </l:context> 792 <l:context name="xref"> 793 <l:template name="webpage" text="%t"/> 794 </l:context> 795 </l:l10n> 796 <l:l10n language="de"> 797 <l:context name="title"> 798 <l:template name="webpage" text="%t"/> 799 </l:context> 800 <l:context name="xref"> 801 <l:template name="webpage" text="%t"/> 802 </l:context> 803 </l:l10n> 804 <l:l10n language="fr"> 805 <l:context name="title"> 806 <l:template name="webpage" text="%t"/> 807 </l:context> 808 <l:context name="xref"> 809 <l:template name="webpage" text="%t"/> 810 </l:context> 811 </l:l10n> 812</l:i18n> 813</xsl:stylesheet> 814