xsl-list
[Top] [All Lists]

[xsl] why no prev / next link

2012-01-13 02:21:50


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

                                          
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>