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

Using xsl:if to set-up dropdown lists?

Subject: Using xsl:if to set-up dropdown lists?
From: Cliodhna Mc Guirk <cliodhna@xxxxxx>
Date: Fri, 30 Jul 1999 15:54:41 +0100
xsl if option selected
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

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.