|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using xsl:if to set-up dropdown lists?
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
|
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








