You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/09/22 05:19:41 UTC
DO NOT REPLY [Bug 23314] New: -
org.apache.tools.ant.taskdefs.XSTLProcess enhancement
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23314>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23314
org.apache.tools.ant.taskdefs.XSTLProcess enhancement
Summary: org.apache.tools.ant.taskdefs.XSTLProcess enhancement
Product: Ant
Version: 1.6Alpha (nightly)
Platform: All
OS/Version: Other
Status: NEW
Severity: Enhancement
Priority: Other
Component: Core tasks
AssignedTo: dev@ant.apache.org
ReportedBy: keeleyd@clear.net.nz
Provide the path and file name relative to the base directory as a parameter to
each XSL transform. We have many applications that need this relative path
because a derivative of it is output by the transform. e.g. we generate java
source and the package in the java source is derived from this relative path.
After inspecting the ant nightly code drop, I think this is a one line change.
See the one line added in the code sample below
>From the file org.apache.tools.ant.taskdefs.XSTLProcess ...
For examples sake, I suggested the parameter name "xml-file" which would need
to be documented as a standard parameter available to all transforms.
I would be happy to effect this change myself if you wish, obviously I would
need access to the CVS to do so.
I look forward to your response.
Regards
Dave Keeley
/**
* Processes the given input XML file and stores the result
* in the given resultFile.
*
* @param baseDir the base directory for resolving files.
* @param xmlFile the input file
* @param destDir the destination directory
* @param stylesheet the stylesheet to use.
* @exception BuildException if the processing fails.
*/
private void process(File baseDir, String xmlFile, File destDir,
File stylesheet)
throws BuildException {
String fileExt = targetExtension;
File outFile = null;
File inFile = null;
try {
long styleSheetLastModified = stylesheet.lastModified();
inFile = new File(baseDir, xmlFile);
if (inFile.isDirectory()) {
log("Skipping " + inFile + " it is a directory.",
Project.MSG_VERBOSE);
return;
}
int dotPos = xmlFile.lastIndexOf('.');
if (dotPos > 0) {
outFile = new File(destDir,
xmlFile.substring(0, xmlFile.lastIndexOf('.')) + fileExt);
} else {
outFile = new File(destDir, xmlFile + fileExt);
}
if (force ||
inFile.lastModified() > outFile.lastModified() ||
styleSheetLastModified > outFile.lastModified()) {
ensureDirectoryFor(outFile);
log("Processing " + inFile + " to " + outFile);
configureLiaison(stylesheet);
// ONE LINE ENHANCEMENT BELOW...
liaison.addParam("xml-file", xmlFile);
liaison.transform(inFile, outFile);
}
} catch (Exception ex) {
// If failed to process document, must delete target document,
// or it will not attempt to process it the second time
log("Failed to process " + inFile, Project.MSG_INFO);
if (outFile != null) {
outFile.delete();
}
throw new BuildException(ex);
}
} //-- processXML
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org