本站首页
|
代码实验室
|
CSS3 中文参考
|
书籍出版
|
Google 英文翻译版
|
给我留言
文章标题
文章内容
.NET 相关
ASP.NET
ASP.NET MVC
Sliverlight
Linq
C#
F#
VB.NET
Web Services
XML/XSL
.NET FAQ
Web 开发
Internet Explorer
CSS
Javascript
SQL Server
Java应用
友情链接
关于 使用XPathExpression类对XML进行排序 的评论:
评论日期:2004年08月09日 00:00:00
评论人:dsclub
孟子!
网上您是不是再在这里提供一下您的那个用XML+XSL实现的数据分页排序的那份代码!
不胜感激!
评论日期:2007年01月30日 00:00:00
评论人:jevylau
page.xsl
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="size" select="6"/>
<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>
评论日期:2007年01月30日 00:00:00
评论人:jevylau
page.xml
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="page.xsl" ?>
<list name="OOAP">
<item id="1">1</item>
<item id="2">2</item>
<item id="3">3</item>
<item id="4">4</item>
<item id="5">5</item>
<item id="6">6</item>
<item id="7">7</item>
<item id="8">8</item>
<item id="9">9</item>
<item id="10">10</item>
<item id="11">11</item>
<item id="12">12</item>
<item id="13">13</item>
</list>
评论日期:2007年08月17日 00:00:00
评论人:WWW
what?
发表评论:
(由于众所周知的原因,评论需要审核后才能显示,请勿重复发评论。谢谢!!)
标题:
用户名:
内容:
验证码:
请输入右边图像中的文字。