XSL样式表排序问题
请大家帮忙看下这个问题怎么解决
- XML code
XML文件:...<aa><a num="2" /><a num="3" /><a num="21" /><a num="1" /></aa>
- XML code
XSL样式表文件:...<div><xsl:for-each select="aa/a"><xsl:sort select="@num" /><span><xsl:value-of select="@num" />,</span></xsl:for-each></div>...
结果为:1,2,21,3
怎么修改能让结果按照num属性的数字值排序呢?(怎么才能得到结果1,2,3,21呢?)
[解决办法]
- XML code
<div><xsl:for-each select="aa/a"><xsl:sort select="@num" data-type="number" /><span><xsl:value-of select="@num" />,</span></xsl:for-each></div>