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

XSL pagination question

Subject: XSL pagination question
From: "Ray Masa" <raymasa@xxxxxxxxxxx>
Date: Mon, 02 Apr 2007 01:18:20 -0700
 XSL pagination question
Hello all,

I need to paginate XML feed using XSL. I found a way to do it at http://www.codeproject.com/Purgatory/pagination.asp and using the way described, I have been able to make it work, except for one thing. When I click on the previous and next link, the page does not retrieve the next (or previous data). The page refreshes to the same page (showing the same data) again, even thou the URL is changed correctly.

XSL I am using is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="3.2" encoding="ISO-8859-1"/>
<xsl:param name="Page" select="0" />
<xsl:param name="PageSize" select="1" />
<xsl:template name="results" match="/">


<xsl:variable name="mycount" select="count(root/customer)"/>
<xsl:variable name="selectedRowCount" select="round($mycount div $PageSize)"/>


     	<xsl:for-each select="root/customer">
       <!-- Pagination logic -->
       <xsl:if test="position() >= ($Page * $PageSize) + 1">
        <xsl:if test="position() <= $PageSize + ($PageSize * $Page)">

<!-- Do display here -->

        </xsl:if>
       </xsl:if>
      </xsl:for-each>


<!-- Prev link for pagination -->
<xsl:choose>
<xsl:when test="number($Page)-1 >= 0">
<A>
<xsl:attribute name="href">page.php?page=<xsl:value-of select="number($Page)-1"/>&pagesize=<xsl:value-of select="$PageSize"/>
</xsl:attribute>
<<Prev
</A>
</xsl:when>
<xsl:otherwise>
<!-- display something else -->
</xsl:otherwise>
</xsl:choose>


      <xsl:if test="$selectedRowCount > 1">
        <b class="blacktext"><xsl:value-of select="number($Page)+1"/> of
	<xsl:value-of select="number($selectedRowCount)"/></b>
      </xsl:if>

<!-- Next link for pagination -->
<xsl:choose>
<xsl:when test="number($Page)+1 < number($selectedRowCount)">
<A>
<xsl:attribute name="href">_dirresult?page=<xsl:value-of select="number($Page)+1"/>&pagesize=<xsl:value-of select="$PageSize"/>
</xsl:attribute>
Next>>
</A>
</xsl:when>
<xsl:otherwise>
<!-- display something else -->
</xsl:otherwise>
</xsl:choose>


    </xsl:template>
</xsl:stylesheet>


Any ideas why the next (or previous) data is not being show?


Thank you for your help.

Ray

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


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-2011 All Rights Reserved.