xsl/atom,rss,podcast: configurable $maxitems

This commit is contained in:
Astro 2012-03-06 18:06:59 +01:00
parent b7da47796c
commit e81598ac55
3 changed files with 6 additions and 3 deletions

View File

@ -13,6 +13,7 @@
indent="yes"/> indent="yes"/>
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable> <xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
<xsl:variable name="maxitems">10</xsl:variable>
<xsl:template match="news"> <xsl:template match="news">
<feed xml:lang="de"> <feed xml:lang="de">
@ -35,7 +36,7 @@
<xsl:for-each select="newsfile"> <xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" /> <xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:variable name="newsfile" select="."/> <xsl:variable name="newsfile" select="."/>
<xsl:if test="(position() &lt;= 10) and <xsl:if test="(position() &lt;= $maxitems) and
starts-with(substring-after(substring-after($newsfile, '/'), '/'), $prefix)"> starts-with(substring-after(substring-after($newsfile, '/'), '/'), $prefix)">
<xsl:for-each select="document($newsfile)/item"> <xsl:for-each select="document($newsfile)/item">

View File

@ -20,6 +20,7 @@
<xsl:include href="common.xsl" /> <xsl:include href="common.xsl" />
<xsl:variable name="baseurl">http://www.c3d2.de/</xsl:variable> <xsl:variable name="baseurl">http://www.c3d2.de/</xsl:variable>
<xsl:variable name="maxitems">23</xsl:variable>
<xsl:param name="selection" select="''"/> <xsl:param name="selection" select="''"/>
<xsl:template match="news"> <xsl:template match="news">
@ -101,7 +102,7 @@
<xsl:for-each select="newsfile"> <xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" /> <xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:if test="position() &lt;= 23"> <xsl:if test="position() &lt;= $maxitems">
<xsl:choose> <xsl:choose>
<xsl:when test="($selection = 'pentaradio' or $selection = 'pentamedia') and <xsl:when test="($selection = 'pentaradio' or $selection = 'pentamedia') and
starts-with(., 'content/news/pentaradio') and starts-with(., 'content/news/pentaradio') and

View File

@ -14,6 +14,7 @@
indent="yes"/> indent="yes"/>
<xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable> <xsl:variable name="baseurl">https://www.c3d2.de/</xsl:variable>
<xsl:variable name="maxitems">10</xsl:variable>
<xsl:template match="news"> <xsl:template match="news">
<xsl:element name="rss"> <xsl:element name="rss">
@ -29,7 +30,7 @@
<xsl:for-each select="newsfile"> <xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" /> <xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
<xsl:variable name="newsfile" select="."/> <xsl:variable name="newsfile" select="."/>
<xsl:if test="(position() &lt;= 10) and <xsl:if test="(position() &lt;= $maxitems) and
starts-with(substring-after(substring-after($newsfile, '/'), '/'), $prefix)"> starts-with(substring-after(substring-after($newsfile, '/'), '/'), $prefix)">
<xsl:apply-templates select="document(.)/item"> <xsl:apply-templates select="document(.)/item">