View Full Version : The character '<' cannot be used in an attribute value
Exodious
12-07-2003, 07:19 PM
<div id="<xsl:value-of select="@name"/>"></div>
Hi, i haven't read the fine print yet, but was wondering how to get an xml value into an attribute and came across the above error, appreciate the help... thx
brothercake
12-07-2003, 07:34 PM
Like this:
<div id="{@name}"></div>
Alex Vincent
12-08-2003, 04:35 AM
As an alternative (this matters for not just XSLT), I'm suggesting the < entity.
<div id="<xsl:value-of select="@name"/>"></div>
Attribute values actually can't have any of the five escaped characters in XML. I only remember 3 at the moment:
<
>
&amp;
Heh, CF encoded that last entity...
liorean
12-08-2003, 03:04 PM
From [XML1.0] <http://www.w3.org/TR/2000/REC-xml-20001006#sec-predefined-ent>:
<!ENTITY lt "&#38;#60;">
<!ENTITY gt "&#62;">
<!ENTITY amp "&#38;#38;">
<!ENTITY apos "&#39;">
<!ENTITY quot "&#34;">
Exodious
12-08-2003, 03:35 PM
xsl is kewl
Originally posted by Alex Vincent
As an alternative (this matters for not just XSLT), I'm suggesting the < entity.
<div id="<xsl:value-of select="@name"/>"></div> Wouldn't you also need to escape the quotes there,
<div id="<xsl:value-of select=\"@name\"/>"></div>
Alex Vincent
12-25-2003, 02:40 AM
Bleh, even I have bad days :)
mattstahl
11-02-2010, 06:45 PM
The following line throws the same error described, but my attempts to correct using thoughts here it have gone for naught. Any "geniac" here have a quick rewrite that will show me what I'm doing wrong? Many thanks.
<param name="text_down" type="text" default="<span>Click Here</span><br /> To Login" label="PLGMMTOPPANELTEXTDOWN" description="PLGMMTOPPANELTEXTDOWNDESCRIPTION" />
MattF
11-02-2010, 08:55 PM
that will show me what I'm doing wrong?
Wrong as in other than using it incorrectly?
http://www.w3schools.com/tags/tag_param.asp
mattstahl
11-02-2010, 09:56 PM
Thank you for your interest. I understand the problem, but am no coder, and simply can't fix it despite many attempts. Have tried to adapt what snippets you guys in the know have offered here, but all attempts have failed miserably. Hoping that you or someone else can show me by visual example where I've gone dense.
MattF
11-02-2010, 10:16 PM
Remove this. It has no place there:
default="<span>Click Here</span><br /> To Login" label="PLGMMTOPPANELTEXTDOWN" description="PLGMMTOPPANELTEXTDOWNDESCRIPTION"
mattstahl
11-02-2010, 10:46 PM
So, I wasted a lot of time trying to fix something that wasn't needed in the first place. Tried everything BUT deleting it. Worked perfectly. Thanks for opening my eyes to the obvious. Will try that FIRST next outing.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.