Thanks! I was able to get everything to work properly. I ended up changing
the XML for errors, but I had to use XML similar to that to populate the
drop-downs that had already been selected.
If someone finds this in the archive, watch out for what I did with
populating against previous submissions... I know that option_ids will not
be duplicated for different attribute_ids. If that weren't the case, I would
have had to replace the * with something else.
<xsl:for-each select="attribute">
<select name="attribute_{attribute_id}">
<xsl:if test="/configuration/details/errors/error/name =
concat('attribute_', attribute_id)">
<xsl:attribute name="style">background-color:#FFCC00; color:red;
font-weight:bolder;</xsl:attribute>
</xsl:if>
<option value="">Select a <xsl:value-of select="attribute_name" />
</option>
<xsl:for-each select="option">
<option value="{option_id}">
<xsl:if test="/configuration/request/* = option_id">
<xsl:attribute name="selected">TRUE</xsl:attribute>
</xsl:if>
<xsl:value-of select="option_name"/><xsl:if test="price_offset >
0"> - add <xsl:value-of select="format-number(price_offset,
'$###,###,.00')" /></xsl:if></option>
</xsl:for-each>
</select>
</xsl:for-each>
Hi Johnathon,
You cannot use attribute value templates within attributes that are
expected to contain XPath
expressions themselves. Not a very nice solution, but you could use:
<xsl:if test="/configuration/details/errors/*[local-name() =
concat('attribute_', attribute_id)]">
<xsl:attribute name="style">xyz</xsl:attribute>
</xsl:if>
Regards,
Geert
------------------------------
Date: Thu, 17 Nov 2005 22:37:44 -0000
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] xsl:if / variables / fancy / confusing
Don't try to pack meaning and structure into element names. Instead of
<attribute_285>, use <attribute id="285">. It's much easier to manipulate.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--