Brian Hancock wrote:
Hi,
My Perl script receives data back from a legacy database in the form
of an XML file, which I want to process with an XSL template. I am
thinking of using 'xsltproc' to process the file.
The only way I have used xsltproc is as a commandline , eg
system('xsltproc -o myoutput.xxx mytemplate.xsl myxml.xml')
and then reading the output file, which might either be an xml or a
html document, and printing it to stdout, and then unlinking my
temporary xml input and the output files.
For some scripts, usually in the case of errors , I generate a (very
simple) XML from a string and print that to stdout. I would like also
to be able to apply an XSL template against that, and so I am saving
that xml document string to a temporary file so I can use xsltproc as
per above.
I know this is very clumsy. I think perhaps I should be using a pipe,
but I am really at a loss where to start. My two major questions would
be,
1. can I apply a transformation against the XSLT and XML but instead
of saving the output to a file, can I retrieve that to a string, and,
2. instead of having my input xml file as a file on disk could it come
from a string representation of my xml document.
Alternatively, should I be approaching this from an entirely different
direction.
I think you probably want to think about a different direction
entirely. Start with a google search of XSLT and CGI. You will find a
number of articles. No temporary files or or system() calls should be
necessary. Also, a search of CPAN for XSLT will likely turn up many
interesting modules.
Sean
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>