ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
Date Fri, 23 Jun 2000 21:00:55 GMT
rubys       00/06/23 14:00:53

  Modified:    src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
  Log:
  Now, commit something that works...
  
  Revision  Changes    Path
  1.2       +23 -19    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTProcess.java	2000/06/23 16:47:04	1.1
  +++ XSLTProcess.java	2000/06/23 21:00:51	1.2
  @@ -83,7 +83,7 @@
    *
    * @author <a href="mailto:kvisco@exoffice.com">Keith Visco</a>
    * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
  - * @version $Revision: 1.1 $ $Date: 2000/06/23 16:47:04 $
  + * @version $Revision: 1.2 $ $Date: 2000/06/23 21:00:51 $
    */
   public class XSLTProcess extends MatchingTask {
   
  @@ -122,11 +122,28 @@
   	scanner = getDirectoryScanner(baseDir);
   	project.log("Transforming into "+destDir,project.MSG_INFO);
   
  +        // if processor wasn't specified, default it to xslp or xalan,
  +        // depending on which is in the classpath
  +        if (liaison == null) {
  +           try {
  +               setProcessor("xslp");
  +           } catch (Exception e1) {
  +               try {
  +                   setProcessor("xalan");
  +               } catch (Exception e2) {
  +                   throw new BuildException(e2);
  +               }
  +           }
  +        }
  +
  +	project.log("Using "+liaison.getClass().toString(),project.MSG_VERBOSE);
  +
   	try {
   	    // Create a new XSL processor with the specified stylesheet
   	    if (xslFile != null) {
  -		project.log("Loading stylesheet " + xslFile, project.MSG_INFO);
  -                liaison.setStylesheet( new File(baseDir,xslFile.toString()).toString()
);
  +                String file = new File(baseDir,xslFile.toString()).toString();
  +		project.log("Loading stylesheet " + file, project.MSG_INFO);
  +                liaison.setStylesheet( file );
   	    }
   	} catch (Exception ex) {
   	    project.log("Failed to read stylesheet " + xslFile,project.MSG_INFO);
  @@ -183,14 +200,15 @@
        * Sets the file to use for styling relative to the base directory.
        */
       public void setProcessor(String processor) throws Exception {
  +
   	if (processor.equals("xslp")) {
               liaison = (XSLTLiaison) Class.forName("org.apache.tools.ant.taskdefs.optional.XslpLiaison").newInstance();
  -	} if (processor.equals("xalan")) {
  +	} else if (processor.equals("xalan")) {
               liaison = (XSLTLiaison) Class.forName("org.apache.tools.ant.taskdefs.optional.XalanLiaison").newInstance();
           } else {
               liaison = (XSLTLiaison) Class.forName(processor).newInstance();
           }
  -        
  +
       }
   
       /*
  @@ -199,20 +217,6 @@
       {
   
           
  -        // if processor wasn't specified, default it to xslp or xalan,
  -        // depending on which is in the classpath
  -        if (liaison == null)
  -           try {
  -               setProcessor("xslp");
  -           } catch (Exception e) {
  -               try {
  -                   setProcessor("xalan");
  -               } catch (Exception e) {
  -                   throw new BuildException(e);
  -               }
  -           }
  -        }
  -
           if (!sourceDir.isDirectory()) {
               throw new BuildException(sourceDir.getName() +
                   " is not a directory!");
  
  
  

Mime
View raw message