xsl-list
[Top] [All Lists]

[xsl] XSL pagination question

2007-04-02 01:21:16
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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] XSL pagination question, Ray Masa <=