文章詳情頁
在 XSL/XSLT 中實(shí)現(xiàn)隨機(jī)排序
瀏覽:297日期: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. JavaScript實(shí)現(xiàn)簡單的彈窗效果2. Vue 實(shí)現(xiàn)對quill-editor組件中的工具欄添加title3. javascript實(shí)現(xiàn)貪吃蛇小練習(xí)4. 我所理解的JavaScript中的this指向5. Java commons-httpclient如果實(shí)現(xiàn)get及post請求6. js實(shí)現(xiàn)碰撞檢測7. PHP驗證碼工具-Securimage8. PHP單件模式和命令鏈模式的基礎(chǔ)知識9. 一文帶你徹底理解Java序列化和反序列化10. PHP利用curl發(fā)送HTTP請求的實(shí)例代碼
排行榜

網(wǎng)公網(wǎng)安備