@@ -122,32 +122,7 @@ public class XSLTProcess extends MatchingTask {
baseDir = project.resolveFile(".");
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);
log("Using "+liaison.getClass().toString(), Project.MSG_VERBOSE);
long styleSheetLastModified = 0;
long styleSheetLastModified = 0;
@@ -156,9 +131,15 @@ public class XSLTProcess extends MatchingTask {
File file = project.resolveFile(xslFile, project.getBaseDir());
File file = project.resolveFile(xslFile, project.getBaseDir());
if (!file.exists()) {
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);
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
// Create a new XSL processor with the specified stylesheet
@@ -181,6 +162,19 @@ public class XSLTProcess extends MatchingTask {
return;
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
// Process all the files marked for styling
list = scanner.getIncludedFiles();
list = scanner.getIncludedFiles();
for (int i = 0;i < list.length; ++i) {
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() {
public Param createParam() {
Param p = new Param();
Param p = new Param();
params.addElement(p);
params.addElement(p);