- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> .NET >> XML*XSL >> 正文
站内文章搜索:           

XSL中如何接收到XML地址中URL查询字符串传递的参数?

作者:佚名    文章来源:不详    更新时间 :2007-6-5 0:28:55

在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****


发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……