文章詳情頁
在 XSL/XSLT 中實(shí)現(xiàn)隨機(jī)排序
瀏覽:121日期:2022-06-03 13:32:03
和數(shù)據(jù)庫排序一樣,XSL/XSLT也可以實(shí)現(xiàn)隨機(jī)排序,原理也很簡單,下面就是代碼。
<?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>
標(biāo)簽:
XML/RSS
上一條:用XML和XSL來生成動態(tài)頁面下一條:XMLHTTP資料
相關(guān)文章:
1. 小技巧處理div內(nèi)容溢出2. 概述IE和SQL2k開發(fā)一個XML聊天程序3. PHP字符串前后字符或空格刪除方法介紹4. 解析原生JS getComputedStyle5. jsp+servlet實(shí)現(xiàn)猜數(shù)字游戲6. ASP中格式化時間短日期補(bǔ)0變兩位長日期的方法7. 怎樣才能用js生成xmldom對象,并且在firefox中也實(shí)現(xiàn)xml數(shù)據(jù)島?8. ASP基礎(chǔ)入門第八篇(ASP內(nèi)建對象Application和Session)9. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)10. PHP循環(huán)與分支知識點(diǎn)梳理
排行榜
