I already have that in the where condition for the web part. That was part of the instructions in the link above. The issue is that in the item template at the top level, I need to add a class to the link if it has children, similar to this:
<a href="{% Transformation.GetDocumentUrl() %}</a>
The problem is that NodeChildNodesCount doesn't take into account whether it should be shown in the nav or not.