You will need to package your xsl files as part of your projects directory structure.
For ex. you have packages (directories in other words ) for your classes.  Similarly,
you need to have a directory (under your src root) that will be the actual place where your xsl files will sit on Unix.
Since this directory will be under your src and everything up to your src is in your classpath, you will be able to refer
to it relatively after that point.
Ex.
--home in unix
    --your application
        --src
            --classes
            --config
            --xls_files(where the files are)
                StockTemplate.xsl
                StockTemplate1.xsl
                StockTemplate2.xsl
            --images
so if your classpath is up to src
then you can say new File("/xls_files/StockTemplate.xsl");
 
 
 
-----Original Message-----
From: Bob Lee [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 29, 2004 12:54 PM
To: [EMAIL PROTECTED]
Subject: RE: How to get the XSL file using relative path?

Diana,
 
Thanks for your info. If I use System.getProperty("user.dir"), I only get C:\Program Files\IBM\WebSphere Studio because I develop my project using IBM WebSphere Studio(WSAD 5.0) on my local machine. My project(ViewStock) actually is now saved in my local machine C:/workspace.   Our production server is Websphere 5.0 runing on Unix. In this case, how can the application retrieve the file using relative path without worrying about system environment and directory structure? Any suggestion about this?
 
thanks,
 
Bob

"Bokser, Diana" <[EMAIL PROTECTED]> wrote:
 I believe you can give a relative path.
Use System.getProperty("user.dir"); to find where you are running from and then specify a relative path from that location.
-----Original Message-----
From: Bob Lee [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 29, 2004 11:45 AM
To: [EMAIL PROTECTED]
Subject: How to get the XSL file using relative path?

hi,

I have a xsl file. I need to use Transformer to process this xsl source into a Transformer object. But it looks like I have to specify the full path for this XSL file. This is what I want to avoid because we do not want to change the file path manually once we deploy it to our production. Here is the codes. I appreciate it if anyone can give me some suggestions.

//ViewStock is my project name

File MyXsl = new File("C:/workspace/ViewStock/Web Content/html/StockTemplate.xsl");

//Setup XSLT

TransformerFactory factory = TransformerFactory.newInstance();

Transformer transformer = factory.newTransformer(new StreamSource(MyXsl));

 

thanks in advance,

Bob


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs

The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer.
Thank you,
Standard & Poor's


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs

Reply via email to