[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

why no prev / next link

Subject: why no prev / next link
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Fri, 13 Jan 2012 08:21:31 +0000
 why no prev / next link
Hello,



I have now this xslt :



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



<xsl:import href="../utilities/master.xsl"/>
<xsl:import href="../utilities/dagboek-article.xsl"/>



<xsl:param name="total_articles"
select="data/dagboek/pagination/@total-entries" />



<xsl:param name="articles_per_page">
    <xsl:choose>
        <xsl:when test="$page = 1 and $year = 2005 and $month =
04">1</xsl:when>
        <xsl:otherwise>3</xsl:otherwise>
    </xsl:choose>
</xsl:param>



<xsl:param name="number_pages">
    <xsl:choose>
        <xsl:when test="$year = 2005 and $month = 04">3</xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="ceiling($total_articles div
$articles_per_page)" />
        </xsl:otherwise>
    </xsl:choose>
</xsl:param>



<xsl:param name="offset">
    <xsl:choose>
        <xsl:when test="$page = 1 and $year = 2005 and $month =
04">0</xsl:when>
        <xsl:when test="$page &gt; 1 and $year = 2005"><xsl:value-of
select="($page - 1)* $articles_per_page -2" /> </xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="$articles_per_page * $page  -
$articles_per_page " />
        </xsl:otherwise>
    </xsl:choose>
</xsl:param>



<xsl:param name="end" select="$offset + $articles_per_page + 1" />



<xsl:template match="data">
     <xsl:if test=" $page  &lt;= $number_pages " >
       <xsl:apply-templates select="dagboek/entry[position() &gt;
$offset][position() &lt; $end]" />
          <xsl:if test="number_pages &gt; 1">
                 <div class="post-nav">
                     <xsl:choose>
                         <xsl:when test=" $page &gt; 1" >   <span
class="previous"><a href="{$root}/dagboek/{$year}/{$month}/{$page - 1}
">prev</a> </span>
           </xsl:when>
        <xsl:when test="$page &lt; number_pages" >
           <span class="next"> <a
href="{$root}/dagboek/{$year}/{$month}/{$page + 1}">next </a> </span>
        </xsl:when>
        </xsl:choose>
</div>
</xsl:if>
    </xsl:if>
    <xsl:if test=" $page &gt; $number_pages " >
       <xsl:call-template name="error" />
    </xsl:if>
</xsl:template>



</xsl:stylesheet>





But when the variable page has the value 1 and number_pages has the value 3 I
expected that a next link would appear but it don't appear.

Can anyone help me figure out why not ?



Roelof

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.