|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Escaping curly braces in an attribute
"Charles White" <chuck@xxxxxxxxxxx> wrote:
> Well, I'm not sure it's a more elegant solution that just writing out the
> attribute element, but you could do this:
>
> <xsl:variable name="leftbrace"><![CDATA[{]]></xsl:variable>
What's the purpose of the CDATA section here? It's not as if you can't
have a curly brace as the content of xsl:variable. This seems like
obfuscation without any practical purpose. And if you really need one of
these as a string, how about:
<xsl:variable name="leftbrace" select="'{'"/>
That's likely more efficient than creating a result tree fragment.
Fortunately, in an AVT, you can escape the { and } characters by having two
of them:
<a href="#" onclick="if (foo == false) {{bar = true; alert('ding');}}
return false">Don't click me</a>
See:
http://www.w3.org/TR/xslt#attribute-value-templates
"When an attribute value template is instantiated, a double left or
right curly brace outside an expression will be replaced by a single
curly brace."
Dave
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
|

Cart








