website.xsl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. $Id: website.xsl 6910 2007-06-28 23:23:30Z xmldoc $
  9. ********************************************************************
  10. This file is part of the WebSite distribution.
  11. See ../README or http://nwalsh.com/website/ for copyright
  12. copyright and other information.
  13. ******************************************************************** -->
  14. <!-- ==================================================================== -->
  15. <xsl:include href="website-common.xsl"/>
  16. <xsl:include href="toc.xsl"/>
  17. <xsl:output method="html"
  18. indent="no"/>
  19. <xsl:param name="autolayout" select="document($autolayout-file,/*[1])"/>
  20. <xsl:attribute-set name="body.attributes"/>
  21. <xsl:template name="body.attributes">
  22. <!-- Turn off the template from the stock DocBook XSL -->
  23. </xsl:template>
  24. <!-- ==================================================================== -->
  25. <xsl:template match="webpage">
  26. <xsl:variable name="id">
  27. <xsl:call-template name="object.id"/>
  28. </xsl:variable>
  29. <xsl:variable name="tocentry" select="$autolayout/autolayout//*[$id=@id]"/>
  30. <xsl:variable name="toc" select="$tocentry/ancestor-or-self::toc"/>
  31. <html>
  32. <xsl:apply-templates select="head" mode="head.mode"/>
  33. <xsl:apply-templates select="config" mode="head.mode"/>
  34. <body class="website">
  35. <xsl:call-template name="body.attributes"/>
  36. <div class="{name(.)}">
  37. <a name="{$id}"/>
  38. <xsl:if test="$banner.before.navigation != 0">
  39. <xsl:call-template name="allpages.banner"/>
  40. </xsl:if>
  41. <xsl:if test="$toc">
  42. <div class="navhead">
  43. <xsl:apply-templates select="$toc">
  44. <xsl:with-param name="pageid" select="@id"/>
  45. </xsl:apply-templates>
  46. <xsl:if test="$header.hr != 0"><hr/></xsl:if>
  47. </div>
  48. </xsl:if>
  49. <xsl:if test="$banner.before.navigation = 0">
  50. <xsl:call-template name="allpages.banner"/>
  51. </xsl:if>
  52. <xsl:apply-templates select="./head/title" mode="title.mode"/>
  53. <xsl:apply-templates select="child::node()[not(self::webpage)]"/>
  54. <xsl:call-template name="process.footnotes"/>
  55. <xsl:call-template name="webpage.footer"/>
  56. </div>
  57. </body>
  58. </html>
  59. </xsl:template>
  60. <!-- ==================================================================== -->
  61. <xsl:template match="webtoc">
  62. <xsl:variable name="webpage" select="ancestor::webpage"/>
  63. <xsl:variable name="relpath">
  64. <xsl:call-template name="root-rel-path">
  65. <xsl:with-param name="webpage" select="$webpage"/>
  66. </xsl:call-template>
  67. </xsl:variable>
  68. <xsl:variable name="pageid" select="$webpage/@id"/>
  69. <xsl:variable name="pages"
  70. select="$autolayout//*[$pageid=@id]/tocentry"/>
  71. <xsl:if test="count($pages) > 0">
  72. <ul class="toc">
  73. <xsl:for-each select="$pages">
  74. <li>
  75. <a>
  76. <xsl:attribute name="href">
  77. <xsl:choose>
  78. <xsl:when test="@href">
  79. <xsl:value-of select="@href"/>
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <xsl:value-of select="$relpath"/>
  83. <xsl:value-of select="@dir"/>
  84. <xsl:value-of select="$filename-prefix"/>
  85. <xsl:value-of select="@filename"/>
  86. </xsl:otherwise>
  87. </xsl:choose>
  88. </xsl:attribute>
  89. <xsl:apply-templates select="title"/>
  90. </a>
  91. <xsl:if test="summary">
  92. <xsl:text>--</xsl:text>
  93. <xsl:apply-templates select="summary"/>
  94. </xsl:if>
  95. </li>
  96. </xsl:for-each>
  97. </ul>
  98. </xsl:if>
  99. </xsl:template>
  100. <xsl:template match="toc/summary|tocentry/summary|notoc/summary">
  101. <xsl:apply-templates/>
  102. </xsl:template>
  103. <!-- ==================================================================== -->
  104. </xsl:stylesheet>