ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r426494 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
Date Fri, 28 Jul 2006 13:11:43 GMT
Author: jhm
Date: Fri Jul 28 06:11:43 2006
New Revision: 426494

URL: http://svn.apache.org/viewvc?rev=426494&view=rev
Log:
- back to File-based algorithm
- cpu enhancement

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java?rev=426494&r1=426493&r2=426494&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java Fri Jul 28 06:11:43
2006
@@ -1036,24 +1036,15 @@
         XSLTLiaison liaison,
         File inFile
     ) throws Exception {
-        String fileName = FileUtils.getRelativePath(baseDir, inFile);
-        
-        String name;
-        String dir;
-        int lastDirSep = fileName.lastIndexOf("/");
-        if (lastDirSep > -1) {
-            name = fileName.substring(lastDirSep + 1);
-            dir  = fileName.substring(0, lastDirSep);
-        } else {
-            name = fileName;
-            dir  = ".";      // so a dir+"/"+name would not result in an absolute path
-        }
-        
         if (fileNameParameter != null) {
-            liaison.addParam(fileNameParameter, name);
+            liaison.addParam(fileNameParameter, inFile.getName());
         }
         if (fileDirParameter != null) {
-            liaison.addParam(fileDirParameter, dir);
+            String fileName = FileUtils.getRelativePath(baseDir, inFile);
+            File file = new File(fileName);
+            // Give always a slash as file separator, so the stylesheet could be sure about
that
+            // Use '.' so a dir+"/"+name would not result in an absolute path
+            liaison.addParam(fileDirParameter, (file.getParent()!=null) ? file.getParent().replace('\\','/')
: "." );
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message