商讯信箱
用户名: @
密  码:   注册|忘记密码
登录
个人用户经销商
您的位置:首页 > 技术频道 > 正文

XML卷之实战锦囊(2):动态查询

作者:ITPUB论坛  2008-02-22
  search.xsl
<?xml version="1.0" encoding="gb2312" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <head> <title> XML卷之实战锦囊(2):动态查询</title> <style> body,BlueIdea,team,blue_ID,blue_name,blue_text,blue_time,blue_class{ font: 12px "宋体", "Arial", "Times New Roman"; } table { font-size: 12px; border: 0px double; border-color: #99CC99 #99CC99 #CCCCCC #CCCCCC; cellpadding:3;cellspacing:3; bgcolor:#eeeeee; text-decoration: blink} span { font-size: 12px; color: red; } </style> <script> function searchtext(x) { stylesheet=document.XSLDocument; source=document.XMLDocument; sortField=document.XSLDocument.selectNodes("//@select"); if (x!="") { sortField[1].value="team[blue_ID='"+x+"']"; Layer1.innerHTML=source.documentElement.transformNode(stylesheet); } else {alert("请输入筛选条件!");} } </script> </head> <body> <p align="center"><span>XML卷之实战锦囊(2):动态查询</span></p> <div id="Layer1" name="Layer1"> <xsl:apply-templates select="BlueIdea" /> </div> <hr size="1" width="500" /> <table align="center" cellpadding="0" cellspacing="0" border="0" > <tr> <td> <span >请输入筛选条件 : </span> blue_ID= <input type="text" name="searchtext" size="1" maxlength="1" /> <input type="button" class="button" onClick="searchtext(document.all.searchtext.value)" value="Search" name="button" /> </td> </tr> </table> </body> </html> </xsl:template> <xsl:template match="BlueIdea"> <table width="500" border="1" align="center" cellpadding="1" cellspacing="1" bordercolordark="#ffffff" bordercolorlight="#ADAAAD"> <tr bgcolor="#FFCC99" align="center"> <td>编号</td> <td>姓名</td> <td>主题</td> <td>发表时间</td> <td>归类</td> </tr> <xsl:apply-templates select="team" order-by="blue_ID"/> </table> </xsl:template> <xsl:template match="team"> <tr align="center"> <xsl:apply-templates select="blue_ID" /> <xsl:apply-templates select="blue_name" /> <xsl:apply-templates select="blue_text" /> <xsl:apply-templates select="blue_time" /> <xsl:apply-templates select="blue_class" /> </tr> </xsl:template> <xsl:template match="blue_ID"> <td bgcolor="#eeeeee"> <xsl:value-of /> </td> </xsl:template> <xsl:template match="blue_name"> <td> <xsl:value-of /> </td> </xsl:template> <xsl:template match="blue_text"> <td> <xsl:value-of /> </td> </xsl:template> <xsl:template match="blue_time"> <td> <xsl:value-of /> </td> </xsl:template> <xsl:template match="blue_class"> <td> <xsl:value-of /> </td> </xsl:template> </xsl:stylesheet>
1 2 3
【内容导航】
第1页: 概述 第2页: 第2页
第3页: 第3页
©版权所有。未经许可,不得转载。
[责任编辑:nancy]
[an error occurred while processing this directive]