fixed formatting to include <function> element

fixed xml output to make <output> and <derivative> correctly
subelements of <function>