以文本方式查看主题

-  中文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=53684)


--  作者:跳绳儿
--  发布时间:10/12/2007 1:21:00 PM

--  急问:一个sort的问题[求助]
xml:
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>

<DOC>
  <JH Coe="8">
    <x V="1"/>
    <y V="1"/>
    <x V="1"/>
    <z V="6"/>
    <y V="1"/>
    <x V="3"/>
    </JH>
</DOC>

xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt"

xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:output method="xml"/>

<xsl:template match="/DOC/JH">
    <xsl:variable name="sorted_vec">
      <xsl:for-each select="./*">
        <xsl:sort select="name()"/>
 <xsl:copy-of select="."/>
      </xsl:for-each>
    </xsl:variable>

<xsl:variable name="sorted" select="msxsl:node-set($sorted_vec)"/>
<xsl:value-of select="$sorted/*"/>

</xsl:template>
</xsl:stylesheet>

我想实现按照x,y,z的顺序给元素排序,为什么<xsl:value-of select="$sorted/*"/>取不到值呀??


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