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

Re: how to limit number of items shown

Subject: Re: how to limit number of items shown
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sun, 31 May 2009 21:38:55 +0530
Re:  how to limit number of items shown
On Sun, May 31, 2009 at 7:15 PM, Dmitri Snytkine <d.snytkine@xxxxxxxxx>
> I was going to try the for-each loop looping over all items
> and then inside the loop have the <xsl:if test="(position() &lt < 11)">
> But I just was not sure if that is the best way to implement the limit of

you can do like this. xsl:for-each select="item[position() ...] and
xsl:if as you have mentioned would produce the same result.

I would prefer item[position() ...] as it looks more cleaner, and
perhaps more efficient (am not sure..?)

> Yes, the for-each is real foreach loop, I mean the XSL does not have a
> real 'for' loop like this:
> B for(i = 0; i<=10; i++){
> }

XSLT doesn't have notion of variables changing the states. So
something like above will not work with XSLT.

you can use patterns like tem[position() ...] or perhaps use recursion
sometimes, to iterate specific number of times.

Mukul Gandhi

Current Thread


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.
First Name
Last Name
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.