wget-list.xsl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <!-- $Id$ -->
  3. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. version="1.0">
  5. <xsl:output method="text"/>
  6. <!-- The FTP server used as fallback -->
  7. <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
  8. <!-- The libc model used for HLFS -->
  9. <xsl:param name="model" select="glibc"/>
  10. <xsl:template match="/">
  11. <xsl:apply-templates select="//ulink"/>
  12. </xsl:template>
  13. <xsl:template match="ulink">
  14. <!-- If some package don't have the predefined strings in their
  15. name, the next test must be fixed to match it also. Skip possible
  16. duplicated URLs due that may be splitted for PDF output -->
  17. <xsl:if test="(ancestor::varlistentry[@condition=$model]
  18. or not(ancestor::varlistentry[@condition])) and
  19. (contains(@url, '.tar.') or contains(@url, '.tgz')
  20. or contains(@url, '.patch')) and
  21. not(ancestor-or-self::*/@condition = 'pdf')">
  22. <!-- Extract the package name -->
  23. <xsl:variable name="package">
  24. <xsl:call-template name="package.name">
  25. <xsl:with-param name="url" select="@url"/>
  26. </xsl:call-template>
  27. </xsl:variable>
  28. <!-- Extract the directory for that package -->
  29. <xsl:variable name="cut"
  30. select="translate(substring-after($package, '-'),
  31. '0123456789', '0000000000')"/>
  32. <xsl:variable name="package2">
  33. <xsl:value-of select="substring-before($package, '-')"/>
  34. <xsl:text>-</xsl:text>
  35. <xsl:value-of select="$cut"/>
  36. </xsl:variable>
  37. <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
  38. <!-- Write the upstream URLs, except the redirected ones -->
  39. <xsl:value-of select="@url"/>
  40. <xsl:text> </xsl:text>
  41. <xsl:text>&#x0a;</xsl:text>
  42. </xsl:if>
  43. </xsl:template>
  44. <xsl:template name="package.name">
  45. <xsl:param name="url"/>
  46. <xsl:choose>
  47. <xsl:when test="contains($url, '/')">
  48. <xsl:call-template name="package.name">
  49. <xsl:with-param name="url" select="substring-after($url, '/')"/>
  50. </xsl:call-template>
  51. </xsl:when>
  52. <xsl:otherwise>
  53. <xsl:choose>
  54. <xsl:when test="contains($url, '?')">
  55. <xsl:value-of select="substring-before($url, '?')"/>
  56. </xsl:when>
  57. <xsl:otherwise>
  58. <xsl:value-of select="$url"/>
  59. </xsl:otherwise>
  60. </xsl:choose>
  61. </xsl:otherwise>
  62. </xsl:choose>
  63. </xsl:template>
  64. </xsl:stylesheet>