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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Select with options in xsl if statement

Status
Not open for further replies.

amillia

Programmer
Nov 14, 2001
124
US
I have the following code in an xsl doc.

<td colspan="17">
<select name="frm" tabindex="1">
<option>
<xsl:attribute name="value"><xsl:value-of select="mci/form"/></xsl:attribute><xsl:value-of select="mci/form"/>
</option>
<option value="ROCK">ROCK</option>
<option value="PEBBLE">PEBBLE</option>
<option value="IRON">IRON</option>
<option value="GRAVEL">GRAVEL</option>
</select><br/>


My question is:
Can I test the frm option = Aspa in an XSL if statement.
 
Not exactly sure what you are asking for. Can you show your input XML document, and restate the question, please?

Tom Morrison
 
The question is not clear, I agree. Just guessing that if you want to check if "mci/form" is of value "Aspa" you want to do something special or not do something, it is like this.
[tt]
<td colspan="17">
<select name="frm" tabindex="1">
<xsl:choose>
<xsl:when test="mci/form = 'Aspa'">
<!-- do nothing -->
</xsl:when>
<xsl:eek:therwise>
<option>
<xsl:attribute name="value">
<xsl:value-of select="mci/form"/>
</xsl:attribute>
<xsl:value-of select="mci/form"/>
</option>
</xsl:eek:therwise>
</xsl:choose>
<option value="ROCK">ROCK</option>
<option value="PEBBLE">PEBBLE</option>
<option value="IRON">IRON</option>
<option value="GRAVEL">GRAVEL</option>
</select><br/>
[/tt]
There is also xsl:if doing similar thing. Upon reflecting, the position of <select> seems odd... but, you should know better.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top