ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
Date Mon, 19 Mar 2001 12:27:23 GMT
bodewig     01/03/19 04:27:23

  Modified:    docs/manual/CoreTasks style.html
               src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
  Log:
  destdir in <style> is no longer required if in/out have been specified.
  
  Suggested by:	Will Holcomb <will@odin.himinbi.org>
  
  Revision  Changes    Path
  1.6       +5 -3      jakarta-ant/docs/manual/CoreTasks/style.html
  
  Index: style.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/style.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- style.html	2001/03/16 09:48:12	1.5
  +++ style.html	2001/03/19 12:27:23	1.6
  @@ -36,13 +36,15 @@
     </tr>
     <tr>
       <td valign="top">basedir</td>
  -    <td valign="top">where to find the source XML file.</td>
  -    <td align="center" valign="top">Yes</td>
  +    <td valign="top">where to find the source XML file, default is the
  +      project's basedir.</td>
  +    <td align="center" valign="top">No</td>
     </tr>
     <tr>
       <td valign="top">destdir</td>
       <td valign="top">directory in which to store the results.</td>
  -    <td align="center" valign="top">Yes</td>
  +    <td align="center" valign="top">Yes, unless in and out have been
  +      specified.</td>
     </tr>
     <tr>
       <td valign="top">extension</td>
  
  
  
  1.19      +44 -29    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  
  Index: XSLTProcess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XSLTProcess.java	2001/03/16 09:48:12	1.18
  +++ XSLTProcess.java	2001/03/19 12:27:23	1.19
  @@ -84,7 +84,7 @@
    * @author <a href="mailto:kvisco@exoffice.com">Keith Visco</a>
    * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
    * @author <a href="mailto:russgold@acm.org">Russell Gold</a>
  - * @version $Revision: 1.18 $ $Date: 2001/03/16 09:48:12 $
  + * @version $Revision: 1.19 $ $Date: 2001/03/19 12:27:23 $
    */
   public class XSLTProcess extends MatchingTask {
   
  @@ -122,32 +122,7 @@
               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 @@
                   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 @@
               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 @@
           }
       }
       
  +    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);
  
  
  

Mime
View raw message