Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6840281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:49:28+00:00 2026-05-26T23:49:28+00:00

I found a script that will allow me to implement previous/next navigation on a

  • 0

I found a script that will allow me to implement previous/next navigation on a web site, but I am not sure if it is correct.

<?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="floor((number($numberOfRecords)-1) div 
$recordsPerPage)+1"/>


  <xsl:for-each select="root/customer">
   <!-- Pagination logic -->
   <xsl:if test="position() &gt;= ($Page * $PageSize) + 1">
    <xsl:if test="position() &lt;= $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 &gt;= 0">&#160;
    <A>
     <xsl:attribute name="href">_dirresult?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>
    <!-- display something else -->
   </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>

  <!-- Next link for pagination -->
  <xsl:choose>
   <xsl:when test="number($Page)+1 &lt; number($selectedRowCount)">&#160;
    <A>
     <xsl:attribute name="href">_dirresult?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>
    <!-- display something else -->
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>
</xsl:stylesheet>

Is this script correct? As far as I can tell, “Do display here” is never reached when you are on page 1 article 1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:49:28+00:00Added an answer on May 26, 2026 at 11:49 pm

    The way to find out whether it works, is to try it out!

    First thing you will need to do, is fix some errors. This variable declaration is simply wrong because it references two other variables that do not exist

    <xsl:variable name="selectedRowCount" 
       select="floor((number($numberOfRecords)-1) div  $recordsPerPage)+1"/>
    

    $numberOfRecords should probably be mycount, and $recordsPerPage should be $PageSize

    From looking at the XSLT, it expects a list of Customer elements, like so…

    <root>
       <customer>Bob 1</customer>
       <customer>Bob 2</customer>
       <customer>Bob 3</customer>
    </root>
    

    Having tried it myself, it does appear to work, but do bear in mind it assumes page numbering starts at 0, not 1, so if you want to display the first page, you set the $Page parameter to 0. Don’t panic though, it will display Page 1 of … in the output.

    So, give it a go, and see how you get on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a TSQL script that will allow me to see the contents of
I've found a great little program that will allow me to add user friendly
I'm trying to work with a jQuery script I found at http://marcgrabanski.com/articles/scrollto-next-article-button-jquery that allows
What I hope to accomplish is write a small jQuery script that will allow
I found this script on pastebin that is an IRC bot that will find
I found a perl script that manages randomizing the wikipedia articles in Wikipedia here
The only reliable method that I a have found for using a script to
I am trying to add functionality to a webpage that will allow the user
I have a shell script that will let me access global variables inside the
We are looking for a script that will traverse in recursive mode all subfolders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.