I need to check if an XML node has at least one non-empty child. Applied to this XML the expression should return true
<xml>
<node>
<node1/>
<node2/>
<node3>value</node3>
</node>
</xml>
I tried to use this expression: <xsl:if test="not(/xml/node/child::* = '')">
but it seems to check if all children are not empty.
How can I write an expression which returns true
if at least one element is not empty? Is there a way to do this without creating another template to iterate over node chldren?
UPD: I'm thinking of counting non-empty nodes like
test="count(not(/xml/node/child::* = '')) > '0'"
but somehow just can't make it work right. This expression is not a well-formed one.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…