Subject: Using xsl:if to set-up dropdown lists? From: Cliodhna Mc Guirk <cliodhna@xxxxxx> Date: Fri, 30 Jul 1999 15:54:41 +0100 |
I've got a pretty straight forward problem but I can't think of a straight forward solution. I want to set an option field on a drop down list to be selected, depending on the value of an xml element. So if I have as input: <title>Dr</title> <first-name>John</first-name> <sur-name>Mooney</first-name> I'd like to have as HTML output: Name: <select> <option>Mr</option> <option>Mrs</option> <option selected="1" value="Dr">Dr</option> </select> John Mooney So for the xsl I'd have something like: <xsl:template match="title"> <SELECT NAME="title"> <OPTION VALUE="Mr">Mr </OPTION> <OPTION SELECTED="1" VALUE="{../title}"><xsl:value-of select="." /></OPTION> <OPTION VALUE="Mrs">Mrs</OPTION> </SELECT> </xsl:template> Except in the case above, I'm presuming that the title is not Mr or Mrs which won't work. Does anyone have any suggestions on how I could set the attribute on the correct tag? Thanks Cliodhna -- ============================================================================ ___ Dublin_______NUA: Internet Strategy & Development_________ New York_____ Tel: +353-1-676-8996 http://www.nua.ie/ Tel: + 212 358 1775 Fax: +353-1-283-9988 Fax: + 212 358 1760 Cliodhna Mc Guirk EMAIL: cliodhna@xxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Someone bashing XSL, Kay Michael | Thread | why no keeps and breaks properties , Randy Hudson |
Someone bashing XSL, Duane Nickull | Date | why no keeps and breaks properties , Randy Hudson |
Month |