xsl-list
[Top] [All Lists]

RE: xsl:if / variables / fancy / confusing

2005-11-17 15:37:44
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/
 

-----Original Message-----
From: Johnathon Wright [mailto:jw(_at_)llfitness(_dot_)com] 
Sent: 17 November 2005 21:54
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xsl:if / variables / fancy / confusing

I'm sure someone will be able to chew through this easily. I can not.

I've got

<configuration>
    ...
    <details>
    ...
        <errors>
            <attribute_285>Please select a Color</attribute_286>
            <attribute_297>Please select a Frame Color</attribute_297>
        </errors>
    </details>
...
</configuration>

and what I want to do is change the style of the drop down 
with the same 
name if an error is include in the XSL. This is for form 
validation. If they 
don't select a color, etc., it will come back and display 
that drop-down in 
some obnoxious color.

Here is the code to generate the select statement:

    <xsl:for-each select="attribute">
     <select name="attribute_{attribute_id}">

      <option value="">Select a <xsl:value-of 
select="attribute_name" /> 
</option>
     <xsl:for-each select="option">
      <option value="{option_id}"><xsl:value-of 
select="option_name"/><xsl:if test="price_offset &gt; 0"> - add 
<xsl:value-of select="format-number(price_offset, '$###,###,.00')" 
/></xsl:if></option>
     </xsl:for-each>
        </select>
    </xsl:for-each>

I was thinking:

<select name="attribute_{attribute_id}">
    <xsl:if 
test="/configuration/details/errors/attribute_{attribute_id}">
<xsl:attribute 
name="style">xyz</xsl:attribute></xsl:if>

but it doesn't like that AT ALL.

Just for reference, it will be used on a page like this:

http://www.massageking.com/products/Aphrodite-Wet-Hydraulic/Go
lden-Ratio-Aphrodite-Wet-Hydraulic/858/2/1

Any ideas? 


--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>