[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: for-each question/IE5

Subject: RE: for-each question/IE5
From: Ben Robb <Ben@xxxxxxxxxx>
Date: Tue, 25 Jan 2000 18:35:12 -0000
xsl for each select option
Try something like:

++++++++++++++++++++++++++++

<xsl:for-each select="/MCRoot/Lists/Languages/Language">
   <option>
	<xsl:if test="/MCRoot/Lists/Person/Languages[@value =
context()/@value]">
		<xsl:attribute name="selected">selected</xsl:attribute>
	</xsl:if>
   <xsl:value-of select="@value"/>
   </option>
</xsl:for-each>

++++++++++++++++++++++++++++

<warning>this code was lifted and amended from something I wrote about a
year ago - so no guarantees that it works...*grin*</warning>

Hope it helps - as you can see, if using IE5, the only "nice" way of doing
it is by using the context() function.

> -----Original Message-----
> From: Pettigrew, Nancy [mailto:NancyPettigrew@xxxxxxxxxxxxx]
> Sent: 25 January 2000 18:10
> To: 'xsl-list@xxxxxxxxxxxxxxxx'
> Subject: for-each question/IE5
> 
> 
> With the following XML document, I need to create HTML output 
> that shows all
> the possible Languages as options in a select box, with the Person's
> Languages selected.
> 
> Using a for-each loop, I can populate the select options, no problem.
> However, I am having trouble also checking the Person 
> languages while in
> that loop in order to mark options as selected.
> I'm using IE5 (ack) and apparently, xsl:variable is not supported.
> 
> Does anyone have an idea of how to do this using IE5?  Weird 
> kludgey fixes
> are more than welcome - this is the last page I need to 
> complete, and I'm
> truly at a loss at this point...
> I've tried some comparisons using the $any$ operator, but 
> have had no luck
> with that either.
> 
> Thanks.
> 
> XML:
> <MCRoot>
> 	<Lists>
> 		<Languages>
> 			<Language value="French"/>
> 			<Language value="English"/>
> 			<Language value="German"/>
> 			<Language value="Russian"/>
> 			<Language value="Spanish"/>
> 		</Languages>
> 	</Lists>
> 	<Person>
> 		<Languages>
> 			<Language value="English"/>
> 			<Language value="Spanish"/>
> 		</Languages>
> 	</Person>
> </MCRoot>
> 
> XSL:
> <SELECT size="10">
> <xsl:for-each select="/MCRoot/Lists/Languages/Language">
> 	<OPTION>
> ***** This is where I've been trying to set the selected 
> attribute with no
> luck ********
> 	<xsl:value-of select="@value"/>
> 	</OPTION>
> </xsl:for-each>
> </SELECT>
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.