|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: AW: An easy problem
Thanks thomas
I tried that .i would not say that it is not working but there is some thing which is not correct but i am not getting what? 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='text'] or input[@type='password'] or input[@type='checkbox']"> <postfield name="{@name}" value="{concat('$',@name)}"/> </xsl:when> <xsl:when test="input[@type='radio']"> <xsl:for-each select="//input[generate-id(.)=generate-id(key('radios', @name))]"> <postfield name="{@name}" value="{concat('$',@name)}"/> </xsl:for-each> </xsl:when> </xsl:choose> </go> </do> <xsl:apply-templates select="*"/> </xsl:template> i tried your style sheet but it was processing the input types twice as i have written template match style sheet for input type separately. like <xsl:template match="input[@type='text']"> <input name="{@name}" type="{@type}"> <xsl:apply-templates/> </input> <xsl:template match="input[@type='password']"> <input name="{@name}" type="{@type}"> <xsl:apply-templates/> </input> <xsl:template match="input[@type='']"> <input name="{@name}" type="text"> <xsl:apply-templates/> </input> <xsl template match="input[@type='radio'] and count( . | key('radiobutton', @name)[1] ) = 1"> <select name="{@name}"> <xsl:for-each select="key('radiobutton', @name)"> <option> <xsl:value-of select="following- sibling::text()[1]"/> </option> </xsl:for-each> </select> <xsl:template match="input[@type='checkbox']"> <select name="{@name}" > <option value="{@value}"> <xsl:value-of select="following-sibling::text()[1]"/> </option> </select> </xsl:template> So now the output i am getting is <do type="accept" label="submit">
<go href="choice.html" method="post">
<postfield name="gender" value="$gender"/>
</go>
</do> input your name: <input name="name" type="text"/><br/>
input password :<input name="pwd" type="password"/>
Enter the choices<select name="name1">
<option value="">America</option>
</select><br/>
<select name="name2"><option value="">Europe</option>
</select><br/>
<select name="name3"><option value="">Asia </option>
</select>
Enter the gender
<select name="gender">
<option value="mal">male</option>
<option value="fem"> female</option>
</select>Where as what it should be like input your name: <input name="name" type="text"/> <br/> input password : <input name="pwd" type="password"/> Enter the choices <select name="name1"> <option value=""> America </option> </select> <br/> <select name="name2"> <option value=""> Europe </option> </select> <br/> <select name="name3"> <option value=""> Asia </option> </select> Enter the gender <select name="gender"> <option value="mal"> male </option> <option value="fem"> female </option> </select> <br/> <do label="submit" type="accept"> <go href="choice.html" method="post"> <postfield name="name" value="$name"/> <postfield name="pwd" value="$pwd"/> <postfield name="name1" value="$name1"/> <postfield name="name2" value="$name2"/> <postfield name="name3" value="$name3"/> <postfield name="gender" value="$gender"/> </go> </do> and are these two same <xsl:for-each select="//input[generate-id(.)=generate-id(key('radios', @name))]"> <xsl:for-each select="@type='radio' and count( . | key('radiobutton', @name)[1] ) = 1"> And now the question What is the problem . alexek <?xml version="1.0" encoding="UTF-8"?> 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
|

Cart








