Subject: RE: [xsl] Using Position() to display results in groups From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 20 Aug 2001 13:10:22 +0100 |
Thanks, This would be fine if I knew the size of the list in advance, however it could be several hundred items or it could be just one. Writing ten or so 'when' tests probably isnt the best way to go about this. What is required is some code to iterate through the list, decide if it as the 10th item ( or a multiple of 10) and output some code. If any one can take this pseudocode and turn it into XSL I would be very grateful :) <card id "firstpage"> for each item in list (some wml code) When test=position divided by 10 equals an integer //to locate every tenth item ***main line <a href="#position()">next 10</a> //this code generates a link to the next card </card> //closes the current card <card id="position()"> //starts new one, postion can be used as the names of the links //When </card> //final closing card tag end If you dont get why Im using position for the link names, this is what the produce code would look like: <a href="#10">next 10/a> </card> <card id="10"> ... <a href="#20">next 10/a> </card> <card id="20"> If anyone can help me with that main line, or with a neater solution, please let me know Thanks andrew -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Gavin Corfield Sent: 20 August 2001 06:12 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Using Position() to display results in groups > <card id="firstpage"> > (results 1-10) > <a href="#secondpage">next10</a> > </card> > > <card id="secondpage"> > (results 11-20) > <a href="#thirdpage"> > </a> > > HiAndrew, Use xsl:choose: <xsl:choose> <xsl:when test="position() < 11> blah </xsl:when> <xsl:when test="position() < 21> blah </xsl:when> </xsl:choose> according to the spec the processor will select the first 'when' condition matched according to document order. gavin XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.265 / Virus Database: 137 - Release Date: 18/07/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.265 / Virus Database: 137 - Release Date: 18/07/2001 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using Position() to displ, Gavin Corfield | Thread | Re: [xsl] Using Position() to displ, Jeni Tennison |
[xsl] Re: Break a for-each, Dimitre Novatchev | Date | Re: [xsl] Re^4: ?XSLT Repository?, by way of B. Tommie |
Month |