Martin von Gagern wrote:
> This is the mailing list inbcarnation of bug 47002.
> https://issues.apache.org/bugzilla/show_bug.cgi?id=47002
> 
> [...]
> 
> Please review,
>  Martin von Gagern

I forgot to attach the patch. Doing so now.

Expose classpath and factory of internal XSLTProcess task.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47002
Patch licensed to the Apache Software Foundation.
2009-04-09 Martin von Gagern

Index: 
src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
===================================================================
--- 
src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java 
    (revision 763549)
+++ 
src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java 
    (working copy)
@@ -41,6 +41,7 @@
 import org.apache.tools.ant.util.JAXPUtils;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.types.EnumeratedAttribute;
+import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.resources.URLResource;
 import org.apache.tools.ant.types.resources.FileResource;
@@ -93,11 +94,11 @@
     protected File toDir;
 
     /**
-     * The params that will be sent to the XSL transformation
+     * The internal XSLT task used to perform the transformation.
      *
-     * @since Ant 1.7
+     * @since Ant 1.8
      */
-    private List params;
+    private XSLTProcess xsltTask;
 
     /**
      * Instance of a utility class to use for file operations.
@@ -132,7 +133,8 @@
      */
     public AggregateTransformer(Task task) {
         this.task = task;
-        params = new Vector();
+        xsltTask = new XSLTProcess();
+        xsltTask.bindToOwner(task);
     }
 
     /**
@@ -212,12 +214,30 @@
      * @since Ant 1.7
      */
     public XSLTProcess.Param createParam() {
-        XSLTProcess.Param p = new XSLTProcess.Param();
-        params.add(p);
-        return p;
+        return xsltTask.createParam();
     }
 
     /**
+     * Creates a classpath to be used for the internal XSLT task.
+     *
+     * @return the classpath to be configured
+     * @since Ant 1.8
+     */
+    public Path createClasspath() {
+        return xsltTask.createClasspath();
+    }
+
+    /**
+     * Creates a factory configuration to be used for the internal XSLT task.
+     *
+     * @return the factory description to be configured
+     * @since Ant 1.8
+     */
+    public XSLTProcess.Factory createFactory() {
+        return xsltTask.createFactory();
+    }
+
+    /**
      * transformation
      * @throws BuildException exception if something goes wrong with the 
transformation.
      */
@@ -228,9 +248,6 @@
         TempFile tempFileTask = new TempFile();
         tempFileTask.bindToOwner(task);
 
-        XSLTProcess xsltTask = new XSLTProcess();
-        xsltTask.bindToOwner(task);
-
         xsltTask.setXslResource(getStylesheet());
 
         // acrobatic cast.
@@ -248,13 +265,6 @@
             outputFile = new File(toDir, "junit-noframes.html");
         }
         xsltTask.setOut(outputFile);
-        for (Iterator i = params.iterator(); i.hasNext();) {
-            XSLTProcess.Param param = (XSLTProcess.Param) i.next();
-            XSLTProcess.Param newParam = xsltTask.createParam();
-            newParam.setProject(task.getProject());
-            newParam.setName(param.getName());
-            newParam.setExpression(param.getExpression());
-        }
         XSLTProcess.Param paramx = xsltTask.createParam();
         paramx.setProject(task.getProject());
         paramx.setName("output.dir");
Index: docs/manual/CoreTasks/style.html
===================================================================
--- docs/manual/CoreTasks/style.html    (revision 763549)
+++ docs/manual/CoreTasks/style.html    (working copy)
@@ -267,7 +267,7 @@
 should be applied to.  Use a nested mapper and the task's destdir
 attribute to specify the output files.</p>
 
-<h4>classpath</h4>
+<h4><a name="classpath">classpath</a></h4>
 <p>The classpath to load the processor from can be specified via a
 nested <code>&lt;classpath&gt;</code>, as well - that is, a
 <a href="../using.html#path">path</a>-like structure.</p>
@@ -336,7 +336,7 @@
 </table>
 </blockquote>
 
-<h4>factory ('trax' processors only)</h4>
+<h4><a name="factory">factory ('trax' processors only)</a></h4>
 Used to specify factory settings.
 <blockquote>
 <h4>Parameters</h4>
Index: docs/manual/OptionalTasks/junitreport.html
===================================================================
--- docs/manual/OptionalTasks/junitreport.html  (revision 763549)
+++ docs/manual/OptionalTasks/junitreport.html  (working copy)
@@ -167,8 +167,17 @@
   </tr>
 </table>
 
+<h4>classpath</h4>
+<p><em>Since Ant 1.8.</em>
+Like for the <a href="../CoreTasks/style.html#classpath">XSLT task</a>,
+a nested &lt;classpath&gt; will be used to load the processor.</p>
 
+<h4>factory</h4>
+<p><em>Since Ant 1.8.</em>
+Like for the <a href="../CoreTasks/style.html#factory">XSLT task</a>,
+a nested &lt;factory&gt; can be used to specify factory settings.</p>
 
+
 <h3>Example of report</h3>
 <blockquote>
   <pre>&lt;junitreport todir=&quot;./reports&quot;&gt;

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to