1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | version="1.0">
|
---|
5 |
|
---|
6 | <xsl:output method="text"/>
|
---|
7 |
|
---|
8 | <!-- The FTP server used as fallback -->
|
---|
9 | <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
|
---|
10 |
|
---|
11 | <!-- Do we use a package manager? -->
|
---|
12 | <xsl:param name="pkgmngt" select="'n'"/>
|
---|
13 |
|
---|
14 | <!-- The system for LFS: sysv of systemd -->
|
---|
15 | <xsl:param name="revision" select="'sysv'"/>
|
---|
16 |
|
---|
17 | <xsl:template match="/">
|
---|
18 | <xsl:apply-templates select="//varlistentry[@revision=$revision
|
---|
19 | or not(@revision)]//ulink"/>
|
---|
20 | <xsl:if test="$pkgmngt='y'">
|
---|
21 | <xsl:apply-templates
|
---|
22 | select="document('packageManager.xml')//ulink"/>
|
---|
23 | </xsl:if>
|
---|
24 | </xsl:template>
|
---|
25 |
|
---|
26 | <xsl:template match="ulink">
|
---|
27 | <!-- If some package doesn't have the predefined strings in their
|
---|
28 | name, the next test must be fixed to match it also. Skip possible
|
---|
29 | duplicated URLs due that may be splitted for PDF output -->
|
---|
30 | <xsl:if test="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
---|
31 | contains(@url, '.tgz') or contains(@url, '.patch') or
|
---|
32 | contains(@url, '.xz') or contains(@url, '.lzma')) and
|
---|
33 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
34 | <!-- Extract the package name -->
|
---|
35 | <xsl:variable name="package">
|
---|
36 | <xsl:call-template name="package.name">
|
---|
37 | <xsl:with-param name="url" select="@url"/>
|
---|
38 | </xsl:call-template>
|
---|
39 | </xsl:variable>
|
---|
40 | <!-- Write the upstream URLs, fixing the redirected ones -->
|
---|
41 | <xsl:choose>
|
---|
42 | <xsl:when test="contains(@url,'?')">
|
---|
43 | <xsl:value-of select="substring-before(@url,'?')"/>
|
---|
44 | </xsl:when>
|
---|
45 | <xsl:otherwise>
|
---|
46 | <xsl:value-of select="@url"/>
|
---|
47 | </xsl:otherwise>
|
---|
48 | </xsl:choose>
|
---|
49 | <!-- Write MD5SUM value -->
|
---|
50 | <xsl:text> </xsl:text>
|
---|
51 | <xsl:value-of select="../following-sibling::para/literal"/>
|
---|
52 | <xsl:text>
</xsl:text>
|
---|
53 | </xsl:if>
|
---|
54 | </xsl:template>
|
---|
55 |
|
---|
56 | <xsl:template name="package.name">
|
---|
57 | <xsl:param name="url"/>
|
---|
58 | <xsl:choose>
|
---|
59 | <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
|
---|
60 | <xsl:call-template name="package.name">
|
---|
61 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
62 | </xsl:call-template>
|
---|
63 | </xsl:when>
|
---|
64 | <xsl:otherwise>
|
---|
65 | <xsl:choose>
|
---|
66 | <xsl:when test="contains($url, '?')">
|
---|
67 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
68 | </xsl:when>
|
---|
69 | <xsl:otherwise>
|
---|
70 | <xsl:value-of select="$url"/>
|
---|
71 | </xsl:otherwise>
|
---|
72 | </xsl:choose>
|
---|
73 | </xsl:otherwise>
|
---|
74 | </xsl:choose>
|
---|
75 | </xsl:template>
|
---|
76 |
|
---|
77 | </xsl:stylesheet>
|
---|