Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2010, 05:12 PM
Authorized User
 
Join Date: Apr 2008
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default pagination

Hi,

I have a requirement of pagination, but I am not sure how to achieve this in xslt. The requirement is, I have to display certain amount of records page wise. Each page should contain 5 items.

I have the following input xml:

<students>
<student>
<name/>
<age/>
<rollno/>
</student>
<student>
<name/>
<age/>
<rollno/>
</student>
....
.... the xml has more than 100 student tags

<student>
<name/>
<age/>
<rollno/>
</student>
</students>

I need to output the above xml in the individual pages node with each page node consisting of 5 student records as below:

<records>
<total-students>235</total-students>

<page>
<number>1<number>
<student>
<name/>
<age/>
<rollno/>

</student>

<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>(totally 5 records per page)
</page>
<page>
<number>2..<number>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>
<student>
<name/>
<age/>
<rollno/>

</student>(totally 5 records per page)
</page>

....
....
</records>

I am able to calculate the number of records. Based on number of items per page and number of items I got the number of pages.

But I am not sure how to proceed to achieve that page wise result dynamically based on the input xml. the input xml is dynamic, the number of records in the input xml change. Please suggest me the possible appraoch to achieve this.

thanks,
-irs.
 
Old May 16th, 2010, 07:11 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is the same problem (grouping into fixed size groups) as the problem of arranging data in multiple columns of a table, as described and solved here:

http://www.dpawson.co.uk/xsl/sect2/N7450.html#d10392e19
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
bsridharg (February 3rd, 2012)
 
Old May 19th, 2010, 10:18 PM
Authorized User
 
Join Date: Apr 2008
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you, i got the solution from that link.

-sridhar





Similar Threads
Thread Thread Starter Forum Replies Last Post
pagination implementation vivekkumar_23 Struts 1 July 12th, 2006 05:52 AM
how to use javascript in pagination vijayanmsc XSLT 5 June 8th, 2006 07:22 AM
pagination Regornil Pro JSP 2 May 31st, 2005 06:10 AM
Please.....Pagination junemo PHP Databases 2 September 25th, 2004 01:14 PM
pagination junemo Oracle 0 July 1st, 2004 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.