|
|
 |
|
Title: Result Pagination with XSL
Submitter: Not specified Not specified
(other recipes)
Last Updated: 2002/03/21
Version no: 1.0
Category:
Miscellaneous
|
|
1 vote(s)
|
|
|
|
Description:
My technique for separating Xml results into pages. The great thing is that it is fully implemented in XSL, the bad thing is that you still have to deal with the entire result, even though you are only showing a portion of it.
Source: Text Source
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" />
<xsl:param name="Page" select="0" />
<xsl:param name="PageSize" select="5" />
<xsl:template match="/">
<xsl:for-each select="/TopicList/Topic">
<xsl:if test="position() >= ($Page * $PageSize) + 1">
<xsl:if test="position() <= $PageSize + ($PageSize * $Page)">
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
The license for this recipe is available here.
Discussion:
It's easy to know when to display "previous" and "next" links. Tell me what you think.
|
|
Add comment
|
|
Number of comments: 5
Hey, what the..?, Not specified Not specified, 2002/03/21
I didn't get any credit. Probably because i used Passport sign in. This was submitted by:
Brandon Croft
brandon@gobigfishgo.com
www.gobigfishgo.com
Add comment
next links question for pagination, Zoe Peng, 2002/05/10
Hi,
I got a question here. Please help..
If /TopicList/Topic has over 5 records(let's say 7 records),
I am going to divide it by two pages with next links. (Page1: have 5 records and next link to Page 2)
When I click the next links, it will return the whole /TopicList/Topic again and try to use the same stylesheet to do the transform again.
The question is: when I implement the links, the Page1 is good that return five records and next link. But, after I click the link again, it returns the whole seven records for me. Any ideas? Thanks.
--Zoe
mpeng@atxtelematics.com
Add comment
Next and Previous links?!?!, Rob MacDonald, 2003/01/20
How do you display the next and previous links?!?!?
Add comment
Prev, Next links....., nba scrub, 2003/06/04
So how would you determine when to display prev and next links and making sure the last page doesn't contain a next link ?
Add comment
how to enable caching in apache cocoon, Bhavya Sharma, 2006/09/05
hi Devs
Could u give me any idea that how can we enable caching
Thanks
Bhavya
Add comment
|
|
|
|
|
 |
|