change xml generation to output the occurrences of metadata names and values