[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|