We keep this here in order to reset the context classloader * in execute. We can't use liaison.getClass().getClassLoader() * since the actual liaison class may have been loaded by a loader * higher up (system classloader, for example).
* * @since Ant 1.6.2 */ private AntClassLoader loader = null; /** * Mapper to use when a set of files gets processed. * * @since Ant 1.6.2 */ private Mapper mapperElement = null; /** * Additional resource collections to process. * * @since Ant 1.7 */ private final Union resources = new Union(); /** * Whether to use the implicit fileset. * * @since Ant 1.7 */ private boolean useImplicitFileset = true; /** * The default processor is trax * @since Ant 1.7 */ public static final String PROCESSOR_TRAX = "trax"; /** * whether to suppress warnings. * * @since Ant 1.8.0 */ private boolean suppressWarnings = false; /** * whether to fail the build if an error occurs during transformation. * * @since Ant 1.8.0 */ private boolean failOnTransformationError = true; /** * whether to fail the build if an error occurs. * * @since Ant 1.8.0 */ private boolean failOnError = true; /** * Whether the build should fail if the nested resource collection * is empty. * * @since Ant 1.8.0 */ private boolean failOnNoResources = true; /** * For evaluating template params * * @since Ant 1.9.3 */ private XPathFactory xpathFactory; /** * For evaluating template params * * @since Ant 1.9.3 */ private XPath xpath; /** * System properties to set during transformation. * * @since Ant 1.8.0 */ private final CommandlineJava.SysProperties sysProperties = new CommandlineJava.SysProperties(); /** * Trace configuration for Xalan2. * * @since Ant 1.8.0 */ private TraceConfiguration traceConfiguration; /** * Creates a new XSLTProcess Task. */ public XSLTProcess() { } //-- XSLTProcess /** * Whether to style all files in the included directories as well; * optional, default is true. * * @param b true if files in included directories are processed. * @since Ant 1.5 */ public void setScanIncludedDirectories(final boolean b) { performDirectoryScan = b; } /** * Controls whether the stylesheet is reloaded for every transform. * *Setting this to true may get around a bug in certain * Xalan-J versions, default is false.
* @param b aboolean value
* @since Ant 1.5.2
*/
public void setReloadStylesheet(final boolean b) {
reuseLoadedStylesheet = !b;
}
/**
* Defines the mapper to map source to destination files.
* @param mapper the mapper to use
* @exception BuildException if more than one mapper is defined
* @since Ant 1.6.2
*/
public void addMapper(final Mapper mapper) {
if (mapperElement != null) {
handleError("Cannot define more than one mapper");
} else {
mapperElement = mapper;
}
}
/**
* Adds a collection of resources to style in addition to the
* given file or the implicit fileset.
*
* @param rc the collection of resources to style
* @since Ant 1.7
*/
public void add(final ResourceCollection rc) {
resources.add(rc);
}
/**
* Add a nested <style> element.
* @param rc the configured Resources object represented as <style>.
* @since Ant 1.7
*/
public void addConfiguredStyle(final Resources rc) {
if (rc.size() != 1) {
handleError("The style element must be specified with exactly one"
+ " nested resource.");
} else {
setXslResource(rc.iterator().next());
}
}
/**
* API method to set the XSL Resource.
* @param xslResource Resource to set as the stylesheet.
* @since Ant 1.7
*/
public void setXslResource(final Resource xslResource) {
this.xslResource = xslResource;
}
/**
* Adds a nested filenamemapper.
* @param fileNameMapper the mapper to add
* @exception BuildException if more than one mapper is defined
* @since Ant 1.7.0
*/
public void add(final FileNameMapper fileNameMapper) throws BuildException {
final Mapper mapper = new Mapper(getProject());
mapper.add(fileNameMapper);
addMapper(mapper);
}
/**
* Executes the task.
*
* @exception BuildException if there is an execution problem.
* @todo validate that if either in or out is defined, then both are
*/
@Override
public void execute() throws BuildException {
if ("style".equals(getTaskType())) {
log("Warning: the task name