One Star

resource files within repository

I've created a job that performs some specific XSL transformations on the input data (xml files).
I cannot figure out where I am expected to store these XSL transformations (XSL files). I want to make them a part of the project, so the 'job script export' packs them in the job archive.
It seems to me that it is not possible to place them in the project's repository. At the moment, these XSL files are outside of the project and the only connection is a context variable that defines a path to these XSL files.
11 REPLIES
One Star

Re: resource files within repository

I suggest you to put your file in the main directory when you export it. Before you have to configure your filepath with only your filename.
I don't if you may understand what I say?
One Star

Re: resource files within repository

Thank you for the quick answer. Unfortunately, I am not sure I understand you quite well.
Just to ensure the problem is clear enough... :
I have a project and a job. The job transforms input xml files (fetched by tFTPGet) using tXSLT (in fact I use a tJava component to perform some specific transformation, but the problem is the same). tXSLT uses a context variable to fetch input xml files. It also needs a information about XSL transformation. This XSL transformation is not input data, it should be considered as a code.
So, I need to know where I am expected to store this XSL file. I believe it should be a part of the project and not in some external location (directory).
One Star

Re: resource files within repository

Are you able to run the first part of your job (tFTPGet)? to read your context variable?
If I understand what you want to do, you get an xml file from a ftp repository and you want to read this file in the second part of your job,I'm right?
Your issue comes from this first part?
One Star

Re: resource files within repository

I am able to get a xml file from the ftp server. I've also get the whole job works fine. It's not an issue. The issue is related to how the tXSLT component refers to the XSLT file.
At the moment, tXSLT is set to use a context variable that defines the file path to the XSL file. But this file path points a location outside of the project directory (e.g. c:\temp\xslt\transform.xsl).
I want to know if I could somehow incorporate this XSL file in to the project (e.g. store it in the metadata repository).
One Star

Re: resource files within repository

so your problem comes from the job export and you want to set a good configuration to be able to use your job everywhere?
One Star

Re: resource files within repository

That's right. This is the root of the problem.
One Star

Re: resource files within repository

ok so you have to put your file at the root of the project. In your tFTPGet put the local directory value to "." after you can use a filelist with the directory value to "." or directly your name file like that "mynam.xsl"
One Star

Re: resource files within repository

I think there is one more thing to explain.
Namely, tFtpGet component gets XML file from the FTP repository. I understand your point about using '.' path. It's ok.
But the second component, tXSLT uses two files: a source XML (provided by tFtpGet) that is to be transformed, and the XSL transformation itself (a XSL file).
This second file, XSL one, is a constant file that I want to have inside of the talend project. The question is where to put that XSL file.
I really appreciate your help and quick replies!
One Star

Re: resource files within repository

ok actually it's exactly the same method.
Configure your tXSLT to have access to the file XSL by putting in the field XSL File :"name.xsl".
Export your job.
Put the file (name.xsl) in the same directory as the .jar of your project.
it must work
One Star

Re: resource files within repository

Thanks. I think I've got the point.
But I was hopping there is a way to define a XSL file in the similar way I do when creating, for example, a generic schema in the metadata repository. Or the way tLoadLibrary components defines an external library that is automatically packed in the job export archive.
So I have to keep the TOS project and the set of XSL files separately and after exporting a job script I have to copy the XSL files where they are expected to be found.
One Star

Re: resource files within repository

Hello nivancevic,
sorry, I don't think there is a solution for your need at this time. But I think this is good enough for a feature request.
Additional there is actual no connection between the different types of information in tos. So we would need a new view like my suggestion in the following thread (point 1):
http://www.talendforge.org/forum/viewtopic.php?id=1322
Bye
Volker