[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: if-questioning between two nodes inside an for-each-loop
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
|
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
|