xml.c: Fix writing XML data for one image only