Re: [xsl] getting combo value,not textbox value

Subject: Re: [xsl] getting combo value,not textbox value
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 27 Feb 2009 11:56:13 GMT
As has been explained, your problem is not to do with xslt, it is simply
an error in your generated html.

Your posted xsl (it would be better to post complete but small
stylesheet rather than a fragment) if made into a working stylesheet, looks
like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:str="http://exslt.org/strings";
>

<xsl:import href="http://www.exslt.org/str/functions/tokenize/str.tokenize.template.xsl"; />

<xsl:output indent="yes"/>
<xsl:variable name="idx" select="'???'"/>
<xsl:variable name="sidx" select="'???'"/>
<xsl:variable name="input" select="'???'"/>
<xsl:variable name="new" select="'???'"/>

 <xsl:template match="records">
    <table border="1">
        <tr>
            <td> Parameter </td>
            <td> Description </td>
            <td> Value </td>
        </tr>
        <xsl:apply-templates/>
    </table>
</xsl:template>

<xsl:template match="one">
    <form name="form1" method="POST" action="one.cgi">
    <tr>
        <td>
            <xsl:value-of select="label"/>
        </td>
        <td>
            <xsl:value-of select="desc"/>
        </td>
        <td>
            <xsl:if test="label = 'machine name'">
                    <select name="machine_name">
                      <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>
         <input type="hidden" name="idx" value="{$idx}"/>
         <input type="hidden" name="sidx" value="{$sidx}"/>
         <input type="hidden" name="new" value="{$new}" />
    </tr>
    </form>
    <script>
        document.form1.submit();
    </script>
</xsl:template>

</xsl:stylesheet>

If run on your example input it produces the html below which has two
forms with the same name. So first you need to correct the html to
either have one form, or two forms with different names. Once you have
working html then you should be able to write the xslt to generate the
required html.

Don't try to debug your stylesheet by executing the generated code
directly in a browser. Do it in two separate steps, so you can -see_ the
output from xslt.

The output from the above is:

$ saxon abc.xml abc.xsl
<?xml version="1.0" encoding="utf-8"?>
<table xmlns:str="http://exslt.org/strings"; border="1">
   <tr>
      <td> Parameter </td>
      <td> Description </td>
      <td> Value </td>
   </tr>
    
   <form name="form1" method="POST" action="one.cgi">
      <tr>
         <td>machine name</td>
         <td>specify machine name</td>
         <td>
            <select name="machine_name"/>
         </td>
         <input type="hidden" name="idx" value="???"/>
         <input type="hidden" name="sidx" value="???"/>
         <input type="hidden" name="new" value="???"/>
      </tr>
   </form>
   <script>
        document.form1.submit();
    </script>
    
   <form name="form1" method="POST" action="one.cgi">
      <tr>
         <td>limit</td>
         <td>specify limit which should not exceed</td>
         <td>
            <input type="text" name="limit" value=""/>
         </td>
         <input type="hidden" name="idx" value="???"/>
         <input type="hidden" name="sidx" value="???"/>
         <input type="hidden" name="new" value="???"/>
      </tr>
   </form>
   <script>
        document.form1.submit();
    </script>

</table>



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread