[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:if / variables / fancy / confusing

Subject: RE: xsl:if / variables / fancy / confusing
From: "Johnathon Wright" <jw@xxxxxxxxxxxxx>
Date: Fri, 18 Nov 2005 09:39:19 -0600
if variables
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 &gt; 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@xxxxxxxxxxxxxxxxxxxxxx>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Subject: RE:  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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.