和数据库排序一样,XSL/XSLT也可以实现随机排序,原理也很简单,下面就是代码。
复制代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:eMeng="http://dotnet.aspx.cc/"
version="1.0">
<msxsl:script language="javaScript" implements-PRefix="eMeng">
function Random() {
return Math.random();
}
</msxsl:script>
<xsl:template match="/">
<xsl:for-each select="/*/node()">
<xsl:sort select="eMeng:Random()"/>
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
登录后复制
以上就是在 XSL/XSLT 中实现随机排序的内容,更多相关内容请关注靠谱客(www.uoften.com)!
最后
以上就是靓丽绿茶最近收集整理的关于在 XSL/XSLT 中实现随机排序的全部内容,更多相关在内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复