在XSL中存储变量

时间:2012-06-08 22:14:23

标签: php xml xslt variables store

我写了一个从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>

1 个答案:

答案 0 :(得分:0)

请勿使用

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

使用

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

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