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

RE: nested for-each?

Subject: RE: nested for-each?
From: "Pettigrew, Nancy" <NancyPettigrew@xxxxxxxxxxxxx>
Date: Mon, 24 Jan 2000 17:32:45 -0800
nested for each
Is the xsl:variable not recognized by IE5?
When I add the line to store the value in a variable, the page bombs...

> -----Original Message-----
> From:	Mike Brown [SMTP:mbrown@xxxxxxxxxxxxx]
> Sent:	Tuesday, January 11, 2000 8:55 AM
> To:	'xsl-list@xxxxxxxxxxxxxxxx'
> Cc:	'NancyPettigrew@xxxxxxxxxxxxx'
> Subject:	RE: nested for-each?
> 
> > This chunk of code doesn't work because @stuff is not 
> > recognized by the innermost loop.
> > 
> > <SELECT id="selList" name="selList>
> > 	<xsl:for-each value-of select="/List">
> > 		<OPTION>
> > 		<xsl:attribute name="value"><xsl:value-of
> > select="@stuff"/></xsl:attribute>
> > 			<xsl:for-each select="/Detail">
> > 				<xsl:if test="@detailstuff[.=@stuff]">
> > 					<xsl:attribute name="selected"/>
> > 				</xsl:if>
> > 			</xsl:for-each>
> > 		<xsl:value-of select="@stuff">
> > 		</OPTION>
> > 	</xsl:for-each>
> > </SELECT>
> 
> Creating an attribute named "selected" with no value, for an HTML output
> method, should not produce the intended results. You want to give it a
> value
> of "selected". When output via the HTML method, then, it will be
> interpreted
> as <OPTION selected> instead of <OPTION selected="">.
> 
> > Is there some way to store the value in a variable?
> 
> Yes, that would be the easiest solution. Put
>   <xsl:variable name="stuff" select="@stuff"/>
> prior to the inner xsl:for-each, and then
> change the predicate in the xsl:if to [.=$stuff]
> 
> > Or, some less tedious way to make this work?
> 
> Perhaps replace the inner xsl:for-each with:
>   <xsl:if test="@stuff = /Detail/@detailstuff">
>     <xsl:attribute name="selected">selected</xsl:attribute>
>   </xsl:if>
> 
> Comparing 2 node-sets like this will return true if there are members in
> each set that have the same string value.


 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.