Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • umbracocool 108 posts 197 karma points
    Oct 25, 2012 @ 18:26
    umbracocool
    0

    Xslt error when using attribute "rel"

    Hello friends. I'm working on a project and xslt gave me this error:

    Turns out I have this code:

    <href="javascript:void(0);" 
       rel="{gallery: 'gal2', smallimage: '/images/imagenes/lent1.jpg',largeimage: '/images/imagenes/lent1.jpg'}"
       <img src="/images/imagenes/lent1.jpg" width="100%" alt="" />
    </a>

    When I remove the "rel", works well. I think it is because as use the braces {}, xslt interpretra it otherwise. Any solution to this?

    Thank you!

  • Sean Mooney 131 posts 158 karma points c-trib
    Oct 25, 2012 @ 19:07
    Sean Mooney
    1

    You should use the <xsl:attribute>, something like this:

    <a href="javascript:void(0);">
    <xsl:attribute name="rel">
    {gallery: 'gal2', smallimage: '/images/imagenes/lent1.jpg',largeimage: '/images/imagenes/lent1.jpg'}
    </xsl:attrubute>
    <img src="/images/imagenes/lent1.jpg" width="100%" alt="" />
    </a>

     

  • umbracocool 108 posts 197 karma points
    Oct 25, 2012 @ 19:45
    umbracocool
    0

    Thank yo very much bro!

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Oct 25, 2012 @ 20:17
    Chriztian Steinmeier
    0

    Hi,

    Just for the record - another way would be to escape the curlies by doubling them:

    <a href="javascript:void(0)" rel="{{gallery: 'gal2', smallimage: '/images/imagenes/lent1.jpg',largeimage: '/images/imagenes/lent1.jpg'}}">...</a>

    But of course, when doing lots of JSON, this wouldn't be the ideal way.

    /Chriztian

  • umbracocool 108 posts 197 karma points
    Oct 25, 2012 @ 20:31
    umbracocool
    0

    Oh Yeah! hehe Thank you Cristian!

Please Sign in or register to post replies

Write your reply to:

Draft