Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能建议我如何在以下 XSLT 代码中获得 i 的值?
<xsl:for-each select="MenuItems/mainmenu"> <xsl:variable name="i" select="position()"/> <li class="menu_hover" onclick="SwitchMenu(this, $i)" > </li> </xsl:for-each>
谢谢。
最简单的方法是使用“value-of”的快捷方式,即花括号:
<xsl:for-each select="MenuItems/mainmenu"> <xsl:variable name="i" select="position()"/> <li class="menu_hover" onclick="SwitchMenu(this, {$i})" > </li> </xsl:for-each>