Reputation: 45
I'm trying to use a an xsl:template with the following:
xsl:template match="/a/b/c/d/text() = 'Foo'"
But I get an error from XMLSpy...: Invalid Pattern: Unexcpected token - "= 'Foo'"
Anyone has any idea what i'm doing wrong?
Thanks.
Upvotes: 0
Views: 172
Reputation: 34596
<xsl:template match='/a/b/c/d[text() = "Foo"]'>
text() = "Foo"
is a comparison, and in XPath this means it must be inside a predicate - in square brackets.
Upvotes: 0
Reputation: 167716
If you want to match the d
elements then use match="/a/b/c/d[. = 'Foo']"
, if you need to match the text node children of the d
elements then use match="/a/b/c/d/text()[. = 'Foo']"
.
Upvotes: 2