[ebf8265] | 1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 2 |
|
---|
[ca4c634] | 3 | <!-- $Id$ -->
|
---|
| 4 |
|
---|
[ebf8265] | 5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 6 | version="1.0">
|
---|
| 7 |
|
---|
| 8 | <xsl:output method="text"/>
|
---|
| 9 |
|
---|
| 10 | <!-- The FTP server used as fallback -->
|
---|
| 11 | <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
|
---|
| 12 |
|
---|
[a9ca77f] | 13 | <!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
|
---|
| 14 | <xsl:param name="family">lfs</xsl:param>
|
---|
| 15 |
|
---|
[ebf8265] | 16 | <!-- The libc model used for HLFS -->
|
---|
| 17 | <xsl:param name="model" select="glibc"/>
|
---|
| 18 |
|
---|
[139c34e] | 19 | <!-- The kernel series used for HLFS -->
|
---|
| 20 | <xsl:param name="kernel" select="2.6"/>
|
---|
| 21 |
|
---|
[ebf8265] | 22 | <xsl:template match="/">
|
---|
| 23 | <xsl:apply-templates select="//ulink"/>
|
---|
| 24 | </xsl:template>
|
---|
| 25 |
|
---|
| 26 | <xsl:template match="ulink">
|
---|
| 27 | <!-- If some package don'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="(ancestor::varlistentry[@condition=$model]
|
---|
| 31 | or not(ancestor::varlistentry[@condition])) and
|
---|
[139c34e] | 32 | (ancestor::varlistentry[@vendor=$kernel]
|
---|
| 33 | or not(ancestor::varlistentry[@vendor])) and
|
---|
[37002ae] | 34 | (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
---|
[a7e1348] | 35 | contains(@url, '.tgz') or contains(@url, '.patch') or
|
---|
| 36 | contains(@url, '.xz')) and
|
---|
[ebf8265] | 37 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 38 | <!-- Extract the package name -->
|
---|
| 39 | <xsl:variable name="package">
|
---|
| 40 | <xsl:call-template name="package.name">
|
---|
| 41 | <xsl:with-param name="url" select="@url"/>
|
---|
| 42 | </xsl:call-template>
|
---|
| 43 | </xsl:variable>
|
---|
| 44 | <!-- Extract the directory for that package -->
|
---|
| 45 | <xsl:variable name="cut"
|
---|
| 46 | select="translate(substring-after($package, '-'),
|
---|
| 47 | '0123456789', '0000000000')"/>
|
---|
| 48 | <xsl:variable name="package2">
|
---|
| 49 | <xsl:value-of select="substring-before($package, '-')"/>
|
---|
| 50 | <xsl:text>-</xsl:text>
|
---|
| 51 | <xsl:value-of select="$cut"/>
|
---|
| 52 | </xsl:variable>
|
---|
| 53 | <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
|
---|
[f221c2c] | 54 | <!-- Write the upstream URLs, fixing the redirected ones -->
|
---|
[26053c4] | 55 | <xsl:choose>
|
---|
| 56 | <xsl:when test="contains(@url,'?')">
|
---|
[f221c2c] | 57 | <xsl:value-of select="substring-before(@url,'?')"/>
|
---|
[26053c4] | 58 | </xsl:when>
|
---|
| 59 | <xsl:otherwise>
|
---|
| 60 | <xsl:value-of select="@url"/>
|
---|
| 61 | </xsl:otherwise>
|
---|
| 62 | </xsl:choose>
|
---|
[15cad16] | 63 | <xsl:text> </xsl:text>
|
---|
[26053c4] | 64 | <!-- Write FTP mirror URLs -->
|
---|
[ebf8265] | 65 | <xsl:value-of select="$server"/>
|
---|
[a9ca77f] | 66 | <xsl:text>/pub/</xsl:text>
|
---|
| 67 | <xsl:value-of select="$family"/>
|
---|
| 68 | <xsl:text>/conglomeration/</xsl:text>
|
---|
[ebf8265] | 69 | <xsl:choose>
|
---|
[046d5c3] | 70 | <!-- Fix some directories. Test against $dirname to be sure that we
|
---|
| 71 | are matching the start of a package name, not a string in a patch name
|
---|
| 72 | But some packages requires test against $package. -->
|
---|
[e071571] | 73 | <xsl:when test="contains($dirname, 'bash')">
|
---|
[ebf8265] | 74 | <xsl:text>bash/</xsl:text>
|
---|
| 75 | </xsl:when>
|
---|
[9be4494] | 76 | <xsl:when test="contains($package, 'dvhtool')">
|
---|
| 77 | <xsl:text>dvhtool/</xsl:text>
|
---|
| 78 | </xsl:when>
|
---|
[e071571] | 79 | <xsl:when test="contains($dirname, 'gcc')">
|
---|
[c03b616] | 80 | <xsl:text>gcc/</xsl:text>
|
---|
| 81 | </xsl:when>
|
---|
[e071571] | 82 | <xsl:when test="contains($dirname, 'glibc')">
|
---|
[7453f74] | 83 | <xsl:text>glibc/</xsl:text>
|
---|
| 84 | </xsl:when>
|
---|
[046d5c3] | 85 | <xsl:when test="contains($package, 'powerpc-utils')">
|
---|
| 86 | <xsl:text>powerpc-utils/</xsl:text>
|
---|
| 87 | </xsl:when>
|
---|
[4887f67] | 88 | <xsl:when test="contains($package, 'tcl')">
|
---|
[7453f74] | 89 | <xsl:text>tcl/</xsl:text>
|
---|
| 90 | </xsl:when>
|
---|
[a9ca77f] | 91 | <xsl:when test="contains($package, 'uClibc')">
|
---|
[c03b616] | 92 | <xsl:text>uClibc/</xsl:text>
|
---|
| 93 | </xsl:when>
|
---|
[e071571] | 94 | <xsl:when test="contains($dirname, 'udev')">
|
---|
[ee5e8f0] | 95 | <xsl:text>udev/</xsl:text>
|
---|
| 96 | </xsl:when>
|
---|
[ebf8265] | 97 | <xsl:otherwise>
|
---|
| 98 | <xsl:value-of select="$dirname"/>
|
---|
| 99 | <xsl:text>/</xsl:text>
|
---|
| 100 | </xsl:otherwise>
|
---|
| 101 | </xsl:choose>
|
---|
| 102 | <xsl:value-of select="$package"/>
|
---|
[26053c4] | 103 | <!-- Write MD5SUM value -->
|
---|
| 104 | <xsl:text> </xsl:text>
|
---|
[a3a1394] | 105 | <xsl:value-of select="../..//para/literal"/>
|
---|
[ebf8265] | 106 | <xsl:text>
</xsl:text>
|
---|
| 107 | </xsl:if>
|
---|
| 108 | </xsl:template>
|
---|
| 109 |
|
---|
| 110 | <xsl:template name="package.name">
|
---|
| 111 | <xsl:param name="url"/>
|
---|
| 112 | <xsl:choose>
|
---|
| 113 | <xsl:when test="contains($url, '/')">
|
---|
| 114 | <xsl:call-template name="package.name">
|
---|
| 115 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
| 116 | </xsl:call-template>
|
---|
| 117 | </xsl:when>
|
---|
| 118 | <xsl:otherwise>
|
---|
| 119 | <xsl:choose>
|
---|
| 120 | <xsl:when test="contains($url, '?')">
|
---|
| 121 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
| 122 | </xsl:when>
|
---|
| 123 | <xsl:otherwise>
|
---|
| 124 | <xsl:value-of select="$url"/>
|
---|
| 125 | </xsl:otherwise>
|
---|
| 126 | </xsl:choose>
|
---|
| 127 | </xsl:otherwise>
|
---|
| 128 | </xsl:choose>
|
---|
| 129 | </xsl:template>
|
---|
| 130 |
|
---|
| 131 | </xsl:stylesheet>
|
---|