diff --git a/docs/manual/CoreTasks/style.html b/docs/manual/CoreTasks/style.html index 6f3ae76e0..ae5bf3e70 100644 --- a/docs/manual/CoreTasks/style.html +++ b/docs/manual/CoreTasks/style.html @@ -36,13 +36,15 @@ inclusion/exclusion of files works, and how to write patterns.

basedir - where to find the source XML file. - Yes + where to find the source XML file, default is the + project's basedir. + No destdir directory in which to store the results. - Yes + Yes, unless in and out have been + specified. extension diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 5180bdfde..e70e3c2d8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -122,32 +122,7 @@ public class XSLTProcess extends MatchingTask { baseDir = project.resolveFile("."); } - //-- make sure Source directory exists... - if (destDir == null ) { - String msg = "destdir attributes must be set!"; - throw new BuildException(msg); - } - scanner = getDirectoryScanner(baseDir); - log("Transforming into "+destDir, Project.MSG_INFO); - - // if processor wasn't specified, see if TraX is available. If not, - // default it to xslp or xalan, depending on which is in the classpath - if (liaison == null) { - try { - setProcessor("trax"); - } catch (Throwable e1) { - try { - setProcessor("xslp"); - } catch (Throwable e2) { - try { - setProcessor("xalan"); - } catch (Throwable e3) { - throw new BuildException(e1); - } - } - } - } - + liaison = getLiaison(); log("Using "+liaison.getClass().toString(), Project.MSG_VERBOSE); long styleSheetLastModified = 0; @@ -156,9 +131,15 @@ public class XSLTProcess extends MatchingTask { File file = project.resolveFile(xslFile, project.getBaseDir()); if (!file.exists()) { - log("DEPRECATED - the style attribute should be relative to the project\'s"); - log(" basedir, not the tasks\'s basedir."); file = project.resolveFile(xslFile, baseDir); + /* + * shouldn't throw out deprectaion warnings before we know, + * the wrong version has been used. + */ + if (file.exists()) { + log("DEPRECATED - the style attribute should be relative to the project\'s"); + log(" basedir, not the tasks\'s basedir."); + } } // Create a new XSL processor with the specified stylesheet @@ -181,6 +162,19 @@ public class XSLTProcess extends MatchingTask { return; } + /* + * if we get here, in and out have not been specified, we are + * in batch processing mode. + */ + + //-- make sure Source directory exists... + if (destDir == null ) { + String msg = "destdir attributes must be set!"; + throw new BuildException(msg); + } + scanner = getDirectoryScanner(baseDir); + log("Transforming into "+destDir, Project.MSG_INFO); + // Process all the files marked for styling list = scanner.getIncludedFiles(); for (int i = 0;i < list.length; ++i) { @@ -331,6 +325,27 @@ public class XSLTProcess extends MatchingTask { } } + protected XSLTLiaison getLiaison() { + // if processor wasn't specified, see if TraX is available. If not, + // default it to xslp or xalan, depending on which is in the classpath + if (liaison == null) { + try { + setProcessor("trax"); + } catch (Throwable e1) { + try { + setProcessor("xslp"); + } catch (Throwable e2) { + try { + setProcessor("xalan"); + } catch (Throwable e3) { + throw new BuildException(e1); + } + } + } + } + return liaison; + } + public Param createParam() { Param p = new Param(); params.addElement(p);