1

Hi I am trying to call a javascript function called bob with the value of the node "Path". Is what I am trying to do in XSLT possible? Thank you.

<xsl:template match="/">
    <div id="subdirectory">
        <div style="height:30px;width:100%; float:left; padding-top:10px;">
            <xsl:for-each select="Reports/Folder">

                <xsl:variable name="varPath" select="Path"/>

                <input type='button' class="Folder" style="height:30px; float:left; margin-right:5px; margin-top:5px;" value="{Name}" onclick="this.disabled = true; bob("<xsl:value-of select="Path"/>");">
                    <xsl:attribute name="xml">
                        <xsl:value-of select="Xml"/>
                    </xsl:attribute>
                    <xsl:attribute name="data-path">
                        <xsl:value-of select="Path"/>
                    </xsl:attribute>
                    <xsl:attribute name="report-name">
                        <xsl:value-of select="Name"/>
                    </xsl:attribute>
                    <xsl:attribute name="directoriesDeep">
                        <xsl:value-of select="DirectoriesDeep"/>
                    </xsl:attribute>
                </input>
            </xsl:for-each>
        </div>
    </div>
4

1 回答 1

0

最后解决了。

我将 onclick 事件作为一个属性,然后代码很高兴在其中包含 jscript。

                    <xsl:variable name="varPath" select="Path"/>

                <input type='button' class="Folder" style="height:30px; float:left; margin-right:5px; margin-top:5px;" value="{Name}" onclick="this.disabled=true">
                    <xsl:attribute name="xml">
                        <xsl:value-of select="Xml"/>
                    </xsl:attribute>
                    <xsl:attribute name="data-path">
                        <xsl:value-of select="Path"/>
                    </xsl:attribute>
                    <xsl:attribute name="report-name">
                        <xsl:value-of select="Name"/>
                    </xsl:attribute>
                    <xsl:attribute name="directoriesDeep">
                        <xsl:value-of select="DirectoriesDeep"/>
                    </xsl:attribute>
                    <xsl:attribute name="onclick">
                        bob($varPath)
                    </xsl:attribute>                              
                </input>
            </xsl:for-each>
于 2013-07-01T15:45:10.680 回答