Re: [xsl] pass variables to next form on submit from XSL file

Subject: Re: [xsl] pass variables to next form on submit from XSL file
From: himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx>
Date: Sat, 21 Feb 2009 13:05:45 +0530
If I do this,

1.<xsl:param name="idx" />
2.<input type="hidden" name="idx" value="{$idx}"/>

I am not getting value in "idx",only using line 2 does give.

On Fri, Feb 20, 2009 at 9:44 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> I don't know Perl (last used it more than 10 years ago) or its API to XSLT,
> so I can't comment on your syntax. But you seem to have the idea almost
> right.
>
> If you want $argu1 to be a stylesheet parameter passed from your Perl code
> to your XSLT code, then
>
> (a) you must declare it in the stylesheet using <xsl:param>
>
> (b) the reference to the value should be <input value="{$argu1}"/>, not
> <input value="$argu1"/>.
>
> Michael Kay
> http://www.saxonica.com/
>
>> -----Original Message-----
>> From: himanshu padmanabhi [mailto:himanshu.padmanabhi@xxxxxxxxx]
>> Sent: 18 February 2009 09:28
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: Re: [xsl] pass variables to next form on submit from XSL file
>>
>> Do you mean to say I should do this in xsl file ..
>>
>> <form>
>>     <td>
>>             <input type=hidden name="argu1" value="$argu1">
>>     </td>
>> </form>
>>
>> and I should call xsl file using this perl sentense.
>>
>> my $results = $stylesheet->transform($source, string  =>
>> "'$str'",val => "'1'",argu1 => "'$argument'");
>>
>> so that in the next form(which is called by xsl file),I can
>> use $in{'argu1'} ?
>>
>> On Tue, Feb 17, 2009 at 6:57 PM, Michael Kay
>> <mike@xxxxxxxxxxxx> wrote:
>> > Remember that your stylesheet is just generating an HTML
>> page. First
>> > work out what HTML you want to generate, then remember that
>> it's just data.
>> > There's nothing magic about the fact that part of the page is
>> > Javascript code, as far as the XSLT is concerned it's data
>> like everything else.
>> >
>> > So, your calling application (myfile.cgi) extracts the
>> variables from
>> > the HTTP request, it passes them to the stylesheet as stylesheet
>> > parameters, and the stylesheet copies them into the
>> generated client-side Javascript code.
>> >
>> > Michael Kay
>> > http://www.saxonica.com/
>> >
>> >> -----Original Message-----
>> >> From: himanshu padmanabhi [mailto:himanshu.padmanabhi@xxxxxxxxx]
>> >> Sent: 17 February 2009 13:11
>> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> >> Subject: [xsl] pass variables to next form on submit from XSL file
>> >>
>> >> How to pass variables from XSL file to next form on form submit?
>> >>
>> >> CODE
>> >>
>> >> myfile.cgi
>> >>
>> >>     $str=$in{'some_value'};
>> >>     my $parser = XML::LibXML->new();
>> >>     my $xslt = XML::LibXSLT->new();
>> >>
>> >>     my $source = $parser->parse_file($xmlfile);
>> >>     my $style_doc = $parser->parse_file($xslfile);
>> >>
>> >>     my $stylesheet = $xslt->parse_stylesheet($style_doc);
>> >>
>> >>     my $results = $stylesheet->transform($source, string  =>
>> >> "'$str'",val => "'1'");
>> >>     print $stylesheet->output_string($results);
>> >>
>> >>
>> >> myfile.xsl
>> >>
>> >> <form name="form1" method="POST" action="file1.cgi">
>> >>      <tr>
>> >>             <td>
>> >>                          <xsl:value-of select="label"/>
>> >>             </td>
>> >>             <td>
>> >>                         <xsl:value-of select="desc"/>
>> >>             </td>
>> >>             <td>
>> >>                    <select>
>> >>                            <xsl:call-template name="str:tokenize">
>> >>                            </xsl:call-template>
>> >>                   </select>
>> >>            </td>
>> >>     </tr>
>> >> </form>
>> >>
>> >> <xsl:choose>
>> >> <xsl:when test="$val &gt; 1">
>> >> <script>
>> >>         document.mon.submit();
>> >> </script>
>> >>  </xsl:when>
>> >>  </xsl:choose>
>> >>
>> >> </xsl:template>
>> >>
>> >>
>> >> file1.cgi
>> >>
>> >> Here I want to access $string and $val.XSL should give
>> them on form
>> >> submit.How to access those here?
>> >> ----------------------------
>> >> Regards,
>> >> Himanshu Padmanabhi
>> >
>> >
>>
>>
>>
>> --
>> Regards,
>> Himanshu Padmanabhi
>
>



-- 
Regards,
Himanshu Padmanabhi

Current Thread