Take this XML example:
<root>
<grandParent GPid="1" hidden="false">
<parent Pid="1" hidden="false">
<child Cid="1" hidden="false"/>
<child Cid="2" hidden="true"/>
</parent>
<parent Pid="2" hidden="false">
<child Cid="3" hidden="false"/>
<child Cid="4" hidden="false"/>
</parent>
</grandParent>
<grandParent GPid="2" hidden="false">
<parent Pid="3" hidden="false">
<child Cid="5" hidden="true"/>
</parent>
<parent Pid="4" hidden="true">
<child Cid="6" hidden="false"/>
</parent>
</grandParent>
<grandParent GPid="3" hidden="true">
<parent Pid="5" hidden="false">
<child Cid="7" hidden="false"/>
</parent>
</grandParent>
</root>
I need some sort of filter to get a copy of this where all the nodes marked "hidden" are removed like so:
<root>
<grandParent GPid="1" hidden="false">
<parent Pid="1" hidden="false">
<child Cid="1" hidden="false"/>
</parent>
<parent Pid="2" hidden="false">
<child Cid="3" hidden="false"/>
<child Cid="4" hidden="false"/>
</parent>
</grandParent>
<grandParent GPid="2" hidden="false">
<parent Pid="3" hidden="false"/>
</grandParent>
</root>
I tried using something like this
var newXML:XML = XML(root.(grandParent.@hidden != "true").(grandParent.parent.@hidden != "true").(grandParent.parent.child.@hidden !=true);
But that really just gives me back the original XML (since I'm asking for the root where those conditions are met I get the root). I understand why my approach doesn't work, but I don't know where to go from here.