RE: [xsl] Selecting an option

Subject: RE: [xsl] Selecting an option
From: Heather Lindsay <heather.lindsay@xxxxxxxxxxxxx>
Date: Wed, 12 Sep 2001 15:37:56 -0400
	I'm not sure if this is what you are asking without more information
but here it goes...

Say you have an XML file that looks like this:


And you want an html like this:

				<select name="myMenu">
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5"

Then you would need this XSLT:
<xsl:stylesheet version="1.0"
   <xsl:template match="/">
			   <select name="myMenu">
					<xsl:with-param name="default"
   <xsl:template match="value">
	<xsl:param name="default"/>
	   <xsl:when test=". = $default">
		  <option value="{.}" selected="selected"><xsl:value-of
		<option value="{.}"><xsl:value-of select="."/></option>


I hope that helps.  It's hard to know what you are asking for without
example XML and the relevant segment of what you've tried so far in your

Good luck,

-----Original Message-----
From: Carlos Durand Silvestrin [mailto:csilvestrin@xxxxxxxxxxx]
Sent: Wednesday, September 12, 2001 1:53 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Selecting an option

I want to know the better way to select one option below using XSLT:

<select name="note">	
	<option value="0">0</option>
	<option value="1">1</option>
	<option value="2">2</option>
	<option value="3">3</option>
	<option value="4">4</option>
	<option value="5">5</option>
	<option value="6">6</option>
	<option value="7">7</option>
	<option value="8">8</option>
	<option value="9">9</option>

For example, select the 5th option when my node in XML has the same value
<option value="5" selected="selected">5</option>

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread