我有以下 XSL 片段:
<xsl:for-each select="item">
<xsl:variable name="hhref" select="link" />
<xsl:variable name="pdate" select="pubDate" />
<xsl:if test="hhref not contains '1234'">
<li>
<a href="{$hhref}" title="{$pdate}">
<xsl:value-of select="title"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
if 语句不起作用,因为我无法计算出 contains 的语法。我如何正确表达 xsl:if?
最佳答案
当然有!例如:
<xsl:if test="not(contains($hhref, '1234'))">
<li>
<a href="{$hhref}" title="{$pdate}">
<xsl:value-of select="title"/>
</a>
</li>
</xsl:if>
语法为:contains(stringToSearchWithin, stringToSearchFor)
关于xslt - 是否有 XSL "contains"指令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/569908/