DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> XML學習教程 >> XML詳解 >> XSL中如何接收到XML地址中URL查詢字符串傳遞的參數?
XSL中如何接收到XML地址中URL查詢字符串傳遞的參數?
編輯:XML詳解     

在xsl任何接收http://community.csdn.Net/Expert/topic/3091/3091367.XML?temp=.2425196形式的參數?saucer回答: There Is So General Solution, If You Are Using IE6, You Can Try The Following, But You Have To Parse The URL First,下面是完整的xsl代碼:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="whatever"> <msxsl:script implements-prefix="user" language="Javascript"> <![CDATA[ function getDocURL(nodelist,sName) { if (sName == null) return ""; var url = nodelist.nextNode().url; var re = new RegExp("[?&]" + sName + "=([^&]*|$)","i"); if (re.test(url)) return RegExp.$1; else return ""; } ]]> </msxsl:script> <xsl:output method="text" indent="yes"/> <xsl:template match="/"> ****<xsl:value-of select="user:getDocURL(/,'varid')"/>**** </xsl:template> </xsl:stylesheet>

通過訪問:http://server/xx.XML?varid=yyyy,你可以看到下面的輸出:
****yyyy****

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved