[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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() < 4"> do something </xsl:if> </xsl:for-each> /an/x/path 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. David
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|