Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2007, 04:32 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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>
Reply With Quote
  #2 (permalink)  
Old April 4th, 2007, 05:40 PM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.