以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 XSL/XSLT/XSL-FO/CSS 』 (http://bbs.xml.org.cn/list.asp?boardid=8) ---- 模板中怎么进行排序?sort的问题 (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=55251) |
-- 作者:foxu -- 发布时间:11/12/2007 5:00:00 PM -- 模板中怎么进行排序?sort的问题 xsl/////////////// <?xml version="1.0" encoding="gb2312" ?> <xsl:template match="main/na"> <xsl:template match="nc"> 要根据@se进行排序,<xsl:sort select="@se" order="descending"/>语句放在哪里啊?~`
|
-- 作者:Qr -- 发布时间:11/12/2007 5:26:00 PM -- <xsl:apply-templates> <xsl:sort/> </xsl:apply-templates> sort放在哪个apply-templates,看你需要吧,关键是路径对就可以。
|
-- 作者:foxu -- 发布时间:11/12/2007 7:10:00 PM -- 我是加在这里的 <xsl:template match="main/na"> <table> <xsl:apply-templates select="nc[(position()>=1 and position()<=10)]"/> <xsl:sort select="@se" order="descending"/> </table> </xsl:template> 但他说“此处不能使用关键字 xsl:sort。”,怎么解决?问题出在哪里呢?我是想分页后根据这个来排序显示。 |
-- 作者:Qr -- 发布时间:11/13/2007 12:18:00 PM -- sort必须用在apply-templates和for-each标记中,你把它独立在外面当然错了。 |
-- 作者:foxu -- 发布时间:11/13/2007 1:11:00 PM -- <xsl:template match="main/na"> <table> <xsl:apply-templates select="nc[(position()>=1 and position()<=10)]"/> <xsl:apply-templates> <xsl:sort select="@se" order="descending"/> </xsl:apply-templates> </table> </xsl:template> 这样写?但是分页就不能实现了。不知道怎么弄阿~~`` |
-- 作者:Qr -- 发布时间:11/13/2007 6:29:00 PM -- ![]() <xsl:apply-templates select="nc[(position()>=1 and position()<=10)]"> <xsl:sort select="@se" order="descending"/> </xsl:apply-templates> |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
117.188ms |