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