<node>
<node1><node11/></node1>
<node2/>
</node>
I want my XSLT to check
<xsl:if test="If at least 1 child node exists">
Only node1 can pass the if condition
</xsl:if>
Thanks for any reply.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firstly, be careful with your terminology here. Do you mean “node” or do you mean “element”. A node can be an element, comment, text or processing-instruction.
Anyway, if you do mean element here, to check at least one child element exists, you can just do this (assuming you are positioned on the node element in this case.
Your comment suggests only “node1” can pass the if condition, so to check the existence of a specific element, do this