Copied to clipboard

Flag this post as spam?

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


  • Garrett Fisher 341 posts 496 karma points
    Mar 17, 2010 @ 14:33
    Garrett Fisher
    0

    how to use a dictionary item inside an html attribute

    Having an interesting challenge/problem.  Because of the three sets of quotes, I seem to be unable to write a dictionary item inside an HTML tag attribute:

    <input id="loc" name="loc" type="text" value="<xsl:value-of select='umbraco.library:GetDictionaryItem("Locate Button")' />" />

    I've got the HTML <input value="">, the <xsl:value-of select="", and then the GetDictionaryItem param ("Locate Button").  I am getting an error from my XSLT trying to do this.  Do I need to escape one of these sets?  If so, which ones, and how?? I thought of creating a Macro which takes the Dictionary Item as a param; this would eliminate one set; but the problem there is that I am Already inside a Macro here.

    How to do accomplish this? Seems like someone would have run into the same problem before.  For example, with an <img src=""> or something like that.

    Thanks in advance,

    Garrett

  • dandrayne 1138 posts 2262 karma points
    Mar 17, 2010 @ 14:39
    dandrayne
    2

    If you're already in xslt try

    <input id="loc" name="loc" type="text" >
    <xsl:attribute name="value">
    <xsl:value-of select='umbraco.library:GetDictionaryItem("Locate Button")' />
    </xsl:attribute>
    </input>

    dan

  • Douglas Robar 3570 posts 4671 karma points MVP ∞ admin c-trib
    Mar 17, 2010 @ 15:41
    Douglas Robar
    0

    Be sure to notice Dan's use of single and double quotes.

    You could also use select="umbraco.library:GetDictionaryItem('Locate Button')" if you prefer that.

    cheers,
    doug.

  • Anders Brännmark 220 posts 250 karma points
    Mar 17, 2010 @ 15:52
    Anders Brännmark
    0

    <input id="loc" name="loc" type="text" value="{umbraco.library:GetDictionaryItem('Locate Button')}" />

  • Garrett Fisher 341 posts 496 karma points
    Mar 17, 2010 @ 20:04
    Garrett Fisher
    0

    Thanks to all, but this last one is genius.  I KNEW I was missing something obvious :)  Umbraco forum is the best.

    //Garrett

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies