/[gentoo]/xml/htdocs/xsl/guide.xsl
Gentoo

Contents of /xml/htdocs/xsl/guide.xsl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.244 - (show annotations) (download) (as text)
Fri Jun 26 16:31:39 2009 UTC (5 years, 5 months ago) by neysx
Branch: MAIN
Changes since 1.243: +2 -0 lines
File MIME type: application/xml
Do not display header on <pre> tags on archives.g.o

1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
3 xmlns:exslt="http://exslt.org/common"
4 xmlns:func="http://exslt.org/functions"
5 xmlns:dyn="http://exslt.org/dynamic"
6 xmlns:str="http://exslt.org/strings"
7
8 xmlns:feed="http://www.w3.org/2005/Atom"
9
10 xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
11 exclude-result-prefixes="opensearch feed"
12
13 extension-element-prefixes="exslt func dyn str" >
14
15 <xsl:output encoding="UTF-8"
16 method="html"
17 indent="yes"
18 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
19 doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
20
21 <!-- Include external stylesheets -->
22 <xsl:include href="/xsl/content.xsl" />
23 <xsl:include href="/xsl/handbook.xsl" />
24 <xsl:include href="/xsl/util.xsl"/>
25 <xsl:include href="/xsl/inserts.xsl" />
26
27 <xsl:include href="/xsl/mail.xsl" />
28
29 <xsl:include href="/xsl/menu.xsl" />
30
31 <xsl:include href="/xsl/devmap.xsl" />
32
33 <xsl:include href="/xsl/doc-struct.xsl" />
34
35 <xsl:include href="/xsl/ads.xsl" />
36
37 <!-- When using <pre>, whitespaces should be preserved -->
38 <xsl:preserve-space elements="pre script"/>
39
40 <!-- Global definition of style parameter -->
41 <xsl:param name="style">0</xsl:param>
42 <xsl:param name="newsitemcount">9</xsl:param>
43
44 <!-- Category from metadoc -->
45 <xsl:param name="catid">0</xsl:param>
46
47 <!-- Nick to select on dev map -->
48 <xsl:param name="dev"/>
49
50 <!-- Where is this xsl being run? -->
51 <xsl:param name="httphost">www</xsl:param>
52
53 <xsl:variable name="basename">
54 <xsl:call-template name="filename">
55 <xsl:with-param name="path" select="$link"/>
56 </xsl:call-template>
57 </xsl:variable>
58
59 <!-- img tag -->
60 <xsl:template match="img">
61 <img src="{@src}" alt=""/>
62 </xsl:template>
63
64 <xsl:template name="show-disclaimer">
65 <!-- Disclaimer stuff -->
66 <xsl:if test="/*[1][@disclaimer] or /*[1][@redirect]">
67 <table class="ncontent" align="center" width="90%" border="2px" cellspacing="0" cellpadding="4px">
68 <xsl:if test="/*[1]/@disclaimer='obsolete'">
69 <xsl:attribute name="style">margin-top:40px;margin-bottom:30px</xsl:attribute>
70 </xsl:if>
71 <tr>
72 <td bgcolor="#ddddff">
73 <p class="note">
74 <xsl:if test="/*[1][@disclaimer]">
75 <xsl:if test="/*[1]/@disclaimer='obsolete'">
76 <xsl:attribute name="style">font-size:1.3em</xsl:attribute>
77 </xsl:if>
78 <b><xsl:value-of select="func:gettext('disclaimer')"/>: </b>
79 <xsl:apply-templates select="func:gettext(/*[1]/@disclaimer)"/>
80 </xsl:if>
81 <xsl:if test="/*[1][@redirect]">
82 <xsl:apply-templates select="func:gettext('redirect')">
83 <xsl:with-param name="paramlink" select="/*[1]/@redirect"/>
84 </xsl:apply-templates>
85 </xsl:if>
86 </p>
87 </td>
88 </tr>
89 </table>
90 </xsl:if>
91 </xsl:template>
92
93
94 <!-- Content of /guide -->
95 <xsl:template name="guidecontent">
96 <xsl:if test="$style != 'printable'">
97 <br />
98 </xsl:if>
99
100 <h1>
101 <xsl:choose>
102 <xsl:when test="/guide/subtitle"><xsl:value-of select="/guide/title"/>: <xsl:value-of select="/guide/subtitle"/></xsl:when>
103 <xsl:otherwise><xsl:value-of select="/guide/title"/></xsl:otherwise>
104 </xsl:choose>
105 </h1>
106
107 <xsl:choose>
108 <xsl:when test="$style = 'printable'">
109 <xsl:apply-templates select="author" />
110 <br/>
111 <i><xsl:call-template name="contentdate"/></i>
112 <xsl:variable name="outdated">
113 <xsl:call-template name="outdated-translation"/>
114 </xsl:variable>
115 <xsl:if test="string-length($outdated) &gt; 1">
116 <br/><b><i><xsl:copy-of select="$outdated"/></i></b>
117 </xsl:if>
118 </xsl:when>
119 <xsl:otherwise>
120 <xsl:if test="count(exslt:node-set($doc-struct)//chapter)&gt;1">
121 <form name="contents" action="http://www.gentoo.org">
122 <b><xsl:value-of select="func:gettext('Content')"/></b>:
123 <select name="url" size="1" OnChange="location.href=form.url.options[form.url.selectedIndex].value" style="font-family:sans-serif,Arial,Helvetica">
124 <xsl:for-each select="exslt:node-set($doc-struct)//chapter">
125 <option value="#doc_chap{position()}"><xsl:number/>. <xsl:value-of select="@title"/></option>
126 </xsl:for-each>
127 </select>
128 </form>
129 </xsl:if>
130 </xsl:otherwise>
131 </xsl:choose>
132
133 <xsl:choose>
134 <xsl:when test="/guide">
135 <xsl:apply-templates select="faqindex|chapter"/>
136 </xsl:when>
137 <xsl:when test="/sections">
138 <xsl:apply-templates select="/sections/section"/>
139 </xsl:when>
140 </xsl:choose>
141 <br/>
142 <xsl:if test="/guide/license">
143 <xsl:apply-templates select="license" />
144 </xsl:if>
145 <br/>
146 </xsl:template>
147
148 <!-- Layout for documentation -->
149 <xsl:template name="doclayout">
150 <xsl:param name="chapnum"/>
151 <xsl:param name="partnum"/>
152 <html>
153 <xsl:if test="string-length($glang)>1">
154 <xsl:attribute name="lang"><xsl:value-of select="translate($glang,'_','-')"/></xsl:attribute>
155 </xsl:if>
156 <head>
157 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
158 <link title="new" rel="stylesheet" href="{concat($ROOT,'css/main.css')}" type="text/css"/>
159 <link REL="shortcut icon" HREF="{concat($ROOT,'favicon.ico')}" TYPE="image/x-icon"/>
160
161 <!-- Support for opensearch -->
162 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/www-gentoo-org.xml" title="Gentoo Website"/>
163 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/forums-gentoo-org.xml" title="Gentoo Forums"/>
164 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/bugs-gentoo-org.xml" title="Gentoo Bugzilla"/>
165 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/packages-gentoo-org.xml" title="Gentoo Packages"/>
166 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/archives-gentoo-org.xml" title="Gentoo List Archives"/>
167
168 <xsl:if test="//glsaindex or //glsa-latest">
169 <link rel="alternate" type="application/rss+xml">
170 <xsl:attribute name="href">
171 <xsl:text>/rdf/en/glsa-index.rdf</xsl:text>
172 <xsl:if test="//glsa-latest">
173 <xsl:text>?num=9</xsl:text>
174 </xsl:if>
175 </xsl:attribute>
176 </link>
177 </xsl:if>
178
179 <xsl:if test="/*[1][@redirect]">
180 <!-- HTML refresh in case redirect is not supported -->
181 <meta http-equiv="Refresh">
182 <xsl:attribute name="content"><xsl:value-of select="concat('15; URL=', /*[1]/@redirect)"/></xsl:attribute>
183 </meta>
184 <xsl:message>
185 <!-- Redirect using http header when supported -->
186 <xsl:value-of select="concat('%%GORG%%Redirect=',/*[1]/@redirect)"/>
187 </xsl:message>
188 </xsl:if>
189
190 <title>
191 <xsl:choose>
192 <xsl:when test="/guide/@type='project'">Gentoo Linux Projects</xsl:when>
193 <xsl:when test="/guide/@type='newsletter'">Gentoo Linux Newsletter</xsl:when>
194 <xsl:when test="/sections">Gentoo Linux Handbook Page</xsl:when>
195 <xsl:otherwise><xsl:value-of select="func:gettext('GLinuxDoc')"/></xsl:otherwise>
196 </xsl:choose>
197 --
198 <xsl:choose>
199 <xsl:when test="subtitle"><xsl:if test="/guide/@type!='newsletter'"><xsl:value-of select="title"/>:</xsl:if> <xsl:value-of select="subtitle"/></xsl:when>
200 <xsl:otherwise><xsl:value-of select="title"/></xsl:otherwise>
201 </xsl:choose>
202 </title>
203
204 </head>
205 <xsl:choose>
206 <xsl:when test="$style = 'printable'">
207 <!-- Insert the node-specific content -->
208 <body bgcolor="#ffffff">
209 <!-- Test for RTL languages -->
210 <xsl:if test="$RTL='Y'">
211 <xsl:attribute name="dir">RTL</xsl:attribute>
212 </xsl:if>
213
214 <xsl:call-template name="show-disclaimer"/>
215 <xsl:call-template name="content">
216 <xsl:with-param name="chapnum" select="$chapnum"/>
217 <xsl:with-param name="partnum" select="$partnum"/>
218 </xsl:call-template>
219 </body>
220 </xsl:when>
221 <xsl:otherwise>
222 <body style="margin:0px;" bgcolor="#ffffff">
223 <table width="100%" border="0" cellspacing="0" cellpadding="0">
224 <tr>
225 <td valign="top" height="125" bgcolor="#45347b">
226 <a href="/"><img border="0" src="{concat($ROOT,'images/gtop-www.jpg')}" alt="Gentoo Logo"/></a>
227 </td>
228 </tr>
229 <tr>
230 <td valign="top" align="right" colspan="1" bgcolor="#ffffff">
231 <table border="0" cellspacing="0" cellpadding="0" width="100%">
232 <tr>
233 <td width="99%" class="content" valign="top">
234 <!-- Test for RTL languages -->
235 <xsl:choose>
236 <xsl:when test="$RTL='Y'">
237 <xsl:attribute name="dir">RTL</xsl:attribute>
238 </xsl:when>
239 <xsl:otherwise>
240 <xsl:attribute name="align">left</xsl:attribute>
241 </xsl:otherwise>
242 </xsl:choose>
243 <!-- Insert the node-specific content -->
244 <xsl:call-template name="show-disclaimer"/>
245 <xsl:call-template name="content">
246 <xsl:with-param name="chapnum" select="$chapnum"/>
247 <xsl:with-param name="partnum" select="$partnum"/>
248 </xsl:call-template>
249 </td>
250 <td width="1%" bgcolor="#dddaec" valign="top">
251 <xsl:call-template name="rhcol"/>
252 </td>
253 </tr>
254 </table>
255 </td>
256 </tr>
257 <tr>
258 <td colspan="2" align="right" class="infohead">
259 <xsl:call-template name="copyright-footer"/>
260 </td>
261 </tr>
262 </table>
263
264 </body>
265 </xsl:otherwise>
266 </xsl:choose>
267 </html>
268 </xsl:template>
269
270
271 <xsl:template match="/included|/gleps|/devaway|/uris|/inserts|/glsa-index|opensearch:OpenSearchDescription">
272 <xsl:message>
273 <xsl:value-of select="concat('%%GORG%%Redirect=',$link,'?passthru=1')"/>
274 </xsl:message>
275 </xsl:template>
276
277 <!-- Guide template -->
278 <xsl:template match="/guide">
279 <xsl:call-template name="doclayout" />
280 </xsl:template>
281
282 <!-- {Mainpage, News, Email} template -->
283 <xsl:template match="/mainpage | /news">
284 <html>
285 <xsl:if test="string-length($glang)>1">
286 <xsl:attribute name="lang"><xsl:value-of select="translate($glang,'_','-')"/></xsl:attribute>
287 </xsl:if>
288 <head>
289 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
290 <link title="new" rel="stylesheet" href="{concat($ROOT,'css/main.css')}" type="text/css"/>
291 <link REL="shortcut icon" HREF="{concat($ROOT,'favicon.ico')}" TYPE="image/x-icon"/>
292
293 <!-- Support for opensearch -->
294 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/www-gentoo-org.xml" title="Gentoo Website"/>
295 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/forums-gentoo-org.xml" title="Gentoo Forums"/>
296 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/bugs-gentoo-org.xml" title="Gentoo Bugzilla"/>
297 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/packages-gentoo-org.xml" title="Gentoo Packages"/>
298 <link rel="search" type="application/opensearchdescription+xml" href="http://www.gentoo.org/search/archives-gentoo-org.xml" title="Gentoo List Archives"/>
299
300 <xsl:if test="/*[1][@redirect]">
301 <!-- Immediate HTML refresh in case redirect is not supported -->
302 <meta http-equiv="Refresh">
303 <xsl:attribute name="content"><xsl:value-of select="concat('0; URL=', /*[1]/@redirect)"/></xsl:attribute>
304 </meta>
305 <xsl:message>
306 <!-- Redirect using http header when supported -->
307 <xsl:value-of select="concat('%%GORG%%Redirect=',/*[1]/@redirect)"/>
308 </xsl:message>
309 </xsl:if>
310
311 <xsl:if test="/mainpage/newsitems">
312 <link rel="alternate" type="application/rss+xml" title="Gentoo Linux News RDF" href="http://www.gentoo.org/rdf/en/gentoo-news.rdf" />
313 </xsl:if>
314 <xsl:choose>
315 <xsl:when test="/mainpage | /news">
316 <title>
317 Gentoo Linux -- <xsl:value-of select="title"/>
318 </title>
319 </xsl:when>
320 </xsl:choose>
321
322 <xsl:if test="/mainpage/devmap">
323 <xsl:variable name="gkey" select="document('/gmaps-key.xml')/gkey"/>
324 <script src="{concat('http://maps.google.com/maps?file=api&amp;v=2&amp;key=', $gkey)}" type="text/javascript"></script>
325
326 <xsl:variable name="selectdev">
327 <xsl:choose>
328 <xsl:when test="string-length(translate($dev,'qwertyuioplkjhgfdsazxcvbnm-_0987654321QWERTYUIOPLKJHGFDSAZXCVBNM',''))=0 and string-length($dev)&lt;24">
329 <xsl:value-of select="translate($dev,'QWERTYUIOPLKJHGFDSAZXCVBNM','qwertyuioplkjhgfdsazxcvbnm')"/>
330 </xsl:when>
331 <xsl:otherwise>NotADev</xsl:otherwise>
332 </xsl:choose>
333 </xsl:variable>
334
335 <xsl:variable name="newscript" select="str:replace($devmap-js, 'X-PLACEHOLDER', string($selectdev))"/>
336 <script type="text/javascript">//<xsl:comment><xsl:value-of select="$newscript"/>//</xsl:comment></script>
337 </xsl:if>
338
339 </head>
340 <body style="margin:0px;" bgcolor="#000000">
341
342 <xsl:if test="/mainpage/devmap">
343 <xsl:attribute name="onload">load()</xsl:attribute>
344 <xsl:attribute name="onunload">GUnload()</xsl:attribute>
345 </xsl:if>
346
347 <table border="0" width="100%" cellspacing="0" cellpadding="0">
348 <xsl:variable name="www"><xsl:if test="$httphost!='www'">http://www.gentoo.org</xsl:if></xsl:variable>
349 <tr>
350 <td valign="top" height="125" width="1%" bgcolor="#45347b">
351 <a href="{concat($www,'/')}"><img border="0" src="{concat($ROOT,'images/gtop-www.jpg')}" alt="Gentoo Logo"/></a>
352 </td>
353 <!-- Top bar menu -->
354 <td valign="bottom" align="left" bgcolor="#000000" colspan="2" lang="en">
355 <p class="menu">
356 <xsl:apply-templates select="document('/xsl/menu.xml')//group[@top='Y']"/>
357 </p>
358 </td>
359 </tr>
360 <tr>
361 <td valign="top" align="right" width="1%" bgcolor="#dddaec">
362 <table width="100%" cellspacing="0" cellpadding="0" border="0">
363 <tr>
364 <td height="1%" valign="top" align="right">
365 <img src="{concat($ROOT,'images/gridtest.gif')}" alt="Gentoo Spaceship"/>
366 </td>
367 </tr>
368 <tr>
369 <td height="99%" valign="top" align="left">
370 <!--info goes here-->
371 <table cellspacing="0" cellpadding="5" border="0">
372 <tr>
373 <td valign="top" class="leftmenu" lang="en">
374 <p class="altmenu">
375 <xsl:apply-templates select="document('/xsl/menu.xml')//group[@top='N']"/>
376 </p>
377 <br/><br/>
378 </td>
379 </tr>
380 </table>
381 </td>
382 </tr>
383 </table>
384 </td>
385 <!-- Content below top menu and between left menu and ads -->
386 <td valign="top" bgcolor="#ffffff">
387 <!-- Test for RTL languages -->
388 <xsl:if test="$RTL='Y'">
389 <xsl:attribute name="dir">RTL</xsl:attribute>
390 </xsl:if>
391 <xsl:choose>
392 <xsl:when test="/mainpage/newsitems">
393 <p class="news">
394 <img class="newsicon" src="{concat($ROOT,'images/gentoo-new.gif')}" alt="Gentoo logo"/>
395 <span class="newsitem" lang="en">We produce Gentoo Linux, a special flavor of Linux that
396 can be automatically optimized and customized for just
397 about any application or need. Extreme performance,
398 configurability and a top-notch user and developer
399 community are all hallmarks of the Gentoo experience.
400 To learn more, read our <b><a href="/main/en/about.xml">about
401 page</a></b>.</span>
402 </p>
403
404 <xsl:variable name="GLSAs" select="document('/dyn/glsa-index2.xml')"/>
405 <xsl:variable name="new-packages" select="document('/dyn/new-packages.xml')"/>
406 <xsl:variable name="planet" select="document('/dyn/planet.xml')"/>
407
408 <xsl:variable name="all-news" xmlns="">
409 <news>
410 <!-- News from news-index.xml, i.e. list of files under /news/ -->
411 <xsl:for-each select="document('/dyn/news-index.xml')/uris/uri[position()&lt;=$newsitemcount]/text()">
412 <xsl:variable name="tlink" select="."/>
413 <newsitem date="{document($tlink)/news/date}" link="{$tlink}"/>
414 </xsl:for-each>
415
416 <!-- GLSAs from my own glsa-index.xml, i.e. not Gentoo's -->
417 <xsl:for-each select="$GLSAs//glsa">
418 <!-- <xsl:sort select="date" order="descending"/> Can't sort on English dates, they should be sorted in the source file -->
419 <xsl:if test="position() &lt;=$newsitemcount">
420 <!-- convert bloody dates like 'July 29, 2006: 02' to YYYY-MM-DD -->
421 <xsl:variable name="yydate">
422 <xsl:choose>
423 <xsl:when test="string-length(substring(date,1,10))=10 and substring(date,5,1)='-' and substring(date,8,1)='-' and contains('|01|02|03|04|05|06|07|08|09|10|11|12|',concat('|',substring(date,6,2),'|'))">
424 <xsl:value-of select="substring(date,1,10)"/>
425 </xsl:when>
426 <xsl:otherwise>
427 <xsl:value-of select="substring(substring-after(substring-after(date,' '),' '),1,4)"/>
428 <xsl:text>-</xsl:text>
429 <xsl:choose>
430 <xsl:when test="substring-before(date,' ')='January'">01</xsl:when>
431 <xsl:when test="substring-before(date,' ')='February'">02</xsl:when>
432 <xsl:when test="substring-before(date,' ')='March'">03</xsl:when>
433 <xsl:when test="substring-before(date,' ')='April'">04</xsl:when>
434 <xsl:when test="substring-before(date,' ')='May'">05</xsl:when>
435 <xsl:when test="substring-before(date,' ')='June'">06</xsl:when>
436 <xsl:when test="substring-before(date,' ')='July'">07</xsl:when>
437 <xsl:when test="substring-before(date,' ')='August'">08</xsl:when>
438 <xsl:when test="substring-before(date,' ')='September'">09</xsl:when>
439 <xsl:when test="substring-before(date,' ')='October'">10</xsl:when>
440 <xsl:when test="substring-before(date,' ')='November'">11</xsl:when>
441 <xsl:when test="substring-before(date,' ')='December'">12</xsl:when>
442 <xsl:otherwise>00</xsl:otherwise>
443 </xsl:choose>
444 <xsl:text>-</xsl:text>
445 <xsl:value-of select="substring-before(substring-after(date,' '),',')"/>
446 </xsl:otherwise>
447 </xsl:choose>
448 </xsl:variable>
449 <xsl:if test="func:is-date($yydate)='YES'">
450 <newsitem date="{$yydate}" glsaid="{@id}"/>
451 </xsl:if>
452 </xsl:if>
453 </xsl:for-each>
454
455 <!-- New packages from packages.gentoo.org/feed/newpackage-->
456 <xsl:if test="$new-packages//feed:entry/feed:updated">
457 <newsitem date="{substring($new-packages//feed:entry[1]/feed:updated,1,10)}" package="{generate-id($new-packages//feed:entry[1])}"/>
458 </xsl:if>
459
460 <!-- Latest posts on planet.g.o from planet.gentoo.org/rss20.xml -->
461 <xsl:for-each select="$planet/rss/channel/item">
462 <xsl:variable name="pubDate" select="substring(pubDate,1,16)"/>
463 <xsl:if test="count(preceding-sibling::item[substring(pubDate,1,16)=$pubDate])=0">
464 <xsl:variable name="postdate">
465 <xsl:value-of select="substring(substring-after(substring-after(substring-after(pubDate,' '),' '), ' '),1,4)"/>
466 <xsl:choose>
467 <xsl:when test="'Jan' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-01-</xsl:when>
468 <xsl:when test="'Feb' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-02-</xsl:when>
469 <xsl:when test="'Mar' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-03-</xsl:when>
470 <xsl:when test="'Apr' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-04-</xsl:when>
471 <xsl:when test="'May' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-05-</xsl:when>
472 <xsl:when test="'Jun' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-06-</xsl:when>
473 <xsl:when test="'Jul' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-07-</xsl:when>
474 <xsl:when test="'Aug' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-08-</xsl:when>
475 <xsl:when test="'Sep' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-09-</xsl:when>
476 <xsl:when test="'Oct' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-10-</xsl:when>
477 <xsl:when test="'Nov' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-11-</xsl:when>
478 <xsl:when test="'Dec' = substring(substring-after(substring-after(pubDate,' '),' '),1,3)">-12-</xsl:when>
479 <xsl:otherwise>-00-</xsl:otherwise>
480 </xsl:choose>
481 <xsl:value-of select="format-number(number(substring-before(substring-after(pubDate,' '),' ')),'00')"/>
482 </xsl:variable>
483 <xsl:if test="$planet//item[substring(pubDate,1,16)=$pubDate and not(contains(link, 'http://www.gentoo.org/news'))]">
484 <newsitem date="{$postdate}" planet="{$pubDate}"/>
485 </xsl:if>
486 </xsl:if>
487 </xsl:for-each>
488 </news>
489 </xsl:variable>
490
491 <xsl:variable name="all-news1" xmlns="">
492 <news>
493 <xsl:for-each select="exslt:node-set($all-news)/news/newsitem">
494 <xsl:sort select="@date" order="descending"/>
495 <xsl:copy-of select="."/>
496 </xsl:for-each>
497 </news>
498 </xsl:variable>
499
500 <xsl:variable name="all-news0" xmlns="">
501 <news>
502 <xsl:for-each select="exslt:node-set($all-news1)/news/newsitem">
503 <xsl:choose>
504 <xsl:when test="@link or @package or @glsaid">
505 <xsl:copy-of select="."/>
506 </xsl:when>
507
508 <xsl:when test="@planet">
509 <xsl:if test="not(preceding-sibling::newsitem[1]/@planet)">
510 <!-- group consecutive blog days into a single item -->
511 <newsitem date="{@date}" blog='1'>
512 <xsl:copy-of select="."/>
513 <xsl:apply-templates select="following-sibling::*[position()=1 and @planet]" mode="moreblogs"/>
514 </newsitem>
515 </xsl:if>
516 </xsl:when>
517 </xsl:choose>
518 </xsl:for-each>
519 </news>
520 </xsl:variable>
521
522 <!-- Display news items -->
523
524 <xsl:for-each select="exslt:node-set($all-news0)/news/newsitem">
525 <xsl:sort select="@date" order="descending"/>
526
527 <!-- Build a newsitem that can be passed to the template that displays a newsitem -->
528 <xsl:variable name="thenews" xmlns="">
529 <news>
530 <xsl:choose>
531 <xsl:when test="@link">
532 <xsl:variable name="newsitem" select="document(@link)/news"/>
533 <xsl:attribute name="category"><xsl:value-of select="$newsitem/@category"/></xsl:attribute>
534 <title><xsl:copy-of select="$newsitem/title"/></title>
535 <date><xsl:value-of select="@date"/></date>
536 <!--
537 <xsl:variable name="poster">
538 <xsl:call-template name="smart-mail">
539 <xsl:with-param name="mail" select="$newsitem/poster"/>
540 </xsl:call-template>
541 </xsl:variable>
542 <poster><xsl:copy-of select="$poster"/></poster>
543 -->
544 <poster><xsl:value-of select="$newsitem/poster"/></poster>
545 <xsl:choose>
546 <xsl:when test="$newsitem/summary"><summary><xsl:copy-of select="$newsitem/summary"/></summary></xsl:when>
547 <xsl:otherwise><body><xsl:copy-of select="$newsitem/body"/></body></xsl:otherwise>
548 </xsl:choose>
549 </xsl:when>
550
551 <xsl:when test="@blog">
552 <xsl:attribute name="category">planet</xsl:attribute>
553 <title>Blog posts</title>
554 <date><xsl:value-of select="@date"/></date>
555 <xsl:if test="@date != ./newsitem[position()=last()]/@date">
556 <until><xsl:value-of select="./newsitem[position()=last()]/@date"/></until>
557 </xsl:if>
558 <poster>planet.gentoo.org</poster>
559 <body><table>
560 <xsl:variable name="blogentries" xmlns="">
561 <xsl:for-each select="./newsitem">
562 <xsl:variable name="pubDate" select="@planet"/>
563 <xsl:for-each select="$planet//item[substring(pubDate,1,16)=$pubDate and not(contains(link, 'http://www.gentoo.org/news'))]">
564 <tr>
565 <xsl:choose>
566 <xsl:when test="contains(title,': ')">
567 <ti><xsl:value-of select="substring-before(title,': ')"/></ti>
568 <ti><uri link="{link}"><xsl:value-of select="substring-after(title,': ')"/></uri></ti>
569 </xsl:when>
570 <xsl:otherwise>
571 <ti><xsl:value-of select="title"/></ti>
572 <ti><uri link="{link}">. . .</uri></ti>
573 </xsl:otherwise>
574 </xsl:choose>
575 </tr>
576 </xsl:for-each>
577 </xsl:for-each>
578 </xsl:variable>
579
580 <xsl:variable name="sortedblogentries" xmlns="">
581 <xsl:for-each select="exslt:node-set($blogentries)/tr">
582 <xsl:sort select="ti[1]"/>
583 <tr>
584 <xsl:copy-of select="ti"/>
585 </tr>
586 </xsl:for-each>
587 </xsl:variable>
588
589 <xsl:for-each select="exslt:node-set($sortedblogentries)/tr">
590 <xsl:variable name="blogposter" select="ti[1]"/>
591 <tr>
592 <xsl:choose>
593 <xsl:when test="preceding-sibling::tr[1]/ti[1]/text()=$blogposter">
594 </xsl:when>
595 <xsl:when test="following-sibling::tr[1]/ti[1]/text()=$blogposter">
596 <ti rowspan="{1+count(following-sibling::tr[ti[1]/text()=$blogposter])}"><xsl:value-of select="ti[1]"/></ti>
597 </xsl:when>
598 <xsl:otherwise>
599 <xsl:copy-of select="ti[1]"/>
600 </xsl:otherwise>
601 </xsl:choose>
602 <xsl:copy-of select="ti[2]"/>
603 </tr>
604 </xsl:for-each>
605 </table></body>
606 </xsl:when>
607
608 <xsl:when test="@glsaid">
609 <xsl:attribute name="category">plans</xsl:attribute>
610 <xsl:variable name="glsaid" select="@glsaid"/>
611 <title>GLSA <xsl:value-of select="$glsaid"/>: <xsl:value-of select="$GLSAs//glsa[@id=$glsaid]/package[1]"/><xsl:if test="count($GLSAs//glsa[@id=$glsaid]/package)>1"> (and <xsl:value-of select="count($GLSAs//glsa[@id=$glsaid]/package)-1"/> more package<xsl:if test="count($GLSAs//glsa[@id=$glsaid]/package)>2">s</xsl:if>)</xsl:if></title>
612 <date><xsl:value-of select="@date"/></date>
613 <poster>Gentoo Security Team</poster>
614 <body><p><b><xsl:value-of select="$GLSAs//glsa[@id=$glsaid]/title"/></b><br/><xsl:value-of select="$GLSAs//glsa[@id=$glsaid]/synopsis/text()"/><br/>See <uri link="{$GLSAs//glsa[@id=$glsaid]/link}">GLSA <xsl:value-of select="$glsaid"/></uri> for more information.</p></body>
615 </xsl:when>
616
617 <xsl:when test="@package">
618 <xsl:attribute name="category">moo</xsl:attribute>
619 <xsl:variable name="pid" select="@package"/>
620 <title>New Packages</title>
621 <date><xsl:value-of select="@date"/></date>
622 <poster>packages.gentoo.org</poster>
623 <body><table>
624 <xsl:for-each select="$new-packages//feed:entry">
625 <tr>
626 <ti><uri link="{feed:id}"><xsl:value-of select="feed:title/feed:div/feed:span[1]"/></uri></ti>
627 <ti><xsl:value-of select="feed:title/feed:div/feed:span[2]"/></ti>
628 </tr>
629 </xsl:for-each>
630 </table></body>
631 </xsl:when>
632 </xsl:choose>
633 </news>
634 </xsl:variable>
635
636 <xsl:call-template name="newscontent">
637 <xsl:with-param name="thenews" select="exslt:node-set($thenews)/news"/>
638 <xsl:with-param name="summary" select="'yes'"/>
639 <xsl:with-param name="link" select="@link"/>
640 </xsl:call-template>
641 </xsl:for-each>
642
643
644
645
646 <!-- Links to older news below news items -->
647 <div class="news">
648 <p class="newshead" lang="en">
649 <b>Older News</b>
650 </p>
651 <ul>
652 <xsl:for-each select="document('/dyn/news-index.xml')/uris/uri[position()&gt;$newsitemcount][position()&lt;20]/text()">
653 <xsl:variable name="newsuri" select="."/>
654 <li><b><a class="altlink" href="{$newsuri}"><xsl:value-of select="document(.)/news/title"/></a></b></li>
655 </xsl:for-each>
656 </ul>
657 </div>
658 </xsl:when>
659
660 <xsl:when test="/news">
661 <xsl:call-template name="newscontent">
662 <xsl:with-param name="thenews" select="/news"/>
663 <xsl:with-param name="summary" select="no"/>
664 </xsl:call-template>
665 </xsl:when>
666 </xsl:choose>
667 <br/>
668 <table border="0" class="content">
669 <tr>
670 <td>
671 <xsl:apply-templates select="chapter|devmap"/>
672 </td>
673 </tr>
674 </table>
675 <br/>
676 <xsl:if test="/mainpage/license">
677 <xsl:apply-templates select="license" />
678 </xsl:if>
679 <br/>
680 <!--content end-->
681 </td>
682 <td width="1%" bgcolor="#dddaec" valign="top">
683 <xsl:call-template name="rhcol"/>
684 </td>
685 </tr>
686 <tr lang="en">
687 <td align="right" class="infohead" colspan="3">
688 <xsl:call-template name="copyright-footer"/>
689 </td>
690 </tr>
691 </table>
692
693 </body>
694 </html>
695 </xsl:template>
696
697 <xsl:template match="newsitem" mode="moreblogs">
698 <xsl:copy-of select="."/>
699 <xsl:if test="following-sibling::*[1]/@planet">
700 <xsl:apply-templates select="following-sibling::newsitem[position()=1 and @planet]" mode="moreblogs"/>
701 </xsl:if>
702 </xsl:template>
703
704 <xsl:template name="copyright-footer">
705 <xsl:variable name="isEnglish">
706 <xsl:if test="string-length($glang)=0 or $glang='en'">Y</xsl:if>
707 </xsl:variable>
708 <xsl:variable name="www">
709 <xsl:if test="$httphost!='www'">http://www.gentoo.org</xsl:if>
710 </xsl:variable>
711 <xsl:variable name="contact">
712 <xsl:choose>
713 <xsl:when test="not($isEnglish='Y' or document(concat('/main/', $glang, '/contact.xml'))/missing)">
714 <xsl:value-of select="concat('/main/', $glang, '/contact.xml')"/>
715 </xsl:when>
716 <xsl:otherwise>/main/en/contact.xml</xsl:otherwise>
717 </xsl:choose>
718 </xsl:variable>
719 Copyright 2001-<xsl:value-of select="substring(func:today(),1,4)"/> Gentoo Foundation, Inc. Questions, Comments? <a class="highlight" href="{concat($www, $contact)}">Contact us</a>.
720 </xsl:template>
721
722 <!-- Mail template -->
723 <xsl:template match="mail">
724 <xsl:variable name="mail">
725 <xsl:call-template name="smart-mail">
726 <xsl:with-param name="mail" select="."/>
727 </xsl:call-template>
728 </xsl:variable>
729
730 <xsl:choose>
731 <xsl:when test="string-length(exslt:node-set($mail)/mail/@link)>0">
732 <a href="{concat('mailto:',exslt:node-set($mail)/mail/@link)}">
733 <xsl:choose>
734 <xsl:when test="name(..)='author'">
735 <xsl:attribute name="class">altlink</xsl:attribute>
736 <b><xsl:value-of select="exslt:node-set($mail)/mail/text()"/></b>
737 </xsl:when>
738 <xsl:otherwise>
739 <xsl:value-of select="exslt:node-set($mail)/mail/text()"/>
740 </xsl:otherwise>
741 </xsl:choose>
742 </a>
743 </xsl:when>
744 <xsl:otherwise><xsl:value-of select="exslt:node-set($mail)/mail/text()"/></xsl:otherwise>
745 </xsl:choose>
746 </xsl:template>
747
748 <!-- Author -->
749 <xsl:template match="author">
750 <xsl:apply-templates/>
751 <xsl:if test="@title">
752 <xsl:if test="$style != 'printable'"><br/></xsl:if>
753 <xsl:if test="$style = 'printable'">&#160;</xsl:if>
754 <i><xsl:value-of select="@title"/></i>
755 </xsl:if>
756 <br/>
757 <xsl:if test="$style != 'printable' and position() != last()"><br/></xsl:if>
758 </xsl:template>
759
760 <!-- FAQ Index & Chapter -->
761 <xsl:template match="faqindex|chapter|/sections/section">
762 <xsl:if test="not(@test) or dyn:evaluate(@test)">
763 <xsl:variable name="uid" select="generate-id(.)" />
764 <xsl:variable name="chid">
765 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[@uid=$uid]/preceding-sibling::chapter)"/>
766 </xsl:variable>
767
768 <xsl:variable name="partnum">
769 <xsl:value-of select="exslt:node-set($doc-struct)//bookpart[descendant::*[@uid=$uid]]/@pos"/>
770 </xsl:variable>
771 <xsl:variable name="chapnum">
772 <xsl:value-of select="exslt:node-set($doc-struct)//bookchap[descendant::*[@uid=$uid]]/@pos"/>
773 </xsl:variable>
774
775 <xsl:choose>
776 <xsl:when test="include">
777 <xsl:apply-templates select="document(include/@href)//chapter"/>
778 </xsl:when>
779
780 <xsl:when test="title">
781 <p class="chaphead">
782 <xsl:if test="@id">
783 <a name="{@id}"/>
784 </xsl:if>
785
786 <xsl:choose>
787 <xsl:when test="$TTOP='book' and $full != 0">
788 <a name="book_part{$partnum}_chap{$chapnum}__chap{$chid}"/>
789 </xsl:when>
790 <xsl:otherwise>
791 <a name="doc_chap{$chid}"/>
792 </xsl:otherwise>
793 </xsl:choose>
794
795 <span class="chapnum">
796 <xsl:choose>
797 <xsl:when test="$TTOP='book'">
798 <xsl:value-of select="$chapnum" />.<xsl:number level="multiple" format="a. " value="$chid"/>
799 </xsl:when>
800 <xsl:otherwise>
801 <xsl:value-of select="$chid"/>.&#160;
802 </xsl:otherwise>
803 </xsl:choose>
804 </span>
805 <xsl:value-of select="title"/>
806 </p>
807 </xsl:when>
808 <xsl:otherwise>
809 <xsl:if test="/guide">
810 <p class="chaphead">
811 <span class="chapnum">
812 <a name="doc_chap{$chid}"><xsl:number/>.</a>
813 </span>
814 </p>
815 </xsl:if>
816 </xsl:otherwise>
817 </xsl:choose>
818
819 <xsl:apply-templates select="section|subsection|body"/>
820
821 <xsl:if test="name()='faqindex'">
822 <!-- Generate FAQ index -->
823
824 <xsl:for-each select="exslt:node-set($doc-struct)//chapter[position()>1]">
825 <xsl:if test="section[@title]">
826 <p class="secthead">
827 <xsl:value-of select="@title"/>
828 </p>
829 <xsl:variable name="nchap"><xsl:value-of select="1+position()"/></xsl:variable>
830 <ul>
831 <xsl:for-each select="section">
832 <xsl:if test="@title">
833 <li>
834 <a>
835 <xsl:attribute name="href">
836 <xsl:choose>
837 <xsl:when test="@id">
838 #<xsl:value-of select="@id"/>
839 </xsl:when>
840 <xsl:otherwise>
841 <xsl:value-of select="concat('#doc_chap', $nchap, '_sect')"/><xsl:number/>
842 </xsl:otherwise>
843 </xsl:choose>
844 </xsl:attribute>
845 <xsl:value-of select="@title"/>
846 </a>
847 </li>
848 </xsl:if>
849 </xsl:for-each>
850 </ul>
851 </xsl:if>
852 </xsl:for-each>
853 </xsl:if>
854 </xsl:if>
855 </xsl:template>
856
857
858 <!-- Section template -->
859 <xsl:template match="section|/sections/section/subsection">
860 <xsl:if test="not(@test) or dyn:evaluate(@test)">
861
862 <xsl:variable name="uid" select="generate-id(.)" />
863 <xsl:variable name="chid">
864 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[descendant::section[@uid=$uid]]/preceding-sibling::chapter)"/>
865 </xsl:variable>
866 <xsl:variable name="seid">
867 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//section[@uid=$uid]/preceding-sibling::section)"/>
868 </xsl:variable>
869
870 <xsl:variable name="partnum">
871 <xsl:value-of select="exslt:node-set($doc-struct)//bookpart[descendant::*[@uid=$uid]]/@pos"/>
872 </xsl:variable>
873 <xsl:variable name="chapnum">
874 <xsl:value-of select="exslt:node-set($doc-struct)//bookchap[descendant::*[@uid=$uid]]/@pos"/>
875 </xsl:variable>
876
877 <xsl:choose>
878 <xsl:when test="include">
879 <xsl:apply-templates select="document(include/@href)//section"/>
880 </xsl:when>
881
882 <xsl:when test="title">
883 <xsl:variable name="sectid">
884 <xsl:choose>
885 <xsl:when test="$TTOP='book' and $full != 0">
886 <xsl:value-of select="concat('book_part', $partnum, '_chap', $chapnum, '__chap', $chid, '_sect', $seid)"/>
887 </xsl:when>
888 <xsl:otherwise>
889 <xsl:value-of select="concat('doc_chap', $chid, '_sect', $seid)"/>
890 </xsl:otherwise>
891 </xsl:choose>
892 </xsl:variable>
893
894 <p class="secthead">
895 <xsl:if test="@id">
896 <a name="{@id}"/></xsl:if>
897 <a name="{$sectid}"><xsl:value-of select="title"/></a>
898 </p>
899 </xsl:when>
900 </xsl:choose>
901
902 <xsl:apply-templates select="body"/>
903 </xsl:if>
904 </xsl:template>
905
906 <!-- Figure template -->
907 <xsl:template match="figure">
908 <xsl:variable name="uid" select="generate-id(.)" />
909 <xsl:variable name="chid">
910 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[descendant::figure[@uid=$uid]]/preceding-sibling::chapter)"/>
911 </xsl:variable>
912 <xsl:variable name="fignum">
913 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[descendant::figure[@uid=$uid]]//figure[following::figure[@uid=$uid]])"/>
914 </xsl:variable>
915 <xsl:variable name="figid">
916 <xsl:choose>
917 <xsl:when test="($TTOP = 'book') and ($full != 0)">
918 <xsl:value-of select="concat('book_part', exslt:node-set($doc-struct)//bookpart[descendant::figure[@uid=$uid]]/@pos, '_chap', exslt:node-set($doc-struct)//bookchap[descendant::figure[@uid=$uid]]/@pos, '__chap', $chid, '_fig', $fignum)"/>
919 </xsl:when>
920 <xsl:otherwise>
921 <xsl:value-of select="concat('doc_chap', $chid, '_fig', $fignum)"/>
922 </xsl:otherwise>
923 </xsl:choose>
924 </xsl:variable>
925
926 <xsl:variable name="llink">
927 <xsl:choose>
928 <xsl:when test="starts-with(@link,'http://www.gentoo.org/')">
929 <xsl:value-of select="concat($ROOT, substring-after(@link, 'http://www.gentoo.org/'))"/>
930 </xsl:when>
931 <xsl:when test="starts-with(@link,'/')">
932 <xsl:value-of select="concat($ROOT, substring-after(@link, '/'))"/>
933 </xsl:when>
934 <xsl:otherwise>
935 <xsl:value-of select="@link"/>
936 </xsl:otherwise>
937 </xsl:choose>
938 </xsl:variable>
939 <br/>
940 <a name="{$figid}"/>
941 <table cellspacing="0" cellpadding="0" border="0">
942 <tr>
943 <td bgcolor="#7a5ada">
944 <p class="codetitle">
945 <xsl:choose>
946 <xsl:when test="@caption">
947 <xsl:value-of select="func:gettext('Figure')"/>&#160;<xsl:value-of select="$chid"/>.<xsl:value-of select="$fignum"/><xsl:value-of select="func:gettext('SpaceBeforeColon')"/>: <xsl:value-of select="@caption"/>
948 </xsl:when>
949 <xsl:otherwise>
950 <xsl:value-of select="func:gettext('Figure')"/>&#160;<xsl:value-of select="$chid"/>.<xsl:value-of select="$fignum"/>
951 </xsl:otherwise>
952 </xsl:choose>
953 </p>
954 </td>
955 </tr>
956 <tr>
957 <td align="center" bgcolor="#ddddff">
958 <xsl:choose>
959 <xsl:when test="@short">
960 <img src="{$llink}" alt="Fig. {$fignum}: {@short}"/>
961 </xsl:when>
962 <xsl:otherwise>
963 <img src="{$llink}" alt="Fig. {$fignum}"/>
964 </xsl:otherwise>
965 </xsl:choose>
966 </td>
967 </tr>
968 </table>
969 <br/>
970 </xsl:template>
971
972 <!--figure without a caption; just a graphical element-->
973 <xsl:template match="fig">
974 <xsl:variable name="llink">
975 <xsl:choose>
976 <xsl:when test="starts-with(@link,'http://www.gentoo.org/')">
977 <xsl:value-of select="concat($ROOT, substring-after(@link, 'http://www.gentoo.org/'))"/>
978 </xsl:when>
979 <xsl:when test="starts-with(@link,'/')">
980 <xsl:value-of select="concat($ROOT, substring-after(@link, '/'))"/>
981 </xsl:when>
982 <xsl:otherwise>
983 <xsl:value-of select="@link"/>
984 </xsl:otherwise>
985 </xsl:choose>
986 </xsl:variable>
987 <center>
988 <xsl:choose>
989 <xsl:when test="@linkto">
990 <a href="{@linkto}"><img border="0" src="{$llink}" alt="{@short}"/></a>
991 </xsl:when>
992 <xsl:otherwise>
993 <img src="{$llink}" alt="{@short}"/>
994 </xsl:otherwise>
995 </xsl:choose>
996 </center>
997 </xsl:template>
998
999 <xsl:template match="devmap">
1000 <h1>Gentoo Developers Map</h1>
1001 <p id="map" style="height:460px"/>
1002 <br/>
1003 <table id="devlinks" style="width:100%"/>
1004 </xsl:template>
1005
1006 <!-- Line break -->
1007 <xsl:template match="br">
1008 <br/>
1009 </xsl:template>
1010
1011 <!-- Note -->
1012 <xsl:template match="note">
1013 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1014 <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
1015 <tr>
1016 <td bgcolor="#bbffbb">
1017 <p class="note">
1018 <b><xsl:value-of select="func:gettext('Note')"/>: </b>
1019 <xsl:apply-templates/>
1020 </p>
1021 </td>
1022 </tr>
1023 </table>
1024 </xsl:if>
1025 </xsl:template>
1026
1027 <!-- Important item -->
1028 <xsl:template match="impo">
1029 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1030 <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
1031 <tr>
1032 <td bgcolor="#ffffbb">
1033 <p class="note">
1034 <b><xsl:value-of select="func:gettext('Important')"/>: </b>
1035 <xsl:apply-templates/>
1036 </p>
1037 </td>
1038 </tr>
1039 </table>
1040 </xsl:if>
1041 </xsl:template>
1042
1043 <!-- Warning -->
1044 <xsl:template match="warn">
1045 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1046 <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
1047 <tr>
1048 <td bgcolor="#ffbbbb">
1049 <p class="note">
1050 <b><xsl:value-of select="func:gettext('Warning')"/>: </b>
1051 <xsl:apply-templates/>
1052 </p>
1053 </td>
1054 </tr>
1055 </table>
1056 </xsl:if>
1057 </xsl:template>
1058
1059 <!-- Code note -->
1060 <xsl:template match="codenote">
1061 <span class="comment">
1062 <xsl:if test='not(starts-with(., "("))'>(</xsl:if>
1063 <xsl:apply-templates/>
1064 <xsl:if test='not(starts-with(., "("))'>)</xsl:if>
1065 </span>
1066 </xsl:template>
1067
1068 <!-- Regular comment -->
1069 <xsl:template match="comment">
1070 <span class="code-comment"><xsl:apply-templates/></span>
1071 </xsl:template>
1072
1073 <!-- Colour coding inside <pre> -->
1074 <xsl:template match="i">
1075 <span class="code-input"><xsl:apply-templates/></span>
1076 </xsl:template>
1077
1078 <xsl:template match="var">
1079 <span class="code-variable"><xsl:apply-templates/></span>
1080 </xsl:template>
1081
1082 <xsl:template match="ident">
1083 <span class="code-identifier"><xsl:apply-templates/></span>
1084 </xsl:template>
1085
1086 <xsl:template match="keyword">
1087 <span class="code-keyword"><xsl:apply-templates/></span>
1088 </xsl:template>
1089
1090 <xsl:template match="stmt">
1091 <span class="code-statement"><xsl:apply-templates/></span>
1092 </xsl:template>
1093
1094 <xsl:template match="const">
1095 <span class="code-constant"><xsl:apply-templates/></span>
1096 </xsl:template>
1097
1098
1099 <!-- Bold -->
1100 <xsl:template match="b">
1101 <b><xsl:apply-templates/></b>
1102 </xsl:template>
1103
1104 <!-- Superscript -->
1105 <xsl:template match="sup">
1106 <sup><xsl:apply-templates/></sup>
1107 </xsl:template>
1108
1109 <!-- Subscript -->
1110 <xsl:template match="sub">
1111 <sub><xsl:apply-templates/></sub>
1112 </xsl:template>
1113
1114 <!-- Brite -->
1115 <xsl:template match="brite">
1116 <font color="#ff0000">
1117 <b><xsl:apply-templates/></b>
1118 </font>
1119 </xsl:template>
1120
1121 <!-- Body -->
1122 <xsl:template match="body">
1123 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1124 <xsl:choose>
1125 <xsl:when test="include">
1126 <xsl:apply-templates select="document(include/@href)//body"/>
1127 </xsl:when>
1128 <xsl:otherwise>
1129 <xsl:apply-templates select="./*[not(@test) or dyn:evaluate(@test)]"/>
1130 </xsl:otherwise>
1131 </xsl:choose>
1132 </xsl:if>
1133 </xsl:template>
1134
1135 <!-- Command or input, not to use inside <pre> -->
1136 <xsl:template match="c">
1137 <span class="code" dir="ltr"><xsl:apply-templates/></span>
1138 </xsl:template>
1139
1140 <!-- Preserve whitespace, aka Code Listing -->
1141 <xsl:template match="pre">
1142 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1143 <xsl:variable name="uid" select="generate-id(.)" />
1144 <xsl:variable name="chid">
1145 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[descendant::pre[@uid=$uid]]/preceding-sibling::chapter)"/>
1146 </xsl:variable>
1147 <xsl:variable name="prenum">
1148 <xsl:value-of select="1+count(exslt:node-set($doc-struct)//chapter[descendant::pre[@uid=$uid]]//pre[following::pre[@uid=$uid]])"/>
1149 </xsl:variable>
1150 <xsl:variable name="preid">
1151 <xsl:choose>
1152 <xsl:when test="($TTOP = 'book') and ($full != 0)">
1153 <xsl:value-of select="concat('book_part', exslt:node-set($doc-struct)//bookpart[descendant::pre[@uid=$uid]]/@pos, '_chap', exslt:node-set($doc-struct)//bookchap[descendant::pre[@uid=$uid]]/@pos, '__chap', $chid, '_pre', $prenum)"/>
1154 </xsl:when>
1155 <xsl:otherwise>
1156 <xsl:value-of select="concat('doc_chap', $chid, '_pre', $prenum)"/>
1157 </xsl:otherwise>
1158 </xsl:choose>
1159 </xsl:variable>
1160
1161 <a name="{$preid}"/>
1162 <table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0">
1163 <xsl:if test="not($httphost='archives')">
1164 <tr>
1165 <td bgcolor="#7a5ada">
1166 <p class="codetitle">
1167 <xsl:value-of select="func:gettext('CodeListing')"/>&#160;<xsl:if test="$chid"><xsl:value-of select="$chid"/>.</xsl:if><xsl:value-of select="$prenum"/>
1168 <xsl:if test="@caption">
1169 <xsl:value-of select="func:gettext('SpaceBeforeColon')"/>: <xsl:value-of select="@caption"/>
1170 </xsl:if>
1171 </p>
1172 </td>
1173 </tr>
1174 </xsl:if>
1175 <tr>
1176 <td bgcolor="#eeeeff" align="left" dir="ltr">
1177 <pre>
1178 <xsl:apply-templates/>
1179 </pre>
1180 </td>
1181 </tr>
1182 </table>
1183 </xsl:if>
1184 </xsl:template>
1185
1186 <!-- Path -->
1187 <xsl:template match="path">
1188 <span class="path" dir="ltr"><xsl:apply-templates/></span>
1189 </xsl:template>
1190
1191 <!-- Url -->
1192 <xsl:template match="uri">
1193 <xsl:param name="paramlink"/>
1194 <!-- expand templates to handle things like <uri link="http://bar"><c>foo</c></uri> -->
1195 <xsl:variable name="theurl">
1196 <xsl:choose>
1197 <xsl:when test="@link and contains(@link, '__FILE_')">
1198 <xsl:value-of select="concat(substring-before(@link,'__FILE__'),$basename,substring-after(@link,'__FILE__'))" />
1199 </xsl:when>
1200 <xsl:when test="@link"><xsl:value-of select="@link" /></xsl:when>
1201 <xsl:when test="contains(text(), '__FILE_')">
1202 <xsl:value-of select="concat(substring-before(text(),'__FILE__'),$basename,substring-after(text(),'__FILE__'))" />
1203 </xsl:when>
1204 <xsl:otherwise><xsl:value-of select="text()" /></xsl:otherwise>
1205 </xsl:choose>
1206 </xsl:variable>
1207
1208 <xsl:choose>
1209 <xsl:when test="@link">
1210 <xsl:choose>
1211 <xsl:when test="($TTOP = 'sections') and (starts-with(@link, '?'))">
1212 <!-- Handbook link pointing to another part/chapter when viewing a single page,
1213 cannot be a link because we have no idea where to link to
1214 Besides, we have no way of knowing the language unless told via a param -->
1215 <xsl:variable name="nolink"><xsl:value-of select="func:gettext('hb_file', $glang)"/></xsl:variable>
1216 <span title="{$nolink}"><font color="#404080">(<xsl:apply-templates/>)</font></span>
1217 </xsl:when>
1218 <xsl:when test="($TTOP = 'book') and ($full = 0) and (starts-with(@link, '?'))">
1219 <!-- Handbook link pointing to another part/chapter, normal case -->
1220 <xsl:choose>
1221 <xsl:when test="$style != 'printable'">
1222 <a href="{$link}{$theurl}"><xsl:apply-templates/></a>
1223 </xsl:when>
1224 <xsl:otherwise>
1225 <a href="{$link}{$theurl}&amp;style=printable"><xsl:apply-templates/></a>
1226 </xsl:otherwise>
1227 </xsl:choose>
1228 </xsl:when>
1229 <xsl:when test="($TTOP = 'book') and ($full = 1) and (starts-with(@link, '?'))">
1230 <!-- Handbook link pointing to another part/chapter
1231 Handbook is being rendered in a single page (full=1)
1232 Hence link needs to be rewritten as a local one
1233 i.e. ?part=1&chap=3#doc_chap1 must become #book_part1_chap3__chap1 Case 1a
1234 i.e. ?part=1&chap=3#anID must become #anID Case 1b
1235 or ?part=1&chap=3 must become #book_part1_chap3 Case 2
1236 or ?part=2 must become #book_part2 Case 3-->
1237 <xsl:choose>
1238 <xsl:when test="contains(@link, 'chap=') and contains(@link, '#doc_')">
1239 <!-- Link points inside a chapter (Case 1a)-->
1240 <xsl:variable name="linkpart" select="substring-after(substring-before($theurl, '&amp;'), '=')" />
1241 <xsl:variable name="linkchap" select="substring-before(substring-after(substring-after($theurl, '&amp;'), '='), '#doc_')" />
1242 <xsl:variable name="linkanch" select="substring-after($theurl, '#doc_')" />
1243 <a href="#book_part{$linkpart}_chap{$linkchap}__{$linkanch}"><xsl:apply-templates /></a>
1244 </xsl:when>
1245 <xsl:when test="contains(@link, 'chap=') and contains(@link, '#')">
1246 <!-- Link points inside a chapter via an ID (Case 1b)
1247 (IDs are expected to be unique throughout a handbook) -->
1248 <xsl:variable name="linkanch" select="substring-after(@link, '#')" />
1249 <a href="#{$linkanch}"><xsl:apply-templates /></a>
1250 </xsl:when>
1251 <xsl:when test="contains(@link, 'chap=')">
1252 <!-- Link points to a chapter (Case 2)-->
1253 <xsl:variable name="linkpart" select="substring-after(substring-before($theurl, '&amp;'), '=')" />
1254 <xsl:variable name="linkchap" select="substring-after(substring-after($theurl, '&amp;'), '=')" />
1255 <a href="#book_part{$linkpart}_chap{$linkchap}"><xsl:apply-templates /></a>
1256 </xsl:when>
1257 <xsl:otherwise>
1258 <!-- Link points to a part (Case 3)-->
1259 <xsl:variable name="linkpart" select="substring-after($theurl, '=')" />
1260 <a href="#book_part{$linkpart}"><xsl:apply-templates/></a>
1261 </xsl:otherwise>
1262 </xsl:choose>
1263 </xsl:when>
1264 <xsl:when test="($TTOP = 'book') and ($full = 1) and (starts-with(@link, '#'))">
1265 <!-- Handbook link pointing to another place in same part/chapter
1266 Handbook is being rendered in a single page (full=1)
1267 Hence link needs to be rewritten as an internal one that is unique
1268 for the whole handbook, i.e.
1269 #doc_part1_chap3 becomes #book_{UNIQUEID}_part1_chap3, but
1270 #anything_else_like_an_ID is left unchanged (IDs are expected to be unique throughout a handbook)-->
1271 <xsl:choose>
1272 <xsl:when test="starts-with(@link, '#doc_')">
1273 <xsl:variable name="locallink" select="substring-after(@link, 'doc_')" />
1274 <xsl:variable name="bodyid" select="generate-id(ancestor::body)"/>
1275 <a href="{concat('#book_part',exslt:node-set($doc-struct)//bookpart[descendant::body[@uid=$bodyid]]/@pos,'_chap',exslt:node-set($doc-struct)//bookchap[descendant::body[@uid=$bodyid]]/@pos,'__',$locallink)}"><xsl:apply-templates /></a>
1276 </xsl:when>
1277 <xsl:otherwise>
1278 <a href="{$theurl}"><xsl:apply-templates/></a>
1279 </xsl:otherwise>
1280 </xsl:choose>
1281 </xsl:when>
1282 <xsl:otherwise>
1283
1284 <xsl:variable name="thelink">
1285 <xsl:choose>
1286 <xsl:when test="name(..)='insert' and $theurl='$redirect' and $paramlink"><xsl:value-of select="$paramlink" /></xsl:when>
1287 <xsl:when test="name(..)='insert' and $theurl='$originalversion' and $paramlink">
1288 <xsl:variable name="temp">
1289 <xsl:value-of select="$paramlink"/>
1290 <xsl:if test="$style = 'printable'">&amp;style=printable</xsl:if>
1291 <xsl:if test="$full != '0'">&amp;full=1</xsl:if>
1292 <xsl:if test="$part != '0'">&amp;part=<xsl:value-of select="$part"/></xsl:if>
1293 <xsl:if test="$chap != '0'">&amp;chap=<xsl:value-of select="$chap"/></xsl:if>
1294 </xsl:variable>
1295 <xsl:choose>
1296 <xsl:when test="contains($temp, '&amp;')">
1297 <xsl:value-of select="concat(substring-before($temp,'&amp;'), '?', substring-after($temp,'&amp;'))"/>
1298 </xsl:when>
1299 <xsl:otherwise>
1300 <xsl:value-of select="$temp"/>
1301 </xsl:otherwise>
1302 </xsl:choose>
1303 </xsl:when>
1304 <xsl:otherwise><xsl:value-of select="$theurl" /></xsl:otherwise>
1305 </xsl:choose>
1306 </xsl:variable>
1307
1308 <!-- Strip http://www.gentoo.org from links if running on www.g.o
1309 Has no effect on actual www.g.o but helps when surfing on a local copy as long as httphost is set to www as well
1310 Rewrite http://www.gentoo.org/cgi-bin/viewcvs/ to use sources.gentoo.org/
1311 -->
1312 <xsl:variable name="llink">
1313 <xsl:choose>
1314 <xsl:when test="starts-with($thelink, 'http://www.gentoo.org/cgi-bin/viewcvs.cgi')"><xsl:value-of select="concat('http://sources.gentoo.org/viewcvs.py', substring-after($thelink, 'http://www.gentoo.org/cgi-bin/viewcvs.cgi'))" /></xsl:when>
1315 <xsl:when test="starts-with($thelink, '/cgi-bin/viewcvs.cgi')"><xsl:value-of select="concat('http://sources.gentoo.org/viewcvs.py', substring-after($thelink, '/cgi-bin/viewcvs.cgi'))" /></xsl:when>
1316 <xsl:when test="$httphost='www' and starts-with($thelink, 'http://www.gentoo.org/')"><xsl:value-of select="substring-after($thelink, 'http://www.gentoo.org')" /></xsl:when>
1317 <xsl:when test="not($httphost='www') and starts-with($thelink, '/') and not(starts-with($thelink, '/~'))"><xsl:value-of select="concat('http://www.gentoo.org', $thelink)" /></xsl:when>
1318 <!-- Add catid to links to /doc/LL/index.xml -->
1319 <xsl:when test="$catid != '0' and starts-with($thelink, '/doc/') and (substring-after(substring-after($thelink, '/doc/'), '/')='' or substring-after(substring-after($thelink, '/doc/'), '/')='index.xml')">
1320 <xsl:value-of select="concat($thelink, '?catid=', $catid)"/>
1321 </xsl:when>
1322 <xsl:otherwise><xsl:value-of select="$thelink" /></xsl:otherwise>
1323 </xsl:choose>
1324 </xsl:variable>
1325
1326 <!-- Now, insert style=printable in the URL if necessary -->
1327 <xsl:variable name="alink">
1328 <xsl:choose>
1329 <xsl:when test="$style != 'printable' or contains($llink, 'style=printable')">
1330 <!-- Not printable style or style=printable already in URL, copy link -->
1331 <xsl:value-of select="$llink" />
1332 </xsl:when>
1333 <xsl:when test="contains($llink, '://')">
1334 <!-- External link, copy link -->
1335 <xsl:value-of select="$llink" />
1336 </xsl:when>
1337 <xsl:when test="starts-with($llink, '#')">
1338 <!-- Anchor, copy link -->
1339 <xsl:value-of select="$llink" />
1340 </xsl:when>
1341 <xsl:otherwise>
1342 <!-- We should have eliminated all other cases,
1343 style printable, local link, then insert ?style=printable -->
1344 <xsl:choose>
1345 <xsl:when test="starts-with($llink, '?')">
1346 <xsl:value-of select="concat( '?style=printable&amp;', substring-after($llink, '?'))" />
1347 </xsl:when>
1348 <xsl:when test="contains($llink, '.xml?')">
1349 <xsl:value-of select="concat(substring-before($llink, '.xml?'), '.xml?style=printable&amp;', substring-after($llink, '.xml?'))" />
1350 </xsl:when>
1351 <xsl:when test="contains($llink, '.xml#')">
1352 <xsl:value-of select="concat(substring-before($llink, '.xml#'), '.xml?style=printable#', substring-after($llink, '.xml#'))" />
1353 </xsl:when>
1354 <xsl:when test="substring-after($llink, '.xml') = ''">
1355 <xsl:value-of select="concat($llink, '?style=printable')" />
1356 </xsl:when>
1357 <xsl:otherwise>
1358 <!-- Have I forgotten anything?
1359 Copy link -->
1360 <xsl:value-of select="$llink" />
1361 </xsl:otherwise>
1362 </xsl:choose>
1363 </xsl:otherwise>
1364 </xsl:choose>
1365 </xsl:variable>
1366 <a href="{$alink}"><xsl:apply-templates/></a>
1367 </xsl:otherwise>
1368 </xsl:choose>
1369 </xsl:when>
1370 <xsl:otherwise>
1371 <xsl:variable name="loc" select="."/>
1372 <a href="{$loc}"><xsl:apply-templates/></a>
1373 </xsl:otherwise>
1374 </xsl:choose>
1375 </xsl:template>
1376
1377 <!-- Paragraph -->
1378 <xsl:template match="p">
1379 <xsl:param name="chid"/>
1380 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1381 <p>
1382 <!-- Keep this for old files with <p class="secthead"> -->
1383 <xsl:if test="@class">
1384 <xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
1385 </xsl:if>
1386
1387 <xsl:if test="@by">
1388 <xsl:attribute name="class">epigraph</xsl:attribute>
1389 </xsl:if>
1390
1391 <xsl:apply-templates>
1392 <xsl:with-param name="chid" select="$chid"/>
1393 </xsl:apply-templates>
1394
1395 <xsl:if test="@by">
1396 <br/><br/><span class="episig">—<xsl:value-of select="@by"/></span><br/><br/>
1397 </xsl:if>
1398 </p>
1399 </xsl:if>
1400 </xsl:template>
1401
1402 <!-- Emphasize -->
1403 <xsl:template match="e">
1404 <span class="emphasis"><xsl:apply-templates/></span>
1405 </xsl:template>
1406
1407 <!-- Table -->
1408 <xsl:template match="table">
1409 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1410 <table class="ntable">
1411 <xsl:apply-templates/>
1412 </table>
1413 </xsl:if>
1414 </xsl:template>
1415
1416 <!-- Table Row -->
1417 <xsl:template match="tr">
1418 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1419 <tr>
1420 <xsl:if test="@id">
1421 <xsl:attribute name="id">
1422 <xsl:value-of select="@id"/>
1423 </xsl:attribute>
1424 </xsl:if>
1425 <xsl:apply-templates/>
1426 </tr>
1427 </xsl:if>
1428 </xsl:template>
1429
1430 <xsl:template match="tcolumn">
1431 <col width="{@width}"/>
1432 </xsl:template>
1433
1434 <!-- Table Item -->
1435 <xsl:template match="ti">
1436 <td class="tableinfo">
1437 <xsl:if test="@align='center' or @align='right'">
1438 <xsl:attribute name="style"><xsl:value-of select="concat('text-align:',@align)"/></xsl:attribute>
1439 </xsl:if>
1440 <xsl:if test="@colspan">
1441 <xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>
1442 </xsl:if>
1443 <xsl:if test="@rowspan">
1444 <xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>
1445 </xsl:if>
1446 <xsl:apply-templates/>
1447 </td>
1448 </xsl:template>
1449
1450 <!-- Table Heading, no idea why <th> hasn't been used -->
1451 <xsl:template match="th">
1452 <td class="infohead">
1453 <xsl:if test="@colspan">
1454 <xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>
1455 <!-- Center only when item spans several columns as
1456 centering all <th> might disrupt some pages.
1457 We might want to use a plain html <th> tag later.
1458 Tip: to center a single-cell title, use <th colspan="1">
1459 -->
1460 <xsl:attribute name="style">text-align:center</xsl:attribute>
1461 </xsl:if>
1462 <xsl:if test="@rowspan">
1463 <xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>
1464 </xsl:if>
1465 <b>
1466 <xsl:apply-templates/>
1467 </b>
1468 </td>
1469 </xsl:template>
1470
1471 <!-- Unnumbered List -->
1472 <xsl:template match="ul">
1473 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1474 <ul>
1475 <xsl:apply-templates/>
1476 </ul>
1477 </xsl:if>
1478 </xsl:template>
1479
1480 <!-- Ordered List -->
1481 <xsl:template match="ol">
1482 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1483 <ol>
1484 <xsl:apply-templates/>
1485 </ol>
1486 </xsl:if>
1487 </xsl:template>
1488
1489 <!-- List Item -->
1490 <xsl:template match="li">
1491 <xsl:if test="not(@test) or dyn:evaluate(@test)">
1492 <li>
1493 <xsl:apply-templates/>
1494 </li>
1495 </xsl:if>
1496 </xsl:template>
1497
1498 <!-- Definition Lists -->
1499 <xsl:template match="dl">
1500 <dl><xsl:apply-templates/></dl>
1501 </xsl:template>
1502
1503 <xsl:template match="dt">
1504 <dt><xsl:apply-templates/></dt>
1505 </xsl:template>
1506
1507 <xsl:template match="dd">
1508 <dd><xsl:apply-templates/></dd>
1509 </xsl:template>
1510
1511 <!-- NOP -->
1512 <xsl:template match="ignoreinemail">
1513 <xsl:apply-templates/>
1514 </xsl:template>
1515
1516 <!-- NOP -->
1517 <xsl:template match="ignoreinguide">
1518 </xsl:template>
1519
1520 <!-- License Tag -->
1521 <xsl:template match="license">
1522 <p class="copyright">
1523 <!-- Test for RTL languages -->
1524 <xsl:if test="$RTL='Y'">
1525 <xsl:attribute name="dir">RTL</xsl:attribute>
1526 </xsl:if>
1527 <xsl:apply-templates select="func:gettext('License')"/>
1528 </p>
1529 <xsl:comment>
1530 &lt;rdf:RDF xmlns="http://web.resource.org/cc/"
1531 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
1532 &lt;License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"&gt;
1533 &lt;permits rdf:resource="http://web.resource.org/cc/Reproduction" /&gt;
1534 &lt;permits rdf:resource="http://web.resource.org/cc/Distribution" /&gt;
1535 &lt;requires rdf:resource="http://web.resource.org/cc/Notice" /&gt;
1536 &lt;requires rdf:resource="http://web.resource.org/cc/Attribution" /&gt;
1537 &lt;permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" /&gt;
1538 &lt;requires rdf:resource="http://web.resource.org/cc/ShareAlike" /&gt;
1539 &lt;/License&gt;
1540 &lt;/rdf:RDF&gt;
1541 </xsl:comment>
1542 </xsl:template>
1543
1544 <!-- GLEP index -->
1545 <xsl:template match="glepindex">
1546 <table class="ntable">
1547 <tr>
1548 <td class="infohead">Number</td><td class="infohead">Type</td><td class="infohead">Status</td><td class="infohead">Title</td>
1549 </tr>
1550 <xsl:apply-templates select="document(@index)/gleps/glep">
1551 <xsl:with-param name="status" select="string(@status)"/>
1552 </xsl:apply-templates>
1553 </table>
1554 </xsl:template>
1555
1556 <!-- One GLEP table row -->
1557 <xsl:template match="glep">
1558 <xsl:param name="status" select="''"/>
1559 <xsl:if test="string-length($status)=0 or contains($status, @status)">
1560 <tr>
1561 <td class="tableinfo"><a href="{@file}"><xsl:value-of select="@id"/></a></td>
1562 <td class="tableinfo"><xsl:value-of select="@type"/></td>
1563 <td class="tableinfo"><xsl:value-of select="@status"/></td>
1564 <td class="tableinfo"><xsl:apply-templates select="node()"/></td>
1565 </tr>
1566 </xsl:if>
1567 </xsl:template>
1568
1569
1570 <!-- GLSA Index -->
1571 <xsl:template match="glsaindex">
1572 <xsl:apply-templates select="document('/dyn/glsa-index.xml')/guide/chapter[1]/section[1]/body"/>
1573 </xsl:template>
1574
1575 <!-- GLSA Latest (max 10) -->
1576 <xsl:template match="glsa-latest">
1577 <xsl:variable name="src" select="'/dyn/glsa-index.xml'"/>
1578 <table>
1579 <xsl:for-each select="document($src)/guide/chapter[1]/section[1]/body/table[1]/tr[position()&lt;11]">
1580 <tr><xsl:apply-templates/></tr>
1581 </xsl:for-each>
1582 </table>
1583 </xsl:template>
1584
1585
1586 <!-- Compare versions between two documents, scan handbooks if need be -->
1587 <xsl:template name="compare-versions">
1588 <xsl:param name="original"/>
1589 <xsl:param name="translation"/>
1590
1591 <xsl:choose>
1592 <xsl:when test="$original/doc-struct/@type != $translation/doc-struct/@type">
1593 <xsl:text>NoOriginal</xsl:text>
1594 </xsl:when>
1595
1596 <xsl:when test="/book and $full='0' and $chap != '0' and $part != '0' and not($original/doc-struct/bookpart[@pos=$part]/bookchap[@pos=$chap])">
1597 <xsl:text>NoOriginal</xsl:text>
1598 </xsl:when>
1599
1600 <xsl:otherwise>
1601 <xsl:variable name="orig-versions">
1602 <xsl:for-each select="$original//version">
1603 <xsl:value-of select="concat(.,' ')"/>
1604 </xsl:for-each>
1605 </xsl:variable>
1606
1607 <xsl:variable name="trans-versions">
1608 <xsl:for-each select="$translation//version">
1609 <xsl:value-of select="concat(.,' ')"/>
1610 </xsl:for-each>
1611 </xsl:variable>
1612
1613 <xsl:if test="$orig-versions != $trans-versions">Different</xsl:if>
1614 </xsl:otherwise>
1615 </xsl:choose>
1616
1617 </xsl:template>
1618
1619 <xsl:template name="maxdate">
1620 <xsl:param name="thedoc"/>
1621 <xsl:for-each select="$thedoc//date">
1622 <xsl:sort select="." order="descending" />
1623 <xsl:if test="position()=1"><xsl:value-of select="."/></xsl:if>
1624 </xsl:for-each>
1625 </xsl:template>
1626
1627 <xsl:template name="contentdate">
1628 <xsl:variable name="docdate">
1629 <xsl:call-template name="maxdate">
1630 <xsl:with-param name="thedoc" select="exslt:node-set($doc-struct)"/>
1631 </xsl:call-template>
1632 </xsl:variable>
1633
1634 <xsl:choose>
1635 <xsl:when test="func:gettext('Updated')/docdate">
1636 <xsl:apply-templates select="func:gettext('Updated')">
1637 <xsl:with-param name="docdate" select="$docdate"/>
1638 </xsl:apply-templates>
1639 </xsl:when>
1640 <xsl:otherwise>
1641 <xsl:value-of select="concat(func:gettext('Updated'),' ')"/> <xsl:copy-of select="func:format-date($docdate)"/>
1642 </xsl:otherwise>
1643 </xsl:choose>
1644 </xsl:template>
1645
1646 <xsl:template name="outdated-translation">
1647 <!-- Add mention that translation is outdated whenever possible in /main and /doc-->
1648 <xsl:if test="$glang != '' and not (//*[1]/@metadoc = 'yes') and (starts-with($link, '/doc/') or starts-with($link, '/main/') or (starts-with($link, '/proj/') and contains($link, '/gdp/'))) and not(starts-with($link, '/doc/en/') or starts-with($link, '/main/en/') or starts-with($link, '/proj/en/'))">
1649 <!-- We have a translation, is it up-to-date? -->
1650 <xsl:variable name="metadoc" select="document(concat('/doc/', $glang, '/metadoc.xml'))"/>
1651 <xsl:variable name="fileid" select="$metadoc/metadoc/files/file[text()=$link]/@id"/>
1652 <xsl:choose>
1653 <xsl:when test="not($fileid)">
1654 <!-- File is not even listed in local metadoc.xml -->
1655 <xsl:value-of select="func:gettext('NoIndex')"/>
1656 </xsl:when>
1657 <xsl:otherwise>
1658 <xsl:variable name="pmetadoc" select="document($metadoc/metadoc/@parent)"/>
1659 <xsl:choose>
1660 <xsl:when test="not($pmetadoc/metadoc/files/file[@id=$fileid])">
1661 <!-- File is not listed in original metadoc.xml -->
1662 <xsl:value-of select="func:gettext('NoOriginal')"/>
1663 </xsl:when>
1664 <xsl:otherwise>
1665 <!-- Document is listed in both local metadoc.xml and English one, compare version numbers -->
1666 <xsl:variable name="pfile" select="$pmetadoc/metadoc/files/file[@id=$fileid]"/>
1667
1668 <xsl:variable name="orig-struct" xmlns="">
1669 <xsl:call-template name="build-doc-struct">
1670 <xsl:with-param name="doc" select="document($pfile)"/>
1671 </xsl:call-template>
1672 </xsl:variable>
1673
1674 <xsl:variable name="versions">
1675 <xsl:call-template name="compare-versions">
1676 <xsl:with-param name="translation" select ="exslt:node-set($doc-struct)"/>
1677 <xsl:with-param name="original" select ="exslt:node-set($orig-struct)"/>
1678 </xsl:call-template>
1679 </xsl:variable>
1680
1681 <xsl:choose>
1682 <xsl:when test="$versions = 'Different'">
1683 <xsl:variable name="pdocdate">
1684 <xsl:call-template name="maxdate">
1685 <xsl:with-param name="thedoc" select="exslt:node-set($orig-struct)"/>
1686 </xsl:call-template>
1687 </xsl:variable>
1688 <xsl:variable name="res">
1689 <xsl:apply-templates select="func:gettext('Outdated')">
1690 <xsl:with-param name="docdate" select="$pdocdate"/>
1691 <xsl:with-param name="paramlink" select="$pfile"/>
1692 </xsl:apply-templates>
1693 </xsl:variable>
1694 <xsl:copy-of select="$res"/>
1695 </xsl:when>
1696 <xsl:when test="contains($versions,'NoOriginal')">
1697 <xsl:value-of select="func:gettext('NoOriginal')"/>
1698 </xsl:when>
1699 </xsl:choose>
1700 </xsl:otherwise>
1701 </xsl:choose>
1702 </xsl:otherwise>
1703 </xsl:choose>
1704 </xsl:if>
1705 </xsl:template>
1706
1707 <xsl:template match="docdate">
1708 <xsl:param name="docdate"/>
1709 <xsl:copy-of select="func:format-date($docdate)"/>
1710 </xsl:template>
1711
1712
1713 <xsl:template name="rhcol">
1714 <!-- Right-hand column with date/authors/ads -->
1715
1716 <xsl:variable name="images">
1717 <!-- Source images from www.gentoo.org when on another server to
1718 prevent missing images after an update -->
1719 <xsl:choose>
1720 <xsl:when test="$httphost != 'www'">http://www.gentoo.org/</xsl:when>
1721 <xsl:otherwise>
1722 <xsl:value-of select="$ROOT"/>
1723 </xsl:otherwise>
1724 </xsl:choose>
1725 </xsl:variable>
1726
1727 <table border="0" cellspacing="4px" cellpadding="4px">
1728 <!-- Add a "printer-friendly" -->
1729 <xsl:if test="/book or /guide">
1730 <tr>
1731 <td class="topsep" align="center">
1732 <p class="altmenu">
1733 <xsl:variable name="PrintTip"><xsl:value-of select="func:gettext('PrintTip')"/></xsl:variable>
1734 <xsl:variable name="href">
1735 <xsl:choose>
1736 <xsl:when test="/book and $full != 0">
1737 <xsl:value-of select="concat($link, '?full=1&amp;style=printable')"/>
1738 </xsl:when>
1739 <xsl:when test="/book">
1740 <xsl:value-of select="concat($link, '?style=printable')"/>
1741 <xsl:if test="$part != '0'">&amp;part=<xsl:value-of select="$part"/></xsl:if>
1742 <xsl:if test="$chap != '0'">&amp;chap=<xsl:value-of select="$chap"/></xsl:if>
1743 </xsl:when>
1744 <xsl:when test="/guide">
1745 <xsl:value-of select="concat($link, '?style=printable')"/>
1746 </xsl:when>
1747 </xsl:choose>
1748 </xsl:variable>
1749 <a title="{$PrintTip}" class="altlink" href="{$href}"><xsl:value-of select="func:gettext('Print')"/></a>
1750 </p>
1751 </td>
1752 </tr>
1753 </xsl:if>
1754 <!-- Add link to full handbook -->
1755 <xsl:if test="$TTOP='book' and $full=0">
1756 <tr>
1757 <td class="topsep" align="center">
1758 <p class="altmenu">
1759 <xsl:variable name="ShowFullHBTip"><xsl:value-of select="func:gettext('ShowFullHBTip')"/></xsl:variable>
1760 <xsl:variable name="href">
1761 <xsl:choose>
1762 <xsl:when test="$part != 0 and $chap != 0">
1763 <xsl:value-of select="concat($link, '?full=1#book_part',$part,'_chap',$chap)"/>
1764 </xsl:when>
1765 <xsl:otherwise>
1766 <xsl:value-of select="concat($link, '?full=1')"/>
1767 </xsl:otherwise>
1768 </xsl:choose>
1769 </xsl:variable>
1770 <a title="{$ShowFullHBTip}" class="altlink" href="{$href}"><xsl:value-of select="func:gettext('ShowFullHB')"/></a>
1771 </p>
1772 </td>
1773 </tr>
1774 </xsl:if>
1775 <xsl:if test="/book/date or /guide/date or /sections/date or /mainpage/date or /news/date">
1776 <tr>
1777 <td class="topsep">
1778 <!-- Test for RTL languages -->
1779 <xsl:choose>
1780 <xsl:when test="$RTL='Y'">
1781 <xsl:attribute name="dir">RTL</xsl:attribute>
1782 </xsl:when>
1783 <xsl:otherwise>
1784 <xsl:attribute name="align">center</xsl:attribute>
1785 </xsl:otherwise>
1786 </xsl:choose>
1787
1788 <p class="alttext">
1789 <xsl:call-template name="contentdate"/>
1790 </p>
1791 </td>
1792 </tr>
1793 <xsl:if test="/book/date or /guide/date or /sections/date or /mainpage/date">
1794 <xsl:variable name="outdated">
1795 <xsl:call-template name="outdated-translation"/>
1796 </xsl:variable>
1797 <xsl:if test="string-length($outdated) &gt; 1">
1798 <tr>
1799 <td class="topsep">
1800 <!-- Test for RTL languages -->
1801 <xsl:choose>
1802 <xsl:when test="$RTL='Y'">
1803 <xsl:attribute name="dir">RTL</xsl:attribute>
1804 </xsl:when>
1805 <xsl:otherwise>
1806 <xsl:attribute name="align">left</xsl:attribute>
1807 </xsl:otherwise>
1808 </xsl:choose>
1809
1810 <p class="alttext">
1811 <b><xsl:copy-of select="$outdated"/></b>
1812 </p>
1813 </td>
1814 </tr>
1815 </xsl:if>
1816 </xsl:if>
1817 </xsl:if>
1818 <xsl:if test="abstract or document(include/@href)/*[1]/abstract">
1819 <tr>
1820 <td class="topsep">
1821 <!-- Test for RTL languages -->
1822 <xsl:choose>
1823 <xsl:when test="$RTL='Y'">
1824 <xsl:attribute name="dir">RTL</xsl:attribute>
1825 </xsl:when>
1826 <xsl:otherwise>
1827 <xsl:attribute name="align">left</xsl:attribute>
1828 </xsl:otherwise>
1829 </xsl:choose>
1830
1831 <p class="alttext">
1832 <!-- Abstract (summary) of the document -->
1833 <b><xsl:value-of select="func:gettext('Summary')"/>: </b>
1834 <xsl:choose>
1835 <xsl:when test="abstract">
1836 <xsl:value-of select="abstract" />
1837 </xsl:when>
1838 <xsl:otherwise>
1839 <xsl:value-of select="document(include/@href)/*[1]/abstract" />
1840 </xsl:otherwise>
1841 </xsl:choose>
1842 </p>
1843 </td>
1844 </tr>
1845 </xsl:if>
1846 <xsl:if test="/book/author or /guide/author">
1847 <tr>
1848 <td align="left" class="topsep">
1849 <p class="alttext">
1850 <!-- Authors -->
1851 <xsl:apply-templates select="/guide/author|/book/author"/>
1852 </p>
1853 </td>
1854 </tr>
1855 </xsl:if>
1856
1857 <tr lang="en">
1858 <td align="center" class="topsep">
1859 <p class="alttext">
1860 <b>Donate</b> to support our development efforts.
1861 </p>
1862
1863 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1864 <input type="hidden" name="cmd" value="_xclick"/>
1865 <input type="hidden" name="business" value="paypal@gentoo.org"/>
1866 <input type="hidden" name="item_name" value="Gentoo Linux Support"/>
1867 <input type="hidden" name="item_number" value="1000"/>
1868 <input type="hidden" name="image_url" value="/images/paypal.png"/>
1869 <input type="hidden" name="no_shipping" value="1"/>
1870 <input type="hidden" name="return" value="http://www.gentoo.org"/>
1871 <input type="hidden" name="cancel_return" value="http://www.gentoo.org"/>
1872
1873 <input type="image" src="http://images.paypal.com/images/x-click-but21.gif" name="submit" alt="Donate to Gentoo"/>
1874 </form>
1875 </td>
1876 </tr>
1877 <xsl:call-template name="ads">
1878 <xsl:with-param name="images" select="$images"/>
1879 </xsl:call-template>
1880 <tr>
1881 <td align="center" class="topsep"/>
1882 </tr>
1883 </table>
1884 </xsl:template>
1885
1886 <xsl:template name="newscontent">
1887 <xsl:param name="thenews"/>
1888 <xsl:param name="summary"/>
1889 <xsl:param name="link"/>
1890
1891 <div class="news">
1892 <p class="newshead" lang="en">
1893 <b><xsl:value-of select="$thenews/title"/></b>
1894 <br/>
1895 <font size="0.90em">
1896 <xsl:choose>
1897 <xsl:when test="$thenews/until">
1898 Posted between <xsl:copy-of select="func:format-date($thenews/date)"/> and <xsl:copy-of select="func:format-date($thenews/until)"/>
1899 </xsl:when>
1900 <xsl:otherwise>
1901 Posted on <xsl:copy-of select="func:format-date($thenews/date)"/>
1902 </xsl:otherwise>
1903 </xsl:choose>
1904 <xsl:variable name="poster">
1905 <xsl:call-template name="smart-mail">
1906 <xsl:with-param name="mail" select="$thenews/poster"/>
1907 </xsl:call-template>
1908 </xsl:variable>
1909 by <xsl:value-of select="$poster"/>
1910 </font>
1911 </p>
1912
1913 <xsl:choose>
1914 <xsl:when test="$thenews/@category='gentoo'">
1915 <img class="newsicon" src="/images/icon-gentoo.png" alt="gentoo"/>
1916 </xsl:when>
1917 <xsl:when test="$thenews/@category='main'">
1918 <img class="newsicon" src="/images/icon-stick.png" alt="stick man"/>
1919 </xsl:when>
1920 <xsl:when test="$thenews/@category='linux'">
1921 <img class="newsicon" src="/images/icon-penguin.png" alt="tux"/>
1922 </xsl:when>
1923 <xsl:when test="$thenews/@category='moo'">
1924 <img class="newsicon" src="/images/icon-cow.png" alt="Larry the Cow"/>
1925 </xsl:when>
1926 <xsl:when test="$thenews/@category='plans'">
1927 <img class="newsicon" src="/images/icon-clock.png" alt="Clock"/>
1928 </xsl:when>
1929 <xsl:when test="$thenews/@category='planet'">
1930 <img class="newsicon" src="/images/G-Earth.png" alt="Planet Earth"/>
1931 </xsl:when>
1932 <!-- old ones, kept to display very very old news items -->
1933 <xsl:when test="$thenews/@category='alpha'">
1934 <img class="newsicon" src="/images/icon-alpha.gif" alt="AlphaServer GS160"/>
1935 </xsl:when>
1936 <xsl:when test="$thenews/@category='kde'">
1937 <img class="newsicon" src="/images/icon-kde.png" alt="KDE"/>
1938 </xsl:when>
1939 <xsl:when test="$thenews/@category='ibm'">
1940 <img class="newsicon" src="/images/icon-ibm.gif" alt="ibm"/>
1941 </xsl:when>
1942 <xsl:when test="$thenews/@category='nvidia'">
1943 <img class="newsicon" src="/images/icon-nvidia.png" alt="Nvidia"/>
1944 </xsl:when>
1945 <xsl:when test="$thenews/@category='freescale'">
1946 <img class="newsicon" src="/images/icon-freescale.gif" alt="Freescale Semiconductor"/>
1947 </xsl:when>
1948 </xsl:choose>
1949
1950 <div class="newsitem">
1951 <xsl:choose>
1952 <xsl:when test="$thenews/summary and $summary='yes'">
1953 <xsl:apply-templates select="$thenews/summary"/>
1954 <br/>
1955 <a href="{$link}"><b>(full story)</b></a>
1956 </xsl:when>
1957 <xsl:when test="$thenews/body">
1958 <xsl:apply-templates select="$thenews/body"/>
1959 </xsl:when>
1960 </xsl:choose>
1961 </div>
1962 </div>
1963 </xsl:template>
1964
1965 </xsl:stylesheet>

  ViewVC Help
Powered by ViewVC 1.1.20