From 62e7dc5ae23d71d2d924dd8393e2ceb8a40bc9a7 Mon Sep 17 00:00:00 2001
From: Steve Loughran
Writes all build information out to an XML file named log.xml, or the value -of the XmlLogger.file property if present.
+of theXmlLogger.file
property if present.
+
+By default the xml file creates
+a reference to an xslt file "log.xsl" in the current directory; look in
+ANT_HOME/etc for one of these. You can set the property
+ant.XmlLogger.stylesheet.uri
to provide a uri to a style sheet.
+this can be a relative or absolute file path, or an http URL.
+If you set the property to the empty string, "", no XSLT transform
+is declared at all.
+
+
+
+
+
diff --git a/src/main/org/apache/tools/ant/XmlLogger.java b/src/main/org/apache/tools/ant/XmlLogger.java index 62d4f2071..8a46a90fe 100644 --- a/src/main/org/apache/tools/ant/XmlLogger.java +++ b/src/main/org/apache/tools/ant/XmlLogger.java @@ -185,10 +185,14 @@ public class XmlLogger implements BuildListener { buildElement.element.appendChild(stacktrace); } - String outFilename = event.getProject().getProperty("XmlLogger.file"); + String outFilename = event.getProject().getProperty("XmlLogger.file"); if (outFilename == null) { outFilename = "log.xml"; } + String xslUri=event.getProject().getProperty("ant.XmlLogger.stylesheet.uri"); + if(xslUri==null) { + xslUri="log.xsl"; + } Writer out = null; try { // specify output in UTF8 otherwise accented characters will blow @@ -196,7 +200,9 @@ public class XmlLogger implements BuildListener { FileOutputStream fos = new FileOutputStream(outFilename); out = new OutputStreamWriter(fos, "UTF8"); out.write("\n"); - out.write("\n\n"); + if(xslUri.length()>0) { + out.write("\n\n"); + } (new DOMElementWriter()).write(buildElement.element, out, 0, "\t"); out.flush(); } catch(IOException exc) {