在 XSL 中存储变量


Store variable in XSL

我正在编写一个程序来从xsl调用php,但我需要存储一个xsl变量,以便我可以将其发送到php函数php:functionString()

<xsl:template match="atom:entry">
 <xsl:if test="position() &lt;= 10">
   <table border="0" width="55"  cellpadding="2" cellspacing="4" style="float:left;">
      <tr >
         <td width="55">
    <a href="?page_id=9#anchor-{ atom:id }" >
    <img id="icon">
<xsl:attribute name="src">
<xsl:value-of select="./im:image[1]"/>
</xsl:attribute>
</img></a>
</td>
</tr>
         <tr> <td width="35" style="font-family:Arial; font-size:10px; color:black; font-weight:bold;">
             <xsl:value-of select="atom:category/@label"/> </td></tr>
          <tr> <td width="35" style="font-family:Arial; font-size:10px; color:black;">   <xsl:value-of select="./im:price"/>
         </td>
     </tr>
     <tr> <td>Rating: <xsl:value-of select="php:functionString('PD::parseData','$id')" disable-output-escaping="yes"/></td>
     </tr>
     </table>
     </xsl:if>
   </xsl:template>

不要使用

<xsl:value-of select="php:functionString('PD::parseData','$id')" disable-output-escaping="yes"/>

用途

<xsl:value-of select="php:functionString('PD::parseData', $id)"/>

前者将字符串作为参数传递"$id"而不是变量$id