当前位置: 代码迷 >> XML/SOAP >> xsl中 javascript 怎么引用 param
  详细解决方案

xsl中 javascript 怎么引用 param

热度:867   发布时间:2012-02-25 10:01:48.0
xsl中 javascript 如何引用 param ?
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method= "html"/>
<xsl:param name="SoStr"></xsl:param>
<xsl:param name="Beginning">undefined</xsl:param>
<xsl:param name="Knottail">undefined</xsl:param>
<xsl:param name="BT">1</xsl:param>

<xsl:template match="/">
 <html>
 <body>
 <xsl:apply-templates select="CATALOG"/>
 </body>
 </html>
</xsl:template>
<xsl:template match="CATALOG">
 <input type="hidden" name="DataPage">
  <xsl:attribute name="value"><xsl:value-of select="count(BOOK[contains(Img, $SoStr)])"/></xsl:attribute>
 </input>
 <TABLE id="viewTable" name="viewTable" width="700px" border="0" bordercolor="#85979f" cellSpacing="0" cellPadding="0" style="border-collapse:collapse;">
 <tr>
 <xsl:for-each select='BOOK[contains(Img, $SoStr)]'>
 <xsl:if test="position() &gt; $Beginning and position() &lt;= $Knottail">
 <td>
  <xsl:element name="img">
  <xsl:attribute name="src">
  <xsl:value-of select="Img"/>
  </xsl:attribute>
  </xsl:element><br/>
  <span> <xsl:attribute name="id">Book<xsl:value-of select="string($Beginning+1)"/></xsl:attribute><xsl:value-of select="BookName"/></span><br/>
  <xsl:value-of select="BookName"/><br/>
  <xsl:value-of select="Authors"/> <br/>
  <xsl:value-of select="ISBN"/> <br/>
  <xsl:value-of select="Price"/> <br/>
  <xsl:value-of select="Quantity"/> <br/>
  <xsl:value-of select="VerYear"/> <br/>



-------------------------------------------------------关键代码---------------------------------


我想给AddRemoveItem()传递一个参数,里面使用到param,该如何写呢?


  <a href="javascript:AddRemoveItem('Add',<xsl:value-of select="Book+$Beginnig+1">);">添加购物车</a>  
--------------------------------------------------- 

 
</td>
 </xsl:if>
 </xsl:for-each>
  </tr>
 </TABLE>
</xsl:template>
</xsl:stylesheet>

------解决方案--------------------
你仍然可以使用<xsl:attribute name="href">javascript:AddRemoveItem('Add', 'Book<xsl:value-of select="$Beginnig"/>+1')</xsl:attribute>
  相关解决方案