Make wget-list.xsl and md5sums.xsl more robust

Those stylesheets selected download urls by seeking some pattern
in their content. Those patterns may need to be adjusted if a new
type of file is downloaded.

We prefer to seek urls inside <para> containing "Download",
which is the norm in chapter 3. The condition is also that those
<para> are in a <listitem>.
This commit is contained in:
Pierre Labastie
2026-07-15 23:45:46 +02:00
parent 3386ea1ce0
commit e86e9c4f23
2 changed files with 4 additions and 12 deletions

View File

@@ -8,18 +8,14 @@
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//ulink"/>
<xsl:apply-templates select="//listitem/para[contains(string(),'Download')]/ulink"/>
</xsl:template>
<xsl:template match="ulink">
<!-- If some package don't have the predefined strings in their
name, the next test must be fixed to match it also. Skip possible
duplicated URLs that may be split for PDF output -->
<xsl:if test="( (contains( @url, '.tar.' ) and not( ancestor::note ) ) or
contains( @url, '.zip' ) or
contains( @url, '.patch' )
) and
not( ancestor-or-self::*/@condition = 'pdf' )" >
<xsl:if test="not( ancestor-or-self::*/@condition = 'pdf' )" >
<!-- Get the md5sum -->
<xsl:value-of select="../../para/literal"/>

View File

@@ -9,18 +9,14 @@
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="//ulink"/>
<xsl:apply-templates select="//listitem/para[contains(string(),'Download')]/ulink"/>
</xsl:template>
<xsl:template match="ulink">
<!-- If some package don't have the predefined strings in their
name, the next test must be fixed to match it also. Skip possible
duplicated URLs due that may be split for PDF output -->
<xsl:if test="( (contains(@url, '.tar.') and not( ancestor::note ) ) or
contains(@url, '.zip' ) or
contains(@url, '.patch')
) and
not(ancestor-or-self::*/@condition = 'pdf')">
<xsl:if test="not(ancestor-or-self::*/@condition = 'pdf')">
<xsl:choose>
<xsl:when test="contains(@url,'?download')">
<xsl:value-of select="substring-before(@url,'?download')"/>