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.
|