文章詳情頁
在 XSL/XSLT 中實(shí)現(xiàn)隨機(jī)排序
瀏覽:93日期: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. python 如何在 Matplotlib 中繪制垂直線2. bootstrap select2 動態(tài)從后臺Ajax動態(tài)獲取數(shù)據(jù)的代碼3. ASP常用日期格式化函數(shù) FormatDate()4. python中@contextmanager實(shí)例用法5. html中的form不提交(排除)某些input 原創(chuàng)6. CSS3中Transition屬性詳解以及示例分享7. js select支持手動輸入功能實(shí)現(xiàn)代碼8. 如何通過python實(shí)現(xiàn)IOU計算代碼實(shí)例9. 開發(fā)效率翻倍的Web API使用技巧10. vue使用moment如何將時間戳轉(zhuǎn)為標(biāo)準(zhǔn)日期時間格式
排行榜
