Pass Parameter to XSLT Using PERL

N

Neal

I need to know how to pass a parameter from PERL to an XSLT when using
that XSLT to transform XML. For instance, I'd like to pass a paramter
that I retrieve from the queryString and pass it into XSLT which will
create my HTML.

Here's what I have for the basic transformation:

#!/usr/local/bin/perl
use XML::XSLT;/

$xmlfile = "resume.xml";
$xslfile = "resume.xsl";

$parser = XML::XSLT->new ($xslfile);
$parser->transform($xmlfile);
$parser->print_result();

Does anyone know what I would need to pass the paramter?

Thanks.
Neal
 
N

Neal

Actually, I figured out (in theory) how to pass a parameter to an XSL.
I just added a string into the args:

$parser->transform($xmlfile, test => "'hello world'");

Now the problem seems to be that the XSL is ignoring it's parameters
and variables. Perhaps the parser is set to not work with these by
default or something? Man, what a pain is the ass!

Does anyone know how to get PERL to interpret variables and params in
an XSLT?

Thanks.
Neal
 
J

Jim Gibson

Neal said:
Actually, I figured out (in theory) how to pass a parameter to an XSL.
I just added a string into the args:

$parser->transform($xmlfile, test => "'hello world'");

Now the problem seems to be that the XSL is ignoring it's parameters
and variables. Perhaps the parser is set to not work with these by
default or something? Man, what a pain is the ass!

Does anyone know how to get PERL to interpret variables and params in
an XSLT?

Thanks.
Neal

FYI: this newsgroup is defunct. You might want to try
comp.lang.perl.modules for this question (and comp.lang.perl.misc for
general perl questions in the future).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top