XML parsing error: Selecting an item from a HTML drop-down list

XML parsing error: Selecting an item from a HTML drop-down list

Post by Michael Liedtk » Thu, 29 May 2003 09:35:42



Hello,

I am doing an XML/XSL transformation for an XHTML page. I
am dynamically creating a drop down list of states. To pre-
select a state on the list, I need to place "SELECTED"
within the option tag for the desired state. However, the
parser throws an error when it reaches the SELECTED
attribute of the option tag. It claims: This is an
unexpected token. Expected 'EQUALS'. It appears that the
parser is looking for "select=???", and doesn't know about
SELECTED.

Is SELECTED deprecated? Is there another way to pre-select
an item from a drop down list in an XHTML page? Or is this
a parsing error?

My code follows.

Regards,
Michael

<select name="States">
<xsl:for-each select="Table">
<xsl:variable name="StateID" select="StateID"/>

<xsl:choose>
        <xsl:when test="StateID != $CurrentStateID">
                <option value="{$StateID}"><xsl:value-of
select="StateName"/></option>
        </xsl:when>
        <xsl:otherwise>
                <option value="{$StateID}"
SELECTED><xsl:value-of select="StateName"/></option>
        </xsl:otherwise>
</xsl:choose>
<option value="{$StateID}"><xsl:value-of
select="StateName"/></option>

</xsl:for-each>
</select>

 
 
 

XML parsing error: Selecting an item from a HTML drop-down list

Post by Michael Liedtk » Thu, 29 May 2003 09:45:37


Oops, I found the problem...the source was a difference
between XHTML and HTML. A pre-selected item in a drop down
list can be indicated with "SELECTED" in HTML, but in
XHTML "selected="selected"" must be inserted into the
option tag.

Mike

 
 
 

1. Selecting Item in Drop-Down with Item Value????

How does one find the index number of an item in a drop-
down list, using the Item or Item Value.

For instance:

I have one drop-down that is dynamically generated to
show a member list (about 100), which is used when
selecting adding a purchase record.

I display all purchases for a particular day in another
drop-down box. I want to be able to select a name in the
second box, repopulate the sales form and have the member
list display the appropriate name.

I thought it would be as simple as:

DDList_Members.SelectedItems.Value = Rs
["ItemValue"].ToString()

But the list still remains on the first name in the list.

Any help would be appreciated.

2. changing the paper-format

3. retrive preselected value in second drop down list from the first drop down list

4. Socket problem, Irix 5.2 and Oracle 7.0.15

5. Drop down list selected item

6. VBA to matlab?

7. Getting selected item from a drop down list

8. Nokia 6150

9. Drop down list selected item changed event

10. Passing a value to a user control and selecting an item from a drop down list

11. search for items selected in drop down list

12. drop-down list not retaining selected value

13. Removing items from a Drop-down list C#