XSL / XPath expression to check if a node contains at least one non-empty child

hackrockx

New Member
I need to check if an XML node has at least one non-empty child. Applied to this XML the expression should return \[code\]true\[/code\]\[code\]<xml> <node> <node1/> <node2/> <node3>value</node3> </node></xml>\[/code\]I tried to use this expression: \[code\]<xsl:if test="not(/xml/node/child::* = '')">\[/code\] but it seems to check if all children are not empty.How can I write an expression which returns \[code\]true\[/code\] 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
\[code\]test="count(not(/xml/node/child::* = '')) > '1'"\[/code\]
but somehow just can't make it work right. This expression is not a well-formed one.
 
Back
Top