以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  高手请进:想要以表格形式显示出来,并按定价排列,但出现问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=20094)


--  作者:lazyy
--  发布时间:7/2/2005 1:51:00 PM

--  高手请进:想要以表格形式显示出来,并按定价排列,但出现问题
<?xml  version="1.0" encoding="gb2312" ?>
<?xml-stylesheet  type="text/xsl"  href="cd.xsl"?>
<CD信息>
<CD>
<代号>gb1000</代号>
<专辑名>红蔷薇</专辑名>
<歌手>萧亚轩</歌手>
<定价  单位="元">16</定价>
</CD>
<CD>
<代号>gb2000</代号>
<专辑名>一个人的孤单</专辑名>
<歌手>刘若英</歌手>
<定价 单位="元">20</定价>
</CD>
</CD信息>


样式单:cd.xsl
<?xml version="1.0"  encoding="gb2312"?>
<xsl:stylesheet  xmlns:xsl="www.w3.org/TR/WD-xsl">
<xsl:template  match="/">
<html>
<head>
<title>CD信息</title>
</head>
<body>
<table  border="2" width="400"  cellspacing="2"   spacpadding="4"  bgcolor="#ff00ff">
<tr>
<th>代号 </th>
<th>专辑名</th>
<th>歌手</th>
<th>定价</th>
</tr>
<xsl:for-each select="CD信息/CD"  order-by="定价">
<tr>
<td>
<xsl:value-of  select="代号"/>
</td>

<td>
<xsl:value-of  select="专辑名"/>
</td>
<td>
<xsl:value-of  select="歌手"/>
</td>
<td>
<xsl:value-of  select="定价"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


想要以表格形式显示出来,并按定价排列,结果只显示表头第一行,下面要显示的CD信息不显示,为什么?我找不出来,哪位高手救救我!


--  作者:Qr
--  发布时间:7/2/2005 2:24:00 PM

--  
用1999。
排序用<xsl:sort select="定价"/>
--  作者:Qr
--  发布时间:7/2/2005 2:33:00 PM

--  
order-by在IE5中作为xsl:for-each/appla-templates的属性来排序,在IE6中好象不行,被xsl:sort元素代替。

排序这个功能,IE5和IE6的实现方式并不相同,按需选择。


--  作者:lazyy
--  发布时间:7/2/2005 6:04:00 PM

--  
搞定,谢谢了!
--  作者:lazyy
--  发布时间:7/2/2005 6:07:00 PM

--  
不好意思:<xsl:sort select="定价"/>位置放哪啊?
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
1,578.125ms