-----Original Message-----
From: r.gordon [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 1:00 AM
To: Sablotron Mailing List
Subject: [Sab] running Sablotron from Perl

I am able to use the following successfully in a Perl script;
system `sabcmd temp.xsl temp.xml`
 
I would like to pass a variable instead as the data file, i.e. $out.
Tried the following:
system `sabcmd temp.xsl $out` nothing happens
system `sabcmd temp.xsl "$out"` Parsing 'file://stdin'... waits forever
system `sabcmd temp.xsl '$out'` crashes, memory access violation. dump shows beginning of data from variable
 
Using Windows binary on Win98
 
any suggestions as to what I'm doing wrong? 
It would appear that you're using backtics to quote the system function args: you're mixing two methods. Instead, use a quoting scheme that allows variable interpolation for the system command or use a variable to hold the result of a backtic'd expression: eg. perl -e "$d='data.xml';system \"sabcmd style.xsl $d\"" or perl -e "$d='data.xml';$r=`sabcmd style.xsl $d`;print $r"
 
Alternatively, use the module interface:
#!perl -w
 
use strict;
use XML::Sablotron qw(:all);
my ($template_uri, $data_uri, $result_uri, $params, $buffers, $sab, $code, $result, $return);
$template_uri = "file://d:/xml/style.xsl";
$data_uri = "file://d:/xml/data.xml";
$result_uri = "arg:/result";
$params = [];
$buffers = [];
 
$sab = new XML::Sablotron();
$code = $sab->RunProcessor($template_uri, $data_uri, $result_uri, $params, $buffers);
exit $code if $code;
$return = $sab->GetResultArg("result");
print $return;
__END__
 

Reply via email to