[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

An easy problem

Subject: An easy problem
From: "alex ek" <alexek@xxxxxxxxxxxxxx>
Date: 27 Jul 2002 14:51:12 -0000
an easy problem
Hello All
I have a problem in xslt style sheet in which i am writing template match for the form tag of HTML.
I hev some thing like this in HTML
<form method="POST" action="choice.html">
<p>Enter the choices</p>
<p><input type="checkbox" name="name1" checked="checked" />America<br />
<input type="checkbox" name="name2" checked="checked" />Europe<br />
<input type="checkbox" name="name3" />Asia </p>
<p>Enter the gender</p>
<input type="radio" name="gender" value="mal" />male<br />
<input type="radio" name="gender" value="fem" /> female
</form>


And i want to convert it in this form

<do label="submit" type="accept">
<go href="choice.html" method="post">
<postfield name="name1" value="$name1"/>
<postfield name="name2" value="$name2"/>
<postfield name="name3" value="$name3"/>
<postfield name="gender" value="$gender"/>
</go>
</do>

And the style sheet i am using is

 <xsl:template match="form">
        <do type="accept" label="submit">
         <go href="@action" method="@method">
          <xsl:choose>
           <xsl:when test="input[@type='checkbox']">
            <xsl:for-each select="input[@type='checkbox']">
             <postfield name="@name" value="$@name">
            </xsl:for-each>
           </xsl:when>
           <xsl:when test="input[@type='radio']>
            <postfield name=@name" value="$@name">
           </xsl:when>
           </xsl:choose>
          </go>
        </do>
       <xsl:apply-templates select="*"/>
      </xsl:template>

Though i should check in input[@type='radio'] that name of the preceding sibling is same or not because in type radio name is same for all.so it should come only once .
But this is not working even after removing the when condition of input type radio and simply using type check box only .
It is giving error .
What is wrong in it and what should be the correct way.
Itried various combinations even removing for-each loop and giving only one input type =checkbox in input but it is not working .
The rest of style sheet working .
if i use only


<xsl:template match="form">
<p><xsl:apply-templates select="*"/>
</xsl:template>
It is working but as obvious not creating any post field which is required for form handling.
Need help.
Alexek


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.