Subject: RE: nested for-each?
From: "Carl Soane" <csoane@xxxxxxxxxxxxx>
Date: Mon, 24 Jan 2000 20:12:28 -0800
|
xsl:variable isn't recognized by ie5.
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx [SMTP:owner-xsl-list@xxxxxxxxxxxxxxxx]
On Behalf Of Pettigrew, Nancy
Sent: Monday, January 24, 2000 5:33 PM
To: 'Mike Brown'; 'xsl-list@xxxxxxxxxxxxxxxx'
Subject: 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|