Reputation: 3865
I am writing an XSLT file to output some HTML onto a web page (using Sitecore CMS). I am running into a problem with the following:
<a href="../videos/video.flv" class="videolightbox jackie-hover" data="{width:400,height:200}" title="Title goes here">Text goes here</a>
This causes the following error:
Expected token '}', found ':'. {width -->:<-- 400,height:200}
Can anyone tell me how to fix this issue?
Thank you,
b3n
Upvotes: 4
Views: 416
Reputation: 10772
I think the braces are used as a shortcut to evaluating an XSLT function when inside an attribute.
They are called "Attribute Value Templates":
Attribute value templates in XSLT are the XPath expressions that appear in curly braces in attribute values. Without this extremely convenient shortcut, we'd be forced to use the xsl:attribute instruction whenever we needed to dynamically compute an attribute's value.
You can escape them by using {{
and }}
.
This makes your snippet read:
<a href="../videos/video.flv" class="videolightbox jackie-hover" data="{{width:400,height:200}}" title="Title goes here">Text goes here</a>
Upvotes: 6