Easiest method might be simply hiding the redudant markup with CSS, using the example from the first post, you could hide all secondary <ul>‘s and then display the active parent…
#menu li ul { display:none; }
#menu .current ul {display:block; }
Alternatively add some more conditionals:
{exp:structure_entries}
{if {depth} == 1}{!-- Top Level --}
<li {if {current_parent}}class="current"{/if}{if {current_page}}class="active"{/if}>
<a href="{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
{if {children_total} == 0 || {current_parent} != true}{!-- No Children - so close markup --}
</li>
{/if}
{if:else}{!-- Children (not top level) --}
{if {current_parent}}
{if {sibling_count} == 1}{!-- First child - so open markup --}
<ul class="level{depth}">
{/if}
<li {if {current_parent}}class="current"{/if}{if {current_page}}class="active"{/if}>
<a href="{page_uri}">{title} Depth={depth} Parent={parent_id}</a>
{close_markup}
{if {total_children} == 0 || {depth} == {restricted_depth}}
</li>
{/if}
{if {last_sibling} && {sibling_count} == {sibling_total}}
</ul><!-- End of level{depth} closing tags -->
</li>
{/if}
{/close_markup}
{/if}
{/if}
{/exp:structure_entries}
There’s two {current_parent} additions in the above - this isn’t tested, but should get you in the right direction!
