I'm probably being dense but I can't work out how to add the second line: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> <catalogue> ... ... </catalogue> I can get the first line using: saveXML(xml$value(), prefix='<?xml version="1.0"?>', encoding="ISO-8859-1") Any ideas? Thanks.