Not sure if I am answering the question right, but I will try :-
I have a html page(xml+xslt) that has a drop down list containing 10 values. When I select a value, ex. ABC, I can perform add or delete or search. Now on every other pages(add, delete, search), i have a home button. When I click it, it goes to home, but the value of drop down is resetted.
How do I retain the value selected by user?
I have the following piece of code, but it is not working not sure why.
I am working on TIBCO BusinessWorks.
<tr > <td>
<select name= "GetRelationCombo">
<xsl:for-each select="resultSet/Record">
<xsl:sort select="REL_NAME" />
<option>
<xsl:attribute name="value">
<xsl:value-of select="REL_NAME" />
</xsl:attribute>
<xsl:value-of select="REL_NAME" />
<xsl:if test="REL_NAME = 'resultSet/RelationshipName'">
<xsl:attribute name="selected">true</xsl:attribute>
</xsl:if>
</option>
</xsl:for-each>
</select>
</td></tr>
This is the input XML:
<?xml version = "1.0" encoding = "UTF-8"?>
<resultSet>
<Record>
<REL_NAME>ShapeID</REL_NAME>
</Record>
<Record>
<REL_NAME>eMPSQPType</REL_NAME>
</Record>
<Record>
<REL_NAME>GERSGLAccount</REL_NAME>
</Record>
<Record>
<REL_NAME>WageType</REL_NAME>
</Record>
<RelationshipName>PLANT</RelationshipName>
</resultSet>
Please help!! I am in middle of something big.
Firstly, any attributes you use need to occur before anything inside an element, so this:
should be above this:
this isn't correct, because it will only be true when REL_NAME actually has the value "resultSet/RelationshipName":
This is the actual condition you need:
Modified XSL:
As a side note, I think the correct value for the selected attribute is "selected", not "true", even though "true" might work anyway.
http://reference.sitepoint.com/html/option/selected