首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

html如何往xsl里传参数,用来动态应用xsl

2012-04-11 
html怎么往xsl里传参数,用来动态应用xslhtml:HTML codescript typetext/javascriptvar xml new Act

html怎么往xsl里传参数,用来动态应用xsl
html:

HTML code
<script type="text/javascript">                                var xml = new ActiveXObject("Microsoft.XMLDOM")                                xml.async = false                                xml.load("data.xml")                                var xsl = new ActiveXObject("Microsoft.XMLDOM")                                xsl.async = false                                xsl.load("view.xsl")                                document.write(xml.transformNode(xsl))</script>



xsl:

XML code
    <xsl:template match="/">        <xsl:choose>            <xsl:when test="$mode = a">                <xsl:apply-templates select="." mode="a"/>            </xsl:when>            <xsl:otherwise>                <xsl:apply-templates select="." mode="b"/>            </xsl:otherwise>        </xsl:choose>    </xsl:template><xsl:template match="/" mode="a"></xsl:template><xsl:template match="/" mode="b"></xsl:template>


问题:
怎么把mode参数,从html传入到xsl里
比如,在html里做两个超链接,分别链接到用mode a和b的方式来展示xml

[解决办法]
addParameter方法
参见
http://msdn.microsoft.com/en-us/library/windows/desktop/ms762312%28v=vs.85%29.aspx

热点排行