满分求救XSL分页、排序问题,高手快快来啊
XML文件:
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="okxrpic.xsl"?>
<okxrpic>
<pic>
<id>1</id>
<name>测试</name>
<type>mxxz</type>
<!--图片地址列表-->
<urls>
<url>images/1.gif</url>
<url>images/2.gif</url>
</urls>
</pic>
<!--回复列表-->
<replys>
<reply>
<!--回复号-->
<replyid>1</replyid>
<!--回复人签名-->
<username>ghb</username>
<!--图片ID-->
<picid>1</picid>
<replytime>2005-12-10</replytime>
<content>回复测试</content>
<replyip>127.0.0.1</replyip>
</reply>
<reply>
<!--回复号-->
<replyid>2</replyid>
<!--回复人签名-->
<username>ghb</username>
<!--图片ID-->
<picid>1</picid>
<replytime>2005-12-10</replytime>
<content>回复测试2</content>
<replyip>127.0.0.1</replyip>
</reply>
<reply>
<!--回复号-->
<replyid>3</replyid>
<!--回复人签名-->
<username>ghb</username>
<!--图片ID-->
<picid>1</picid>
<replytime>2005-12-10</replytime>
<content>回复测试3</content>
<replyip>127.0.0.1</replyip>
</reply>
<reply>
<!--回复号-->
<replyid>4</replyid>
<!--回复人签名-->
<username>ghb</username>
<!--图片ID-->
<picid>1</picid>
<replytime>2005-12-10</replytime>
<content>回复测试4</content>
<replyip>127.0.0.1</replyip>
</reply>
<reply>
<!--回复号-->
<replyid>5</replyid>
<!--回复人签名-->
<username>ghb</username>
<!--图片ID-->
<picid>1</picid>
<replytime>2005-12-10</replytime>
<content>回复测试4</content>
<replyip>127.0.0.1</replyip>
</reply>
</replys>
</okxrpic>
我想提取okxrpic/replys下的内容分页显示,在网上早到如下JS分页函数,但它是对根节点下的元素分页,怎么改成对特定子目录(okxrpic/replys)下的元素分页呢?
//XML分页
function pages(Num)
{
var OnePageNum=2;
var PageNum=1;
var XMLPageNum=1;
stylesheet=document.XSLDocument;
source=document.XMLDocument;
nodes=source.documentElement.childNodes;
len=nodes.length;
for(i=1;i<=(len/OnePageNum);i++);
XMLPageNum=i;
var firstNum=0;
var lastNume=0;
if (Num=="first") {PageNum=1;}
if (Num=="previous") {if (PageNum>1) PageNum -=1;}
if (Num=="next") {if (PageNum<XMLPageNum) PageNum +=1;}
if (Num=="last") {PageNum =XMLPageNum;}
sortField=document.XSLDocument.selectSingleNode("//@expr");
firstNum=OnePageNum*(PageNum-1)+1;
lastNum=OnePageNum*(PageNum-1)+OnePageNum;
text="childnumber(this)>="+firstNum+" & childnumber(this)<="+lastNum;
sortField.value=text;
Layer1.innerHTML=source.documentElement.transformNode(stylesheet);
alert("长度:"+len+"num:"+Num+"sortfield:"+text+"html:"+Layer1.innerHTML);
}