以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  请问asp读取xml中数据集合时是否可以对数据进行筛选、排序?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=43170)


--  作者:herrylu
--  发布时间:2/8/2007 10:36:00 AM

--  请问asp读取xml中数据集合时是否可以对数据进行筛选、排序?
比如我有一个xml文件,里面记录着全班同学的年龄、身高记录!
我想在希望通过asp程序把身高在1.7以上的按年龄大小列出来。怎么写?

请高手贴段相关的代码吧~

谢~


--  作者:Qr
--  发布时间:2/8/2007 6:26:00 PM

--  
用XSL比ASP更方便。
XSL:
<xsl:apply-templates select="student[length &gt; 170']">
 <xsl:sort select="age" order="ascending"/><!--ascending、descending,order有两个参数-->
</xsl:apply-templates>

<xsl:template match="student">
 <xsl:value-of select="name"/>
 <xsl:value-of select="age"/>
 <xsl:value-of select="length"/>
</xsl:template>

XML:
<student>
 <name>tom</name>
 <age>20</age>
 <length>175</length>
</student>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
32.227ms