Pass Parameter to XSLT Using PERL

Discussion in 'Perl' started by Neal, Oct 19, 2003.

  1. Neal

    Neal Guest

    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
     
    Neal, Oct 19, 2003
    #1
    1. Advertising

  2. Neal

    Neal Guest

    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
     
    Neal, Oct 19, 2003
    #2
    1. Advertising

  3. Neal

    Jim Gibson Guest

    In article <>, Neal
    <> wrote:

    > 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).
     
    Jim Gibson, Oct 20, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Julien C.
    Replies:
    5
    Views:
    5,527
    Patrice Scribe
    Dec 23, 2003
  2. bearclaws
    Replies:
    4
    Views:
    8,691
    bearclaws
    Feb 4, 2005
  3. Replies:
    2
    Views:
    729
    Henry S. Thompson
    Oct 19, 2005
  4. Ronald S. Cook

    Can I pass a parameter without using ?value=123

    Ronald S. Cook, May 1, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    447
    Page Brooks
    May 2, 2007
  5. AzamSharp
    Replies:
    2
    Views:
    186
Loading...

Share This Page