Advertisement
Guest User

XSLT pagination attempt

a guest
Oct 21st, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.74 KB | None | 0 0
  1. <xsl:template match="pagination">
  2.         <div class="row-fluid">
  3.           <div class="span12">
  4.             <div class="pagination pagination-centered">
  5.               <ul>
  6.  
  7.                 <xsl:if test="@current-page = 1">
  8.                   <li class="disabled"><a href="#">«</a></li>
  9.                 </xsl:if>
  10.                 <xsl:if test="@current-page != 1">
  11.                   <li><a href="{$root}{$current-path}/?page=1">«</a></li>
  12.                 </xsl:if>
  13.  
  14.                 <xsl:call-template name="iterator">
  15.                   <xsl:with-param name="iterations" select="@total-pages"/>
  16.                   <xsl:with-param name="callback" select="'pagination-component'"/>
  17.                   <xsl:with-param name="callback-params">
  18.                     <current-page><xsl:value-of select="@current-page"/></current-page>
  19.                   </xsl:with-param>
  20.                 </xsl:call-template>
  21.  
  22.                 <xsl:if test="@current-page = @total-pages">
  23.                   <li class="disabled"><a href="#">»</a></li>
  24.                 </xsl:if>
  25.                 <xsl:if test="@current-page != @total-pages">
  26.                   <li><a href="{$root}{$current-path}/?page={@total-pages}">»</a></li>
  27.                 </xsl:if>
  28.  
  29.               </ul>
  30.             </div>
  31.           </div>
  32.         </div>
  33. </xsl:template>
  34.  
  35. <xsl:template name="pagination-component" mode="iterator-callback">
  36.   <xsl:param name="position"/>
  37.   <xsl:if test="current = $position">
  38.                   <li class="disabled"><a href="#"><xsl:value-of select="current-page"/></a></li>
  39.   </xsl:if>
  40.   <xsl:if test="current != $position">
  41.                   <li><a href="{$root}{$current-path}/?page={$position}"><xsl:value-of select="$position"/></a></li>
  42.   </xsl:if>
  43. </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement