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

RE: Using Position() to display results in groups

Subject: RE: Using Position() to display results in groups
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Aug 2001 13:10:22 +0100
xsl display position
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:  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() &lt; 11>
		blah
	</xsl:when>
	<xsl:when test="position() &lt; 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

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.