amiro 01/09/17 14:22:15
Modified: test/java/src/org/apache/qetest/xslwrapper
XsltcMainWrapper.java
Log:
checked in the wrong file; replacing it with correct one
Revision Changes Path
1.4 +31 -28
xml-xalan/test/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java
Index: XsltcMainWrapper.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xslwrapper/XsltcMainWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XsltcMainWrapper.java 2001/09/17 20:27:48 1.3
+++ XsltcMainWrapper.java 2001/09/17 21:22:14 1.4
@@ -77,7 +77,7 @@
* that calls XSLTC API's directly.
*
* @author Shane Curcuru
- * @version $Id: XsltcMainWrapper.java,v 1.3 2001/09/17 20:27:48 amiro Exp $
+ * @version $Id: XsltcMainWrapper.java,v 1.4 2001/09/17 21:22:14 amiro Exp $
*/
public class XsltcMainWrapper extends TransformWrapperHelper
{
@@ -154,9 +154,10 @@
* @param xmlName local path\filename of XML file to transform
* @param xslName local path\filename of XSL stylesheet to use
* @param resultName local path\filename to put result in
- * TWA - temp hack; use results dir to get path for to use for a dir to put
- * the translets
- *
+/* TWA - temp hack; use results dir to get path for to use for a dir to put
+the translets
+*/
+ /*
* @return array of longs denoting timing of only these parts of
* our operation: IDX_OVERALL, IDX_XSLBUILD, IDX_TRANSFORM
*
@@ -172,33 +173,35 @@
long xslBuild = 0;
long transform = 0;
- // java com.sun.xslt.cmdline.Compile play1.xsl
- // java com.sun.xslt.cmdline.Transform play.xml play1 >stdout
+ // java org.apache.xalan.xlstc.cmdline.Compile play1.xsl
+ // java org.apache.xalan.xlstc.cmdline.Transform play.xml play1 >stdout
// Timed: compile stylesheet class from XSL file
-
-/* TWA - commented out the -u option
+// String[] args1 = new String[2];
+// args1[0] = "-s"; // Don't allow System.exit
+/* TWA - commented out the following for short-term
Problem when local path/file is being used, somewhere a file://// prefix is
being appended to the filename and xsltc can't find the file even with the -u
-So as a temp fix - strip off the protocol prefix and pass the local path/file
+So I strip off the protocol prefix and pass the local path/file
args1[1] = "-u"; // Using URIs
+ args1[2] = xslName;
*/
/* TWA - temporay hack to construct and pass a directory for translets */
- int tidx = resultName.indexOf("tests/");
- String tdir = resultName.substring(0, tidx+6);
- String transletsdirName = tdir + "translets";
+ int last = resultName.lastIndexOf('/');
+ String tdir = resultName.substring(0, last);
+ int next = tdir.lastIndexOf('/');
+ String transletsdirName = tdir.substring(0, next);
+
String[] args1 = new String[4];
args1[0] = "-s";
args1[1] = "-d";
args1[2] = transletsdirName;
args1[3] = xslName;
-/* Shane said this didn't need to be done anymore
int idx = xslName.indexOf("file:////");
if (idx != -1){
xslName = new String(xslName.substring(8));
args1[3] = xslName;
}
-*/
startTime = System.currentTimeMillis();
/// Transformer transformer = factory.newTransformer(new
StreamSource(xslName));
Compile.main(args1);
@@ -206,7 +209,6 @@
// Verify output file was created
// WARNING: assumption of / here, which means we assume URI not local path
- needs revisiting
- //TWA - / may mean local file on Unix platform
int nameStart = xslName.lastIndexOf('/') + 1;
String baseName = xslName.substring(nameStart);
int extStart = baseName.lastIndexOf('.');
@@ -218,24 +220,25 @@
// Timed: read/build xml, transform, and write results
-/* TWA - We shouldn't use the -u option unless we are really using URLs.
-With or without the -u option, the files are getting a file://// prefix
-which caused them to be not found
-*/
-
-// args2[1] = "-u"; // Using URIs
-
+/* TWA - I don't see how this could have worked, there is no -s option in DefaultRun
+so passing it in the args2 caused usuage messages to be output.
+Also, we shouldn't use the -u option unless we are really using URLs,
+I'm just trying to get it to work with local path/files. With or without the
+-u option, the files were getting a file://// prefix with caused them to be not
found
String[] args2 = new String[3];
args2[0] = "-s"; // Don't allow System.exit
- args2[1] = xmlName;
-/* Shane said this doesn't need to be done anymore
+ args2[1] = "-u"; // Using URIs
+ args2[2] = xmlName;
+ args2[3] = baseName; // Just basename of the .class file, without the
.class
+ // Note that . must be on CLASSPATH to work!
+*/
+ String[] args2 = new String[2];
+ args2[0] = xmlName;
int idx2 = xmlName.indexOf("file:////");
if (idx2 != -1){
- args2[1] = new String(xmlName.substring(8));
+ args2[0] = new String(xmlName.substring(8));
}
-*/
- args2[2] = baseName;// Just basename of the .class file, without the .class
- // Note that . must be on CLASSPATH to work!
+ args2[1] = baseName;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream newSystemOut = new PrintStream(baos);
PrintStream saveSystemOut = System.out;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]