Subject: Re: [xsl] "form.submit" not working From: himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx> Date: Wed, 25 Feb 2009 14:24:30 +0530 |
I got the problem. If I have 2 entries in XML file,then submit works.If I have 1 entry,then it doesn't. This is the working case. <?xml version='1.0'?> <?xml-stylesheet href="one.xsl" type="text/xsl"?> <tracks> <one> <name>ip</name> <label>Machine IP</label> <desc>specify machine ip</desc> </one> <one> <name>name</name> <label>Machine Name</label> <desc>specify machine name</desc> </one> </tracks> But I want 1 entry in XML file,i.e.Machine IP and not second entry. What should I do? On Wed, Feb 25, 2009 at 11:40 AM, himanshu padmanabhi <himanshu.padmanabhi@xxxxxxxxx> wrote: > "not worked" means form not submitted.HTML elements specified in XSL > got printed.I am using Firefox 3 Beta 5.Not script error,only problem > is cgi script is not called on form submit. > > Equivalent HTML code works well. > > print "<form name=\"form1\" method=\"POST\" action=\"one.cgi\"> > <tr> > <td> > <input type=\"text\" name=\"machine_ip1\" value=\"1\"></input> > </td> > <td> > <input type=\"text\" name=\"machine_ip2\" value=\"2\"></input> > </td> > <td> > <input type=\"text\" name=\"machine_ip3\" value=\"3\"></input> > </td> > </tr> > </form> > <script type=\"text/javascript\"> > document.form1.submit(); > </script>"; > > Similar XSL code also works well(submit works here) > > <xsl:output method="html"/> > > <xsl:template match="tracks"> > <table border="1"> > <tr> > <td> Parameter </td> > <td> Description </td> > <td> Value </td> > </tr> > <xsl:apply-templates/> > </table> > </xsl:template> > > <xsl:template match="two"> > <form name="form1" method="POST" action="two.cgi"> > <tr> > <td> > <xsl:value-of select="label"/> > </td> > <td> > <xsl:value-of select="desc"/> > </td> > <td> > <xsl:if test="label = 'machine name'"> > <select> > <xsl:call-template name="str:tokenize"> > </xsl:call-template> > </select> > </xsl:if> > > <xsl:if test="label = 'limit'"> > <input type="text" name="limit" value=""> > </input> > </xsl:if> > </td> > </tr> > </form> > <script> > document.form1.submit(); > </script> > </xsl:template> > > <!-- ONLY STR:TOKENIZE IS DIFFERENT HERE --> > <xsl:template name="str:tokenize"> > <xsl:param name="args" select="$args" /> > <xsl:param name="delimiters" select="' 	
'" /> > <xsl:choose> > > <xsl:when test="not($args)" /> > <xsl:when test="not($delimiters)"> > <xsl:call-template name="str:_tokenize-characters"> > <xsl:with-param name="args" select="$args" /> > </xsl:call-template> > </xsl:when> > <xsl:otherwise> > <xsl:call-template name="str:_tokenize-delimiters"> > <xsl:with-param name="args" select="$args" /> > <xsl:with-param name="delimiters" select="$delimiters" /> > </xsl:call-template> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > <xsl:template name="str:_tokenize-characters"> > <xsl:param name="args" /> > <xsl:if test="$args"> > <token><xsl:value-of select="substring($args, 1, 1)" /></token> > <xsl:call-template name="str:_tokenize-characters"> > <xsl:with-param name="args" select="substring($args, 2)" /> > </xsl:call-template> > </xsl:if> > </xsl:template> > > <xsl:template name="str:_tokenize-delimiters"> > <xsl:param name="args" /> > <xsl:param name="delimiters" /> > <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)" /> > <xsl:choose> > <xsl:when test="not($delimiter)" > > <option><xsl:value-of select="$args" /></option> > </xsl:when> > <xsl:when test="contains($args, $delimiter)"> > <xsl:if test="not(starts-with($args, $delimiter))"> > <xsl:call-template name="str:_tokenize-delimiters"> > <xsl:with-param name="args" > select="substring-before($args, $delimiter)" /> > <xsl:with-param name="delimiters" > select="substring($delimiters, 2)" /> > </xsl:call-template> > </xsl:if> > <xsl:call-template name="str:_tokenize-delimiters"> > <xsl:with-param name="args" select="substring-after($args, > $delimiter)" /> > <xsl:with-param name="delimiters" select="$delimiters" /> > </xsl:call-template> > </xsl:when> > <xsl:otherwise> > <xsl:call-template name="str:_tokenize-delimiters"> > <xsl:with-param name="args" select="$args" /> > <xsl:with-param name="delimiters" > select="substring($delimiters, 2)" /> > </xsl:call-template> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > </xsl:stylesheet> > > Just don't know now,what is going wrong.other HTML form elements gets > printed,only form.submit isnt working..:( > > Regards, > Himanshu > > > On Tue, Feb 24, 2009 at 7:30 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote: >> >> himanshu padmanabhi wrote: >>> >>> This is my one.cgi which should be called on xsl submit >>> >>> #!/usr/bin/perl >> >> You will need to discuss your Perl code on a Perl forum. >> >>> HTML elements gets printed correctly in my given code also and submit >>> code given by Mr. Martin not worked(sorry,maybe I did something >>> wrong)..:(( >> >> What exactly happens when you say "not worked"? Which browser do you use? Do you get a script error? >> Does the submit code work in a static HTML document but not in the HTML generated by the stylesheet? In that case at least it could require a fix to the stylesheet which would be on topic here. >> >> >> -- >> >> Martin Honnen >> http://JavaScript.FAQTs.com/ >> > > > > -- > Regards, > Himanshu Padmanabhi > > > > > -- > Regards, > Himanshu Padmanabhi > -- Regards, Himanshu Padmanabhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] "form.submit" not working, himanshu padmanabhi | Thread | [xsl] If no parameters,then what sh, himanshu padmanabhi |
RE: [xsl] Re: encoding error when u, Michael Kay | Date | Re: [xsl] Re: encoding error when u, Nick Fitzsimons |
Month |