[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: jd.xsltc translet performs System.exit ?

Subject: Re: jd.xsltc translet performs System.exit ?
From: Johannes Döbler <jd@xxxxxxxxxxxxxx>
Date: Fri, 15 Aug 2003 22:33:22 +0200
translet

Hi,

I want to run a translet generated by jd.xsltc via a java-program
several times in a loop. It seems that only the first pass is done
and after this the program stops. Does the translet do this? How
can I prevent it from doing so?

In the following code "hello1" is printed only one time, "hello2"
doesn't get printed at all. Diml2cmsTranslet is the translet created
by jd.xsltc (Version 1.0, released 13 May 2003).

for(int s=0; s<parts.getLength(); s++) {

[ ... ]

       Diml2cmsTranslet cmstranslet = new Diml2cmsTranslet();
       String transletarguments[];
       transletarguments = new String[6];
       transletarguments[0]= "-out";
       transletarguments[1]= cmsContainerFile;
       transletarguments[2]= "-param";
       transletarguments[3]= "SELECTID";
       transletarguments[4]= "'" + id + "'";
       transletarguments[5]= dimlFileName;

       System.out.println("hello1");
       cmstranslet.main(transletarguments);
       System.out.println("hello2");

} // end for

Hope thats not a too stupid question,

Burghard ;)


This question might be too product specific for xsl-list but here is the answer:
The main method of a Translets ends with a call to System.exit() to set an appropriate exit code.
Use the following code schema to access the commandline interface without System.exit() being called:


import jd.xml.xslt.translet.TransletCmdLine;
...
MyTranslet mytranslet = new MyTranslet();
String transletArgs[] = ...

try
{
    TransletCmdLine cmdline = new TransletCmdLine(myTranslet);
    cmdline.evaluate(transletArgs);
}
catch(Exception e)
{
    ...
}

best regards,
Johannes Döbler


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.