source: stylesheets/wget-list.xsl@ eede1a3

11.0 ken/refactor-virt lazarus qt5new trunk
Last change on this file since eede1a3 was ccded7e, checked in by Xi Ruoyao <xry111@…>, 6 months ago

clean up unused SVN prop entries

  • Property mode set to 100644
File size: 3.6 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
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>&#x0a;</xsl:text>
69 </xsl:if>
70 </xsl:template>
71
72 <xsl:template match="ulink" mode="full">
73 <!-- The next strings need be revised periodically to add missing
74 files or to skip false positives. Skip also possible
75 duplicated URLs that may be splitted for PDF output -->
76 <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
77 or contains(@url, '.tgz') or contains(@url, '.tar')
78 or contains(@url, '.txt') or contains(@url, 'compressdoc')
79 or contains(@url, '.zip') or contains(@url, '.patch')
80 or contains(@url, '/patch.') or contains(@url, 'md5sums')
81 or contains(@url, 'mozconfig'))
82 and not(contains(@url, '?url'))
83 and not(ancestor-or-self::*/@condition = 'pdf')">
84 <!-- To list all URls, included html files, wiki pages, home pages, and
85 mailto: links, comment-out the above xsl:if and uncomment the next one. -->
86 <!--
87 <xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
88 -->
89 <xsl:value-of select="@url"/>
90 <xsl:text>&#x0a;</xsl:text>
91 </xsl:if>
92 </xsl:template>
93
94</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.