[a804944] | 1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
[8e1efd0] | 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 |
|
---|
[7818e780] | 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 |
|
---|
[8e1efd0] | 17 | <xsl:template match="/">
|
---|
[7818e780] | 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>
|
---|
[8e1efd0] | 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>
|
---|
[725d5f8] | 35 | <xsl:when test="string-length(listitem[2]/para/ulink/@url) > '10'">
|
---|
| 36 | <xsl:apply-templates select="listitem[2]/para/ulink"/>
|
---|
[8e1efd0] | 37 | </xsl:when>
|
---|
| 38 | <xsl:otherwise>
|
---|
[725d5f8] | 39 | <xsl:apply-templates select="listitem[1]/para/ulink"/>
|
---|
[8e1efd0] | 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">
|
---|
[7818e780] | 51 | <!-- The next strings need be revised periodically to add missing
|
---|
| 52 | files or to skip false positives. Skip also possible
|
---|
[0f27fb5] | 53 | duplicated URLs that may be split for PDF output -->
|
---|
[7818e780] | 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')">
|
---|
[8e1efd0] | 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>
|
---|
[a804944] | 68 | <xsl:text>
|
---|
| 69 | </xsl:text>
|
---|
[8e1efd0] | 70 | </xsl:if>
|
---|
| 71 | </xsl:template>
|
---|
| 72 |
|
---|
[7818e780] | 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
|
---|
[0f27fb5] | 76 | duplicated URLs that may be split for PDF output -->
|
---|
[7818e780] | 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"/>
|
---|
[a804944] | 91 | <xsl:text>
|
---|
| 92 | </xsl:text>
|
---|
[7818e780] | 93 | </xsl:if>
|
---|
| 94 | </xsl:template>
|
---|
[8e1efd0] | 95 |
|
---|
[7818e780] | 96 | </xsl:stylesheet>
|
---|