[xsl] Sorting XML and select top 10

Subject: [xsl] Sorting XML and select top 10
From: gerritjan <gerritjankoekkoek@xxxxxxx>
Date: Wed, 12 Jan 2005 21:09:06 +0100
I would like to sort an XML source. Then select the first 10 of the sorted list being the 10 newest articles
I've come up with this XSLT so far, but it does not work (it sorts on 'onderwerp', the subject of the for-each)
<xsl:template match="onderwerpen" >
<xsl:variable name="teller">0</xsl:variable>
<xsl:for-each select="onderwerp">
<xsl:sort select="onderwerp/@datum" order="descending"/>
<xsl:if test="$teller &lt;= 10">
<xsl:variable name="teller"><xsl:value-of select="$teller+1"/></xsl:variable>
<xsl:value-of select="@titel"/>
<xsl:value-of select="@menu"/>
<xsl:value-of select="@beveiliging"/>
<xsl:value-of select="@bestand"/>
<xsl:apply-templates select="inleidingtekst"/>
<xsl:value-of select="@datum"/>

Anybody having suggestions how to do this?

Gerritjan Koekkoek

Current Thread