This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: if-questioning between two nodes inside an for-each-loop
- To: xsl-list at mulberrytech dot com
- Subject: Re: if-questioning between two nodes inside an for-each-loop
- From: Nick Browne <NickBrowne at slipstone dot co dot uk>
- Date: Fri, 15 Sep 2000 15:23:53 +0100
- Organization: Slipstone Ltd
- References: <2339B88D6AA6D31187A80008C7E6F67230ED37@daemsg01.software-ag.de>
- Reply-To: xsl-list at mulberrytech dot com
Try the following variation of your original :
<xsl:template match="/">
<xsl:variable name="CHOOSE">
<xsl:value-of select="cars/choose"/>
</xsl:variable>
<html>
: etc.
<xsl:for-each select="cars/single">
<option>
<xsl:attribute name="value"><xsl:value-of
select="."/></xsl:attribute>
<xsl:if test=". = $CHOOSE">
<xsl:attribute name="selected">Yes</xsl:attribute>
</xsl:if>
<xsl:value-of select="."/>
</option>
</xsl:for-each>
: etc.
Main changes are :
1. Moving variable assignment to after template.
2. Adding a $ to CHOOSE on if test.
3. Moving attributes so that they are generated before any content is created
for the option element.
Regards
Nick Browne
Slipstone Ltd
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list