0

我有以下 xsl 代码。我要做的就是输出包含函数找到的单词的 cat 属性。代码现在输出 true (据我了解原因),但我如何输出它的属性值?

<xsl:value-of select="contains($grammar//lexicalRules, 'likes')"></xsl:value-of>

我的 $grammar 是这样的

<lexicalRules>
        <word cat="vp">snores</word>
        <word cat="vt">likes</word>
</lexicalRules>

在这种情况下,我想输出 vt。

非常感谢。

4

1 回答 1

3

试试这个 :

$grammar//lexicalRules/word[. = 'likes']/@cat
于 2011-12-05T16:50:48.900 回答