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