in reply to Re^2: Push + variable argument
in thread Push + variable argument

Thank you very much all especially dHarry.Now it is working. $str comes from another cgi script and contains values separated by spaces.
$str=$in{'values_separated_by_spaces'};
I am getting values in $str and they are passed to XSL script using XPath mechanism as you told. I want to separate these space values in XSL script so to display individual ones.Can you tell how to do this?

Replies are listed 'Best First'.
Re^4: Push + variable argument
by dHarry (Abbot) on Feb 11, 2009 at 08:25 UTC

    Do the separating in Perl (for example with the split statement) and pass the individual arguments/parameters to the XSLT. So something like:

    In the xslt:

    <xsl:param name="param_1"/> <xsl:param name="param_2"/>

    In the Perl script:

    my ($par1, $par2) = split (/ /,$str); my $results = $stylesheet->transform($source, XML::LibXSLT::xpath_to_string(param_1 => $par1), XML::LibXSLT::xpath_to_string(param_2 => $par2) );

    NB The utility function xpath_to_string takes care of the quoting. This is probably the better/easier way of doing things. See the documentation for details. See playing with XSLT for a bigger example.