Question about Paths

Okay, every night I like to play with the Queries to try to understand it better. I am still trying to figure out what is the best way to find out which elements have kids. I came up with something that kind of work


Now, my problem is how do I show the elements of those elements that have children. I can show the tasks with something like,

@type/..* union task///*

But if you notice, that only gives you those that have “task” as children. Is there a way to show all the descendants of those elements with children?

This is useful in very large projects. I can check and see if there is a project somewhere that has run out of tasks with something like,

* except @type/..* union task///*

I can also use that statement to only show me the projects with tasks in particular searches. In other words, I can eliminate empty projects (no tasks) in my search results. Just use

(@type/..* union task///*) except...

instead of

* except...

Sorry been half answering (then stopping) this post a few times. I think it would help if you made a simple but demonstrative example file, along with telling me which entries you’d like to see included in the results.