Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2007, 04:32 PM
Authorized User
 
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default pagination problem

I found and implemented the following xsl for pagination....can anyone spot why the next and prev links aren't working?
Code:
<?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="10" />

<xsl:template name="results" match="/">
<xsl:variable name="mycount" select="count(web_inventory/item)"/> 
<xsl:variable name="selectedRowCount" select="round($mycount div $PageSize)"/>
      <xsl:for-each select="web_inventory/item">               
       <xsl:if test="position() &gt;= ($Page * $PageSize) + 1">         
       <xsl:if test="position() &lt;= $PageSize + ($PageSize * $Page)">

<div style="margin-left:20%; width:650px">

    <div style="float:left;margin-left:10px;margin-bottom:1em;font-size:10pt; width:300px;">
        <span style="font-weight:bold;color:white; background-color:#999933; display:block;">
        <xsl:value-of select="description"/></span>

      <br/>
    <img border="1" align="center" border-color="black" src="pictures/noImage.jpg"/>
     <br/>
        <xsl:value-of select="description"/>
        <br/>
        <span style="font-style:italic">
          (Your Price:$<xsl:value-of select="Retail"/>)
        </span>
      </div>

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

       <xsl:choose>        
       <xsl:when test="number($Page)-1 &gt;= 0">#160;         
       <A>         
        <xsl:attribute name="href">web_items.xml?page=<xsl:value-of select="number($Page)-1"/>&amp;pagesize=<xsl:value-of select="$PageSize"/></xsl:attribute>&lt;&lt;Prev</A>        
        </xsl:when>        
        <xsl:otherwise>                 
        </xsl:otherwise>       
        </xsl:choose>             
         <xsl:if test="$selectedRowCount &gt; 1">#160;<b class="blacktext">
         <xsl:value-of select="number($Page)+1"/>#160;of#160;
         <xsl:value-of select="number($selectedRowCount)"/></b>#160;       
         </xsl:if>                              
         <xsl:choose>        
         <xsl:when test="number($Page)+1 &lt;=160">#160;<A>         
          <xsl:attribute name="href">web_items.xml?page=<xsl:value-of select="number($Page)+1"/>&amp;pagesize=
          <xsl:value-of select="$PageSize"/>
          </xsl:attribute>Next&gt;&gt;</A>        
          </xsl:when>        
          <xsl:otherwise>                 
          </xsl:otherwise>      
           </xsl:choose>

 </xsl:template>
</xsl:stylesheet>
 
Old April 4th, 2007, 05:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

When the user clicks Next, they're requesting a URL such as

web_items.xml?page=20

The most likely reason it isn't working is that your web server isn't acting on that request. You need to tell us more about your server side configuration.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagination problem nanetsu Other Programming Languages 1 June 12th, 2008 06:12 AM
Problem Regarding Pagination!!!!!!!!!!! mohit_malik555 Pro Java 2 August 3rd, 2006 08:06 AM
Please.....Pagination junemo PHP Databases 2 September 25th, 2004 01:14 PM
Problem with pagination fung Classic ASP Basics 4 August 23rd, 2004 07:42 AM
pagination junemo Oracle 0 July 1st, 2004 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.