Try to use the empty()
function:
<xsl:if test="empty(node/ABC/node()) and empty(node/DEF/node())">
<xsl:text>This should work</xsl:text>
</xsl:if>
This identifies ABC
and DEF
as empty in the sense that they do not have any child nodes (no elements, no text nodes, no processing instructions, no comments).
But, as pointed out by @Ian, your elements might not be empty really or that might not be your actual problem - you did not show what your input XML looks like.
Another cause of error could be your relative position in the tree. This way of testing conditions only works if the surrounding template matches the parent element of node
or if you iterate over the parent element of node
.