source: stylesheets/wget-list.xsl

trunk
Last change on this file was a804944, checked in by Pierre Labastie <pierre.labastie@…>, 3 months ago

Remove all "&#" characters and replace with utf-8

  • Property mode set to 100644
File size: 3.6 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
2
3<!-- Create a list of upstream URLs for packages and patches to be used
4 with wget. -->
5
6<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 version="1.0">
8
9 <xsl:output method="text"/>
10
11 <!-- Define the generated wget file type:
12 ftpmirror - the one used to check FTP mirrors (default)
13 full - the one used to test all download links found in the book
14 -->
15 <xsl:param name="list_mode" select="ftpmirror"/>
16
17 <xsl:template match="/">
18 <xsl:choose>
19 <xsl:when test="$list_mode = 'full'">
20 <xsl:apply-templates select="//ulink" mode="full"/>
21 </xsl:when>
22 <xsl:otherwise>
23 <xsl:apply-templates select="//itemizedlist"/>
24 </xsl:otherwise>
25 </xsl:choose>
26 </xsl:template>
27
28 <xsl:template match="itemizedlist">
29 <xsl:choose>
30 <!-- If both http and ftp URLs are available, output the ftp one if not empty,
31 otherwise output the http URL.-->
32 <xsl:when test="contains(listitem[1]/para,'(HTTP)')
33 and contains(listitem[2]/para,'(FTP)')">
34 <xsl:choose>
35 <xsl:when test="string-length(listitem[2]/para/ulink/@url) &gt; '10'">
36 <xsl:apply-templates select="listitem[2]/para/ulink"/>
37 </xsl:when>
38 <xsl:otherwise>
39 <xsl:apply-templates select="listitem[1]/para/ulink"/>
40 </xsl:otherwise>
41 </xsl:choose>
42 </xsl:when>
43 <!-- Additional packages and patches.-->
44 <xsl:otherwise>
45 <xsl:apply-templates select="listitem/para/ulink"/>
46 </xsl:otherwise>
47 </xsl:choose>
48 </xsl:template>
49
50 <xsl:template match="listitem/para/ulink">
51 <!-- The next strings need be revised periodically to add missing
52 files or to skip false positives. Skip also possible
53 duplicated URLs that may be splitted for PDF output -->
54 <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
55 or contains(@url, '.tgz') or contains(@url, '.tar')
56 or contains(@url, 'patch.txt') or contains(@url, '.zip')
57 or contains(@url, '.patch') or contains(@url, '/patch.'))
58 and not(ancestor-or-self::*/@condition = 'pdf')">
59 <xsl:choose>
60 <!-- Fix SourceForge links-->
61 <xsl:when test="contains(@url,'?download')">
62 <xsl:value-of select="substring-before(@url,'?download')"/>
63 </xsl:when>
64 <xsl:otherwise>
65 <xsl:value-of select="@url"/>
66 </xsl:otherwise>
67 </xsl:choose>
68 <xsl:text>
69</xsl:text>
70 </xsl:if>
71 </xsl:template>
72
73 <xsl:template match="ulink" mode="full">
74 <!-- The next strings need be revised periodically to add missing
75 files or to skip false positives. Skip also possible
76 duplicated URLs that may be splitted for PDF output -->
77 <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
78 or contains(@url, '.tgz') or contains(@url, '.tar')
79 or contains(@url, '.txt') or contains(@url, 'compressdoc')
80 or contains(@url, '.zip') or contains(@url, '.patch')
81 or contains(@url, '/patch.') or contains(@url, 'md5sums')
82 or contains(@url, 'mozconfig'))
83 and not(contains(@url, '?url'))
84 and not(ancestor-or-self::*/@condition = 'pdf')">
85 <!-- To list all URls, included html files, wiki pages, home pages, and
86 mailto: links, comment-out the above xsl:if and uncomment the next one. -->
87 <!--
88 <xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
89 -->
90 <xsl:value-of select="@url"/>
91 <xsl:text>
92</xsl:text>
93 </xsl:if>
94 </xsl:template>
95
96</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.