xsl-list
[Top] [All Lists]

[xsl] "form.submit" not working

2009-02-25 01:11:23
"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="' &#x9;&#xA;'" />
    <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(_dot_)Honnen(_at_)gmx(_dot_)de> 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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--
Regards,
Himanshu Padmanabhi




--
Regards,
Himanshu Padmanabhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>