Hi,

I'm populating an HTML select box with contents from an XML document.
Here's a snippet of the XML doc:

<months>
 <month name="January" value="01"/>
 <month name="February" value="02"/>
...
</months>

My JSP page parses the XML document and prints out the select box as per
below.  The problem is that the x:when statment doesn't do what I want
it to (i.e. when the month value from the XML doc matches the
monthcurrent value, the select option gets the "selected" value added.

NB: monthcurrent is picked up as the current month number i.e. "01".  

<select name="monthend">
 <x:forEach select="$doc/calendar/months/month" var="m">
   <x:choose>
    <x:when select="@value = monthcurrent">
     <c:set var="selected" value=" selected"/>
    </x:when>
    <x:otherwise>
     <c:set var="selected" value=""/>
    </x:otherwise>
   </x:choose>
   <option value="<x:out select="@value"/>"${selected}><x:out
select="@name"/></option>
 </x:forEach>
</select>

..the output I'm looking for is:

<select name="monthend">
 <option value="01" selected>January</option>
 <option value="02">February</option>
...
</select>

Any idea on what I'm doing wrong?

Thanks

..Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to