Search code examples
xsltjsrenderaspdotnetstorefront

XSL keeps stipping my Curly Braces for jsRender


I'm using AspDotNetStorefront (this is why I have to use xsl) and my client would like to be able to sort products in a category. I decided to use tablesorter & use jsrender to render out the template.

I can do everything but create a special link because the xsl is stripping one of my curly braces for the jsrender template.

So I've got an object w/ productImage like /images/blah.jpg and the following works correctly.

<td>{{:productImage}}</td>

Great - so I try to put in in a link:

<td><a href='{{:productImage}}'>See the image</a></td>

And the xsl outputs my template to be:

<td><a href='{:productImage}'>See the image</a></td>

So it's not being rendered correctly. I've tried all kinds of ideas over the last couple hours but cannot get this to work correctly. How do I keep XSL from stipping my curly braces?


Solution

  • XSLT sees the attribute value template in your {}. the spec says:

    a double left or right curly brace outside an expression will be replaced by a single curly brace.

    with that said, doubling the amount of curly braces seems to do the trick. The following node put in the XSLT:

    <something a="{{{{a}}}}"/>
    

    produces the following result tree:

    <something a="{{a}}"/>
    

    UPDATE: the XSLT 2.0 spec has a little more to say about double {{ and }} in the attribute value templates section.