for (int i = 0; i < count; i++) {
generatedFiles[i] = File.createTempFile(prefix, ".xml");
service.declareVariable("filename", generatedFiles[i].getName());
service.declareVariable("count", new Integer(i));
ResourceSet result = service.execute(compiled);
Writer out = new OutputStreamWriter(new FileOutputStream(generatedFiles[i]), "UTF-8");
SAXSerializer sax = new SAXSerializer(out, outputProps);
for (ResourceIterator iter = result.getIterator(); iter.hasMoreResources(); ) {
XMLResource r = (XMLResource) iter.nextResource();