Subject: Re: [xsl] Filtering nodes by using XSL From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 21 Dec 2006 14:45:59 -0500 |
<xsl:for-each select="entry"> <xsl:sort select="date" order="descending"/> <xsl:if test="position() <= 10"> <xsl:apply-templates select="." mode="display"/> </xsl:if> </xsl:for-each>
Cheers, Wendell
Hi all, I have a situation where I need to filter the results of one XML doc into an Atom feed; I'm of course using xslt. The underlying XML represents entries and/or comments in a blog for example, and they want to be able to request the feed and filter using criteria like "show only the last 10 entries". The problem is that last ten is ambiguous. There may be only 7 entries for example. Using dates won't work because I can't know apriori what date would qualify the last n entries. I've got to think some of you have done this kind of filtering before and probably even more robustly. Any suggestions? I'm thinking maybe sorting by date and then using some node operator to pick off the N I need, I'm sort of new to XSLT so I'm not sure of the idioms for this kind of operation. Thanks in advance. -Gregory --
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Suppose you were an idiot, and suppose you were a member of congress; but I repeat myself." - Mark Twain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Filtering nodes by using XSL, Gregory Stone | Thread | [xsl] Are namespace nodes required , Florent Georges |
Re: [xsl] Why does '#' start a comm, Abel Braaksma | Date | Re: [xsl] Why does '#' start a comm, Abel Braaksma |
Month |