Re: [xsl] Calling Java Xalan inside Perl on Unix -- THANKS!

Subject: Re: [xsl] Calling Java Xalan inside Perl on Unix -- THANKS!
From: Gan Uesli Starling <alias@xxxxxxxxxxx>
Date: Thu, 17 Apr 2003 12:45:52 -0400
David McKain wrote:
On Thu, Apr 17, 2003 at 10:07:42AM -0400, Gan Uesli Starling wrote:

Your problem is shell escaping. The list @xsl you pass to system() has 2
arguments so is equivalent to typing:

java "org.apache.xalan.xslt.Process -in blah.xml blah..."

at the shell (I've omitted the last part of the command to make it fit
on one line!)

Everything inside the double quotes is treated as ONE argument by the
shell, so what this does is ask Java to find and run the class called
org.apache.xalan.xslt.Process -in blah.xml blah... This class
name includes the space and the '-in' stuff and almost certainly doesn't
exist, hence the error.

To fix, do:

my @xsl = ("java", "org.apache.xalan.xslt.Process", "-in",
            "$filename.xml", ...);
system(@xsl);


That did it. Thanks!

Gan

PS: Is there a pure Perl way of XSLT that is as easy
as calling like above to Java Xalan? I lernt the Java
way from the XSLT Oreilly book. But it seems a bit silly
to call Java from Perl (even though it now works fine).


--


Mistera Sturno - Rarest Extinct Bird

 <(+)__       Gan Uesli Starling
  ((__/)=-    Kalamazoo, MI, USA
   `||`
    ++        http://starling.us


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



Current Thread