Subject: RE: nested for-each? From: "Pettigrew, Nancy" <NancyPettigrew@xxxxxxxxxxxxx> Date: Mon, 24 Jan 2000 17:32:45 -0800 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: newbie question: combining two , Marko Draisma | Thread | RE: nested for-each?, Carl Soane |
Re: disable-output-escaping, Scott Boag/CAM/Lotus | Date | Re: C++ libraries for XML/XSL, Keith Visco |
Month |