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.

-

classpath

+

classpath

The classpath to load the processor from can be specified via a nested <classpath>, as well - that is, a path-like structure.

@@ -336,7 +336,7 @@ -

factory ('trax' processors only)

+

factory ('trax' processors only)

Used to specify factory settings.

Parameters

Index: docs/manual/OptionalTasks/junitreport.html =================================================================== --- docs/manual/OptionalTasks/junitreport.html (revision 763549) +++ docs/manual/OptionalTasks/junitreport.html (working copy) @@ -167,8 +167,17 @@ +

classpath

+

Since Ant 1.8. +Like for the XSLT task, +a nested <classpath> will be used to load the processor.

+

factory

+

Since Ant 1.8. +Like for the XSLT task, +a nested <factory> can be used to specify factory settings.

+

Example of report

<junitreport todir="./reports">