[求助]xsl分页首页和尾页
以下代码,怎样加首页和尾页:<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www. version="1.0">
<xsl:param name="size" select="5"/>
<xsl:template match="list">
<html>
<script>
<![CDATA[
function nextPage(num){
document.getElementById("content"+num).style.display="";
num--;
document.getElementById("content"+num).style.display="none";
}
function prevPage(num){
document.getElementById("content"+num).style.display="";
num++;
document.getElementById("content"+num).style.display="none";
}
function onInitialize(){
var i = 1;
document.getElementById("content"+i).style.display = "";
}
]]>
</script>
<body onload="onInitialize()">
<xsl:apply-templates select="item[position() mod $size = 1]">
<xsl:with-param name="pages" select="ceiling(count(item) div $size)"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<xsl:param name="pages"/>
<xsl:variable name="page" select="position()"/>
<div id='content{$page}' style="display:'none'" title="content{$page}">
<xsl:for-each select="self::item | following-sibling::item[position()<$size]">
<div><xsl:value-of select="."/></div>
</xsl:for-each>
<div id="navBar">
<xsl:choose>
<xsl:when test="$page = 1">
第<xsl:value-of select="$page" />页---
<a href="#{$page + 1}" onclick="nextPage({$page + 1})">下一页</a>---
共有<xsl:value-of select="$pages" />页
</xsl:when>
<xsl:when test="$page = $pages">
第<xsl:value-of select="$page" />页---
<a href="#{$page - 1}" onclick="prevPage({$page - 1})">上一页</a>---
共有<xsl:value-of select="$pages" />页
</xsl:when>
<xsl:otherwise>
第<xsl:value-of select="$page" />页---
<a href="#{$page - 1}" onclick="prevPage({$page - 1})">上一页</a>---
<a href="#{$page + 1}" onclick="nextPage({$page + 1})">下一页</a>---
共有<xsl:value-of select="$pages" />页
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</xsl:template>
</xsl:stylesheet>