[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|