You have the variables the wrong way around. This should (hopefully) be correct:
{foreach $object.contentobject_attributes as $ContentObjectAttribute}
{attribute_view_gui attribute=$ContentObjectAttribute}
{/foreach}
The if statement in your code will most likely not work because $ContentObjectAttribute is an object, which you want to compare with the string 'body'. Therefore I left it out.