Debian Codegraph @

eg/web/pod.xsl

raw
1 <?xml version='1.0' encoding="ISO-8859-1" ?>
2
3
4 <!-- the following seems not to work with libxml -->
5
6 <!DOCTYPE stylesheet [
7 <!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
8 <!ENTITY space "<xsl:text> </xsl:text>">
9 <!ENTITY cr "<xsl:text>
10 </xsl:text>">
11 ]>
12
13 <xsl:stylesheet version="1.0"
14 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 xmlns="http://www.w3.org/TR/xhtml1/strict">
16
17 <xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
18
19 <xsl:include href="podbase.xsl"/>
20
21
22 <!-- - - - - Header 1 - - - - -->
23
24 <xsl:template name="header1line">
25 <xsl:param name="txt"></xsl:param>
26 <table width="100%" border="0" cellspacing="0" cellpadding="6">
27 <tr>
28 <td class="cPodH1"><xsl:value-of select="$txt"/></td>
29 </tr>
30 </table>
31 </xsl:template>
32
33
34 <!-- - - - - Get number - - - - -->
35
36 <xsl:template match="sect1" mode="number"><xsl:number/></xsl:template>
37 <xsl:template match="sect2" mode="number"><xsl:number level="any"/></xsl:template>
38
39
40 <!-- - - - - Header Navigation - - - - -->
41
42 <xsl:template name="headernav">
43 <a name="top">
44 <xsl:choose>
45
46 <!-- - - - - Header Navigation - normal page - - - -->
47
48
49 <xsl:when test="not(pod/sect1)">
50 <xsl:variable name="nextpage">
51 <xsl:apply-templates select="following-sibling::sect1[para|verbatim|sect2][position()=1]" mode="number"/>
52 </xsl:variable>
53
54 <xsl:variable name="prevpage">
55 <xsl:apply-templates select="preceding-sibling::sect1[para|verbatim|sect2][position()=1]" mode="number"/>
56 </xsl:variable>
57
58 <table width="100%">
59 <tr>
60 <td align="left" valign="top" width="45%">
61 <xsl:if test="$prevpage &gt; 0">
62 <a href="{$basename}.-page-{$prevpage}-.{$extension}" class="cPodHeaderNavLink">
63 [ &lt;&lt; Prev: <xsl:value-of select="preceding-sibling::sect1[para|verbatim|sect2][position()=1]/title"/> ]
64 </a>
65 </xsl:if>
66 </td>
67 <td align="center" valign="top" width="10%">
68 <a href="{$basename}.{$extension}" class="cPodHeaderNavLink">[ Content ]</a>
69 </td>
70 <td align="right" valign="top" width="45%">
71 <xsl:if test="following-sibling::sect1">
72 <a href="{$basename}.-page-{$nextpage}-.{$extension}" class="cPodHeaderNavLink">
73 [ Next: <xsl:value-of select="following-sibling::sect1[para|verbatim|sect2]/title"/> &gt;&gt; ]
74 </a>
75
76 </xsl:if>
77 </td>
78 </tr>
79 </table>
80 </xsl:when>
81
82 <!-- - - - - Header Navigation - content page - - - -->
83
84 <xsl:otherwise>
85 <xsl:variable name="nextpage">
86 <xsl:apply-templates select="/pod/sect1[para|verbatim|sect2][position()=1]" mode="number"/>
87 </xsl:variable>
88 <table width="100%">
89 <tr>
90 <td align="right">
91 <a href="{$basename}.-page-{$nextpage}-.{$extension}" class="cPodHeaderNavLink">
92 [ Next: <xsl:value-of select="/pod/sect1[para|verbatim|sect2]/title"/> &gt;&gt; ]
93 </a>
94 </td>
95 </tr>
96 </table>
97 </xsl:otherwise>
98 </xsl:choose>
99 </a>
100 </xsl:template>
101
102 <!-- - - - - Root - - - - -->
103
104 <xsl:template match="/">
105 <xsl:choose>
106 <xsl:when test="count(/pod/sect1) = 1">
107 <xsl:apply-templates select="/pod/sect1">
108 <xsl:with-param name="shownav">0</xsl:with-param>
109 </xsl:apply-templates>
110 </xsl:when>
111 <xsl:when test="$page = 0">
112 <xsl:call-template name="header1line">
113 <xsl:with-param name="txt">Content - <xsl:value-of select="/pod/head/title|/pod/sect1/title"/></xsl:with-param>
114 </xsl:call-template>
115 <xsl:call-template name="headernav"/>
116
117 <ul>
118 <xsl:apply-templates select="/pod/sect1" mode="toc_short"/>
119 </ul>
120 <hr/>
121 <ul>
122 <xsl:apply-templates select="/pod/sect1" mode="toc"/>
123 </ul>
124 <hr/>
125 <xsl:call-template name="headernav"/>
126 </xsl:when>
127 <xsl:otherwise>
128 <xsl:apply-templates select="/pod/sect1[position()=$page]"/>
129 </xsl:otherwise>
130 </xsl:choose>
131 </xsl:template>
132
133 <!-- - - - - table of content - short - - - - -->
134
135 <xsl:template match="sect1" mode="toc_short">
136 <xsl:if test="para|verbatim|sect2|list">
137 <li>
138 <xsl:element name="a">
139 <xsl:attribute name="href"><xsl:value-of select="$basename"/>.-page-<xsl:number/>-.<xsl:value-of select="$extension"/></xsl:attribute>
140 <xsl:attribute name="class">cPodH1ContentLink</xsl:attribute>
141 <xsl:value-of select="title"/>
142 </xsl:element>
143 </li>
144 </xsl:if>
145 </xsl:template>
146
147 <!-- - - - - table of content - long - - - - -->
148
149 <xsl:template match="sect1" mode="toc">
150 <xsl:if test="para|verbatim|sect2|list">
151 <xsl:variable name="pagehref">
152 <xsl:value-of select="$basename"/>.-page-<xsl:number/>-.<xsl:value-of select="$extension"/>
153 </xsl:variable>
154
155 <li><a href="{$pagehref}" class="cPodH1ContentLink"><xsl:value-of select="title"/></a></li>
156 <xsl:if test="sect2">
157 <ul>
158 <xsl:apply-templates select="sect2" mode="toc1">
159 <xsl:with-param name="pagehref" select="$pagehref"/>
160 </xsl:apply-templates>
161 </ul>
162 </xsl:if>
163 </xsl:if>
164 </xsl:template>
165
166 <xsl:template match="sect2" mode="toc1">
167 <xsl:param name="pagehref"></xsl:param>
168 <li>
169 <xsl:element name="a">
170 <xsl:attribute name="href"><xsl:value-of select="$pagehref"/>#sect_<xsl:number level="any"/></xsl:attribute>
171 <xsl:attribute name="class">cPodH2ContentLink</xsl:attribute>
172 <xsl:value-of select="title"/>
173 </xsl:element>
174 </li>
175 </xsl:template>
176
177 <!-- ********** content - sect1 ********** -->
178
179 <xsl:template match="sect1">
180 <xsl:param name="shownav">1</xsl:param>
181
182 <xsl:call-template name="header1line">
183 <xsl:with-param name="txt" select="title"/>
184 </xsl:call-template>
185
186 <xsl:if test="$shownav = 1">
187 <xsl:call-template name="headernav"/>
188 </xsl:if>
189
190 <xsl:if test="para|verbatim|sect2|list">
191 <xsl:if test="sect2">
192 <ul>
193 <xsl:apply-templates select="sect2" mode="toc1"/>
194 </ul><hr/>
195 </xsl:if>
196 <xsl:apply-templates select="*[name()!='title']"/>
197 </xsl:if>
198
199 <xsl:if test="$shownav = 1">
200 <hr/>
201 <xsl:call-template name="headernav"/>
202 </xsl:if>
203
204 </xsl:template>
205
206
207 <!-- ********** content - sect2 ********** -->
208
209 <xsl:template match="sect2">
210 <br/>
211 <xsl:element name="a">
212 <xsl:attribute name="name">sect_<xsl:number level="any"/></xsl:attribute>
213 <table width="100%" border="0" cellspacing="0" cellpadding="6">
214 <tr class="cPodH2">
215 <td><xsl:value-of select="title"/></td>
216 <td align="right"><a href="#top" class="cTopLink">top</a></td>
217 </tr>
218 </table>
219 </xsl:element>
220 <xsl:apply-templates select="*[name()!='title']"/>
221 </xsl:template>
222
223
224
225 </xsl:stylesheet>