[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sorting XML and select top 10

Subject: Sorting XML and select top 10
From: gerritjan <gerritjankoekkoek@xxxxxxx>
Date: Wed, 12 Jan 2005 21:09:06 +0100
select top 10
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>
<item>
<title>
<xsl:value-of select="@titel"/>
</title>
<link>
<xsl:value-of select="@menu"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="@beveiliging"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="@bestand"/>
<xsl:text>.html</xsl:text>
</link>
<xsl:apply-templates select="inleidingtekst"/>
<pubDate>
<xsl:value-of select="@datum"/>
</pubDate>
</item>
</xsl:if>
</xsl:for-each>
</xsl:template>


Anybody having suggestions how to do this?

Gerritjan Koekkoek

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.