Reputation: 4054
How can I write a test condition in XSLT which says "if any of the child nodes of the current node's child has local-name() = 'abc'"?
For example if the current node has a node named test
inside it and test
may contain a node named abc
I tried writing test="local-name(test/child::*) = 'abc'"
but it obviously didn't work.
Thnx in advance!!
Upvotes: 2
Views: 8416
Reputation: 122364
local-name(test/*)
will check the name of only the first child element of the (first) test
, if you want to check them all then you need to use a predicate:
<xsl:when test="test/*[local-name() = 'abc']">
but the simpler
<xsl:when test="test/abc">
may be enough if you don't need to cater for the possibility of unknown namespaces.
Upvotes: 5