[8e1efd0] | 1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 2 |
|
---|
[276015d2] | 3 | <!--
|
---|
| 4 | $LastChangedBy$
|
---|
| 5 | $Date$
|
---|
| 6 | -->
|
---|
| 7 |
|
---|
[8e1efd0] | 8 | <!-- Create a list of upstream URLs for packages and patches to be used
|
---|
| 9 | with wget. -->
|
---|
| 10 |
|
---|
| 11 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 12 | version="1.0">
|
---|
| 13 |
|
---|
| 14 | <xsl:output method="text"/>
|
---|
| 15 |
|
---|
[7818e780] | 16 | <!-- Define the generated wget file type:
|
---|
| 17 | ftpmirror - the one used to check FTP mirrors (default)
|
---|
| 18 | full - the one used to test all download links found in the book
|
---|
| 19 | -->
|
---|
| 20 | <xsl:param name="list_mode" select="ftpmirror"/>
|
---|
| 21 |
|
---|
[8e1efd0] | 22 | <xsl:template match="/">
|
---|
[7818e780] | 23 | <xsl:choose>
|
---|
| 24 | <xsl:when test="$list_mode = 'full'">
|
---|
| 25 | <xsl:apply-templates select="//ulink" mode="full"/>
|
---|
| 26 | </xsl:when>
|
---|
| 27 | <xsl:otherwise>
|
---|
| 28 | <xsl:apply-templates select="//itemizedlist"/>
|
---|
| 29 | </xsl:otherwise>
|
---|
| 30 | </xsl:choose>
|
---|
[8e1efd0] | 31 | </xsl:template>
|
---|
| 32 |
|
---|
| 33 | <xsl:template match="itemizedlist">
|
---|
| 34 | <xsl:choose>
|
---|
| 35 | <!-- If both http and ftp URLs are available, output the ftp one if not empty,
|
---|
| 36 | otherwise output the http URL.-->
|
---|
| 37 | <xsl:when test="contains(listitem[1]/para,'(HTTP)')
|
---|
| 38 | and contains(listitem[2]/para,'(FTP)')">
|
---|
| 39 | <xsl:choose>
|
---|
| 40 | <xsl:when test="string-length(listitem[2]/para/ulink/@url) > '10'">
|
---|
| 41 | <xsl:apply-templates select="listitem[2]/para/ulink"/>
|
---|
| 42 | </xsl:when>
|
---|
| 43 | <xsl:otherwise>
|
---|
| 44 | <xsl:apply-templates select="listitem[1]/para/ulink"/>
|
---|
| 45 | </xsl:otherwise>
|
---|
| 46 | </xsl:choose>
|
---|
| 47 | </xsl:when>
|
---|
| 48 | <!-- Additional packages and patches.-->
|
---|
| 49 | <xsl:otherwise>
|
---|
| 50 | <xsl:apply-templates select="listitem/para/ulink"/>
|
---|
| 51 | </xsl:otherwise>
|
---|
| 52 | </xsl:choose>
|
---|
| 53 | </xsl:template>
|
---|
| 54 |
|
---|
| 55 | <xsl:template match="listitem/para/ulink">
|
---|
[7818e780] | 56 | <!-- The next strings need be revised periodically to add missing
|
---|
| 57 | files or to skip false positives. Skip also possible
|
---|
| 58 | duplicated URLs that may be splitted for PDF output -->
|
---|
| 59 | <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
|
---|
| 60 | or contains(@url, '.tgz') or contains(@url, '.tar')
|
---|
| 61 | or contains(@url, 'patch.txt') or contains(@url, '.zip')
|
---|
| 62 | or contains(@url, '.patch') or contains(@url, '/patch.'))
|
---|
| 63 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
[8e1efd0] | 64 | <xsl:choose>
|
---|
| 65 | <!-- Fix SourceForge links-->
|
---|
| 66 | <xsl:when test="contains(@url,'?download')">
|
---|
| 67 | <xsl:value-of select="substring-before(@url,'?download')"/>
|
---|
| 68 | </xsl:when>
|
---|
| 69 | <xsl:otherwise>
|
---|
| 70 | <xsl:value-of select="@url"/>
|
---|
| 71 | </xsl:otherwise>
|
---|
| 72 | </xsl:choose>
|
---|
| 73 | <xsl:text>
</xsl:text>
|
---|
| 74 | </xsl:if>
|
---|
| 75 | </xsl:template>
|
---|
| 76 |
|
---|
[7818e780] | 77 | <xsl:template match="ulink" mode="full">
|
---|
| 78 | <!-- The next strings need be revised periodically to add missing
|
---|
| 79 | files or to skip false positives. Skip also possible
|
---|
| 80 | duplicated URLs that may be splitted for PDF output -->
|
---|
| 81 | <xsl:if test="(contains(@url, '.gz') or contains(@url, '.bz2')
|
---|
| 82 | or contains(@url, '.tgz') or contains(@url, '.tar')
|
---|
| 83 | or contains(@url, '.txt') or contains(@url, 'compressdoc')
|
---|
| 84 | or contains(@url, '.zip') or contains(@url, '.patch')
|
---|
| 85 | or contains(@url, '/patch.') or contains(@url, 'md5sums')
|
---|
| 86 | or contains(@url, 'mozconfig'))
|
---|
| 87 | and not(contains(@url, '?url'))
|
---|
| 88 | and not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 89 | <!-- To list all URls, included html files, wiki pages, home pages, and
|
---|
| 90 | mailto: links, comment-out the above xsl:if and uncomment the next one. -->
|
---|
| 91 | <!--
|
---|
| 92 | <xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 93 | -->
|
---|
| 94 | <xsl:value-of select="@url"/>
|
---|
| 95 | <xsl:text>
</xsl:text>
|
---|
| 96 | </xsl:if>
|
---|
| 97 | </xsl:template>
|
---|
[8e1efd0] | 98 |
|
---|
[7818e780] | 99 | </xsl:stylesheet>
|
---|