Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving values from xslt into select control

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
OK, I would expect this code below to fill in the dropdown list with the enumerated values from the xml schema, and then select the Female element as the currently selected value in the list control.

What actually happens is that all the values go into the list control, but it does not select the default value. (neither into the textbox at the top to show it is selected, or by highlighting the choice when you expand the list.)

Can anyone spot the (not so)deliberate mistake?

Code:
<select name = "ddlGender" id="ddlGender">
    <xsl:for-each select="document('[URL unfurl="true"]http://localhost/xmlproject/bdefinitions.xsd')/xs:schema/xs:simpleType[/URL][@name='gendertype']//xs:enumeration">
     <option value="{@value}">
     <xsl:if test="@value='Female'">
<xsl:attribute name="selected">selected</xsl:attribute>
     </xsl:if>
<xsl:value-of select="@value"/>
     </option>
</xsl:for-each>

k
 
OOps, cos no one answered I didnt post a retraction

For some reason its my PC, when I edit the xslt, I cant just refresh my browser, I need to close it and then re-open it again, and then it works. (I asusme that it is only parsing the xpathonce on loading, adn then ignoring it on a refresh.
But either way, it works.

K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top