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

Re: Tricky problem, limiting the number of source elements p

Subject: Re: Tricky problem, limiting the number of source elements processed.
From: "Nikolai Grigoriev" <grig@xxxxxxxxxxx>
Date: Tue, 24 Oct 2000 18:51:06 -0400 (EST)
tricky number problems
Dylan,

> Lets say you have two types of elements, "typeA" and "typeB" that you want
> to display, but you only want to display a maximum number of them, say five.
> More particularly, you want to display as many of typeA as possible, up to
> the limit of five, but if there are less than five typeAs, the remaining
> space should be filled with typeBs.

If you can ensure that typeAs always precede typeBs, then

  select="*[self::typeA or self::typeB][position() &lt;= 5]"

would probably do the trick; otherwise you will need two separate selects:

  select = "typeA[position() &lt;= 5]"
  select = "typeB[position() &lt;= (5 - count(typeA))]"

Best regards,
Nikolai




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.