#Defining objects for XML,XSLT. my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); #Parsing both files my $source = $parser->parse_file($xmlfile); # '$style_doc' represents 'XML::LibXML::Document' object representing +an XSLT file. my $style_doc = $parser->parse_file($xslfile); my $stylesheet = $xslt->parse_stylesheet($style_doc); # 'Transform' returns a scalar that is the XSLT rendering of the 'XML: +:LibXML::Document' object using the desired output format(specified i +n the xsl:output tag in the stylesheet) my $results = $stylesheet->transform($source, XML::LibXSLT::xpath_to +_string(args1=> "$in{'args1'}",args2=> "$in{'args2'}",args3=> "$in{'a +rgs3'}",idx => "$in{'idx'}",newperiod => "$in{'newperiod'}")); # IN ABOVE CASE,I DN'T WANT TO HARDCODE 'ARGS' LIKE 3 ABOVE.I AM GETTI +NG TOTAL NUMBER OF PARAMETERS IN VARIABLE.SO IF ARGS CAN BE 5 IN SOME + CASE,ABOVE LINE SHOULD BE LIKE THIS.. # my $results = $stylesheet->transform($source, XML::LibXSLT::xpath_to +_string(args1=> "$in{'args1'}",args2=> "$in{'args2'}",args3=> "$in{'a +rgs3'}",args4=> "$in{'args4'}",args5=> "$in{'args5'}",idx => "$in{'id +x'}",newperiod => "$in{'newperiod'}")); print $stylesheet->output_string($results);
Actually I want that it should check '$in' hash.It contains '$in{args<number>}'.It should pass these '$in{args<number>}' variables to XSL file.

In reply to passing variable arguments to XSLT by Anonymous Monk
in thread passing variable arguments to XSL from perl by himanshu.padmanabhi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.