title: passing parameters in xml
body: <p>i'm trying to implement paging in xml using <a href="http://www.codeproject.com/KB/dotnet/pagination.aspx" rel="nofollow noreferrer">this code</a> and got around to making it work. while it works perfectly, there is a small issue, that when i click on the NEXT button,  it keeps reloading the page with the same initial records. it does not take the user to the next page. </p>
  
  <p>i came across <a href="http://forums.devshed.com/xml-programming-19/xsl-pagination-434508.html" rel="nofollow noreferrer">this link</a> wherein the poster had a similar issue, and it seems from the answers parameters need to be passed. however, the guy in that link was using MM_XSLTransform, while i'm not. hence when i try to implement this code in index.php:</p>
  
  <pre><code>$xsl-&gt;addParameter("Page", $_GET["Page"]);
  $xsl-&gt;addParameter("PageSize", $_GET["PageSize"]);
  </code></pre>
  
  <p>it throws an error:</p>
  
  <pre><code>Fatal error: Call to undefined method XSLTProcessor::addParameter() 
  </code></pre>
  
  <p><strong>UPDATED</strong></p>
  
  <p>php code:</p>
  
  <pre><code>&lt;?php
          error_reporting(E_ALL);
          ini_set("display_errors", 1);
  
              $xmldoc = new DOMDocument();
              if(!file_exists('test.xml')){
                echo "Sorry this file does not exists!";
                exit();
              } else {
                  $xmldoc-&gt;load('test.xml', LIBXML_NOBLANKS);
  
                 // Load up the XSL file
                  $xslDoc = new DomDocument;
                  $xslDoc-&gt;load("test.xsl");
                  $xsl = new XSLTProcessor;
                  $xsl-&gt;importStyleSheet($xslDoc);
  
                  $xsl-&gt;setParameter(null, 'Page', $_GET['Page']);
                  $xsl-&gt;setParameter(null, 'PageSize', $_GET['PageSize']);
  
                  // apply the transformation
                  echo $xsl-&gt;transformToXml($xmldoc);
  
              } 
  ?&gt;
  </code></pre>
  
  <p>xsl:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:output method="html" /&gt;
  
  &lt;!-- XML Parameters --&gt;
  &lt;xsl:param name="Page" select="0" /&gt;
  &lt;xsl:param name="PageSize" select="5" /&gt;
  
  &lt;xsl:template match="/"&gt;
  
  &lt;xsl:variable name="mycount" select="count(root/verse)"/&gt;
  &lt;xsl:variable name="selectedRowCount" select="floor((number($mycount)-1) div $PageSize)+1"/&gt;
  
  &lt;div&gt;
      &lt;div&gt;
          &lt;xsl:value-of select="root/title"/&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;p&gt;&lt;xsl:value-of select="root/introduction"/&gt;&lt;/p&gt;
      &lt;/div&gt;
      &lt;div&gt;
  
              &lt;xsl:for-each select="root/verse"&gt;  
  
                  &lt;xsl:if test="position() &amp;gt;= ($Page * $PageSize) + 1"&gt;
                  &lt;xsl:if test="position() &amp;lt;= $PageSize + ($PageSize * $Page)"&gt;
  
                      &lt;div&gt;&lt;xsl:value-of select="p"/&gt;&lt;/div&gt; &lt;br /&gt;
                      &lt;div&gt;&lt;xsl:value-of select="trla"/&gt;&lt;/div&gt; &lt;br /&gt;
                      &lt;div&gt;&lt;xsl:value-of select="trli"/&gt;&lt;/div&gt; &lt;br /&gt;
  
                  &lt;/xsl:if&gt;
                  &lt;/xsl:if&gt;
              &lt;/xsl:for-each&gt;
  
  
              &lt;!-- Prev link for pagination --&gt;
                &lt;xsl:choose&gt;
                 &lt;xsl:when test="number($Page)-1 &amp;gt;= 0"&gt;&amp;#160;
                  &lt;A&gt;
                   &lt;xsl:attribute name="href"&gt;index.php?page=&lt;xsl:value-of select="number($Page)-1"/&gt;&amp;amp;pagesize=&lt;xsl:value-of select="$PageSize"/&gt;&lt;/xsl:attribute&gt;
                    &amp;lt;&amp;lt;Prev
                  &lt;/A&gt;
                 &lt;/xsl:when&gt;
                 &lt;xsl:otherwise&gt;
                  &lt;!-- display something else --&gt;
                 &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
  
                &lt;xsl:if test="$selectedRowCount &amp;gt; 1"&gt;
                 &amp;#160;&lt;b class="blacktext"&gt;&lt;xsl:value-of select="number($Page)+1"/&gt;&amp;#160;of&amp;#160;&lt;xsl:value-of select="number($selectedRowCount)"/&gt;&lt;/b&gt;&amp;#160;
                &lt;/xsl:if&gt;
  
                &lt;!-- Next link for pagination --&gt;
                &lt;xsl:choose&gt;
                 &lt;xsl:when test="number($Page)+1 &amp;lt; number($selectedRowCount)"&gt;&amp;#160;
                  &lt;A&gt;
                   &lt;xsl:attribute name="href"&gt;index.php?page=&lt;xsl:value-of select="number($Page)+1"/&gt;&amp;amp;pagesize=&lt;xsl:value-of select="$PageSize"/&gt;&lt;/xsl:attribute&gt;
                    Next&amp;gt;&amp;gt;
                  &lt;/A&gt;
                 &lt;/xsl:when&gt;
                 &lt;xsl:otherwise&gt;
                  &lt;!-- display something else --&gt;
                 &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>