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

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |