Debian Codegraph @

eg/web/podbase.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
18 <xsl:variable name="newswidth">152</xsl:variable>
19
20 <xsl:param name="page" select="0"/>
21 <xsl:param name="basename">default</xsl:param>
22 <xsl:param name="extension">html???</xsl:param>
23 <xsl:param name="baseuri">/eg/web/</xsl:param>
24 <xsl:param name="imageuri">/eg/images/</xsl:param>
25
26
27 <!-- - - - - list - - - - -->
28
29 <xsl:template match="list">
30 <table border="0" cellspacing="3" cellpadding="0">
31 <xsl:apply-templates mode="item"/>
32 </table>
33 </xsl:template>
34
35
36
37 <xsl:template match="item" mode="item">
38 <tr class="cItemText">
39 <td valign="top">
40 <img src="{$imageuri}but.gif"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
41 </td>
42 <td>
43 <xsl:apply-templates select="itemtext"/>
44 </td>
45 </tr>
46 <xsl:if test="*[name()!='itemtext']">
47 <tr>
48 <td>
49 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
50 </td>
51 <td>
52 <xsl:apply-templates select="*[name()!='itemtext']"/>
53 </td>
54 </tr>
55 <tr>
56 <td colspan="2">
57 <img src="{$imageuri}transp.gif" height="4"/>
58 </td>
59 </tr>
60 </xsl:if>
61 </xsl:template>
62
63
64 <xsl:template match="list" mode="item">
65 <tr>
66 <td>
67 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
68 </td>
69 <td>
70 <table border="0" cellspacing="3" cellpadding="0">
71 <xsl:apply-templates mode="item"/>
72 </table>
73 </td>
74 </tr>
75 </xsl:template>
76
77 <xsl:template match="itemtext">
78 <p><xsl:apply-templates/></p>
79 </xsl:template>
80
81
82 <!-- - - - - code - - - - -->
83
84 <!--
85 <xsl:template match="verbatim">
86 <xsl:if test="not(preceding-sibling::node()[1][name()='verbatim'])">
87 <table width="100%" cellspacing="0"><tr>
88 <td width="5%"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
89 <td class="cPodVerbatim" width="90%">
90 <br/><pre>
91 <xsl:apply-templates/>
92 <xsl:apply-templates select="following-sibling::node()[1][name()='verbatim']" mode="verbatim"/>
93 </pre>
94 </td>
95 <td width="5%"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
96 </tr></table>
97 </xsl:if>
98 </xsl:template>
99 -->
100
101 <xsl:template match="verbatim">
102 <xsl:if test="not(preceding-sibling::node()[1][name()='verbatim'])">
103 <pre class="cPodVerbatim">
104 <xsl:apply-templates/>
105 <xsl:apply-templates select="following-sibling::node()[1][name()='verbatim']" mode="verbatim"/>
106 </pre>
107 </xsl:if>
108 </xsl:template>
109
110
111 <xsl:template match="verbatim" mode="verbatim">
112 <xsl:text>
113
114 </xsl:text>
115 <xsl:apply-templates/>
116 <xsl:apply-templates select="following-sibling::node()[1][name()='verbatim']" mode="verbatim"/>
117 </xsl:template>
118
119 <!-- - - - - link - - - - -->
120
121 <xsl:template name="link">
122 <xsl:param name="txt"/>
123 <xsl:param name="uri"/>
124 <xsl:param name="useuri"/>
125 <xsl:choose>
126 <xsl:when test="contains($uri, '.pod')">
127 <xsl:element name="a">
128 <xsl:attribute name="href"><xsl:value-of select="$baseuri"/>pod/doc/<xsl:value-of select="substring-before($uri, '.pod')"/>.htm</xsl:attribute>
129 <xsl:value-of select="$txt"/>
130 </xsl:element>
131 </xsl:when>
132 <xsl:when test="contains($uri, '::')">
133 <xsl:element name="a">
134 <xsl:attribute name="href"><xsl:value-of select="translate($uri, ':', '/')"/></xsl:attribute>
135 <xsl:value-of select="$txt"/>
136 </xsl:element>
137 </xsl:when>
138 <xsl:when test="starts-with($uri, 'http:')">
139 <a href="{$uri}"><xsl:value-of select="$txt"/></a>
140 </xsl:when>
141 <xsl:when test="starts-with($uri, 'ftp:')">
142 <a href="{$uri}"><xsl:value-of select="$txt"/></a>
143 </xsl:when>
144 <xsl:otherwise>
145
146 <xsl:variable name="page">
147 <xsl:apply-templates select="//sect1[title=$uri]" mode="number"/>
148 </xsl:variable>
149
150 <xsl:choose>
151 <xsl:when test="$page!=''">
152 <a href="{$basename}.-page-{$page}-.{$extension}"><xsl:value-of select="$txt"/></a>
153 </xsl:when>
154 <xsl:otherwise>
155 <xsl:variable name="page2">
156 <xsl:apply-templates select="//sect1[sect2/title=$uri]" mode="number"/>
157 </xsl:variable>
158 <xsl:variable name="sect2">
159 <xsl:apply-templates select="//sect2[title=$uri]" mode="number"/>
160 </xsl:variable>
161
162 <xsl:choose>
163 <xsl:when test="$page2!=''">
164 <a href="{$basename}.-page-{$page2}-.{$extension}#sect_{$sect2}"><xsl:value-of select="$txt"/></a>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:choose>
168 <xsl:when test="$useuri">
169 <a href="{$useuri}"><xsl:value-of select="$txt"/></a>
170 </xsl:when>
171 <xsl:otherwise>
172 <xsl:value-of select="$txt"/>
173 </xsl:otherwise>
174 </xsl:choose>
175 </xsl:otherwise>
176 </xsl:choose>
177 </xsl:otherwise>
178 </xsl:choose>
179 </xsl:otherwise>
180 </xsl:choose>
181 </xsl:template>
182
183
184
185 <xsl:template match="xlink">
186 <xsl:choose>
187 <xsl:when test="@uri">
188 <xsl:call-template name="link">
189 <xsl:with-param name="uri" select="@uri"/>
190 <xsl:with-param name="useuri" select="@uri"/>
191 <xsl:with-param name="txt" select="."/>
192 </xsl:call-template>
193 </xsl:when>
194 <xsl:otherwise>
195 <xsl:call-template name="link">
196 <xsl:with-param name="uri" select="."/>
197 <xsl:with-param name="txt" select="."/>
198 </xsl:call-template>
199 </xsl:otherwise>
200 </xsl:choose>
201
202 </xsl:template>
203
204 <xsl:template match="para">
205 <p class="body"><xsl:apply-templates/></p>
206 </xsl:template>
207
208 <!-- - - - - text - - - - -->
209
210 <xsl:template match="emphasis">
211 <i><xsl:value-of select="."/></i>
212 </xsl:template>
213
214 <xsl:template match="strong">
215 <b><xsl:value-of select="."/></b>
216 </xsl:template>
217
218 <xsl:template match="code">
219 <code><xsl:value-of select="."/></code>
220 </xsl:template>
221
222 <xsl:template match="underline">
223 <u><xsl:value-of select="."/></u>
224 </xsl:template>
225
226 <xsl:template match="pic">
227 <p class="cPic">
228 <xsl:element name="img">
229 <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
230 </xsl:element>
231 </p>
232 </xsl:template>
233
234 </xsl:stylesheet>