[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 |
|
---|
| 19 | <xsl:template match="/">
|
---|
| 20 | <xsl:apply-templates select="//ulink"/>
|
---|
| 21 | </xsl:template>
|
---|
| 22 |
|
---|
| 23 | <xsl:template match="ulink">
|
---|
| 24 | <!-- If some package don't have the predefined strings in their
|
---|
| 25 | name, the next test must be fixed to match it also. Skip possible
|
---|
| 26 | duplicated URLs due that may be splitted for PDF output -->
|
---|
| 27 | <xsl:if test="(ancestor::varlistentry[@condition=$model]
|
---|
| 28 | or not(ancestor::varlistentry[@condition])) and
|
---|
[37002ae] | 29 | (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
---|
| 30 | contains(@url, '.tgz') or contains(@url, '.patch')) and
|
---|
[ebf8265] | 31 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 32 | <!-- Extract the package name -->
|
---|
| 33 | <xsl:variable name="package">
|
---|
| 34 | <xsl:call-template name="package.name">
|
---|
| 35 | <xsl:with-param name="url" select="@url"/>
|
---|
| 36 | </xsl:call-template>
|
---|
| 37 | </xsl:variable>
|
---|
| 38 | <!-- Extract the directory for that package -->
|
---|
| 39 | <xsl:variable name="cut"
|
---|
| 40 | select="translate(substring-after($package, '-'),
|
---|
| 41 | '0123456789', '0000000000')"/>
|
---|
| 42 | <xsl:variable name="package2">
|
---|
| 43 | <xsl:value-of select="substring-before($package, '-')"/>
|
---|
| 44 | <xsl:text>-</xsl:text>
|
---|
| 45 | <xsl:value-of select="$cut"/>
|
---|
| 46 | </xsl:variable>
|
---|
| 47 | <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
|
---|
[f221c2c] | 48 | <!-- Write the upstream URLs, fixing the redirected ones -->
|
---|
[26053c4] | 49 | <xsl:choose>
|
---|
| 50 | <xsl:when test="contains(@url,'?')">
|
---|
[f221c2c] | 51 | <xsl:value-of select="substring-before(@url,'?')"/>
|
---|
[26053c4] | 52 | </xsl:when>
|
---|
| 53 | <xsl:otherwise>
|
---|
| 54 | <xsl:value-of select="@url"/>
|
---|
| 55 | </xsl:otherwise>
|
---|
| 56 | </xsl:choose>
|
---|
[15cad16] | 57 | <xsl:text> </xsl:text>
|
---|
[26053c4] | 58 | <!-- Write FTP mirror URLs -->
|
---|
[ebf8265] | 59 | <xsl:value-of select="$server"/>
|
---|
[a9ca77f] | 60 | <xsl:text>/pub/</xsl:text>
|
---|
| 61 | <xsl:value-of select="$family"/>
|
---|
| 62 | <xsl:text>/conglomeration/</xsl:text>
|
---|
[ebf8265] | 63 | <xsl:choose>
|
---|
[046d5c3] | 64 | <!-- Fix some directories. Test against $dirname to be sure that we
|
---|
| 65 | are matching the start of a package name, not a string in a patch name
|
---|
| 66 | But some packages requires test against $package. -->
|
---|
[e071571] | 67 | <xsl:when test="contains($dirname, 'bash')">
|
---|
[ebf8265] | 68 | <xsl:text>bash/</xsl:text>
|
---|
| 69 | </xsl:when>
|
---|
[9be4494] | 70 | <xsl:when test="contains($package, 'dvhtool')">
|
---|
| 71 | <xsl:text>dvhtool/</xsl:text>
|
---|
| 72 | </xsl:when>
|
---|
[e071571] | 73 | <xsl:when test="contains($dirname, 'gcc')">
|
---|
[c03b616] | 74 | <xsl:text>gcc/</xsl:text>
|
---|
| 75 | </xsl:when>
|
---|
[e071571] | 76 | <xsl:when test="contains($dirname, 'glibc')">
|
---|
[7453f74] | 77 | <xsl:text>glibc/</xsl:text>
|
---|
| 78 | </xsl:when>
|
---|
[046d5c3] | 79 | <xsl:when test="contains($package, 'powerpc-utils')">
|
---|
| 80 | <xsl:text>powerpc-utils/</xsl:text>
|
---|
| 81 | </xsl:when>
|
---|
[4887f67] | 82 | <xsl:when test="contains($package, 'tcl')">
|
---|
[7453f74] | 83 | <xsl:text>tcl/</xsl:text>
|
---|
| 84 | </xsl:when>
|
---|
[a9ca77f] | 85 | <xsl:when test="contains($package, 'uClibc')">
|
---|
[c03b616] | 86 | <xsl:text>uClibc/</xsl:text>
|
---|
| 87 | </xsl:when>
|
---|
[e071571] | 88 | <xsl:when test="contains($dirname, 'udev')">
|
---|
[ee5e8f0] | 89 | <xsl:text>udev/</xsl:text>
|
---|
| 90 | </xsl:when>
|
---|
[ebf8265] | 91 | <xsl:otherwise>
|
---|
| 92 | <xsl:value-of select="$dirname"/>
|
---|
| 93 | <xsl:text>/</xsl:text>
|
---|
| 94 | </xsl:otherwise>
|
---|
| 95 | </xsl:choose>
|
---|
| 96 | <xsl:value-of select="$package"/>
|
---|
[26053c4] | 97 | <!-- Write MD5SUM value -->
|
---|
| 98 | <xsl:text> </xsl:text>
|
---|
[a3a1394] | 99 | <xsl:value-of select="../..//para/literal"/>
|
---|
[ebf8265] | 100 | <xsl:text>
</xsl:text>
|
---|
| 101 | </xsl:if>
|
---|
| 102 | </xsl:template>
|
---|
| 103 |
|
---|
| 104 | <xsl:template name="package.name">
|
---|
| 105 | <xsl:param name="url"/>
|
---|
| 106 | <xsl:choose>
|
---|
| 107 | <xsl:when test="contains($url, '/')">
|
---|
| 108 | <xsl:call-template name="package.name">
|
---|
| 109 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
| 110 | </xsl:call-template>
|
---|
| 111 | </xsl:when>
|
---|
| 112 | <xsl:otherwise>
|
---|
| 113 | <xsl:choose>
|
---|
| 114 | <xsl:when test="contains($url, '?')">
|
---|
| 115 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
| 116 | </xsl:when>
|
---|
| 117 | <xsl:otherwise>
|
---|
| 118 | <xsl:value-of select="$url"/>
|
---|
| 119 | </xsl:otherwise>
|
---|
| 120 | </xsl:choose>
|
---|
| 121 | </xsl:otherwise>
|
---|
| 122 | </xsl:choose>
|
---|
| 123 | </xsl:template>
|
---|
| 124 |
|
---|
| 125 | </xsl:stylesheet>
|
---|