I'm not sure I undestand this test with the current parameter name.

I would have expected something like

attrOnly == !(name && *name);

to walk child attributes if the current record had no name and you are outputting attributes.  I may have misunderstood though.