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

Re: Confused using a loop...

Subject: Re: Confused using a loop...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 28 Mar 2007 16:30:42 +0100
Re:  Confused using a loop...
> Well, I'm really not sure. I'm not clear on how sort works. I have a
> select that grabs a node, I then sort that node, then don't I need to
> select the first 3 from that sorted node if I only want to list 3
> items?

If you only select one node, you have nothing to sort (sorting a list of
length 1 is dull)

XSLt seems more natural if you use the terminoligy that it uses 

the idiom you want is

<xsl:for-each select="/an/x/path"/>
<xsl:sort selct="relative/path/to/sort/key"/>
<xsl:if test="position() &lt; 4">
  do something


selects a set of nodes

For each of these nodes relative/path/to/sort/key is evaluated (relative
to that node) to generate a sort key.

The original node set is then ordered in the ordering specified by thos
sort keys and assigned a position (an integer greater than equal to 1)

For those nodes with a position less than 4, you do something.


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.