[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Confused using a loop...
Subject: Re: [xsl] Confused using a loop... From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 28 Mar 2007 16:30:42 +0100 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Confused using a loop..., Austin, Darrel | Thread | RE: [xsl] Confused using a loop..., Austin, Darrel |
Re: [xsl] Confused using a loop..., Abel Braaksma | Date | Re: [xsl] XSLT parsers in a C/C++ A, M. David Peterson |
Month |
Keywords