]> git.stg.codes - stg.git/blob - doc/xslt/website/tabular.xsl
Help book chapter 1 complete
[stg.git] / doc / xslt / website / tabular.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="html doc"
6                 version="1.0">
7
8 <xsl:import href="website-common.xsl"/>
9 <xsl:include href="toc-tabular.xsl"/>
10
11 <xsl:output method="html"
12             indent="no"
13             doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
14             doctype-system="http://www.w3.org/TR/html4/loose.dtd"
15 />
16
17 <xsl:param name="autolayout" select="document($autolayout-file, /*)"/>
18
19 <!-- ==================================================================== -->
20
21 <!-- Netscape gets badly confused if it sees a CSS style... -->
22 <xsl:param name="admon.style" select="''"/>
23 <xsl:param name="admon.graphics" select="1"/>
24 <xsl:param name="admon.graphics.path">graphics/</xsl:param>
25 <xsl:param name="admon.graphics.extension">.gif</xsl:param>
26
27 <xsl:attribute-set name="table.properties">
28   <xsl:attribute name="border">0</xsl:attribute>
29   <xsl:attribute name="cellpadding">0</xsl:attribute>
30   <xsl:attribute name="cellspacing">0</xsl:attribute>
31   <xsl:attribute name="width">100%</xsl:attribute>
32 </xsl:attribute-set>
33
34 <xsl:attribute-set name="table.navigation.cell.properties">
35   <xsl:attribute name="valign">top</xsl:attribute>
36   <xsl:attribute name="align">left</xsl:attribute>
37   <!-- width is set with $navotocwidth -->
38   <xsl:attribute name="bgcolor">
39     <xsl:choose>
40       <xsl:when test="/webpage/config[@param='navbgcolor']/@value[. != '']">
41         <xsl:value-of select="/webpage/config[@param='navbgcolor']/@value"/>
42       </xsl:when>
43       <xsl:when test="$autolayout/autolayout/config[@param='navbgcolor']/@value[. != '']">
44         <xsl:value-of select="$autolayout/autolayout/config[@param='navbgcolor']/@value"/>
45       </xsl:when>
46       <xsl:otherwise>
47         <xsl:value-of select="$navbgcolor"/>
48       </xsl:otherwise>
49     </xsl:choose>
50   </xsl:attribute>
51 </xsl:attribute-set>
52
53 <xsl:attribute-set name="table.body.cell.properties">
54   <xsl:attribute name="valign">top</xsl:attribute>
55   <xsl:attribute name="align">left</xsl:attribute>
56   <!-- width is set with $navobodywidth -->
57   <xsl:attribute name="bgcolor">
58     <xsl:value-of select="$textbgcolor"/>
59   </xsl:attribute>
60 </xsl:attribute-set>
61
62 <xsl:param name="body.columns" select="2"/>
63
64 <!-- ==================================================================== -->
65
66 <xsl:template match="/">
67   <xsl:apply-templates/>
68 </xsl:template>
69
70 <xsl:template name="home.navhead">
71   <xsl:text>Navhead</xsl:text>
72 </xsl:template>
73
74 <xsl:template name="home.navhead.upperright">
75   <xsl:text>Upper-right</xsl:text>
76 </xsl:template>
77
78 <xsl:template name="home.navhead.cell">
79   <td width="50%" valign="middle" align="left">
80     <xsl:call-template name="home.navhead"/>
81   </td>
82 </xsl:template>
83
84 <xsl:template name="home.navhead.upperright.cell">
85   <td width="50%" valign="middle" align="right">
86     <xsl:call-template name="home.navhead.upperright"/>
87   </td>
88 </xsl:template>
89
90 <xsl:template name="home.navhead.separator">
91   <hr/>
92 </xsl:template>
93
94 <xsl:template match="webpage">
95   <xsl:variable name="id">
96     <xsl:call-template name="object.id"/>
97   </xsl:variable>
98
99   <xsl:variable name="relpath">
100     <xsl:call-template name="root-rel-path">
101       <xsl:with-param name="webpage" select="."/>
102     </xsl:call-template>
103   </xsl:variable>
104
105   <xsl:variable name="tocentry" select="$autolayout/autolayout//*[$id=@id]"/>
106   <xsl:variable name="toc" select="($tocentry/ancestor-or-self::toc
107                                    |$autolayout/autolayout/toc[1])[last()]"/>
108
109   <html>
110     <xsl:apply-templates select="head" mode="head.mode"/>
111     <xsl:apply-templates select="config" mode="head.mode"/>
112     <body class="tabular">
113       <xsl:call-template name="body.attributes"/>
114
115       <div class="{name(.)}">
116         <a name="{$id}"/>
117
118         <xsl:call-template name="allpages.banner"/>
119
120         <table xsl:use-attribute-sets="table.properties" border="0">
121           <xsl:if test="$nav.table.summary!=''">
122             <xsl:attribute name="summary">
123               <xsl:value-of select="normalize-space($nav.table.summary)"/>
124             </xsl:attribute>
125           </xsl:if>
126           <tr>
127             <td xsl:use-attribute-sets="table.navigation.cell.properties">
128               <img src="{$relpath}{$table.spacer.image}" alt=" " width="1" height="1"/>
129             </td>
130             <xsl:call-template name="hspacer">
131               <xsl:with-param name="vspacer" select="1"/>
132             </xsl:call-template>
133             <td rowspan="2" xsl:use-attribute-sets="table.body.cell.properties">
134               <xsl:if test="$navbodywidth != ''">
135                 <xsl:attribute name="width">
136                   <xsl:value-of select="$navbodywidth"/>
137                 </xsl:attribute>
138               </xsl:if>
139
140               <xsl:if test="$autolayout/autolayout/toc[1]/@id = $id">
141                 <table border="0" summary="home page extra headers"
142                        cellpadding="0" cellspacing="0" width="100%">
143                   <tr>
144                     <xsl:call-template name="home.navhead.cell"/>
145                     <xsl:call-template name="home.navhead.upperright.cell"/>
146                   </tr>
147                 </table>
148                 <xsl:call-template name="home.navhead.separator"/>
149               </xsl:if>
150
151               <xsl:if test="$autolayout/autolayout/toc[1]/@id != $id
152                             or $suppress.homepage.title = 0">
153                 <xsl:apply-templates select="./head/title" mode="title.mode"/>
154               </xsl:if>
155
156               <xsl:apply-templates select="child::node()[not(self::webpage)]"/>
157               <xsl:call-template name="process.footnotes"/>
158               <br/>
159             </td>
160           </tr>
161           <tr>
162             <td xsl:use-attribute-sets="table.navigation.cell.properties">
163               <xsl:if test="$navtocwidth != ''">
164                 <xsl:attribute name="width">
165                   <xsl:choose>
166                     <xsl:when test="/webpage/config[@param='navtocwidth']/@value[. != '']">
167                       <xsl:value-of select="/webpage/config[@param='navtocwidth']/@value"/>
168                     </xsl:when>
169                     <xsl:when test="$autolayout/autolayout/config[@param='navtocwidth']/@value[. != '']">
170                       <xsl:value-of select="$autolayout/autolayout/config[@param='navtocwidth']/@value"/>
171                     </xsl:when>
172                     <xsl:otherwise>
173                       <xsl:value-of select="$navtocwidth"/>
174                     </xsl:otherwise>
175                   </xsl:choose>
176                 </xsl:attribute>
177               </xsl:if>
178               <xsl:choose>
179                 <xsl:when test="$toc">
180                   <p class="navtoc">
181                     <xsl:apply-templates select="$toc">
182                       <xsl:with-param name="pageid" select="@id"/>
183                     </xsl:apply-templates>
184                   </p>
185                 </xsl:when>
186                 <xsl:otherwise>&#160;</xsl:otherwise>
187               </xsl:choose>
188             </td>
189             <xsl:call-template name="hspacer"/>
190           </tr>
191           <xsl:call-template name="webpage.table.footer"/>
192         </table>
193
194         <xsl:call-template name="webpage.footer"/>
195       </div>
196
197     </body>
198   </html>
199 </xsl:template>
200
201 <xsl:template name="hspacer">
202   <xsl:param name="vspacer" select="0"/>
203   <!-- nop -->
204 </xsl:template>
205
206 <xsl:template match="config[@param='filename']" mode="head.mode">
207 </xsl:template>
208
209 <xsl:template match="webtoc">
210   <!-- nop -->
211 </xsl:template>
212
213 </xsl:stylesheet>