| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl cd67" xmlns:cd67 ="http://my.functions" >
- <xsl:strip-space elements ="a"/>
- <xsl:template match="result" mode="pagination">
- <xsl:if test="$recordsPerPage < $numberOfRecords">
- <xsl:if test="$pageNumber > 1">
- <xsl:choose>
- <xsl:when test ="$query='*:*'">
- <a class="numeroPagination" href="?start={($pageNumber - 2) * $recordsPerPage}">
- ◁ précédent"
- </a> |
- </xsl:when>
- <xsl:otherwise>
- <a class="numeroPagination" href="?term={$query}&start={($pageNumber - 2) * $recordsPerPage}">
- ◁ précédent
- </a> |
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:call-template name="numerosPaginas">
- <xsl:with-param name="current" select="$pageNumber"/>
- <xsl:with-param name="max">
- <xsl:choose>
- <xsl:when test="(($pageNumber + $cantPages) > $endPage) or ($endPage <= 9)">
- <xsl:value-of select="$endPage" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="($pageNumber + $cantPages)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="number">
- <xsl:choose>
- <xsl:when test="(($pageNumber - $cantPages) < 1) or ($endPage <= 9)">
- <xsl:value-of select="1" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="($pageNumber - $cantPages)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:if test="(($pageNumber ) * $recordsPerPage) < ($numberOfRecords)">
- <xsl:choose>
- <xsl:when test ="$query='*:*'">
- | <a href="?start={($pageNumber) * $recordsPerPage}">
- suivant ▷
- </a>
- </xsl:when>
- <xsl:otherwise>
- | <a href="?term={$query}&start={($pageNumber) * $recordsPerPage}">
- suivant ▷
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- (Nombre de resultats <xsl:value-of select="$numberOfRecords" />)
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="numerosPaginas">
- <xsl:param name="current"/>
- <xsl:param name="number"/>
- <xsl:param name="max"/>
- <xsl:choose>
- <xsl:when test="$number = $current">
- <!-- la page courante n'est pas un lien -->
- <span class="currentPagination">
- <xsl:value-of select="$number"/>
- </span>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test ="$query='*:*'">
- <!--<a class="numeroPagination" href="?start={($number - 1) * $recordsPerPage}">-->
- <a class="numeroPagination">
- <xsl:attribute name="href">
- ?<xsl:value-of select="$paramrecherche" />=<xsl:value-of select="$recherche" /><xsl:value-of select="$extend" />&start=<xsl:value-of select="(($number - 1) * $recordsPerPage)"/>&rows=<xsl:value-of select="$recordsPerPage" /><xsl:apply-templates select="//descendant-or-self::str[@name='fq']|//descendant-or-self::arr[@name='fq']/str" mode="facet" />
- </xsl:attribute>
- <xsl:value-of select="$number"/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <!--<a class="numeroPagination" href="?q={$query}&start={($number - 1) * $recordsPerPage}&rows={$recordsPerPage}">
-
- <xsl:value-of select="$number"/>
- </a>-->
- <a class="numeroPagination">
- <xsl:attribute name="href">
- ?<xsl:value-of select="$paramrecherche" />=<xsl:value-of select="$recherche" /><xsl:value-of select="$extend" />&start=<xsl:value-of select="(($number - 1) * $recordsPerPage)"/>&rows=<xsl:value-of select="$recordsPerPage" /><xsl:apply-templates select="//descendant-or-self::str[@name='fq']|//descendant-or-self::arr[@name='fq']/str" mode="facet" />
- </xsl:attribute>
- <xsl:value-of select="$number"/>
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Appel recursif jusqu'a nb max de page -->
- <xsl:if test="$number < $max">
- <xsl:call-template name="numerosPaginas">
- <xsl:with-param name="current" select="$current"/>
- <xsl:with-param name="number" select="$number+1"/>
- <xsl:with-param name="max" select="$max"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="paginateur">
-
- <xsl:if test="$recordsPerPage < $numberOfRecords">
- <div class="pagination">
- <span>
- <xsl:if test="$pageNumber > 1">
- <xsl:choose>
- <xsl:when test ="$query='*:*'">
- <a class="firstPagination" href="?start={($pageNumber - 2) * $recordsPerPage}">
- ◁ précédent
- </a>
- </xsl:when>
- <xsl:otherwise>
- <a class="firstPagination" >
- <xsl:attribute name="href">?<xsl:value-of select="$paramrecherche" />=<xsl:value-of select="$recherche" /><xsl:value-of select="$extend" />&start=<xsl:value-of select="($pageNumber - 2) * $recordsPerPage"/>&rows=<xsl:value-of select="$recordsPerPage" /><xsl:apply-templates select="//descendant-or-self::str[@name='fq']|//descendant-or-self::arr[@name='fq']/str" mode="facet" />
- </xsl:attribute>
- ◁ précédent
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:call-template name="numerosPaginas">
- <xsl:with-param name="current" select="$pageNumber"/>
- <xsl:with-param name="max">
- <xsl:choose>
- <xsl:when test="(($pageNumber + $cantPages) > $endPage) or ($endPage <= 9)">
- <xsl:value-of select="$endPage" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="($pageNumber + $cantPages)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="number">
- <xsl:choose>
- <xsl:when test="(($pageNumber - $cantPages) < 1) or ($endPage <= 9)">
- <xsl:value-of select="1" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="($pageNumber - $cantPages)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:if test="(($pageNumber ) * $recordsPerPage) < ($numberOfRecords)">
- <xsl:choose>
- <xsl:when test ="$query='*:*'">
- <a class="lastPagination">
- <xsl:attribute name="href">
- ?<xsl:value-of select="$paramrecherche" />=<xsl:value-of select="$recherche" /><xsl:value-of select="$extend" />&start=<xsl:value-of select="($pageNumber * $recordsPerPage)"/>&rows=<xsl:value-of select="$recordsPerPage" /><xsl:apply-templates select="//descendant-or-self::str[@name='fq']|//descendant-or-self::arr[@name='fq']/str" mode="facet" />
- </xsl:attribute>
- suivant ▷
- </a>
-
- </xsl:when>
- <xsl:otherwise>
- <a class="lastPagination">
- <xsl:attribute name="href">
- ?<xsl:value-of select="$paramrecherche" />=<xsl:value-of select="$recherche" /><xsl:value-of select="$extend" />&start=<xsl:value-of select="($pageNumber * $recordsPerPage)"/>&rows=<xsl:value-of select="$recordsPerPage" /><xsl:apply-templates select="//descendant-or-self::str[@name='fq']|//descendant-or-self::arr[@name='fq']/str" mode="facet" />
- </xsl:attribute>
- suivant ▷
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </span>
-
- </div>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
|