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!

searching a variable for a node element

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
Hi,

Does anyone know how to perform an if statement on a variable, that can have multiple elements within it, to see if it matches the current node?

eg:

$vbl = "a,c,e"

available nodes = "a,b,c,d,e,f"

in a select box, i want to make the a the c and the e elements selected within the select control. i can't see anything that will work within the book that i ahve got

any ideas?

TIA

Tony
 
Well, you will need to use <xsl:attribute name="selected"> to set the selected attribute.

That leaves the test for the <xsl:if>. It would seem that one might use XPath functions contains() and local-name().

I would also revisit the use of a variable. Might there be something else that is more convenient? A better example, including what you have already tried, would be helpful.

Tom Morrison
 
Tom,

Thanks for the response. the compare did it for me. this book i have is rubbish!

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top