podcast.xsl: refactor logic for pentamedia.xml

This commit is contained in:
Astro 2011-01-10 00:09:25 +01:00
parent 3ee96ee3af
commit 2135690f4e
3 changed files with 20 additions and 25 deletions

View File

View File

View File

@ -103,37 +103,32 @@
<xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:choose>
<xsl:when test="$selection = 'pentaradio' or $selection = 'pentamedia'">
<xsl:if test="starts-with(., 'content/news/pentaradio') and
<xsl:when test="($selection = 'pentaradio' or $selection = 'pentamedia') and
starts-with(., 'content/news/pentaradio') and
count(document(.)/item/resource) &gt; 0">
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:if>
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$selection = 'pentacast' or $selection = 'pentamedia'">
<xsl:if test="starts-with(., 'content/news/pentacast') and
<xsl:when test="($selection = 'pentacast' or $selection = 'pentamedia') and
starts-with(., 'content/news/pentacast') and
count(document(.)/item/resource) &gt; 0">
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:if>
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$selection = 'pentamusic' or $selection = 'pentamedia'">
<xsl:if test="starts-with(., 'content/news/pentamusic') and
<xsl:when test="($selection = 'pentamusic' or $selection = 'pentamedia') and
starts-with(., 'content/news/pentamusic') and
count(document(.)/item/resource) &gt; 0">
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:if>
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$selection = '' and count(document(.)/item/resource) &gt; 0">
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:if test="count(document(.)/item/resource) &gt; 0">
<xsl:apply-templates select="document(.)/item/resource" mode="preselect">
<xsl:with-param name="newsfile" select="."/>
</xsl:apply-templates>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</channel>