"Charles White" <chuck(_at_)tumeric(_dot_)net> 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