您的位置:程序门 -> web 开发 -> xml/soap



xml_xs调用脚本问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


xml_xs调用脚本问题
发表于:2007-12-13 23:52:19 楼主
    ==================================================xml文档==================================================
xml code
<?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type="text/xsl" href="1.xsl"?> <students> <student id="98789"> <name>廖西</name> <sex></sex> <birthday type="阳历">1987.2</birthday> <phone>1303456787</phone> <skill>唱歌</skill> <dd>asdf <ee>asdf</ee></dd> <list>asdf</list> </student> <student id="98788"> <name>小记</name> <sex></sex> <birthday>1975.6</birthday> <phone>13901145678</phone> <skill>爬山</skill> </student> <student id="98785"> <name>江南</name> <sex></sex> <birthday>1978.8</birthday> <phone>64576786</phone> <skill>网络</skill> </student> <student> <name>小红</name> <sex></sex> <birthday>1976.2</birthday> <phone>62775466</phone> <skill>网络</skill> <skill>书法</skill> </student> </students>



=======================================================下面是xsl代码.....======================================
xml code
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <center> <h1> 学号是"98789"的学生的生日是: <xsl:value-of select="/students/student[@id='98789']/birthday/@type"/> </h1> 你打开的页面的时间是<xsl:eval language="javascript">time()</xsl:eval> </center> <xsl:script> function time() { today=new date(); inthours=today.gethours(); intminute=today.getminute(); intseconds=today.getseconds(); return inthours+":"+intminute+":"+intseconds; } </xsl:script> </xsl:template> </xsl:stylesheet>



================顺便问一下,如何在xsl里面实现由大到小的排序,我只知道由小到大是 <xsl:sort   select="标签名字"> ===
发表于:2007-12-13 23:53:531楼 得分:0
上面脚本调用不起,谁帮我解答一下
发表于:2007-12-15 20:09:402楼 得分:0
<script   language="javascript"   type="text/javascript">
//     <![cdata[
function   time()
{  
var   inthours,intminute;
today=new   date();
inthours=today.gethours();
//intminute   =   today.getminute();

        intseconds=today.getseconds();
        //return   inthours+":"+intminute+":"+intseconds;
return   inthours+   ":"   +   "怎么不支持getminute()?"+":"   +   intseconds
}
alert(time());
//]]>
</script>
发表于:2007-12-15 20:18:283楼 得分:0
intminute       =       today.getminute();  

--------->

intminute       =       today.getminutes();  
发表于:2007-12-18 10:44:274楼 得分:0
楼主,你xsl从哪看来的?
貌似没这种写法。
你的问题,既可以在html做,也可以在xslt里做,所以不知道你本来的意思是想在哪个阶段来执行。

不过,放在html做是比较合理的。

xml code
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <script language="javascript"> <![cdata[ function time() { today=new date(); inthours=today.gethours(); intminute=today.getminutes(); intseconds=today.getseconds(); return inthours+":"+intminute+":"+intseconds; } ]]> </script> <center> <h1> 学号是"98789"的学生的生日是: <xsl:value-of select="/students/student[@id='98789']/birthday/@type"/> </h1> 你打开的页面的时间是<script language="javascript">time()</script> </center> </xsl:template> </xsl:stylesheet>
发表于:2007-12-18 22:23:445楼 得分:0
谢谢


快速检索

最新资讯
热门点击